diff --git a/LICENSES/Biopython.rst b/LICENSES/Biopython.rst new file mode 100644 index 0000000000000000000000000000000000000000..748dd92a95aaeb6c1914a774713d23f51b48c7fa --- /dev/null +++ b/LICENSES/Biopython.rst @@ -0,0 +1,68 @@ +Biopython is currently released under the "Biopython License Agreement" +(given in full below). Unless stated otherwise in individual file headers, +all Biopython's files are under the "Biopython License Agreement". + +Some files are explicitly dual licensed under your choice of the +"Biopython License Agreement" or the "BSD 3-Clause License" (both given +in full below). This is with the intention of later offering all of +Biopython under this dual licensing approach. + + +------------------------------------------------------------------------------ + + +Biopython License Agreement +--------------------------- + +Permission to use, copy, modify, and distribute this software and its +documentation with or without modifications and for any purpose and +without fee is hereby granted, provided that any copyright notices +appear in all copies and that both those copyright notices and this +permission notice appear in supporting documentation, and that the +names of the contributors or copyright holders not be used in +advertising or publicity pertaining to distribution of the software +without specific prior permission. + +THE CONTRIBUTORS AND COPYRIGHT HOLDERS OF THIS SOFTWARE DISCLAIM ALL +WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE +CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT +OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE +OR PERFORMANCE OF THIS SOFTWARE. + + +------------------------------------------------------------------------------ + + +BSD 3-Clause License +-------------------- + +Copyright (c) 1999-2024, The Biopython Contributors +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/LICENSES/COGNI-CC0-1.0.txt b/LICENSES/COGNI-CC0-1.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0e259d42c996742e9e3cba14c677129b2c1b6311 --- /dev/null +++ b/LICENSES/COGNI-CC0-1.0.txt @@ -0,0 +1,121 @@ +Creative Commons Legal Code + +CC0 1.0 Universal + + CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE + LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN + ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS + INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES + REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS + PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM + THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED + HEREUNDER. + +Statement of Purpose + +The laws of most jurisdictions throughout the world automatically confer +exclusive Copyright and Related Rights (defined below) upon the creator +and subsequent owner(s) (each and all, an "owner") of an original work of +authorship and/or a database (each, a "Work"). + +Certain owners wish to permanently relinquish those rights to a Work for +the purpose of contributing to a commons of creative, cultural and +scientific works ("Commons") that the public can reliably and without fear +of later claims of infringement build upon, modify, incorporate in other +works, reuse and redistribute as freely as possible in any form whatsoever +and for any purposes, including without limitation commercial purposes. +These owners may contribute to the Commons to promote the ideal of a free +culture and the further production of creative, cultural and scientific +works, or to gain reputation or greater distribution for their Work in +part through the use and efforts of others. + +For these and/or other purposes and motivations, and without any +expectation of additional consideration or compensation, the person +associating CC0 with a Work (the "Affirmer"), to the extent that he or she +is an owner of Copyright and Related Rights in the Work, voluntarily +elects to apply CC0 to the Work and publicly distribute the Work under its +terms, with knowledge of his or her Copyright and Related Rights in the +Work and the meaning and intended legal effect of CC0 on those rights. + +1. Copyright and Related Rights. A Work made available under CC0 may be +protected by copyright and related or neighboring rights ("Copyright and +Related Rights"). Copyright and Related Rights include, but are not +limited to, the following: + + i. the right to reproduce, adapt, distribute, perform, display, + communicate, and translate a Work; + ii. moral rights retained by the original author(s) and/or performer(s); +iii. publicity and privacy rights pertaining to a person's image or + likeness depicted in a Work; + iv. rights protecting against unfair competition in regards to a Work, + subject to the limitations in paragraph 4(a), below; + v. rights protecting the extraction, dissemination, use and reuse of data + in a Work; + vi. database rights (such as those arising under Directive 96/9/EC of the + European Parliament and of the Council of 11 March 1996 on the legal + protection of databases, and under any national implementation + thereof, including any amended or successor version of such + directive); and +vii. other similar, equivalent or corresponding rights throughout the + world based on applicable law or treaty, and any national + implementations thereof. + +2. Waiver. To the greatest extent permitted by, but not in contravention +of, applicable law, Affirmer hereby overtly, fully, permanently, +irrevocably and unconditionally waives, abandons, and surrenders all of +Affirmer's Copyright and Related Rights and associated claims and causes +of action, whether now known or unknown (including existing as well as +future claims and causes of action), in the Work (i) in all territories +worldwide, (ii) for the maximum duration provided by applicable law or +treaty (including future time extensions), (iii) in any current or future +medium and for any number of copies, and (iv) for any purpose whatsoever, +including without limitation commercial, advertising or promotional +purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each +member of the public at large and to the detriment of Affirmer's heirs and +successors, fully intending that such Waiver shall not be subject to +revocation, rescission, cancellation, termination, or any other legal or +equitable action to disrupt the quiet enjoyment of the Work by the public +as contemplated by Affirmer's express Statement of Purpose. + +3. Public License Fallback. Should any part of the Waiver for any reason +be judged legally invalid or ineffective under applicable law, then the +Waiver shall be preserved to the maximum extent permitted taking into +account Affirmer's express Statement of Purpose. In addition, to the +extent the Waiver is so judged Affirmer hereby grants to each affected +person a royalty-free, non transferable, non sublicensable, non exclusive, +irrevocable and unconditional license to exercise Affirmer's Copyright and +Related Rights in the Work (i) in all territories worldwide, (ii) for the +maximum duration provided by applicable law or treaty (including future +time extensions), (iii) in any current or future medium and for any number +of copies, and (iv) for any purpose whatsoever, including without +limitation commercial, advertising or promotional purposes (the +"License"). The License shall be deemed effective as of the date CC0 was +applied by Affirmer to the Work. Should any part of the License for any +reason be judged legally invalid or ineffective under applicable law, such +partial invalidity or ineffectiveness shall not invalidate the remainder +of the License, and in such case Affirmer hereby affirms that he or she +will not (i) exercise any of his or her remaining Copyright and Related +Rights in the Work or (ii) assert any associated claims and causes of +action with respect to the Work, in either case contrary to Affirmer's +express Statement of Purpose. + +4. Limitations and Disclaimers. + + a. No trademark or patent rights held by Affirmer are waived, abandoned, + surrendered, licensed or otherwise affected by this document. + b. Affirmer offers the Work as-is and makes no representations or + warranties of any kind concerning the Work, express, implied, + statutory or otherwise, including without limitation warranties of + title, merchantability, fitness for a particular purpose, non + infringement, or the absence of latent or other defects, accuracy, or + the present or absence of errors, whether or not discoverable, all to + the greatest extent permissible under applicable law. + c. Affirmer disclaims responsibility for clearing rights of other persons + that may apply to the Work or any use thereof, including without + limitation any person's Copyright and Related Rights in the Work. + Further, Affirmer disclaims responsibility for obtaining any necessary + consents, permissions or other rights required for any use of the + Work. + d. Affirmer understands and acknowledges that Creative Commons is not a + party to this document and has no duty or obligation with respect to + this CC0 or use of the Work. diff --git a/LICENSES/CoolProp-MIT.txt b/LICENSES/CoolProp-MIT.txt new file mode 100644 index 0000000000000000000000000000000000000000..2bcd1175645f85feec6ebdb20beb569c9f5a58c3 --- /dev/null +++ b/LICENSES/CoolProp-MIT.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2012-2018 Ian H. Bell and other CoolProp developers + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/LICENSES/KiMoPack-GPL-3.0.txt b/LICENSES/KiMoPack-GPL-3.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f288702d2fa16d3cdf0035b15a9fcbc552cd88e7 --- /dev/null +++ b/LICENSES/KiMoPack-GPL-3.0.txt @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/LICENSES/OPERA-MIT.txt b/LICENSES/OPERA-MIT.txt new file mode 100644 index 0000000000000000000000000000000000000000..c0ed7bc45f805a175c3c31ede22b5258a044ab5c --- /dev/null +++ b/LICENSES/OPERA-MIT.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2016 kmansouri + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/LICENSES/XrayDB.txt b/LICENSES/XrayDB.txt new file mode 100644 index 0000000000000000000000000000000000000000..f13c78978591225341dfda5ccaafea77c5f44411 --- /dev/null +++ b/LICENSES/XrayDB.txt @@ -0,0 +1,18 @@ +The MIT Licene + +Copyright 2025 Matthew Newville, The University of Chicago, newville@cars.uchicago.edu + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/LICENSES/chemicals-MIT.txt b/LICENSES/chemicals-MIT.txt new file mode 100644 index 0000000000000000000000000000000000000000..d527c74cae8e5f17db669851e1dc4ac3c9de27ac --- /dev/null +++ b/LICENSES/chemicals-MIT.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (C) 2016, 2017, 2018, 2019, 2020, 2021 Caleb Bell + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/LICENSES/openpoly-MIT.txt b/LICENSES/openpoly-MIT.txt new file mode 100644 index 0000000000000000000000000000000000000000..db550b47d9d346237ecb6f368f1ee045791fecd7 --- /dev/null +++ b/LICENSES/openpoly-MIT.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 WangGroupFDU + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/LICENSES/srsinst-rga-MIT.txt b/LICENSES/srsinst-rga-MIT.txt new file mode 100644 index 0000000000000000000000000000000000000000..7e0e131bd61b5486bc11a3bc039a9fda3958a491 --- /dev/null +++ b/LICENSES/srsinst-rga-MIT.txt @@ -0,0 +1,21 @@ +The MIT License + +Copyright (c) 2022, 2023 Stanford Research Systems + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/LICENSES/teMatDb-MIT.txt b/LICENSES/teMatDb-MIT.txt new file mode 100644 index 0000000000000000000000000000000000000000..f8405b1102aa0be74b2371016b8cfd97d6961b29 --- /dev/null +++ b/LICENSES/teMatDb-MIT.txt @@ -0,0 +1,20 @@ +> ⚠️ Note: This repository depends on [`pykeri`](https://github.com/byungkiryu/teMatDb/tree/main/pykeri), which is developed and licensed separately. See the pykeri repository for more details. + + +MIT License + +Copyright (c) 2025 Byungki Ryu + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. diff --git a/catalog/catalog.csv b/catalog/catalog.csv new file mode 100644 index 0000000000000000000000000000000000000000..87a78790e6842d99812196decdfbbd5fd3e61f7b --- /dev/null +++ b/catalog/catalog.csv @@ -0,0 +1,199 @@ +id,chem_id,name,maker,model,name_zh,domain_name,path,n_components,n_joints,n_state_slots,n_capabilities,n_readouts,n_interface_points,n_sources,output_templates,size_x_m,size_y_m,size_z_m,glb,urdf,contract +instrument.mt_xpr204e,CHEM-001,Analytical balance,METTLER TOLEDO,XPR204E,CHEM-001 分析天平(METTLER TOLEDO XPR204E目标;PX224E功能族几何),Basic Metrology & Sample Handling,assets/basic40_batch02/t4_measure/mt_xpr204e,25,16,22,9,1,1,14,False,0.209,0.3286,0.309,assets/basic40_batch02/t4_measure/mt_xpr204e/model.glb,assets/basic40_batch02/t4_measure/mt_xpr204e/model.urdf,assets/basic40_batch02/t4_measure/mt_xpr204e/asset.contract.json +instrument.mt_hx204,CHEM-002,Halogen moisture analyzer,METTLER TOLEDO,HX204,METTLER TOLEDO HX204 卤素水分测定仪,Basic Metrology & Sample Handling,assets/expansion_batch04/t4_measure/mt_hx204,56,5,14,8,2,1,6,False,0.2309,0.597,0.1437,assets/expansion_batch04/t4_measure/mt_hx204/model.glb,assets/expansion_batch04/t4_measure/mt_hx204/model.urdf,assets/expansion_batch04/t4_measure/mt_hx204/asset.contract.json +instrument.antonpaar_dma5002,CHEM-003,Oscillating U-tube density meter,Anton Paar,DMA 5002,Anton Paar DMA 5002振动管液体密度计,Basic Metrology & Sample Handling,assets/expansion_batch03/t4_measure/antonpaar_dma5002,39,4,17,9,2,2,5,False,0.3607,0.5298,0.252,assets/expansion_batch03/t4_measure/antonpaar_dma5002/model.glb,assets/expansion_batch03/t4_measure/antonpaar_dma5002/model.urdf,assets/expansion_batch03/t4_measure/antonpaar_dma5002/asset.contract.json +instrument.antonpaar_abbematadvanced,CHEM-004,Digital refractometer,Anton Paar,Abbemat Advanced 5201,Anton Paar Abbemat Advanced 5201数字折射仪,Basic Metrology & Sample Handling,assets/expansion_batch03/t4_measure/antonpaar_abbematadvanced,38,5,19,10,3,1,5,False,0.2261,0.3338,0.1242,assets/expansion_batch03/t4_measure/antonpaar_abbematadvanced/model.glb,assets/expansion_batch03/t4_measure/antonpaar_abbematadvanced/model.urdf,assets/expansion_batch03/t4_measure/antonpaar_abbematadvanced/asset.contract.json +instrument.metrohm_914,CHEM-005,pH / DO / conductivity meter,Metrohm,914 pH/DO/Conductometer,CHEM-005 多参数电化学水质测定仪 — Metrohm 914 pH/DO/Conductometer,Basic Metrology & Sample Handling,assets/basic40_batch02/t4_measure/metrohm_914,11,3,44,11,0,0,7,False,0.2062,0.208,0.0551,assets/basic40_batch02/t4_measure/metrohm_914/model.glb,assets/basic40_batch02/t4_measure/metrohm_914/model.urdf,assets/basic40_batch02/t4_measure/metrohm_914/asset.contract.json +instrument.mt_mp70,CHEM-006,Automatic melting-point system,METTLER TOLEDO,MP70,METTLER TOLEDO MP70自动熔点仪,Basic Metrology & Sample Handling,assets/expansion_batch03/t4_measure/mt_mp70,51,4,26,10,3,4,6,False,0.1806,0.3519,0.19,assets/expansion_batch03/t4_measure/mt_mp70/model.glb,assets/expansion_batch03/t4_measure/mt_mp70/model.urdf,assets/expansion_batch03/t4_measure/mt_mp70/asset.contract.json +instrument.aqualab_4te,CHEM-007,Water-activity meter,AQUALAB,4TE,AQUALAB 4TE水活度仪,Basic Metrology & Sample Handling,assets/expansion_batch04/t4_measure/aqualab_4te,39,10,27,13,2,1,6,False,0.267,0.184,0.129,assets/expansion_batch04/t4_measure/aqualab_4te/model.glb,assets/expansion_batch04/t4_measure/aqualab_4te/model.urdf,assets/expansion_batch04/t4_measure/aqualab_4te/asset.contract.json +instrument.ika_plate_rctdigital,CHEM-008,Magnetic hotplate stirrer,IKA,Plate RCT digital,磁力加热搅拌器IKA Plate (RCT digital)(25004601,附PT1000),Basic Metrology & Sample Handling,assets/expansion_batch05/t4_measure/ika_plate_rctdigital,31,8,33,33,13,7,14,True,0.16,0.27,0.0849,assets/expansion_batch05/t4_measure/ika_plate_rctdigital/model.glb,assets/expansion_batch05/t4_measure/ika_plate_rctdigital/model.urdf,assets/expansion_batch05/t4_measure/ika_plate_rctdigital/asset.contract.json +instrument.ika_ks4000,CHEM-009,Incubated orbital shaker,IKA,KS 4000 i control,IKA KS 4000 i control恒温轨道摇床,Basic Metrology & Sample Handling,assets/expansion_batch03/t4_measure/ika_ks4000,48,14,33,14,3,9,7,False,0.58,0.75,0.52,assets/expansion_batch03/t4_measure/ika_ks4000/model.glb,assets/expansion_batch03/t4_measure/ika_ks4000/model.urdf,assets/expansion_batch03/t4_measure/ika_ks4000/asset.contract.json +instrument.eppendorf_5910ri,CHEM-010,Refrigerated multipurpose centrifuge,Eppendorf,5910 Ri,CHEM-010 冷冻多用途离心机 Eppendorf 5910 Ri,Basic Metrology & Sample Handling,assets/basic40_batch02/t3_analytical/eppendorf_5910ri,16,2,23,13,2,24,11,False,0.72,0.68,0.37,assets/basic40_batch02/t3_analytical/eppendorf_5910ri/model.glb,assets/basic40_batch02/t3_analytical/eppendorf_5910ri/model.urdf,assets/basic40_batch02/t3_analytical/eppendorf_5910ri/asset.contract.json +instrument.binder_fd056,CHEM-011,Forced-convection drying oven,BINDER,FD 56,强制对流干燥箱BINDER FD 56(FD056-230V,标准配置),Basic Metrology & Sample Handling,assets/expansion_batch05/t4_measure/binder_fd056,34,7,25,32,6,8,15,True,0.564,0.6425,0.625,assets/expansion_batch05/t4_measure/binder_fd056/model.glb,assets/expansion_batch05/t4_measure/binder_fd056/model.urdf,assets/expansion_batch05/t4_measure/binder_fd056/asset.contract.json +instrument.binder_vd56,CHEM-012,Vacuum drying oven,BINDER,VD 56,BINDER VD 56 真空干燥箱(标准单铝搁板配置),Basic Metrology & Sample Handling,assets/basic40_batch02/t1_thermal/binder_vd56,24,7,10,6,1,6,14,False,0.638,0.538,0.815,assets/basic40_batch02/t1_thermal/binder_vd56/model.glb,assets/basic40_batch02/t1_thermal/binder_vd56/model.urdf,assets/basic40_batch02/t1_thermal/binder_vd56/asset.contract.json +instrument.elma_elmasonics60h,CHEM-013,Ultrasonic cleaning bath,Elma,Elmasonic S60H,Elma Elmasonic S60H原版超声清洗槽,Basic Metrology & Sample Handling,assets/expansion_batch03/t4_measure/elma_elmasonics60h,38,8,56,15,26,2,5,False,0.365,0.2104,0.2727,assets/expansion_batch03/t4_measure/elma_elmasonics60h/model.glb,assets/expansion_batch03/t4_measure/elma_elmasonics60h/model.urdf,assets/expansion_batch03/t4_measure/elma_elmasonics60h/asset.contract.json +instrument.hach_tl2300epa,CHEM-014,Benchtop turbidimeter,Hach,TL2300 EPA,Hach TL2300 EPA钨灯台式浊度仪,Basic Metrology & Sample Handling,assets/expansion_batch03/t4_measure/hach_tl2300epa,33,2,26,11,3,2,7,False,0.3956,0.309,0.1534,assets/expansion_batch03/t4_measure/hach_tl2300epa/model.glb,assets/expansion_batch03/t4_measure/hach_tl2300epa/model.urdf,assets/expansion_batch03/t4_measure/hach_tl2300epa/asset.contract.json +instrument.antonpaar_monowave400,CHEM-015,Microwave synthesis reactor,Anton Paar,Monowave 400,Anton Paar Monowave 400微波合成反应器,Reaction & Molecular Synthesis,assets/expansion_batch03/t5_automation/antonpaar_monowave400,40,3,32,12,3,2,11,False,0.4204,0.5594,0.3102,assets/expansion_batch03/t5_automation/antonpaar_monowave400/model.glb,assets/expansion_batch03/t5_automation/antonpaar_monowave400/model.urdf,assets/expansion_batch03/t5_automation/antonpaar_monowave400/asset.contract.json +instrument.ika_electrasyn2,CHEM-016,Electro-organic synthesis system,IKA,ElectraSyn 2.0,IKA ElectraSyn 2.0 Package电有机合成仪,Reaction & Molecular Synthesis,assets/expansion_batch03/t5_automation/ika_electrasyn2,36,2,40,12,4,1,10,False,0.13,0.2509,0.15,assets/expansion_batch03/t5_automation/ika_electrasyn2/model.glb,assets/expansion_batch03/t5_automation/ika_electrasyn2/model.urdf,assets/expansion_batch03/t5_automation/ika_electrasyn2/asset.contract.json +instrument.hepatochem_photoredoxbox,CHEM-017,Photochemical reactor,HepatoChem,PhotoRedOx Box UV-Vis,HepatoChem PhotoRedOx Box UV-Vis HCK1022-01-001受控光反应器,Reaction & Molecular Synthesis,assets/expansion_batch03/t5_automation/hepatochem_photoredoxbox,62,3,36,15,3,8,7,False,0.3556,0.3556,0.3048,assets/expansion_batch03/t5_automation/hepatochem_photoredoxbox/model.glb,assets/expansion_batch03/t5_automation/hepatochem_photoredoxbox/model.urdf,assets/expansion_batch03/t5_automation/hepatochem_photoredoxbox/asset.contract.json +instrument.parr_4591,CHEM-018,Micro high-pressure stirred reactor,Parr Instrument,4591,微型高压搅拌反应釜 Parr Instrument 4591(标准FKM密封),Reaction & Molecular Synthesis,assets/basic40_batch02/t1_thermal/parr_4591,30,9,22,10,1,1,10,False,0.3048,0.4572,0.6858,assets/basic40_batch02/t1_thermal/parr_4591/model.glb,assets/basic40_batch02/t1_thermal/parr_4591/model.urdf,assets/basic40_batch02/t1_thermal/parr_4591/asset.contract.json +instrument.syrris_asiadiscovery,CHEM-019,Continuous-flow chemistry system,Syrris,Asia Discovery,Syrris Asia Discovery Regular 连续流化学合成系统,Reaction & Molecular Synthesis,assets/expansion_batch03/t5_automation/syrris_asiadiscovery,66,4,38,13,3,11,16,False,1.23,0.3103,0.48,assets/expansion_batch03/t5_automation/syrris_asiadiscovery/model.glb,assets/expansion_batch03/t5_automation/syrris_asiadiscovery/model.urdf,assets/expansion_batch03/t5_automation/syrris_asiadiscovery/asset.contract.json +instrument.thalesnano_hcube,CHEM-020,Continuous-flow hydrogenation reactor,ThalesNano,H-Cube Pro,ThalesNano H-Cube Pro 连续流催化加氢仪,Reaction & Molecular Synthesis,assets/expansion_batch03/t5_automation/thalesnano_hcube,70,5,41,17,3,6,11,False,0.4962,0.5095,0.2745,assets/expansion_batch03/t5_automation/thalesnano_hcube/model.glb,assets/expansion_batch03/t5_automation/thalesnano_hcube/model.urdf,assets/expansion_batch03/t5_automation/thalesnano_hcube/asset.contract.json +instrument.radleys_mya4,CHEM-021,Parallel reaction station (4 independent zones),Radleys,Mya 4,独立温区并行反应工作站 Radleys Mya 4,Reaction & Molecular Synthesis,assets/basic40_batch02/t1_thermal/radleys_mya4,33,4,92,15,4,4,12,False,0.6,0.611,0.4992,assets/basic40_batch02/t1_thermal/radleys_mya4/model.glb,assets/basic40_batch02/t1_thermal/radleys_mya4/model.urdf,assets/basic40_batch02/t1_thermal/radleys_mya4/asset.contract.json +instrument.cem_libertyblue,CHEM-022,Automated microwave peptide synthesizer,CEM,Liberty Blue 2.0,CEM Liberty Blue 2.0 自动固相多肽合成仪,Reaction & Molecular Synthesis,assets/expansion_batch03/t5_automation/cem_libertyblue,103,2,34,13,3,47,15,False,1.15,0.52,0.78,assets/expansion_batch03/t5_automation/cem_libertyblue/model.glb,assets/expansion_batch03/t5_automation/cem_libertyblue/model.urdf,assets/expansion_batch03/t5_automation/cem_libertyblue/asset.contract.json +instrument.cytiva_ktaoligosynt,CHEM-023,Oligonucleotide synthesizer,Cytiva,ÄKTA oligosynt,Cytiva ÄKTA oligosynt 寡核苷酸合成仪,Reaction & Molecular Synthesis,assets/expansion_batch03/t5_automation/cytiva_ktaoligosynt,116,3,31,12,3,53,15,False,0.7,0.54,0.63,assets/expansion_batch03/t5_automation/cytiva_ktaoligosynt/model.glb,assets/expansion_batch03/t5_automation/cytiva_ktaoligosynt/model.urdf,assets/expansion_batch03/t5_automation/cytiva_ktaoligosynt/asset.contract.json +instrument.ika_rv10_digital_v,CHEM-024,Rotary evaporator,IKA,RV 10 digital V,IKA RV 10 digital V 旋转蒸发仪,"Extraction, Purification & Drying",assets/basic40_batch02/t2_vacuum/ika_rv10,23,5,26,10,2,2,13,False,0.5,0.44,0.6822,assets/basic40_batch02/t2_vacuum/ika_rv10/model.glb,assets/basic40_batch02/t2_vacuum/ika_rv10/model.urdf,assets/basic40_batch02/t2_vacuum/ika_rv10/asset.contract.json +instrument.buchi_lyovapor_l250_pro,CHEM-025,Freeze dryer,BUCHI,Lyovapor L-250 Pro,冷冻干燥机 BUCHI Lyovapor L-250 Pro,"Extraction, Purification & Drying",assets/basic40_batch02/t2_vacuum/buchi_lyovapor_l250,14,3,34,13,3,4,8,False,0.503,0.645,0.9275,assets/basic40_batch02/t2_vacuum/buchi_lyovapor_l250/model.glb,assets/basic40_batch02/t2_vacuum/buchi_lyovapor_l250/model.urdf,assets/basic40_batch02/t2_vacuum/buchi_lyovapor_l250/asset.contract.json +instrument.buchi_minispray,CHEM-026,Lab spray dryer,BUCHI,Mini Spray Dryer S-300,BUCHI Mini Spray Dryer S-300 实验室喷雾干燥机,"Extraction, Purification & Drying",assets/expansion_batch03/t2_vacuum/buchi_minispray,62,2,26,16,3,13,11,False,0.62,0.64,1.052,assets/expansion_batch03/t2_vacuum/buchi_minispray/model.glb,assets/expansion_batch03/t2_vacuum/buchi_minispray/model.urdf,assets/expansion_batch03/t2_vacuum/buchi_minispray/asset.contract.json +instrument.tousimis_autosamdri815,CHEM-027,Critical point dryer,Tousimis,Autosamdri-815 Series B,Tousimis Autosamdri-815 Series B 8779C 临界点干燥仪,"Extraction, Purification & Drying",assets/expansion_batch03/t2_vacuum/tousimis_autosamdri815,66,2,30,13,3,8,12,False,0.598,0.546,0.32,assets/expansion_batch03/t2_vacuum/tousimis_autosamdri815/model.glb,assets/expansion_batch03/t2_vacuum/tousimis_autosamdri815/model.urdf,assets/expansion_batch03/t2_vacuum/tousimis_autosamdri815/asset.contract.json +instrument.buchi_speedextractore,CHEM-028,Pressurized solvent extractor,BUCHI,SpeedExtractor E-916,BUCHI SpeedExtractor E-916 六位四溶剂加压萃取仪,"Extraction, Purification & Drying",assets/expansion_batch03/t2_vacuum/buchi_speedextractore,138,4,33,14,3,24,14,False,0.67,0.5,0.725,assets/expansion_batch03/t2_vacuum/buchi_speedextractore/model.glb,assets/expansion_batch03/t2_vacuum/buchi_speedextractore/model.urdf,assets/expansion_batch03/t2_vacuum/buchi_speedextractore/asset.contract.json +instrument.gilson_cpc250,CHEM-029,Centrifugal partition chromatograph,Gilson,CPC 250,Gilson CPC250与PLC2050液液分配纯化系统,"Extraction, Purification & Drying",assets/expansion_batch03/t2_vacuum/gilson_cpc250,256,3,28,10,3,202,11,False,1.39,0.59,0.66,assets/expansion_batch03/t2_vacuum/gilson_cpc250/model.glb,assets/expansion_batch03/t2_vacuum/gilson_cpc250/model.urdf,assets/expansion_batch03/t2_vacuum/gilson_cpc250/asset.contract.json +instrument.sartorius_vivaflow200,CHEM-030,Tangential-flow ultrafiltration module,Sartorius,Vivaflow 200,Sartorius Vivaflow200单盒切向流超滤组件,"Extraction, Purification & Drying",assets/expansion_batch03/t2_vacuum/sartorius_vivaflow200,48,1,33,10,0,4,14,False,0.1808,0.038,0.2025,assets/expansion_batch03/t2_vacuum/sartorius_vivaflow200/model.glb,assets/expansion_batch03/t2_vacuum/sartorius_vivaflow200/model.urdf,assets/expansion_batch03/t2_vacuum/sartorius_vivaflow200/asset.contract.json +instrument.biotage_extrahera_classic,CHEM-031,Automated solid-phase extraction workstation,Biotage,Extrahera Classic,Biotage Extrahera Classic 自动固相萃取工作站,"Extraction, Purification & Drying",assets/basic40_batch02/t2_vacuum/biotage_extrahera,24,0,30,10,0,3,14,False,0.86,0.57,0.73,assets/basic40_batch02/t2_vacuum/biotage_extrahera/model.glb,assets/basic40_batch02/t2_vacuum/biotage_extrahera/model.urdf,assets/basic40_batch02/t2_vacuum/biotage_extrahera/asset.contract.json +instrument.sft_sft110,CHEM-032,Supercritical fluid extractor,Supercritical Fluid Technologies,SFT-110,SFT110超临界流体萃取仪100mL配置,"Extraction, Purification & Drying",assets/expansion_batch03/t2_vacuum/sft_sft110,64,3,30,13,3,6,11,False,0.29,0.57,0.76,assets/expansion_batch03/t2_vacuum/sft_sft110/model.glb,assets/expansion_batch03/t2_vacuum/sft_sft110/model.urdf,assets/expansion_batch03/t2_vacuum/sft_sft110/asset.contract.json +instrument.syrris_asiafllex,CHEM-033,Flow liquid–liquid extraction module,Syrris,Asia FLLEX,Asia FLLEX连续流液液萃取模块,"Extraction, Purification & Drying",assets/expansion_batch03/t2_vacuum/syrris_asiafllex,58,2,42,15,1,6,14,False,0.16,0.3032,0.13,assets/expansion_batch03/t2_vacuum/syrris_asiafllex/model.glb,assets/expansion_batch03/t2_vacuum/syrris_asiafllex/model.urdf,assets/expansion_batch03/t2_vacuum/syrris_asiafllex/asset.contract.json +instrument.biotage_selekt,CHEM-034,Automated flash chromatography system,Biotage,"Selekt (UV, single bed)",Biotage Selekt双通道单床UV快速制备色谱仪,"Extraction, Purification & Drying",assets/expansion_batch03/t2_vacuum/biotage_selekt,200,3,55,15,4,151,12,False,0.335,0.393,0.545,assets/expansion_batch03/t2_vacuum/biotage_selekt/model.glb,assets/expansion_batch03/t2_vacuum/biotage_selekt/model.urdf,assets/expansion_batch03/t2_vacuum/biotage_selekt/asset.contract.json +instrument.pccell_ed64002,CHEM-035,Lab electrodialysis stack,PCCell,ED 64002 + BED1-2 Basic,PCCell ED64002 / BED1-2 Basic实验室电渗析组件,"Extraction, Purification & Drying",assets/expansion_batch03/t2_vacuum/pccell_ed64002,112,3,28,14,2,10,11,False,0.8,0.36,0.3412,assets/expansion_batch03/t2_vacuum/pccell_ed64002/model.glb,assets/expansion_batch03/t2_vacuum/pccell_ed64002/model.urdf,assets/expansion_batch03/t2_vacuum/pccell_ed64002/asset.contract.json +instrument.genevac_mivac2,CHEM-036,Centrifugal vacuum concentrator,Genevac / SP Industries,miVac 2 Duo,Genevac miVac 2 Duo离心真空浓缩仪 Rev00101/25,"Extraction, Purification & Drying",assets/expansion_batch03/t2_vacuum/genevac_mivac2,52,9,22,13,2,8,12,False,0.3605,0.4567,0.3002,assets/expansion_batch03/t2_vacuum/genevac_mivac2/model.glb,assets/expansion_batch03/t2_vacuum/genevac_mivac2/model.urdf,assets/expansion_batch03/t2_vacuum/genevac_mivac2/asset.contract.json +instrument.pilodist_pilodist104,CHEM-037,High-efficiency lab fractional distillation unit,PILODIST,PILODIST 104,PILODIST104高效实验室精馏装置6L90板规格,"Extraction, Purification & Drying",assets/expansion_batch03/t2_vacuum/pilodist_pilodist104,95,4,24,15,2,12,14,False,1.6,0.5,2.7,assets/expansion_batch03/t2_vacuum/pilodist_pilodist104/model.glb,assets/expansion_batch03/t2_vacuum/pilodist_pilodist104/model.urdf,assets/expansion_batch03/t2_vacuum/pilodist_pilodist104/asset.contract.json +instrument.uic_kdl1basic,CHEM-038,Short-path wiped-film molecular still,UIC,KDL1 Basic,UIC KDL1 Basic 刮膜短程分子蒸馏装置,"Extraction, Purification & Drying",assets/expansion_batch03/t2_vacuum/uic_kdl1basic,74,5,30,17,1,13,23,False,0.8,0.4,1.2,assets/expansion_batch03/t2_vacuum/uic_kdl1basic/model.glb,assets/expansion_batch03/t2_vacuum/uic_kdl1basic/model.urdf,assets/expansion_batch03/t2_vacuum/uic_kdl1basic/asset.contract.json +instrument.scp_digiprepms,CHEM-039,Graphite block digestion system,SCP SCIENCE,DigiPREP MS,SCP SCIENCE DigiPREP MS 010-500-205 石墨块消解仪,Digestion & Solid Sample Prep,assets/expansion_batch03/t1_thermal/scp_digiprepms,112,2,24,13,0,50,13,False,0.49,0.4006,0.18,assets/expansion_batch03/t1_thermal/scp_digiprepms/model.glb,assets/expansion_batch03/t1_thermal/scp_digiprepms/model.urdf,assets/expansion_batch03/t1_thermal/scp_digiprepms/asset.contract.json +instrument.retsch_pm100,CHEM-040,Planetary ball mill,RETSCH,PM 100,RETSCH PM 100 单工位行星式球磨仪,Digestion & Solid Sample Prep,assets/expansion_batch03/t1_thermal/retsch_pm100,72,8,24,13,1,3,5,False,0.64,0.432,0.48,assets/expansion_batch03/t1_thermal/retsch_pm100/model.glb,assets/expansion_batch03/t1_thermal/retsch_pm100/model.urdf,assets/expansion_batch03/t1_thermal/retsch_pm100/asset.contract.json +instrument.retsch_as200,CHEM-041,Vibratory sieve shaker,RETSCH,AS 200 control,RETSCH AS 200 control 振动筛分仪,Digestion & Solid Sample Prep,assets/expansion_batch03/t1_thermal/retsch_as200,61,16,24,20,3,4,7,False,0.417,0.3895,0.842,assets/expansion_batch03/t1_thermal/retsch_as200/model.glb,assets/expansion_batch03/t1_thermal/retsch_as200/model.urdf,assets/expansion_batch03/t1_thermal/retsch_as200/asset.contract.json +instrument.retsch_pt100,CHEM-042,Rotary sample divider,RETSCH,PT 100,RETSCH PT100旋转缩分仪与DR100,Digestion & Solid Sample Prep,assets/expansion_batch03/t1_thermal/retsch_pt100,74,15,25,21,2,5,9,False,0.582,0.42,0.9115,assets/expansion_batch03/t1_thermal/retsch_pt100/model.glb,assets/expansion_batch03/t1_thermal/retsch_pt100/model.urdf,assets/expansion_batch03/t1_thermal/retsch_pt100/asset.contract.json +instrument.ika_t25,CHEM-043,Rotor–stator disperser,IKA,T 25 digital ULTRA-TURRAX,IKA T25digital转子定子分散机,Digestion & Solid Sample Prep,assets/expansion_batch03/t1_thermal/ika_t25,34,4,30,16,1,4,8,False,0.32,0.3,0.628,assets/expansion_batch03/t1_thermal/ika_t25/model.glb,assets/expansion_batch03/t1_thermal/ika_t25/model.urdf,assets/expansion_batch03/t1_thermal/ika_t25/asset.contract.json +instrument.sonics_vcx750,CHEM-044,Probe ultrasonic processor,Sonics,VCX 750,Sonics VCX750探头式超声处理器,Digestion & Solid Sample Prep,assets/expansion_batch03/t1_thermal/sonics_vcx750,66,25,34,19,4,5,7,False,0.52,0.3679,0.49,assets/expansion_batch03/t1_thermal/sonics_vcx750/model.glb,assets/expansion_batch03/t1_thermal/sonics_vcx750/model.urdf,assets/expansion_batch03/t1_thermal/sonics_vcx750/asset.contract.json +instrument.thinky_are310s,CHEM-045,Planetary centrifugal mixer,THINKY,ARE-310,THINKY ARE-310S-UL行星离心混合脱泡机,Digestion & Solid Sample Prep,assets/expansion_batch03/t1_thermal/thinky_are310s,40,10,33,14,2,5,9,False,0.4279,0.336,0.3808,assets/expansion_batch03/t1_thermal/thinky_are310s/model.glb,assets/expansion_batch03/t1_thermal/thinky_are310s/model.urdf,assets/expansion_batch03/t1_thermal/thinky_are310s/asset.contract.json +instrument.metrohm_909uv,CHEM-046,UV digester,Metrohm,909 UV Digester,Metrohm909UV紫外消解仪,Digestion & Solid Sample Prep,assets/expansion_batch03/t1_thermal/metrohm_909uv,72,10,31,17,3,14,6,False,0.33,0.31,0.5,assets/expansion_batch03/t1_thermal/metrohm_909uv/model.glb,assets/expansion_batch03/t1_thermal/metrohm_909uv/model.urdf,assets/expansion_batch03/t1_thermal/metrohm_909uv/asset.contract.json +instrument.multiwave_7101,CHEM-047,Microwave acid digestion system,Anton Paar,Multiwave 7101,微波酸消解仪 Anton Paar Multiwave 7101(24×8 mL架),Digestion & Solid Sample Prep,assets/basic40_batch02/t1_thermal/multiwave_7101,44,1,16,11,1,0,13,False,0.497,0.742,0.47,assets/basic40_batch02/t1_thermal/multiwave_7101/model.glb,assets/basic40_batch02/t1_thermal/multiwave_7101/model.urdf,assets/basic40_batch02/t1_thermal/multiwave_7101/asset.contract.json +instrument.velp_udk159,CHEM-048,Automatic Kjeldahl distillation & titration unit,VELP,UDK 159,VELP UDK159自动蒸汽蒸馏滴定仪,Digestion & Solid Sample Prep,assets/expansion_batch03/t1_thermal/velp_udk159,57,6,34,18,3,9,10,False,0.385,0.416,0.78,assets/expansion_batch03/t1_thermal/velp_udk159/model.glb,assets/expansion_batch03/t1_thermal/velp_udk159/model.urdf,assets/expansion_batch03/t1_thermal/velp_udk159/asset.contract.json +instrument.buchi_hydrolexh,CHEM-049,Acid hydrolysis unit,BUCHI,HydrolEx H-506,BUCHI HydrolEx H-506酸水解前处理仪,Digestion & Solid Sample Prep,assets/expansion_batch03/t1_thermal/buchi_hydrolexh,92,10,25,19,0,16,12,False,0.312,0.614,0.47,assets/expansion_batch03/t1_thermal/buchi_hydrolexh/model.glb,assets/expansion_batch03/t1_thermal/buchi_hydrolexh/model.urdf,assets/expansion_batch03/t1_thermal/buchi_hydrolexh/asset.contract.json +instrument.malvern_leneo,CHEM-050,Automated fusion bead maker,Malvern Panalytical / Claisse,LeNeo,Malvern Panalytical Claisse LeNeo自动熔融制样仪,Digestion & Solid Sample Prep,assets/expansion_batch03/t1_thermal/malvern_leneo,70,6,20,15,3,5,6,False,0.5563,0.5737,0.52,assets/expansion_batch03/t1_thermal/malvern_leneo/model.glb,assets/expansion_batch03/t1_thermal/malvern_leneo/model.urdf,assets/expansion_batch03/t1_thermal/malvern_leneo/asset.contract.json +instrument.specac_atlasmanual,CHEM-051,Hydraulic pellet press,Specac,Atlas Manual 15T,Specac Atlas Manual15T液压粉末压片机,Digestion & Solid Sample Prep,assets/expansion_batch03/t1_thermal/specac_atlasmanual,57,9,27,16,0,3,6,False,0.31,0.19,0.61,assets/expansion_batch03/t1_thermal/specac_atlasmanual/model.glb,assets/expansion_batch03/t1_thermal/specac_atlasmanual/model.urdf,assets/expansion_batch03/t1_thermal/specac_atlasmanual/asset.contract.json +instrument.buchi_encapsulatorb,CHEM-052,Vibrating-nozzle encapsulator,BUCHI,Encapsulator B-390,BUCHI Encapsulator B-390振动喷嘴微胶囊制备仪,Thin-Film & Functional Materials,assets/expansion_batch04/t5_automation/buchi_encapsulatorb,53,8,30,23,4,10,6,False,0.435,0.34,0.29,assets/expansion_batch04/t5_automation/buchi_encapsulatorb/model.glb,assets/expansion_batch04/t5_automation/buchi_encapsulatorb/model.urdf,assets/expansion_batch04/t5_automation/buchi_encapsulatorb/asset.contract.json +instrument.ossila_spincoater,CHEM-053,Spin coater,Ossila,Spin Coater V3,Ossila Spin Coater Standard V3 L2001A3旋涂机,Thin-Film & Functional Materials,assets/expansion_batch04/t5_automation/ossila_spincoater,45,15,13,12,3,4,7,False,0.171,0.234,0.1399,assets/expansion_batch04/t5_automation/ossila_spincoater/model.glb,assets/expansion_batch04/t5_automation/ossila_spincoater/model.urdf,assets/expansion_batch04/t5_automation/ossila_spincoater/asset.contract.json +instrument.ossila_dipcoater,CHEM-054,Dip coater,Ossila,Dip Coater V2,Ossila Dip Coater V2 L2006A2(手册2.0.A),Thin-Film & Functional Materials,assets/expansion_batch04/t5_automation/ossila_dipcoater,45,15,18,17,3,4,7,False,0.2,0.3,0.35,assets/expansion_batch04/t5_automation/ossila_dipcoater/model.glb,assets/expansion_batch04/t5_automation/ossila_dipcoater/model.urdf,assets/expansion_batch04/t5_automation/ossila_dipcoater/asset.contract.json +instrument.ossila_doctorblade,CHEM-055,Automated doctor-blade coater,Ossila,Doctor Blade Coater,Ossila Doctor Blade Coater(100mm数字刮刀+8mm玻璃台),Thin-Film & Functional Materials,assets/expansion_batch04/t5_automation/ossila_doctorblade,66,16,21,18,4,4,8,False,0.28,0.36,0.19,assets/expansion_batch04/t5_automation/ossila_doctorblade/model.glb,assets/expansion_batch04/t5_automation/ossila_doctorblade/model.urdf,assets/expansion_batch04/t5_automation/ossila_doctorblade/asset.contract.json +instrument.ossila_slotdie,CHEM-056,Slot-die coater,Ossila,Slot-Die Coater V2,Ossila Slot-Die Coater V2 L2005A2(100mm标准模头/5mL注射器),Thin-Film & Functional Materials,assets/expansion_batch04/t5_automation/ossila_slotdie,64,17,29,22,6,5,8,False,0.28,0.36,0.19,assets/expansion_batch04/t5_automation/ossila_slotdie/model.glb,assets/expansion_batch04/t5_automation/ossila_slotdie/model.urdf,assets/expansion_batch04/t5_automation/ossila_slotdie/asset.contract.json +instrument.thermo_process11,CHEM-057,Lab twin-screw extruder,Thermo Fisher Scientific,Process 11,Thermo Scientific Process11(标准350℃双螺杆),Thin-Film & Functional Materials,assets/expansion_batch04/t5_automation/thermo_process11,66,5,32,22,10,7,7,False,0.82,0.48,0.41,assets/expansion_batch04/t5_automation/thermo_process11/model.glb,assets/expansion_batch04/t5_automation/thermo_process11/model.urdf,assets/expansion_batch04/t5_automation/thermo_process11/asset.contract.json +instrument.fujifilm_dmp2850,CHEM-058,Materials inkjet printer,FUJIFILM Dimatix,DMP-2850,FUJIFILM Dimatix DMP-2850 S(SAMBA 12喷嘴),Thin-Film & Functional Materials,assets/expansion_batch04/t5_automation/fujifilm_dmp2850,60,4,28,21,6,7,9,False,0.673,0.5917,0.419,assets/expansion_batch04/t5_automation/fujifilm_dmp2850/model.glb,assets/expansion_batch04/t5_automation/fujifilm_dmp2850/model.urdf,assets/expansion_batch04/t5_automation/fujifilm_dmp2850/asset.contract.json +instrument.linari_rtadvanced,CHEM-059,Electrospinning system,Linari Nanotech,RT Advanced,Linari Nanotech RT Advanced静电纺丝系统,Thin-Film & Functional Materials,assets/expansion_batch04/t5_automation/linari_rtadvanced,63,14,33,21,6,15,6,False,1.05,1.0455,2.2,assets/expansion_batch04/t5_automation/linari_rtadvanced/model.glb,assets/expansion_batch04/t5_automation/linari_rtadvanced/model.urdf,assets/expansion_batch04/t5_automation/linari_rtadvanced/asset.contract.json +instrument.cytiva_nanoassemblrignite,CHEM-060,Microfluidic nanoparticle formulation system,Cytiva / Precision NanoSystems,NanoAssemblr Ignite,NanoAssemblr Ignite NIN0001微流控制备仪,Thin-Film & Functional Materials,assets/expansion_batch04/t5_automation/cytiva_nanoassemblrignite,43,9,35,20,6,12,9,False,0.381,0.3527,0.38,assets/expansion_batch04/t5_automation/cytiva_nanoassemblrignite/model.glb,assets/expansion_batch04/t5_automation/cytiva_nanoassemblrignite/model.urdf,assets/expansion_batch04/t5_automation/cytiva_nanoassemblrignite/asset.contract.json +instrument.glatt_miniglatt,CHEM-061,Fluid-bed granulator / coater,Glatt,Mini-Glatt,Glatt Mini-Glatt2012流化床制粒包衣仪,Thin-Film & Functional Materials,assets/expansion_batch04/t5_automation/glatt_miniglatt,54,12,33,21,4,12,9,False,0.7057,0.7587,0.84,assets/expansion_batch04/t5_automation/glatt_miniglatt/model.glb,assets/expansion_batch04/t5_automation/glatt_miniglatt/model.urdf,assets/expansion_batch04/t5_automation/glatt_miniglatt/asset.contract.json +instrument.quorum_q150tes,CHEM-062,Sputter & carbon coater,Quorum Technologies,Q150T ES Plus,Quorum Q150T ES Plus显微样品镀膜机,Thin-Film & Functional Materials,assets/expansion_batch04/t5_automation/quorum_q150tes,52,7,28,18,6,10,10,False,0.585,0.5546,0.41,assets/expansion_batch04/t5_automation/quorum_q150tes/model.glb,assets/expansion_batch04/t5_automation/quorum_q150tes/model.urdf,assets/expansion_batch04/t5_automation/quorum_q150tes/asset.contract.json +instrument.laboao_cvdltf12p50,CHEM-063,Chemical vapour deposition system,LABOAO,CVD-LTF12P50,LABOAO CVD-LTF12P50单温区化学气相沉积系统,Thin-Film & Functional Materials,assets/expansion_batch04/t5_automation/laboao_cvdltf12p50,110,10,34,16,6,12,10,False,1.9073,0.62,1.378,assets/expansion_batch04/t5_automation/laboao_cvdltf12p50/model.glb,assets/expansion_batch04/t5_automation/laboao_cvdltf12p50/model.urdf,assets/expansion_batch04/t5_automation/laboao_cvdltf12p50/asset.contract.json +instrument.arradiance_gemstarxt,CHEM-064,Atomic layer deposition system,Arradiance,GEMStar XT-SP (PEALD / thermal ALD),Arradiance GEMStar XT-SP单歧管PEALD/热ALD系统,Thin-Film & Functional Materials,assets/expansion_batch04/t5_automation/arradiance_gemstarxt,74,8,31,21,6,20,11,False,1.1576,0.6096,0.635,assets/expansion_batch04/t5_automation/arradiance_gemstarxt/model.glb,assets/expansion_batch04/t5_automation/arradiance_gemstarxt/model.urdf,assets/expansion_batch04/t5_automation/arradiance_gemstarxt/asset.contract.json +instrument.jasco_j1500,CHEM-065,Circular dichroism spectrometer,JASCO,J-1500,JASCO J-1500 150W标准PMT电子圆二色光谱仪,Molecular Spectroscopy & Structure,assets/expansion_batch04/t3_analytical/jasco_j1500,60,2,25,18,6,9,11,False,1.055,0.6655,0.39,assets/expansion_batch04/t3_analytical/jasco_j1500/model.glb,assets/expansion_batch04/t3_analytical/jasco_j1500/model.urdf,assets/expansion_batch04/t3_analytical/jasco_j1500/asset.contract.json +instrument.bruker_minispecmq20,CHEM-066,Time-domain NMR relaxometer,Bruker,minispec mq20,Bruker minispec mq20时域核磁弛豫分析仪,Molecular Spectroscopy & Structure,assets/expansion_batch04/t3_analytical/bruker_minispecmq20,59,1,21,17,6,8,18,False,0.7492,0.787,0.356,assets/expansion_batch04/t3_analytical/bruker_minispecmq20/model.glb,assets/expansion_batch04/t3_analytical/bruker_minispecmq20/model.urdf,assets/expansion_batch04/t3_analytical/bruker_minispecmq20/asset.contract.json +instrument.jasco_fp8350,CHEM-067,Spectrofluorometer,JASCO,FP-8350,JASCO FP-8350 荧光分光光度计,Molecular Spectroscopy & Structure,assets/expansion_batch03/t3_analytical/jasco_fp8350,61,2,25,19,6,7,8,False,0.84,0.5663,0.27,assets/expansion_batch03/t3_analytical/jasco_fp8350/model.glb,assets/expansion_batch03/t3_analytical/jasco_fp8350/model.urdf,assets/expansion_batch03/t3_analytical/jasco_fp8350/asset.contract.json +instrument.magritek_spinsolve80,CHEM-068,Benchtop NMR spectrometer,Magritek,Spinsolve 80 Carbon,核磁共振结构光谱仪 — Magritek Spinsolve 80 Carbon,Molecular Spectroscopy & Structure,assets/basic40_batch02/t4_measure/magritek_spinsolve80,13,1,24,15,0,1,10,False,0.5814,0.4005,0.675,assets/basic40_batch02/t4_measure/magritek_spinsolve80/model.glb,assets/basic40_batch02/t4_measure/magritek_spinsolve80/model.urdf,assets/basic40_batch02/t4_measure/magritek_spinsolve80/asset.contract.json +instrument.bruker_magnettechesr5000,CHEM-069,Benchtop EPR spectrometer,Bruker,Magnettech ESR5000,Bruker Magnettech ESR5000 电子顺磁共振谱仪,Molecular Spectroscopy & Structure,assets/expansion_batch04/t3_analytical/bruker_magnettechesr5000,57,1,21,19,6,7,12,False,0.397,0.426,0.2032,assets/expansion_batch04/t3_analytical/bruker_magnettechesr5000/model.glb,assets/expansion_batch04/t3_analytical/bruker_magnettechesr5000/model.urdf,assets/expansion_batch04/t3_analytical/bruker_magnettechesr5000/asset.contract.json +instrument.jasco_p4200,CHEM-070,Digital polarimeter,JASCO,P-4200,JASCO P-4200 数字旋光仪,Molecular Spectroscopy & Structure,assets/expansion_batch03/t3_analytical/jasco_p4200,58,2,23,20,6,7,9,False,0.55,0.3582,0.21,assets/expansion_batch03/t3_analytical/jasco_p4200/model.glb,assets/expansion_batch03/t3_analytical/jasco_p4200/model.urdf,assets/expansion_batch03/t3_analytical/jasco_p4200/asset.contract.json +instrument.hach_dr6000,CHEM-071,UV-Vis spectrophotometer,Hach,DR6000,Hach DR6000 紫外可见分光光度计,Molecular Spectroscopy & Structure,assets/basic40_batch02/t3_analytical/hach_dr6000,14,1,14,13,1,1,7,False,0.5,0.46,0.215,assets/basic40_batch02/t3_analytical/hach_dr6000/model.glb,assets/basic40_batch02/t3_analytical/hach_dr6000/model.urdf,assets/basic40_batch02/t3_analytical/hach_dr6000/asset.contract.json +instrument.jasco_ftir4700,CHEM-072,FT-IR spectrometer,JASCO,FT/IR-4700,JASCO FT/IR-4700 傅里叶变换红外光谱仪,Molecular Spectroscopy & Structure,assets/basic40_batch02/t3_analytical/jasco_ftir4700,17,1,18,12,0,1,7,False,0.46,0.645,0.29,assets/basic40_batch02/t3_analytical/jasco_ftir4700/model.glb,assets/basic40_batch02/t3_analytical/jasco_ftir4700/model.urdf,assets/basic40_batch02/t3_analytical/jasco_ftir4700/asset.contract.json +instrument.jasco_nrs5500,CHEM-073,Raman microscope,JASCO,NRS-5500,JASCO NRS-5500 显微拉曼光谱仪,Molecular Spectroscopy & Structure,assets/expansion_batch04/t3_analytical/jasco_nrs5500,61,4,26,23,6,7,8,False,1.15,0.89,0.67,assets/expansion_batch04/t3_analytical/jasco_nrs5500/model.glb,assets/expansion_batch04/t3_analytical/jasco_nrs5500/model.urdf,assets/expansion_batch04/t3_analytical/jasco_nrs5500/asset.contract.json +instrument.applied_sx20,CHEM-074,Stopped-flow kinetics spectrometer,Applied Photophysics,SX20,Applied Photophysics SX20 停流反应动力学光谱仪,Molecular Spectroscopy & Structure,assets/expansion_batch04/t3_analytical/applied_sx20,63,6,30,19,6,9,9,False,1.2,0.5,0.5775,assets/expansion_batch04/t3_analytical/applied_sx20/model.glb,assets/expansion_batch04/t3_analytical/applied_sx20/model.urdf,assets/expansion_batch04/t3_analytical/applied_sx20/asset.contract.json +instrument.edinburgh_fls1000tcspc,CHEM-075,Time-resolved fluorescence (TCSPC) spectrometer,Edinburgh Instruments,FLS1000,Edinburgh Instruments FLS1000 TCSPC 时间分辨荧光寿命光谱仪,Molecular Spectroscopy & Structure,assets/expansion_batch04/t3_analytical/edinburgh_fls1000tcspc,55,4,26,18,6,8,17,False,1.2,0.8,0.63,assets/expansion_batch04/t3_analytical/edinburgh_fls1000tcspc/model.glb,assets/expansion_batch04/t3_analytical/edinburgh_fls1000tcspc/model.urdf,assets/expansion_batch04/t3_analytical/edinburgh_fls1000tcspc/asset.contract.json +instrument.ultrafast_helios,CHEM-076,Femtosecond transient absorption spectrometer,Ultrafast Systems,HELIOS,Ultrafast Systems HELIOS 飞秒瞬态吸收光谱仪,Molecular Spectroscopy & Structure,assets/expansion_batch04/t3_analytical/ultrafast_helios,56,4,25,17,6,6,13,False,1.5,0.85,0.66,assets/expansion_batch04/t3_analytical/ultrafast_helios/model.glb,assets/expansion_batch04/t3_analytical/ultrafast_helios/model.urdf,assets/expansion_batch04/t3_analytical/ultrafast_helios/asset.contract.json +instrument.jasco_fvs6000,CHEM-077,Vibrational circular dichroism spectrometer,JASCO,FVS-6000,JASCO FVS-6000 振动圆二色光谱仪,Molecular Spectroscopy & Structure,assets/expansion_batch04/t3_analytical/jasco_fvs6000,74,4,32,22,6,10,12,False,0.945,0.67,0.425,assets/expansion_batch04/t3_analytical/jasco_fvs6000/model.glb,assets/expansion_batch04/t3_analytical/jasco_fvs6000/model.urdf,assets/expansion_batch04/t3_analytical/jasco_fvs6000/asset.contract.json +instrument.jasco_cpl300,CHEM-078,Circularly polarized luminescence spectrometer,JASCO,CPL-300,JASCO CPL-300 圆偏振发光光谱仪,Molecular Spectroscopy & Structure,assets/expansion_batch04/t3_analytical/jasco_cpl300,107,5,29,22,6,7,13,False,2.4,0.7,1.0,assets/expansion_batch04/t3_analytical/jasco_cpl300/model.glb,assets/expansion_batch04/t3_analytical/jasco_cpl300/model.urdf,assets/expansion_batch04/t3_analytical/jasco_cpl300/asset.contract.json +instrument.elementar_varioel,CHEM-079,Organic elemental (CHNS) analyzer,Elementar,vario EL cube,Elementar vario EL cube 有机元素分析仪,Elemental & Mass Spectrometry,assets/expansion_batch04/t3_analytical/elementar_varioel,81,5,31,23,6,7,11,False,0.815,0.55,0.57,assets/expansion_batch04/t3_analytical/elementar_varioel/model.glb,assets/expansion_batch04/t3_analytical/elementar_varioel/model.urdf,assets/expansion_batch04/t3_analytical/elementar_varioel/asset.contract.json +instrument.shimadzu_tocl,CHEM-080,Total organic carbon analyzer,Shimadzu,TOC-L CSH,Shimadzu TOC-L CSH 总有机碳分析仪,Elemental & Mass Spectrometry,assets/expansion_batch03/t3_analytical/shimadzu_tocl,148,40,32,29,6,9,29,False,0.34,0.66,0.48,assets/expansion_batch03/t3_analytical/shimadzu_tocl/model.glb,assets/expansion_batch03/t3_analytical/shimadzu_tocl/model.urdf,assets/expansion_batch03/t3_analytical/shimadzu_tocl/asset.contract.json +instrument.jena_contraa800,CHEM-081,Atomic absorption spectrometer,Analytik Jena,contrAA 800 D,Analytik Jena contrAA 800 D 原子吸收光谱仪,Elemental & Mass Spectrometry,assets/expansion_batch03/t3_analytical/jena_contraa800,118,10,41,33,6,14,14,False,1.115,0.97,0.625,assets/expansion_batch03/t3_analytical/jena_contraa800/model.glb,assets/expansion_batch03/t3_analytical/jena_contraa800/model.urdf,assets/expansion_batch03/t3_analytical/jena_contraa800/asset.contract.json +instrument.shimadzu_icpe9800,CHEM-082,ICP optical emission spectrometer,Shimadzu,ICPE-9800,Shimadzu ICPE-9820 电感耦合等离子体发射光谱仪(9800系列),Elemental & Mass Spectrometry,assets/expansion_batch04/t3_analytical/shimadzu_icpe9800,97,3,36,33,6,9,83,False,1.3,0.72,0.91,assets/expansion_batch04/t3_analytical/shimadzu_icpe9800/model.glb,assets/expansion_batch04/t3_analytical/shimadzu_icpe9800/model.urdf,assets/expansion_batch04/t3_analytical/shimadzu_icpe9800/asset.contract.json +instrument.shimadzu_icpms2030,CHEM-083,ICP mass spectrometer,Shimadzu,ICPMS-2030,Shimadzu ICPMS-2030 电感耦合等离子体质谱仪,Elemental & Mass Spectrometry,assets/expansion_batch04/t3_analytical/shimadzu_icpms2030,126,5,37,30,6,10,18,False,1.0133,0.645,0.857,assets/expansion_batch04/t3_analytical/shimadzu_icpms2030/model.glb,assets/expansion_batch04/t3_analytical/shimadzu_icpms2030/model.urdf,assets/expansion_batch04/t3_analytical/shimadzu_icpms2030/asset.contract.json +instrument.shimadzu_edx7200,CHEM-084,Energy-dispersive XRF spectrometer,Shimadzu,EDX-7200,Shimadzu EDX-7200 能量色散X射线荧光分析仪,Elemental & Mass Spectrometry,assets/expansion_batch04/t3_analytical/shimadzu_edx7200,71,3,33,29,6,5,22,False,0.46,0.59,0.5775,assets/expansion_batch04/t3_analytical/shimadzu_edx7200/model.glb,assets/expansion_batch04/t3_analytical/shimadzu_edx7200/model.urdf,assets/expansion_batch04/t3_analytical/shimadzu_edx7200/asset.contract.json +instrument.jena_multix,CHEM-085,Total organic halogen (AOX/TOX) analyzer,Analytik Jena,multi X 2500,Analytik Jena multi X 2500 总有机卤素分析仪,Elemental & Mass Spectrometry,assets/expansion_batch04/t3_analytical/jena_multix,132,8,38,37,6,11,84,False,1.4,0.55,0.671,assets/expansion_batch04/t3_analytical/jena_multix/model.glb,assets/expansion_batch04/t3_analytical/jena_multix/model.urdf,assets/expansion_batch04/t3_analytical/jena_multix/asset.contract.json +instrument.milestone_dma80,CHEM-086,Direct mercury analyzer,Milestone,DMA-80 evo,Milestone DMA-80 evo DoubleBeam 直接测汞仪,Elemental & Mass Spectrometry,assets/expansion_batch04/t3_analytical/milestone_dma80,114,5,38,34,6,46,69,False,0.8,0.42,0.3,assets/expansion_batch04/t3_analytical/milestone_dma80/model.glb,assets/expansion_batch04/t3_analytical/milestone_dma80/model.urdf,assets/expansion_batch04/t3_analytical/milestone_dma80/asset.contract.json +instrument.stanford_rga100,CHEM-087,Residual gas analyzer,Stanford Research Systems,RGA100,Stanford Research Systems RGA100 残余气体质谱分析仪,Elemental & Mass Spectrometry,assets/expansion_batch04/t3_analytical/stanford_rga100,99,2,40,34,13,7,327,False,0.215,0.5812,0.264,assets/expansion_batch04/t3_analytical/stanford_rga100/model.glb,assets/expansion_batch04/t3_analytical/stanford_rga100/model.urdf,assets/expansion_batch04/t3_analytical/stanford_rga100/asset.contract.json +instrument.thermo_orbitrapexploris,CHEM-088,High-resolution Orbitrap mass spectrometer,Thermo Fisher Scientific,Orbitrap Exploris 120,Thermo Fisher Scientific Orbitrap Exploris120 高分辨分子质谱仪,Elemental & Mass Spectrometry,assets/expansion_batch04/t3_analytical/thermo_orbitrapexploris,119,4,37,37,9,14,100,False,0.534,0.939,0.703,assets/expansion_batch04/t3_analytical/thermo_orbitrapexploris/model.glb,assets/expansion_batch04/t3_analytical/thermo_orbitrapexploris/model.urdf,assets/expansion_batch04/t3_analytical/thermo_orbitrapexploris/asset.contract.json +instrument.leco_onh836,CHEM-089,Inert-gas fusion O/N/H analyzer,LECO,ONH836,LECO ONH836 惰气熔融氧氮氢分析仪,Elemental & Mass Spectrometry,assets/expansion_batch04/t3_analytical/leco_onh836,140,4,36,35,7,8,31,False,0.71,0.76,0.915,assets/expansion_batch04/t3_analytical/leco_onh836/model.glb,assets/expansion_batch04/t3_analytical/leco_onh836/model.urdf,assets/expansion_batch04/t3_analytical/leco_onh836/asset.contract.json +instrument.elementar_isoprimeprecision,CHEM-090,Stable isotope-ratio mass spectrometer,Elementar,isoprime precisION,稳定同位素比质谱仪Elementar isoprime precisION(标准通用收集器阵列,集成centrION),Elemental & Mass Spectrometry,assets/expansion_batch04/t3_analytical/elementar_isoprimeprecision,36,2,21,30,3,16,15,True,0.595,0.4607,0.65,assets/expansion_batch04/t3_analytical/elementar_isoprimeprecision/model.glb,assets/expansion_batch04/t3_analytical/elementar_isoprimeprecision/model.urdf,assets/expansion_batch04/t3_analytical/elementar_isoprimeprecision/asset.contract.json +instrument.agilent_gc8890b,CHEM-096,Gas chromatograph,Agilent,8890B GC,Agilent 8890B GC 气相色谱仪(单S/SL + FID迁移配置),Chromatography & Electrophoresis,assets/basic40_batch02/t3_analytical/agilent_gc8890b,52,50,22,55,3,1,9,False,0.5803,0.545,0.4905,assets/basic40_batch02/t3_analytical/agilent_gc8890b/model.glb,assets/basic40_batch02/t3_analytical/agilent_gc8890b/model.urdf,assets/basic40_batch02/t3_analytical/agilent_gc8890b/asset.contract.json +instrument.agilent_hplc1260,CHEM-097,HPLC system,Agilent,1260 Infinity III LC,高效液相色谱仪 Agilent | 1260 Infinity III LC,Chromatography & Electrophoresis,assets/basic40_batch02/t3_analytical/agilent_hplc1260,15,1,24,14,0,3,9,False,0.396,0.468,0.66,assets/basic40_batch02/t3_analytical/agilent_hplc1260/model.glb,assets/basic40_batch02/t3_analytical/agilent_hplc1260/model.urdf,assets/basic40_batch02/t3_analytical/agilent_hplc1260/asset.contract.json +instrument.thermo_dionexintegrion,CHEM-098,Ion chromatograph,Thermo Fisher Scientific,Dionex Integrion HPIC,Thermo Scientific Dionex Integrion HPIC 离子色谱仪,Chromatography & Electrophoresis,assets/expansion_batch03/t3_analytical/thermo_dionexintegrion,72,2,21,16,4,6,7,False,0.3,0.577,0.625,assets/expansion_batch03/t3_analytical/thermo_dionexintegrion/model.glb,assets/expansion_batch03/t3_analytical/thermo_dionexintegrion/model.urdf,assets/expansion_batch03/t3_analytical/thermo_dionexintegrion/asset.contract.json +instrument.agilent_1290infinity,CHEM-099,GPC/SEC system,Agilent,1290 Infinity II GPC/SEC,Agilent 1290 Infinity II GPC/SEC 凝胶渗透体积排阻色谱系统,Chromatography & Electrophoresis,assets/expansion_batch04/t3_analytical/agilent_1290infinity,166,3,25,18,4,14,8,False,0.4365,0.481,0.9,assets/expansion_batch04/t3_analytical/agilent_1290infinity/model.glb,assets/expansion_batch04/t3_analytical/agilent_1290infinity/model.urdf,assets/expansion_batch04/t3_analytical/agilent_1290infinity/asset.contract.json +instrument.gas_flavourspec25gc,CHEM-100,GC–ion mobility spectrometer,G.A.S.,FlavourSpec25 GC-IMS,G.A.S. FlavourSpec25 GC-IMS 离子迁移谱正交分离系统,Chromatography & Electrophoresis,assets/expansion_batch04/t3_analytical/gas_flavourspec25gc,200,4,29,20,4,65,5,False,1.01,0.8,0.79,assets/expansion_batch04/t3_analytical/gas_flavourspec25gc/model.glb,assets/expansion_batch04/t3_analytical/gas_flavourspec25gc/model.urdf,assets/expansion_batch04/t3_analytical/gas_flavourspec25gc/asset.contract.json +instrument.metrohm_omnis,CHEM-101,Automatic potentiometric titrator,Metrohm,OMNIS Professional Titrator,Metrohm OMNIS Professional Titrator 2.1001.0320 自动电位滴定仪,Electrochemistry & Titration,assets/basic40_batch02/t4_measure/metrohm_omnis,17,2,34,12,1,1,15,False,0.142,0.3996,0.358,assets/basic40_batch02/t4_measure/metrohm_omnis/model.glb,assets/basic40_batch02/t4_measure/metrohm_omnis/model.urdf,assets/basic40_batch02/t4_measure/metrohm_omnis/asset.contract.json +instrument.metrohm_899,CHEM-102,Karl Fischer coulometer,Metrohm,899 Coulometer,CHEM-102 卡尔费休水分滴定仪 · Metrohm 899 Coulometer,Electrochemistry & Titration,assets/basic40_batch02/t4_measure/metrohm_899,11,11,26,7,0,1,9,False,0.1436,0.2889,0.3373,assets/basic40_batch02/t4_measure/metrohm_899/model.glb,assets/basic40_batch02/t4_measure/metrohm_899/model.urdf,assets/basic40_batch02/t4_measure/metrohm_899/asset.contract.json +instrument.gamry_reference620,CHEM-103,Potentiostat / electrochemical workstation,Gamry,Reference 620,Gamry Reference 620 电化学工作站,Electrochemistry & Titration,assets/basic40_batch02/t4_measure/gamry_ref620,12,0,21,7,0,0,13,False,0.09,0.2744,0.19,assets/basic40_batch02/t4_measure/gamry_ref620/model.glb,assets/basic40_batch02/t4_measure/gamry_ref620/model.urdf,assets/basic40_batch02/t4_measure/gamry_ref620/asset.contract.json +instrument.ch_chi920d,CHEM-104,Scanning electrochemical microscope,CH Instruments,CHI920D,CH Instruments CHI920D 扫描电化学显微镜,Electrochemistry & Titration,assets/expansion_batch04/t4_measure/ch_chi920d,118,3,29,16,2,12,6,False,0.76,0.36,0.45,assets/expansion_batch04/t4_measure/ch_chi920d/model.glb,assets/expansion_batch04/t4_measure/ch_chi920d/model.urdf,assets/expansion_batch04/t4_measure/ch_chi920d/asset.contract.json +instrument.ch_chi440c,CHEM-105,Electrochemical quartz crystal microbalance,CH Instruments,CHI440C,CH Instruments CHI440C 电化学石英晶体微天平,Electrochemistry & Titration,assets/expansion_batch04/t4_measure/ch_chi440c,79,1,19,17,1,10,6,False,0.6,0.31,0.1247,assets/expansion_batch04/t4_measure/ch_chi440c/model.glb,assets/expansion_batch04/t4_measure/ch_chi440c/model.urdf,assets/expansion_batch04/t4_measure/ch_chi440c/asset.contract.json +instrument.knauer_k7400s,CHEM-106,Freezing-point osmometer,KNAUER,K-7400S,KNAUER K-7400S 冰点渗透压仪,Electrochemistry & Titration,assets/expansion_batch04/t4_measure/knauer_k7400s,77,2,24,17,2,6,6,False,0.1606,0.3434,0.228,assets/expansion_batch04/t4_measure/knauer_k7400s/model.glb,assets/expansion_batch04/t4_measure/knauer_k7400s/model.urdf,assets/expansion_batch04/t4_measure/knauer_k7400s/asset.contract.json +instrument.pine_wavevortex10,CHEM-107,Rotating ring-disk electrode rotator,Pine Research,WaveVortex 10,Pine Research WaveVortex 10旋转环盘驱动,Electrochemistry & Titration,assets/expansion_batch04/t4_measure/pine_wavevortex10,113,4,30,22,5,9,5,False,0.38,0.28,0.38,assets/expansion_batch04/t4_measure/pine_wavevortex10/model.glb,assets/expansion_batch04/t4_measure/pine_wavevortex10/model.urdf,assets/expansion_batch04/t4_measure/pine_wavevortex10/asset.contract.json +instrument.agilent_hs8697,CHEM-108,Headspace autosampler (48-vial tray),Agilent,8697,CHEM-108 Agilent 8697 顶空自动进样器(48 位托盘),Analytical Sampling & Interfaces,assets/basic40_batch02/t3_analytical/agilent_hs8697,141,1,24,13,1,60,7,False,0.599,0.73,0.8,assets/basic40_batch02/t3_analytical/agilent_hs8697/model.glb,assets/basic40_batch02/t3_analytical/agilent_hs8697/model.urdf,assets/basic40_batch02/t3_analytical/agilent_hs8697/asset.contract.json +instrument.teledyne_atomxxyz,CHEM-109,Purge-and-trap autosampler,Teledyne Tekmar,Atomx XYZ,Teledyne Tekmar Atomx XYZ 吹扫捕集自动进样系统,Analytical Sampling & Interfaces,assets/expansion_batch03/t3_analytical/teledyne_atomxxyz,443,7,25,20,2,97,7,False,0.701,0.5842,0.495,assets/expansion_batch03/t3_analytical/teledyne_atomxxyz/model.glb,assets/expansion_batch03/t3_analytical/teledyne_atomxxyz/model.urdf,assets/expansion_batch03/t3_analytical/teledyne_atomxxyz/asset.contract.json +instrument.teledyne_analyteexcite,CHEM-110,Laser ablation sampling system,Teledyne CETAC,Analyte Excite+,Teledyne CETAC Analyte Excite+ 激光剥蚀系统,Analytical Sampling & Interfaces,assets/expansion_batch03/t3_analytical/teledyne_analyteexcite,135,6,22,23,2,25,7,False,0.76,0.87,1.5,assets/expansion_batch03/t3_analytical/teledyne_analyteexcite/model.glb,assets/expansion_batch03/t3_analytical/teledyne_analyteexcite/model.urdf,assets/expansion_batch03/t3_analytical/teledyne_analyteexcite/asset.contract.json +instrument.frontier_egapy,CHEM-111,Multi-shot pyrolyzer (GC inlet),Frontier Laboratories,EGA/PY-3030D,Frontier EGA/PY-3030D 热裂解进样器,Analytical Sampling & Interfaces,assets/expansion_batch03/t3_analytical/frontier_egapy,101,4,22,22,0,21,9,False,0.3355,0.346,0.3935,assets/expansion_batch03/t3_analytical/frontier_egapy/model.glb,assets/expansion_batch03/t3_analytical/frontier_egapy/model.urdf,assets/expansion_batch03/t3_analytical/frontier_egapy/asset.contract.json +instrument.markes_unityxr,CHEM-112,Thermal desorber,Markes International,UNITY-xr,Markes UNITY-xr 热脱附进样器,Analytical Sampling & Interfaces,assets/expansion_batch03/t3_analytical/markes_unityxr,104,6,27,26,0,11,9,False,0.16,0.54,0.46,assets/expansion_batch03/t3_analytical/markes_unityxr/model.glb,assets/expansion_batch03/t3_analytical/markes_unityxr/model.urdf,assets/expansion_batch03/t3_analytical/markes_unityxr/asset.contract.json +instrument.antonpaar_surpass3,CHEM-113,Solid-surface streaming-potential analyzer,Anton Paar,SurPASS 3,Anton Paar SurPASS 3 固体表面流动电位分析仪,"Particles, Pores & Interfaces",assets/expansion_batch03/t4_measure/antonpaar_surpass3,137,7,29,25,1,15,7,False,0.5365,0.605,0.3508,assets/expansion_batch03/t4_measure/antonpaar_surpass3/model.glb,assets/expansion_batch03/t4_measure/antonpaar_surpass3/model.urdf,assets/expansion_batch03/t4_measure/antonpaar_surpass3/asset.contract.json +instrument.antonpaar_ultrapyc5000,CHEM-114,Gas pycnometer (true density),Anton Paar,Ultrapyc 5000,Anton Paar Ultrapyc 5000 气体置换真密度仪,"Particles, Pores & Interfaces",assets/expansion_batch03/t4_measure/antonpaar_ultrapyc5000,122,6,33,25,4,9,9,False,0.3988,0.4895,0.25,assets/expansion_batch03/t4_measure/antonpaar_ultrapyc5000/model.glb,assets/expansion_batch03/t4_measure/antonpaar_ultrapyc5000/model.urdf,assets/expansion_batch03/t4_measure/antonpaar_ultrapyc5000/asset.contract.json +instrument.antonpaar_autosorb6100,CHEM-115,Gas physisorption surface-area & pore analyzer,Anton Paar,Autosorb 6100,Anton Paar Autosorb 6100 气体物理吸附比表面积与孔径分析仪,"Particles, Pores & Interfaces",assets/expansion_batch03/t4_measure/antonpaar_autosorb6100,178,8,49,33,1,23,7,False,0.8056,0.712,1.079,assets/expansion_batch03/t4_measure/antonpaar_autosorb6100/model.glb,assets/expansion_batch03/t4_measure/antonpaar_autosorb6100/model.urdf,assets/expansion_batch03/t4_measure/antonpaar_autosorb6100/asset.contract.json +instrument.antonpaar_poremaster60,CHEM-116,Mercury intrusion porosimeter,Anton Paar,PoreMaster 60,Anton Paar PoreMaster 60 标准型压汞孔隙率分析仪,"Particles, Pores & Interfaces",assets/expansion_batch03/t4_measure/antonpaar_poremaster60,121,7,27,28,1,12,10,False,0.5272,0.6665,0.7865,assets/expansion_batch03/t4_measure/antonpaar_poremaster60/model.glb,assets/expansion_batch03/t4_measure/antonpaar_poremaster60/model.urdf,assets/expansion_batch03/t4_measure/antonpaar_poremaster60/asset.contract.json +instrument.antonpaar_litesizerdls,CHEM-117,DLS & zeta-potential analyzer,Anton Paar,Litesizer DLS 701,Anton Paar Litesizer DLS 701 动态光散射与胶体电位仪,"Particles, Pores & Interfaces",assets/expansion_batch03/t4_measure/antonpaar_litesizerdls,103,6,31,29,4,10,12,False,0.452,0.5115,0.135,assets/expansion_batch03/t4_measure/antonpaar_litesizerdls/model.glb,assets/expansion_batch03/t4_measure/antonpaar_litesizerdls/model.urdf,assets/expansion_batch03/t4_measure/antonpaar_litesizerdls/asset.contract.json +instrument.antonpaar_psa1190,CHEM-118,Laser-diffraction particle sizer,Anton Paar,PSA 1190,Anton Paar PSA1190 L/D 激光衍射粒度仪,"Particles, Pores & Interfaces",assets/expansion_batch03/t4_measure/antonpaar_psa1190,248,9,31,28,1,16,15,False,0.895,0.547,0.4304,assets/expansion_batch03/t4_measure/antonpaar_psa1190/model.glb,assets/expansion_batch03/t4_measure/antonpaar_psa1190/model.urdf,assets/expansion_batch03/t4_measure/antonpaar_psa1190/asset.contract.json +instrument.antonpaar_litesizerdia,CHEM-119,Dynamic image analyzer (particle shape),Anton Paar,Litesizer DIA 700,Anton Paar Litesizer DIA700 Liquid Flow 动态颗粒图像分析仪,"Particles, Pores & Interfaces",assets/expansion_batch03/t4_measure/antonpaar_litesizerdia,95,7,31,29,1,12,12,False,0.79,0.311,0.4,assets/expansion_batch03/t4_measure/antonpaar_litesizerdia/model.glb,assets/expansion_batch03/t4_measure/antonpaar_litesizerdia/model.urdf,assets/expansion_batch03/t4_measure/antonpaar_litesizerdia/asset.contract.json +instrument.biolin_sigma700,CHEM-120,Force tensiometer,Biolin Scientific,Sigma 700,Biolin Scientific Sigma700 力学式表面张力仪,"Particles, Pores & Interfaces",assets/expansion_batch03/t4_measure/biolin_sigma700,82,7,30,32,1,11,15,False,0.244,0.333,0.62,assets/expansion_batch03/t4_measure/biolin_sigma700/model.glb,assets/expansion_batch03/t4_measure/biolin_sigma700/model.urdf,assets/expansion_batch03/t4_measure/biolin_sigma700/asset.contract.json +instrument.biolin_thetaflex,CHEM-121,Optical contact-angle meter,Biolin Scientific,Theta Flex,Biolin Scientific Theta Flex 光学接触角测量仪,"Particles, Pores & Interfaces",assets/expansion_batch03/t4_measure/biolin_thetaflex,111,8,33,35,1,10,15,False,0.7665,0.2515,0.559,assets/expansion_batch03/t4_measure/biolin_thetaflex/model.glb,assets/expansion_batch03/t4_measure/biolin_thetaflex/model.urdf,assets/expansion_batch03/t4_measure/biolin_thetaflex/asset.contract.json +instrument.micromeritics_autochemiii,CHEM-122,Temperature-programmed chemisorption analyzer,Micromeritics,AutoChem III,Micromeritics AutoChem III 程序升温化学吸附仪,"Particles, Pores & Interfaces",assets/expansion_batch03/t4_measure/micromeritics_autochemiii,199,6,36,35,1,29,14,False,0.61,0.64,0.64,assets/expansion_batch03/t4_measure/micromeritics_autochemiii/model.glb,assets/expansion_batch03/t4_measure/micromeritics_autochemiii/model.urdf,assets/expansion_batch03/t4_measure/micromeritics_autochemiii/asset.contract.json +instrument.surface_dvsresolution,CHEM-123,Dynamic vapour sorption analyzer,Surface Measurement Systems,DVS Resolution,Surface Measurement Systems DVS Resolution 动态蒸气吸附仪(低质量天平),"Particles, Pores & Interfaces",assets/expansion_batch03/t4_measure/surface_dvsresolution,211,6,40,37,4,11,12,False,0.52,0.61,0.98,assets/expansion_batch03/t4_measure/surface_dvsresolution/model.glb,assets/expansion_batch03/t4_measure/surface_dvsresolution/model.urdf,assets/expansion_batch03/t4_measure/surface_dvsresolution/asset.contract.json +instrument.freeman_ft4powder,CHEM-124,Powder rheometer,Freeman Technology / Micromeritics,FT4 Powder Rheometer,Freeman Technology / Micromeritics FT4 Powder Rheometer 粉体流动性流变仪,"Particles, Pores & Interfaces",assets/expansion_batch03/t4_measure/freeman_ft4powder,143,6,39,33,1,8,12,False,0.48,0.306,0.76,assets/expansion_batch03/t4_measure/freeman_ft4powder/model.glb,assets/expansion_batch03/t4_measure/freeman_ft4powder/model.urdf,assets/expansion_batch03/t4_measure/freeman_ft4powder/asset.contract.json +instrument.porometer_poroluxrevo,CHEM-125,Capillary flow porometer,POROMETER,POROLUX Revo,POROMETER POROLUX Revo 毛细流动孔径仪,"Particles, Pores & Interfaces",assets/expansion_batch03/t4_measure/porometer_poroluxrevo,129,3,28,33,1,8,13,False,0.53,0.53,0.755,assets/expansion_batch03/t4_measure/porometer_poroluxrevo/model.glb,assets/expansion_batch03/t4_measure/porometer_poroluxrevo/model.urdf,assets/expansion_batch03/t4_measure/porometer_poroluxrevo/asset.contract.json +instrument.microtrac_turbiscanlab,CHEM-126,Dispersion stability analyzer,Microtrac,TURBISCAN LAB,Microtrac TURBISCAN LAB 分散体系稳定性分析仪,"Particles, Pores & Interfaces",assets/expansion_batch03/t4_measure/microtrac_turbiscanlab,118,5,28,27,3,6,19,False,0.26,0.28,0.25,assets/expansion_batch03/t4_measure/microtrac_turbiscanlab/model.glb,assets/expansion_batch03/t4_measure/microtrac_turbiscanlab/model.urdf,assets/expansion_batch03/t4_measure/microtrac_turbiscanlab/asset.contract.json +instrument.biolin_mediuml,CHEM-127,Langmuir / Langmuir–Blodgett trough,Biolin Scientific KSV NIMA,Medium L&LB Trough,KSV NIMA Medium L&LB Langmuir 单分子膜槽,"Particles, Pores & Interfaces",assets/expansion_batch03/t4_measure/biolin_mediuml,124,7,36,34,2,8,15,False,0.662,0.308,0.455,assets/expansion_batch03/t4_measure/biolin_mediuml/model.glb,assets/expansion_batch03/t4_measure/biolin_mediuml/model.urdf,assets/expansion_batch03/t4_measure/biolin_mediuml/asset.contract.json +instrument.antonpaar_trb,CHEM-128,Pin-on-disk tribometer,Anton Paar,TRB³,Anton Paar TRB³ 销盘摩擦磨损试验机,"Thermal, Mechanical & Transport",assets/expansion_batch04/t1_thermal/antonpaar_trb,155,6,42,39,0,7,13,False,0.532,0.443,0.501,assets/expansion_batch04/t1_thermal/antonpaar_trb/model.glb,assets/expansion_batch04/t1_thermal/antonpaar_trb/model.urdf,assets/expansion_batch04/t1_thermal/antonpaar_trb/asset.contract.json +instrument.antonpaar_rst300,CHEM-129,Coating scratch tester,Anton Paar,RST 300,Anton Paar RST 300 涂层划痕附着力试验机,"Thermal, Mechanical & Transport",assets/expansion_batch04/t1_thermal/antonpaar_rst300,168,6,42,38,0,6,13,False,0.364,0.369,0.5425,assets/expansion_batch04/t1_thermal/antonpaar_rst300/model.glb,assets/expansion_batch04/t1_thermal/antonpaar_rst300/model.urdf,assets/expansion_batch04/t1_thermal/antonpaar_rst300/asset.contract.json +instrument.antonpaar_hit300,CHEM-130,Nanoindentation tester,Anton Paar,HIT 300,Anton Paar HIT 300 纳米压痕仪,"Thermal, Mechanical & Transport",assets/expansion_batch04/t1_thermal/antonpaar_hit300,156,6,38,33,2,7,17,False,0.269,0.259,0.42,assets/expansion_batch04/t1_thermal/antonpaar_hit300/model.glb,assets/expansion_batch04/t1_thermal/antonpaar_hit300/model.urdf,assets/expansion_batch04/t1_thermal/antonpaar_hit300/asset.contract.json +instrument.ta_dsc2500,CHEM-131,Differential scanning calorimeter,TA Instruments,DSC 2500,TA Instruments DSC 2500 差示扫描量热仪,"Thermal, Mechanical & Transport",assets/expansion_batch03/t1_thermal/ta_dsc2500,307,5,43,36,1,13,89,False,0.53,0.51,0.61,assets/expansion_batch03/t1_thermal/ta_dsc2500/model.glb,assets/expansion_batch03/t1_thermal/ta_dsc2500/model.urdf,assets/expansion_batch03/t1_thermal/ta_dsc2500/asset.contract.json +instrument.ta_tga5500,CHEM-132,Thermogravimetric analyzer,TA Instruments,TGA 5500,TA Instruments TGA 5500 热重分析仪,"Thermal, Mechanical & Transport",assets/expansion_batch03/t1_thermal/ta_tga5500,186,4,48,40,2,13,10,False,0.56,0.56,0.61,assets/expansion_batch03/t1_thermal/ta_tga5500/model.glb,assets/expansion_batch03/t1_thermal/ta_tga5500/model.urdf,assets/expansion_batch03/t1_thermal/ta_tga5500/asset.contract.json +instrument.ta_dma850,CHEM-133,Dynamic mechanical analyzer,TA Instruments,DMA 850,TA Instruments DMA 850 动态机械分析仪,"Thermal, Mechanical & Transport",assets/expansion_batch04/t1_thermal/ta_dma850,121,5,43,41,2,10,22,False,0.64,0.47,0.535,assets/expansion_batch04/t1_thermal/ta_dma850/model.glb,assets/expansion_batch04/t1_thermal/ta_dma850/model.urdf,assets/expansion_batch04/t1_thermal/ta_dma850/asset.contract.json +instrument.ta_tma450,CHEM-134,Thermomechanical analyzer,TA Instruments,TMA 450,TA Instruments TMA 450 热机械分析仪,"Thermal, Mechanical & Transport",assets/expansion_batch04/t1_thermal/ta_tma450,107,3,50,47,2,10,13,False,0.56,0.56,0.63,assets/expansion_batch04/t1_thermal/ta_tma450/model.glb,assets/expansion_batch04/t1_thermal/ta_tma450/model.urdf,assets/expansion_batch04/t1_thermal/ta_tma450/asset.contract.json +instrument.netzsch_lfa467,CHEM-135,Laser/light flash thermal diffusivity analyzer,NETZSCH,LFA 467 HyperFlash,NETZSCH LFA467 HyperFlash 闪光法热扩散仪,"Thermal, Mechanical & Transport",assets/expansion_batch04/t1_thermal/netzsch_lfa467,133,4,54,47,6,14,20,False,0.54,0.52,0.61,assets/expansion_batch04/t1_thermal/netzsch_lfa467/model.glb,assets/expansion_batch04/t1_thermal/netzsch_lfa467/model.urdf,assets/expansion_batch04/t1_thermal/netzsch_lfa467/asset.contract.json +instrument.hot_tps2500,CHEM-136,Transient plane source thermal-conductivity analyzer,Hot Disk,TPS 2500 S,Hot Disk TPS 2500 S 瞬态平面热源导热仪,"Thermal, Mechanical & Transport",assets/expansion_batch04/t1_thermal/hot_tps2500,47,4,25,25,1,6,13,False,0.6975,0.5663,0.325,assets/expansion_batch04/t1_thermal/hot_tps2500/model.glb,assets/expansion_batch04/t1_thermal/hot_tps2500/model.urdf,assets/expansion_batch04/t1_thermal/hot_tps2500/asset.contract.json +instrument.antonpaar_mcr503,CHEM-137,Rotational & oscillatory rheometer,Anton Paar,MCR 503,Anton Paar MCR 503 旋转与振荡流变仪,"Thermal, Mechanical & Transport",assets/expansion_batch04/t1_thermal/antonpaar_mcr503,51,3,26,28,1,8,8,False,0.453,0.673,0.775,assets/expansion_batch04/t1_thermal/antonpaar_mcr503/model.glb,assets/expansion_batch04/t1_thermal/antonpaar_mcr503/model.urdf,assets/expansion_batch04/t1_thermal/antonpaar_mcr503/asset.contract.json +instrument.ta_tamiv,CHEM-138,Isothermal microcalorimeter,TA Instruments,TAM IV,TA Instruments TAM IV 20 mL 等温微量热仪,"Thermal, Mechanical & Transport",assets/expansion_batch04/t1_thermal/ta_tamiv,52,2,25,31,0,8,10,False,0.58,0.76,1.0,assets/expansion_batch04/t1_thermal/ta_tamiv/model.glb,assets/expansion_batch04/t1_thermal/ta_tamiv/model.urdf,assets/expansion_batch04/t1_thermal/ta_tamiv/asset.contract.json +instrument.linseis_lsr3,CHEM-139,Thermoelectric (Seebeck) tester,Linseis,LSR-3,Linseis LSR-3 红外炉800°C热电性能测试仪,"Thermal, Mechanical & Transport",assets/expansion_batch04/t1_thermal/linseis_lsr3,57,5,32,31,2,12,11,False,0.7204,0.4278,0.53,assets/expansion_batch04/t1_thermal/linseis_lsr3/model.glb,assets/expansion_batch04/t1_thermal/linseis_lsr3/model.urdf,assets/expansion_batch04/t1_thermal/linseis_lsr3/asset.contract.json +instrument.novocontrol_alphat,CHEM-140,Broadband dielectric spectrometer,Novocontrol Technologies,Alpha-T,Novocontrol Alpha-T Rev C 宽频介电谱仪(含电流转换接口),"Thermal, Mechanical & Transport",assets/expansion_batch04/t1_thermal/novocontrol_alphat,48,3,27,30,0,12,13,False,0.6815,0.364,0.205,assets/expansion_batch04/t1_thermal/novocontrol_alphat/model.glb,assets/expansion_batch04/t1_thermal/novocontrol_alphat/model.urdf,assets/expansion_batch04/t1_thermal/novocontrol_alphat/asset.contract.json +instrument.lakeshore_measurereadym91,CHEM-141,Hall-effect measurement system,Lake Shore Cryotronics,MeasureReady M91 FastHall,Lake Shore MeasureReady M91 FastHall 霍尔测量控制器,"Thermal, Mechanical & Transport",assets/expansion_batch04/t1_thermal/lakeshore_measurereadym91,64,4,36,31,1,17,11,False,0.343,0.369,0.087,assets/expansion_batch04/t1_thermal/lakeshore_measurereadym91/model.glb,assets/expansion_batch04/t1_thermal/lakeshore_measurereadym91/model.urdf,assets/expansion_batch04/t1_thermal/lakeshore_measurereadym91/asset.contract.json +instrument.signatone_quadpro2,CHEM-142,Automated four-point-probe sheet-resistance mapper,Signatone,QuadPro2,Signatone QuadPro2-DAC0 自动四探针面电阻测绘系统,"Thermal, Mechanical & Transport",assets/expansion_batch04/t1_thermal/signatone_quadpro2,99,5,34,29,2,16,13,False,0.572,0.978,1.676,assets/expansion_batch04/t1_thermal/signatone_quadpro2/model.glb,assets/expansion_batch04/t1_thermal/signatone_quadpro2/model.urdf,assets/expansion_batch04/t1_thermal/signatone_quadpro2/asset.contract.json +instrument.lakeshore_8604vsm,CHEM-143,Vibrating sample magnetometer,Lake Shore Cryotronics,8604 VSM,Lake Shore 8604 振动样品磁强计,"Thermal, Mechanical & Transport",assets/expansion_batch04/t1_thermal/lakeshore_8604vsm,106,5,34,32,2,14,14,False,2.175,1.04,1.6,assets/expansion_batch04/t1_thermal/lakeshore_8604vsm/model.glb,assets/expansion_batch04/t1_thermal/lakeshore_8604vsm/model.urdf,assets/expansion_batch04/t1_thermal/lakeshore_8604vsm/asset.contract.json +instrument.shimadzu_ags10knxd,CHEM-144,Universal testing machine,Shimadzu,AGS-10kNXD,Shimadzu AGS-10kNXD 万能材料试验机,"Thermal, Mechanical & Transport",assets/expansion_batch04/t1_thermal/shimadzu_ags10knxd,85,6,35,28,2,14,12,False,0.653,0.52,1.603,assets/expansion_batch04/t1_thermal/shimadzu_ags10knxd/model.glb,assets/expansion_batch04/t1_thermal/shimadzu_ags10knxd/model.urdf,assets/expansion_batch04/t1_thermal/shimadzu_ags10knxd/asset.contract.json +instrument.zwick_hit5p,CHEM-145,Pendulum impact tester,ZwickRoell,HIT5P,ZwickRoell HIT5P 摆锤冲击试验机,"Thermal, Mechanical & Transport",assets/expansion_batch04/t1_thermal/zwick_hit5p,73,4,31,27,2,13,12,False,0.68,0.429,0.684,assets/expansion_batch04/t1_thermal/zwick_hit5p/model.glb,assets/expansion_batch04/t1_thermal/zwick_hit5p/model.urdf,assets/expansion_batch04/t1_thermal/zwick_hit5p/asset.contract.json +instrument.zwick_mflow,CHEM-146,Melt flow indexer,ZwickRoell,Mflow,ZwickRoell Mflow 熔体流动速率仪,"Thermal, Mechanical & Transport",assets/expansion_batch04/t1_thermal/zwick_mflow,63,9,43,36,3,14,12,False,0.479,0.524,0.548,assets/expansion_batch04/t1_thermal/zwick_mflow/model.glb,assets/expansion_batch04/t1_thermal/zwick_mflow/model.urdf,assets/expansion_batch04/t1_thermal/zwick_mflow/asset.contract.json +instrument.ametek_oxtran,CHEM-147,Oxygen transmission-rate analyzer,AMETEK MOCON,OX-TRAN 2/22 L,AMETEK MOCON OX-TRAN 2/22 L 氧气透过率分析仪,"Thermal, Mechanical & Transport",assets/expansion_batch04/t1_thermal/ametek_oxtran,75,8,55,31,5,14,13,False,0.3046,0.6149,0.5008,assets/expansion_batch04/t1_thermal/ametek_oxtran/model.glb,assets/expansion_batch04/t1_thermal/ametek_oxtran/model.urdf,assets/expansion_batch04/t1_thermal/ametek_oxtran/asset.contract.json +instrument.netzsch_mmc315,CHEM-148,Adiabatic (ARC) reaction calorimeter,NETZSCH,MMC 315 Nexus,NETZSCH MMC 315 Nexus 多模块量热仪(ARC模块),"Thermal, Mechanical & Transport",assets/expansion_batch04/t1_thermal/netzsch_mmc315,40,3,30,24,4,10,15,False,0.62,0.594,0.55,assets/expansion_batch04/t1_thermal/netzsch_mmc315/model.glb,assets/expansion_batch04/t1_thermal/netzsch_mmc315/model.urdf,assets/expansion_batch04/t1_thermal/netzsch_mmc315/asset.contract.json +instrument.mt_rc1mxhfcal,CHEM-149,Heat-flow reaction calorimeter,METTLER TOLEDO,RC1mx + HFCal,METTLER TOLEDO RC1mx + HFCal 热流式反应量热系统(标准转矩搅拌器),"Thermal, Mechanical & Transport",assets/expansion_batch04/t1_thermal/mt_rc1mxhfcal,92,5,57,37,5,12,17,False,0.951,0.705,1.1805,assets/expansion_batch04/t1_thermal/mt_rc1mxhfcal/model.glb,assets/expansion_batch04/t1_thermal/mt_rc1mxhfcal/model.urdf,assets/expansion_batch04/t1_thermal/mt_rc1mxhfcal/asset.contract.json +instrument.ika_c6000,CHEM-150,Oxygen bomb calorimeter,IKA,C 6000 isoperibol,IKA C 6000 isoperibol 氧弹量热仪(Package 2/12:C 6000主机+C 6012耐卤素氧弹),"Thermal, Mechanical & Transport",assets/expansion_batch03/t1_thermal/ika_c6000,60,3,43,44,3,16,18,False,0.5053,0.4768,0.4253,assets/expansion_batch03/t1_thermal/ika_c6000/model.glb,assets/expansion_batch03/t1_thermal/ika_c6000/model.urdf,assets/expansion_batch03/t1_thermal/ika_c6000/asset.contract.json +instrument.jeol_jsmit200,CHEM-151,Scanning electron microscope,JEOL,JSM-IT200 LA,JEOL JSM-IT200 LA 扫描电子显微镜(InTouchScope,集成JED-2300 EDS,含机械泵与选配操作台),"Microscopy, Imaging & Diffraction",assets/expansion_batch04/t3_analytical/jeol_jsmit200,102,12,64,48,7,13,22,False,1.537,1.1635,1.48,assets/expansion_batch04/t3_analytical/jeol_jsmit200/model.glb,assets/expansion_batch04/t3_analytical/jeol_jsmit200/model.urdf,assets/expansion_batch04/t3_analytical/jeol_jsmit200/asset.contract.json +instrument.jeol_jem1400flash,CHEM-152,Transmission electron microscope,JEOL,JEM-1400Flash,JEOL JEM-1400Flash HR 透射电子显微镜(120kV钨灯丝、HR极靴、Matataki Flash sCMOS相机,含电源柜、后控制台与机械泵),"Microscopy, Imaging & Diffraction",assets/expansion_batch04/t3_analytical/jeol_jem1400flash,82,21,77,59,7,9,28,False,2.625,2.2643,2.4921,assets/expansion_batch04/t3_analytical/jeol_jem1400flash/model.glb,assets/expansion_batch04/t3_analytical/jeol_jem1400flash/model.urdf,assets/expansion_batch04/t3_analytical/jeol_jem1400flash/asset.contract.json +instrument.antonpaar_saxspace,CHEM-153,Small-angle X-ray scattering system,Anton Paar,SAXSpace,Anton Paar SAXSpace 小角/广角X射线散射仪(Cu密封管、Kratky块线/点准直、TCStage、MYTHEN2 R 1K探测器2θ臂、ASX自动进样器,含实验桌与柜体),"Microscopy, Imaging & Diffraction",assets/expansion_batch04/t3_analytical/antonpaar_saxspace,72,13,76,54,11,13,25,False,1.8,0.922,1.685,assets/expansion_batch04/t3_analytical/antonpaar_saxspace/model.glb,assets/expansion_batch04/t3_analytical/antonpaar_saxspace/model.urdf,assets/expansion_batch04/t3_analytical/antonpaar_saxspace/asset.contract.json +instrument.kratos_axissupra,CHEM-154,X-ray photoelectron spectrometer,Kratos / Shimadzu,AXIS Supra+,Kratos / Shimadzu AXIS Supra+ 成像X射线光电子能谱仪(单色Al Kα、半球+球面镜分析器、DLD、电子中和器、Minibeam 4离子枪、Flexi-lock 3架仓、五轴样品台,含冷水机与ESCApe工作站),"Microscopy, Imaging & Diffraction",assets/expansion_batch04/t3_analytical/kratos_axissupra,66,10,67,49,8,10,22,False,2.77,2.064,1.97,assets/expansion_batch04/t3_analytical/kratos_axissupra/model.glb,assets/expansion_batch04/t3_analytical/kratos_axissupra/model.urdf,assets/expansion_batch04/t3_analytical/kratos_axissupra/asset.contract.json +instrument.keyence_vkx3000,CHEM-155,3D laser-scanning profilometer microscope,KEYENCE,VK-X3000 / VK-X3100,KEYENCE VK-X3000三维光学表面轮廓显微镜(VK-X3000控制器、VK-X3100测量头、VK-D3电动底座,含显示器与电脑工作站),"Microscopy, Imaging & Diffraction",assets/expansion_batch04/t3_analytical/keyence_vkx3000,62,7,51,38,9,9,21,False,1.386,0.5385,0.471,assets/expansion_batch04/t3_analytical/keyence_vkx3000/model.glb,assets/expansion_batch04/t3_analytical/keyence_vkx3000/model.urdf,assets/expansion_batch04/t3_analytical/keyence_vkx3000/asset.contract.json +instrument.bruker_x4poseidon,CHEM-156,Micro X-ray computed tomography,Bruker,X4 POSEIDON,Bruker X4 POSEIDON台式三维X射线显微镜/微米CT(反射源基本配置:反射式X射线源、7 MP平板探测器、标准旋转台、固定扫描几何、7位滤片转换器,含工作站),"Microscopy, Imaging & Diffraction",assets/expansion_batch04/t3_analytical/bruker_x4poseidon,51,7,60,46,7,7,16,False,1.8855,0.622,0.722,assets/expansion_batch04/t3_analytical/bruker_x4poseidon/model.glb,assets/expansion_batch04/t3_analytical/bruker_x4poseidon/model.urdf,assets/expansion_batch04/t3_analytical/bruker_x4poseidon/asset.contract.json +instrument.ja_alphase,CHEM-157,Spectroscopic ellipsometer,J.A. Woollam,alpha-SE,J.A. Woollam alpha-SE光谱椭偏仪(2015规格:旋转补偿器+CCD,380–900 nm 180个波长,入射角65/70/75°与90°直通,手动换角,电动Z对准,真空吸盘,选配液池;含操作电脑),"Microscopy, Imaging & Diffraction",assets/expansion_batch04/t3_analytical/ja_alphase,49,5,39,37,5,7,16,False,1.23,0.485,0.434,assets/expansion_batch04/t3_analytical/ja_alphase/model.glb,assets/expansion_batch04/t3_analytical/ja_alphase/model.urdf,assets/expansion_batch04/t3_analytical/ja_alphase/asset.contract.json +instrument.park_nx10,CHEM-158,Atomic force microscope,Park Systems,NX10,Park Systems NX10原子力显微镜(2024宣传册配置:50×50 µm闭环XY扫描器、15 µm Z扫描器、20×20 mm XY台、25 mm Z台、15 mm聚焦台、10×同轴光学、SLD光束检测;接触/True Non-Contact/轻敲、相位成像、力-距离谱、热调谐;含控制电子单元),"Microscopy, Imaging & Diffraction",assets/expansion_batch04/t3_analytical/park_nx10,51,12,54,56,2,7,12,False,0.776,0.5107,0.443,assets/expansion_batch04/t3_analytical/park_nx10/model.glb,assets/expansion_batch04/t3_analytical/park_nx10/model.urdf,assets/expansion_batch04/t3_analytical/park_nx10/asset.contract.json +instrument.nanosurf_naiostm,CHEM-159,Scanning tunneling microscope,Nanosurf,NaioSTM,Nanosurf NaioSTM扫描隧道显微镜(花岗岩隔振台上的扫描头、500×500×200 nm扫描器、stick-slip自动进针、0.1–100 nA电流放大器、±10 V针尖电压、恒流/恒高成像、I-V与I-z谱、10×放大罩;含台下控制器),"Microscopy, Imaging & Diffraction",assets/expansion_batch04/t3_analytical/nanosurf_naiostm,28,3,36,52,1,7,11,False,0.204,0.204,0.104,assets/expansion_batch04/t3_analytical/nanosurf_naiostm/model.glb,assets/expansion_batch04/t3_analytical/nanosurf_naiostm/model.urdf,assets/expansion_batch04/t3_analytical/nanosurf_naiostm/asset.contract.json +instrument.rigaku_miniflex600_external_cooling,CHEM-160,Powder X-ray diffractometer,Rigaku,MiniFlex600,Rigaku MiniFlex600 粉末X射线衍射仪(外置循环水),"Microscopy, Imaging & Diffraction",assets/basic40_batch02/t4_measure/rigaku_miniflex600,13,3,25,12,0,1,12,False,0.6205,0.456,0.722,assets/basic40_batch02/t4_measure/rigaku_miniflex600/model.glb,assets/basic40_batch02/t4_measure/rigaku_miniflex600/model.urdf,assets/basic40_batch02/t4_measure/rigaku_miniflex600/asset.contract.json +instrument.rigaku_xtalabsynergy,CHEM-161,Single-crystal X-ray diffractometer,Rigaku Oxford Diffraction,XtaLAB Synergy-R,Rigaku XtaLAB Synergy-R单晶X射线衍射仪(HyPix-6000HE配置:PhotonJet-R转靶光源、1–10 mrad电动狭缝、κ测角仪与伸缩2θ臂、HyPix-6000HE混合光子计数探测器、两扇铰链前门与电气安全回路、Oxford Cryostream 1000),"Microscopy, Imaging & Diffraction",assets/expansion_batch04/t3_analytical/rigaku_xtalabsynergy,77,11,44,55,8,8,16,False,1.3012,0.914,1.875,assets/expansion_batch04/t3_analytical/rigaku_xtalabsynergy/model.glb,assets/expansion_batch04/t3_analytical/rigaku_xtalabsynergy/model.urdf,assets/expansion_batch04/t3_analytical/rigaku_xtalabsynergy/asset.contract.json +instrument.evident_bx53p,CHEM-162,Polarizing microscope,Evident / Olympus,BX53-P,Evident / Olympus BX53-P偏光显微镜(锥光/正交配置:U-CPA勃氏镜、U-AN360P检偏镜、U-POC-2偏光聚光镜、U-SRP旋转台、四孔物镜转盘、倾斜三目筒),"Microscopy, Imaging & Diffraction",assets/expansion_batch04/t3_analytical/evident_bx53p,50,14,47,34,1,7,13,False,0.282,0.5124,0.534,assets/expansion_batch04/t3_analytical/evident_bx53p/model.glb,assets/expansion_batch04/t3_analytical/evident_bx53p/model.urdf,assets/expansion_batch04/t3_analytical/evident_bx53p/asset.contract.json +instrument.biotek_405ts,CHEM-163,Microplate washer,Agilent BioTek,405 TS (96-tube manifold),Agilent BioTek 405 TS微孔板洗板机(单96管洗头,内置四路缓冲切换A–D,标准SBS载板),Biochemical & Wet-Chemistry Assays,assets/expansion_batch04/t4_measure/biotek_405ts,25,3,36,26,2,12,17,False,0.3556,0.4318,0.254,assets/expansion_batch04/t4_measure/biotek_405ts/model.glb,assets/expansion_batch04/t4_measure/biotek_405ts/model.urdf,assets/expansion_batch04/t4_measure/biotek_405ts/asset.contract.json +instrument.biorad_miniprotean,CHEM-164,Gel electrophoresis system,Bio-Rad,Mini-PROTEAN Tetra + power supply,Bio-Rad Mini-PROTEAN Tetra垂直电泳槽(电极模块,可加陪伴模块运行1–4块胶)+ PowerPac Basic电源,Biochemical & Wet-Chemistry Assays,assets/expansion_batch03/t4_measure/biorad_miniprotean,40,8,36,37,1,11,17,False,0.41,0.289,0.1993,assets/expansion_batch03/t4_measure/biorad_miniprotean/model.glb,assets/expansion_batch03/t4_measure/biorad_miniprotean/model.urdf,assets/expansion_batch03/t4_measure/biorad_miniprotean/asset.contract.json +instrument.thermo_ibrightfl1500,CHEM-165,Gel & blot imager,Thermo Fisher Scientific,iBright FL1500,Thermo Fisher Invitrogen iBright FL1500凝胶与印迹成像系统(产品册配置),Biochemical & Wet-Chemistry Assays,assets/expansion_batch03/t4_measure/thermo_ibrightfl1500,19,3,24,32,2,5,10,False,0.38,0.68,0.6,assets/expansion_batch03/t4_measure/thermo_ibrightfl1500/model.glb,assets/expansion_batch03/t4_measure/thermo_ibrightfl1500/model.urdf,assets/expansion_batch03/t4_measure/thermo_ibrightfl1500/asset.contract.json +instrument.eppendorf_cellxpertc170i,CHEM-166,CO₂ cell-culture incubator,Eppendorf,CellXpert C170i,Eppendorf CellXpert C170i CO2细胞培养箱(O2 1–20 %、湿度与水位选件),Biochemical & Wet-Chemistry Assays,assets/expansion_batch04/t4_measure/eppendorf_cellxpertc170i,39,5,57,46,2,14,18,True,0.72,0.7153,0.9,assets/expansion_batch04/t4_measure/eppendorf_cellxpertc170i/model.glb,assets/expansion_batch04/t4_measure/eppendorf_cellxpertc170i/model.urdf,assets/expansion_batch04/t4_measure/eppendorf_cellxpertc170i/asset.contract.json +instrument.biorad_cfxopus,CHEM-167,Real-time qPCR system,Bio-Rad,CFX Opus 96,Bio-Rad CFX Opus 96实时荧光定量PCR仪(12011319),Biochemical & Wet-Chemistry Assays,assets/expansion_batch04/t4_measure/biorad_cfxopus,28,3,40,35,5,7,14,True,0.33,0.5608,0.36,assets/expansion_batch04/t4_measure/biorad_cfxopus/model.glb,assets/expansion_batch04/t4_measure/biorad_cfxopus/model.urdf,assets/expansion_batch04/t4_measure/biorad_cfxopus/asset.contract.json +instrument.bd_facsariaiii,CHEM-168,Flow cytometer & cell sorter,BD Biosciences,FACSAria III,BD FACSAria III流式细胞分选仪(2018规格,四激光),Biochemical & Wet-Chemistry Assays,assets/expansion_batch04/t4_measure/bd_facsariaiii,46,10,105,69,3,17,18,True,2.135,0.7286,0.71,assets/expansion_batch04/t4_measure/bd_facsariaiii/model.glb,assets/expansion_batch04/t4_measure/bd_facsariaiii/model.urdf,assets/expansion_batch04/t4_measure/bd_facsariaiii/asset.contract.json +instrument.malvern_microcalpeaq,CHEM-169,Isothermal titration calorimeter,Malvern Panalytical,MicroCal PEAQ-ITC,MicroCal PEAQ-ITC等温滴定量热仪(标准型,含洗涤模块),Biochemical & Wet-Chemistry Assays,assets/expansion_batch04/t4_measure/malvern_microcalpeaq,55,5,58,45,2,17,17,True,0.43,0.377,0.3688,assets/expansion_batch04/t4_measure/malvern_microcalpeaq/model.glb,assets/expansion_batch04/t4_measure/malvern_microcalpeaq/model.urdf,assets/expansion_batch04/t4_measure/malvern_microcalpeaq/asset.contract.json +instrument.cytiva_biacoret200,CHEM-170,Surface plasmon resonance system,Cytiva,Biacore T200,Biacore T200表面等离子共振生物传感器(处理单元),Biochemical & Wet-Chemistry Assays,assets/expansion_batch04/t4_measure/cytiva_biacoret200,56,7,66,64,5,11,20,True,0.6,0.615,0.69,assets/expansion_batch04/t4_measure/cytiva_biacoret200/model.glb,assets/expansion_batch04/t4_measure/cytiva_biacoret200/model.urdf,assets/expansion_batch04/t4_measure/cytiva_biacoret200/asset.contract.json +instrument.wtw_oxitopi,CHEM-171,Respirometric BOD system,WTW (Xylem),OxiTop-i,生化需氧量呼吸测定系统WTW OxiTop-i IS 6(6测头、PF 600瓶、IS 6感应搅拌台),Biochemical & Wet-Chemistry Assays,assets/expansion_batch04/t4_measure/wtw_oxitopi,96,30,45,33,24,13,19,True,0.265,0.1966,0.2556,assets/expansion_batch04/t4_measure/wtw_oxitopi/model.glb,assets/expansion_batch04/t4_measure/wtw_oxitopi/model.urdf,assets/expansion_batch04/t4_measure/wtw_oxitopi/asset.contract.json +instrument.seal_aa500,CHEM-172,Segmented continuous-flow analyzer,SEAL Analytical,AA500,分段连续流动分析仪SEAL AA500(4通道营养盐:NOx、氨、磷酸盐、硅酸盐;带AS2 XY进样器),Biochemical & Wet-Chemistry Assays,assets/expansion_batch04/t4_measure/seal_aa500,66,11,29,40,1,20,17,True,1.405,0.479,0.409,assets/expansion_batch04/t4_measure/seal_aa500/model.glb,assets/expansion_batch04/t4_measure/seal_aa500/model.urdf,assets/expansion_batch04/t4_measure/seal_aa500/asset.contract.json +instrument.bmg_clariostarplus,CHEM-173,Multi-mode microplate reader,BMG LABTECH,CLARIOstar Plus,多模式微孔板读板仪BMG LABTECH CLARIOstar Plus(光谱仪吸光、LVF单色器荧光、偏振、发光,两个注射泵),Biochemical & Wet-Chemistry Assays,assets/expansion_batch04/t4_measure/bmg_clariostarplus,28,5,22,37,2,7,11,True,0.4512,0.5168,0.401,assets/expansion_batch04/t4_measure/bmg_clariostarplus/model.glb,assets/expansion_batch04/t4_measure/bmg_clariostarplus/model.urdf,assets/expansion_batch04/t4_measure/bmg_clariostarplus/asset.contract.json +instrument.mt_quantos_q2_xpe206dr,CHEM-174,Automated powder dosing system,METTLER TOLEDO,Quantos Q2 + XPE206DR,自动粉末定量分配仪 — METTLER TOLEDO Quantos Q2 + XPE206DR,Automation & Gas/Liquid Supply,assets/basic40_batch02/t5_automation/mt_quantos_q2,18,3,20,12,0,1,12,False,0.263,0.542,0.495,assets/basic40_batch02/t5_automation/mt_quantos_q2/model.glb,assets/basic40_batch02/t5_automation/mt_quantos_q2/model.urdf,assets/basic40_batch02/t5_automation/mt_quantos_q2/asset.contract.json +instrument.opentrons_flex_single_5_1000ul,CHEM-175,Automated liquid-handling robot,Opentrons,Flex (1-channel 5–1000 µL),自动移液工作站 — Opentrons Flex 单通道5–1000 µL,Automation & Gas/Liquid Supply,assets/basic40_batch02/t5_automation/opentrons_flex,28,4,15,10,0,16,8,False,0.87,0.6907,0.84,assets/basic40_batch02/t5_automation/opentrons_flex/model.glb,assets/basic40_batch02/t5_automation/opentrons_flex/model.urdf,assets/basic40_batch02/t5_automation/opentrons_flex/asset.contract.json +instrument.azenta_automated_roll_heat_sealer_a4s,CHEM-176,Automated microplate heat sealer,Azenta Life Sciences,Automated Roll Heat Sealer (a4S),自动微孔板热封膜机,Automation & Gas/Liquid Supply,assets/basic40_batch02/t5_automation/azenta_heat_sealer,17,1,22,9,1,1,5,False,0.2312,0.5075,0.403,assets/basic40_batch02/t5_automation/azenta_heat_sealer/model.glb,assets/basic40_batch02/t5_automation/azenta_heat_sealer/model.urdf,assets/basic40_batch02/t5_automation/azenta_heat_sealer/asset.contract.json +instrument.azenta_intellixcap_s1_46_0001,CHEM-177,Automated tube decapper/recapper,Azenta Life Sciences,IntelliXcap S1 46-0001,自动开盖封盖机,Automation & Gas/Liquid Supply,assets/basic40_batch02/t5_automation/azenta_intellixcap_s1,10,8,13,6,0,1,11,False,0.17,0.24,0.3,assets/basic40_batch02/t5_automation/azenta_intellixcap_s1/model.glb,assets/basic40_batch02/t5_automation/azenta_intellixcap_s1/model.urdf,assets/basic40_batch02/t5_automation/azenta_intellixcap_s1/asset.contract.json +instrument.brooks_preciseflex_400,CHEM-178,Lab sample-transfer robot arm,Brooks Automation,PreciseFlex 400,实验室样品转运机械臂 — Brooks Automation PreciseFlex 400 标准臂400 mm行程,Automation & Gas/Liquid Supply,assets/basic40_batch02/t5_automation/preciseflex_400,12,4,15,9,0,1,6,False,0.715,0.2111,0.682,assets/basic40_batch02/t5_automation/preciseflex_400/model.glb,assets/basic40_batch02/t5_automation/preciseflex_400/model.urdf,assets/basic40_batch02/t5_automation/preciseflex_400/asset.contract.json +instrument.ziath_dp5_mirage_2023,CHEM-179,2D-barcode rack reader,Azenta Ziath,DP5 Mirage,样品管二维条码读架仪,Automation & Gas/Liquid Supply,assets/basic40_batch02/t5_automation/ziath_dp5,16,1,16,7,0,1,7,False,0.208,0.135,0.1214,assets/basic40_batch02/t5_automation/ziath_dp5/model.glb,assets/basic40_batch02/t5_automation/ziath_dp5/model.urdf,assets/basic40_batch02/t5_automation/ziath_dp5/asset.contract.json +instrument.alicat_mc_1slpm_rev6,CHEM-180,Gas mass-flow controller,Alicat Scientific,"MC, 1 SLPM full scale, Rev6",气体质量流量控制器(Alicat MC,1 SLPM,标准精度,Rev6),Automation & Gas/Liquid Supply,assets/basic40_batch02/t5_automation/alicat_mc,11,7,25,8,1,0,7,False,0.0911,0.0267,0.1033,assets/basic40_batch02/t5_automation/alicat_mc/model.glb,assets/basic40_batch02/t5_automation/alicat_mc/model.urdf,assets/basic40_batch02/t5_automation/alicat_mc/asset.contract.json +instrument.bronkhorst_p702cv_5bar_gauge_n2,CHEM-181,Electronic back-pressure controller,Bronkhorst,EL-PRESS P-702CV,电子背压控制器,Automation & Gas/Liquid Supply,assets/basic40_batch02/t5_automation/bronkhorst_p702cv,11,1,18,9,0,0,9,False,0.127,0.025,0.123,assets/basic40_batch02/t5_automation/bronkhorst_p702cv/model.glb,assets/basic40_batch02/t5_automation/bronkhorst_p702cv/model.urdf,assets/basic40_batch02/t5_automation/bronkhorst_p702cv/asset.contract.json +instrument.vici_euta_2sd6mwe,CHEM-182,Multi-position gas stream-selection valve,VICI Valco,EUTA-2SD6MWE,多路气体自动切换阀 — VICI Valco EUTA-2SD6MWE(6位,2 inch隔热杆),Automation & Gas/Liquid Supply,assets/basic40_batch02/t5_automation/vici_euta,15,1,8,3,0,7,10,False,0.2338,0.086,0.105,assets/basic40_batch02/t5_automation/vici_euta/model.glb,assets/basic40_batch02/t5_automation/vici_euta/model.urdf,assets/basic40_batch02/t5_automation/vici_euta/asset.contract.json +instrument.bronkhorst_cemw,CHEM-183,Controlled evaporator & mixer,Bronkhorst,CEM W-202A,受控蒸发与混气进料器Bronkhorst CEM W-202A-NN0-K(三通混合阀+100 W换热器),Automation & Gas/Liquid Supply,assets/expansion_batch03/t5_automation/bronkhorst_cemw,16,1,20,21,0,6,12,True,0.12,0.11,0.3819,assets/expansion_batch03/t5_automation/bronkhorst_cemw/model.glb,assets/expansion_batch03/t5_automation/bronkhorst_cemw/model.urdf,assets/expansion_batch03/t5_automation/bronkhorst_cemw/asset.contract.json +instrument.newera_ne1000,CHEM-184,Programmable syringe pump,New Era Pump Systems,NE-1000 Multi-Phaser,可编程注射泵New Era NE-1000 Multi-Phaser(单通道,12 V DC),Automation & Gas/Liquid Supply,assets/expansion_batch05/t5_automation/newera_ne1000,47,12,31,35,10,9,15,True,0.2965,0.1527,0.1151,assets/expansion_batch05/t5_automation/newera_ne1000/model.glb,assets/expansion_batch05/t5_automation/newera_ne1000/model.urdf,assets/expansion_batch05/t5_automation/newera_ne1000/asset.contract.json +instrument.nabertherm_l9,CHEM-185,Muffle furnace,Nabertherm,L 9/11/SKM,Nabertherm L 9/11/SKM 马弗炉(目录版 3.4 kW),Lab Environment & Utilities,assets/basic40_batch02/t1_thermal/nabertherm_l9,10,7,12,10,1,4,8,False,0.49,0.505,0.58,assets/basic40_batch02/t1_thermal/nabertherm_l9/model.glb,assets/basic40_batch02/t1_thermal/nabertherm_l9/model.urdf,assets/basic40_batch02/t1_thermal/nabertherm_l9/asset.contract.json +instrument.carbolite_tf1_12_60_300,CHEM-186,Tube furnace (controlled atmosphere),Carbolite Gero,TF1 12/60/300,管式气氛炉 Carbolite Gero TF1 12/60/300,Lab Environment & Utilities,assets/basic40_batch02/t1_thermal/carbolite_tf1,19,6,14,5,1,1,13,False,0.876,0.48,0.575,assets/basic40_batch02/t1_thermal/carbolite_tf1/model.glb,assets/basic40_batch02/t1_thermal/carbolite_tf1/model.urdf,assets/basic40_batch02/t1_thermal/carbolite_tf1/asset.contract.json +instrument.julabo_corio_cd200f,CHEM-187,Heating/refrigerated circulator,JULABO,CORIO CD-200F,JULABO CORIO CD-200F 9012701.N1.03 加热制冷循环浴,Lab Environment & Utilities,assets/basic40_batch02/t1_thermal/julabo_corio_cd200f,20,6,15,4,1,1,13,False,0.23,0.3898,0.65,assets/basic40_batch02/t1_thermal/julabo_corio_cd200f/model.glb,assets/basic40_batch02/t1_thermal/julabo_corio_cd200f/model.urdf,assets/basic40_batch02/t1_thermal/julabo_corio_cd200f/asset.contract.json +instrument.vacuubrand_pc3001_vario_select,CHEM-188,Chemistry vacuum pumping unit,VACUUBRAND,PC 3001 VARIO select,化学耐腐蚀真空工作站,Lab Environment & Utilities,assets/basic40_batch02/t2_vacuum/vacuubrand_pc3001,15,3,12,7,1,0,11,False,0.306,0.303,0.4,assets/basic40_batch02/t2_vacuum/vacuubrand_pc3001/model.glb,assets/basic40_batch02/t2_vacuum/vacuubrand_pc3001/model.urdf,assets/basic40_batch02/t2_vacuum/vacuubrand_pc3001/asset.contract.json +instrument.inert_purelab_he_2gb,CHEM-189,Inert-atmosphere glovebox,Inert,PureLab HE 2GB,Inert PureLab HE 2GB 惰性气氛手套箱,Lab Environment & Utilities,assets/basic40_batch02/t2_vacuum/inert_purelab_he,15,2,27,10,1,9,7,False,2.0,1.067,1.921,assets/basic40_batch02/t2_vacuum/inert_purelab_he/model.glb,assets/basic40_batch02/t2_vacuum/inert_purelab_he/model.urdf,assets/basic40_batch02/t2_vacuum/inert_purelab_he/asset.contract.json +instrument.elga_purelab_flex3,CHEM-190,Lab ultrapure water system,ELGA LabWater,PURELAB flex 3,实验室超纯水系统,Lab Environment & Utilities,assets/basic40_batch02/t2_vacuum/elga_purelab_flex3,17,6,26,8,0,1,7,False,0.236,0.47,0.9,assets/basic40_batch02/t2_vacuum/elga_purelab_flex3/model.glb,assets/basic40_batch02/t2_vacuum/elga_purelab_flex3/model.urdf,assets/basic40_batch02/t2_vacuum/elga_purelab_flex3/asset.contract.json +instrument.miele_plw6111,CHEM-191,Laboratory glassware washer,Miele,PLW 6111,Miele PLW 6111 DP SC CL H14 10958380 实验室玻璃器皿清洗机,Lab Environment & Utilities,assets/basic40_batch02/t1_thermal/miele_plw6111,29,7,20,8,0,27,9,False,0.65,0.744,1.87,assets/basic40_batch02/t1_thermal/miele_plw6111/model.glb,assets/basic40_batch02/t1_thermal/miele_plw6111/model.urdf,assets/basic40_batch02/t1_thermal/miele_plw6111/asset.contract.json +instrument.tuttnauer_3870elvd,CHEM-192,Steam autoclave,Tuttnauer,3870ELV-D,立式高压蒸汽灭菌器Tuttnauer 3870ELV-D(85 L,冷却选件),Lab Environment & Utilities,assets/expansion_batch03/t2_vacuum/tuttnauer_3870elvd,21,5,19,24,1,9,16,True,0.731,0.555,1.0,assets/expansion_batch03/t2_vacuum/tuttnauer_3870elvd/model.glb,assets/expansion_batch03/t2_vacuum/tuttnauer_3870elvd/model.urdf,assets/expansion_batch03/t2_vacuum/tuttnauer_3870elvd/asset.contract.json +instrument.esco_ac24s8,CHEM-193,Biological safety cabinet,Esco Lifesciences,AC2-4S8-TU,生物安全柜Esco Airstream Plus AC2-4S8-TU(II级A2型,4 ft,不锈钢侧壁,UV-30A),Lab Environment & Utilities,assets/expansion_batch04/t2_vacuum/esco_ac24s8,40,9,30,24,7,7,12,True,1.34,0.823,1.4,assets/expansion_batch04/t2_vacuum/esco_ac24s8/model.glb,assets/expansion_batch04/t2_vacuum/esco_ac24s8/model.urdf,assets/expansion_batch04/t2_vacuum/esco_ac24s8/asset.contract.json +instrument.inficon_ul1000fab,CHEM-194,Helium leak detector,INFICON,UL1000 Fab,氦质谱检漏仪INFICON UL1000 Fab(移动式,干式涡旋泵,230 V 50 Hz),Lab Environment & Utilities,assets/expansion_batch04/t2_vacuum/inficon_ul1000fab,27,6,28,26,4,6,15,True,1.068,0.525,0.85,assets/expansion_batch04/t2_vacuum/inficon_ul1000fab/model.glb,assets/expansion_batch04/t2_vacuum/inficon_ul1000fab/model.urdf,assets/expansion_batch04/t2_vacuum/inficon_ul1000fab/asset.contract.json +instrument.vaisala_dmt152,CHEM-195,Trace-moisture dew-point transmitter,Vaisala,DMT152,"微量水露点变送器Vaisala DRYCAP DMT152(ISO G1/2"")",Lab Environment & Utilities,assets/expansion_batch04/t2_vacuum/vaisala_dmt152,11,1,25,21,0,2,16,True,0.1275,0.033,0.03,assets/expansion_batch04/t2_vacuum/vaisala_dmt152/model.glb,assets/expansion_batch04/t2_vacuum/vaisala_dmt152/model.urdf,assets/expansion_batch04/t2_vacuum/vaisala_dmt152/asset.contract.json +instrument.peak_precisionhydrogen,CHEM-196,Laboratory hydrogen generator,PEAK Scientific,Precision Hydrogen Trace 500,实验室氢气发生器PEAK Precision Hydrogen Trace 500(存档型号),Lab Environment & Utilities,assets/expansion_batch04/t2_vacuum/peak_precisionhydrogen,22,2,23,21,7,5,13,True,0.3814,0.5656,0.4067,assets/expansion_batch04/t2_vacuum/peak_precisionhydrogen/model.glb,assets/expansion_batch04/t2_vacuum/peak_precisionhydrogen/model.urdf,assets/expansion_batch04/t2_vacuum/peak_precisionhydrogen/asset.contract.json +instrument.eppendorf_cryocubef570n,CHEM-197,Ultra-low temperature freezer,Eppendorf,CryoCube F570n,超低温冰箱Eppendorf CryoCube F570n(570 L,230 V,F571300031),Lab Environment & Utilities,assets/expansion_batch04/t2_vacuum/eppendorf_cryocubef570n,41,12,35,34,8,11,12,True,1.1415,1.009,1.95,assets/expansion_batch04/t2_vacuum/eppendorf_cryocubef570n/model.glb,assets/expansion_batch04/t2_vacuum/eppendorf_cryocubef570n/model.urdf,assets/expansion_batch04/t2_vacuum/eppendorf_cryocubef570n/asset.contract.json +instrument.binder_kbf115,CHEM-198,Constant climate (T/RH) chamber,BINDER,KBF 115,恒温恒湿试验箱BINDER KBF 115(102 L,KBF115-230V,9020-0320),Lab Environment & Utilities,assets/expansion_batch04/t2_vacuum/binder_kbf115,31,3,33,33,6,7,16,True,0.9055,0.7971,1.05,assets/expansion_batch04/t2_vacuum/binder_kbf115/model.glb,assets/expansion_batch04/t2_vacuum/binder_kbf115/model.urdf,assets/expansion_batch04/t2_vacuum/binder_kbf115/asset.contract.json +instrument.esco_efa5uduvw,CHEM-199,Chemical fume hood,Esco Lifesciences,Frontier Acela EFA-5UDUVW-9,台式化学通风柜Esco Frontier Acela EFA-5UDUVW-9(1.5 m美国版,选配Sentinel XL风速监视器),Lab Environment & Utilities,assets/expansion_batch05/t2_vacuum/esco_efa5uduvw,39,11,32,32,6,10,14,True,1.602,0.9097,1.521,assets/expansion_batch05/t2_vacuum/esco_efa5uduvw/model.glb,assets/expansion_batch05/t2_vacuum/esco_efa5uduvw/model.urdf,assets/expansion_batch05/t2_vacuum/esco_efa5uduvw/asset.contract.json +instrument.inert_puresolvmd,CHEM-200,Solvent purification system,Inert,PureSolv MD 7,溶剂纯化系统Inert PureSolv MD 7(7路溶剂,双柱,17 L储罐),Lab Environment & Utilities,assets/expansion_batch04/t2_vacuum/inert_puresolvmd,84,27,67,23,0,18,14,True,1.6104,0.8356,1.9459,assets/expansion_batch04/t2_vacuum/inert_puresolvmd/model.glb,assets/expansion_batch04/t2_vacuum/inert_puresolvmd/model.urdf,assets/expansion_batch04/t2_vacuum/inert_puresolvmd/asset.contract.json +instrument.agilent_7890b_ssl_fid,,Gas chromatograph (S/SL inlet + FID),Agilent,7890B,Agilent 7890B 气相色谱仪(单 S/SL 进样口 + FID),Chromatography & Electrophoresis,assets/GC7890B,52,50,0,16,3,1,0,False,0.5803,0.545,0.4905,assets/GC7890B/GC7890B.glb,assets/GC7890B/GC7890B.urdf, +instrument.ohaus_px224e,,Analytical balance,OHAUS,Pioneer PX224/E,OHAUS Pioneer PX224/E 分析天平,Basic Metrology & Sample Handling,assets/PX224E,25,16,0,7,1,1,0,False,0.209,0.3285,0.309,assets/PX224E/PX224E.glb,assets/PX224E/PX224E.urdf, +instrument.ohaus_spx2201,,Portable precision balance,OHAUS,Scout SPX2201,OHAUS Scout SPX2201 电子天平,Basic Metrology & Sample Handling,assets/SPX2201,23,15,0,7,1,1,0,False,0.202,0.2255,0.054,assets/SPX2201/SPX2201.glb,assets/SPX2201/SPX2201.urdf, diff --git a/catalog/catalog.json b/catalog/catalog.json new file mode 100644 index 0000000000000000000000000000000000000000..16738929372eb118cf453bd7df6185ca5a23d027 --- /dev/null +++ b/catalog/catalog.json @@ -0,0 +1,9172 @@ +{ + "name": "ChemLab-Assets", + "version": "1.0.0", + "hf_dataset": "MBZUAI/ChemLab-Assets", + "file_base_url": "https://huggingface.co/datasets/MBZUAI/ChemLab-Assets/resolve/main/", + "totals": { + "instruments": 198, + "domains": 16, + "makers": 115, + "components": 14272, + "mesh_parts": 14492, + "joints": 1328, + "state_slots": 6280, + "capabilities": 4639, + "mechanisms": 218, + "readouts": 648, + "interface_points": 2348, + "sources": 3001, + "with_output_templates": 22, + "isaac_lab": 198 + }, + "domains": [ + { + "key": "thermal", + "name": "Thermal, Mechanical & Transport", + "name_zh": "热学力学与输运", + "count": 23 + }, + { + "key": "metrology", + "name": "Basic Metrology & Sample Handling", + "name_zh": "基础计量与样品处理", + "count": 16 + }, + { + "key": "facility", + "name": "Lab Environment & Utilities", + "name_zh": "环境与公用系统", + "count": 16 + }, + { + "key": "separation", + "name": "Extraction, Purification & Drying", + "name_zh": "萃取纯化与干燥", + "count": 15 + }, + { + "key": "particles", + "name": "Particles, Pores & Interfaces", + "name_zh": "颗粒孔隙与界面", + "count": 15 + }, + { + "key": "spectroscopy", + "name": "Molecular Spectroscopy & Structure", + "name_zh": "分子光谱与结构", + "count": 14 + }, + { + "key": "digestion", + "name": "Digestion & Solid Sample Prep", + "name_zh": "消解与固体前处理", + "count": 13 + }, + { + "key": "materials", + "name": "Thin-Film & Functional Materials", + "name_zh": "薄膜与功能材料制备", + "count": 13 + }, + { + "key": "elemental", + "name": "Elemental & Mass Spectrometry", + "name_zh": "元素与质谱分析", + "count": 12 + }, + { + "key": "imaging", + "name": "Microscopy, Imaging & Diffraction", + "name_zh": "显微成像与衍射", + "count": 12 + }, + { + "key": "bio", + "name": "Biochemical & Wet-Chemistry Assays", + "name_zh": "生化与湿化学分析", + "count": 11 + }, + { + "key": "automation", + "name": "Automation & Gas/Liquid Supply", + "name_zh": "自动化与气液供给", + "count": 11 + }, + { + "key": "synthesis", + "name": "Reaction & Molecular Synthesis", + "name_zh": "反应与分子合成", + "count": 9 + }, + { + "key": "electrochem", + "name": "Electrochemistry & Titration", + "name_zh": "电化学与定量分析", + "count": 7 + }, + { + "key": "chromatography", + "name": "Chromatography & Electrophoresis", + "name_zh": "色谱与电泳分离", + "count": 6 + }, + { + "key": "sampling", + "name": "Analytical Sampling & Interfaces", + "name_zh": "分析进样与接口", + "count": 5 + } + ], + "assets": [ + { + "id": "instrument.mt_xpr204e", + "slug": "mt_xpr204e", + "chem_id": "CHEM-001", + "name": "Analytical balance", + "maker": "METTLER TOLEDO", + "model": "XPR204E", + "title": "METTLER TOLEDO XPR204E", + "name_zh": "CHEM-001 分析天平(METTLER TOLEDO XPR204E目标;PX224E功能族几何)", + "domain": "metrology", + "domain_name": "Basic Metrology & Sample Handling", + "domain_zh": "基础计量与样品处理", + "path": "assets/basic40_batch02/t4_measure/mt_xpr204e", + "size_m": [ + 0.209, + 0.3286, + 0.309 + ], + "n_components": 25, + "n_mesh_parts": 25, + "n_joints": 16, + "joint_types": { + "prismatic": 12, + "revolute": 4 + }, + "n_state_slots": 22, + "n_capabilities": 9, + "n_capabilities_implemented": 9, + "n_mechanisms": 1, + "n_readouts": 1, + "n_interface_points": 1, + "n_sources": 14, + "n_limitations": 8, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/basic40_batch02/t4_measure/mt_xpr204e/model.glb", + "urdf": "assets/basic40_batch02/t4_measure/mt_xpr204e/model.urdf", + "blend": "assets/basic40_batch02/t4_measure/mt_xpr204e/model.blend", + "contract": "assets/basic40_batch02/t4_measure/mt_xpr204e/asset.contract.json", + "runtime": "scripts/basic40_runtime_measure.py" + }, + "thumb": "media/thumb/mt_xpr204e.webp", + "hero": "media/hero/mt_xpr204e.webp" + }, + { + "id": "instrument.mt_hx204", + "slug": "mt_hx204", + "chem_id": "CHEM-002", + "name": "Halogen moisture analyzer", + "maker": "METTLER TOLEDO", + "model": "HX204", + "title": "METTLER TOLEDO HX204", + "name_zh": "METTLER TOLEDO HX204 卤素水分测定仪", + "domain": "metrology", + "domain_name": "Basic Metrology & Sample Handling", + "domain_zh": "基础计量与样品处理", + "path": "assets/expansion_batch04/t4_measure/mt_hx204", + "size_m": [ + 0.2309, + 0.597, + 0.1437 + ], + "n_components": 56, + "n_mesh_parts": 56, + "n_joints": 5, + "joint_types": { + "prismatic": 5 + }, + "n_state_slots": 14, + "n_capabilities": 8, + "n_capabilities_implemented": 8, + "n_mechanisms": 1, + "n_readouts": 2, + "n_interface_points": 1, + "n_sources": 6, + "n_limitations": 10, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t4_measure/mt_hx204/model.glb", + "urdf": "assets/expansion_batch04/t4_measure/mt_hx204/model.urdf", + "blend": "assets/expansion_batch04/t4_measure/mt_hx204/model.blend", + "contract": "assets/expansion_batch04/t4_measure/mt_hx204/asset.contract.json", + "runtime": "scripts/asset_runtime/mt_hx204.py" + }, + "thumb": "media/thumb/mt_hx204.webp", + "hero": "media/hero/mt_hx204.webp" + }, + { + "id": "instrument.antonpaar_dma5002", + "slug": "antonpaar_dma5002", + "chem_id": "CHEM-003", + "name": "Oscillating U-tube density meter", + "maker": "Anton Paar", + "model": "DMA 5002", + "title": "Anton Paar DMA 5002", + "name_zh": "Anton Paar DMA 5002振动管液体密度计", + "domain": "metrology", + "domain_name": "Basic Metrology & Sample Handling", + "domain_zh": "基础计量与样品处理", + "path": "assets/expansion_batch03/t4_measure/antonpaar_dma5002", + "size_m": [ + 0.3607, + 0.5298, + 0.252 + ], + "n_components": 39, + "n_mesh_parts": 39, + "n_joints": 4, + "joint_types": { + "prismatic": 4 + }, + "n_state_slots": 17, + "n_capabilities": 9, + "n_capabilities_implemented": 9, + "n_mechanisms": 1, + "n_readouts": 2, + "n_interface_points": 2, + "n_sources": 5, + "n_limitations": 8, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t4_measure/antonpaar_dma5002/model.glb", + "urdf": "assets/expansion_batch03/t4_measure/antonpaar_dma5002/model.urdf", + "blend": "assets/expansion_batch03/t4_measure/antonpaar_dma5002/model.blend", + "contract": "assets/expansion_batch03/t4_measure/antonpaar_dma5002/asset.contract.json", + "runtime": "scripts/asset_runtime/antonpaar_dma5002.py" + }, + "thumb": "media/thumb/antonpaar_dma5002.webp", + "hero": "media/hero/antonpaar_dma5002.webp" + }, + { + "id": "instrument.antonpaar_abbematadvanced", + "slug": "antonpaar_abbematadvanced", + "chem_id": "CHEM-004", + "name": "Digital refractometer", + "maker": "Anton Paar", + "model": "Abbemat Advanced 5201", + "title": "Anton Paar Abbemat Advanced 5201", + "name_zh": "Anton Paar Abbemat Advanced 5201数字折射仪", + "domain": "metrology", + "domain_name": "Basic Metrology & Sample Handling", + "domain_zh": "基础计量与样品处理", + "path": "assets/expansion_batch03/t4_measure/antonpaar_abbematadvanced", + "size_m": [ + 0.2261, + 0.3338, + 0.1242 + ], + "n_components": 38, + "n_mesh_parts": 38, + "n_joints": 5, + "joint_types": { + "prismatic": 4, + "revolute": 1 + }, + "n_state_slots": 19, + "n_capabilities": 10, + "n_capabilities_implemented": 10, + "n_mechanisms": 1, + "n_readouts": 3, + "n_interface_points": 1, + "n_sources": 5, + "n_limitations": 9, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t4_measure/antonpaar_abbematadvanced/model.glb", + "urdf": "assets/expansion_batch03/t4_measure/antonpaar_abbematadvanced/model.urdf", + "blend": "assets/expansion_batch03/t4_measure/antonpaar_abbematadvanced/model.blend", + "contract": "assets/expansion_batch03/t4_measure/antonpaar_abbematadvanced/asset.contract.json", + "runtime": "scripts/asset_runtime/antonpaar_abbematadvanced.py" + }, + "thumb": "media/thumb/antonpaar_abbematadvanced.webp", + "hero": "media/hero/antonpaar_abbematadvanced.webp" + }, + { + "id": "instrument.metrohm_914", + "slug": "metrohm_914", + "chem_id": "CHEM-005", + "name": "pH / DO / conductivity meter", + "maker": "Metrohm", + "model": "914 pH/DO/Conductometer", + "title": "Metrohm 914 pH/DO/Conductometer", + "name_zh": "CHEM-005 多参数电化学水质测定仪 — Metrohm 914 pH/DO/Conductometer", + "domain": "metrology", + "domain_name": "Basic Metrology & Sample Handling", + "domain_zh": "基础计量与样品处理", + "path": "assets/basic40_batch02/t4_measure/metrohm_914", + "size_m": [ + 0.2062, + 0.208, + 0.0551 + ], + "n_components": 11, + "n_mesh_parts": 10, + "n_joints": 3, + "joint_types": { + "prismatic": 3 + }, + "n_state_slots": 44, + "n_capabilities": 11, + "n_capabilities_implemented": 11, + "n_mechanisms": 1, + "n_readouts": 0, + "n_interface_points": 0, + "n_sources": 7, + "n_limitations": 14, + "isaac_lab": "bridged", + "glb_up": "y", + "output_templates": false, + "files": { + "glb": "assets/basic40_batch02/t4_measure/metrohm_914/model.glb", + "urdf": "assets/basic40_batch02/t4_measure/metrohm_914/model.urdf", + "blend": "assets/basic40_batch02/t4_measure/metrohm_914/model.blend", + "contract": "assets/basic40_batch02/t4_measure/metrohm_914/asset.contract.json", + "runtime": "scripts/basic40_runtime_measure.py" + }, + "thumb": "media/thumb/metrohm_914.webp", + "hero": "media/hero/metrohm_914.webp" + }, + { + "id": "instrument.mt_mp70", + "slug": "mt_mp70", + "chem_id": "CHEM-006", + "name": "Automatic melting-point system", + "maker": "METTLER TOLEDO", + "model": "MP70", + "title": "METTLER TOLEDO MP70", + "name_zh": "METTLER TOLEDO MP70自动熔点仪", + "domain": "metrology", + "domain_name": "Basic Metrology & Sample Handling", + "domain_zh": "基础计量与样品处理", + "path": "assets/expansion_batch03/t4_measure/mt_mp70", + "size_m": [ + 0.1806, + 0.3519, + 0.19 + ], + "n_components": 51, + "n_mesh_parts": 51, + "n_joints": 4, + "joint_types": { + "prismatic": 4 + }, + "n_state_slots": 26, + "n_capabilities": 10, + "n_capabilities_implemented": 10, + "n_mechanisms": 1, + "n_readouts": 3, + "n_interface_points": 4, + "n_sources": 6, + "n_limitations": 10, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t4_measure/mt_mp70/model.glb", + "urdf": "assets/expansion_batch03/t4_measure/mt_mp70/model.urdf", + "blend": "assets/expansion_batch03/t4_measure/mt_mp70/model.blend", + "contract": "assets/expansion_batch03/t4_measure/mt_mp70/asset.contract.json", + "runtime": "scripts/asset_runtime/mt_mp70.py" + }, + "thumb": "media/thumb/mt_mp70.webp", + "hero": "media/hero/mt_mp70.webp" + }, + { + "id": "instrument.aqualab_4te", + "slug": "aqualab_4te", + "chem_id": "CHEM-007", + "name": "Water-activity meter", + "maker": "AQUALAB", + "model": "4TE", + "title": "AQUALAB 4TE", + "name_zh": "AQUALAB 4TE水活度仪", + "domain": "metrology", + "domain_name": "Basic Metrology & Sample Handling", + "domain_zh": "基础计量与样品处理", + "path": "assets/expansion_batch04/t4_measure/aqualab_4te", + "size_m": [ + 0.267, + 0.184, + 0.129 + ], + "n_components": 39, + "n_mesh_parts": 39, + "n_joints": 10, + "joint_types": { + "prismatic": 8, + "revolute": 2 + }, + "n_state_slots": 27, + "n_capabilities": 13, + "n_capabilities_implemented": 13, + "n_mechanisms": 1, + "n_readouts": 2, + "n_interface_points": 1, + "n_sources": 6, + "n_limitations": 12, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t4_measure/aqualab_4te/model.glb", + "urdf": "assets/expansion_batch04/t4_measure/aqualab_4te/model.urdf", + "blend": "assets/expansion_batch04/t4_measure/aqualab_4te/model.blend", + "contract": "assets/expansion_batch04/t4_measure/aqualab_4te/asset.contract.json", + "runtime": "scripts/asset_runtime/aqualab_4te.py" + }, + "thumb": "media/thumb/aqualab_4te.webp", + "hero": "media/hero/aqualab_4te.webp" + }, + { + "id": "instrument.ika_plate_rctdigital", + "slug": "ika_plate_rctdigital", + "chem_id": "CHEM-008", + "name": "Magnetic hotplate stirrer", + "maker": "IKA", + "model": "Plate RCT digital", + "title": "IKA Plate RCT digital", + "name_zh": "磁力加热搅拌器IKA Plate (RCT digital)(25004601,附PT1000)", + "domain": "metrology", + "domain_name": "Basic Metrology & Sample Handling", + "domain_zh": "基础计量与样品处理", + "path": "assets/expansion_batch05/t4_measure/ika_plate_rctdigital", + "size_m": [ + 0.16, + 0.27, + 0.0849 + ], + "n_components": 31, + "n_mesh_parts": 31, + "n_joints": 8, + "joint_types": { + "prismatic": 6, + "revolute": 2 + }, + "n_state_slots": 33, + "n_capabilities": 33, + "n_capabilities_implemented": 29, + "n_mechanisms": 1, + "n_readouts": 13, + "n_interface_points": 7, + "n_sources": 14, + "n_limitations": 53, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": true, + "files": { + "glb": "assets/expansion_batch05/t4_measure/ika_plate_rctdigital/model.glb", + "urdf": "assets/expansion_batch05/t4_measure/ika_plate_rctdigital/model.urdf", + "blend": "assets/expansion_batch05/t4_measure/ika_plate_rctdigital/model.blend", + "contract": "assets/expansion_batch05/t4_measure/ika_plate_rctdigital/asset.contract.json", + "runtime": "scripts/asset_runtime/ika_plate_rctdigital.py" + }, + "thumb": "media/thumb/ika_plate_rctdigital.webp", + "hero": "media/hero/ika_plate_rctdigital.webp" + }, + { + "id": "instrument.ika_ks4000", + "slug": "ika_ks4000", + "chem_id": "CHEM-009", + "name": "Incubated orbital shaker", + "maker": "IKA", + "model": "KS 4000 i control", + "title": "IKA KS 4000 i control", + "name_zh": "IKA KS 4000 i control恒温轨道摇床", + "domain": "metrology", + "domain_name": "Basic Metrology & Sample Handling", + "domain_zh": "基础计量与样品处理", + "path": "assets/expansion_batch03/t4_measure/ika_ks4000", + "size_m": [ + 0.58, + 0.75, + 0.52 + ], + "n_components": 48, + "n_mesh_parts": 48, + "n_joints": 14, + "joint_types": { + "prismatic": 13, + "revolute": 1 + }, + "n_state_slots": 33, + "n_capabilities": 14, + "n_capabilities_implemented": 14, + "n_mechanisms": 1, + "n_readouts": 3, + "n_interface_points": 9, + "n_sources": 7, + "n_limitations": 13, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t4_measure/ika_ks4000/model.glb", + "urdf": "assets/expansion_batch03/t4_measure/ika_ks4000/model.urdf", + "blend": "assets/expansion_batch03/t4_measure/ika_ks4000/model.blend", + "contract": "assets/expansion_batch03/t4_measure/ika_ks4000/asset.contract.json", + "runtime": "scripts/asset_runtime/ika_ks4000.py" + }, + "thumb": "media/thumb/ika_ks4000.webp", + "hero": "media/hero/ika_ks4000.webp" + }, + { + "id": "instrument.eppendorf_5910ri", + "slug": "eppendorf_5910ri", + "chem_id": "CHEM-010", + "name": "Refrigerated multipurpose centrifuge", + "maker": "Eppendorf", + "model": "5910 Ri", + "title": "Eppendorf 5910 Ri", + "name_zh": "CHEM-010 冷冻多用途离心机 Eppendorf 5910 Ri", + "domain": "metrology", + "domain_name": "Basic Metrology & Sample Handling", + "domain_zh": "基础计量与样品处理", + "path": "assets/basic40_batch02/t3_analytical/eppendorf_5910ri", + "size_m": [ + 0.72, + 0.68, + 0.37 + ], + "n_components": 16, + "n_mesh_parts": 17, + "n_joints": 2, + "joint_types": { + "revolute": 1, + "continuous": 1 + }, + "n_state_slots": 23, + "n_capabilities": 13, + "n_capabilities_implemented": 9, + "n_mechanisms": 1, + "n_readouts": 2, + "n_interface_points": 24, + "n_sources": 11, + "n_limitations": 23, + "isaac_lab": "bridged", + "glb_up": "y", + "output_templates": false, + "files": { + "glb": "assets/basic40_batch02/t3_analytical/eppendorf_5910ri/model.glb", + "urdf": "assets/basic40_batch02/t3_analytical/eppendorf_5910ri/model.urdf", + "blend": "assets/basic40_batch02/t3_analytical/eppendorf_5910ri/model.blend", + "contract": "assets/basic40_batch02/t3_analytical/eppendorf_5910ri/asset.contract.json", + "runtime": "scripts/basic40_runtime_analytical.py" + }, + "thumb": "media/thumb/eppendorf_5910ri.webp", + "hero": "media/hero/eppendorf_5910ri.webp" + }, + { + "id": "instrument.binder_fd056", + "slug": "binder_fd056", + "chem_id": "CHEM-011", + "name": "Forced-convection drying oven", + "maker": "BINDER", + "model": "FD 56", + "title": "BINDER FD 56", + "name_zh": "强制对流干燥箱BINDER FD 56(FD056-230V,标准配置)", + "domain": "metrology", + "domain_name": "Basic Metrology & Sample Handling", + "domain_zh": "基础计量与样品处理", + "path": "assets/expansion_batch05/t4_measure/binder_fd056", + "size_m": [ + 0.564, + 0.6425, + 0.625 + ], + "n_components": 34, + "n_mesh_parts": 34, + "n_joints": 7, + "joint_types": { + "revolute": 2, + "prismatic": 5 + }, + "n_state_slots": 25, + "n_capabilities": 32, + "n_capabilities_implemented": 24, + "n_mechanisms": 1, + "n_readouts": 6, + "n_interface_points": 8, + "n_sources": 15, + "n_limitations": 52, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": true, + "files": { + "glb": "assets/expansion_batch05/t4_measure/binder_fd056/model.glb", + "urdf": "assets/expansion_batch05/t4_measure/binder_fd056/model.urdf", + "blend": "assets/expansion_batch05/t4_measure/binder_fd056/model.blend", + "contract": "assets/expansion_batch05/t4_measure/binder_fd056/asset.contract.json", + "runtime": "scripts/asset_runtime/binder_fd056.py" + }, + "thumb": "media/thumb/binder_fd056.webp", + "hero": "media/hero/binder_fd056.webp" + }, + { + "id": "instrument.binder_vd56", + "slug": "binder_vd56", + "chem_id": "CHEM-012", + "name": "Vacuum drying oven", + "maker": "BINDER", + "model": "VD 56", + "title": "BINDER VD 56", + "name_zh": "BINDER VD 56 真空干燥箱(标准单铝搁板配置)", + "domain": "metrology", + "domain_name": "Basic Metrology & Sample Handling", + "domain_zh": "基础计量与样品处理", + "path": "assets/basic40_batch02/t1_thermal/binder_vd56", + "size_m": [ + 0.638, + 0.538, + 0.815 + ], + "n_components": 24, + "n_mesh_parts": 24, + "n_joints": 7, + "joint_types": { + "revolute": 3, + "prismatic": 4 + }, + "n_state_slots": 10, + "n_capabilities": 6, + "n_capabilities_implemented": 5, + "n_mechanisms": 1, + "n_readouts": 1, + "n_interface_points": 6, + "n_sources": 14, + "n_limitations": 13, + "isaac_lab": "full", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/basic40_batch02/t1_thermal/binder_vd56/model.glb", + "urdf": "assets/basic40_batch02/t1_thermal/binder_vd56/model.urdf", + "blend": "assets/basic40_batch02/t1_thermal/binder_vd56/model.blend", + "contract": "assets/basic40_batch02/t1_thermal/binder_vd56/asset.contract.json", + "runtime": "scripts/basic40_runtime_thermal.py" + }, + "thumb": "media/thumb/binder_vd56.webp", + "hero": "media/hero/binder_vd56.webp" + }, + { + "id": "instrument.elma_elmasonics60h", + "slug": "elma_elmasonics60h", + "chem_id": "CHEM-013", + "name": "Ultrasonic cleaning bath", + "maker": "Elma", + "model": "Elmasonic S60H", + "title": "Elma Elmasonic S60H", + "name_zh": "Elma Elmasonic S60H原版超声清洗槽", + "domain": "metrology", + "domain_name": "Basic Metrology & Sample Handling", + "domain_zh": "基础计量与样品处理", + "path": "assets/expansion_batch03/t4_measure/elma_elmasonics60h", + "size_m": [ + 0.365, + 0.2104, + 0.2727 + ], + "n_components": 38, + "n_mesh_parts": 38, + "n_joints": 8, + "joint_types": { + "revolute": 3, + "prismatic": 5 + }, + "n_state_slots": 56, + "n_capabilities": 15, + "n_capabilities_implemented": 15, + "n_mechanisms": 1, + "n_readouts": 26, + "n_interface_points": 2, + "n_sources": 5, + "n_limitations": 13, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t4_measure/elma_elmasonics60h/model.glb", + "urdf": "assets/expansion_batch03/t4_measure/elma_elmasonics60h/model.urdf", + "blend": "assets/expansion_batch03/t4_measure/elma_elmasonics60h/model.blend", + "contract": "assets/expansion_batch03/t4_measure/elma_elmasonics60h/asset.contract.json", + "runtime": "scripts/asset_runtime/elma_elmasonics60h.py" + }, + "thumb": "media/thumb/elma_elmasonics60h.webp", + "hero": "media/hero/elma_elmasonics60h.webp" + }, + { + "id": "instrument.hach_tl2300epa", + "slug": "hach_tl2300epa", + "chem_id": "CHEM-014", + "name": "Benchtop turbidimeter", + "maker": "Hach", + "model": "TL2300 EPA", + "title": "Hach TL2300 EPA", + "name_zh": "Hach TL2300 EPA钨灯台式浊度仪", + "domain": "metrology", + "domain_name": "Basic Metrology & Sample Handling", + "domain_zh": "基础计量与样品处理", + "path": "assets/expansion_batch03/t4_measure/hach_tl2300epa", + "size_m": [ + 0.3956, + 0.309, + 0.1534 + ], + "n_components": 33, + "n_mesh_parts": 33, + "n_joints": 2, + "joint_types": { + "revolute": 1, + "prismatic": 1 + }, + "n_state_slots": 26, + "n_capabilities": 11, + "n_capabilities_implemented": 11, + "n_mechanisms": 1, + "n_readouts": 3, + "n_interface_points": 2, + "n_sources": 7, + "n_limitations": 13, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t4_measure/hach_tl2300epa/model.glb", + "urdf": "assets/expansion_batch03/t4_measure/hach_tl2300epa/model.urdf", + "blend": "assets/expansion_batch03/t4_measure/hach_tl2300epa/model.blend", + "contract": "assets/expansion_batch03/t4_measure/hach_tl2300epa/asset.contract.json", + "runtime": "scripts/asset_runtime/hach_tl2300epa.py" + }, + "thumb": "media/thumb/hach_tl2300epa.webp", + "hero": "media/hero/hach_tl2300epa.webp" + }, + { + "id": "instrument.antonpaar_monowave400", + "slug": "antonpaar_monowave400", + "chem_id": "CHEM-015", + "name": "Microwave synthesis reactor", + "maker": "Anton Paar", + "model": "Monowave 400", + "title": "Anton Paar Monowave 400", + "name_zh": "Anton Paar Monowave 400微波合成反应器", + "domain": "synthesis", + "domain_name": "Reaction & Molecular Synthesis", + "domain_zh": "反应与分子合成", + "path": "assets/expansion_batch03/t5_automation/antonpaar_monowave400", + "size_m": [ + 0.4204, + 0.5594, + 0.3102 + ], + "n_components": 40, + "n_mesh_parts": 40, + "n_joints": 3, + "joint_types": { + "prismatic": 3 + }, + "n_state_slots": 32, + "n_capabilities": 12, + "n_capabilities_implemented": 12, + "n_mechanisms": 1, + "n_readouts": 3, + "n_interface_points": 2, + "n_sources": 11, + "n_limitations": 11, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t5_automation/antonpaar_monowave400/model.glb", + "urdf": "assets/expansion_batch03/t5_automation/antonpaar_monowave400/model.urdf", + "blend": "assets/expansion_batch03/t5_automation/antonpaar_monowave400/model.blend", + "contract": "assets/expansion_batch03/t5_automation/antonpaar_monowave400/asset.contract.json", + "runtime": "scripts/asset_runtime/antonpaar_monowave400.py" + }, + "thumb": "media/thumb/antonpaar_monowave400.webp", + "hero": "media/hero/antonpaar_monowave400.webp" + }, + { + "id": "instrument.ika_electrasyn2", + "slug": "ika_electrasyn2", + "chem_id": "CHEM-016", + "name": "Electro-organic synthesis system", + "maker": "IKA", + "model": "ElectraSyn 2.0", + "title": "IKA ElectraSyn 2.0", + "name_zh": "IKA ElectraSyn 2.0 Package电有机合成仪", + "domain": "synthesis", + "domain_name": "Reaction & Molecular Synthesis", + "domain_zh": "反应与分子合成", + "path": "assets/expansion_batch03/t5_automation/ika_electrasyn2", + "size_m": [ + 0.13, + 0.2509, + 0.15 + ], + "n_components": 36, + "n_mesh_parts": 36, + "n_joints": 2, + "joint_types": { + "revolute": 1, + "prismatic": 1 + }, + "n_state_slots": 40, + "n_capabilities": 12, + "n_capabilities_implemented": 12, + "n_mechanisms": 1, + "n_readouts": 4, + "n_interface_points": 1, + "n_sources": 10, + "n_limitations": 13, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t5_automation/ika_electrasyn2/model.glb", + "urdf": "assets/expansion_batch03/t5_automation/ika_electrasyn2/model.urdf", + "blend": "assets/expansion_batch03/t5_automation/ika_electrasyn2/model.blend", + "contract": "assets/expansion_batch03/t5_automation/ika_electrasyn2/asset.contract.json", + "runtime": "scripts/asset_runtime/ika_electrasyn2.py" + }, + "thumb": "media/thumb/ika_electrasyn2.webp", + "hero": "media/hero/ika_electrasyn2.webp" + }, + { + "id": "instrument.hepatochem_photoredoxbox", + "slug": "hepatochem_photoredoxbox", + "chem_id": "CHEM-017", + "name": "Photochemical reactor", + "maker": "HepatoChem", + "model": "PhotoRedOx Box UV-Vis", + "title": "HepatoChem PhotoRedOx Box UV-Vis", + "name_zh": "HepatoChem PhotoRedOx Box UV-Vis HCK1022-01-001受控光反应器", + "domain": "synthesis", + "domain_name": "Reaction & Molecular Synthesis", + "domain_zh": "反应与分子合成", + "path": "assets/expansion_batch03/t5_automation/hepatochem_photoredoxbox", + "size_m": [ + 0.3556, + 0.3556, + 0.3048 + ], + "n_components": 62, + "n_mesh_parts": 112, + "n_joints": 3, + "joint_types": { + "prismatic": 2, + "revolute": 1 + }, + "n_state_slots": 36, + "n_capabilities": 15, + "n_capabilities_implemented": 15, + "n_mechanisms": 1, + "n_readouts": 3, + "n_interface_points": 8, + "n_sources": 7, + "n_limitations": 20, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t5_automation/hepatochem_photoredoxbox/model.glb", + "urdf": "assets/expansion_batch03/t5_automation/hepatochem_photoredoxbox/model.urdf", + "blend": "assets/expansion_batch03/t5_automation/hepatochem_photoredoxbox/model.blend", + "contract": "assets/expansion_batch03/t5_automation/hepatochem_photoredoxbox/asset.contract.json", + "runtime": "scripts/asset_runtime/hepatochem_photoredoxbox.py" + }, + "thumb": "media/thumb/hepatochem_photoredoxbox.webp", + "hero": "media/hero/hepatochem_photoredoxbox.webp" + }, + { + "id": "instrument.parr_4591", + "slug": "parr_4591", + "chem_id": "CHEM-018", + "name": "Micro high-pressure stirred reactor", + "maker": "Parr Instrument", + "model": "4591", + "title": "Parr Instrument 4591", + "name_zh": "微型高压搅拌反应釜 Parr Instrument 4591(标准FKM密封)", + "domain": "synthesis", + "domain_name": "Reaction & Molecular Synthesis", + "domain_zh": "反应与分子合成", + "path": "assets/basic40_batch02/t1_thermal/parr_4591", + "size_m": [ + 0.3048, + 0.4572, + 0.6858 + ], + "n_components": 30, + "n_mesh_parts": 30, + "n_joints": 9, + "joint_types": { + "revolute": 3, + "prismatic": 5, + "continuous": 1 + }, + "n_state_slots": 22, + "n_capabilities": 10, + "n_capabilities_implemented": 7, + "n_mechanisms": 1, + "n_readouts": 1, + "n_interface_points": 1, + "n_sources": 10, + "n_limitations": 20, + "isaac_lab": "partial", + "glb_up": "y", + "output_templates": false, + "files": { + "glb": "assets/basic40_batch02/t1_thermal/parr_4591/model.glb", + "urdf": "assets/basic40_batch02/t1_thermal/parr_4591/model.urdf", + "blend": "assets/basic40_batch02/t1_thermal/parr_4591/model.blend", + "contract": "assets/basic40_batch02/t1_thermal/parr_4591/asset.contract.json", + "runtime": "scripts/basic40_runtime_thermal.py" + }, + "thumb": "media/thumb/parr_4591.webp", + "hero": "media/hero/parr_4591.webp" + }, + { + "id": "instrument.syrris_asiadiscovery", + "slug": "syrris_asiadiscovery", + "chem_id": "CHEM-019", + "name": "Continuous-flow chemistry system", + "maker": "Syrris", + "model": "Asia Discovery", + "title": "Syrris Asia Discovery", + "name_zh": "Syrris Asia Discovery Regular 连续流化学合成系统", + "domain": "synthesis", + "domain_name": "Reaction & Molecular Synthesis", + "domain_zh": "反应与分子合成", + "path": "assets/expansion_batch03/t5_automation/syrris_asiadiscovery", + "size_m": [ + 1.23, + 0.3103, + 0.48 + ], + "n_components": 66, + "n_mesh_parts": 67, + "n_joints": 4, + "joint_types": { + "revolute": 1, + "prismatic": 3 + }, + "n_state_slots": 38, + "n_capabilities": 13, + "n_capabilities_implemented": 13, + "n_mechanisms": 1, + "n_readouts": 3, + "n_interface_points": 11, + "n_sources": 16, + "n_limitations": 21, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t5_automation/syrris_asiadiscovery/model.glb", + "urdf": "assets/expansion_batch03/t5_automation/syrris_asiadiscovery/model.urdf", + "blend": "assets/expansion_batch03/t5_automation/syrris_asiadiscovery/model.blend", + "contract": "assets/expansion_batch03/t5_automation/syrris_asiadiscovery/asset.contract.json", + "runtime": "scripts/asset_runtime/syrris_asiadiscovery.py" + }, + "thumb": "media/thumb/syrris_asiadiscovery.webp", + "hero": "media/hero/syrris_asiadiscovery.webp" + }, + { + "id": "instrument.thalesnano_hcube", + "slug": "thalesnano_hcube", + "chem_id": "CHEM-020", + "name": "Continuous-flow hydrogenation reactor", + "maker": "ThalesNano", + "model": "H-Cube Pro", + "title": "ThalesNano H-Cube Pro", + "name_zh": "ThalesNano H-Cube Pro 连续流催化加氢仪", + "domain": "synthesis", + "domain_name": "Reaction & Molecular Synthesis", + "domain_zh": "反应与分子合成", + "path": "assets/expansion_batch03/t5_automation/thalesnano_hcube", + "size_m": [ + 0.4962, + 0.5095, + 0.2745 + ], + "n_components": 70, + "n_mesh_parts": 70, + "n_joints": 5, + "joint_types": { + "revolute": 3, + "prismatic": 2 + }, + "n_state_slots": 41, + "n_capabilities": 17, + "n_capabilities_implemented": 17, + "n_mechanisms": 1, + "n_readouts": 3, + "n_interface_points": 6, + "n_sources": 11, + "n_limitations": 30, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t5_automation/thalesnano_hcube/model.glb", + "urdf": "assets/expansion_batch03/t5_automation/thalesnano_hcube/model.urdf", + "blend": "assets/expansion_batch03/t5_automation/thalesnano_hcube/model.blend", + "contract": "assets/expansion_batch03/t5_automation/thalesnano_hcube/asset.contract.json", + "runtime": "scripts/asset_runtime/thalesnano_hcube.py" + }, + "thumb": "media/thumb/thalesnano_hcube.webp", + "hero": "media/hero/thalesnano_hcube.webp" + }, + { + "id": "instrument.radleys_mya4", + "slug": "radleys_mya4", + "chem_id": "CHEM-021", + "name": "Parallel reaction station (4 independent zones)", + "maker": "Radleys", + "model": "Mya 4", + "title": "Radleys Mya 4", + "name_zh": "独立温区并行反应工作站 Radleys Mya 4", + "domain": "synthesis", + "domain_name": "Reaction & Molecular Synthesis", + "domain_zh": "反应与分子合成", + "path": "assets/basic40_batch02/t1_thermal/radleys_mya4", + "size_m": [ + 0.6, + 0.611, + 0.4992 + ], + "n_components": 33, + "n_mesh_parts": 33, + "n_joints": 4, + "joint_types": { + "continuous": 4 + }, + "n_state_slots": 92, + "n_capabilities": 15, + "n_capabilities_implemented": 10, + "n_mechanisms": 2, + "n_readouts": 4, + "n_interface_points": 4, + "n_sources": 12, + "n_limitations": 18, + "isaac_lab": "bridged", + "glb_up": "y", + "output_templates": false, + "files": { + "glb": "assets/basic40_batch02/t1_thermal/radleys_mya4/model.glb", + "urdf": "assets/basic40_batch02/t1_thermal/radleys_mya4/model.urdf", + "blend": "assets/basic40_batch02/t1_thermal/radleys_mya4/model.blend", + "contract": "assets/basic40_batch02/t1_thermal/radleys_mya4/asset.contract.json", + "runtime": "scripts/basic40_runtime_thermal.py" + }, + "thumb": "media/thumb/radleys_mya4.webp", + "hero": "media/hero/radleys_mya4.webp" + }, + { + "id": "instrument.cem_libertyblue", + "slug": "cem_libertyblue", + "chem_id": "CHEM-022", + "name": "Automated microwave peptide synthesizer", + "maker": "CEM", + "model": "Liberty Blue 2.0", + "title": "CEM Liberty Blue 2.0", + "name_zh": "CEM Liberty Blue 2.0 自动固相多肽合成仪", + "domain": "synthesis", + "domain_name": "Reaction & Molecular Synthesis", + "domain_zh": "反应与分子合成", + "path": "assets/expansion_batch03/t5_automation/cem_libertyblue", + "size_m": [ + 1.15, + 0.52, + 0.78 + ], + "n_components": 103, + "n_mesh_parts": 103, + "n_joints": 2, + "joint_types": { + "prismatic": 2 + }, + "n_state_slots": 34, + "n_capabilities": 13, + "n_capabilities_implemented": 13, + "n_mechanisms": 1, + "n_readouts": 3, + "n_interface_points": 47, + "n_sources": 15, + "n_limitations": 27, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t5_automation/cem_libertyblue/model.glb", + "urdf": "assets/expansion_batch03/t5_automation/cem_libertyblue/model.urdf", + "blend": "assets/expansion_batch03/t5_automation/cem_libertyblue/model.blend", + "contract": "assets/expansion_batch03/t5_automation/cem_libertyblue/asset.contract.json", + "runtime": "scripts/asset_runtime/cem_libertyblue.py" + }, + "thumb": "media/thumb/cem_libertyblue.webp", + "hero": "media/hero/cem_libertyblue.webp" + }, + { + "id": "instrument.cytiva_ktaoligosynt", + "slug": "cytiva_ktaoligosynt", + "chem_id": "CHEM-023", + "name": "Oligonucleotide synthesizer", + "maker": "Cytiva", + "model": "ÄKTA oligosynt", + "title": "Cytiva ÄKTA oligosynt", + "name_zh": "Cytiva ÄKTA oligosynt 寡核苷酸合成仪", + "domain": "synthesis", + "domain_name": "Reaction & Molecular Synthesis", + "domain_zh": "反应与分子合成", + "path": "assets/expansion_batch03/t5_automation/cytiva_ktaoligosynt", + "size_m": [ + 0.7, + 0.54, + 0.63 + ], + "n_components": 116, + "n_mesh_parts": 116, + "n_joints": 3, + "joint_types": { + "revolute": 2, + "prismatic": 1 + }, + "n_state_slots": 31, + "n_capabilities": 12, + "n_capabilities_implemented": 12, + "n_mechanisms": 1, + "n_readouts": 3, + "n_interface_points": 53, + "n_sources": 15, + "n_limitations": 39, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t5_automation/cytiva_ktaoligosynt/model.glb", + "urdf": "assets/expansion_batch03/t5_automation/cytiva_ktaoligosynt/model.urdf", + "blend": "assets/expansion_batch03/t5_automation/cytiva_ktaoligosynt/model.blend", + "contract": "assets/expansion_batch03/t5_automation/cytiva_ktaoligosynt/asset.contract.json", + "runtime": "scripts/asset_runtime/cytiva_ktaoligosynt.py" + }, + "thumb": "media/thumb/cytiva_ktaoligosynt.webp", + "hero": "media/hero/cytiva_ktaoligosynt.webp" + }, + { + "id": "instrument.ika_rv10_digital_v", + "slug": "ika_rv10_digital_v", + "chem_id": "CHEM-024", + "name": "Rotary evaporator", + "maker": "IKA", + "model": "RV 10 digital V", + "title": "IKA RV 10 digital V", + "name_zh": "IKA RV 10 digital V 旋转蒸发仪", + "domain": "separation", + "domain_name": "Extraction, Purification & Drying", + "domain_zh": "萃取纯化与干燥", + "path": "assets/basic40_batch02/t2_vacuum/ika_rv10", + "size_m": [ + 0.5, + 0.44, + 0.6822 + ], + "n_components": 23, + "n_mesh_parts": 23, + "n_joints": 5, + "joint_types": { + "prismatic": 3, + "continuous": 1, + "revolute": 1 + }, + "n_state_slots": 26, + "n_capabilities": 10, + "n_capabilities_implemented": 8, + "n_mechanisms": 4, + "n_readouts": 2, + "n_interface_points": 2, + "n_sources": 13, + "n_limitations": 15, + "isaac_lab": "bridged", + "glb_up": "y", + "output_templates": false, + "files": { + "glb": "assets/basic40_batch02/t2_vacuum/ika_rv10/model.glb", + "urdf": "assets/basic40_batch02/t2_vacuum/ika_rv10/model.urdf", + "blend": "assets/basic40_batch02/t2_vacuum/ika_rv10/model.blend", + "contract": "assets/basic40_batch02/t2_vacuum/ika_rv10/asset.contract.json", + "runtime": "scripts/basic40_runtime_vacuum.py" + }, + "thumb": "media/thumb/ika_rv10_digital_v.webp", + "hero": "media/hero/ika_rv10_digital_v.webp" + }, + { + "id": "instrument.buchi_lyovapor_l250_pro", + "slug": "buchi_lyovapor_l250_pro", + "chem_id": "CHEM-025", + "name": "Freeze dryer", + "maker": "BUCHI", + "model": "Lyovapor L-250 Pro", + "title": "BUCHI Lyovapor L-250 Pro", + "name_zh": "冷冻干燥机 BUCHI Lyovapor L-250 Pro", + "domain": "separation", + "domain_name": "Extraction, Purification & Drying", + "domain_zh": "萃取纯化与干燥", + "path": "assets/basic40_batch02/t2_vacuum/buchi_lyovapor_l250", + "size_m": [ + 0.503, + 0.645, + 0.9275 + ], + "n_components": 14, + "n_mesh_parts": 14, + "n_joints": 3, + "joint_types": { + "prismatic": 2, + "revolute": 1 + }, + "n_state_slots": 34, + "n_capabilities": 13, + "n_capabilities_implemented": 13, + "n_mechanisms": 1, + "n_readouts": 3, + "n_interface_points": 4, + "n_sources": 8, + "n_limitations": 22, + "isaac_lab": "bridged", + "glb_up": "y", + "output_templates": false, + "files": { + "glb": "assets/basic40_batch02/t2_vacuum/buchi_lyovapor_l250/model.glb", + "urdf": "assets/basic40_batch02/t2_vacuum/buchi_lyovapor_l250/model.urdf", + "blend": "assets/basic40_batch02/t2_vacuum/buchi_lyovapor_l250/model.blend", + "contract": "assets/basic40_batch02/t2_vacuum/buchi_lyovapor_l250/asset.contract.json", + "runtime": "scripts/basic40_runtime_vacuum.py" + }, + "thumb": "media/thumb/buchi_lyovapor_l250_pro.webp", + "hero": "media/hero/buchi_lyovapor_l250_pro.webp" + }, + { + "id": "instrument.buchi_minispray", + "slug": "buchi_minispray", + "chem_id": "CHEM-026", + "name": "Lab spray dryer", + "maker": "BUCHI", + "model": "Mini Spray Dryer S-300", + "title": "BUCHI Mini Spray Dryer S-300", + "name_zh": "BUCHI Mini Spray Dryer S-300 实验室喷雾干燥机", + "domain": "separation", + "domain_name": "Extraction, Purification & Drying", + "domain_zh": "萃取纯化与干燥", + "path": "assets/expansion_batch03/t2_vacuum/buchi_minispray", + "size_m": [ + 0.62, + 0.64, + 1.052 + ], + "n_components": 62, + "n_mesh_parts": 62, + "n_joints": 2, + "joint_types": { + "prismatic": 2 + }, + "n_state_slots": 26, + "n_capabilities": 16, + "n_capabilities_implemented": 16, + "n_mechanisms": 1, + "n_readouts": 3, + "n_interface_points": 13, + "n_sources": 11, + "n_limitations": 37, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t2_vacuum/buchi_minispray/model.glb", + "urdf": "assets/expansion_batch03/t2_vacuum/buchi_minispray/model.urdf", + "blend": "assets/expansion_batch03/t2_vacuum/buchi_minispray/model.blend", + "contract": "assets/expansion_batch03/t2_vacuum/buchi_minispray/asset.contract.json", + "runtime": "scripts/asset_runtime/buchi_minispray.py" + }, + "thumb": "media/thumb/buchi_minispray.webp", + "hero": "media/hero/buchi_minispray.webp" + }, + { + "id": "instrument.tousimis_autosamdri815", + "slug": "tousimis_autosamdri815", + "chem_id": "CHEM-027", + "name": "Critical point dryer", + "maker": "Tousimis", + "model": "Autosamdri-815 Series B", + "title": "Tousimis Autosamdri-815 Series B", + "name_zh": "Tousimis Autosamdri-815 Series B 8779C 临界点干燥仪", + "domain": "separation", + "domain_name": "Extraction, Purification & Drying", + "domain_zh": "萃取纯化与干燥", + "path": "assets/expansion_batch03/t2_vacuum/tousimis_autosamdri815", + "size_m": [ + 0.598, + 0.546, + 0.32 + ], + "n_components": 66, + "n_mesh_parts": 67, + "n_joints": 2, + "joint_types": { + "prismatic": 2 + }, + "n_state_slots": 30, + "n_capabilities": 13, + "n_capabilities_implemented": 13, + "n_mechanisms": 1, + "n_readouts": 3, + "n_interface_points": 8, + "n_sources": 12, + "n_limitations": 40, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t2_vacuum/tousimis_autosamdri815/model.glb", + "urdf": "assets/expansion_batch03/t2_vacuum/tousimis_autosamdri815/model.urdf", + "blend": "assets/expansion_batch03/t2_vacuum/tousimis_autosamdri815/model.blend", + "contract": "assets/expansion_batch03/t2_vacuum/tousimis_autosamdri815/asset.contract.json", + "runtime": "scripts/asset_runtime/tousimis_autosamdri815.py" + }, + "thumb": "media/thumb/tousimis_autosamdri815.webp", + "hero": "media/hero/tousimis_autosamdri815.webp" + }, + { + "id": "instrument.buchi_speedextractore", + "slug": "buchi_speedextractore", + "chem_id": "CHEM-028", + "name": "Pressurized solvent extractor", + "maker": "BUCHI", + "model": "SpeedExtractor E-916", + "title": "BUCHI SpeedExtractor E-916", + "name_zh": "BUCHI SpeedExtractor E-916 六位四溶剂加压萃取仪", + "domain": "separation", + "domain_name": "Extraction, Purification & Drying", + "domain_zh": "萃取纯化与干燥", + "path": "assets/expansion_batch03/t2_vacuum/buchi_speedextractore", + "size_m": [ + 0.67, + 0.5, + 0.725 + ], + "n_components": 138, + "n_mesh_parts": 139, + "n_joints": 4, + "joint_types": { + "prismatic": 4 + }, + "n_state_slots": 33, + "n_capabilities": 14, + "n_capabilities_implemented": 14, + "n_mechanisms": 1, + "n_readouts": 3, + "n_interface_points": 24, + "n_sources": 14, + "n_limitations": 41, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t2_vacuum/buchi_speedextractore/model.glb", + "urdf": "assets/expansion_batch03/t2_vacuum/buchi_speedextractore/model.urdf", + "blend": "assets/expansion_batch03/t2_vacuum/buchi_speedextractore/model.blend", + "contract": "assets/expansion_batch03/t2_vacuum/buchi_speedextractore/asset.contract.json", + "runtime": "scripts/asset_runtime/buchi_speedextractore.py" + }, + "thumb": "media/thumb/buchi_speedextractore.webp", + "hero": "media/hero/buchi_speedextractore.webp" + }, + { + "id": "instrument.gilson_cpc250", + "slug": "gilson_cpc250", + "chem_id": "CHEM-029", + "name": "Centrifugal partition chromatograph", + "maker": "Gilson", + "model": "CPC 250", + "title": "Gilson CPC 250", + "name_zh": "Gilson CPC250与PLC2050液液分配纯化系统", + "domain": "separation", + "domain_name": "Extraction, Purification & Drying", + "domain_zh": "萃取纯化与干燥", + "path": "assets/expansion_batch03/t2_vacuum/gilson_cpc250", + "size_m": [ + 1.39, + 0.59, + 0.66 + ], + "n_components": 256, + "n_mesh_parts": 257, + "n_joints": 3, + "joint_types": { + "revolute": 1, + "prismatic": 2 + }, + "n_state_slots": 28, + "n_capabilities": 10, + "n_capabilities_implemented": 10, + "n_mechanisms": 1, + "n_readouts": 3, + "n_interface_points": 202, + "n_sources": 11, + "n_limitations": 37, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t2_vacuum/gilson_cpc250/model.glb", + "urdf": "assets/expansion_batch03/t2_vacuum/gilson_cpc250/model.urdf", + "blend": "assets/expansion_batch03/t2_vacuum/gilson_cpc250/model.blend", + "contract": "assets/expansion_batch03/t2_vacuum/gilson_cpc250/asset.contract.json", + "runtime": "scripts/asset_runtime/gilson_cpc250.py" + }, + "thumb": "media/thumb/gilson_cpc250.webp", + "hero": "media/hero/gilson_cpc250.webp" + }, + { + "id": "instrument.sartorius_vivaflow200", + "slug": "sartorius_vivaflow200", + "chem_id": "CHEM-030", + "name": "Tangential-flow ultrafiltration module", + "maker": "Sartorius", + "model": "Vivaflow 200", + "title": "Sartorius Vivaflow 200", + "name_zh": "Sartorius Vivaflow200单盒切向流超滤组件", + "domain": "separation", + "domain_name": "Extraction, Purification & Drying", + "domain_zh": "萃取纯化与干燥", + "path": "assets/expansion_batch03/t2_vacuum/sartorius_vivaflow200", + "size_m": [ + 0.1808, + 0.038, + 0.2025 + ], + "n_components": 48, + "n_mesh_parts": 48, + "n_joints": 1, + "joint_types": { + "prismatic": 1 + }, + "n_state_slots": 33, + "n_capabilities": 10, + "n_capabilities_implemented": 10, + "n_mechanisms": 1, + "n_readouts": 0, + "n_interface_points": 4, + "n_sources": 14, + "n_limitations": 39, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t2_vacuum/sartorius_vivaflow200/model.glb", + "urdf": "assets/expansion_batch03/t2_vacuum/sartorius_vivaflow200/model.urdf", + "blend": "assets/expansion_batch03/t2_vacuum/sartorius_vivaflow200/model.blend", + "contract": "assets/expansion_batch03/t2_vacuum/sartorius_vivaflow200/asset.contract.json", + "runtime": "scripts/asset_runtime/sartorius_vivaflow200.py" + }, + "thumb": "media/thumb/sartorius_vivaflow200.webp", + "hero": "media/hero/sartorius_vivaflow200.webp" + }, + { + "id": "instrument.biotage_extrahera_classic", + "slug": "biotage_extrahera_classic", + "chem_id": "CHEM-031", + "name": "Automated solid-phase extraction workstation", + "maker": "Biotage", + "model": "Extrahera Classic", + "title": "Biotage Extrahera Classic", + "name_zh": "Biotage Extrahera Classic 自动固相萃取工作站", + "domain": "separation", + "domain_name": "Extraction, Purification & Drying", + "domain_zh": "萃取纯化与干燥", + "path": "assets/basic40_batch02/t2_vacuum/biotage_extrahera", + "size_m": [ + 0.86, + 0.57, + 0.73 + ], + "n_components": 24, + "n_mesh_parts": 24, + "n_joints": 0, + "joint_types": {}, + "n_state_slots": 30, + "n_capabilities": 10, + "n_capabilities_implemented": 10, + "n_mechanisms": 1, + "n_readouts": 0, + "n_interface_points": 3, + "n_sources": 14, + "n_limitations": 20, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/basic40_batch02/t2_vacuum/biotage_extrahera/model.glb", + "urdf": "assets/basic40_batch02/t2_vacuum/biotage_extrahera/model.urdf", + "blend": "assets/basic40_batch02/t2_vacuum/biotage_extrahera/model.blend", + "contract": "assets/basic40_batch02/t2_vacuum/biotage_extrahera/asset.contract.json", + "runtime": "scripts/basic40_runtime_vacuum.py" + }, + "thumb": "media/thumb/biotage_extrahera_classic.webp", + "hero": "media/hero/biotage_extrahera_classic.webp" + }, + { + "id": "instrument.sft_sft110", + "slug": "sft_sft110", + "chem_id": "CHEM-032", + "name": "Supercritical fluid extractor", + "maker": "Supercritical Fluid Technologies", + "model": "SFT-110", + "title": "Supercritical Fluid Technologies SFT-110", + "name_zh": "SFT110超临界流体萃取仪100mL配置", + "domain": "separation", + "domain_name": "Extraction, Purification & Drying", + "domain_zh": "萃取纯化与干燥", + "path": "assets/expansion_batch03/t2_vacuum/sft_sft110", + "size_m": [ + 0.29, + 0.57, + 0.76 + ], + "n_components": 64, + "n_mesh_parts": 65, + "n_joints": 3, + "joint_types": { + "revolute": 2, + "prismatic": 1 + }, + "n_state_slots": 30, + "n_capabilities": 13, + "n_capabilities_implemented": 13, + "n_mechanisms": 1, + "n_readouts": 3, + "n_interface_points": 6, + "n_sources": 11, + "n_limitations": 39, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t2_vacuum/sft_sft110/model.glb", + "urdf": "assets/expansion_batch03/t2_vacuum/sft_sft110/model.urdf", + "blend": "assets/expansion_batch03/t2_vacuum/sft_sft110/model.blend", + "contract": "assets/expansion_batch03/t2_vacuum/sft_sft110/asset.contract.json", + "runtime": "scripts/asset_runtime/sft_sft110.py" + }, + "thumb": "media/thumb/sft_sft110.webp", + "hero": "media/hero/sft_sft110.webp" + }, + { + "id": "instrument.syrris_asiafllex", + "slug": "syrris_asiafllex", + "chem_id": "CHEM-033", + "name": "Flow liquid–liquid extraction module", + "maker": "Syrris", + "model": "Asia FLLEX", + "title": "Syrris Asia FLLEX", + "name_zh": "Asia FLLEX连续流液液萃取模块", + "domain": "separation", + "domain_name": "Extraction, Purification & Drying", + "domain_zh": "萃取纯化与干燥", + "path": "assets/expansion_batch03/t2_vacuum/syrris_asiafllex", + "size_m": [ + 0.16, + 0.3032, + 0.13 + ], + "n_components": 58, + "n_mesh_parts": 58, + "n_joints": 2, + "joint_types": { + "prismatic": 2 + }, + "n_state_slots": 42, + "n_capabilities": 15, + "n_capabilities_implemented": 15, + "n_mechanisms": 1, + "n_readouts": 1, + "n_interface_points": 6, + "n_sources": 14, + "n_limitations": 38, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t2_vacuum/syrris_asiafllex/model.glb", + "urdf": "assets/expansion_batch03/t2_vacuum/syrris_asiafllex/model.urdf", + "blend": "assets/expansion_batch03/t2_vacuum/syrris_asiafllex/model.blend", + "contract": "assets/expansion_batch03/t2_vacuum/syrris_asiafllex/asset.contract.json", + "runtime": "scripts/asset_runtime/syrris_asiafllex.py" + }, + "thumb": "media/thumb/syrris_asiafllex.webp", + "hero": "media/hero/syrris_asiafllex.webp" + }, + { + "id": "instrument.biotage_selekt", + "slug": "biotage_selekt", + "chem_id": "CHEM-034", + "name": "Automated flash chromatography system", + "maker": "Biotage", + "model": "Selekt (UV, single bed)", + "title": "Biotage Selekt (UV, single bed)", + "name_zh": "Biotage Selekt双通道单床UV快速制备色谱仪", + "domain": "separation", + "domain_name": "Extraction, Purification & Drying", + "domain_zh": "萃取纯化与干燥", + "path": "assets/expansion_batch03/t2_vacuum/biotage_selekt", + "size_m": [ + 0.335, + 0.393, + 0.545 + ], + "n_components": 200, + "n_mesh_parts": 201, + "n_joints": 3, + "joint_types": { + "prismatic": 3 + }, + "n_state_slots": 55, + "n_capabilities": 15, + "n_capabilities_implemented": 15, + "n_mechanisms": 1, + "n_readouts": 4, + "n_interface_points": 151, + "n_sources": 12, + "n_limitations": 40, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t2_vacuum/biotage_selekt/model.glb", + "urdf": "assets/expansion_batch03/t2_vacuum/biotage_selekt/model.urdf", + "blend": "assets/expansion_batch03/t2_vacuum/biotage_selekt/model.blend", + "contract": "assets/expansion_batch03/t2_vacuum/biotage_selekt/asset.contract.json", + "runtime": "scripts/asset_runtime/biotage_selekt.py" + }, + "thumb": "media/thumb/biotage_selekt.webp", + "hero": "media/hero/biotage_selekt.webp" + }, + { + "id": "instrument.pccell_ed64002", + "slug": "pccell_ed64002", + "chem_id": "CHEM-035", + "name": "Lab electrodialysis stack", + "maker": "PCCell", + "model": "ED 64002 + BED1-2 Basic", + "title": "PCCell ED 64002 + BED1-2 Basic", + "name_zh": "PCCell ED64002 / BED1-2 Basic实验室电渗析组件", + "domain": "separation", + "domain_name": "Extraction, Purification & Drying", + "domain_zh": "萃取纯化与干燥", + "path": "assets/expansion_batch03/t2_vacuum/pccell_ed64002", + "size_m": [ + 0.8, + 0.36, + 0.3412 + ], + "n_components": 112, + "n_mesh_parts": 113, + "n_joints": 3, + "joint_types": { + "revolute": 3 + }, + "n_state_slots": 28, + "n_capabilities": 14, + "n_capabilities_implemented": 14, + "n_mechanisms": 1, + "n_readouts": 2, + "n_interface_points": 10, + "n_sources": 11, + "n_limitations": 27, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t2_vacuum/pccell_ed64002/model.glb", + "urdf": "assets/expansion_batch03/t2_vacuum/pccell_ed64002/model.urdf", + "blend": "assets/expansion_batch03/t2_vacuum/pccell_ed64002/model.blend", + "contract": "assets/expansion_batch03/t2_vacuum/pccell_ed64002/asset.contract.json", + "runtime": "scripts/asset_runtime/pccell_ed64002.py" + }, + "thumb": "media/thumb/pccell_ed64002.webp", + "hero": "media/hero/pccell_ed64002.webp" + }, + { + "id": "instrument.genevac_mivac2", + "slug": "genevac_mivac2", + "chem_id": "CHEM-036", + "name": "Centrifugal vacuum concentrator", + "maker": "Genevac / SP Industries", + "model": "miVac 2 Duo", + "title": "Genevac / SP Industries miVac 2 Duo", + "name_zh": "Genevac miVac 2 Duo离心真空浓缩仪 Rev00101/25", + "domain": "separation", + "domain_name": "Extraction, Purification & Drying", + "domain_zh": "萃取纯化与干燥", + "path": "assets/expansion_batch03/t2_vacuum/genevac_mivac2", + "size_m": [ + 0.3605, + 0.4567, + 0.3002 + ], + "n_components": 52, + "n_mesh_parts": 52, + "n_joints": 9, + "joint_types": { + "revolute": 5, + "prismatic": 4 + }, + "n_state_slots": 22, + "n_capabilities": 13, + "n_capabilities_implemented": 13, + "n_mechanisms": 1, + "n_readouts": 2, + "n_interface_points": 8, + "n_sources": 12, + "n_limitations": 27, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t2_vacuum/genevac_mivac2/model.glb", + "urdf": "assets/expansion_batch03/t2_vacuum/genevac_mivac2/model.urdf", + "blend": "assets/expansion_batch03/t2_vacuum/genevac_mivac2/model.blend", + "contract": "assets/expansion_batch03/t2_vacuum/genevac_mivac2/asset.contract.json", + "runtime": "scripts/asset_runtime/genevac_mivac2.py" + }, + "thumb": "media/thumb/genevac_mivac2.webp", + "hero": "media/hero/genevac_mivac2.webp" + }, + { + "id": "instrument.pilodist_pilodist104", + "slug": "pilodist_pilodist104", + "chem_id": "CHEM-037", + "name": "High-efficiency lab fractional distillation unit", + "maker": "PILODIST", + "model": "PILODIST 104", + "title": "PILODIST PILODIST 104", + "name_zh": "PILODIST104高效实验室精馏装置6L90板规格", + "domain": "separation", + "domain_name": "Extraction, Purification & Drying", + "domain_zh": "萃取纯化与干燥", + "path": "assets/expansion_batch03/t2_vacuum/pilodist_pilodist104", + "size_m": [ + 1.6, + 0.5, + 2.7 + ], + "n_components": 95, + "n_mesh_parts": 96, + "n_joints": 4, + "joint_types": { + "prismatic": 3, + "revolute": 1 + }, + "n_state_slots": 24, + "n_capabilities": 15, + "n_capabilities_implemented": 15, + "n_mechanisms": 1, + "n_readouts": 2, + "n_interface_points": 12, + "n_sources": 14, + "n_limitations": 25, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t2_vacuum/pilodist_pilodist104/model.glb", + "urdf": "assets/expansion_batch03/t2_vacuum/pilodist_pilodist104/model.urdf", + "blend": "assets/expansion_batch03/t2_vacuum/pilodist_pilodist104/model.blend", + "contract": "assets/expansion_batch03/t2_vacuum/pilodist_pilodist104/asset.contract.json", + "runtime": "scripts/asset_runtime/pilodist_pilodist104.py" + }, + "thumb": "media/thumb/pilodist_pilodist104.webp", + "hero": "media/hero/pilodist_pilodist104.webp" + }, + { + "id": "instrument.uic_kdl1basic", + "slug": "uic_kdl1basic", + "chem_id": "CHEM-038", + "name": "Short-path wiped-film molecular still", + "maker": "UIC", + "model": "KDL1 Basic", + "title": "UIC KDL1 Basic", + "name_zh": "UIC KDL1 Basic 刮膜短程分子蒸馏装置", + "domain": "separation", + "domain_name": "Extraction, Purification & Drying", + "domain_zh": "萃取纯化与干燥", + "path": "assets/expansion_batch03/t2_vacuum/uic_kdl1basic", + "size_m": [ + 0.8, + 0.4, + 1.2 + ], + "n_components": 74, + "n_mesh_parts": 74, + "n_joints": 5, + "joint_types": { + "revolute": 4, + "prismatic": 1 + }, + "n_state_slots": 30, + "n_capabilities": 17, + "n_capabilities_implemented": 17, + "n_mechanisms": 1, + "n_readouts": 1, + "n_interface_points": 13, + "n_sources": 23, + "n_limitations": 30, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t2_vacuum/uic_kdl1basic/model.glb", + "urdf": "assets/expansion_batch03/t2_vacuum/uic_kdl1basic/model.urdf", + "blend": "assets/expansion_batch03/t2_vacuum/uic_kdl1basic/model.blend", + "contract": "assets/expansion_batch03/t2_vacuum/uic_kdl1basic/asset.contract.json", + "runtime": "scripts/asset_runtime/uic_kdl1basic.py" + }, + "thumb": "media/thumb/uic_kdl1basic.webp", + "hero": "media/hero/uic_kdl1basic.webp" + }, + { + "id": "instrument.scp_digiprepms", + "slug": "scp_digiprepms", + "chem_id": "CHEM-039", + "name": "Graphite block digestion system", + "maker": "SCP SCIENCE", + "model": "DigiPREP MS", + "title": "SCP SCIENCE DigiPREP MS", + "name_zh": "SCP SCIENCE DigiPREP MS 010-500-205 石墨块消解仪", + "domain": "digestion", + "domain_name": "Digestion & Solid Sample Prep", + "domain_zh": "消解与固体前处理", + "path": "assets/expansion_batch03/t1_thermal/scp_digiprepms", + "size_m": [ + 0.49, + 0.4006, + 0.18 + ], + "n_components": 112, + "n_mesh_parts": 112, + "n_joints": 2, + "joint_types": { + "prismatic": 2 + }, + "n_state_slots": 24, + "n_capabilities": 13, + "n_capabilities_implemented": 13, + "n_mechanisms": 1, + "n_readouts": 0, + "n_interface_points": 50, + "n_sources": 13, + "n_limitations": 26, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t1_thermal/scp_digiprepms/model.glb", + "urdf": "assets/expansion_batch03/t1_thermal/scp_digiprepms/model.urdf", + "blend": "assets/expansion_batch03/t1_thermal/scp_digiprepms/model.blend", + "contract": "assets/expansion_batch03/t1_thermal/scp_digiprepms/asset.contract.json", + "runtime": "scripts/asset_runtime/scp_digiprepms.py" + }, + "thumb": "media/thumb/scp_digiprepms.webp", + "hero": "media/hero/scp_digiprepms.webp" + }, + { + "id": "instrument.retsch_pm100", + "slug": "retsch_pm100", + "chem_id": "CHEM-040", + "name": "Planetary ball mill", + "maker": "RETSCH", + "model": "PM 100", + "title": "RETSCH PM 100", + "name_zh": "RETSCH PM 100 单工位行星式球磨仪", + "domain": "digestion", + "domain_name": "Digestion & Solid Sample Prep", + "domain_zh": "消解与固体前处理", + "path": "assets/expansion_batch03/t1_thermal/retsch_pm100", + "size_m": [ + 0.64, + 0.432, + 0.48 + ], + "n_components": 72, + "n_mesh_parts": 72, + "n_joints": 8, + "joint_types": { + "revolute": 4, + "prismatic": 4 + }, + "n_state_slots": 24, + "n_capabilities": 13, + "n_capabilities_implemented": 13, + "n_mechanisms": 1, + "n_readouts": 1, + "n_interface_points": 3, + "n_sources": 5, + "n_limitations": 23, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t1_thermal/retsch_pm100/model.glb", + "urdf": "assets/expansion_batch03/t1_thermal/retsch_pm100/model.urdf", + "blend": "assets/expansion_batch03/t1_thermal/retsch_pm100/model.blend", + "contract": "assets/expansion_batch03/t1_thermal/retsch_pm100/asset.contract.json", + "runtime": "scripts/asset_runtime/retsch_pm100.py" + }, + "thumb": "media/thumb/retsch_pm100.webp", + "hero": "media/hero/retsch_pm100.webp" + }, + { + "id": "instrument.retsch_as200", + "slug": "retsch_as200", + "chem_id": "CHEM-041", + "name": "Vibratory sieve shaker", + "maker": "RETSCH", + "model": "AS 200 control", + "title": "RETSCH AS 200 control", + "name_zh": "RETSCH AS 200 control 振动筛分仪", + "domain": "digestion", + "domain_name": "Digestion & Solid Sample Prep", + "domain_zh": "消解与固体前处理", + "path": "assets/expansion_batch03/t1_thermal/retsch_as200", + "size_m": [ + 0.417, + 0.3895, + 0.842 + ], + "n_components": 61, + "n_mesh_parts": 61, + "n_joints": 16, + "joint_types": { + "prismatic": 15, + "revolute": 1 + }, + "n_state_slots": 24, + "n_capabilities": 20, + "n_capabilities_implemented": 20, + "n_mechanisms": 1, + "n_readouts": 3, + "n_interface_points": 4, + "n_sources": 7, + "n_limitations": 25, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t1_thermal/retsch_as200/model.glb", + "urdf": "assets/expansion_batch03/t1_thermal/retsch_as200/model.urdf", + "blend": "assets/expansion_batch03/t1_thermal/retsch_as200/model.blend", + "contract": "assets/expansion_batch03/t1_thermal/retsch_as200/asset.contract.json", + "runtime": "scripts/asset_runtime/retsch_as200.py" + }, + "thumb": "media/thumb/retsch_as200.webp", + "hero": "media/hero/retsch_as200.webp" + }, + { + "id": "instrument.retsch_pt100", + "slug": "retsch_pt100", + "chem_id": "CHEM-042", + "name": "Rotary sample divider", + "maker": "RETSCH", + "model": "PT 100", + "title": "RETSCH PT 100", + "name_zh": "RETSCH PT100旋转缩分仪与DR100", + "domain": "digestion", + "domain_name": "Digestion & Solid Sample Prep", + "domain_zh": "消解与固体前处理", + "path": "assets/expansion_batch03/t1_thermal/retsch_pt100", + "size_m": [ + 0.582, + 0.42, + 0.9115 + ], + "n_components": 74, + "n_mesh_parts": 74, + "n_joints": 15, + "joint_types": { + "continuous": 1, + "prismatic": 12, + "revolute": 2 + }, + "n_state_slots": 25, + "n_capabilities": 21, + "n_capabilities_implemented": 21, + "n_mechanisms": 1, + "n_readouts": 2, + "n_interface_points": 5, + "n_sources": 9, + "n_limitations": 24, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t1_thermal/retsch_pt100/model.glb", + "urdf": "assets/expansion_batch03/t1_thermal/retsch_pt100/model.urdf", + "blend": "assets/expansion_batch03/t1_thermal/retsch_pt100/model.blend", + "contract": "assets/expansion_batch03/t1_thermal/retsch_pt100/asset.contract.json", + "runtime": "scripts/asset_runtime/retsch_pt100.py" + }, + "thumb": "media/thumb/retsch_pt100.webp", + "hero": "media/hero/retsch_pt100.webp" + }, + { + "id": "instrument.ika_t25", + "slug": "ika_t25", + "chem_id": "CHEM-043", + "name": "Rotor–stator disperser", + "maker": "IKA", + "model": "T 25 digital ULTRA-TURRAX", + "title": "IKA T 25 digital ULTRA-TURRAX", + "name_zh": "IKA T25digital转子定子分散机", + "domain": "digestion", + "domain_name": "Digestion & Solid Sample Prep", + "domain_zh": "消解与固体前处理", + "path": "assets/expansion_batch03/t1_thermal/ika_t25", + "size_m": [ + 0.32, + 0.3, + 0.628 + ], + "n_components": 34, + "n_mesh_parts": 34, + "n_joints": 4, + "joint_types": { + "prismatic": 2, + "revolute": 1, + "continuous": 1 + }, + "n_state_slots": 30, + "n_capabilities": 16, + "n_capabilities_implemented": 16, + "n_mechanisms": 1, + "n_readouts": 1, + "n_interface_points": 4, + "n_sources": 8, + "n_limitations": 27, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t1_thermal/ika_t25/model.glb", + "urdf": "assets/expansion_batch03/t1_thermal/ika_t25/model.urdf", + "blend": "assets/expansion_batch03/t1_thermal/ika_t25/model.blend", + "contract": "assets/expansion_batch03/t1_thermal/ika_t25/asset.contract.json", + "runtime": "scripts/asset_runtime/ika_t25.py" + }, + "thumb": "media/thumb/ika_t25.webp", + "hero": "media/hero/ika_t25.webp" + }, + { + "id": "instrument.sonics_vcx750", + "slug": "sonics_vcx750", + "chem_id": "CHEM-044", + "name": "Probe ultrasonic processor", + "maker": "Sonics", + "model": "VCX 750", + "title": "Sonics VCX 750", + "name_zh": "Sonics VCX750探头式超声处理器", + "domain": "digestion", + "domain_name": "Digestion & Solid Sample Prep", + "domain_zh": "消解与固体前处理", + "path": "assets/expansion_batch03/t1_thermal/sonics_vcx750", + "size_m": [ + 0.52, + 0.3679, + 0.49 + ], + "n_components": 66, + "n_mesh_parts": 66, + "n_joints": 25, + "joint_types": { + "prismatic": 25 + }, + "n_state_slots": 34, + "n_capabilities": 19, + "n_capabilities_implemented": 19, + "n_mechanisms": 1, + "n_readouts": 4, + "n_interface_points": 5, + "n_sources": 7, + "n_limitations": 29, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t1_thermal/sonics_vcx750/model.glb", + "urdf": "assets/expansion_batch03/t1_thermal/sonics_vcx750/model.urdf", + "blend": "assets/expansion_batch03/t1_thermal/sonics_vcx750/model.blend", + "contract": "assets/expansion_batch03/t1_thermal/sonics_vcx750/asset.contract.json", + "runtime": "scripts/asset_runtime/sonics_vcx750.py" + }, + "thumb": "media/thumb/sonics_vcx750.webp", + "hero": "media/hero/sonics_vcx750.webp" + }, + { + "id": "instrument.thinky_are310s", + "slug": "thinky_are310s", + "chem_id": "CHEM-045", + "name": "Planetary centrifugal mixer", + "maker": "THINKY", + "model": "ARE-310", + "title": "THINKY ARE-310", + "name_zh": "THINKY ARE-310S-UL行星离心混合脱泡机", + "domain": "digestion", + "domain_name": "Digestion & Solid Sample Prep", + "domain_zh": "消解与固体前处理", + "path": "assets/expansion_batch03/t1_thermal/thinky_are310s", + "size_m": [ + 0.4279, + 0.336, + 0.3808 + ], + "n_components": 40, + "n_mesh_parts": 40, + "n_joints": 10, + "joint_types": { + "continuous": 2, + "revolute": 2, + "prismatic": 6 + }, + "n_state_slots": 33, + "n_capabilities": 14, + "n_capabilities_implemented": 14, + "n_mechanisms": 1, + "n_readouts": 2, + "n_interface_points": 5, + "n_sources": 9, + "n_limitations": 24, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t1_thermal/thinky_are310s/model.glb", + "urdf": "assets/expansion_batch03/t1_thermal/thinky_are310s/model.urdf", + "blend": "assets/expansion_batch03/t1_thermal/thinky_are310s/model.blend", + "contract": "assets/expansion_batch03/t1_thermal/thinky_are310s/asset.contract.json", + "runtime": "scripts/asset_runtime/thinky_are310s.py" + }, + "thumb": "media/thumb/thinky_are310s.webp", + "hero": "media/hero/thinky_are310s.webp" + }, + { + "id": "instrument.metrohm_909uv", + "slug": "metrohm_909uv", + "chem_id": "CHEM-046", + "name": "UV digester", + "maker": "Metrohm", + "model": "909 UV Digester", + "title": "Metrohm 909 UV Digester", + "name_zh": "Metrohm909UV紫外消解仪", + "domain": "digestion", + "domain_name": "Digestion & Solid Sample Prep", + "domain_zh": "消解与固体前处理", + "path": "assets/expansion_batch03/t1_thermal/metrohm_909uv", + "size_m": [ + 0.33, + 0.31, + 0.5 + ], + "n_components": 72, + "n_mesh_parts": 72, + "n_joints": 10, + "joint_types": { + "revolute": 1, + "prismatic": 9 + }, + "n_state_slots": 31, + "n_capabilities": 17, + "n_capabilities_implemented": 17, + "n_mechanisms": 1, + "n_readouts": 3, + "n_interface_points": 14, + "n_sources": 6, + "n_limitations": 25, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t1_thermal/metrohm_909uv/model.glb", + "urdf": "assets/expansion_batch03/t1_thermal/metrohm_909uv/model.urdf", + "blend": "assets/expansion_batch03/t1_thermal/metrohm_909uv/model.blend", + "contract": "assets/expansion_batch03/t1_thermal/metrohm_909uv/asset.contract.json", + "runtime": "scripts/asset_runtime/metrohm_909uv.py" + }, + "thumb": "media/thumb/metrohm_909uv.webp", + "hero": "media/hero/metrohm_909uv.webp" + }, + { + "id": "instrument.multiwave_7101", + "slug": "multiwave_7101", + "chem_id": "CHEM-047", + "name": "Microwave acid digestion system", + "maker": "Anton Paar", + "model": "Multiwave 7101", + "title": "Anton Paar Multiwave 7101", + "name_zh": "微波酸消解仪 Anton Paar Multiwave 7101(24×8 mL架)", + "domain": "digestion", + "domain_name": "Digestion & Solid Sample Prep", + "domain_zh": "消解与固体前处理", + "path": "assets/basic40_batch02/t1_thermal/multiwave_7101", + "size_m": [ + 0.497, + 0.742, + 0.47 + ], + "n_components": 44, + "n_mesh_parts": 44, + "n_joints": 1, + "joint_types": { + "revolute": 1 + }, + "n_state_slots": 16, + "n_capabilities": 11, + "n_capabilities_implemented": 7, + "n_mechanisms": 1, + "n_readouts": 1, + "n_interface_points": 0, + "n_sources": 13, + "n_limitations": 20, + "isaac_lab": "partial", + "glb_up": "y", + "output_templates": false, + "files": { + "glb": "assets/basic40_batch02/t1_thermal/multiwave_7101/model.glb", + "urdf": "assets/basic40_batch02/t1_thermal/multiwave_7101/model.urdf", + "blend": "assets/basic40_batch02/t1_thermal/multiwave_7101/model.blend", + "contract": "assets/basic40_batch02/t1_thermal/multiwave_7101/asset.contract.json", + "runtime": "scripts/basic40_runtime_thermal.py" + }, + "thumb": "media/thumb/multiwave_7101.webp", + "hero": "media/hero/multiwave_7101.webp" + }, + { + "id": "instrument.velp_udk159", + "slug": "velp_udk159", + "chem_id": "CHEM-048", + "name": "Automatic Kjeldahl distillation & titration unit", + "maker": "VELP", + "model": "UDK 159", + "title": "VELP UDK 159", + "name_zh": "VELP UDK159自动蒸汽蒸馏滴定仪", + "domain": "digestion", + "domain_name": "Digestion & Solid Sample Prep", + "domain_zh": "消解与固体前处理", + "path": "assets/expansion_batch03/t1_thermal/velp_udk159", + "size_m": [ + 0.385, + 0.416, + 0.78 + ], + "n_components": 57, + "n_mesh_parts": 57, + "n_joints": 6, + "joint_types": { + "prismatic": 3, + "revolute": 3 + }, + "n_state_slots": 34, + "n_capabilities": 18, + "n_capabilities_implemented": 18, + "n_mechanisms": 1, + "n_readouts": 3, + "n_interface_points": 9, + "n_sources": 10, + "n_limitations": 25, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t1_thermal/velp_udk159/model.glb", + "urdf": "assets/expansion_batch03/t1_thermal/velp_udk159/model.urdf", + "blend": "assets/expansion_batch03/t1_thermal/velp_udk159/model.blend", + "contract": "assets/expansion_batch03/t1_thermal/velp_udk159/asset.contract.json", + "runtime": "scripts/asset_runtime/velp_udk159.py" + }, + "thumb": "media/thumb/velp_udk159.webp", + "hero": "media/hero/velp_udk159.webp" + }, + { + "id": "instrument.buchi_hydrolexh", + "slug": "buchi_hydrolexh", + "chem_id": "CHEM-049", + "name": "Acid hydrolysis unit", + "maker": "BUCHI", + "model": "HydrolEx H-506", + "title": "BUCHI HydrolEx H-506", + "name_zh": "BUCHI HydrolEx H-506酸水解前处理仪", + "domain": "digestion", + "domain_name": "Digestion & Solid Sample Prep", + "domain_zh": "消解与固体前处理", + "path": "assets/expansion_batch03/t1_thermal/buchi_hydrolexh", + "size_m": [ + 0.312, + 0.614, + 0.47 + ], + "n_components": 92, + "n_mesh_parts": 92, + "n_joints": 10, + "joint_types": { + "revolute": 8, + "prismatic": 2 + }, + "n_state_slots": 25, + "n_capabilities": 19, + "n_capabilities_implemented": 19, + "n_mechanisms": 1, + "n_readouts": 0, + "n_interface_points": 16, + "n_sources": 12, + "n_limitations": 28, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t1_thermal/buchi_hydrolexh/model.glb", + "urdf": "assets/expansion_batch03/t1_thermal/buchi_hydrolexh/model.urdf", + "blend": "assets/expansion_batch03/t1_thermal/buchi_hydrolexh/model.blend", + "contract": "assets/expansion_batch03/t1_thermal/buchi_hydrolexh/asset.contract.json", + "runtime": "scripts/asset_runtime/buchi_hydrolexh.py" + }, + "thumb": "media/thumb/buchi_hydrolexh.webp", + "hero": "media/hero/buchi_hydrolexh.webp" + }, + { + "id": "instrument.malvern_leneo", + "slug": "malvern_leneo", + "chem_id": "CHEM-050", + "name": "Automated fusion bead maker", + "maker": "Malvern Panalytical / Claisse", + "model": "LeNeo", + "title": "Malvern Panalytical / Claisse LeNeo", + "name_zh": "Malvern Panalytical Claisse LeNeo自动熔融制样仪", + "domain": "digestion", + "domain_name": "Digestion & Solid Sample Prep", + "domain_zh": "消解与固体前处理", + "path": "assets/expansion_batch03/t1_thermal/malvern_leneo", + "size_m": [ + 0.5563, + 0.5737, + 0.52 + ], + "n_components": 70, + "n_mesh_parts": 70, + "n_joints": 6, + "joint_types": { + "revolute": 3, + "prismatic": 3 + }, + "n_state_slots": 20, + "n_capabilities": 15, + "n_capabilities_implemented": 15, + "n_mechanisms": 1, + "n_readouts": 3, + "n_interface_points": 5, + "n_sources": 6, + "n_limitations": 22, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t1_thermal/malvern_leneo/model.glb", + "urdf": "assets/expansion_batch03/t1_thermal/malvern_leneo/model.urdf", + "blend": "assets/expansion_batch03/t1_thermal/malvern_leneo/model.blend", + "contract": "assets/expansion_batch03/t1_thermal/malvern_leneo/asset.contract.json", + "runtime": "scripts/asset_runtime/malvern_leneo.py" + }, + "thumb": "media/thumb/malvern_leneo.webp", + "hero": "media/hero/malvern_leneo.webp" + }, + { + "id": "instrument.specac_atlasmanual", + "slug": "specac_atlasmanual", + "chem_id": "CHEM-051", + "name": "Hydraulic pellet press", + "maker": "Specac", + "model": "Atlas Manual 15T", + "title": "Specac Atlas Manual 15T", + "name_zh": "Specac Atlas Manual15T液压粉末压片机", + "domain": "digestion", + "domain_name": "Digestion & Solid Sample Prep", + "domain_zh": "消解与固体前处理", + "path": "assets/expansion_batch03/t1_thermal/specac_atlasmanual", + "size_m": [ + 0.31, + 0.19, + 0.61 + ], + "n_components": 57, + "n_mesh_parts": 57, + "n_joints": 9, + "joint_types": { + "prismatic": 4, + "revolute": 5 + }, + "n_state_slots": 27, + "n_capabilities": 16, + "n_capabilities_implemented": 16, + "n_mechanisms": 1, + "n_readouts": 0, + "n_interface_points": 3, + "n_sources": 6, + "n_limitations": 26, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t1_thermal/specac_atlasmanual/model.glb", + "urdf": "assets/expansion_batch03/t1_thermal/specac_atlasmanual/model.urdf", + "blend": "assets/expansion_batch03/t1_thermal/specac_atlasmanual/model.blend", + "contract": "assets/expansion_batch03/t1_thermal/specac_atlasmanual/asset.contract.json", + "runtime": "scripts/asset_runtime/specac_atlasmanual.py" + }, + "thumb": "media/thumb/specac_atlasmanual.webp", + "hero": "media/hero/specac_atlasmanual.webp" + }, + { + "id": "instrument.buchi_encapsulatorb", + "slug": "buchi_encapsulatorb", + "chem_id": "CHEM-052", + "name": "Vibrating-nozzle encapsulator", + "maker": "BUCHI", + "model": "Encapsulator B-390", + "title": "BUCHI Encapsulator B-390", + "name_zh": "BUCHI Encapsulator B-390振动喷嘴微胶囊制备仪", + "domain": "materials", + "domain_name": "Thin-Film & Functional Materials", + "domain_zh": "薄膜与功能材料制备", + "path": "assets/expansion_batch04/t5_automation/buchi_encapsulatorb", + "size_m": [ + 0.435, + 0.34, + 0.29 + ], + "n_components": 53, + "n_mesh_parts": 53, + "n_joints": 8, + "joint_types": { + "prismatic": 6, + "revolute": 2 + }, + "n_state_slots": 30, + "n_capabilities": 23, + "n_capabilities_implemented": 23, + "n_mechanisms": 1, + "n_readouts": 4, + "n_interface_points": 10, + "n_sources": 6, + "n_limitations": 28, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t5_automation/buchi_encapsulatorb/model.glb", + "urdf": "assets/expansion_batch04/t5_automation/buchi_encapsulatorb/model.urdf", + "blend": "assets/expansion_batch04/t5_automation/buchi_encapsulatorb/model.blend", + "contract": "assets/expansion_batch04/t5_automation/buchi_encapsulatorb/asset.contract.json", + "runtime": "scripts/asset_runtime/buchi_encapsulatorb.py" + }, + "thumb": "media/thumb/buchi_encapsulatorb.webp", + "hero": "media/hero/buchi_encapsulatorb.webp" + }, + { + "id": "instrument.ossila_spincoater", + "slug": "ossila_spincoater", + "chem_id": "CHEM-053", + "name": "Spin coater", + "maker": "Ossila", + "model": "Spin Coater V3", + "title": "Ossila Spin Coater V3", + "name_zh": "Ossila Spin Coater Standard V3 L2001A3旋涂机", + "domain": "materials", + "domain_name": "Thin-Film & Functional Materials", + "domain_zh": "薄膜与功能材料制备", + "path": "assets/expansion_batch04/t5_automation/ossila_spincoater", + "size_m": [ + 0.171, + 0.234, + 0.1399 + ], + "n_components": 45, + "n_mesh_parts": 45, + "n_joints": 15, + "joint_types": { + "revolute": 2, + "prismatic": 13 + }, + "n_state_slots": 13, + "n_capabilities": 12, + "n_capabilities_implemented": 12, + "n_mechanisms": 1, + "n_readouts": 3, + "n_interface_points": 4, + "n_sources": 7, + "n_limitations": 17, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t5_automation/ossila_spincoater/model.glb", + "urdf": "assets/expansion_batch04/t5_automation/ossila_spincoater/model.urdf", + "blend": "assets/expansion_batch04/t5_automation/ossila_spincoater/model.blend", + "contract": "assets/expansion_batch04/t5_automation/ossila_spincoater/asset.contract.json", + "runtime": "scripts/asset_runtime/ossila_spincoater.py" + }, + "thumb": "media/thumb/ossila_spincoater.webp", + "hero": "media/hero/ossila_spincoater.webp" + }, + { + "id": "instrument.ossila_dipcoater", + "slug": "ossila_dipcoater", + "chem_id": "CHEM-054", + "name": "Dip coater", + "maker": "Ossila", + "model": "Dip Coater V2", + "title": "Ossila Dip Coater V2", + "name_zh": "Ossila Dip Coater V2 L2006A2(手册2.0.A)", + "domain": "materials", + "domain_name": "Thin-Film & Functional Materials", + "domain_zh": "薄膜与功能材料制备", + "path": "assets/expansion_batch04/t5_automation/ossila_dipcoater", + "size_m": [ + 0.2, + 0.3, + 0.35 + ], + "n_components": 45, + "n_mesh_parts": 45, + "n_joints": 15, + "joint_types": { + "prismatic": 15 + }, + "n_state_slots": 18, + "n_capabilities": 17, + "n_capabilities_implemented": 17, + "n_mechanisms": 1, + "n_readouts": 3, + "n_interface_points": 4, + "n_sources": 7, + "n_limitations": 22, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t5_automation/ossila_dipcoater/model.glb", + "urdf": "assets/expansion_batch04/t5_automation/ossila_dipcoater/model.urdf", + "blend": "assets/expansion_batch04/t5_automation/ossila_dipcoater/model.blend", + "contract": "assets/expansion_batch04/t5_automation/ossila_dipcoater/asset.contract.json", + "runtime": "scripts/asset_runtime/ossila_dipcoater.py" + }, + "thumb": "media/thumb/ossila_dipcoater.webp", + "hero": "media/hero/ossila_dipcoater.webp" + }, + { + "id": "instrument.ossila_doctorblade", + "slug": "ossila_doctorblade", + "chem_id": "CHEM-055", + "name": "Automated doctor-blade coater", + "maker": "Ossila", + "model": "Doctor Blade Coater", + "title": "Ossila Doctor Blade Coater", + "name_zh": "Ossila Doctor Blade Coater(100mm数字刮刀+8mm玻璃台)", + "domain": "materials", + "domain_name": "Thin-Film & Functional Materials", + "domain_zh": "薄膜与功能材料制备", + "path": "assets/expansion_batch04/t5_automation/ossila_doctorblade", + "size_m": [ + 0.28, + 0.36, + 0.19 + ], + "n_components": 66, + "n_mesh_parts": 66, + "n_joints": 16, + "joint_types": { + "prismatic": 15, + "revolute": 1 + }, + "n_state_slots": 21, + "n_capabilities": 18, + "n_capabilities_implemented": 18, + "n_mechanisms": 1, + "n_readouts": 4, + "n_interface_points": 4, + "n_sources": 8, + "n_limitations": 24, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t5_automation/ossila_doctorblade/model.glb", + "urdf": "assets/expansion_batch04/t5_automation/ossila_doctorblade/model.urdf", + "blend": "assets/expansion_batch04/t5_automation/ossila_doctorblade/model.blend", + "contract": "assets/expansion_batch04/t5_automation/ossila_doctorblade/asset.contract.json", + "runtime": "scripts/asset_runtime/ossila_doctorblade.py" + }, + "thumb": "media/thumb/ossila_doctorblade.webp", + "hero": "media/hero/ossila_doctorblade.webp" + }, + { + "id": "instrument.ossila_slotdie", + "slug": "ossila_slotdie", + "chem_id": "CHEM-056", + "name": "Slot-die coater", + "maker": "Ossila", + "model": "Slot-Die Coater V2", + "title": "Ossila Slot-Die Coater V2", + "name_zh": "Ossila Slot-Die Coater V2 L2005A2(100mm标准模头/5mL注射器)", + "domain": "materials", + "domain_name": "Thin-Film & Functional Materials", + "domain_zh": "薄膜与功能材料制备", + "path": "assets/expansion_batch04/t5_automation/ossila_slotdie", + "size_m": [ + 0.28, + 0.36, + 0.19 + ], + "n_components": 64, + "n_mesh_parts": 64, + "n_joints": 17, + "joint_types": { + "prismatic": 16, + "revolute": 1 + }, + "n_state_slots": 29, + "n_capabilities": 22, + "n_capabilities_implemented": 22, + "n_mechanisms": 1, + "n_readouts": 6, + "n_interface_points": 5, + "n_sources": 8, + "n_limitations": 26, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t5_automation/ossila_slotdie/model.glb", + "urdf": "assets/expansion_batch04/t5_automation/ossila_slotdie/model.urdf", + "blend": "assets/expansion_batch04/t5_automation/ossila_slotdie/model.blend", + "contract": "assets/expansion_batch04/t5_automation/ossila_slotdie/asset.contract.json", + "runtime": "scripts/asset_runtime/ossila_slotdie.py" + }, + "thumb": "media/thumb/ossila_slotdie.webp", + "hero": "media/hero/ossila_slotdie.webp" + }, + { + "id": "instrument.thermo_process11", + "slug": "thermo_process11", + "chem_id": "CHEM-057", + "name": "Lab twin-screw extruder", + "maker": "Thermo Fisher Scientific", + "model": "Process 11", + "title": "Thermo Fisher Scientific Process 11", + "name_zh": "Thermo Scientific Process11(标准350℃双螺杆)", + "domain": "materials", + "domain_name": "Thin-Film & Functional Materials", + "domain_zh": "薄膜与功能材料制备", + "path": "assets/expansion_batch04/t5_automation/thermo_process11", + "size_m": [ + 0.82, + 0.48, + 0.41 + ], + "n_components": 66, + "n_mesh_parts": 66, + "n_joints": 5, + "joint_types": { + "revolute": 2, + "prismatic": 3 + }, + "n_state_slots": 32, + "n_capabilities": 22, + "n_capabilities_implemented": 22, + "n_mechanisms": 1, + "n_readouts": 10, + "n_interface_points": 7, + "n_sources": 7, + "n_limitations": 22, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t5_automation/thermo_process11/model.glb", + "urdf": "assets/expansion_batch04/t5_automation/thermo_process11/model.urdf", + "blend": "assets/expansion_batch04/t5_automation/thermo_process11/model.blend", + "contract": "assets/expansion_batch04/t5_automation/thermo_process11/asset.contract.json", + "runtime": "scripts/asset_runtime/thermo_process11.py" + }, + "thumb": "media/thumb/thermo_process11.webp", + "hero": "media/hero/thermo_process11.webp" + }, + { + "id": "instrument.fujifilm_dmp2850", + "slug": "fujifilm_dmp2850", + "chem_id": "CHEM-058", + "name": "Materials inkjet printer", + "maker": "FUJIFILM Dimatix", + "model": "DMP-2850", + "title": "FUJIFILM Dimatix DMP-2850", + "name_zh": "FUJIFILM Dimatix DMP-2850 S(SAMBA 12喷嘴)", + "domain": "materials", + "domain_name": "Thin-Film & Functional Materials", + "domain_zh": "薄膜与功能材料制备", + "path": "assets/expansion_batch04/t5_automation/fujifilm_dmp2850", + "size_m": [ + 0.673, + 0.5917, + 0.419 + ], + "n_components": 60, + "n_mesh_parts": 60, + "n_joints": 4, + "joint_types": { + "prismatic": 3, + "revolute": 1 + }, + "n_state_slots": 28, + "n_capabilities": 21, + "n_capabilities_implemented": 21, + "n_mechanisms": 1, + "n_readouts": 6, + "n_interface_points": 7, + "n_sources": 9, + "n_limitations": 26, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t5_automation/fujifilm_dmp2850/model.glb", + "urdf": "assets/expansion_batch04/t5_automation/fujifilm_dmp2850/model.urdf", + "blend": "assets/expansion_batch04/t5_automation/fujifilm_dmp2850/model.blend", + "contract": "assets/expansion_batch04/t5_automation/fujifilm_dmp2850/asset.contract.json", + "runtime": "scripts/asset_runtime/fujifilm_dmp2850.py" + }, + "thumb": "media/thumb/fujifilm_dmp2850.webp", + "hero": "media/hero/fujifilm_dmp2850.webp" + }, + { + "id": "instrument.linari_rtadvanced", + "slug": "linari_rtadvanced", + "chem_id": "CHEM-059", + "name": "Electrospinning system", + "maker": "Linari Nanotech", + "model": "RT Advanced", + "title": "Linari Nanotech RT Advanced", + "name_zh": "Linari Nanotech RT Advanced静电纺丝系统", + "domain": "materials", + "domain_name": "Thin-Film & Functional Materials", + "domain_zh": "薄膜与功能材料制备", + "path": "assets/expansion_batch04/t5_automation/linari_rtadvanced", + "size_m": [ + 1.05, + 1.0455, + 2.2 + ], + "n_components": 63, + "n_mesh_parts": 63, + "n_joints": 14, + "joint_types": { + "revolute": 1, + "continuous": 1, + "prismatic": 12 + }, + "n_state_slots": 33, + "n_capabilities": 21, + "n_capabilities_implemented": 21, + "n_mechanisms": 1, + "n_readouts": 6, + "n_interface_points": 15, + "n_sources": 6, + "n_limitations": 23, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t5_automation/linari_rtadvanced/model.glb", + "urdf": "assets/expansion_batch04/t5_automation/linari_rtadvanced/model.urdf", + "blend": "assets/expansion_batch04/t5_automation/linari_rtadvanced/model.blend", + "contract": "assets/expansion_batch04/t5_automation/linari_rtadvanced/asset.contract.json", + "runtime": "scripts/asset_runtime/linari_rtadvanced.py" + }, + "thumb": "media/thumb/linari_rtadvanced.webp", + "hero": "media/hero/linari_rtadvanced.webp" + }, + { + "id": "instrument.cytiva_nanoassemblrignite", + "slug": "cytiva_nanoassemblrignite", + "chem_id": "CHEM-060", + "name": "Microfluidic nanoparticle formulation system", + "maker": "Cytiva / Precision NanoSystems", + "model": "NanoAssemblr Ignite", + "title": "Cytiva / Precision NanoSystems NanoAssemblr Ignite", + "name_zh": "NanoAssemblr Ignite NIN0001微流控制备仪", + "domain": "materials", + "domain_name": "Thin-Film & Functional Materials", + "domain_zh": "薄膜与功能材料制备", + "path": "assets/expansion_batch04/t5_automation/cytiva_nanoassemblrignite", + "size_m": [ + 0.381, + 0.3527, + 0.38 + ], + "n_components": 43, + "n_mesh_parts": 43, + "n_joints": 9, + "joint_types": { + "revolute": 2, + "prismatic": 7 + }, + "n_state_slots": 35, + "n_capabilities": 20, + "n_capabilities_implemented": 20, + "n_mechanisms": 1, + "n_readouts": 6, + "n_interface_points": 12, + "n_sources": 9, + "n_limitations": 23, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t5_automation/cytiva_nanoassemblrignite/model.glb", + "urdf": "assets/expansion_batch04/t5_automation/cytiva_nanoassemblrignite/model.urdf", + "blend": "assets/expansion_batch04/t5_automation/cytiva_nanoassemblrignite/model.blend", + "contract": "assets/expansion_batch04/t5_automation/cytiva_nanoassemblrignite/asset.contract.json", + "runtime": "scripts/asset_runtime/cytiva_nanoassemblrignite.py" + }, + "thumb": "media/thumb/cytiva_nanoassemblrignite.webp", + "hero": "media/hero/cytiva_nanoassemblrignite.webp" + }, + { + "id": "instrument.glatt_miniglatt", + "slug": "glatt_miniglatt", + "chem_id": "CHEM-061", + "name": "Fluid-bed granulator / coater", + "maker": "Glatt", + "model": "Mini-Glatt", + "title": "Glatt Mini-Glatt", + "name_zh": "Glatt Mini-Glatt2012流化床制粒包衣仪", + "domain": "materials", + "domain_name": "Thin-Film & Functional Materials", + "domain_zh": "薄膜与功能材料制备", + "path": "assets/expansion_batch04/t5_automation/glatt_miniglatt", + "size_m": [ + 0.7057, + 0.7587, + 0.84 + ], + "n_components": 54, + "n_mesh_parts": 54, + "n_joints": 12, + "joint_types": { + "prismatic": 5, + "revolute": 6, + "continuous": 1 + }, + "n_state_slots": 33, + "n_capabilities": 21, + "n_capabilities_implemented": 21, + "n_mechanisms": 1, + "n_readouts": 4, + "n_interface_points": 12, + "n_sources": 9, + "n_limitations": 28, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t5_automation/glatt_miniglatt/model.glb", + "urdf": "assets/expansion_batch04/t5_automation/glatt_miniglatt/model.urdf", + "blend": "assets/expansion_batch04/t5_automation/glatt_miniglatt/model.blend", + "contract": "assets/expansion_batch04/t5_automation/glatt_miniglatt/asset.contract.json", + "runtime": "scripts/asset_runtime/glatt_miniglatt.py" + }, + "thumb": "media/thumb/glatt_miniglatt.webp", + "hero": "media/hero/glatt_miniglatt.webp" + }, + { + "id": "instrument.quorum_q150tes", + "slug": "quorum_q150tes", + "chem_id": "CHEM-062", + "name": "Sputter & carbon coater", + "maker": "Quorum Technologies", + "model": "Q150T ES Plus", + "title": "Quorum Technologies Q150T ES Plus", + "name_zh": "Quorum Q150T ES Plus显微样品镀膜机", + "domain": "materials", + "domain_name": "Thin-Film & Functional Materials", + "domain_zh": "薄膜与功能材料制备", + "path": "assets/expansion_batch04/t5_automation/quorum_q150tes", + "size_m": [ + 0.585, + 0.5546, + 0.41 + ], + "n_components": 52, + "n_mesh_parts": 52, + "n_joints": 7, + "joint_types": { + "prismatic": 4, + "continuous": 1, + "revolute": 2 + }, + "n_state_slots": 28, + "n_capabilities": 18, + "n_capabilities_implemented": 18, + "n_mechanisms": 1, + "n_readouts": 6, + "n_interface_points": 10, + "n_sources": 10, + "n_limitations": 29, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t5_automation/quorum_q150tes/model.glb", + "urdf": "assets/expansion_batch04/t5_automation/quorum_q150tes/model.urdf", + "blend": "assets/expansion_batch04/t5_automation/quorum_q150tes/model.blend", + "contract": "assets/expansion_batch04/t5_automation/quorum_q150tes/asset.contract.json", + "runtime": "scripts/asset_runtime/quorum_q150tes.py" + }, + "thumb": "media/thumb/quorum_q150tes.webp", + "hero": "media/hero/quorum_q150tes.webp" + }, + { + "id": "instrument.laboao_cvdltf12p50", + "slug": "laboao_cvdltf12p50", + "chem_id": "CHEM-063", + "name": "Chemical vapour deposition system", + "maker": "LABOAO", + "model": "CVD-LTF12P50", + "title": "LABOAO CVD-LTF12P50", + "name_zh": "LABOAO CVD-LTF12P50单温区化学气相沉积系统", + "domain": "materials", + "domain_name": "Thin-Film & Functional Materials", + "domain_zh": "薄膜与功能材料制备", + "path": "assets/expansion_batch04/t5_automation/laboao_cvdltf12p50", + "size_m": [ + 1.9073, + 0.62, + 1.378 + ], + "n_components": 110, + "n_mesh_parts": 110, + "n_joints": 10, + "joint_types": { + "revolute": 7, + "prismatic": 3 + }, + "n_state_slots": 34, + "n_capabilities": 16, + "n_capabilities_implemented": 16, + "n_mechanisms": 1, + "n_readouts": 6, + "n_interface_points": 12, + "n_sources": 10, + "n_limitations": 24, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t5_automation/laboao_cvdltf12p50/model.glb", + "urdf": "assets/expansion_batch04/t5_automation/laboao_cvdltf12p50/model.urdf", + "blend": "assets/expansion_batch04/t5_automation/laboao_cvdltf12p50/model.blend", + "contract": "assets/expansion_batch04/t5_automation/laboao_cvdltf12p50/asset.contract.json", + "runtime": "scripts/asset_runtime/laboao_cvdltf12p50.py" + }, + "thumb": "media/thumb/laboao_cvdltf12p50.webp", + "hero": "media/hero/laboao_cvdltf12p50.webp" + }, + { + "id": "instrument.arradiance_gemstarxt", + "slug": "arradiance_gemstarxt", + "chem_id": "CHEM-064", + "name": "Atomic layer deposition system", + "maker": "Arradiance", + "model": "GEMStar XT-SP (PEALD / thermal ALD)", + "title": "Arradiance GEMStar XT-SP (PEALD / thermal ALD)", + "name_zh": "Arradiance GEMStar XT-SP单歧管PEALD/热ALD系统", + "domain": "materials", + "domain_name": "Thin-Film & Functional Materials", + "domain_zh": "薄膜与功能材料制备", + "path": "assets/expansion_batch04/t5_automation/arradiance_gemstarxt", + "size_m": [ + 1.1576, + 0.6096, + 0.635 + ], + "n_components": 74, + "n_mesh_parts": 74, + "n_joints": 8, + "joint_types": { + "revolute": 2, + "prismatic": 6 + }, + "n_state_slots": 31, + "n_capabilities": 21, + "n_capabilities_implemented": 21, + "n_mechanisms": 1, + "n_readouts": 6, + "n_interface_points": 20, + "n_sources": 11, + "n_limitations": 26, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t5_automation/arradiance_gemstarxt/model.glb", + "urdf": "assets/expansion_batch04/t5_automation/arradiance_gemstarxt/model.urdf", + "blend": "assets/expansion_batch04/t5_automation/arradiance_gemstarxt/model.blend", + "contract": "assets/expansion_batch04/t5_automation/arradiance_gemstarxt/asset.contract.json", + "runtime": "scripts/asset_runtime/arradiance_gemstarxt.py" + }, + "thumb": "media/thumb/arradiance_gemstarxt.webp", + "hero": "media/hero/arradiance_gemstarxt.webp" + }, + { + "id": "instrument.jasco_j1500", + "slug": "jasco_j1500", + "chem_id": "CHEM-065", + "name": "Circular dichroism spectrometer", + "maker": "JASCO", + "model": "J-1500", + "title": "JASCO J-1500", + "name_zh": "JASCO J-1500 150W标准PMT电子圆二色光谱仪", + "domain": "spectroscopy", + "domain_name": "Molecular Spectroscopy & Structure", + "domain_zh": "分子光谱与结构", + "path": "assets/expansion_batch04/t3_analytical/jasco_j1500", + "size_m": [ + 1.055, + 0.6655, + 0.39 + ], + "n_components": 60, + "n_mesh_parts": 60, + "n_joints": 2, + "joint_types": { + "revolute": 1, + "prismatic": 1 + }, + "n_state_slots": 25, + "n_capabilities": 18, + "n_capabilities_implemented": 17, + "n_mechanisms": 1, + "n_readouts": 6, + "n_interface_points": 9, + "n_sources": 11, + "n_limitations": 25, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t3_analytical/jasco_j1500/model.glb", + "urdf": "assets/expansion_batch04/t3_analytical/jasco_j1500/model.urdf", + "blend": "assets/expansion_batch04/t3_analytical/jasco_j1500/model.blend", + "contract": "assets/expansion_batch04/t3_analytical/jasco_j1500/asset.contract.json", + "runtime": "scripts/asset_runtime/jasco_j1500.py" + }, + "thumb": "media/thumb/jasco_j1500.webp", + "hero": "media/hero/jasco_j1500.webp" + }, + { + "id": "instrument.bruker_minispecmq20", + "slug": "bruker_minispecmq20", + "chem_id": "CHEM-066", + "name": "Time-domain NMR relaxometer", + "maker": "Bruker", + "model": "minispec mq20", + "title": "Bruker minispec mq20", + "name_zh": "Bruker minispec mq20时域核磁弛豫分析仪", + "domain": "spectroscopy", + "domain_name": "Molecular Spectroscopy & Structure", + "domain_zh": "分子光谱与结构", + "path": "assets/expansion_batch04/t3_analytical/bruker_minispecmq20", + "size_m": [ + 0.7492, + 0.787, + 0.356 + ], + "n_components": 59, + "n_mesh_parts": 59, + "n_joints": 1, + "joint_types": { + "prismatic": 1 + }, + "n_state_slots": 21, + "n_capabilities": 17, + "n_capabilities_implemented": 15, + "n_mechanisms": 1, + "n_readouts": 6, + "n_interface_points": 8, + "n_sources": 18, + "n_limitations": 23, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t3_analytical/bruker_minispecmq20/model.glb", + "urdf": "assets/expansion_batch04/t3_analytical/bruker_minispecmq20/model.urdf", + "blend": "assets/expansion_batch04/t3_analytical/bruker_minispecmq20/model.blend", + "contract": "assets/expansion_batch04/t3_analytical/bruker_minispecmq20/asset.contract.json", + "runtime": "scripts/asset_runtime/bruker_minispecmq20.py" + }, + "thumb": "media/thumb/bruker_minispecmq20.webp", + "hero": "media/hero/bruker_minispecmq20.webp" + }, + { + "id": "instrument.jasco_fp8350", + "slug": "jasco_fp8350", + "chem_id": "CHEM-067", + "name": "Spectrofluorometer", + "maker": "JASCO", + "model": "FP-8350", + "title": "JASCO FP-8350", + "name_zh": "JASCO FP-8350 荧光分光光度计", + "domain": "spectroscopy", + "domain_name": "Molecular Spectroscopy & Structure", + "domain_zh": "分子光谱与结构", + "path": "assets/expansion_batch03/t3_analytical/jasco_fp8350", + "size_m": [ + 0.84, + 0.5663, + 0.27 + ], + "n_components": 61, + "n_mesh_parts": 61, + "n_joints": 2, + "joint_types": { + "revolute": 1, + "prismatic": 1 + }, + "n_state_slots": 25, + "n_capabilities": 19, + "n_capabilities_implemented": 17, + "n_mechanisms": 1, + "n_readouts": 6, + "n_interface_points": 7, + "n_sources": 8, + "n_limitations": 31, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t3_analytical/jasco_fp8350/model.glb", + "urdf": "assets/expansion_batch03/t3_analytical/jasco_fp8350/model.urdf", + "blend": "assets/expansion_batch03/t3_analytical/jasco_fp8350/model.blend", + "contract": "assets/expansion_batch03/t3_analytical/jasco_fp8350/asset.contract.json", + "runtime": "scripts/asset_runtime/jasco_fp8350.py" + }, + "thumb": "media/thumb/jasco_fp8350.webp", + "hero": "media/hero/jasco_fp8350.webp" + }, + { + "id": "instrument.magritek_spinsolve80", + "slug": "magritek_spinsolve80", + "chem_id": "CHEM-068", + "name": "Benchtop NMR spectrometer", + "maker": "Magritek", + "model": "Spinsolve 80 Carbon", + "title": "Magritek Spinsolve 80 Carbon", + "name_zh": "核磁共振结构光谱仪 — Magritek Spinsolve 80 Carbon", + "domain": "spectroscopy", + "domain_name": "Molecular Spectroscopy & Structure", + "domain_zh": "分子光谱与结构", + "path": "assets/basic40_batch02/t4_measure/magritek_spinsolve80", + "size_m": [ + 0.5814, + 0.4005, + 0.675 + ], + "n_components": 13, + "n_mesh_parts": 13, + "n_joints": 1, + "joint_types": { + "prismatic": 1 + }, + "n_state_slots": 24, + "n_capabilities": 15, + "n_capabilities_implemented": 9, + "n_mechanisms": 2, + "n_readouts": 0, + "n_interface_points": 1, + "n_sources": 10, + "n_limitations": 13, + "isaac_lab": "bridged", + "glb_up": "y", + "output_templates": false, + "files": { + "glb": "assets/basic40_batch02/t4_measure/magritek_spinsolve80/model.glb", + "urdf": "assets/basic40_batch02/t4_measure/magritek_spinsolve80/model.urdf", + "blend": "assets/basic40_batch02/t4_measure/magritek_spinsolve80/model.blend", + "contract": "assets/basic40_batch02/t4_measure/magritek_spinsolve80/asset.contract.json" + }, + "thumb": "media/thumb/magritek_spinsolve80.webp", + "hero": "media/hero/magritek_spinsolve80.webp" + }, + { + "id": "instrument.bruker_magnettechesr5000", + "slug": "bruker_magnettechesr5000", + "chem_id": "CHEM-069", + "name": "Benchtop EPR spectrometer", + "maker": "Bruker", + "model": "Magnettech ESR5000", + "title": "Bruker Magnettech ESR5000", + "name_zh": "Bruker Magnettech ESR5000 电子顺磁共振谱仪", + "domain": "spectroscopy", + "domain_name": "Molecular Spectroscopy & Structure", + "domain_zh": "分子光谱与结构", + "path": "assets/expansion_batch04/t3_analytical/bruker_magnettechesr5000", + "size_m": [ + 0.397, + 0.426, + 0.2032 + ], + "n_components": 57, + "n_mesh_parts": 57, + "n_joints": 1, + "joint_types": { + "prismatic": 1 + }, + "n_state_slots": 21, + "n_capabilities": 19, + "n_capabilities_implemented": 17, + "n_mechanisms": 1, + "n_readouts": 6, + "n_interface_points": 7, + "n_sources": 12, + "n_limitations": 32, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t3_analytical/bruker_magnettechesr5000/model.glb", + "urdf": "assets/expansion_batch04/t3_analytical/bruker_magnettechesr5000/model.urdf", + "blend": "assets/expansion_batch04/t3_analytical/bruker_magnettechesr5000/model.blend", + "contract": "assets/expansion_batch04/t3_analytical/bruker_magnettechesr5000/asset.contract.json", + "runtime": "scripts/asset_runtime/bruker_magnettechesr5000.py" + }, + "thumb": "media/thumb/bruker_magnettechesr5000.webp", + "hero": "media/hero/bruker_magnettechesr5000.webp" + }, + { + "id": "instrument.jasco_p4200", + "slug": "jasco_p4200", + "chem_id": "CHEM-070", + "name": "Digital polarimeter", + "maker": "JASCO", + "model": "P-4200", + "title": "JASCO P-4200", + "name_zh": "JASCO P-4200 数字旋光仪", + "domain": "spectroscopy", + "domain_name": "Molecular Spectroscopy & Structure", + "domain_zh": "分子光谱与结构", + "path": "assets/expansion_batch03/t3_analytical/jasco_p4200", + "size_m": [ + 0.55, + 0.3582, + 0.21 + ], + "n_components": 58, + "n_mesh_parts": 58, + "n_joints": 2, + "joint_types": { + "revolute": 2 + }, + "n_state_slots": 23, + "n_capabilities": 20, + "n_capabilities_implemented": 18, + "n_mechanisms": 1, + "n_readouts": 6, + "n_interface_points": 7, + "n_sources": 9, + "n_limitations": 32, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t3_analytical/jasco_p4200/model.glb", + "urdf": "assets/expansion_batch03/t3_analytical/jasco_p4200/model.urdf", + "blend": "assets/expansion_batch03/t3_analytical/jasco_p4200/model.blend", + "contract": "assets/expansion_batch03/t3_analytical/jasco_p4200/asset.contract.json", + "runtime": "scripts/asset_runtime/jasco_p4200.py" + }, + "thumb": "media/thumb/jasco_p4200.webp", + "hero": "media/hero/jasco_p4200.webp" + }, + { + "id": "instrument.hach_dr6000", + "slug": "hach_dr6000", + "chem_id": "CHEM-071", + "name": "UV-Vis spectrophotometer", + "maker": "Hach", + "model": "DR6000", + "title": "Hach DR6000", + "name_zh": "Hach DR6000 紫外可见分光光度计", + "domain": "spectroscopy", + "domain_name": "Molecular Spectroscopy & Structure", + "domain_zh": "分子光谱与结构", + "path": "assets/basic40_batch02/t3_analytical/hach_dr6000", + "size_m": [ + 0.5, + 0.46, + 0.215 + ], + "n_components": 14, + "n_mesh_parts": 14, + "n_joints": 1, + "joint_types": { + "continuous": 1 + }, + "n_state_slots": 14, + "n_capabilities": 13, + "n_capabilities_implemented": 8, + "n_mechanisms": 1, + "n_readouts": 1, + "n_interface_points": 1, + "n_sources": 7, + "n_limitations": 10, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/basic40_batch02/t3_analytical/hach_dr6000/model.glb", + "urdf": "assets/basic40_batch02/t3_analytical/hach_dr6000/model.urdf", + "blend": "assets/basic40_batch02/t3_analytical/hach_dr6000/model.blend", + "contract": "assets/basic40_batch02/t3_analytical/hach_dr6000/asset.contract.json", + "runtime": "scripts/basic40_runtime_analytical.py" + }, + "thumb": "media/thumb/hach_dr6000.webp", + "hero": "media/hero/hach_dr6000.webp" + }, + { + "id": "instrument.jasco_ftir4700", + "slug": "jasco_ftir4700", + "chem_id": "CHEM-072", + "name": "FT-IR spectrometer", + "maker": "JASCO", + "model": "FT/IR-4700", + "title": "JASCO FT/IR-4700", + "name_zh": "JASCO FT/IR-4700 傅里叶变换红外光谱仪", + "domain": "spectroscopy", + "domain_name": "Molecular Spectroscopy & Structure", + "domain_zh": "分子光谱与结构", + "path": "assets/basic40_batch02/t3_analytical/jasco_ftir4700", + "size_m": [ + 0.46, + 0.645, + 0.29 + ], + "n_components": 17, + "n_mesh_parts": 17, + "n_joints": 1, + "joint_types": { + "continuous": 1 + }, + "n_state_slots": 18, + "n_capabilities": 12, + "n_capabilities_implemented": 8, + "n_mechanisms": 1, + "n_readouts": 0, + "n_interface_points": 1, + "n_sources": 7, + "n_limitations": 10, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/basic40_batch02/t3_analytical/jasco_ftir4700/model.glb", + "urdf": "assets/basic40_batch02/t3_analytical/jasco_ftir4700/model.urdf", + "blend": "assets/basic40_batch02/t3_analytical/jasco_ftir4700/model.blend", + "contract": "assets/basic40_batch02/t3_analytical/jasco_ftir4700/asset.contract.json", + "runtime": "scripts/basic40_runtime_analytical.py" + }, + "thumb": "media/thumb/jasco_ftir4700.webp", + "hero": "media/hero/jasco_ftir4700.webp" + }, + { + "id": "instrument.jasco_nrs5500", + "slug": "jasco_nrs5500", + "chem_id": "CHEM-073", + "name": "Raman microscope", + "maker": "JASCO", + "model": "NRS-5500", + "title": "JASCO NRS-5500", + "name_zh": "JASCO NRS-5500 显微拉曼光谱仪", + "domain": "spectroscopy", + "domain_name": "Molecular Spectroscopy & Structure", + "domain_zh": "分子光谱与结构", + "path": "assets/expansion_batch04/t3_analytical/jasco_nrs5500", + "size_m": [ + 1.15, + 0.89, + 0.67 + ], + "n_components": 61, + "n_mesh_parts": 61, + "n_joints": 4, + "joint_types": { + "revolute": 1, + "prismatic": 3 + }, + "n_state_slots": 26, + "n_capabilities": 23, + "n_capabilities_implemented": 20, + "n_mechanisms": 1, + "n_readouts": 6, + "n_interface_points": 7, + "n_sources": 8, + "n_limitations": 38, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t3_analytical/jasco_nrs5500/model.glb", + "urdf": "assets/expansion_batch04/t3_analytical/jasco_nrs5500/model.urdf", + "blend": "assets/expansion_batch04/t3_analytical/jasco_nrs5500/model.blend", + "contract": "assets/expansion_batch04/t3_analytical/jasco_nrs5500/asset.contract.json", + "runtime": "scripts/asset_runtime/jasco_nrs5500.py" + }, + "thumb": "media/thumb/jasco_nrs5500.webp", + "hero": "media/hero/jasco_nrs5500.webp" + }, + { + "id": "instrument.applied_sx20", + "slug": "applied_sx20", + "chem_id": "CHEM-074", + "name": "Stopped-flow kinetics spectrometer", + "maker": "Applied Photophysics", + "model": "SX20", + "title": "Applied Photophysics SX20", + "name_zh": "Applied Photophysics SX20 停流反应动力学光谱仪", + "domain": "spectroscopy", + "domain_name": "Molecular Spectroscopy & Structure", + "domain_zh": "分子光谱与结构", + "path": "assets/expansion_batch04/t3_analytical/applied_sx20", + "size_m": [ + 1.2, + 0.5, + 0.5775 + ], + "n_components": 63, + "n_mesh_parts": 63, + "n_joints": 6, + "joint_types": { + "prismatic": 2, + "revolute": 4 + }, + "n_state_slots": 30, + "n_capabilities": 19, + "n_capabilities_implemented": 16, + "n_mechanisms": 1, + "n_readouts": 6, + "n_interface_points": 9, + "n_sources": 9, + "n_limitations": 49, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t3_analytical/applied_sx20/model.glb", + "urdf": "assets/expansion_batch04/t3_analytical/applied_sx20/model.urdf", + "blend": "assets/expansion_batch04/t3_analytical/applied_sx20/model.blend", + "contract": "assets/expansion_batch04/t3_analytical/applied_sx20/asset.contract.json", + "runtime": "scripts/asset_runtime/applied_sx20.py" + }, + "thumb": "media/thumb/applied_sx20.webp", + "hero": "media/hero/applied_sx20.webp" + }, + { + "id": "instrument.edinburgh_fls1000tcspc", + "slug": "edinburgh_fls1000tcspc", + "chem_id": "CHEM-075", + "name": "Time-resolved fluorescence (TCSPC) spectrometer", + "maker": "Edinburgh Instruments", + "model": "FLS1000", + "title": "Edinburgh Instruments FLS1000", + "name_zh": "Edinburgh Instruments FLS1000 TCSPC 时间分辨荧光寿命光谱仪", + "domain": "spectroscopy", + "domain_name": "Molecular Spectroscopy & Structure", + "domain_zh": "分子光谱与结构", + "path": "assets/expansion_batch04/t3_analytical/edinburgh_fls1000tcspc", + "size_m": [ + 1.2, + 0.8, + 0.63 + ], + "n_components": 55, + "n_mesh_parts": 55, + "n_joints": 4, + "joint_types": { + "prismatic": 3, + "revolute": 1 + }, + "n_state_slots": 26, + "n_capabilities": 18, + "n_capabilities_implemented": 16, + "n_mechanisms": 1, + "n_readouts": 6, + "n_interface_points": 8, + "n_sources": 17, + "n_limitations": 51, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t3_analytical/edinburgh_fls1000tcspc/model.glb", + "urdf": "assets/expansion_batch04/t3_analytical/edinburgh_fls1000tcspc/model.urdf", + "blend": "assets/expansion_batch04/t3_analytical/edinburgh_fls1000tcspc/model.blend", + "contract": "assets/expansion_batch04/t3_analytical/edinburgh_fls1000tcspc/asset.contract.json", + "runtime": "scripts/asset_runtime/edinburgh_fls1000tcspc.py" + }, + "thumb": "media/thumb/edinburgh_fls1000tcspc.webp", + "hero": "media/hero/edinburgh_fls1000tcspc.webp" + }, + { + "id": "instrument.ultrafast_helios", + "slug": "ultrafast_helios", + "chem_id": "CHEM-076", + "name": "Femtosecond transient absorption spectrometer", + "maker": "Ultrafast Systems", + "model": "HELIOS", + "title": "Ultrafast Systems HELIOS", + "name_zh": "Ultrafast Systems HELIOS 飞秒瞬态吸收光谱仪", + "domain": "spectroscopy", + "domain_name": "Molecular Spectroscopy & Structure", + "domain_zh": "分子光谱与结构", + "path": "assets/expansion_batch04/t3_analytical/ultrafast_helios", + "size_m": [ + 1.5, + 0.85, + 0.66 + ], + "n_components": 56, + "n_mesh_parts": 56, + "n_joints": 4, + "joint_types": { + "prismatic": 4 + }, + "n_state_slots": 25, + "n_capabilities": 17, + "n_capabilities_implemented": 14, + "n_mechanisms": 1, + "n_readouts": 6, + "n_interface_points": 6, + "n_sources": 13, + "n_limitations": 37, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t3_analytical/ultrafast_helios/model.glb", + "urdf": "assets/expansion_batch04/t3_analytical/ultrafast_helios/model.urdf", + "blend": "assets/expansion_batch04/t3_analytical/ultrafast_helios/model.blend", + "contract": "assets/expansion_batch04/t3_analytical/ultrafast_helios/asset.contract.json", + "runtime": "scripts/asset_runtime/ultrafast_helios.py" + }, + "thumb": "media/thumb/ultrafast_helios.webp", + "hero": "media/hero/ultrafast_helios.webp" + }, + { + "id": "instrument.jasco_fvs6000", + "slug": "jasco_fvs6000", + "chem_id": "CHEM-077", + "name": "Vibrational circular dichroism spectrometer", + "maker": "JASCO", + "model": "FVS-6000", + "title": "JASCO FVS-6000", + "name_zh": "JASCO FVS-6000 振动圆二色光谱仪", + "domain": "spectroscopy", + "domain_name": "Molecular Spectroscopy & Structure", + "domain_zh": "分子光谱与结构", + "path": "assets/expansion_batch04/t3_analytical/jasco_fvs6000", + "size_m": [ + 0.945, + 0.67, + 0.425 + ], + "n_components": 74, + "n_mesh_parts": 74, + "n_joints": 4, + "joint_types": { + "prismatic": 3, + "revolute": 1 + }, + "n_state_slots": 32, + "n_capabilities": 22, + "n_capabilities_implemented": 20, + "n_mechanisms": 1, + "n_readouts": 6, + "n_interface_points": 10, + "n_sources": 12, + "n_limitations": 37, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t3_analytical/jasco_fvs6000/model.glb", + "urdf": "assets/expansion_batch04/t3_analytical/jasco_fvs6000/model.urdf", + "blend": "assets/expansion_batch04/t3_analytical/jasco_fvs6000/model.blend", + "contract": "assets/expansion_batch04/t3_analytical/jasco_fvs6000/asset.contract.json", + "runtime": "scripts/asset_runtime/jasco_fvs6000.py" + }, + "thumb": "media/thumb/jasco_fvs6000.webp", + "hero": "media/hero/jasco_fvs6000.webp" + }, + { + "id": "instrument.jasco_cpl300", + "slug": "jasco_cpl300", + "chem_id": "CHEM-078", + "name": "Circularly polarized luminescence spectrometer", + "maker": "JASCO", + "model": "CPL-300", + "title": "JASCO CPL-300", + "name_zh": "JASCO CPL-300 圆偏振发光光谱仪", + "domain": "spectroscopy", + "domain_name": "Molecular Spectroscopy & Structure", + "domain_zh": "分子光谱与结构", + "path": "assets/expansion_batch04/t3_analytical/jasco_cpl300", + "size_m": [ + 2.4, + 0.7, + 1.0 + ], + "n_components": 107, + "n_mesh_parts": 107, + "n_joints": 5, + "joint_types": { + "prismatic": 1, + "revolute": 4 + }, + "n_state_slots": 29, + "n_capabilities": 22, + "n_capabilities_implemented": 20, + "n_mechanisms": 1, + "n_readouts": 6, + "n_interface_points": 7, + "n_sources": 13, + "n_limitations": 39, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t3_analytical/jasco_cpl300/model.glb", + "urdf": "assets/expansion_batch04/t3_analytical/jasco_cpl300/model.urdf", + "blend": "assets/expansion_batch04/t3_analytical/jasco_cpl300/model.blend", + "contract": "assets/expansion_batch04/t3_analytical/jasco_cpl300/asset.contract.json", + "runtime": "scripts/asset_runtime/jasco_cpl300.py" + }, + "thumb": "media/thumb/jasco_cpl300.webp", + "hero": "media/hero/jasco_cpl300.webp" + }, + { + "id": "instrument.elementar_varioel", + "slug": "elementar_varioel", + "chem_id": "CHEM-079", + "name": "Organic elemental (CHNS) analyzer", + "maker": "Elementar", + "model": "vario EL cube", + "title": "Elementar vario EL cube", + "name_zh": "Elementar vario EL cube 有机元素分析仪", + "domain": "elemental", + "domain_name": "Elemental & Mass Spectrometry", + "domain_zh": "元素与质谱分析", + "path": "assets/expansion_batch04/t3_analytical/elementar_varioel", + "size_m": [ + 0.815, + 0.55, + 0.57 + ], + "n_components": 81, + "n_mesh_parts": 81, + "n_joints": 5, + "joint_types": { + "revolute": 4, + "prismatic": 1 + }, + "n_state_slots": 31, + "n_capabilities": 23, + "n_capabilities_implemented": 20, + "n_mechanisms": 1, + "n_readouts": 6, + "n_interface_points": 7, + "n_sources": 11, + "n_limitations": 38, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t3_analytical/elementar_varioel/model.glb", + "urdf": "assets/expansion_batch04/t3_analytical/elementar_varioel/model.urdf", + "blend": "assets/expansion_batch04/t3_analytical/elementar_varioel/model.blend", + "contract": "assets/expansion_batch04/t3_analytical/elementar_varioel/asset.contract.json", + "runtime": "scripts/asset_runtime/elementar_varioel.py" + }, + "thumb": "media/thumb/elementar_varioel.webp", + "hero": "media/hero/elementar_varioel.webp" + }, + { + "id": "instrument.shimadzu_tocl", + "slug": "shimadzu_tocl", + "chem_id": "CHEM-080", + "name": "Total organic carbon analyzer", + "maker": "Shimadzu", + "model": "TOC-L CSH", + "title": "Shimadzu TOC-L CSH", + "name_zh": "Shimadzu TOC-L CSH 总有机碳分析仪", + "domain": "elemental", + "domain_name": "Elemental & Mass Spectrometry", + "domain_zh": "元素与质谱分析", + "path": "assets/expansion_batch03/t3_analytical/shimadzu_tocl", + "size_m": [ + 0.34, + 0.66, + 0.48 + ], + "n_components": 148, + "n_mesh_parts": 148, + "n_joints": 40, + "joint_types": { + "revolute": 3, + "prismatic": 37 + }, + "n_state_slots": 32, + "n_capabilities": 29, + "n_capabilities_implemented": 26, + "n_mechanisms": 1, + "n_readouts": 6, + "n_interface_points": 9, + "n_sources": 29, + "n_limitations": 51, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t3_analytical/shimadzu_tocl/model.glb", + "urdf": "assets/expansion_batch03/t3_analytical/shimadzu_tocl/model.urdf", + "blend": "assets/expansion_batch03/t3_analytical/shimadzu_tocl/model.blend", + "contract": "assets/expansion_batch03/t3_analytical/shimadzu_tocl/asset.contract.json", + "runtime": "scripts/asset_runtime/shimadzu_tocl.py" + }, + "thumb": "media/thumb/shimadzu_tocl.webp", + "hero": "media/hero/shimadzu_tocl.webp" + }, + { + "id": "instrument.jena_contraa800", + "slug": "jena_contraa800", + "chem_id": "CHEM-081", + "name": "Atomic absorption spectrometer", + "maker": "Analytik Jena", + "model": "contrAA 800 D", + "title": "Analytik Jena contrAA 800 D", + "name_zh": "Analytik Jena contrAA 800 D 原子吸收光谱仪", + "domain": "elemental", + "domain_name": "Elemental & Mass Spectrometry", + "domain_zh": "元素与质谱分析", + "path": "assets/expansion_batch03/t3_analytical/jena_contraa800", + "size_m": [ + 1.115, + 0.97, + 0.625 + ], + "n_components": 118, + "n_mesh_parts": 118, + "n_joints": 10, + "joint_types": { + "revolute": 6, + "prismatic": 4 + }, + "n_state_slots": 41, + "n_capabilities": 33, + "n_capabilities_implemented": 28, + "n_mechanisms": 1, + "n_readouts": 6, + "n_interface_points": 14, + "n_sources": 14, + "n_limitations": 42, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t3_analytical/jena_contraa800/model.glb", + "urdf": "assets/expansion_batch03/t3_analytical/jena_contraa800/model.urdf", + "blend": "assets/expansion_batch03/t3_analytical/jena_contraa800/model.blend", + "contract": "assets/expansion_batch03/t3_analytical/jena_contraa800/asset.contract.json", + "runtime": "scripts/asset_runtime/jena_contraa800.py" + }, + "thumb": "media/thumb/jena_contraa800.webp", + "hero": "media/hero/jena_contraa800.webp" + }, + { + "id": "instrument.shimadzu_icpe9800", + "slug": "shimadzu_icpe9800", + "chem_id": "CHEM-082", + "name": "ICP optical emission spectrometer", + "maker": "Shimadzu", + "model": "ICPE-9800", + "title": "Shimadzu ICPE-9800", + "name_zh": "Shimadzu ICPE-9820 电感耦合等离子体发射光谱仪(9800系列)", + "domain": "elemental", + "domain_name": "Elemental & Mass Spectrometry", + "domain_zh": "元素与质谱分析", + "path": "assets/expansion_batch04/t3_analytical/shimadzu_icpe9800", + "size_m": [ + 1.3, + 0.72, + 0.91 + ], + "n_components": 97, + "n_mesh_parts": 97, + "n_joints": 3, + "joint_types": { + "revolute": 1, + "prismatic": 2 + }, + "n_state_slots": 36, + "n_capabilities": 33, + "n_capabilities_implemented": 28, + "n_mechanisms": 1, + "n_readouts": 6, + "n_interface_points": 9, + "n_sources": 83, + "n_limitations": 41, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t3_analytical/shimadzu_icpe9800/model.glb", + "urdf": "assets/expansion_batch04/t3_analytical/shimadzu_icpe9800/model.urdf", + "blend": "assets/expansion_batch04/t3_analytical/shimadzu_icpe9800/model.blend", + "contract": "assets/expansion_batch04/t3_analytical/shimadzu_icpe9800/asset.contract.json", + "runtime": "scripts/asset_runtime/shimadzu_icpe9800.py" + }, + "thumb": "media/thumb/shimadzu_icpe9800.webp", + "hero": "media/hero/shimadzu_icpe9800.webp" + }, + { + "id": "instrument.shimadzu_icpms2030", + "slug": "shimadzu_icpms2030", + "chem_id": "CHEM-083", + "name": "ICP mass spectrometer", + "maker": "Shimadzu", + "model": "ICPMS-2030", + "title": "Shimadzu ICPMS-2030", + "name_zh": "Shimadzu ICPMS-2030 电感耦合等离子体质谱仪", + "domain": "elemental", + "domain_name": "Elemental & Mass Spectrometry", + "domain_zh": "元素与质谱分析", + "path": "assets/expansion_batch04/t3_analytical/shimadzu_icpms2030", + "size_m": [ + 1.0133, + 0.645, + 0.857 + ], + "n_components": 126, + "n_mesh_parts": 126, + "n_joints": 5, + "joint_types": { + "revolute": 2, + "prismatic": 3 + }, + "n_state_slots": 37, + "n_capabilities": 30, + "n_capabilities_implemented": 26, + "n_mechanisms": 1, + "n_readouts": 6, + "n_interface_points": 10, + "n_sources": 18, + "n_limitations": 36, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t3_analytical/shimadzu_icpms2030/model.glb", + "urdf": "assets/expansion_batch04/t3_analytical/shimadzu_icpms2030/model.urdf", + "blend": "assets/expansion_batch04/t3_analytical/shimadzu_icpms2030/model.blend", + "contract": "assets/expansion_batch04/t3_analytical/shimadzu_icpms2030/asset.contract.json", + "runtime": "scripts/asset_runtime/shimadzu_icpms2030.py" + }, + "thumb": "media/thumb/shimadzu_icpms2030.webp", + "hero": "media/hero/shimadzu_icpms2030.webp" + }, + { + "id": "instrument.shimadzu_edx7200", + "slug": "shimadzu_edx7200", + "chem_id": "CHEM-084", + "name": "Energy-dispersive XRF spectrometer", + "maker": "Shimadzu", + "model": "EDX-7200", + "title": "Shimadzu EDX-7200", + "name_zh": "Shimadzu EDX-7200 能量色散X射线荧光分析仪", + "domain": "elemental", + "domain_name": "Elemental & Mass Spectrometry", + "domain_zh": "元素与质谱分析", + "path": "assets/expansion_batch04/t3_analytical/shimadzu_edx7200", + "size_m": [ + 0.46, + 0.59, + 0.5775 + ], + "n_components": 71, + "n_mesh_parts": 75, + "n_joints": 3, + "joint_types": { + "revolute": 1, + "prismatic": 2 + }, + "n_state_slots": 33, + "n_capabilities": 29, + "n_capabilities_implemented": 25, + "n_mechanisms": 1, + "n_readouts": 6, + "n_interface_points": 5, + "n_sources": 22, + "n_limitations": 33, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t3_analytical/shimadzu_edx7200/model.glb", + "urdf": "assets/expansion_batch04/t3_analytical/shimadzu_edx7200/model.urdf", + "blend": "assets/expansion_batch04/t3_analytical/shimadzu_edx7200/model.blend", + "contract": "assets/expansion_batch04/t3_analytical/shimadzu_edx7200/asset.contract.json", + "runtime": "scripts/asset_runtime/shimadzu_edx7200.py" + }, + "thumb": "media/thumb/shimadzu_edx7200.webp", + "hero": "media/hero/shimadzu_edx7200.webp" + }, + { + "id": "instrument.jena_multix", + "slug": "jena_multix", + "chem_id": "CHEM-085", + "name": "Total organic halogen (AOX/TOX) analyzer", + "maker": "Analytik Jena", + "model": "multi X 2500", + "title": "Analytik Jena multi X 2500", + "name_zh": "Analytik Jena multi X 2500 总有机卤素分析仪", + "domain": "elemental", + "domain_name": "Elemental & Mass Spectrometry", + "domain_zh": "元素与质谱分析", + "path": "assets/expansion_batch04/t3_analytical/jena_multix", + "size_m": [ + 1.4, + 0.55, + 0.671 + ], + "n_components": 132, + "n_mesh_parts": 132, + "n_joints": 8, + "joint_types": { + "revolute": 5, + "prismatic": 3 + }, + "n_state_slots": 38, + "n_capabilities": 37, + "n_capabilities_implemented": 30, + "n_mechanisms": 1, + "n_readouts": 6, + "n_interface_points": 11, + "n_sources": 84, + "n_limitations": 40, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t3_analytical/jena_multix/model.glb", + "urdf": "assets/expansion_batch04/t3_analytical/jena_multix/model.urdf", + "blend": "assets/expansion_batch04/t3_analytical/jena_multix/model.blend", + "contract": "assets/expansion_batch04/t3_analytical/jena_multix/asset.contract.json", + "runtime": "scripts/asset_runtime/jena_multix.py" + }, + "thumb": "media/thumb/jena_multix.webp", + "hero": "media/hero/jena_multix.webp" + }, + { + "id": "instrument.milestone_dma80", + "slug": "milestone_dma80", + "chem_id": "CHEM-086", + "name": "Direct mercury analyzer", + "maker": "Milestone", + "model": "DMA-80 evo", + "title": "Milestone DMA-80 evo", + "name_zh": "Milestone DMA-80 evo DoubleBeam 直接测汞仪", + "domain": "elemental", + "domain_name": "Elemental & Mass Spectrometry", + "domain_zh": "元素与质谱分析", + "path": "assets/expansion_batch04/t3_analytical/milestone_dma80", + "size_m": [ + 0.8, + 0.42, + 0.3 + ], + "n_components": 114, + "n_mesh_parts": 114, + "n_joints": 5, + "joint_types": { + "revolute": 3, + "prismatic": 2 + }, + "n_state_slots": 38, + "n_capabilities": 34, + "n_capabilities_implemented": 28, + "n_mechanisms": 1, + "n_readouts": 6, + "n_interface_points": 46, + "n_sources": 69, + "n_limitations": 56, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t3_analytical/milestone_dma80/model.glb", + "urdf": "assets/expansion_batch04/t3_analytical/milestone_dma80/model.urdf", + "blend": "assets/expansion_batch04/t3_analytical/milestone_dma80/model.blend", + "contract": "assets/expansion_batch04/t3_analytical/milestone_dma80/asset.contract.json", + "runtime": "scripts/asset_runtime/milestone_dma80.py" + }, + "thumb": "media/thumb/milestone_dma80.webp", + "hero": "media/hero/milestone_dma80.webp" + }, + { + "id": "instrument.stanford_rga100", + "slug": "stanford_rga100", + "chem_id": "CHEM-087", + "name": "Residual gas analyzer", + "maker": "Stanford Research Systems", + "model": "RGA100", + "title": "Stanford Research Systems RGA100", + "name_zh": "Stanford Research Systems RGA100 残余气体质谱分析仪", + "domain": "elemental", + "domain_name": "Elemental & Mass Spectrometry", + "domain_zh": "元素与质谱分析", + "path": "assets/expansion_batch04/t3_analytical/stanford_rga100", + "size_m": [ + 0.215, + 0.5812, + 0.264 + ], + "n_components": 99, + "n_mesh_parts": 102, + "n_joints": 2, + "joint_types": { + "prismatic": 2 + }, + "n_state_slots": 40, + "n_capabilities": 34, + "n_capabilities_implemented": 27, + "n_mechanisms": 1, + "n_readouts": 13, + "n_interface_points": 7, + "n_sources": 327, + "n_limitations": 44, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t3_analytical/stanford_rga100/model.glb", + "urdf": "assets/expansion_batch04/t3_analytical/stanford_rga100/model.urdf", + "blend": "assets/expansion_batch04/t3_analytical/stanford_rga100/model.blend", + "contract": "assets/expansion_batch04/t3_analytical/stanford_rga100/asset.contract.json", + "runtime": "scripts/asset_runtime/stanford_rga100.py" + }, + "thumb": "media/thumb/stanford_rga100.webp", + "hero": "media/hero/stanford_rga100.webp" + }, + { + "id": "instrument.thermo_orbitrapexploris", + "slug": "thermo_orbitrapexploris", + "chem_id": "CHEM-088", + "name": "High-resolution Orbitrap mass spectrometer", + "maker": "Thermo Fisher Scientific", + "model": "Orbitrap Exploris 120", + "title": "Thermo Fisher Scientific Orbitrap Exploris 120", + "name_zh": "Thermo Fisher Scientific Orbitrap Exploris120 高分辨分子质谱仪", + "domain": "elemental", + "domain_name": "Elemental & Mass Spectrometry", + "domain_zh": "元素与质谱分析", + "path": "assets/expansion_batch04/t3_analytical/thermo_orbitrapexploris", + "size_m": [ + 0.534, + 0.939, + 0.703 + ], + "n_components": 119, + "n_mesh_parts": 119, + "n_joints": 4, + "joint_types": { + "revolute": 3, + "prismatic": 1 + }, + "n_state_slots": 37, + "n_capabilities": 37, + "n_capabilities_implemented": 27, + "n_mechanisms": 1, + "n_readouts": 9, + "n_interface_points": 14, + "n_sources": 100, + "n_limitations": 45, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t3_analytical/thermo_orbitrapexploris/model.glb", + "urdf": "assets/expansion_batch04/t3_analytical/thermo_orbitrapexploris/model.urdf", + "blend": "assets/expansion_batch04/t3_analytical/thermo_orbitrapexploris/model.blend", + "contract": "assets/expansion_batch04/t3_analytical/thermo_orbitrapexploris/asset.contract.json", + "runtime": "scripts/asset_runtime/thermo_orbitrapexploris.py" + }, + "thumb": "media/thumb/thermo_orbitrapexploris.webp", + "hero": "media/hero/thermo_orbitrapexploris.webp" + }, + { + "id": "instrument.leco_onh836", + "slug": "leco_onh836", + "chem_id": "CHEM-089", + "name": "Inert-gas fusion O/N/H analyzer", + "maker": "LECO", + "model": "ONH836", + "title": "LECO ONH836", + "name_zh": "LECO ONH836 惰气熔融氧氮氢分析仪", + "domain": "elemental", + "domain_name": "Elemental & Mass Spectrometry", + "domain_zh": "元素与质谱分析", + "path": "assets/expansion_batch04/t3_analytical/leco_onh836", + "size_m": [ + 0.71, + 0.76, + 0.915 + ], + "n_components": 140, + "n_mesh_parts": 141, + "n_joints": 4, + "joint_types": { + "prismatic": 4 + }, + "n_state_slots": 36, + "n_capabilities": 35, + "n_capabilities_implemented": 28, + "n_mechanisms": 1, + "n_readouts": 7, + "n_interface_points": 8, + "n_sources": 31, + "n_limitations": 54, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t3_analytical/leco_onh836/model.glb", + "urdf": "assets/expansion_batch04/t3_analytical/leco_onh836/model.urdf", + "blend": "assets/expansion_batch04/t3_analytical/leco_onh836/model.blend", + "contract": "assets/expansion_batch04/t3_analytical/leco_onh836/asset.contract.json", + "runtime": "scripts/asset_runtime/leco_onh836.py" + }, + "thumb": "media/thumb/leco_onh836.webp", + "hero": "media/hero/leco_onh836.webp" + }, + { + "id": "instrument.elementar_isoprimeprecision", + "slug": "elementar_isoprimeprecision", + "chem_id": "CHEM-090", + "name": "Stable isotope-ratio mass spectrometer", + "maker": "Elementar", + "model": "isoprime precisION", + "title": "Elementar isoprime precisION", + "name_zh": "稳定同位素比质谱仪Elementar isoprime precisION(标准通用收集器阵列,集成centrION)", + "domain": "elemental", + "domain_name": "Elemental & Mass Spectrometry", + "domain_zh": "元素与质谱分析", + "path": "assets/expansion_batch04/t3_analytical/elementar_isoprimeprecision", + "size_m": [ + 0.595, + 0.4607, + 0.65 + ], + "n_components": 36, + "n_mesh_parts": 36, + "n_joints": 2, + "joint_types": { + "prismatic": 1, + "revolute": 1 + }, + "n_state_slots": 21, + "n_capabilities": 30, + "n_capabilities_implemented": 26, + "n_mechanisms": 1, + "n_readouts": 3, + "n_interface_points": 16, + "n_sources": 15, + "n_limitations": 31, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": true, + "files": { + "glb": "assets/expansion_batch04/t3_analytical/elementar_isoprimeprecision/model.glb", + "urdf": "assets/expansion_batch04/t3_analytical/elementar_isoprimeprecision/model.urdf", + "blend": "assets/expansion_batch04/t3_analytical/elementar_isoprimeprecision/model.blend", + "contract": "assets/expansion_batch04/t3_analytical/elementar_isoprimeprecision/asset.contract.json", + "runtime": "scripts/asset_runtime/elementar_isoprimeprecision.py" + }, + "thumb": "media/thumb/elementar_isoprimeprecision.webp", + "hero": "media/hero/elementar_isoprimeprecision.webp" + }, + { + "id": "instrument.agilent_gc8890b", + "slug": "agilent_gc8890b", + "chem_id": "CHEM-096", + "name": "Gas chromatograph", + "maker": "Agilent", + "model": "8890B GC", + "title": "Agilent 8890B GC", + "name_zh": "Agilent 8890B GC 气相色谱仪(单S/SL + FID迁移配置)", + "domain": "chromatography", + "domain_name": "Chromatography & Electrophoresis", + "domain_zh": "色谱与电泳分离", + "path": "assets/basic40_batch02/t3_analytical/agilent_gc8890b", + "size_m": [ + 0.5803, + 0.545, + 0.4905 + ], + "n_components": 52, + "n_mesh_parts": 52, + "n_joints": 50, + "joint_types": { + "revolute": 3, + "prismatic": 47 + }, + "n_state_slots": 22, + "n_capabilities": 55, + "n_capabilities_implemented": 45, + "n_mechanisms": 3, + "n_readouts": 3, + "n_interface_points": 1, + "n_sources": 9, + "n_limitations": 8, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/basic40_batch02/t3_analytical/agilent_gc8890b/model.glb", + "urdf": "assets/basic40_batch02/t3_analytical/agilent_gc8890b/model.urdf", + "blend": "assets/basic40_batch02/t3_analytical/agilent_gc8890b/model.blend", + "contract": "assets/basic40_batch02/t3_analytical/agilent_gc8890b/asset.contract.json", + "runtime": "scripts/basic40_runtime_analytical.py" + }, + "thumb": "media/thumb/agilent_gc8890b.webp", + "hero": "media/hero/agilent_gc8890b.webp" + }, + { + "id": "instrument.agilent_hplc1260", + "slug": "agilent_hplc1260", + "chem_id": "CHEM-097", + "name": "HPLC system", + "maker": "Agilent", + "model": "1260 Infinity III LC", + "title": "Agilent 1260 Infinity III LC", + "name_zh": "高效液相色谱仪 Agilent | 1260 Infinity III LC", + "domain": "chromatography", + "domain_name": "Chromatography & Electrophoresis", + "domain_zh": "色谱与电泳分离", + "path": "assets/basic40_batch02/t3_analytical/agilent_hplc1260", + "size_m": [ + 0.396, + 0.468, + 0.66 + ], + "n_components": 15, + "n_mesh_parts": 15, + "n_joints": 1, + "joint_types": { + "continuous": 1 + }, + "n_state_slots": 24, + "n_capabilities": 14, + "n_capabilities_implemented": 9, + "n_mechanisms": 1, + "n_readouts": 0, + "n_interface_points": 3, + "n_sources": 9, + "n_limitations": 23, + "isaac_lab": "bridged", + "glb_up": "y", + "output_templates": false, + "files": { + "glb": "assets/basic40_batch02/t3_analytical/agilent_hplc1260/model.glb", + "urdf": "assets/basic40_batch02/t3_analytical/agilent_hplc1260/model.urdf", + "blend": "assets/basic40_batch02/t3_analytical/agilent_hplc1260/model.blend", + "contract": "assets/basic40_batch02/t3_analytical/agilent_hplc1260/asset.contract.json" + }, + "thumb": "media/thumb/agilent_hplc1260.webp", + "hero": "media/hero/agilent_hplc1260.webp" + }, + { + "id": "instrument.thermo_dionexintegrion", + "slug": "thermo_dionexintegrion", + "chem_id": "CHEM-098", + "name": "Ion chromatograph", + "maker": "Thermo Fisher Scientific", + "model": "Dionex Integrion HPIC", + "title": "Thermo Fisher Scientific Dionex Integrion HPIC", + "name_zh": "Thermo Scientific Dionex Integrion HPIC 离子色谱仪", + "domain": "chromatography", + "domain_name": "Chromatography & Electrophoresis", + "domain_zh": "色谱与电泳分离", + "path": "assets/expansion_batch03/t3_analytical/thermo_dionexintegrion", + "size_m": [ + 0.3, + 0.577, + 0.625 + ], + "n_components": 72, + "n_mesh_parts": 72, + "n_joints": 2, + "joint_types": { + "revolute": 2 + }, + "n_state_slots": 21, + "n_capabilities": 16, + "n_capabilities_implemented": 14, + "n_mechanisms": 1, + "n_readouts": 4, + "n_interface_points": 6, + "n_sources": 7, + "n_limitations": 22, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t3_analytical/thermo_dionexintegrion/model.glb", + "urdf": "assets/expansion_batch03/t3_analytical/thermo_dionexintegrion/model.urdf", + "blend": "assets/expansion_batch03/t3_analytical/thermo_dionexintegrion/model.blend", + "contract": "assets/expansion_batch03/t3_analytical/thermo_dionexintegrion/asset.contract.json", + "runtime": "scripts/asset_runtime/thermo_dionexintegrion.py" + }, + "thumb": "media/thumb/thermo_dionexintegrion.webp", + "hero": "media/hero/thermo_dionexintegrion.webp" + }, + { + "id": "instrument.agilent_1290infinity", + "slug": "agilent_1290infinity", + "chem_id": "CHEM-099", + "name": "GPC/SEC system", + "maker": "Agilent", + "model": "1290 Infinity II GPC/SEC", + "title": "Agilent 1290 Infinity II GPC/SEC", + "name_zh": "Agilent 1290 Infinity II GPC/SEC 凝胶渗透体积排阻色谱系统", + "domain": "chromatography", + "domain_name": "Chromatography & Electrophoresis", + "domain_zh": "色谱与电泳分离", + "path": "assets/expansion_batch04/t3_analytical/agilent_1290infinity", + "size_m": [ + 0.4365, + 0.481, + 0.9 + ], + "n_components": 166, + "n_mesh_parts": 166, + "n_joints": 3, + "joint_types": { + "revolute": 2, + "prismatic": 1 + }, + "n_state_slots": 25, + "n_capabilities": 18, + "n_capabilities_implemented": 16, + "n_mechanisms": 1, + "n_readouts": 4, + "n_interface_points": 14, + "n_sources": 8, + "n_limitations": 20, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t3_analytical/agilent_1290infinity/model.glb", + "urdf": "assets/expansion_batch04/t3_analytical/agilent_1290infinity/model.urdf", + "blend": "assets/expansion_batch04/t3_analytical/agilent_1290infinity/model.blend", + "contract": "assets/expansion_batch04/t3_analytical/agilent_1290infinity/asset.contract.json", + "runtime": "scripts/asset_runtime/agilent_1290infinity.py" + }, + "thumb": "media/thumb/agilent_1290infinity.webp", + "hero": "media/hero/agilent_1290infinity.webp" + }, + { + "id": "instrument.gas_flavourspec25gc", + "slug": "gas_flavourspec25gc", + "chem_id": "CHEM-100", + "name": "GC–ion mobility spectrometer", + "maker": "G.A.S.", + "model": "FlavourSpec25 GC-IMS", + "title": "G.A.S. FlavourSpec25 GC-IMS", + "name_zh": "G.A.S. FlavourSpec25 GC-IMS 离子迁移谱正交分离系统", + "domain": "chromatography", + "domain_name": "Chromatography & Electrophoresis", + "domain_zh": "色谱与电泳分离", + "path": "assets/expansion_batch04/t3_analytical/gas_flavourspec25gc", + "size_m": [ + 1.01, + 0.8, + 0.79 + ], + "n_components": 200, + "n_mesh_parts": 200, + "n_joints": 4, + "joint_types": { + "revolute": 1, + "prismatic": 3 + }, + "n_state_slots": 29, + "n_capabilities": 20, + "n_capabilities_implemented": 18, + "n_mechanisms": 1, + "n_readouts": 4, + "n_interface_points": 65, + "n_sources": 5, + "n_limitations": 24, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t3_analytical/gas_flavourspec25gc/model.glb", + "urdf": "assets/expansion_batch04/t3_analytical/gas_flavourspec25gc/model.urdf", + "blend": "assets/expansion_batch04/t3_analytical/gas_flavourspec25gc/model.blend", + "contract": "assets/expansion_batch04/t3_analytical/gas_flavourspec25gc/asset.contract.json", + "runtime": "scripts/asset_runtime/gas_flavourspec25gc.py" + }, + "thumb": "media/thumb/gas_flavourspec25gc.webp", + "hero": "media/hero/gas_flavourspec25gc.webp" + }, + { + "id": "instrument.metrohm_omnis", + "slug": "metrohm_omnis", + "chem_id": "CHEM-101", + "name": "Automatic potentiometric titrator", + "maker": "Metrohm", + "model": "OMNIS Professional Titrator", + "title": "Metrohm OMNIS Professional Titrator", + "name_zh": "Metrohm OMNIS Professional Titrator 2.1001.0320 自动电位滴定仪", + "domain": "electrochem", + "domain_name": "Electrochemistry & Titration", + "domain_zh": "电化学与定量分析", + "path": "assets/basic40_batch02/t4_measure/metrohm_omnis", + "size_m": [ + 0.142, + 0.3996, + 0.358 + ], + "n_components": 17, + "n_mesh_parts": 13, + "n_joints": 2, + "joint_types": { + "continuous": 1, + "prismatic": 1 + }, + "n_state_slots": 34, + "n_capabilities": 12, + "n_capabilities_implemented": 12, + "n_mechanisms": 3, + "n_readouts": 1, + "n_interface_points": 1, + "n_sources": 15, + "n_limitations": 13, + "isaac_lab": "bridged", + "glb_up": "y", + "output_templates": false, + "files": { + "glb": "assets/basic40_batch02/t4_measure/metrohm_omnis/model.glb", + "urdf": "assets/basic40_batch02/t4_measure/metrohm_omnis/model.urdf", + "blend": "assets/basic40_batch02/t4_measure/metrohm_omnis/model.blend", + "contract": "assets/basic40_batch02/t4_measure/metrohm_omnis/asset.contract.json", + "runtime": "scripts/basic40_runtime_measure.py" + }, + "thumb": "media/thumb/metrohm_omnis.webp", + "hero": "media/hero/metrohm_omnis.webp" + }, + { + "id": "instrument.metrohm_899", + "slug": "metrohm_899", + "chem_id": "CHEM-102", + "name": "Karl Fischer coulometer", + "maker": "Metrohm", + "model": "899 Coulometer", + "title": "Metrohm 899 Coulometer", + "name_zh": "CHEM-102 卡尔费休水分滴定仪 · Metrohm 899 Coulometer", + "domain": "electrochem", + "domain_name": "Electrochemistry & Titration", + "domain_zh": "电化学与定量分析", + "path": "assets/basic40_batch02/t4_measure/metrohm_899", + "size_m": [ + 0.1436, + 0.2889, + 0.3373 + ], + "n_components": 11, + "n_mesh_parts": 11, + "n_joints": 11, + "joint_types": { + "prismatic": 11 + }, + "n_state_slots": 26, + "n_capabilities": 7, + "n_capabilities_implemented": 7, + "n_mechanisms": 1, + "n_readouts": 0, + "n_interface_points": 1, + "n_sources": 9, + "n_limitations": 22, + "isaac_lab": "bridged", + "glb_up": "y", + "output_templates": false, + "files": { + "glb": "assets/basic40_batch02/t4_measure/metrohm_899/model.glb", + "urdf": "assets/basic40_batch02/t4_measure/metrohm_899/model.urdf", + "blend": "assets/basic40_batch02/t4_measure/metrohm_899/model.blend", + "contract": "assets/basic40_batch02/t4_measure/metrohm_899/asset.contract.json", + "runtime": "scripts/basic40_runtime_measure.py" + }, + "thumb": "media/thumb/metrohm_899.webp", + "hero": "media/hero/metrohm_899.webp" + }, + { + "id": "instrument.gamry_reference620", + "slug": "gamry_reference620", + "chem_id": "CHEM-103", + "name": "Potentiostat / electrochemical workstation", + "maker": "Gamry", + "model": "Reference 620", + "title": "Gamry Reference 620", + "name_zh": "Gamry Reference 620 电化学工作站", + "domain": "electrochem", + "domain_name": "Electrochemistry & Titration", + "domain_zh": "电化学与定量分析", + "path": "assets/basic40_batch02/t4_measure/gamry_ref620", + "size_m": [ + 0.09, + 0.2744, + 0.19 + ], + "n_components": 12, + "n_mesh_parts": 7, + "n_joints": 0, + "joint_types": {}, + "n_state_slots": 21, + "n_capabilities": 7, + "n_capabilities_implemented": 6, + "n_mechanisms": 1, + "n_readouts": 0, + "n_interface_points": 0, + "n_sources": 13, + "n_limitations": 13, + "isaac_lab": "bridged", + "glb_up": "y", + "output_templates": false, + "files": { + "glb": "assets/basic40_batch02/t4_measure/gamry_ref620/model.glb", + "urdf": "assets/basic40_batch02/t4_measure/gamry_ref620/model.urdf", + "blend": "assets/basic40_batch02/t4_measure/gamry_ref620/model.blend", + "contract": "assets/basic40_batch02/t4_measure/gamry_ref620/asset.contract.json", + "runtime": "scripts/basic40_runtime_measure.py" + }, + "thumb": "media/thumb/gamry_reference620.webp", + "hero": "media/hero/gamry_reference620.webp" + }, + { + "id": "instrument.ch_chi920d", + "slug": "ch_chi920d", + "chem_id": "CHEM-104", + "name": "Scanning electrochemical microscope", + "maker": "CH Instruments", + "model": "CHI920D", + "title": "CH Instruments CHI920D", + "name_zh": "CH Instruments CHI920D 扫描电化学显微镜", + "domain": "electrochem", + "domain_name": "Electrochemistry & Titration", + "domain_zh": "电化学与定量分析", + "path": "assets/expansion_batch04/t4_measure/ch_chi920d", + "size_m": [ + 0.76, + 0.36, + 0.45 + ], + "n_components": 118, + "n_mesh_parts": 118, + "n_joints": 3, + "joint_types": { + "prismatic": 3 + }, + "n_state_slots": 29, + "n_capabilities": 16, + "n_capabilities_implemented": 12, + "n_mechanisms": 1, + "n_readouts": 2, + "n_interface_points": 12, + "n_sources": 6, + "n_limitations": 20, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t4_measure/ch_chi920d/model.glb", + "urdf": "assets/expansion_batch04/t4_measure/ch_chi920d/model.urdf", + "blend": "assets/expansion_batch04/t4_measure/ch_chi920d/model.blend", + "contract": "assets/expansion_batch04/t4_measure/ch_chi920d/asset.contract.json", + "runtime": "scripts/asset_runtime/ch_chi920d.py" + }, + "thumb": "media/thumb/ch_chi920d.webp", + "hero": "media/hero/ch_chi920d.webp" + }, + { + "id": "instrument.ch_chi440c", + "slug": "ch_chi440c", + "chem_id": "CHEM-105", + "name": "Electrochemical quartz crystal microbalance", + "maker": "CH Instruments", + "model": "CHI440C", + "title": "CH Instruments CHI440C", + "name_zh": "CH Instruments CHI440C 电化学石英晶体微天平", + "domain": "electrochem", + "domain_name": "Electrochemistry & Titration", + "domain_zh": "电化学与定量分析", + "path": "assets/expansion_batch04/t4_measure/ch_chi440c", + "size_m": [ + 0.6, + 0.31, + 0.1247 + ], + "n_components": 79, + "n_mesh_parts": 79, + "n_joints": 1, + "joint_types": { + "prismatic": 1 + }, + "n_state_slots": 19, + "n_capabilities": 17, + "n_capabilities_implemented": 13, + "n_mechanisms": 1, + "n_readouts": 1, + "n_interface_points": 10, + "n_sources": 6, + "n_limitations": 19, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t4_measure/ch_chi440c/model.glb", + "urdf": "assets/expansion_batch04/t4_measure/ch_chi440c/model.urdf", + "blend": "assets/expansion_batch04/t4_measure/ch_chi440c/model.blend", + "contract": "assets/expansion_batch04/t4_measure/ch_chi440c/asset.contract.json", + "runtime": "scripts/asset_runtime/ch_chi440c.py" + }, + "thumb": "media/thumb/ch_chi440c.webp", + "hero": "media/hero/ch_chi440c.webp" + }, + { + "id": "instrument.knauer_k7400s", + "slug": "knauer_k7400s", + "chem_id": "CHEM-106", + "name": "Freezing-point osmometer", + "maker": "KNAUER", + "model": "K-7400S", + "title": "KNAUER K-7400S", + "name_zh": "KNAUER K-7400S 冰点渗透压仪", + "domain": "electrochem", + "domain_name": "Electrochemistry & Titration", + "domain_zh": "电化学与定量分析", + "path": "assets/expansion_batch04/t4_measure/knauer_k7400s", + "size_m": [ + 0.1606, + 0.3434, + 0.228 + ], + "n_components": 77, + "n_mesh_parts": 77, + "n_joints": 2, + "joint_types": { + "prismatic": 2 + }, + "n_state_slots": 24, + "n_capabilities": 17, + "n_capabilities_implemented": 13, + "n_mechanisms": 1, + "n_readouts": 2, + "n_interface_points": 6, + "n_sources": 6, + "n_limitations": 24, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t4_measure/knauer_k7400s/model.glb", + "urdf": "assets/expansion_batch04/t4_measure/knauer_k7400s/model.urdf", + "blend": "assets/expansion_batch04/t4_measure/knauer_k7400s/model.blend", + "contract": "assets/expansion_batch04/t4_measure/knauer_k7400s/asset.contract.json", + "runtime": "scripts/asset_runtime/knauer_k7400s.py" + }, + "thumb": "media/thumb/knauer_k7400s.webp", + "hero": "media/hero/knauer_k7400s.webp" + }, + { + "id": "instrument.pine_wavevortex10", + "slug": "pine_wavevortex10", + "chem_id": "CHEM-107", + "name": "Rotating ring-disk electrode rotator", + "maker": "Pine Research", + "model": "WaveVortex 10", + "title": "Pine Research WaveVortex 10", + "name_zh": "Pine Research WaveVortex 10旋转环盘驱动", + "domain": "electrochem", + "domain_name": "Electrochemistry & Titration", + "domain_zh": "电化学与定量分析", + "path": "assets/expansion_batch04/t4_measure/pine_wavevortex10", + "size_m": [ + 0.38, + 0.28, + 0.38 + ], + "n_components": 113, + "n_mesh_parts": 113, + "n_joints": 4, + "joint_types": { + "revolute": 1, + "prismatic": 2, + "continuous": 1 + }, + "n_state_slots": 30, + "n_capabilities": 22, + "n_capabilities_implemented": 18, + "n_mechanisms": 1, + "n_readouts": 5, + "n_interface_points": 9, + "n_sources": 5, + "n_limitations": 22, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t4_measure/pine_wavevortex10/model.glb", + "urdf": "assets/expansion_batch04/t4_measure/pine_wavevortex10/model.urdf", + "blend": "assets/expansion_batch04/t4_measure/pine_wavevortex10/model.blend", + "contract": "assets/expansion_batch04/t4_measure/pine_wavevortex10/asset.contract.json", + "runtime": "scripts/asset_runtime/pine_wavevortex10.py" + }, + "thumb": "media/thumb/pine_wavevortex10.webp", + "hero": "media/hero/pine_wavevortex10.webp" + }, + { + "id": "instrument.agilent_hs8697", + "slug": "agilent_hs8697", + "chem_id": "CHEM-108", + "name": "Headspace autosampler (48-vial tray)", + "maker": "Agilent", + "model": "8697", + "title": "Agilent 8697", + "name_zh": "CHEM-108 Agilent 8697 顶空自动进样器(48 位托盘)", + "domain": "sampling", + "domain_name": "Analytical Sampling & Interfaces", + "domain_zh": "分析进样与接口", + "path": "assets/basic40_batch02/t3_analytical/agilent_hs8697", + "size_m": [ + 0.599, + 0.73, + 0.8 + ], + "n_components": 141, + "n_mesh_parts": 140, + "n_joints": 1, + "joint_types": { + "continuous": 1 + }, + "n_state_slots": 24, + "n_capabilities": 13, + "n_capabilities_implemented": 8, + "n_mechanisms": 2, + "n_readouts": 1, + "n_interface_points": 60, + "n_sources": 7, + "n_limitations": 8, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/basic40_batch02/t3_analytical/agilent_hs8697/model.glb", + "urdf": "assets/basic40_batch02/t3_analytical/agilent_hs8697/model.urdf", + "blend": "assets/basic40_batch02/t3_analytical/agilent_hs8697/model.blend", + "contract": "assets/basic40_batch02/t3_analytical/agilent_hs8697/asset.contract.json", + "runtime": "scripts/basic40_runtime_analytical.py" + }, + "thumb": "media/thumb/agilent_hs8697.webp", + "hero": "media/hero/agilent_hs8697.webp" + }, + { + "id": "instrument.teledyne_atomxxyz", + "slug": "teledyne_atomxxyz", + "chem_id": "CHEM-109", + "name": "Purge-and-trap autosampler", + "maker": "Teledyne Tekmar", + "model": "Atomx XYZ", + "title": "Teledyne Tekmar Atomx XYZ", + "name_zh": "Teledyne Tekmar Atomx XYZ 吹扫捕集自动进样系统", + "domain": "sampling", + "domain_name": "Analytical Sampling & Interfaces", + "domain_zh": "分析进样与接口", + "path": "assets/expansion_batch03/t3_analytical/teledyne_atomxxyz", + "size_m": [ + 0.701, + 0.5842, + 0.495 + ], + "n_components": 443, + "n_mesh_parts": 443, + "n_joints": 7, + "joint_types": { + "prismatic": 5, + "revolute": 2 + }, + "n_state_slots": 25, + "n_capabilities": 20, + "n_capabilities_implemented": 16, + "n_mechanisms": 1, + "n_readouts": 2, + "n_interface_points": 97, + "n_sources": 7, + "n_limitations": 20, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t3_analytical/teledyne_atomxxyz/model.glb", + "urdf": "assets/expansion_batch03/t3_analytical/teledyne_atomxxyz/model.urdf", + "blend": "assets/expansion_batch03/t3_analytical/teledyne_atomxxyz/model.blend", + "contract": "assets/expansion_batch03/t3_analytical/teledyne_atomxxyz/asset.contract.json", + "runtime": "scripts/asset_runtime/teledyne_atomxxyz.py" + }, + "thumb": "media/thumb/teledyne_atomxxyz.webp", + "hero": "media/hero/teledyne_atomxxyz.webp" + }, + { + "id": "instrument.teledyne_analyteexcite", + "slug": "teledyne_analyteexcite", + "chem_id": "CHEM-110", + "name": "Laser ablation sampling system", + "maker": "Teledyne CETAC", + "model": "Analyte Excite+", + "title": "Teledyne CETAC Analyte Excite+", + "name_zh": "Teledyne CETAC Analyte Excite+ 激光剥蚀系统", + "domain": "sampling", + "domain_name": "Analytical Sampling & Interfaces", + "domain_zh": "分析进样与接口", + "path": "assets/expansion_batch03/t3_analytical/teledyne_analyteexcite", + "size_m": [ + 0.76, + 0.87, + 1.5 + ], + "n_components": 135, + "n_mesh_parts": 135, + "n_joints": 6, + "joint_types": { + "revolute": 2, + "prismatic": 4 + }, + "n_state_slots": 22, + "n_capabilities": 23, + "n_capabilities_implemented": 18, + "n_mechanisms": 1, + "n_readouts": 2, + "n_interface_points": 25, + "n_sources": 7, + "n_limitations": 20, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t3_analytical/teledyne_analyteexcite/model.glb", + "urdf": "assets/expansion_batch03/t3_analytical/teledyne_analyteexcite/model.urdf", + "blend": "assets/expansion_batch03/t3_analytical/teledyne_analyteexcite/model.blend", + "contract": "assets/expansion_batch03/t3_analytical/teledyne_analyteexcite/asset.contract.json", + "runtime": "scripts/asset_runtime/teledyne_analyteexcite.py" + }, + "thumb": "media/thumb/teledyne_analyteexcite.webp", + "hero": "media/hero/teledyne_analyteexcite.webp" + }, + { + "id": "instrument.frontier_egapy", + "slug": "frontier_egapy", + "chem_id": "CHEM-111", + "name": "Multi-shot pyrolyzer (GC inlet)", + "maker": "Frontier Laboratories", + "model": "EGA/PY-3030D", + "title": "Frontier Laboratories EGA/PY-3030D", + "name_zh": "Frontier EGA/PY-3030D 热裂解进样器", + "domain": "sampling", + "domain_name": "Analytical Sampling & Interfaces", + "domain_zh": "分析进样与接口", + "path": "assets/expansion_batch03/t3_analytical/frontier_egapy", + "size_m": [ + 0.3355, + 0.346, + 0.3935 + ], + "n_components": 101, + "n_mesh_parts": 101, + "n_joints": 4, + "joint_types": { + "revolute": 1, + "prismatic": 3 + }, + "n_state_slots": 22, + "n_capabilities": 22, + "n_capabilities_implemented": 17, + "n_mechanisms": 1, + "n_readouts": 0, + "n_interface_points": 21, + "n_sources": 9, + "n_limitations": 25, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t3_analytical/frontier_egapy/model.glb", + "urdf": "assets/expansion_batch03/t3_analytical/frontier_egapy/model.urdf", + "blend": "assets/expansion_batch03/t3_analytical/frontier_egapy/model.blend", + "contract": "assets/expansion_batch03/t3_analytical/frontier_egapy/asset.contract.json", + "runtime": "scripts/asset_runtime/frontier_egapy.py" + }, + "thumb": "media/thumb/frontier_egapy.webp", + "hero": "media/hero/frontier_egapy.webp" + }, + { + "id": "instrument.markes_unityxr", + "slug": "markes_unityxr", + "chem_id": "CHEM-112", + "name": "Thermal desorber", + "maker": "Markes International", + "model": "UNITY-xr", + "title": "Markes International UNITY-xr", + "name_zh": "Markes UNITY-xr 热脱附进样器", + "domain": "sampling", + "domain_name": "Analytical Sampling & Interfaces", + "domain_zh": "分析进样与接口", + "path": "assets/expansion_batch03/t3_analytical/markes_unityxr", + "size_m": [ + 0.16, + 0.54, + 0.46 + ], + "n_components": 104, + "n_mesh_parts": 104, + "n_joints": 6, + "joint_types": { + "prismatic": 3, + "revolute": 3 + }, + "n_state_slots": 27, + "n_capabilities": 26, + "n_capabilities_implemented": 19, + "n_mechanisms": 1, + "n_readouts": 0, + "n_interface_points": 11, + "n_sources": 9, + "n_limitations": 23, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t3_analytical/markes_unityxr/model.glb", + "urdf": "assets/expansion_batch03/t3_analytical/markes_unityxr/model.urdf", + "blend": "assets/expansion_batch03/t3_analytical/markes_unityxr/model.blend", + "contract": "assets/expansion_batch03/t3_analytical/markes_unityxr/asset.contract.json", + "runtime": "scripts/asset_runtime/markes_unityxr.py" + }, + "thumb": "media/thumb/markes_unityxr.webp", + "hero": "media/hero/markes_unityxr.webp" + }, + { + "id": "instrument.antonpaar_surpass3", + "slug": "antonpaar_surpass3", + "chem_id": "CHEM-113", + "name": "Solid-surface streaming-potential analyzer", + "maker": "Anton Paar", + "model": "SurPASS 3", + "title": "Anton Paar SurPASS 3", + "name_zh": "Anton Paar SurPASS 3 固体表面流动电位分析仪", + "domain": "particles", + "domain_name": "Particles, Pores & Interfaces", + "domain_zh": "颗粒孔隙与界面", + "path": "assets/expansion_batch03/t4_measure/antonpaar_surpass3", + "size_m": [ + 0.5365, + 0.605, + 0.3508 + ], + "n_components": 137, + "n_mesh_parts": 137, + "n_joints": 7, + "joint_types": { + "prismatic": 5, + "revolute": 2 + }, + "n_state_slots": 29, + "n_capabilities": 25, + "n_capabilities_implemented": 18, + "n_mechanisms": 1, + "n_readouts": 1, + "n_interface_points": 15, + "n_sources": 7, + "n_limitations": 27, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t4_measure/antonpaar_surpass3/model.glb", + "urdf": "assets/expansion_batch03/t4_measure/antonpaar_surpass3/model.urdf", + "blend": "assets/expansion_batch03/t4_measure/antonpaar_surpass3/model.blend", + "contract": "assets/expansion_batch03/t4_measure/antonpaar_surpass3/asset.contract.json", + "runtime": "scripts/asset_runtime/antonpaar_surpass3.py" + }, + "thumb": "media/thumb/antonpaar_surpass3.webp", + "hero": "media/hero/antonpaar_surpass3.webp" + }, + { + "id": "instrument.antonpaar_ultrapyc5000", + "slug": "antonpaar_ultrapyc5000", + "chem_id": "CHEM-114", + "name": "Gas pycnometer (true density)", + "maker": "Anton Paar", + "model": "Ultrapyc 5000", + "title": "Anton Paar Ultrapyc 5000", + "name_zh": "Anton Paar Ultrapyc 5000 气体置换真密度仪", + "domain": "particles", + "domain_name": "Particles, Pores & Interfaces", + "domain_zh": "颗粒孔隙与界面", + "path": "assets/expansion_batch03/t4_measure/antonpaar_ultrapyc5000", + "size_m": [ + 0.3988, + 0.4895, + 0.25 + ], + "n_components": 122, + "n_mesh_parts": 130, + "n_joints": 6, + "joint_types": { + "prismatic": 3, + "revolute": 3 + }, + "n_state_slots": 33, + "n_capabilities": 25, + "n_capabilities_implemented": 19, + "n_mechanisms": 1, + "n_readouts": 4, + "n_interface_points": 9, + "n_sources": 9, + "n_limitations": 20, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t4_measure/antonpaar_ultrapyc5000/model.glb", + "urdf": "assets/expansion_batch03/t4_measure/antonpaar_ultrapyc5000/model.urdf", + "blend": "assets/expansion_batch03/t4_measure/antonpaar_ultrapyc5000/model.blend", + "contract": "assets/expansion_batch03/t4_measure/antonpaar_ultrapyc5000/asset.contract.json", + "runtime": "scripts/asset_runtime/antonpaar_ultrapyc5000.py" + }, + "thumb": "media/thumb/antonpaar_ultrapyc5000.webp", + "hero": "media/hero/antonpaar_ultrapyc5000.webp" + }, + { + "id": "instrument.antonpaar_autosorb6100", + "slug": "antonpaar_autosorb6100", + "chem_id": "CHEM-115", + "name": "Gas physisorption surface-area & pore analyzer", + "maker": "Anton Paar", + "model": "Autosorb 6100", + "title": "Anton Paar Autosorb 6100", + "name_zh": "Anton Paar Autosorb 6100 气体物理吸附比表面积与孔径分析仪", + "domain": "particles", + "domain_name": "Particles, Pores & Interfaces", + "domain_zh": "颗粒孔隙与界面", + "path": "assets/expansion_batch03/t4_measure/antonpaar_autosorb6100", + "size_m": [ + 0.8056, + 0.712, + 1.079 + ], + "n_components": 178, + "n_mesh_parts": 178, + "n_joints": 8, + "joint_types": { + "prismatic": 6, + "revolute": 2 + }, + "n_state_slots": 49, + "n_capabilities": 33, + "n_capabilities_implemented": 26, + "n_mechanisms": 1, + "n_readouts": 1, + "n_interface_points": 23, + "n_sources": 7, + "n_limitations": 21, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t4_measure/antonpaar_autosorb6100/model.glb", + "urdf": "assets/expansion_batch03/t4_measure/antonpaar_autosorb6100/model.urdf", + "blend": "assets/expansion_batch03/t4_measure/antonpaar_autosorb6100/model.blend", + "contract": "assets/expansion_batch03/t4_measure/antonpaar_autosorb6100/asset.contract.json", + "runtime": "scripts/asset_runtime/antonpaar_autosorb6100.py" + }, + "thumb": "media/thumb/antonpaar_autosorb6100.webp", + "hero": "media/hero/antonpaar_autosorb6100.webp" + }, + { + "id": "instrument.antonpaar_poremaster60", + "slug": "antonpaar_poremaster60", + "chem_id": "CHEM-116", + "name": "Mercury intrusion porosimeter", + "maker": "Anton Paar", + "model": "PoreMaster 60", + "title": "Anton Paar PoreMaster 60", + "name_zh": "Anton Paar PoreMaster 60 标准型压汞孔隙率分析仪", + "domain": "particles", + "domain_name": "Particles, Pores & Interfaces", + "domain_zh": "颗粒孔隙与界面", + "path": "assets/expansion_batch03/t4_measure/antonpaar_poremaster60", + "size_m": [ + 0.5272, + 0.6665, + 0.7865 + ], + "n_components": 121, + "n_mesh_parts": 121, + "n_joints": 7, + "joint_types": { + "revolute": 3, + "prismatic": 4 + }, + "n_state_slots": 27, + "n_capabilities": 28, + "n_capabilities_implemented": 21, + "n_mechanisms": 1, + "n_readouts": 1, + "n_interface_points": 12, + "n_sources": 10, + "n_limitations": 29, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t4_measure/antonpaar_poremaster60/model.glb", + "urdf": "assets/expansion_batch03/t4_measure/antonpaar_poremaster60/model.urdf", + "blend": "assets/expansion_batch03/t4_measure/antonpaar_poremaster60/model.blend", + "contract": "assets/expansion_batch03/t4_measure/antonpaar_poremaster60/asset.contract.json", + "runtime": "scripts/asset_runtime/antonpaar_poremaster60.py" + }, + "thumb": "media/thumb/antonpaar_poremaster60.webp", + "hero": "media/hero/antonpaar_poremaster60.webp" + }, + { + "id": "instrument.antonpaar_litesizerdls", + "slug": "antonpaar_litesizerdls", + "chem_id": "CHEM-117", + "name": "DLS & zeta-potential analyzer", + "maker": "Anton Paar", + "model": "Litesizer DLS 701", + "title": "Anton Paar Litesizer DLS 701", + "name_zh": "Anton Paar Litesizer DLS 701 动态光散射与胶体电位仪", + "domain": "particles", + "domain_name": "Particles, Pores & Interfaces", + "domain_zh": "颗粒孔隙与界面", + "path": "assets/expansion_batch03/t4_measure/antonpaar_litesizerdls", + "size_m": [ + 0.452, + 0.5115, + 0.135 + ], + "n_components": 103, + "n_mesh_parts": 103, + "n_joints": 6, + "joint_types": { + "revolute": 2, + "prismatic": 4 + }, + "n_state_slots": 31, + "n_capabilities": 29, + "n_capabilities_implemented": 20, + "n_mechanisms": 1, + "n_readouts": 4, + "n_interface_points": 10, + "n_sources": 12, + "n_limitations": 28, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t4_measure/antonpaar_litesizerdls/model.glb", + "urdf": "assets/expansion_batch03/t4_measure/antonpaar_litesizerdls/model.urdf", + "blend": "assets/expansion_batch03/t4_measure/antonpaar_litesizerdls/model.blend", + "contract": "assets/expansion_batch03/t4_measure/antonpaar_litesizerdls/asset.contract.json", + "runtime": "scripts/asset_runtime/antonpaar_litesizerdls.py" + }, + "thumb": "media/thumb/antonpaar_litesizerdls.webp", + "hero": "media/hero/antonpaar_litesizerdls.webp" + }, + { + "id": "instrument.antonpaar_psa1190", + "slug": "antonpaar_psa1190", + "chem_id": "CHEM-118", + "name": "Laser-diffraction particle sizer", + "maker": "Anton Paar", + "model": "PSA 1190", + "title": "Anton Paar PSA 1190", + "name_zh": "Anton Paar PSA1190 L/D 激光衍射粒度仪", + "domain": "particles", + "domain_name": "Particles, Pores & Interfaces", + "domain_zh": "颗粒孔隙与界面", + "path": "assets/expansion_batch03/t4_measure/antonpaar_psa1190", + "size_m": [ + 0.895, + 0.547, + 0.4304 + ], + "n_components": 248, + "n_mesh_parts": 248, + "n_joints": 9, + "joint_types": { + "revolute": 7, + "prismatic": 2 + }, + "n_state_slots": 31, + "n_capabilities": 28, + "n_capabilities_implemented": 20, + "n_mechanisms": 1, + "n_readouts": 1, + "n_interface_points": 16, + "n_sources": 15, + "n_limitations": 30, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t4_measure/antonpaar_psa1190/model.glb", + "urdf": "assets/expansion_batch03/t4_measure/antonpaar_psa1190/model.urdf", + "blend": "assets/expansion_batch03/t4_measure/antonpaar_psa1190/model.blend", + "contract": "assets/expansion_batch03/t4_measure/antonpaar_psa1190/asset.contract.json", + "runtime": "scripts/asset_runtime/antonpaar_psa1190.py" + }, + "thumb": "media/thumb/antonpaar_psa1190.webp", + "hero": "media/hero/antonpaar_psa1190.webp" + }, + { + "id": "instrument.antonpaar_litesizerdia", + "slug": "antonpaar_litesizerdia", + "chem_id": "CHEM-119", + "name": "Dynamic image analyzer (particle shape)", + "maker": "Anton Paar", + "model": "Litesizer DIA 700", + "title": "Anton Paar Litesizer DIA 700", + "name_zh": "Anton Paar Litesizer DIA700 Liquid Flow 动态颗粒图像分析仪", + "domain": "particles", + "domain_name": "Particles, Pores & Interfaces", + "domain_zh": "颗粒孔隙与界面", + "path": "assets/expansion_batch03/t4_measure/antonpaar_litesizerdia", + "size_m": [ + 0.79, + 0.311, + 0.4 + ], + "n_components": 95, + "n_mesh_parts": 265, + "n_joints": 7, + "joint_types": { + "prismatic": 2, + "revolute": 5 + }, + "n_state_slots": 31, + "n_capabilities": 29, + "n_capabilities_implemented": 21, + "n_mechanisms": 1, + "n_readouts": 1, + "n_interface_points": 12, + "n_sources": 12, + "n_limitations": 30, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t4_measure/antonpaar_litesizerdia/model.glb", + "urdf": "assets/expansion_batch03/t4_measure/antonpaar_litesizerdia/model.urdf", + "blend": "assets/expansion_batch03/t4_measure/antonpaar_litesizerdia/model.blend", + "contract": "assets/expansion_batch03/t4_measure/antonpaar_litesizerdia/asset.contract.json", + "runtime": "scripts/asset_runtime/antonpaar_litesizerdia.py" + }, + "thumb": "media/thumb/antonpaar_litesizerdia.webp", + "hero": "media/hero/antonpaar_litesizerdia.webp" + }, + { + "id": "instrument.biolin_sigma700", + "slug": "biolin_sigma700", + "chem_id": "CHEM-120", + "name": "Force tensiometer", + "maker": "Biolin Scientific", + "model": "Sigma 700", + "title": "Biolin Scientific Sigma 700", + "name_zh": "Biolin Scientific Sigma700 力学式表面张力仪", + "domain": "particles", + "domain_name": "Particles, Pores & Interfaces", + "domain_zh": "颗粒孔隙与界面", + "path": "assets/expansion_batch03/t4_measure/biolin_sigma700", + "size_m": [ + 0.244, + 0.333, + 0.62 + ], + "n_components": 82, + "n_mesh_parts": 82, + "n_joints": 7, + "joint_types": { + "revolute": 3, + "prismatic": 4 + }, + "n_state_slots": 30, + "n_capabilities": 32, + "n_capabilities_implemented": 21, + "n_mechanisms": 1, + "n_readouts": 1, + "n_interface_points": 11, + "n_sources": 15, + "n_limitations": 27, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t4_measure/biolin_sigma700/model.glb", + "urdf": "assets/expansion_batch03/t4_measure/biolin_sigma700/model.urdf", + "blend": "assets/expansion_batch03/t4_measure/biolin_sigma700/model.blend", + "contract": "assets/expansion_batch03/t4_measure/biolin_sigma700/asset.contract.json", + "runtime": "scripts/asset_runtime/biolin_sigma700.py" + }, + "thumb": "media/thumb/biolin_sigma700.webp", + "hero": "media/hero/biolin_sigma700.webp" + }, + { + "id": "instrument.biolin_thetaflex", + "slug": "biolin_thetaflex", + "chem_id": "CHEM-121", + "name": "Optical contact-angle meter", + "maker": "Biolin Scientific", + "model": "Theta Flex", + "title": "Biolin Scientific Theta Flex", + "name_zh": "Biolin Scientific Theta Flex 光学接触角测量仪", + "domain": "particles", + "domain_name": "Particles, Pores & Interfaces", + "domain_zh": "颗粒孔隙与界面", + "path": "assets/expansion_batch03/t4_measure/biolin_thetaflex", + "size_m": [ + 0.7665, + 0.2515, + 0.559 + ], + "n_components": 111, + "n_mesh_parts": 111, + "n_joints": 8, + "joint_types": { + "prismatic": 7, + "revolute": 1 + }, + "n_state_slots": 33, + "n_capabilities": 35, + "n_capabilities_implemented": 24, + "n_mechanisms": 1, + "n_readouts": 1, + "n_interface_points": 10, + "n_sources": 15, + "n_limitations": 31, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t4_measure/biolin_thetaflex/model.glb", + "urdf": "assets/expansion_batch03/t4_measure/biolin_thetaflex/model.urdf", + "blend": "assets/expansion_batch03/t4_measure/biolin_thetaflex/model.blend", + "contract": "assets/expansion_batch03/t4_measure/biolin_thetaflex/asset.contract.json", + "runtime": "scripts/asset_runtime/biolin_thetaflex.py" + }, + "thumb": "media/thumb/biolin_thetaflex.webp", + "hero": "media/hero/biolin_thetaflex.webp" + }, + { + "id": "instrument.micromeritics_autochemiii", + "slug": "micromeritics_autochemiii", + "chem_id": "CHEM-122", + "name": "Temperature-programmed chemisorption analyzer", + "maker": "Micromeritics", + "model": "AutoChem III", + "title": "Micromeritics AutoChem III", + "name_zh": "Micromeritics AutoChem III 程序升温化学吸附仪", + "domain": "particles", + "domain_name": "Particles, Pores & Interfaces", + "domain_zh": "颗粒孔隙与界面", + "path": "assets/expansion_batch03/t4_measure/micromeritics_autochemiii", + "size_m": [ + 0.61, + 0.64, + 0.64 + ], + "n_components": 199, + "n_mesh_parts": 199, + "n_joints": 6, + "joint_types": { + "prismatic": 3, + "revolute": 3 + }, + "n_state_slots": 36, + "n_capabilities": 35, + "n_capabilities_implemented": 28, + "n_mechanisms": 1, + "n_readouts": 1, + "n_interface_points": 29, + "n_sources": 14, + "n_limitations": 36, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t4_measure/micromeritics_autochemiii/model.glb", + "urdf": "assets/expansion_batch03/t4_measure/micromeritics_autochemiii/model.urdf", + "blend": "assets/expansion_batch03/t4_measure/micromeritics_autochemiii/model.blend", + "contract": "assets/expansion_batch03/t4_measure/micromeritics_autochemiii/asset.contract.json", + "runtime": "scripts/asset_runtime/micromeritics_autochemiii.py" + }, + "thumb": "media/thumb/micromeritics_autochemiii.webp", + "hero": "media/hero/micromeritics_autochemiii.webp" + }, + { + "id": "instrument.surface_dvsresolution", + "slug": "surface_dvsresolution", + "chem_id": "CHEM-123", + "name": "Dynamic vapour sorption analyzer", + "maker": "Surface Measurement Systems", + "model": "DVS Resolution", + "title": "Surface Measurement Systems DVS Resolution", + "name_zh": "Surface Measurement Systems DVS Resolution 动态蒸气吸附仪(低质量天平)", + "domain": "particles", + "domain_name": "Particles, Pores & Interfaces", + "domain_zh": "颗粒孔隙与界面", + "path": "assets/expansion_batch03/t4_measure/surface_dvsresolution", + "size_m": [ + 0.52, + 0.61, + 0.98 + ], + "n_components": 211, + "n_mesh_parts": 211, + "n_joints": 6, + "joint_types": { + "revolute": 2, + "prismatic": 4 + }, + "n_state_slots": 40, + "n_capabilities": 37, + "n_capabilities_implemented": 29, + "n_mechanisms": 1, + "n_readouts": 4, + "n_interface_points": 11, + "n_sources": 12, + "n_limitations": 32, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t4_measure/surface_dvsresolution/model.glb", + "urdf": "assets/expansion_batch03/t4_measure/surface_dvsresolution/model.urdf", + "blend": "assets/expansion_batch03/t4_measure/surface_dvsresolution/model.blend", + "contract": "assets/expansion_batch03/t4_measure/surface_dvsresolution/asset.contract.json", + "runtime": "scripts/asset_runtime/surface_dvsresolution.py" + }, + "thumb": "media/thumb/surface_dvsresolution.webp", + "hero": "media/hero/surface_dvsresolution.webp" + }, + { + "id": "instrument.freeman_ft4powder", + "slug": "freeman_ft4powder", + "chem_id": "CHEM-124", + "name": "Powder rheometer", + "maker": "Freeman Technology / Micromeritics", + "model": "FT4 Powder Rheometer", + "title": "Freeman Technology / Micromeritics FT4 Powder Rheometer", + "name_zh": "Freeman Technology / Micromeritics FT4 Powder Rheometer 粉体流动性流变仪", + "domain": "particles", + "domain_name": "Particles, Pores & Interfaces", + "domain_zh": "颗粒孔隙与界面", + "path": "assets/expansion_batch03/t4_measure/freeman_ft4powder", + "size_m": [ + 0.48, + 0.306, + 0.76 + ], + "n_components": 143, + "n_mesh_parts": 143, + "n_joints": 6, + "joint_types": { + "prismatic": 4, + "revolute": 2 + }, + "n_state_slots": 39, + "n_capabilities": 33, + "n_capabilities_implemented": 25, + "n_mechanisms": 1, + "n_readouts": 1, + "n_interface_points": 8, + "n_sources": 12, + "n_limitations": 37, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t4_measure/freeman_ft4powder/model.glb", + "urdf": "assets/expansion_batch03/t4_measure/freeman_ft4powder/model.urdf", + "blend": "assets/expansion_batch03/t4_measure/freeman_ft4powder/model.blend", + "contract": "assets/expansion_batch03/t4_measure/freeman_ft4powder/asset.contract.json", + "runtime": "scripts/asset_runtime/freeman_ft4powder.py" + }, + "thumb": "media/thumb/freeman_ft4powder.webp", + "hero": "media/hero/freeman_ft4powder.webp" + }, + { + "id": "instrument.porometer_poroluxrevo", + "slug": "porometer_poroluxrevo", + "chem_id": "CHEM-125", + "name": "Capillary flow porometer", + "maker": "POROMETER", + "model": "POROLUX Revo", + "title": "POROMETER POROLUX Revo", + "name_zh": "POROMETER POROLUX Revo 毛细流动孔径仪", + "domain": "particles", + "domain_name": "Particles, Pores & Interfaces", + "domain_zh": "颗粒孔隙与界面", + "path": "assets/expansion_batch03/t4_measure/porometer_poroluxrevo", + "size_m": [ + 0.53, + 0.53, + 0.755 + ], + "n_components": 129, + "n_mesh_parts": 129, + "n_joints": 3, + "joint_types": { + "prismatic": 2, + "revolute": 1 + }, + "n_state_slots": 28, + "n_capabilities": 33, + "n_capabilities_implemented": 23, + "n_mechanisms": 1, + "n_readouts": 1, + "n_interface_points": 8, + "n_sources": 13, + "n_limitations": 43, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t4_measure/porometer_poroluxrevo/model.glb", + "urdf": "assets/expansion_batch03/t4_measure/porometer_poroluxrevo/model.urdf", + "blend": "assets/expansion_batch03/t4_measure/porometer_poroluxrevo/model.blend", + "contract": "assets/expansion_batch03/t4_measure/porometer_poroluxrevo/asset.contract.json", + "runtime": "scripts/asset_runtime/porometer_poroluxrevo.py" + }, + "thumb": "media/thumb/porometer_poroluxrevo.webp", + "hero": "media/hero/porometer_poroluxrevo.webp" + }, + { + "id": "instrument.microtrac_turbiscanlab", + "slug": "microtrac_turbiscanlab", + "chem_id": "CHEM-126", + "name": "Dispersion stability analyzer", + "maker": "Microtrac", + "model": "TURBISCAN LAB", + "title": "Microtrac TURBISCAN LAB", + "name_zh": "Microtrac TURBISCAN LAB 分散体系稳定性分析仪", + "domain": "particles", + "domain_name": "Particles, Pores & Interfaces", + "domain_zh": "颗粒孔隙与界面", + "path": "assets/expansion_batch03/t4_measure/microtrac_turbiscanlab", + "size_m": [ + 0.26, + 0.28, + 0.25 + ], + "n_components": 118, + "n_mesh_parts": 118, + "n_joints": 5, + "joint_types": { + "prismatic": 4, + "revolute": 1 + }, + "n_state_slots": 28, + "n_capabilities": 27, + "n_capabilities_implemented": 19, + "n_mechanisms": 1, + "n_readouts": 3, + "n_interface_points": 6, + "n_sources": 19, + "n_limitations": 45, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t4_measure/microtrac_turbiscanlab/model.glb", + "urdf": "assets/expansion_batch03/t4_measure/microtrac_turbiscanlab/model.urdf", + "blend": "assets/expansion_batch03/t4_measure/microtrac_turbiscanlab/model.blend", + "contract": "assets/expansion_batch03/t4_measure/microtrac_turbiscanlab/asset.contract.json", + "runtime": "scripts/asset_runtime/microtrac_turbiscanlab.py" + }, + "thumb": "media/thumb/microtrac_turbiscanlab.webp", + "hero": "media/hero/microtrac_turbiscanlab.webp" + }, + { + "id": "instrument.biolin_mediuml", + "slug": "biolin_mediuml", + "chem_id": "CHEM-127", + "name": "Langmuir / Langmuir–Blodgett trough", + "maker": "Biolin Scientific KSV NIMA", + "model": "Medium L&LB Trough", + "title": "Biolin Scientific KSV NIMA Medium L&LB Trough", + "name_zh": "KSV NIMA Medium L&LB Langmuir 单分子膜槽", + "domain": "particles", + "domain_name": "Particles, Pores & Interfaces", + "domain_zh": "颗粒孔隙与界面", + "path": "assets/expansion_batch03/t4_measure/biolin_mediuml", + "size_m": [ + 0.662, + 0.308, + 0.455 + ], + "n_components": 124, + "n_mesh_parts": 124, + "n_joints": 7, + "joint_types": { + "prismatic": 6, + "revolute": 1 + }, + "n_state_slots": 36, + "n_capabilities": 34, + "n_capabilities_implemented": 25, + "n_mechanisms": 1, + "n_readouts": 2, + "n_interface_points": 8, + "n_sources": 15, + "n_limitations": 44, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t4_measure/biolin_mediuml/model.glb", + "urdf": "assets/expansion_batch03/t4_measure/biolin_mediuml/model.urdf", + "blend": "assets/expansion_batch03/t4_measure/biolin_mediuml/model.blend", + "contract": "assets/expansion_batch03/t4_measure/biolin_mediuml/asset.contract.json", + "runtime": "scripts/asset_runtime/biolin_mediuml.py" + }, + "thumb": "media/thumb/biolin_mediuml.webp", + "hero": "media/hero/biolin_mediuml.webp" + }, + { + "id": "instrument.antonpaar_trb", + "slug": "antonpaar_trb", + "chem_id": "CHEM-128", + "name": "Pin-on-disk tribometer", + "maker": "Anton Paar", + "model": "TRB³", + "title": "Anton Paar TRB³", + "name_zh": "Anton Paar TRB³ 销盘摩擦磨损试验机", + "domain": "thermal", + "domain_name": "Thermal, Mechanical & Transport", + "domain_zh": "热学力学与输运", + "path": "assets/expansion_batch04/t1_thermal/antonpaar_trb", + "size_m": [ + 0.532, + 0.443, + 0.501 + ], + "n_components": 155, + "n_mesh_parts": 251, + "n_joints": 6, + "joint_types": { + "revolute": 4, + "prismatic": 2 + }, + "n_state_slots": 42, + "n_capabilities": 39, + "n_capabilities_implemented": 29, + "n_mechanisms": 1, + "n_readouts": 0, + "n_interface_points": 7, + "n_sources": 13, + "n_limitations": 43, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t1_thermal/antonpaar_trb/model.glb", + "urdf": "assets/expansion_batch04/t1_thermal/antonpaar_trb/model.urdf", + "blend": "assets/expansion_batch04/t1_thermal/antonpaar_trb/model.blend", + "contract": "assets/expansion_batch04/t1_thermal/antonpaar_trb/asset.contract.json", + "runtime": "scripts/asset_runtime/antonpaar_trb.py" + }, + "thumb": "media/thumb/antonpaar_trb.webp", + "hero": "media/hero/antonpaar_trb.webp" + }, + { + "id": "instrument.antonpaar_rst300", + "slug": "antonpaar_rst300", + "chem_id": "CHEM-129", + "name": "Coating scratch tester", + "maker": "Anton Paar", + "model": "RST 300", + "title": "Anton Paar RST 300", + "name_zh": "Anton Paar RST 300 涂层划痕附着力试验机", + "domain": "thermal", + "domain_name": "Thermal, Mechanical & Transport", + "domain_zh": "热学力学与输运", + "path": "assets/expansion_batch04/t1_thermal/antonpaar_rst300", + "size_m": [ + 0.364, + 0.369, + 0.5425 + ], + "n_components": 168, + "n_mesh_parts": 168, + "n_joints": 6, + "joint_types": { + "prismatic": 5, + "revolute": 1 + }, + "n_state_slots": 42, + "n_capabilities": 38, + "n_capabilities_implemented": 25, + "n_mechanisms": 1, + "n_readouts": 0, + "n_interface_points": 6, + "n_sources": 13, + "n_limitations": 34, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t1_thermal/antonpaar_rst300/model.glb", + "urdf": "assets/expansion_batch04/t1_thermal/antonpaar_rst300/model.urdf", + "blend": "assets/expansion_batch04/t1_thermal/antonpaar_rst300/model.blend", + "contract": "assets/expansion_batch04/t1_thermal/antonpaar_rst300/asset.contract.json", + "runtime": "scripts/asset_runtime/antonpaar_rst300.py" + }, + "thumb": "media/thumb/antonpaar_rst300.webp", + "hero": "media/hero/antonpaar_rst300.webp" + }, + { + "id": "instrument.antonpaar_hit300", + "slug": "antonpaar_hit300", + "chem_id": "CHEM-130", + "name": "Nanoindentation tester", + "maker": "Anton Paar", + "model": "HIT 300", + "title": "Anton Paar HIT 300", + "name_zh": "Anton Paar HIT 300 纳米压痕仪", + "domain": "thermal", + "domain_name": "Thermal, Mechanical & Transport", + "domain_zh": "热学力学与输运", + "path": "assets/expansion_batch04/t1_thermal/antonpaar_hit300", + "size_m": [ + 0.269, + 0.259, + 0.42 + ], + "n_components": 156, + "n_mesh_parts": 156, + "n_joints": 6, + "joint_types": { + "prismatic": 5, + "revolute": 1 + }, + "n_state_slots": 38, + "n_capabilities": 33, + "n_capabilities_implemented": 22, + "n_mechanisms": 1, + "n_readouts": 2, + "n_interface_points": 7, + "n_sources": 17, + "n_limitations": 35, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t1_thermal/antonpaar_hit300/model.glb", + "urdf": "assets/expansion_batch04/t1_thermal/antonpaar_hit300/model.urdf", + "blend": "assets/expansion_batch04/t1_thermal/antonpaar_hit300/model.blend", + "contract": "assets/expansion_batch04/t1_thermal/antonpaar_hit300/asset.contract.json", + "runtime": "scripts/asset_runtime/antonpaar_hit300.py" + }, + "thumb": "media/thumb/antonpaar_hit300.webp", + "hero": "media/hero/antonpaar_hit300.webp" + }, + { + "id": "instrument.ta_dsc2500", + "slug": "ta_dsc2500", + "chem_id": "CHEM-131", + "name": "Differential scanning calorimeter", + "maker": "TA Instruments", + "model": "DSC 2500", + "title": "TA Instruments DSC 2500", + "name_zh": "TA Instruments DSC 2500 差示扫描量热仪", + "domain": "thermal", + "domain_name": "Thermal, Mechanical & Transport", + "domain_zh": "热学力学与输运", + "path": "assets/expansion_batch03/t1_thermal/ta_dsc2500", + "size_m": [ + 0.53, + 0.51, + 0.61 + ], + "n_components": 307, + "n_mesh_parts": 307, + "n_joints": 5, + "joint_types": { + "prismatic": 4, + "revolute": 1 + }, + "n_state_slots": 43, + "n_capabilities": 36, + "n_capabilities_implemented": 25, + "n_mechanisms": 1, + "n_readouts": 1, + "n_interface_points": 13, + "n_sources": 89, + "n_limitations": 34, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t1_thermal/ta_dsc2500/model.glb", + "urdf": "assets/expansion_batch03/t1_thermal/ta_dsc2500/model.urdf", + "blend": "assets/expansion_batch03/t1_thermal/ta_dsc2500/model.blend", + "contract": "assets/expansion_batch03/t1_thermal/ta_dsc2500/asset.contract.json", + "runtime": "scripts/asset_runtime/ta_dsc2500.py" + }, + "thumb": "media/thumb/ta_dsc2500.webp", + "hero": "media/hero/ta_dsc2500.webp" + }, + { + "id": "instrument.ta_tga5500", + "slug": "ta_tga5500", + "chem_id": "CHEM-132", + "name": "Thermogravimetric analyzer", + "maker": "TA Instruments", + "model": "TGA 5500", + "title": "TA Instruments TGA 5500", + "name_zh": "TA Instruments TGA 5500 热重分析仪", + "domain": "thermal", + "domain_name": "Thermal, Mechanical & Transport", + "domain_zh": "热学力学与输运", + "path": "assets/expansion_batch03/t1_thermal/ta_tga5500", + "size_m": [ + 0.56, + 0.56, + 0.61 + ], + "n_components": 186, + "n_mesh_parts": 186, + "n_joints": 4, + "joint_types": { + "prismatic": 2, + "revolute": 2 + }, + "n_state_slots": 48, + "n_capabilities": 40, + "n_capabilities_implemented": 28, + "n_mechanisms": 1, + "n_readouts": 2, + "n_interface_points": 13, + "n_sources": 10, + "n_limitations": 36, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t1_thermal/ta_tga5500/model.glb", + "urdf": "assets/expansion_batch03/t1_thermal/ta_tga5500/model.urdf", + "blend": "assets/expansion_batch03/t1_thermal/ta_tga5500/model.blend", + "contract": "assets/expansion_batch03/t1_thermal/ta_tga5500/asset.contract.json", + "runtime": "scripts/asset_runtime/ta_tga5500.py" + }, + "thumb": "media/thumb/ta_tga5500.webp", + "hero": "media/hero/ta_tga5500.webp" + }, + { + "id": "instrument.ta_dma850", + "slug": "ta_dma850", + "chem_id": "CHEM-133", + "name": "Dynamic mechanical analyzer", + "maker": "TA Instruments", + "model": "DMA 850", + "title": "TA Instruments DMA 850", + "name_zh": "TA Instruments DMA 850 动态机械分析仪", + "domain": "thermal", + "domain_name": "Thermal, Mechanical & Transport", + "domain_zh": "热学力学与输运", + "path": "assets/expansion_batch04/t1_thermal/ta_dma850", + "size_m": [ + 0.64, + 0.47, + 0.535 + ], + "n_components": 121, + "n_mesh_parts": 121, + "n_joints": 5, + "joint_types": { + "prismatic": 4, + "revolute": 1 + }, + "n_state_slots": 43, + "n_capabilities": 41, + "n_capabilities_implemented": 29, + "n_mechanisms": 1, + "n_readouts": 2, + "n_interface_points": 10, + "n_sources": 22, + "n_limitations": 27, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t1_thermal/ta_dma850/model.glb", + "urdf": "assets/expansion_batch04/t1_thermal/ta_dma850/model.urdf", + "blend": "assets/expansion_batch04/t1_thermal/ta_dma850/model.blend", + "contract": "assets/expansion_batch04/t1_thermal/ta_dma850/asset.contract.json", + "runtime": "scripts/asset_runtime/ta_dma850.py" + }, + "thumb": "media/thumb/ta_dma850.webp", + "hero": "media/hero/ta_dma850.webp" + }, + { + "id": "instrument.ta_tma450", + "slug": "ta_tma450", + "chem_id": "CHEM-134", + "name": "Thermomechanical analyzer", + "maker": "TA Instruments", + "model": "TMA 450", + "title": "TA Instruments TMA 450", + "name_zh": "TA Instruments TMA 450 热机械分析仪", + "domain": "thermal", + "domain_name": "Thermal, Mechanical & Transport", + "domain_zh": "热学力学与输运", + "path": "assets/expansion_batch04/t1_thermal/ta_tma450", + "size_m": [ + 0.56, + 0.56, + 0.63 + ], + "n_components": 107, + "n_mesh_parts": 107, + "n_joints": 3, + "joint_types": { + "prismatic": 2, + "revolute": 1 + }, + "n_state_slots": 50, + "n_capabilities": 47, + "n_capabilities_implemented": 33, + "n_mechanisms": 1, + "n_readouts": 2, + "n_interface_points": 10, + "n_sources": 13, + "n_limitations": 42, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t1_thermal/ta_tma450/model.glb", + "urdf": "assets/expansion_batch04/t1_thermal/ta_tma450/model.urdf", + "blend": "assets/expansion_batch04/t1_thermal/ta_tma450/model.blend", + "contract": "assets/expansion_batch04/t1_thermal/ta_tma450/asset.contract.json", + "runtime": "scripts/asset_runtime/ta_tma450.py" + }, + "thumb": "media/thumb/ta_tma450.webp", + "hero": "media/hero/ta_tma450.webp" + }, + { + "id": "instrument.netzsch_lfa467", + "slug": "netzsch_lfa467", + "chem_id": "CHEM-135", + "name": "Laser/light flash thermal diffusivity analyzer", + "maker": "NETZSCH", + "model": "LFA 467 HyperFlash", + "title": "NETZSCH LFA 467 HyperFlash", + "name_zh": "NETZSCH LFA467 HyperFlash 闪光法热扩散仪", + "domain": "thermal", + "domain_name": "Thermal, Mechanical & Transport", + "domain_zh": "热学力学与输运", + "path": "assets/expansion_batch04/t1_thermal/netzsch_lfa467", + "size_m": [ + 0.54, + 0.52, + 0.61 + ], + "n_components": 133, + "n_mesh_parts": 133, + "n_joints": 4, + "joint_types": { + "prismatic": 3, + "revolute": 1 + }, + "n_state_slots": 54, + "n_capabilities": 47, + "n_capabilities_implemented": 31, + "n_mechanisms": 1, + "n_readouts": 6, + "n_interface_points": 14, + "n_sources": 20, + "n_limitations": 40, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t1_thermal/netzsch_lfa467/model.glb", + "urdf": "assets/expansion_batch04/t1_thermal/netzsch_lfa467/model.urdf", + "blend": "assets/expansion_batch04/t1_thermal/netzsch_lfa467/model.blend", + "contract": "assets/expansion_batch04/t1_thermal/netzsch_lfa467/asset.contract.json", + "runtime": "scripts/asset_runtime/netzsch_lfa467.py" + }, + "thumb": "media/thumb/netzsch_lfa467.webp", + "hero": "media/hero/netzsch_lfa467.webp" + }, + { + "id": "instrument.hot_tps2500", + "slug": "hot_tps2500", + "chem_id": "CHEM-136", + "name": "Transient plane source thermal-conductivity analyzer", + "maker": "Hot Disk", + "model": "TPS 2500 S", + "title": "Hot Disk TPS 2500 S", + "name_zh": "Hot Disk TPS 2500 S 瞬态平面热源导热仪", + "domain": "thermal", + "domain_name": "Thermal, Mechanical & Transport", + "domain_zh": "热学力学与输运", + "path": "assets/expansion_batch04/t1_thermal/hot_tps2500", + "size_m": [ + 0.6975, + 0.5663, + 0.325 + ], + "n_components": 47, + "n_mesh_parts": 47, + "n_joints": 4, + "joint_types": { + "revolute": 2, + "prismatic": 2 + }, + "n_state_slots": 25, + "n_capabilities": 25, + "n_capabilities_implemented": 16, + "n_mechanisms": 1, + "n_readouts": 1, + "n_interface_points": 6, + "n_sources": 13, + "n_limitations": 28, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t1_thermal/hot_tps2500/model.glb", + "urdf": "assets/expansion_batch04/t1_thermal/hot_tps2500/model.urdf", + "blend": "assets/expansion_batch04/t1_thermal/hot_tps2500/model.blend", + "contract": "assets/expansion_batch04/t1_thermal/hot_tps2500/asset.contract.json", + "runtime": "scripts/asset_runtime/hot_tps2500.py" + }, + "thumb": "media/thumb/hot_tps2500.webp", + "hero": "media/hero/hot_tps2500.webp" + }, + { + "id": "instrument.antonpaar_mcr503", + "slug": "antonpaar_mcr503", + "chem_id": "CHEM-137", + "name": "Rotational & oscillatory rheometer", + "maker": "Anton Paar", + "model": "MCR 503", + "title": "Anton Paar MCR 503", + "name_zh": "Anton Paar MCR 503 旋转与振荡流变仪", + "domain": "thermal", + "domain_name": "Thermal, Mechanical & Transport", + "domain_zh": "热学力学与输运", + "path": "assets/expansion_batch04/t1_thermal/antonpaar_mcr503", + "size_m": [ + 0.453, + 0.673, + 0.775 + ], + "n_components": 51, + "n_mesh_parts": 51, + "n_joints": 3, + "joint_types": { + "prismatic": 1, + "continuous": 1, + "revolute": 1 + }, + "n_state_slots": 26, + "n_capabilities": 28, + "n_capabilities_implemented": 18, + "n_mechanisms": 1, + "n_readouts": 1, + "n_interface_points": 8, + "n_sources": 8, + "n_limitations": 32, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t1_thermal/antonpaar_mcr503/model.glb", + "urdf": "assets/expansion_batch04/t1_thermal/antonpaar_mcr503/model.urdf", + "blend": "assets/expansion_batch04/t1_thermal/antonpaar_mcr503/model.blend", + "contract": "assets/expansion_batch04/t1_thermal/antonpaar_mcr503/asset.contract.json", + "runtime": "scripts/asset_runtime/antonpaar_mcr503.py" + }, + "thumb": "media/thumb/antonpaar_mcr503.webp", + "hero": "media/hero/antonpaar_mcr503.webp" + }, + { + "id": "instrument.ta_tamiv", + "slug": "ta_tamiv", + "chem_id": "CHEM-138", + "name": "Isothermal microcalorimeter", + "maker": "TA Instruments", + "model": "TAM IV", + "title": "TA Instruments TAM IV", + "name_zh": "TA Instruments TAM IV 20 mL 等温微量热仪", + "domain": "thermal", + "domain_name": "Thermal, Mechanical & Transport", + "domain_zh": "热学力学与输运", + "path": "assets/expansion_batch04/t1_thermal/ta_tamiv", + "size_m": [ + 0.58, + 0.76, + 1.0 + ], + "n_components": 52, + "n_mesh_parts": 52, + "n_joints": 2, + "joint_types": { + "prismatic": 1, + "revolute": 1 + }, + "n_state_slots": 25, + "n_capabilities": 31, + "n_capabilities_implemented": 22, + "n_mechanisms": 1, + "n_readouts": 0, + "n_interface_points": 8, + "n_sources": 10, + "n_limitations": 36, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t1_thermal/ta_tamiv/model.glb", + "urdf": "assets/expansion_batch04/t1_thermal/ta_tamiv/model.urdf", + "blend": "assets/expansion_batch04/t1_thermal/ta_tamiv/model.blend", + "contract": "assets/expansion_batch04/t1_thermal/ta_tamiv/asset.contract.json", + "runtime": "scripts/asset_runtime/ta_tamiv.py" + }, + "thumb": "media/thumb/ta_tamiv.webp", + "hero": "media/hero/ta_tamiv.webp" + }, + { + "id": "instrument.linseis_lsr3", + "slug": "linseis_lsr3", + "chem_id": "CHEM-139", + "name": "Thermoelectric (Seebeck) tester", + "maker": "Linseis", + "model": "LSR-3", + "title": "Linseis LSR-3", + "name_zh": "Linseis LSR-3 红外炉800°C热电性能测试仪", + "domain": "thermal", + "domain_name": "Thermal, Mechanical & Transport", + "domain_zh": "热学力学与输运", + "path": "assets/expansion_batch04/t1_thermal/linseis_lsr3", + "size_m": [ + 0.7204, + 0.4278, + 0.53 + ], + "n_components": 57, + "n_mesh_parts": 57, + "n_joints": 5, + "joint_types": { + "prismatic": 3, + "revolute": 2 + }, + "n_state_slots": 32, + "n_capabilities": 31, + "n_capabilities_implemented": 22, + "n_mechanisms": 1, + "n_readouts": 2, + "n_interface_points": 12, + "n_sources": 11, + "n_limitations": 44, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t1_thermal/linseis_lsr3/model.glb", + "urdf": "assets/expansion_batch04/t1_thermal/linseis_lsr3/model.urdf", + "blend": "assets/expansion_batch04/t1_thermal/linseis_lsr3/model.blend", + "contract": "assets/expansion_batch04/t1_thermal/linseis_lsr3/asset.contract.json", + "runtime": "scripts/asset_runtime/linseis_lsr3.py" + }, + "thumb": "media/thumb/linseis_lsr3.webp", + "hero": "media/hero/linseis_lsr3.webp" + }, + { + "id": "instrument.novocontrol_alphat", + "slug": "novocontrol_alphat", + "chem_id": "CHEM-140", + "name": "Broadband dielectric spectrometer", + "maker": "Novocontrol Technologies", + "model": "Alpha-T", + "title": "Novocontrol Technologies Alpha-T", + "name_zh": "Novocontrol Alpha-T Rev C 宽频介电谱仪(含电流转换接口)", + "domain": "thermal", + "domain_name": "Thermal, Mechanical & Transport", + "domain_zh": "热学力学与输运", + "path": "assets/expansion_batch04/t1_thermal/novocontrol_alphat", + "size_m": [ + 0.6815, + 0.364, + 0.205 + ], + "n_components": 48, + "n_mesh_parts": 48, + "n_joints": 3, + "joint_types": { + "revolute": 2, + "prismatic": 1 + }, + "n_state_slots": 27, + "n_capabilities": 30, + "n_capabilities_implemented": 21, + "n_mechanisms": 1, + "n_readouts": 0, + "n_interface_points": 12, + "n_sources": 13, + "n_limitations": 48, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t1_thermal/novocontrol_alphat/model.glb", + "urdf": "assets/expansion_batch04/t1_thermal/novocontrol_alphat/model.urdf", + "blend": "assets/expansion_batch04/t1_thermal/novocontrol_alphat/model.blend", + "contract": "assets/expansion_batch04/t1_thermal/novocontrol_alphat/asset.contract.json", + "runtime": "scripts/asset_runtime/novocontrol_alphat.py" + }, + "thumb": "media/thumb/novocontrol_alphat.webp", + "hero": "media/hero/novocontrol_alphat.webp" + }, + { + "id": "instrument.lakeshore_measurereadym91", + "slug": "lakeshore_measurereadym91", + "chem_id": "CHEM-141", + "name": "Hall-effect measurement system", + "maker": "Lake Shore Cryotronics", + "model": "MeasureReady M91 FastHall", + "title": "Lake Shore Cryotronics MeasureReady M91 FastHall", + "name_zh": "Lake Shore MeasureReady M91 FastHall 霍尔测量控制器", + "domain": "thermal", + "domain_name": "Thermal, Mechanical & Transport", + "domain_zh": "热学力学与输运", + "path": "assets/expansion_batch04/t1_thermal/lakeshore_measurereadym91", + "size_m": [ + 0.343, + 0.369, + 0.087 + ], + "n_components": 64, + "n_mesh_parts": 64, + "n_joints": 4, + "joint_types": { + "revolute": 1, + "prismatic": 3 + }, + "n_state_slots": 36, + "n_capabilities": 31, + "n_capabilities_implemented": 23, + "n_mechanisms": 1, + "n_readouts": 1, + "n_interface_points": 17, + "n_sources": 11, + "n_limitations": 57, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t1_thermal/lakeshore_measurereadym91/model.glb", + "urdf": "assets/expansion_batch04/t1_thermal/lakeshore_measurereadym91/model.urdf", + "blend": "assets/expansion_batch04/t1_thermal/lakeshore_measurereadym91/model.blend", + "contract": "assets/expansion_batch04/t1_thermal/lakeshore_measurereadym91/asset.contract.json", + "runtime": "scripts/asset_runtime/lakeshore_measurereadym91.py" + }, + "thumb": "media/thumb/lakeshore_measurereadym91.webp", + "hero": "media/hero/lakeshore_measurereadym91.webp" + }, + { + "id": "instrument.signatone_quadpro2", + "slug": "signatone_quadpro2", + "chem_id": "CHEM-142", + "name": "Automated four-point-probe sheet-resistance mapper", + "maker": "Signatone", + "model": "QuadPro2", + "title": "Signatone QuadPro2", + "name_zh": "Signatone QuadPro2-DAC0 自动四探针面电阻测绘系统", + "domain": "thermal", + "domain_name": "Thermal, Mechanical & Transport", + "domain_zh": "热学力学与输运", + "path": "assets/expansion_batch04/t1_thermal/signatone_quadpro2", + "size_m": [ + 0.572, + 0.978, + 1.676 + ], + "n_components": 99, + "n_mesh_parts": 100, + "n_joints": 5, + "joint_types": { + "revolute": 2, + "prismatic": 3 + }, + "n_state_slots": 34, + "n_capabilities": 29, + "n_capabilities_implemented": 21, + "n_mechanisms": 1, + "n_readouts": 2, + "n_interface_points": 16, + "n_sources": 13, + "n_limitations": 58, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t1_thermal/signatone_quadpro2/model.glb", + "urdf": "assets/expansion_batch04/t1_thermal/signatone_quadpro2/model.urdf", + "blend": "assets/expansion_batch04/t1_thermal/signatone_quadpro2/model.blend", + "contract": "assets/expansion_batch04/t1_thermal/signatone_quadpro2/asset.contract.json", + "runtime": "scripts/asset_runtime/signatone_quadpro2.py" + }, + "thumb": "media/thumb/signatone_quadpro2.webp", + "hero": "media/hero/signatone_quadpro2.webp" + }, + { + "id": "instrument.lakeshore_8604vsm", + "slug": "lakeshore_8604vsm", + "chem_id": "CHEM-143", + "name": "Vibrating sample magnetometer", + "maker": "Lake Shore Cryotronics", + "model": "8604 VSM", + "title": "Lake Shore Cryotronics 8604 VSM", + "name_zh": "Lake Shore 8604 振动样品磁强计", + "domain": "thermal", + "domain_name": "Thermal, Mechanical & Transport", + "domain_zh": "热学力学与输运", + "path": "assets/expansion_batch04/t1_thermal/lakeshore_8604vsm", + "size_m": [ + 2.175, + 1.04, + 1.6 + ], + "n_components": 106, + "n_mesh_parts": 106, + "n_joints": 5, + "joint_types": { + "prismatic": 3, + "revolute": 1, + "continuous": 1 + }, + "n_state_slots": 34, + "n_capabilities": 32, + "n_capabilities_implemented": 24, + "n_mechanisms": 1, + "n_readouts": 2, + "n_interface_points": 14, + "n_sources": 14, + "n_limitations": 53, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t1_thermal/lakeshore_8604vsm/model.glb", + "urdf": "assets/expansion_batch04/t1_thermal/lakeshore_8604vsm/model.urdf", + "blend": "assets/expansion_batch04/t1_thermal/lakeshore_8604vsm/model.blend", + "contract": "assets/expansion_batch04/t1_thermal/lakeshore_8604vsm/asset.contract.json", + "runtime": "scripts/asset_runtime/lakeshore_8604vsm.py" + }, + "thumb": "media/thumb/lakeshore_8604vsm.webp", + "hero": "media/hero/lakeshore_8604vsm.webp" + }, + { + "id": "instrument.shimadzu_ags10knxd", + "slug": "shimadzu_ags10knxd", + "chem_id": "CHEM-144", + "name": "Universal testing machine", + "maker": "Shimadzu", + "model": "AGS-10kNXD", + "title": "Shimadzu AGS-10kNXD", + "name_zh": "Shimadzu AGS-10kNXD 万能材料试验机", + "domain": "thermal", + "domain_name": "Thermal, Mechanical & Transport", + "domain_zh": "热学力学与输运", + "path": "assets/expansion_batch04/t1_thermal/shimadzu_ags10knxd", + "size_m": [ + 0.653, + 0.52, + 1.603 + ], + "n_components": 85, + "n_mesh_parts": 85, + "n_joints": 6, + "joint_types": { + "prismatic": 5, + "revolute": 1 + }, + "n_state_slots": 35, + "n_capabilities": 28, + "n_capabilities_implemented": 19, + "n_mechanisms": 1, + "n_readouts": 2, + "n_interface_points": 14, + "n_sources": 12, + "n_limitations": 49, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t1_thermal/shimadzu_ags10knxd/model.glb", + "urdf": "assets/expansion_batch04/t1_thermal/shimadzu_ags10knxd/model.urdf", + "blend": "assets/expansion_batch04/t1_thermal/shimadzu_ags10knxd/model.blend", + "contract": "assets/expansion_batch04/t1_thermal/shimadzu_ags10knxd/asset.contract.json", + "runtime": "scripts/asset_runtime/shimadzu_ags10knxd.py" + }, + "thumb": "media/thumb/shimadzu_ags10knxd.webp", + "hero": "media/hero/shimadzu_ags10knxd.webp" + }, + { + "id": "instrument.zwick_hit5p", + "slug": "zwick_hit5p", + "chem_id": "CHEM-145", + "name": "Pendulum impact tester", + "maker": "ZwickRoell", + "model": "HIT5P", + "title": "ZwickRoell HIT5P", + "name_zh": "ZwickRoell HIT5P 摆锤冲击试验机", + "domain": "thermal", + "domain_name": "Thermal, Mechanical & Transport", + "domain_zh": "热学力学与输运", + "path": "assets/expansion_batch04/t1_thermal/zwick_hit5p", + "size_m": [ + 0.68, + 0.429, + 0.684 + ], + "n_components": 73, + "n_mesh_parts": 73, + "n_joints": 4, + "joint_types": { + "revolute": 3, + "prismatic": 1 + }, + "n_state_slots": 31, + "n_capabilities": 27, + "n_capabilities_implemented": 18, + "n_mechanisms": 1, + "n_readouts": 2, + "n_interface_points": 13, + "n_sources": 12, + "n_limitations": 49, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t1_thermal/zwick_hit5p/model.glb", + "urdf": "assets/expansion_batch04/t1_thermal/zwick_hit5p/model.urdf", + "blend": "assets/expansion_batch04/t1_thermal/zwick_hit5p/model.blend", + "contract": "assets/expansion_batch04/t1_thermal/zwick_hit5p/asset.contract.json", + "runtime": "scripts/asset_runtime/zwick_hit5p.py" + }, + "thumb": "media/thumb/zwick_hit5p.webp", + "hero": "media/hero/zwick_hit5p.webp" + }, + { + "id": "instrument.zwick_mflow", + "slug": "zwick_mflow", + "chem_id": "CHEM-146", + "name": "Melt flow indexer", + "maker": "ZwickRoell", + "model": "Mflow", + "title": "ZwickRoell Mflow", + "name_zh": "ZwickRoell Mflow 熔体流动速率仪", + "domain": "thermal", + "domain_name": "Thermal, Mechanical & Transport", + "domain_zh": "热学力学与输运", + "path": "assets/expansion_batch04/t1_thermal/zwick_mflow", + "size_m": [ + 0.479, + 0.524, + 0.548 + ], + "n_components": 63, + "n_mesh_parts": 63, + "n_joints": 9, + "joint_types": { + "revolute": 3, + "prismatic": 6 + }, + "n_state_slots": 43, + "n_capabilities": 36, + "n_capabilities_implemented": 22, + "n_mechanisms": 1, + "n_readouts": 3, + "n_interface_points": 14, + "n_sources": 12, + "n_limitations": 51, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t1_thermal/zwick_mflow/model.glb", + "urdf": "assets/expansion_batch04/t1_thermal/zwick_mflow/model.urdf", + "blend": "assets/expansion_batch04/t1_thermal/zwick_mflow/model.blend", + "contract": "assets/expansion_batch04/t1_thermal/zwick_mflow/asset.contract.json", + "runtime": "scripts/asset_runtime/zwick_mflow.py" + }, + "thumb": "media/thumb/zwick_mflow.webp", + "hero": "media/hero/zwick_mflow.webp" + }, + { + "id": "instrument.ametek_oxtran", + "slug": "ametek_oxtran", + "chem_id": "CHEM-147", + "name": "Oxygen transmission-rate analyzer", + "maker": "AMETEK MOCON", + "model": "OX-TRAN 2/22 L", + "title": "AMETEK MOCON OX-TRAN 2/22 L", + "name_zh": "AMETEK MOCON OX-TRAN 2/22 L 氧气透过率分析仪", + "domain": "thermal", + "domain_name": "Thermal, Mechanical & Transport", + "domain_zh": "热学力学与输运", + "path": "assets/expansion_batch04/t1_thermal/ametek_oxtran", + "size_m": [ + 0.3046, + 0.6149, + 0.5008 + ], + "n_components": 75, + "n_mesh_parts": 75, + "n_joints": 8, + "joint_types": { + "prismatic": 6, + "revolute": 2 + }, + "n_state_slots": 55, + "n_capabilities": 31, + "n_capabilities_implemented": 18, + "n_mechanisms": 1, + "n_readouts": 5, + "n_interface_points": 14, + "n_sources": 13, + "n_limitations": 41, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t1_thermal/ametek_oxtran/model.glb", + "urdf": "assets/expansion_batch04/t1_thermal/ametek_oxtran/model.urdf", + "blend": "assets/expansion_batch04/t1_thermal/ametek_oxtran/model.blend", + "contract": "assets/expansion_batch04/t1_thermal/ametek_oxtran/asset.contract.json", + "runtime": "scripts/asset_runtime/ametek_oxtran.py" + }, + "thumb": "media/thumb/ametek_oxtran.webp", + "hero": "media/hero/ametek_oxtran.webp" + }, + { + "id": "instrument.netzsch_mmc315", + "slug": "netzsch_mmc315", + "chem_id": "CHEM-148", + "name": "Adiabatic (ARC) reaction calorimeter", + "maker": "NETZSCH", + "model": "MMC 315 Nexus", + "title": "NETZSCH MMC 315 Nexus", + "name_zh": "NETZSCH MMC 315 Nexus 多模块量热仪(ARC模块)", + "domain": "thermal", + "domain_name": "Thermal, Mechanical & Transport", + "domain_zh": "热学力学与输运", + "path": "assets/expansion_batch04/t1_thermal/netzsch_mmc315", + "size_m": [ + 0.62, + 0.594, + 0.55 + ], + "n_components": 40, + "n_mesh_parts": 40, + "n_joints": 3, + "joint_types": { + "revolute": 2, + "prismatic": 1 + }, + "n_state_slots": 30, + "n_capabilities": 24, + "n_capabilities_implemented": 14, + "n_mechanisms": 1, + "n_readouts": 4, + "n_interface_points": 10, + "n_sources": 15, + "n_limitations": 37, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t1_thermal/netzsch_mmc315/model.glb", + "urdf": "assets/expansion_batch04/t1_thermal/netzsch_mmc315/model.urdf", + "blend": "assets/expansion_batch04/t1_thermal/netzsch_mmc315/model.blend", + "contract": "assets/expansion_batch04/t1_thermal/netzsch_mmc315/asset.contract.json", + "runtime": "scripts/asset_runtime/netzsch_mmc315.py" + }, + "thumb": "media/thumb/netzsch_mmc315.webp", + "hero": "media/hero/netzsch_mmc315.webp" + }, + { + "id": "instrument.mt_rc1mxhfcal", + "slug": "mt_rc1mxhfcal", + "chem_id": "CHEM-149", + "name": "Heat-flow reaction calorimeter", + "maker": "METTLER TOLEDO", + "model": "RC1mx + HFCal", + "title": "METTLER TOLEDO RC1mx + HFCal", + "name_zh": "METTLER TOLEDO RC1mx + HFCal 热流式反应量热系统(标准转矩搅拌器)", + "domain": "thermal", + "domain_name": "Thermal, Mechanical & Transport", + "domain_zh": "热学力学与输运", + "path": "assets/expansion_batch04/t1_thermal/mt_rc1mxhfcal", + "size_m": [ + 0.951, + 0.705, + 1.1805 + ], + "n_components": 92, + "n_mesh_parts": 92, + "n_joints": 5, + "joint_types": { + "prismatic": 3, + "revolute": 2 + }, + "n_state_slots": 57, + "n_capabilities": 37, + "n_capabilities_implemented": 26, + "n_mechanisms": 1, + "n_readouts": 5, + "n_interface_points": 12, + "n_sources": 17, + "n_limitations": 47, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t1_thermal/mt_rc1mxhfcal/model.glb", + "urdf": "assets/expansion_batch04/t1_thermal/mt_rc1mxhfcal/model.urdf", + "blend": "assets/expansion_batch04/t1_thermal/mt_rc1mxhfcal/model.blend", + "contract": "assets/expansion_batch04/t1_thermal/mt_rc1mxhfcal/asset.contract.json", + "runtime": "scripts/asset_runtime/mt_rc1mxhfcal.py" + }, + "thumb": "media/thumb/mt_rc1mxhfcal.webp", + "hero": "media/hero/mt_rc1mxhfcal.webp" + }, + { + "id": "instrument.ika_c6000", + "slug": "ika_c6000", + "chem_id": "CHEM-150", + "name": "Oxygen bomb calorimeter", + "maker": "IKA", + "model": "C 6000 isoperibol", + "title": "IKA C 6000 isoperibol", + "name_zh": "IKA C 6000 isoperibol 氧弹量热仪(Package 2/12:C 6000主机+C 6012耐卤素氧弹)", + "domain": "thermal", + "domain_name": "Thermal, Mechanical & Transport", + "domain_zh": "热学力学与输运", + "path": "assets/expansion_batch03/t1_thermal/ika_c6000", + "size_m": [ + 0.5053, + 0.4768, + 0.4253 + ], + "n_components": 60, + "n_mesh_parts": 60, + "n_joints": 3, + "joint_types": { + "prismatic": 2, + "revolute": 1 + }, + "n_state_slots": 43, + "n_capabilities": 44, + "n_capabilities_implemented": 35, + "n_mechanisms": 1, + "n_readouts": 3, + "n_interface_points": 16, + "n_sources": 18, + "n_limitations": 37, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t1_thermal/ika_c6000/model.glb", + "urdf": "assets/expansion_batch03/t1_thermal/ika_c6000/model.urdf", + "blend": "assets/expansion_batch03/t1_thermal/ika_c6000/model.blend", + "contract": "assets/expansion_batch03/t1_thermal/ika_c6000/asset.contract.json", + "runtime": "scripts/asset_runtime/ika_c6000.py" + }, + "thumb": "media/thumb/ika_c6000.webp", + "hero": "media/hero/ika_c6000.webp" + }, + { + "id": "instrument.jeol_jsmit200", + "slug": "jeol_jsmit200", + "chem_id": "CHEM-151", + "name": "Scanning electron microscope", + "maker": "JEOL", + "model": "JSM-IT200 LA", + "title": "JEOL JSM-IT200 LA", + "name_zh": "JEOL JSM-IT200 LA 扫描电子显微镜(InTouchScope,集成JED-2300 EDS,含机械泵与选配操作台)", + "domain": "imaging", + "domain_name": "Microscopy, Imaging & Diffraction", + "domain_zh": "显微成像与衍射", + "path": "assets/expansion_batch04/t3_analytical/jeol_jsmit200", + "size_m": [ + 1.537, + 1.1635, + 1.48 + ], + "n_components": 102, + "n_mesh_parts": 102, + "n_joints": 12, + "joint_types": { + "prismatic": 8, + "revolute": 4 + }, + "n_state_slots": 64, + "n_capabilities": 48, + "n_capabilities_implemented": 39, + "n_mechanisms": 1, + "n_readouts": 7, + "n_interface_points": 13, + "n_sources": 22, + "n_limitations": 39, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t3_analytical/jeol_jsmit200/model.glb", + "urdf": "assets/expansion_batch04/t3_analytical/jeol_jsmit200/model.urdf", + "blend": "assets/expansion_batch04/t3_analytical/jeol_jsmit200/model.blend", + "contract": "assets/expansion_batch04/t3_analytical/jeol_jsmit200/asset.contract.json", + "runtime": "scripts/asset_runtime/jeol_jsmit200.py" + }, + "thumb": "media/thumb/jeol_jsmit200.webp", + "hero": "media/hero/jeol_jsmit200.webp" + }, + { + "id": "instrument.jeol_jem1400flash", + "slug": "jeol_jem1400flash", + "chem_id": "CHEM-152", + "name": "Transmission electron microscope", + "maker": "JEOL", + "model": "JEM-1400Flash", + "title": "JEOL JEM-1400Flash", + "name_zh": "JEOL JEM-1400Flash HR 透射电子显微镜(120kV钨灯丝、HR极靴、Matataki Flash sCMOS相机,含电源柜、后控制台与机械泵)", + "domain": "imaging", + "domain_name": "Microscopy, Imaging & Diffraction", + "domain_zh": "显微成像与衍射", + "path": "assets/expansion_batch04/t3_analytical/jeol_jem1400flash", + "size_m": [ + 2.625, + 2.2643, + 2.4921 + ], + "n_components": 82, + "n_mesh_parts": 82, + "n_joints": 21, + "joint_types": { + "revolute": 13, + "prismatic": 8 + }, + "n_state_slots": 77, + "n_capabilities": 59, + "n_capabilities_implemented": 48, + "n_mechanisms": 1, + "n_readouts": 7, + "n_interface_points": 9, + "n_sources": 28, + "n_limitations": 33, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t3_analytical/jeol_jem1400flash/model.glb", + "urdf": "assets/expansion_batch04/t3_analytical/jeol_jem1400flash/model.urdf", + "blend": "assets/expansion_batch04/t3_analytical/jeol_jem1400flash/model.blend", + "contract": "assets/expansion_batch04/t3_analytical/jeol_jem1400flash/asset.contract.json", + "runtime": "scripts/asset_runtime/jeol_jem1400flash.py" + }, + "thumb": "media/thumb/jeol_jem1400flash.webp", + "hero": "media/hero/jeol_jem1400flash.webp" + }, + { + "id": "instrument.antonpaar_saxspace", + "slug": "antonpaar_saxspace", + "chem_id": "CHEM-153", + "name": "Small-angle X-ray scattering system", + "maker": "Anton Paar", + "model": "SAXSpace", + "title": "Anton Paar SAXSpace", + "name_zh": "Anton Paar SAXSpace 小角/广角X射线散射仪(Cu密封管、Kratky块线/点准直、TCStage、MYTHEN2 R 1K探测器2θ臂、ASX自动进样器,含实验桌与柜体)", + "domain": "imaging", + "domain_name": "Microscopy, Imaging & Diffraction", + "domain_zh": "显微成像与衍射", + "path": "assets/expansion_batch04/t3_analytical/antonpaar_saxspace", + "size_m": [ + 1.8, + 0.922, + 1.685 + ], + "n_components": 72, + "n_mesh_parts": 72, + "n_joints": 13, + "joint_types": { + "prismatic": 9, + "revolute": 4 + }, + "n_state_slots": 76, + "n_capabilities": 54, + "n_capabilities_implemented": 45, + "n_mechanisms": 1, + "n_readouts": 11, + "n_interface_points": 13, + "n_sources": 25, + "n_limitations": 34, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t3_analytical/antonpaar_saxspace/model.glb", + "urdf": "assets/expansion_batch04/t3_analytical/antonpaar_saxspace/model.urdf", + "blend": "assets/expansion_batch04/t3_analytical/antonpaar_saxspace/model.blend", + "contract": "assets/expansion_batch04/t3_analytical/antonpaar_saxspace/asset.contract.json", + "runtime": "scripts/asset_runtime/antonpaar_saxspace.py" + }, + "thumb": "media/thumb/antonpaar_saxspace.webp", + "hero": "media/hero/antonpaar_saxspace.webp" + }, + { + "id": "instrument.kratos_axissupra", + "slug": "kratos_axissupra", + "chem_id": "CHEM-154", + "name": "X-ray photoelectron spectrometer", + "maker": "Kratos / Shimadzu", + "model": "AXIS Supra+", + "title": "Kratos / Shimadzu AXIS Supra+", + "name_zh": "Kratos / Shimadzu AXIS Supra+ 成像X射线光电子能谱仪(单色Al Kα、半球+球面镜分析器、DLD、电子中和器、Minibeam 4离子枪、Flexi-lock 3架仓、五轴样品台,含冷水机与ESCApe工作站)", + "domain": "imaging", + "domain_name": "Microscopy, Imaging & Diffraction", + "domain_zh": "显微成像与衍射", + "path": "assets/expansion_batch04/t3_analytical/kratos_axissupra", + "size_m": [ + 2.77, + 2.064, + 1.97 + ], + "n_components": 66, + "n_mesh_parts": 66, + "n_joints": 10, + "joint_types": { + "prismatic": 7, + "revolute": 3 + }, + "n_state_slots": 67, + "n_capabilities": 49, + "n_capabilities_implemented": 39, + "n_mechanisms": 1, + "n_readouts": 8, + "n_interface_points": 10, + "n_sources": 22, + "n_limitations": 29, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t3_analytical/kratos_axissupra/model.glb", + "urdf": "assets/expansion_batch04/t3_analytical/kratos_axissupra/model.urdf", + "blend": "assets/expansion_batch04/t3_analytical/kratos_axissupra/model.blend", + "contract": "assets/expansion_batch04/t3_analytical/kratos_axissupra/asset.contract.json", + "runtime": "scripts/asset_runtime/kratos_axissupra.py" + }, + "thumb": "media/thumb/kratos_axissupra.webp", + "hero": "media/hero/kratos_axissupra.webp" + }, + { + "id": "instrument.keyence_vkx3000", + "slug": "keyence_vkx3000", + "chem_id": "CHEM-155", + "name": "3D laser-scanning profilometer microscope", + "maker": "KEYENCE", + "model": "VK-X3000 / VK-X3100", + "title": "KEYENCE VK-X3000 / VK-X3100", + "name_zh": "KEYENCE VK-X3000三维光学表面轮廓显微镜(VK-X3000控制器、VK-X3100测量头、VK-D3电动底座,含显示器与电脑工作站)", + "domain": "imaging", + "domain_name": "Microscopy, Imaging & Diffraction", + "domain_zh": "显微成像与衍射", + "path": "assets/expansion_batch04/t3_analytical/keyence_vkx3000", + "size_m": [ + 1.386, + 0.5385, + 0.471 + ], + "n_components": 62, + "n_mesh_parts": 62, + "n_joints": 7, + "joint_types": { + "revolute": 2, + "prismatic": 5 + }, + "n_state_slots": 51, + "n_capabilities": 38, + "n_capabilities_implemented": 32, + "n_mechanisms": 1, + "n_readouts": 9, + "n_interface_points": 9, + "n_sources": 21, + "n_limitations": 27, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t3_analytical/keyence_vkx3000/model.glb", + "urdf": "assets/expansion_batch04/t3_analytical/keyence_vkx3000/model.urdf", + "blend": "assets/expansion_batch04/t3_analytical/keyence_vkx3000/model.blend", + "contract": "assets/expansion_batch04/t3_analytical/keyence_vkx3000/asset.contract.json", + "runtime": "scripts/asset_runtime/keyence_vkx3000.py" + }, + "thumb": "media/thumb/keyence_vkx3000.webp", + "hero": "media/hero/keyence_vkx3000.webp" + }, + { + "id": "instrument.bruker_x4poseidon", + "slug": "bruker_x4poseidon", + "chem_id": "CHEM-156", + "name": "Micro X-ray computed tomography", + "maker": "Bruker", + "model": "X4 POSEIDON", + "title": "Bruker X4 POSEIDON", + "name_zh": "Bruker X4 POSEIDON台式三维X射线显微镜/微米CT(反射源基本配置:反射式X射线源、7 MP平板探测器、标准旋转台、固定扫描几何、7位滤片转换器,含工作站)", + "domain": "imaging", + "domain_name": "Microscopy, Imaging & Diffraction", + "domain_zh": "显微成像与衍射", + "path": "assets/expansion_batch04/t3_analytical/bruker_x4poseidon", + "size_m": [ + 1.8855, + 0.622, + 0.722 + ], + "n_components": 51, + "n_mesh_parts": 51, + "n_joints": 7, + "joint_types": { + "prismatic": 6, + "revolute": 1 + }, + "n_state_slots": 60, + "n_capabilities": 46, + "n_capabilities_implemented": 36, + "n_mechanisms": 1, + "n_readouts": 7, + "n_interface_points": 7, + "n_sources": 16, + "n_limitations": 26, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t3_analytical/bruker_x4poseidon/model.glb", + "urdf": "assets/expansion_batch04/t3_analytical/bruker_x4poseidon/model.urdf", + "blend": "assets/expansion_batch04/t3_analytical/bruker_x4poseidon/model.blend", + "contract": "assets/expansion_batch04/t3_analytical/bruker_x4poseidon/asset.contract.json", + "runtime": "scripts/asset_runtime/bruker_x4poseidon.py" + }, + "thumb": "media/thumb/bruker_x4poseidon.webp", + "hero": "media/hero/bruker_x4poseidon.webp" + }, + { + "id": "instrument.ja_alphase", + "slug": "ja_alphase", + "chem_id": "CHEM-157", + "name": "Spectroscopic ellipsometer", + "maker": "J.A. Woollam", + "model": "alpha-SE", + "title": "J.A. Woollam alpha-SE", + "name_zh": "J.A. Woollam alpha-SE光谱椭偏仪(2015规格:旋转补偿器+CCD,380–900 nm 180个波长,入射角65/70/75°与90°直通,手动换角,电动Z对准,真空吸盘,选配液池;含操作电脑)", + "domain": "imaging", + "domain_name": "Microscopy, Imaging & Diffraction", + "domain_zh": "显微成像与衍射", + "path": "assets/expansion_batch04/t3_analytical/ja_alphase", + "size_m": [ + 1.23, + 0.485, + 0.434 + ], + "n_components": 49, + "n_mesh_parts": 49, + "n_joints": 5, + "joint_types": { + "prismatic": 3, + "revolute": 2 + }, + "n_state_slots": 39, + "n_capabilities": 37, + "n_capabilities_implemented": 29, + "n_mechanisms": 1, + "n_readouts": 5, + "n_interface_points": 7, + "n_sources": 16, + "n_limitations": 26, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t3_analytical/ja_alphase/model.glb", + "urdf": "assets/expansion_batch04/t3_analytical/ja_alphase/model.urdf", + "blend": "assets/expansion_batch04/t3_analytical/ja_alphase/model.blend", + "contract": "assets/expansion_batch04/t3_analytical/ja_alphase/asset.contract.json", + "runtime": "scripts/asset_runtime/ja_alphase.py" + }, + "thumb": "media/thumb/ja_alphase.webp", + "hero": "media/hero/ja_alphase.webp" + }, + { + "id": "instrument.park_nx10", + "slug": "park_nx10", + "chem_id": "CHEM-158", + "name": "Atomic force microscope", + "maker": "Park Systems", + "model": "NX10", + "title": "Park Systems NX10", + "name_zh": "Park Systems NX10原子力显微镜(2024宣传册配置:50×50 µm闭环XY扫描器、15 µm Z扫描器、20×20 mm XY台、25 mm Z台、15 mm聚焦台、10×同轴光学、SLD光束检测;接触/True Non-Contact/轻敲、相位成像、力-距离谱、热调谐;含控制电子单元)", + "domain": "imaging", + "domain_name": "Microscopy, Imaging & Diffraction", + "domain_zh": "显微成像与衍射", + "path": "assets/expansion_batch04/t3_analytical/park_nx10", + "size_m": [ + 0.776, + 0.5107, + 0.443 + ], + "n_components": 51, + "n_mesh_parts": 51, + "n_joints": 12, + "joint_types": { + "prismatic": 6, + "revolute": 6 + }, + "n_state_slots": 54, + "n_capabilities": 56, + "n_capabilities_implemented": 43, + "n_mechanisms": 1, + "n_readouts": 2, + "n_interface_points": 7, + "n_sources": 12, + "n_limitations": 21, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t3_analytical/park_nx10/model.glb", + "urdf": "assets/expansion_batch04/t3_analytical/park_nx10/model.urdf", + "blend": "assets/expansion_batch04/t3_analytical/park_nx10/model.blend", + "contract": "assets/expansion_batch04/t3_analytical/park_nx10/asset.contract.json", + "runtime": "scripts/asset_runtime/park_nx10.py" + }, + "thumb": "media/thumb/park_nx10.webp", + "hero": "media/hero/park_nx10.webp" + }, + { + "id": "instrument.nanosurf_naiostm", + "slug": "nanosurf_naiostm", + "chem_id": "CHEM-159", + "name": "Scanning tunneling microscope", + "maker": "Nanosurf", + "model": "NaioSTM", + "title": "Nanosurf NaioSTM", + "name_zh": "Nanosurf NaioSTM扫描隧道显微镜(花岗岩隔振台上的扫描头、500×500×200 nm扫描器、stick-slip自动进针、0.1–100 nA电流放大器、±10 V针尖电压、恒流/恒高成像、I-V与I-z谱、10×放大罩;含台下控制器)", + "domain": "imaging", + "domain_name": "Microscopy, Imaging & Diffraction", + "domain_zh": "显微成像与衍射", + "path": "assets/expansion_batch04/t3_analytical/nanosurf_naiostm", + "size_m": [ + 0.204, + 0.204, + 0.104 + ], + "n_components": 28, + "n_mesh_parts": 28, + "n_joints": 3, + "joint_types": { + "prismatic": 3 + }, + "n_state_slots": 36, + "n_capabilities": 52, + "n_capabilities_implemented": 43, + "n_mechanisms": 1, + "n_readouts": 1, + "n_interface_points": 7, + "n_sources": 11, + "n_limitations": 21, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t3_analytical/nanosurf_naiostm/model.glb", + "urdf": "assets/expansion_batch04/t3_analytical/nanosurf_naiostm/model.urdf", + "blend": "assets/expansion_batch04/t3_analytical/nanosurf_naiostm/model.blend", + "contract": "assets/expansion_batch04/t3_analytical/nanosurf_naiostm/asset.contract.json", + "runtime": "scripts/asset_runtime/nanosurf_naiostm.py" + }, + "thumb": "media/thumb/nanosurf_naiostm.webp", + "hero": "media/hero/nanosurf_naiostm.webp" + }, + { + "id": "instrument.rigaku_miniflex600_external_cooling", + "slug": "rigaku_miniflex600_external_cooling", + "chem_id": "CHEM-160", + "name": "Powder X-ray diffractometer", + "maker": "Rigaku", + "model": "MiniFlex600", + "title": "Rigaku MiniFlex600", + "name_zh": "Rigaku MiniFlex600 粉末X射线衍射仪(外置循环水)", + "domain": "imaging", + "domain_name": "Microscopy, Imaging & Diffraction", + "domain_zh": "显微成像与衍射", + "path": "assets/basic40_batch02/t4_measure/rigaku_miniflex600", + "size_m": [ + 0.6205, + 0.456, + 0.722 + ], + "n_components": 13, + "n_mesh_parts": 13, + "n_joints": 3, + "joint_types": { + "revolute": 3 + }, + "n_state_slots": 25, + "n_capabilities": 12, + "n_capabilities_implemented": 10, + "n_mechanisms": 2, + "n_readouts": 0, + "n_interface_points": 1, + "n_sources": 12, + "n_limitations": 15, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/basic40_batch02/t4_measure/rigaku_miniflex600/model.glb", + "urdf": "assets/basic40_batch02/t4_measure/rigaku_miniflex600/model.urdf", + "blend": "assets/basic40_batch02/t4_measure/rigaku_miniflex600/model.blend", + "contract": "assets/basic40_batch02/t4_measure/rigaku_miniflex600/asset.contract.json", + "runtime": "scripts/basic40_runtime_measure.py" + }, + "thumb": "media/thumb/rigaku_miniflex600_external_cooling.webp", + "hero": "media/hero/rigaku_miniflex600_external_cooling.webp" + }, + { + "id": "instrument.rigaku_xtalabsynergy", + "slug": "rigaku_xtalabsynergy", + "chem_id": "CHEM-161", + "name": "Single-crystal X-ray diffractometer", + "maker": "Rigaku Oxford Diffraction", + "model": "XtaLAB Synergy-R", + "title": "Rigaku Oxford Diffraction XtaLAB Synergy-R", + "name_zh": "Rigaku XtaLAB Synergy-R单晶X射线衍射仪(HyPix-6000HE配置:PhotonJet-R转靶光源、1–10 mrad电动狭缝、κ测角仪与伸缩2θ臂、HyPix-6000HE混合光子计数探测器、两扇铰链前门与电气安全回路、Oxford Cryostream 1000)", + "domain": "imaging", + "domain_name": "Microscopy, Imaging & Diffraction", + "domain_zh": "显微成像与衍射", + "path": "assets/expansion_batch04/t3_analytical/rigaku_xtalabsynergy", + "size_m": [ + 1.3012, + 0.914, + 1.875 + ], + "n_components": 77, + "n_mesh_parts": 77, + "n_joints": 11, + "joint_types": { + "prismatic": 4, + "revolute": 7 + }, + "n_state_slots": 44, + "n_capabilities": 55, + "n_capabilities_implemented": 44, + "n_mechanisms": 1, + "n_readouts": 8, + "n_interface_points": 8, + "n_sources": 16, + "n_limitations": 23, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t3_analytical/rigaku_xtalabsynergy/model.glb", + "urdf": "assets/expansion_batch04/t3_analytical/rigaku_xtalabsynergy/model.urdf", + "blend": "assets/expansion_batch04/t3_analytical/rigaku_xtalabsynergy/model.blend", + "contract": "assets/expansion_batch04/t3_analytical/rigaku_xtalabsynergy/asset.contract.json", + "runtime": "scripts/asset_runtime/rigaku_xtalabsynergy.py" + }, + "thumb": "media/thumb/rigaku_xtalabsynergy.webp", + "hero": "media/hero/rigaku_xtalabsynergy.webp" + }, + { + "id": "instrument.evident_bx53p", + "slug": "evident_bx53p", + "chem_id": "CHEM-162", + "name": "Polarizing microscope", + "maker": "Evident / Olympus", + "model": "BX53-P", + "title": "Evident / Olympus BX53-P", + "name_zh": "Evident / Olympus BX53-P偏光显微镜(锥光/正交配置:U-CPA勃氏镜、U-AN360P检偏镜、U-POC-2偏光聚光镜、U-SRP旋转台、四孔物镜转盘、倾斜三目筒)", + "domain": "imaging", + "domain_name": "Microscopy, Imaging & Diffraction", + "domain_zh": "显微成像与衍射", + "path": "assets/expansion_batch04/t3_analytical/evident_bx53p", + "size_m": [ + 0.282, + 0.5124, + 0.534 + ], + "n_components": 50, + "n_mesh_parts": 50, + "n_joints": 14, + "joint_types": { + "revolute": 9, + "prismatic": 5 + }, + "n_state_slots": 47, + "n_capabilities": 34, + "n_capabilities_implemented": 29, + "n_mechanisms": 1, + "n_readouts": 1, + "n_interface_points": 7, + "n_sources": 13, + "n_limitations": 18, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t3_analytical/evident_bx53p/model.glb", + "urdf": "assets/expansion_batch04/t3_analytical/evident_bx53p/model.urdf", + "blend": "assets/expansion_batch04/t3_analytical/evident_bx53p/model.blend", + "contract": "assets/expansion_batch04/t3_analytical/evident_bx53p/asset.contract.json", + "runtime": "scripts/asset_runtime/evident_bx53p.py" + }, + "thumb": "media/thumb/evident_bx53p.webp", + "hero": "media/hero/evident_bx53p.webp" + }, + { + "id": "instrument.biotek_405ts", + "slug": "biotek_405ts", + "chem_id": "CHEM-163", + "name": "Microplate washer", + "maker": "Agilent BioTek", + "model": "405 TS (96-tube manifold)", + "title": "Agilent BioTek 405 TS (96-tube manifold)", + "name_zh": "Agilent BioTek 405 TS微孔板洗板机(单96管洗头,内置四路缓冲切换A–D,标准SBS载板)", + "domain": "bio", + "domain_name": "Biochemical & Wet-Chemistry Assays", + "domain_zh": "生化与湿化学分析", + "path": "assets/expansion_batch04/t4_measure/biotek_405ts", + "size_m": [ + 0.3556, + 0.4318, + 0.254 + ], + "n_components": 25, + "n_mesh_parts": 25, + "n_joints": 3, + "joint_types": { + "prismatic": 3 + }, + "n_state_slots": 36, + "n_capabilities": 26, + "n_capabilities_implemented": 20, + "n_mechanisms": 1, + "n_readouts": 2, + "n_interface_points": 12, + "n_sources": 17, + "n_limitations": 21, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch04/t4_measure/biotek_405ts/model.glb", + "urdf": "assets/expansion_batch04/t4_measure/biotek_405ts/model.urdf", + "blend": "assets/expansion_batch04/t4_measure/biotek_405ts/model.blend", + "contract": "assets/expansion_batch04/t4_measure/biotek_405ts/asset.contract.json", + "runtime": "scripts/asset_runtime/biotek_405ts.py" + }, + "thumb": "media/thumb/biotek_405ts.webp", + "hero": "media/hero/biotek_405ts.webp" + }, + { + "id": "instrument.biorad_miniprotean", + "slug": "biorad_miniprotean", + "chem_id": "CHEM-164", + "name": "Gel electrophoresis system", + "maker": "Bio-Rad", + "model": "Mini-PROTEAN Tetra + power supply", + "title": "Bio-Rad Mini-PROTEAN Tetra + power supply", + "name_zh": "Bio-Rad Mini-PROTEAN Tetra垂直电泳槽(电极模块,可加陪伴模块运行1–4块胶)+ PowerPac Basic电源", + "domain": "bio", + "domain_name": "Biochemical & Wet-Chemistry Assays", + "domain_zh": "生化与湿化学分析", + "path": "assets/expansion_batch03/t4_measure/biorad_miniprotean", + "size_m": [ + 0.41, + 0.289, + 0.1993 + ], + "n_components": 40, + "n_mesh_parts": 40, + "n_joints": 8, + "joint_types": { + "prismatic": 8 + }, + "n_state_slots": 36, + "n_capabilities": 37, + "n_capabilities_implemented": 30, + "n_mechanisms": 1, + "n_readouts": 1, + "n_interface_points": 11, + "n_sources": 17, + "n_limitations": 23, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t4_measure/biorad_miniprotean/model.glb", + "urdf": "assets/expansion_batch03/t4_measure/biorad_miniprotean/model.urdf", + "blend": "assets/expansion_batch03/t4_measure/biorad_miniprotean/model.blend", + "contract": "assets/expansion_batch03/t4_measure/biorad_miniprotean/asset.contract.json", + "runtime": "scripts/asset_runtime/biorad_miniprotean.py" + }, + "thumb": "media/thumb/biorad_miniprotean.webp", + "hero": "media/hero/biorad_miniprotean.webp" + }, + { + "id": "instrument.thermo_ibrightfl1500", + "slug": "thermo_ibrightfl1500", + "chem_id": "CHEM-165", + "name": "Gel & blot imager", + "maker": "Thermo Fisher Scientific", + "model": "iBright FL1500", + "title": "Thermo Fisher Scientific iBright FL1500", + "name_zh": "Thermo Fisher Invitrogen iBright FL1500凝胶与印迹成像系统(产品册配置)", + "domain": "bio", + "domain_name": "Biochemical & Wet-Chemistry Assays", + "domain_zh": "生化与湿化学分析", + "path": "assets/expansion_batch03/t4_measure/thermo_ibrightfl1500", + "size_m": [ + 0.38, + 0.68, + 0.6 + ], + "n_components": 19, + "n_mesh_parts": 19, + "n_joints": 3, + "joint_types": { + "prismatic": 2, + "revolute": 1 + }, + "n_state_slots": 24, + "n_capabilities": 32, + "n_capabilities_implemented": 26, + "n_mechanisms": 1, + "n_readouts": 2, + "n_interface_points": 5, + "n_sources": 10, + "n_limitations": 18, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/expansion_batch03/t4_measure/thermo_ibrightfl1500/model.glb", + "urdf": "assets/expansion_batch03/t4_measure/thermo_ibrightfl1500/model.urdf", + "blend": "assets/expansion_batch03/t4_measure/thermo_ibrightfl1500/model.blend", + "contract": "assets/expansion_batch03/t4_measure/thermo_ibrightfl1500/asset.contract.json", + "runtime": "scripts/asset_runtime/thermo_ibrightfl1500.py" + }, + "thumb": "media/thumb/thermo_ibrightfl1500.webp", + "hero": "media/hero/thermo_ibrightfl1500.webp" + }, + { + "id": "instrument.eppendorf_cellxpertc170i", + "slug": "eppendorf_cellxpertc170i", + "chem_id": "CHEM-166", + "name": "CO₂ cell-culture incubator", + "maker": "Eppendorf", + "model": "CellXpert C170i", + "title": "Eppendorf CellXpert C170i", + "name_zh": "Eppendorf CellXpert C170i CO2细胞培养箱(O2 1–20 %、湿度与水位选件)", + "domain": "bio", + "domain_name": "Biochemical & Wet-Chemistry Assays", + "domain_zh": "生化与湿化学分析", + "path": "assets/expansion_batch04/t4_measure/eppendorf_cellxpertc170i", + "size_m": [ + 0.72, + 0.7153, + 0.9 + ], + "n_components": 39, + "n_mesh_parts": 39, + "n_joints": 5, + "joint_types": { + "prismatic": 2, + "revolute": 3 + }, + "n_state_slots": 57, + "n_capabilities": 46, + "n_capabilities_implemented": 40, + "n_mechanisms": 1, + "n_readouts": 2, + "n_interface_points": 14, + "n_sources": 18, + "n_limitations": 24, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": true, + "files": { + "glb": "assets/expansion_batch04/t4_measure/eppendorf_cellxpertc170i/model.glb", + "urdf": "assets/expansion_batch04/t4_measure/eppendorf_cellxpertc170i/model.urdf", + "blend": "assets/expansion_batch04/t4_measure/eppendorf_cellxpertc170i/model.blend", + "contract": "assets/expansion_batch04/t4_measure/eppendorf_cellxpertc170i/asset.contract.json", + "runtime": "scripts/asset_runtime/eppendorf_cellxpertc170i.py" + }, + "thumb": "media/thumb/eppendorf_cellxpertc170i.webp", + "hero": "media/hero/eppendorf_cellxpertc170i.webp" + }, + { + "id": "instrument.biorad_cfxopus", + "slug": "biorad_cfxopus", + "chem_id": "CHEM-167", + "name": "Real-time qPCR system", + "maker": "Bio-Rad", + "model": "CFX Opus 96", + "title": "Bio-Rad CFX Opus 96", + "name_zh": "Bio-Rad CFX Opus 96实时荧光定量PCR仪(12011319)", + "domain": "bio", + "domain_name": "Biochemical & Wet-Chemistry Assays", + "domain_zh": "生化与湿化学分析", + "path": "assets/expansion_batch04/t4_measure/biorad_cfxopus", + "size_m": [ + 0.33, + 0.5608, + 0.36 + ], + "n_components": 28, + "n_mesh_parts": 28, + "n_joints": 3, + "joint_types": { + "prismatic": 2, + "revolute": 1 + }, + "n_state_slots": 40, + "n_capabilities": 35, + "n_capabilities_implemented": 29, + "n_mechanisms": 1, + "n_readouts": 5, + "n_interface_points": 7, + "n_sources": 14, + "n_limitations": 21, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": true, + "files": { + "glb": "assets/expansion_batch04/t4_measure/biorad_cfxopus/model.glb", + "urdf": "assets/expansion_batch04/t4_measure/biorad_cfxopus/model.urdf", + "blend": "assets/expansion_batch04/t4_measure/biorad_cfxopus/model.blend", + "contract": "assets/expansion_batch04/t4_measure/biorad_cfxopus/asset.contract.json", + "runtime": "scripts/asset_runtime/biorad_cfxopus.py" + }, + "thumb": "media/thumb/biorad_cfxopus.webp", + "hero": "media/hero/biorad_cfxopus.webp" + }, + { + "id": "instrument.bd_facsariaiii", + "slug": "bd_facsariaiii", + "chem_id": "CHEM-168", + "name": "Flow cytometer & cell sorter", + "maker": "BD Biosciences", + "model": "FACSAria III", + "title": "BD Biosciences FACSAria III", + "name_zh": "BD FACSAria III流式细胞分选仪(2018规格,四激光)", + "domain": "bio", + "domain_name": "Biochemical & Wet-Chemistry Assays", + "domain_zh": "生化与湿化学分析", + "path": "assets/expansion_batch04/t4_measure/bd_facsariaiii", + "size_m": [ + 2.135, + 0.7286, + 0.71 + ], + "n_components": 46, + "n_mesh_parts": 46, + "n_joints": 10, + "joint_types": { + "revolute": 5, + "prismatic": 5 + }, + "n_state_slots": 105, + "n_capabilities": 69, + "n_capabilities_implemented": 63, + "n_mechanisms": 1, + "n_readouts": 3, + "n_interface_points": 17, + "n_sources": 18, + "n_limitations": 24, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": true, + "files": { + "glb": "assets/expansion_batch04/t4_measure/bd_facsariaiii/model.glb", + "urdf": "assets/expansion_batch04/t4_measure/bd_facsariaiii/model.urdf", + "blend": "assets/expansion_batch04/t4_measure/bd_facsariaiii/model.blend", + "contract": "assets/expansion_batch04/t4_measure/bd_facsariaiii/asset.contract.json", + "runtime": "scripts/asset_runtime/bd_facsariaiii.py" + }, + "thumb": "media/thumb/bd_facsariaiii.webp", + "hero": "media/hero/bd_facsariaiii.webp" + }, + { + "id": "instrument.malvern_microcalpeaq", + "slug": "malvern_microcalpeaq", + "chem_id": "CHEM-169", + "name": "Isothermal titration calorimeter", + "maker": "Malvern Panalytical", + "model": "MicroCal PEAQ-ITC", + "title": "Malvern Panalytical MicroCal PEAQ-ITC", + "name_zh": "MicroCal PEAQ-ITC等温滴定量热仪(标准型,含洗涤模块)", + "domain": "bio", + "domain_name": "Biochemical & Wet-Chemistry Assays", + "domain_zh": "生化与湿化学分析", + "path": "assets/expansion_batch04/t4_measure/malvern_microcalpeaq", + "size_m": [ + 0.43, + 0.377, + 0.3688 + ], + "n_components": 55, + "n_mesh_parts": 55, + "n_joints": 5, + "joint_types": { + "prismatic": 4, + "revolute": 1 + }, + "n_state_slots": 58, + "n_capabilities": 45, + "n_capabilities_implemented": 42, + "n_mechanisms": 1, + "n_readouts": 2, + "n_interface_points": 17, + "n_sources": 17, + "n_limitations": 28, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": true, + "files": { + "glb": "assets/expansion_batch04/t4_measure/malvern_microcalpeaq/model.glb", + "urdf": "assets/expansion_batch04/t4_measure/malvern_microcalpeaq/model.urdf", + "blend": "assets/expansion_batch04/t4_measure/malvern_microcalpeaq/model.blend", + "contract": "assets/expansion_batch04/t4_measure/malvern_microcalpeaq/asset.contract.json", + "runtime": "scripts/asset_runtime/malvern_microcalpeaq.py" + }, + "thumb": "media/thumb/malvern_microcalpeaq.webp", + "hero": "media/hero/malvern_microcalpeaq.webp" + }, + { + "id": "instrument.cytiva_biacoret200", + "slug": "cytiva_biacoret200", + "chem_id": "CHEM-170", + "name": "Surface plasmon resonance system", + "maker": "Cytiva", + "model": "Biacore T200", + "title": "Cytiva Biacore T200", + "name_zh": "Biacore T200表面等离子共振生物传感器(处理单元)", + "domain": "bio", + "domain_name": "Biochemical & Wet-Chemistry Assays", + "domain_zh": "生化与湿化学分析", + "path": "assets/expansion_batch04/t4_measure/cytiva_biacoret200", + "size_m": [ + 0.6, + 0.615, + 0.69 + ], + "n_components": 56, + "n_mesh_parts": 54, + "n_joints": 7, + "joint_types": { + "revolute": 5, + "prismatic": 2 + }, + "n_state_slots": 66, + "n_capabilities": 64, + "n_capabilities_implemented": 61, + "n_mechanisms": 1, + "n_readouts": 5, + "n_interface_points": 11, + "n_sources": 20, + "n_limitations": 32, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": true, + "files": { + "glb": "assets/expansion_batch04/t4_measure/cytiva_biacoret200/model.glb", + "urdf": "assets/expansion_batch04/t4_measure/cytiva_biacoret200/model.urdf", + "blend": "assets/expansion_batch04/t4_measure/cytiva_biacoret200/model.blend", + "contract": "assets/expansion_batch04/t4_measure/cytiva_biacoret200/asset.contract.json", + "runtime": "scripts/asset_runtime/cytiva_biacoret200.py" + }, + "thumb": "media/thumb/cytiva_biacoret200.webp", + "hero": "media/hero/cytiva_biacoret200.webp" + }, + { + "id": "instrument.wtw_oxitopi", + "slug": "wtw_oxitopi", + "chem_id": "CHEM-171", + "name": "Respirometric BOD system", + "maker": "WTW (Xylem)", + "model": "OxiTop-i", + "title": "WTW (Xylem) OxiTop-i", + "name_zh": "生化需氧量呼吸测定系统WTW OxiTop-i IS 6(6测头、PF 600瓶、IS 6感应搅拌台)", + "domain": "bio", + "domain_name": "Biochemical & Wet-Chemistry Assays", + "domain_zh": "生化与湿化学分析", + "path": "assets/expansion_batch04/t4_measure/wtw_oxitopi", + "size_m": [ + 0.265, + 0.1966, + 0.2556 + ], + "n_components": 96, + "n_mesh_parts": 94, + "n_joints": 30, + "joint_types": { + "continuous": 6, + "prismatic": 24 + }, + "n_state_slots": 45, + "n_capabilities": 33, + "n_capabilities_implemented": 30, + "n_mechanisms": 1, + "n_readouts": 24, + "n_interface_points": 13, + "n_sources": 19, + "n_limitations": 27, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": true, + "files": { + "glb": "assets/expansion_batch04/t4_measure/wtw_oxitopi/model.glb", + "urdf": "assets/expansion_batch04/t4_measure/wtw_oxitopi/model.urdf", + "blend": "assets/expansion_batch04/t4_measure/wtw_oxitopi/model.blend", + "contract": "assets/expansion_batch04/t4_measure/wtw_oxitopi/asset.contract.json", + "runtime": "scripts/asset_runtime/wtw_oxitopi.py" + }, + "thumb": "media/thumb/wtw_oxitopi.webp", + "hero": "media/hero/wtw_oxitopi.webp" + }, + { + "id": "instrument.seal_aa500", + "slug": "seal_aa500", + "chem_id": "CHEM-172", + "name": "Segmented continuous-flow analyzer", + "maker": "SEAL Analytical", + "model": "AA500", + "title": "SEAL Analytical AA500", + "name_zh": "分段连续流动分析仪SEAL AA500(4通道营养盐:NOx、氨、磷酸盐、硅酸盐;带AS2 XY进样器)", + "domain": "bio", + "domain_name": "Biochemical & Wet-Chemistry Assays", + "domain_zh": "生化与湿化学分析", + "path": "assets/expansion_batch04/t4_measure/seal_aa500", + "size_m": [ + 1.405, + 0.479, + 0.409 + ], + "n_components": 66, + "n_mesh_parts": 66, + "n_joints": 11, + "joint_types": { + "continuous": 1, + "prismatic": 5, + "revolute": 5 + }, + "n_state_slots": 29, + "n_capabilities": 40, + "n_capabilities_implemented": 35, + "n_mechanisms": 1, + "n_readouts": 1, + "n_interface_points": 20, + "n_sources": 17, + "n_limitations": 22, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": true, + "files": { + "glb": "assets/expansion_batch04/t4_measure/seal_aa500/model.glb", + "urdf": "assets/expansion_batch04/t4_measure/seal_aa500/model.urdf", + "blend": "assets/expansion_batch04/t4_measure/seal_aa500/model.blend", + "contract": "assets/expansion_batch04/t4_measure/seal_aa500/asset.contract.json", + "runtime": "scripts/asset_runtime/seal_aa500.py" + }, + "thumb": "media/thumb/seal_aa500.webp", + "hero": "media/hero/seal_aa500.webp" + }, + { + "id": "instrument.bmg_clariostarplus", + "slug": "bmg_clariostarplus", + "chem_id": "CHEM-173", + "name": "Multi-mode microplate reader", + "maker": "BMG LABTECH", + "model": "CLARIOstar Plus", + "title": "BMG LABTECH CLARIOstar Plus", + "name_zh": "多模式微孔板读板仪BMG LABTECH CLARIOstar Plus(光谱仪吸光、LVF单色器荧光、偏振、发光,两个注射泵)", + "domain": "bio", + "domain_name": "Biochemical & Wet-Chemistry Assays", + "domain_zh": "生化与湿化学分析", + "path": "assets/expansion_batch04/t4_measure/bmg_clariostarplus", + "size_m": [ + 0.4512, + 0.5168, + 0.401 + ], + "n_components": 28, + "n_mesh_parts": 28, + "n_joints": 5, + "joint_types": { + "prismatic": 4, + "revolute": 1 + }, + "n_state_slots": 22, + "n_capabilities": 37, + "n_capabilities_implemented": 30, + "n_mechanisms": 1, + "n_readouts": 2, + "n_interface_points": 7, + "n_sources": 11, + "n_limitations": 20, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": true, + "files": { + "glb": "assets/expansion_batch04/t4_measure/bmg_clariostarplus/model.glb", + "urdf": "assets/expansion_batch04/t4_measure/bmg_clariostarplus/model.urdf", + "blend": "assets/expansion_batch04/t4_measure/bmg_clariostarplus/model.blend", + "contract": "assets/expansion_batch04/t4_measure/bmg_clariostarplus/asset.contract.json", + "runtime": "scripts/asset_runtime/bmg_clariostarplus.py" + }, + "thumb": "media/thumb/bmg_clariostarplus.webp", + "hero": "media/hero/bmg_clariostarplus.webp" + }, + { + "id": "instrument.mt_quantos_q2_xpe206dr", + "slug": "mt_quantos_q2_xpe206dr", + "chem_id": "CHEM-174", + "name": "Automated powder dosing system", + "maker": "METTLER TOLEDO", + "model": "Quantos Q2 + XPE206DR", + "title": "METTLER TOLEDO Quantos Q2 + XPE206DR", + "name_zh": "自动粉末定量分配仪 — METTLER TOLEDO Quantos Q2 + XPE206DR", + "domain": "automation", + "domain_name": "Automation & Gas/Liquid Supply", + "domain_zh": "自动化与气液供给", + "path": "assets/basic40_batch02/t5_automation/mt_quantos_q2", + "size_m": [ + 0.263, + 0.542, + 0.495 + ], + "n_components": 18, + "n_mesh_parts": 16, + "n_joints": 3, + "joint_types": { + "prismatic": 1, + "revolute": 2 + }, + "n_state_slots": 20, + "n_capabilities": 12, + "n_capabilities_implemented": 11, + "n_mechanisms": 3, + "n_readouts": 0, + "n_interface_points": 1, + "n_sources": 12, + "n_limitations": 14, + "isaac_lab": "bridged", + "glb_up": "y", + "output_templates": false, + "files": { + "glb": "assets/basic40_batch02/t5_automation/mt_quantos_q2/model.glb", + "urdf": "assets/basic40_batch02/t5_automation/mt_quantos_q2/model.urdf", + "blend": "assets/basic40_batch02/t5_automation/mt_quantos_q2/model.blend", + "contract": "assets/basic40_batch02/t5_automation/mt_quantos_q2/asset.contract.json" + }, + "thumb": "media/thumb/mt_quantos_q2_xpe206dr.webp", + "hero": "media/hero/mt_quantos_q2_xpe206dr.webp" + }, + { + "id": "instrument.opentrons_flex_single_5_1000ul", + "slug": "opentrons_flex_single_5_1000ul", + "chem_id": "CHEM-175", + "name": "Automated liquid-handling robot", + "maker": "Opentrons", + "model": "Flex (1-channel 5–1000 µL)", + "title": "Opentrons Flex (1-channel 5–1000 µL)", + "name_zh": "自动移液工作站 — Opentrons Flex 单通道5–1000 µL", + "domain": "automation", + "domain_name": "Automation & Gas/Liquid Supply", + "domain_zh": "自动化与气液供给", + "path": "assets/basic40_batch02/t5_automation/opentrons_flex", + "size_m": [ + 0.87, + 0.6907, + 0.84 + ], + "n_components": 28, + "n_mesh_parts": 28, + "n_joints": 4, + "joint_types": { + "prismatic": 4 + }, + "n_state_slots": 15, + "n_capabilities": 10, + "n_capabilities_implemented": 7, + "n_mechanisms": 2, + "n_readouts": 0, + "n_interface_points": 16, + "n_sources": 8, + "n_limitations": 20, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/basic40_batch02/t5_automation/opentrons_flex/model.glb", + "urdf": "assets/basic40_batch02/t5_automation/opentrons_flex/model.urdf", + "blend": "assets/basic40_batch02/t5_automation/opentrons_flex/model.blend", + "contract": "assets/basic40_batch02/t5_automation/opentrons_flex/asset.contract.json" + }, + "thumb": "media/thumb/opentrons_flex_single_5_1000ul.webp", + "hero": "media/hero/opentrons_flex_single_5_1000ul.webp" + }, + { + "id": "instrument.azenta_automated_roll_heat_sealer_a4s", + "slug": "azenta_automated_roll_heat_sealer_a4s", + "chem_id": "CHEM-176", + "name": "Automated microplate heat sealer", + "maker": "Azenta Life Sciences", + "model": "Automated Roll Heat Sealer (a4S)", + "title": "Azenta Life Sciences Automated Roll Heat Sealer (a4S)", + "name_zh": "自动微孔板热封膜机", + "domain": "automation", + "domain_name": "Automation & Gas/Liquid Supply", + "domain_zh": "自动化与气液供给", + "path": "assets/basic40_batch02/t5_automation/azenta_heat_sealer", + "size_m": [ + 0.2312, + 0.5075, + 0.403 + ], + "n_components": 17, + "n_mesh_parts": 16, + "n_joints": 1, + "joint_types": { + "prismatic": 1 + }, + "n_state_slots": 22, + "n_capabilities": 9, + "n_capabilities_implemented": 8, + "n_mechanisms": 2, + "n_readouts": 1, + "n_interface_points": 1, + "n_sources": 5, + "n_limitations": 16, + "isaac_lab": "bridged", + "glb_up": "y", + "output_templates": false, + "files": { + "glb": "assets/basic40_batch02/t5_automation/azenta_heat_sealer/model.glb", + "urdf": "assets/basic40_batch02/t5_automation/azenta_heat_sealer/model.urdf", + "blend": "assets/basic40_batch02/t5_automation/azenta_heat_sealer/model.blend", + "contract": "assets/basic40_batch02/t5_automation/azenta_heat_sealer/asset.contract.json", + "runtime": "scripts/basic40_runtime_automation.py" + }, + "thumb": "media/thumb/azenta_automated_roll_heat_sealer_a4s.webp", + "hero": "media/hero/azenta_automated_roll_heat_sealer_a4s.webp" + }, + { + "id": "instrument.azenta_intellixcap_s1_46_0001", + "slug": "azenta_intellixcap_s1_46_0001", + "chem_id": "CHEM-177", + "name": "Automated tube decapper/recapper", + "maker": "Azenta Life Sciences", + "model": "IntelliXcap S1 46-0001", + "title": "Azenta Life Sciences IntelliXcap S1 46-0001", + "name_zh": "自动开盖封盖机", + "domain": "automation", + "domain_name": "Automation & Gas/Liquid Supply", + "domain_zh": "自动化与气液供给", + "path": "assets/basic40_batch02/t5_automation/azenta_intellixcap_s1", + "size_m": [ + 0.17, + 0.24, + 0.3 + ], + "n_components": 10, + "n_mesh_parts": 9, + "n_joints": 8, + "joint_types": { + "continuous": 1, + "prismatic": 7 + }, + "n_state_slots": 13, + "n_capabilities": 6, + "n_capabilities_implemented": 5, + "n_mechanisms": 2, + "n_readouts": 0, + "n_interface_points": 1, + "n_sources": 11, + "n_limitations": 19, + "isaac_lab": "bridged", + "glb_up": "y", + "output_templates": false, + "files": { + "glb": "assets/basic40_batch02/t5_automation/azenta_intellixcap_s1/model.glb", + "urdf": "assets/basic40_batch02/t5_automation/azenta_intellixcap_s1/model.urdf", + "blend": "assets/basic40_batch02/t5_automation/azenta_intellixcap_s1/model.blend", + "contract": "assets/basic40_batch02/t5_automation/azenta_intellixcap_s1/asset.contract.json", + "runtime": "scripts/basic40_runtime_automation.py" + }, + "thumb": "media/thumb/azenta_intellixcap_s1_46_0001.webp", + "hero": "media/hero/azenta_intellixcap_s1_46_0001.webp" + }, + { + "id": "instrument.brooks_preciseflex_400", + "slug": "brooks_preciseflex_400", + "chem_id": "CHEM-178", + "name": "Lab sample-transfer robot arm", + "maker": "Brooks Automation", + "model": "PreciseFlex 400", + "title": "Brooks Automation PreciseFlex 400", + "name_zh": "实验室样品转运机械臂 — Brooks Automation PreciseFlex 400 标准臂400 mm行程", + "domain": "automation", + "domain_name": "Automation & Gas/Liquid Supply", + "domain_zh": "自动化与气液供给", + "path": "assets/basic40_batch02/t5_automation/preciseflex_400", + "size_m": [ + 0.715, + 0.2111, + 0.682 + ], + "n_components": 12, + "n_mesh_parts": 12, + "n_joints": 4, + "joint_types": { + "prismatic": 1, + "revolute": 3 + }, + "n_state_slots": 15, + "n_capabilities": 9, + "n_capabilities_implemented": 7, + "n_mechanisms": 1, + "n_readouts": 0, + "n_interface_points": 1, + "n_sources": 6, + "n_limitations": 14, + "isaac_lab": "bridged", + "glb_up": "y", + "output_templates": false, + "files": { + "glb": "assets/basic40_batch02/t5_automation/preciseflex_400/model.glb", + "urdf": "assets/basic40_batch02/t5_automation/preciseflex_400/model.urdf", + "blend": "assets/basic40_batch02/t5_automation/preciseflex_400/model.blend", + "contract": "assets/basic40_batch02/t5_automation/preciseflex_400/asset.contract.json", + "runtime": "scripts/basic40_runtime_automation.py" + }, + "thumb": "media/thumb/brooks_preciseflex_400.webp", + "hero": "media/hero/brooks_preciseflex_400.webp" + }, + { + "id": "instrument.ziath_dp5_mirage_2023", + "slug": "ziath_dp5_mirage_2023", + "chem_id": "CHEM-179", + "name": "2D-barcode rack reader", + "maker": "Azenta Ziath", + "model": "DP5 Mirage", + "title": "Azenta Ziath DP5 Mirage", + "name_zh": "样品管二维条码读架仪", + "domain": "automation", + "domain_name": "Automation & Gas/Liquid Supply", + "domain_zh": "自动化与气液供给", + "path": "assets/basic40_batch02/t5_automation/ziath_dp5", + "size_m": [ + 0.208, + 0.135, + 0.1214 + ], + "n_components": 16, + "n_mesh_parts": 15, + "n_joints": 1, + "joint_types": { + "prismatic": 1 + }, + "n_state_slots": 16, + "n_capabilities": 7, + "n_capabilities_implemented": 7, + "n_mechanisms": 1, + "n_readouts": 0, + "n_interface_points": 1, + "n_sources": 7, + "n_limitations": 21, + "isaac_lab": "bridged", + "glb_up": "y", + "output_templates": false, + "files": { + "glb": "assets/basic40_batch02/t5_automation/ziath_dp5/model.glb", + "urdf": "assets/basic40_batch02/t5_automation/ziath_dp5/model.urdf", + "blend": "assets/basic40_batch02/t5_automation/ziath_dp5/model.blend", + "contract": "assets/basic40_batch02/t5_automation/ziath_dp5/asset.contract.json", + "runtime": "scripts/basic40_runtime_automation.py" + }, + "thumb": "media/thumb/ziath_dp5_mirage_2023.webp", + "hero": "media/hero/ziath_dp5_mirage_2023.webp" + }, + { + "id": "instrument.alicat_mc_1slpm_rev6", + "slug": "alicat_mc_1slpm_rev6", + "chem_id": "CHEM-180", + "name": "Gas mass-flow controller", + "maker": "Alicat Scientific", + "model": "MC, 1 SLPM full scale, Rev6", + "title": "Alicat Scientific MC, 1 SLPM full scale, Rev6", + "name_zh": "气体质量流量控制器(Alicat MC,1 SLPM,标准精度,Rev6)", + "domain": "automation", + "domain_name": "Automation & Gas/Liquid Supply", + "domain_zh": "自动化与气液供给", + "path": "assets/basic40_batch02/t5_automation/alicat_mc", + "size_m": [ + 0.0911, + 0.0267, + 0.1033 + ], + "n_components": 11, + "n_mesh_parts": 11, + "n_joints": 7, + "joint_types": { + "prismatic": 7 + }, + "n_state_slots": 25, + "n_capabilities": 8, + "n_capabilities_implemented": 7, + "n_mechanisms": 2, + "n_readouts": 1, + "n_interface_points": 0, + "n_sources": 7, + "n_limitations": 17, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/basic40_batch02/t5_automation/alicat_mc/model.glb", + "urdf": "assets/basic40_batch02/t5_automation/alicat_mc/model.urdf", + "blend": "assets/basic40_batch02/t5_automation/alicat_mc/model.blend", + "contract": "assets/basic40_batch02/t5_automation/alicat_mc/asset.contract.json", + "runtime": "scripts/basic40_runtime_automation.py" + }, + "thumb": "media/thumb/alicat_mc_1slpm_rev6.webp", + "hero": "media/hero/alicat_mc_1slpm_rev6.webp" + }, + { + "id": "instrument.bronkhorst_p702cv_5bar_gauge_n2", + "slug": "bronkhorst_p702cv_5bar_gauge_n2", + "chem_id": "CHEM-181", + "name": "Electronic back-pressure controller", + "maker": "Bronkhorst", + "model": "EL-PRESS P-702CV", + "title": "Bronkhorst EL-PRESS P-702CV", + "name_zh": "电子背压控制器", + "domain": "automation", + "domain_name": "Automation & Gas/Liquid Supply", + "domain_zh": "自动化与气液供给", + "path": "assets/basic40_batch02/t5_automation/bronkhorst_p702cv", + "size_m": [ + 0.127, + 0.025, + 0.123 + ], + "n_components": 11, + "n_mesh_parts": 10, + "n_joints": 1, + "joint_types": { + "prismatic": 1 + }, + "n_state_slots": 18, + "n_capabilities": 9, + "n_capabilities_implemented": 9, + "n_mechanisms": 1, + "n_readouts": 0, + "n_interface_points": 0, + "n_sources": 9, + "n_limitations": 16, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/basic40_batch02/t5_automation/bronkhorst_p702cv/model.glb", + "urdf": "assets/basic40_batch02/t5_automation/bronkhorst_p702cv/model.urdf", + "blend": "assets/basic40_batch02/t5_automation/bronkhorst_p702cv/model.blend", + "contract": "assets/basic40_batch02/t5_automation/bronkhorst_p702cv/asset.contract.json", + "runtime": "scripts/basic40_runtime_automation.py" + }, + "thumb": "media/thumb/bronkhorst_p702cv_5bar_gauge_n2.webp", + "hero": "media/hero/bronkhorst_p702cv_5bar_gauge_n2.webp" + }, + { + "id": "instrument.vici_euta_2sd6mwe", + "slug": "vici_euta_2sd6mwe", + "chem_id": "CHEM-182", + "name": "Multi-position gas stream-selection valve", + "maker": "VICI Valco", + "model": "EUTA-2SD6MWE", + "title": "VICI Valco EUTA-2SD6MWE", + "name_zh": "多路气体自动切换阀 — VICI Valco EUTA-2SD6MWE(6位,2 inch隔热杆)", + "domain": "automation", + "domain_name": "Automation & Gas/Liquid Supply", + "domain_zh": "自动化与气液供给", + "path": "assets/basic40_batch02/t5_automation/vici_euta", + "size_m": [ + 0.2338, + 0.086, + 0.105 + ], + "n_components": 15, + "n_mesh_parts": 14, + "n_joints": 1, + "joint_types": { + "continuous": 1 + }, + "n_state_slots": 8, + "n_capabilities": 3, + "n_capabilities_implemented": 3, + "n_mechanisms": 1, + "n_readouts": 0, + "n_interface_points": 7, + "n_sources": 10, + "n_limitations": 14, + "isaac_lab": "bridged", + "glb_up": "y", + "output_templates": false, + "files": { + "glb": "assets/basic40_batch02/t5_automation/vici_euta/model.glb", + "urdf": "assets/basic40_batch02/t5_automation/vici_euta/model.urdf", + "blend": "assets/basic40_batch02/t5_automation/vici_euta/model.blend", + "contract": "assets/basic40_batch02/t5_automation/vici_euta/asset.contract.json", + "runtime": "scripts/basic40_runtime_automation.py" + }, + "thumb": "media/thumb/vici_euta_2sd6mwe.webp", + "hero": "media/hero/vici_euta_2sd6mwe.webp" + }, + { + "id": "instrument.bronkhorst_cemw", + "slug": "bronkhorst_cemw", + "chem_id": "CHEM-183", + "name": "Controlled evaporator & mixer", + "maker": "Bronkhorst", + "model": "CEM W-202A", + "title": "Bronkhorst CEM W-202A", + "name_zh": "受控蒸发与混气进料器Bronkhorst CEM W-202A-NN0-K(三通混合阀+100 W换热器)", + "domain": "automation", + "domain_name": "Automation & Gas/Liquid Supply", + "domain_zh": "自动化与气液供给", + "path": "assets/expansion_batch03/t5_automation/bronkhorst_cemw", + "size_m": [ + 0.12, + 0.11, + 0.3819 + ], + "n_components": 16, + "n_mesh_parts": 16, + "n_joints": 1, + "joint_types": { + "revolute": 1 + }, + "n_state_slots": 20, + "n_capabilities": 21, + "n_capabilities_implemented": 16, + "n_mechanisms": 1, + "n_readouts": 0, + "n_interface_points": 6, + "n_sources": 12, + "n_limitations": 21, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": true, + "files": { + "glb": "assets/expansion_batch03/t5_automation/bronkhorst_cemw/model.glb", + "urdf": "assets/expansion_batch03/t5_automation/bronkhorst_cemw/model.urdf", + "blend": "assets/expansion_batch03/t5_automation/bronkhorst_cemw/model.blend", + "contract": "assets/expansion_batch03/t5_automation/bronkhorst_cemw/asset.contract.json", + "runtime": "scripts/asset_runtime/bronkhorst_cemw.py" + }, + "thumb": "media/thumb/bronkhorst_cemw.webp", + "hero": "media/hero/bronkhorst_cemw.webp" + }, + { + "id": "instrument.newera_ne1000", + "slug": "newera_ne1000", + "chem_id": "CHEM-184", + "name": "Programmable syringe pump", + "maker": "New Era Pump Systems", + "model": "NE-1000 Multi-Phaser", + "title": "New Era Pump Systems NE-1000 Multi-Phaser", + "name_zh": "可编程注射泵New Era NE-1000 Multi-Phaser(单通道,12 V DC)", + "domain": "automation", + "domain_name": "Automation & Gas/Liquid Supply", + "domain_zh": "自动化与气液供给", + "path": "assets/expansion_batch05/t5_automation/newera_ne1000", + "size_m": [ + 0.2965, + 0.1527, + 0.1151 + ], + "n_components": 47, + "n_mesh_parts": 47, + "n_joints": 12, + "joint_types": { + "prismatic": 12 + }, + "n_state_slots": 31, + "n_capabilities": 35, + "n_capabilities_implemented": 28, + "n_mechanisms": 1, + "n_readouts": 10, + "n_interface_points": 9, + "n_sources": 15, + "n_limitations": 28, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": true, + "files": { + "glb": "assets/expansion_batch05/t5_automation/newera_ne1000/model.glb", + "urdf": "assets/expansion_batch05/t5_automation/newera_ne1000/model.urdf", + "blend": "assets/expansion_batch05/t5_automation/newera_ne1000/model.blend", + "contract": "assets/expansion_batch05/t5_automation/newera_ne1000/asset.contract.json", + "runtime": "scripts/asset_runtime/newera_ne1000.py" + }, + "thumb": "media/thumb/newera_ne1000.webp", + "hero": "media/hero/newera_ne1000.webp" + }, + { + "id": "instrument.nabertherm_l9", + "slug": "nabertherm_l9", + "chem_id": "CHEM-185", + "name": "Muffle furnace", + "maker": "Nabertherm", + "model": "L 9/11/SKM", + "title": "Nabertherm L 9/11/SKM", + "name_zh": "Nabertherm L 9/11/SKM 马弗炉(目录版 3.4 kW)", + "domain": "facility", + "domain_name": "Lab Environment & Utilities", + "domain_zh": "环境与公用系统", + "path": "assets/basic40_batch02/t1_thermal/nabertherm_l9", + "size_m": [ + 0.49, + 0.505, + 0.58 + ], + "n_components": 10, + "n_mesh_parts": 10, + "n_joints": 7, + "joint_types": { + "revolute": 1, + "prismatic": 6 + }, + "n_state_slots": 12, + "n_capabilities": 10, + "n_capabilities_implemented": 7, + "n_mechanisms": 1, + "n_readouts": 1, + "n_interface_points": 4, + "n_sources": 8, + "n_limitations": 14, + "isaac_lab": "full", + "glb_up": "y", + "output_templates": false, + "files": { + "glb": "assets/basic40_batch02/t1_thermal/nabertherm_l9/model.glb", + "urdf": "assets/basic40_batch02/t1_thermal/nabertherm_l9/model.urdf", + "blend": "assets/basic40_batch02/t1_thermal/nabertherm_l9/model.blend", + "contract": "assets/basic40_batch02/t1_thermal/nabertherm_l9/asset.contract.json", + "runtime": "scripts/basic40_runtime_thermal.py" + }, + "thumb": "media/thumb/nabertherm_l9.webp", + "hero": "media/hero/nabertherm_l9.webp" + }, + { + "id": "instrument.carbolite_tf1_12_60_300", + "slug": "carbolite_tf1_12_60_300", + "chem_id": "CHEM-186", + "name": "Tube furnace (controlled atmosphere)", + "maker": "Carbolite Gero", + "model": "TF1 12/60/300", + "title": "Carbolite Gero TF1 12/60/300", + "name_zh": "管式气氛炉 Carbolite Gero TF1 12/60/300", + "domain": "facility", + "domain_name": "Lab Environment & Utilities", + "domain_zh": "环境与公用系统", + "path": "assets/basic40_batch02/t1_thermal/carbolite_tf1", + "size_m": [ + 0.876, + 0.48, + 0.575 + ], + "n_components": 19, + "n_mesh_parts": 19, + "n_joints": 6, + "joint_types": { + "prismatic": 6 + }, + "n_state_slots": 14, + "n_capabilities": 5, + "n_capabilities_implemented": 5, + "n_mechanisms": 2, + "n_readouts": 1, + "n_interface_points": 1, + "n_sources": 13, + "n_limitations": 16, + "isaac_lab": "partial", + "glb_up": "y", + "output_templates": false, + "files": { + "glb": "assets/basic40_batch02/t1_thermal/carbolite_tf1/model.glb", + "urdf": "assets/basic40_batch02/t1_thermal/carbolite_tf1/model.urdf", + "blend": "assets/basic40_batch02/t1_thermal/carbolite_tf1/model.blend", + "contract": "assets/basic40_batch02/t1_thermal/carbolite_tf1/asset.contract.json", + "runtime": "scripts/basic40_runtime_thermal.py" + }, + "thumb": "media/thumb/carbolite_tf1_12_60_300.webp", + "hero": "media/hero/carbolite_tf1_12_60_300.webp" + }, + { + "id": "instrument.julabo_corio_cd200f", + "slug": "julabo_corio_cd200f", + "chem_id": "CHEM-187", + "name": "Heating/refrigerated circulator", + "maker": "JULABO", + "model": "CORIO CD-200F", + "title": "JULABO CORIO CD-200F", + "name_zh": "JULABO CORIO CD-200F 9012701.N1.03 加热制冷循环浴", + "domain": "facility", + "domain_name": "Lab Environment & Utilities", + "domain_zh": "环境与公用系统", + "path": "assets/basic40_batch02/t1_thermal/julabo_corio_cd200f", + "size_m": [ + 0.23, + 0.3898, + 0.65 + ], + "n_components": 20, + "n_mesh_parts": 20, + "n_joints": 6, + "joint_types": { + "revolute": 2, + "prismatic": 4 + }, + "n_state_slots": 15, + "n_capabilities": 4, + "n_capabilities_implemented": 4, + "n_mechanisms": 2, + "n_readouts": 1, + "n_interface_points": 1, + "n_sources": 13, + "n_limitations": 11, + "isaac_lab": "bridged", + "glb_up": "y", + "output_templates": false, + "files": { + "glb": "assets/basic40_batch02/t1_thermal/julabo_corio_cd200f/model.glb", + "urdf": "assets/basic40_batch02/t1_thermal/julabo_corio_cd200f/model.urdf", + "blend": "assets/basic40_batch02/t1_thermal/julabo_corio_cd200f/model.blend", + "contract": "assets/basic40_batch02/t1_thermal/julabo_corio_cd200f/asset.contract.json", + "runtime": "scripts/basic40_runtime_thermal.py" + }, + "thumb": "media/thumb/julabo_corio_cd200f.webp", + "hero": "media/hero/julabo_corio_cd200f.webp" + }, + { + "id": "instrument.vacuubrand_pc3001_vario_select", + "slug": "vacuubrand_pc3001_vario_select", + "chem_id": "CHEM-188", + "name": "Chemistry vacuum pumping unit", + "maker": "VACUUBRAND", + "model": "PC 3001 VARIO select", + "title": "VACUUBRAND PC 3001 VARIO select", + "name_zh": "化学耐腐蚀真空工作站", + "domain": "facility", + "domain_name": "Lab Environment & Utilities", + "domain_zh": "环境与公用系统", + "path": "assets/basic40_batch02/t2_vacuum/vacuubrand_pc3001", + "size_m": [ + 0.306, + 0.303, + 0.4 + ], + "n_components": 15, + "n_mesh_parts": 15, + "n_joints": 3, + "joint_types": { + "revolute": 1, + "prismatic": 2 + }, + "n_state_slots": 12, + "n_capabilities": 7, + "n_capabilities_implemented": 6, + "n_mechanisms": 1, + "n_readouts": 1, + "n_interface_points": 0, + "n_sources": 11, + "n_limitations": 14, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/basic40_batch02/t2_vacuum/vacuubrand_pc3001/model.glb", + "urdf": "assets/basic40_batch02/t2_vacuum/vacuubrand_pc3001/model.urdf", + "blend": "assets/basic40_batch02/t2_vacuum/vacuubrand_pc3001/model.blend", + "contract": "assets/basic40_batch02/t2_vacuum/vacuubrand_pc3001/asset.contract.json", + "runtime": "scripts/basic40_runtime_vacuum.py" + }, + "thumb": "media/thumb/vacuubrand_pc3001_vario_select.webp", + "hero": "media/hero/vacuubrand_pc3001_vario_select.webp" + }, + { + "id": "instrument.inert_purelab_he_2gb", + "slug": "inert_purelab_he_2gb", + "chem_id": "CHEM-189", + "name": "Inert-atmosphere glovebox", + "maker": "Inert", + "model": "PureLab HE 2GB", + "title": "Inert PureLab HE 2GB", + "name_zh": "Inert PureLab HE 2GB 惰性气氛手套箱", + "domain": "facility", + "domain_name": "Lab Environment & Utilities", + "domain_zh": "环境与公用系统", + "path": "assets/basic40_batch02/t2_vacuum/inert_purelab_he", + "size_m": [ + 2.0, + 1.067, + 1.921 + ], + "n_components": 15, + "n_mesh_parts": 15, + "n_joints": 2, + "joint_types": { + "revolute": 2 + }, + "n_state_slots": 27, + "n_capabilities": 10, + "n_capabilities_implemented": 9, + "n_mechanisms": 3, + "n_readouts": 1, + "n_interface_points": 9, + "n_sources": 7, + "n_limitations": 12, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/basic40_batch02/t2_vacuum/inert_purelab_he/model.glb", + "urdf": "assets/basic40_batch02/t2_vacuum/inert_purelab_he/model.urdf", + "blend": "assets/basic40_batch02/t2_vacuum/inert_purelab_he/model.blend", + "contract": "assets/basic40_batch02/t2_vacuum/inert_purelab_he/asset.contract.json", + "runtime": "scripts/basic40_runtime_vacuum.py" + }, + "thumb": "media/thumb/inert_purelab_he_2gb.webp", + "hero": "media/hero/inert_purelab_he_2gb.webp" + }, + { + "id": "instrument.elga_purelab_flex3", + "slug": "elga_purelab_flex3", + "chem_id": "CHEM-190", + "name": "Lab ultrapure water system", + "maker": "ELGA LabWater", + "model": "PURELAB flex 3", + "title": "ELGA LabWater PURELAB flex 3", + "name_zh": "实验室超纯水系统", + "domain": "facility", + "domain_name": "Lab Environment & Utilities", + "domain_zh": "环境与公用系统", + "path": "assets/basic40_batch02/t2_vacuum/elga_purelab_flex3", + "size_m": [ + 0.236, + 0.47, + 0.9 + ], + "n_components": 17, + "n_mesh_parts": 17, + "n_joints": 6, + "joint_types": { + "prismatic": 6 + }, + "n_state_slots": 26, + "n_capabilities": 8, + "n_capabilities_implemented": 8, + "n_mechanisms": 1, + "n_readouts": 0, + "n_interface_points": 1, + "n_sources": 7, + "n_limitations": 19, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": false, + "files": { + "glb": "assets/basic40_batch02/t2_vacuum/elga_purelab_flex3/model.glb", + "urdf": "assets/basic40_batch02/t2_vacuum/elga_purelab_flex3/model.urdf", + "blend": "assets/basic40_batch02/t2_vacuum/elga_purelab_flex3/model.blend", + "contract": "assets/basic40_batch02/t2_vacuum/elga_purelab_flex3/asset.contract.json", + "runtime": "scripts/basic40_runtime_vacuum.py" + }, + "thumb": "media/thumb/elga_purelab_flex3.webp", + "hero": "media/hero/elga_purelab_flex3.webp" + }, + { + "id": "instrument.miele_plw6111", + "slug": "miele_plw6111", + "chem_id": "CHEM-191", + "name": "Laboratory glassware washer", + "maker": "Miele", + "model": "PLW 6111", + "title": "Miele PLW 6111", + "name_zh": "Miele PLW 6111 DP SC CL H14 10958380 实验室玻璃器皿清洗机", + "domain": "facility", + "domain_name": "Lab Environment & Utilities", + "domain_zh": "环境与公用系统", + "path": "assets/basic40_batch02/t1_thermal/miele_plw6111", + "size_m": [ + 0.65, + 0.744, + 1.87 + ], + "n_components": 29, + "n_mesh_parts": 29, + "n_joints": 7, + "joint_types": { + "revolute": 1, + "prismatic": 6 + }, + "n_state_slots": 20, + "n_capabilities": 8, + "n_capabilities_implemented": 8, + "n_mechanisms": 2, + "n_readouts": 0, + "n_interface_points": 27, + "n_sources": 9, + "n_limitations": 25, + "isaac_lab": "bridged", + "glb_up": "y", + "output_templates": false, + "files": { + "glb": "assets/basic40_batch02/t1_thermal/miele_plw6111/model.glb", + "urdf": "assets/basic40_batch02/t1_thermal/miele_plw6111/model.urdf", + "blend": "assets/basic40_batch02/t1_thermal/miele_plw6111/model.blend", + "contract": "assets/basic40_batch02/t1_thermal/miele_plw6111/asset.contract.json", + "runtime": "scripts/basic40_runtime_thermal.py" + }, + "thumb": "media/thumb/miele_plw6111.webp", + "hero": "media/hero/miele_plw6111.webp" + }, + { + "id": "instrument.tuttnauer_3870elvd", + "slug": "tuttnauer_3870elvd", + "chem_id": "CHEM-192", + "name": "Steam autoclave", + "maker": "Tuttnauer", + "model": "3870ELV-D", + "title": "Tuttnauer 3870ELV-D", + "name_zh": "立式高压蒸汽灭菌器Tuttnauer 3870ELV-D(85 L,冷却选件)", + "domain": "facility", + "domain_name": "Lab Environment & Utilities", + "domain_zh": "环境与公用系统", + "path": "assets/expansion_batch03/t2_vacuum/tuttnauer_3870elvd", + "size_m": [ + 0.731, + 0.555, + 1.0 + ], + "n_components": 21, + "n_mesh_parts": 21, + "n_joints": 5, + "joint_types": { + "revolute": 2, + "prismatic": 3 + }, + "n_state_slots": 19, + "n_capabilities": 24, + "n_capabilities_implemented": 18, + "n_mechanisms": 1, + "n_readouts": 1, + "n_interface_points": 9, + "n_sources": 16, + "n_limitations": 23, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": true, + "files": { + "glb": "assets/expansion_batch03/t2_vacuum/tuttnauer_3870elvd/model.glb", + "urdf": "assets/expansion_batch03/t2_vacuum/tuttnauer_3870elvd/model.urdf", + "blend": "assets/expansion_batch03/t2_vacuum/tuttnauer_3870elvd/model.blend", + "contract": "assets/expansion_batch03/t2_vacuum/tuttnauer_3870elvd/asset.contract.json", + "runtime": "scripts/asset_runtime/tuttnauer_3870elvd.py" + }, + "thumb": "media/thumb/tuttnauer_3870elvd.webp", + "hero": "media/hero/tuttnauer_3870elvd.webp" + }, + { + "id": "instrument.esco_ac24s8", + "slug": "esco_ac24s8", + "chem_id": "CHEM-193", + "name": "Biological safety cabinet", + "maker": "Esco Lifesciences", + "model": "AC2-4S8-TU", + "title": "Esco Lifesciences AC2-4S8-TU", + "name_zh": "生物安全柜Esco Airstream Plus AC2-4S8-TU(II级A2型,4 ft,不锈钢侧壁,UV-30A)", + "domain": "facility", + "domain_name": "Lab Environment & Utilities", + "domain_zh": "环境与公用系统", + "path": "assets/expansion_batch04/t2_vacuum/esco_ac24s8", + "size_m": [ + 1.34, + 0.823, + 1.4 + ], + "n_components": 40, + "n_mesh_parts": 40, + "n_joints": 9, + "joint_types": { + "prismatic": 9 + }, + "n_state_slots": 30, + "n_capabilities": 24, + "n_capabilities_implemented": 20, + "n_mechanisms": 1, + "n_readouts": 7, + "n_interface_points": 7, + "n_sources": 12, + "n_limitations": 25, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": true, + "files": { + "glb": "assets/expansion_batch04/t2_vacuum/esco_ac24s8/model.glb", + "urdf": "assets/expansion_batch04/t2_vacuum/esco_ac24s8/model.urdf", + "blend": "assets/expansion_batch04/t2_vacuum/esco_ac24s8/model.blend", + "contract": "assets/expansion_batch04/t2_vacuum/esco_ac24s8/asset.contract.json", + "runtime": "scripts/asset_runtime/esco_ac24s8.py" + }, + "thumb": "media/thumb/esco_ac24s8.webp", + "hero": "media/hero/esco_ac24s8.webp" + }, + { + "id": "instrument.inficon_ul1000fab", + "slug": "inficon_ul1000fab", + "chem_id": "CHEM-194", + "name": "Helium leak detector", + "maker": "INFICON", + "model": "UL1000 Fab", + "title": "INFICON UL1000 Fab", + "name_zh": "氦质谱检漏仪INFICON UL1000 Fab(移动式,干式涡旋泵,230 V 50 Hz)", + "domain": "facility", + "domain_name": "Lab Environment & Utilities", + "domain_zh": "环境与公用系统", + "path": "assets/expansion_batch04/t2_vacuum/inficon_ul1000fab", + "size_m": [ + 1.068, + 0.525, + 0.85 + ], + "n_components": 27, + "n_mesh_parts": 27, + "n_joints": 6, + "joint_types": { + "prismatic": 5, + "revolute": 1 + }, + "n_state_slots": 28, + "n_capabilities": 26, + "n_capabilities_implemented": 22, + "n_mechanisms": 1, + "n_readouts": 4, + "n_interface_points": 6, + "n_sources": 15, + "n_limitations": 22, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": true, + "files": { + "glb": "assets/expansion_batch04/t2_vacuum/inficon_ul1000fab/model.glb", + "urdf": "assets/expansion_batch04/t2_vacuum/inficon_ul1000fab/model.urdf", + "blend": "assets/expansion_batch04/t2_vacuum/inficon_ul1000fab/model.blend", + "contract": "assets/expansion_batch04/t2_vacuum/inficon_ul1000fab/asset.contract.json", + "runtime": "scripts/asset_runtime/inficon_ul1000fab.py" + }, + "thumb": "media/thumb/inficon_ul1000fab.webp", + "hero": "media/hero/inficon_ul1000fab.webp" + }, + { + "id": "instrument.vaisala_dmt152", + "slug": "vaisala_dmt152", + "chem_id": "CHEM-195", + "name": "Trace-moisture dew-point transmitter", + "maker": "Vaisala", + "model": "DMT152", + "title": "Vaisala DMT152", + "name_zh": "微量水露点变送器Vaisala DRYCAP DMT152(ISO G1/2\")", + "domain": "facility", + "domain_name": "Lab Environment & Utilities", + "domain_zh": "环境与公用系统", + "path": "assets/expansion_batch04/t2_vacuum/vaisala_dmt152", + "size_m": [ + 0.1275, + 0.033, + 0.03 + ], + "n_components": 11, + "n_mesh_parts": 11, + "n_joints": 1, + "joint_types": { + "prismatic": 1 + }, + "n_state_slots": 25, + "n_capabilities": 21, + "n_capabilities_implemented": 17, + "n_mechanisms": 1, + "n_readouts": 0, + "n_interface_points": 2, + "n_sources": 16, + "n_limitations": 26, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": true, + "files": { + "glb": "assets/expansion_batch04/t2_vacuum/vaisala_dmt152/model.glb", + "urdf": "assets/expansion_batch04/t2_vacuum/vaisala_dmt152/model.urdf", + "blend": "assets/expansion_batch04/t2_vacuum/vaisala_dmt152/model.blend", + "contract": "assets/expansion_batch04/t2_vacuum/vaisala_dmt152/asset.contract.json", + "runtime": "scripts/asset_runtime/vaisala_dmt152.py" + }, + "thumb": "media/thumb/vaisala_dmt152.webp", + "hero": "media/hero/vaisala_dmt152.webp" + }, + { + "id": "instrument.peak_precisionhydrogen", + "slug": "peak_precisionhydrogen", + "chem_id": "CHEM-196", + "name": "Laboratory hydrogen generator", + "maker": "PEAK Scientific", + "model": "Precision Hydrogen Trace 500", + "title": "PEAK Scientific Precision Hydrogen Trace 500", + "name_zh": "实验室氢气发生器PEAK Precision Hydrogen Trace 500(存档型号)", + "domain": "facility", + "domain_name": "Lab Environment & Utilities", + "domain_zh": "环境与公用系统", + "path": "assets/expansion_batch04/t2_vacuum/peak_precisionhydrogen", + "size_m": [ + 0.3814, + 0.5656, + 0.4067 + ], + "n_components": 22, + "n_mesh_parts": 22, + "n_joints": 2, + "joint_types": { + "prismatic": 2 + }, + "n_state_slots": 23, + "n_capabilities": 21, + "n_capabilities_implemented": 17, + "n_mechanisms": 1, + "n_readouts": 7, + "n_interface_points": 5, + "n_sources": 13, + "n_limitations": 23, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": true, + "files": { + "glb": "assets/expansion_batch04/t2_vacuum/peak_precisionhydrogen/model.glb", + "urdf": "assets/expansion_batch04/t2_vacuum/peak_precisionhydrogen/model.urdf", + "blend": "assets/expansion_batch04/t2_vacuum/peak_precisionhydrogen/model.blend", + "contract": "assets/expansion_batch04/t2_vacuum/peak_precisionhydrogen/asset.contract.json", + "runtime": "scripts/asset_runtime/peak_precisionhydrogen.py" + }, + "thumb": "media/thumb/peak_precisionhydrogen.webp", + "hero": "media/hero/peak_precisionhydrogen.webp" + }, + { + "id": "instrument.eppendorf_cryocubef570n", + "slug": "eppendorf_cryocubef570n", + "chem_id": "CHEM-197", + "name": "Ultra-low temperature freezer", + "maker": "Eppendorf", + "model": "CryoCube F570n", + "title": "Eppendorf CryoCube F570n", + "name_zh": "超低温冰箱Eppendorf CryoCube F570n(570 L,230 V,F571300031)", + "domain": "facility", + "domain_name": "Lab Environment & Utilities", + "domain_zh": "环境与公用系统", + "path": "assets/expansion_batch04/t2_vacuum/eppendorf_cryocubef570n", + "size_m": [ + 1.1415, + 1.009, + 1.95 + ], + "n_components": 41, + "n_mesh_parts": 41, + "n_joints": 12, + "joint_types": { + "revolute": 7, + "prismatic": 5 + }, + "n_state_slots": 35, + "n_capabilities": 34, + "n_capabilities_implemented": 28, + "n_mechanisms": 1, + "n_readouts": 8, + "n_interface_points": 11, + "n_sources": 12, + "n_limitations": 23, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": true, + "files": { + "glb": "assets/expansion_batch04/t2_vacuum/eppendorf_cryocubef570n/model.glb", + "urdf": "assets/expansion_batch04/t2_vacuum/eppendorf_cryocubef570n/model.urdf", + "blend": "assets/expansion_batch04/t2_vacuum/eppendorf_cryocubef570n/model.blend", + "contract": "assets/expansion_batch04/t2_vacuum/eppendorf_cryocubef570n/asset.contract.json", + "runtime": "scripts/asset_runtime/eppendorf_cryocubef570n.py" + }, + "thumb": "media/thumb/eppendorf_cryocubef570n.webp", + "hero": "media/hero/eppendorf_cryocubef570n.webp" + }, + { + "id": "instrument.binder_kbf115", + "slug": "binder_kbf115", + "chem_id": "CHEM-198", + "name": "Constant climate (T/RH) chamber", + "maker": "BINDER", + "model": "KBF 115", + "title": "BINDER KBF 115", + "name_zh": "恒温恒湿试验箱BINDER KBF 115(102 L,KBF115-230V,9020-0320)", + "domain": "facility", + "domain_name": "Lab Environment & Utilities", + "domain_zh": "环境与公用系统", + "path": "assets/expansion_batch04/t2_vacuum/binder_kbf115", + "size_m": [ + 0.9055, + 0.7971, + 1.05 + ], + "n_components": 31, + "n_mesh_parts": 31, + "n_joints": 3, + "joint_types": { + "revolute": 2, + "prismatic": 1 + }, + "n_state_slots": 33, + "n_capabilities": 33, + "n_capabilities_implemented": 26, + "n_mechanisms": 1, + "n_readouts": 6, + "n_interface_points": 7, + "n_sources": 16, + "n_limitations": 29, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": true, + "files": { + "glb": "assets/expansion_batch04/t2_vacuum/binder_kbf115/model.glb", + "urdf": "assets/expansion_batch04/t2_vacuum/binder_kbf115/model.urdf", + "blend": "assets/expansion_batch04/t2_vacuum/binder_kbf115/model.blend", + "contract": "assets/expansion_batch04/t2_vacuum/binder_kbf115/asset.contract.json", + "runtime": "scripts/asset_runtime/binder_kbf115.py" + }, + "thumb": "media/thumb/binder_kbf115.webp", + "hero": "media/hero/binder_kbf115.webp" + }, + { + "id": "instrument.esco_efa5uduvw", + "slug": "esco_efa5uduvw", + "chem_id": "CHEM-199", + "name": "Chemical fume hood", + "maker": "Esco Lifesciences", + "model": "Frontier Acela EFA-5UDUVW-9", + "title": "Esco Lifesciences Frontier Acela EFA-5UDUVW-9", + "name_zh": "台式化学通风柜Esco Frontier Acela EFA-5UDUVW-9(1.5 m美国版,选配Sentinel XL风速监视器)", + "domain": "facility", + "domain_name": "Lab Environment & Utilities", + "domain_zh": "环境与公用系统", + "path": "assets/expansion_batch05/t2_vacuum/esco_efa5uduvw", + "size_m": [ + 1.602, + 0.9097, + 1.521 + ], + "n_components": 39, + "n_mesh_parts": 39, + "n_joints": 11, + "joint_types": { + "prismatic": 9, + "revolute": 2 + }, + "n_state_slots": 32, + "n_capabilities": 32, + "n_capabilities_implemented": 27, + "n_mechanisms": 1, + "n_readouts": 6, + "n_interface_points": 10, + "n_sources": 14, + "n_limitations": 30, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": true, + "files": { + "glb": "assets/expansion_batch05/t2_vacuum/esco_efa5uduvw/model.glb", + "urdf": "assets/expansion_batch05/t2_vacuum/esco_efa5uduvw/model.urdf", + "blend": "assets/expansion_batch05/t2_vacuum/esco_efa5uduvw/model.blend", + "contract": "assets/expansion_batch05/t2_vacuum/esco_efa5uduvw/asset.contract.json", + "runtime": "scripts/asset_runtime/esco_efa5uduvw.py" + }, + "thumb": "media/thumb/esco_efa5uduvw.webp", + "hero": "media/hero/esco_efa5uduvw.webp" + }, + { + "id": "instrument.inert_puresolvmd", + "slug": "inert_puresolvmd", + "chem_id": "CHEM-200", + "name": "Solvent purification system", + "maker": "Inert", + "model": "PureSolv MD 7", + "title": "Inert PureSolv MD 7", + "name_zh": "溶剂纯化系统Inert PureSolv MD 7(7路溶剂,双柱,17 L储罐)", + "domain": "facility", + "domain_name": "Lab Environment & Utilities", + "domain_zh": "环境与公用系统", + "path": "assets/expansion_batch04/t2_vacuum/inert_puresolvmd", + "size_m": [ + 1.6104, + 0.8356, + 1.9459 + ], + "n_components": 84, + "n_mesh_parts": 84, + "n_joints": 27, + "joint_types": { + "revolute": 26, + "prismatic": 1 + }, + "n_state_slots": 67, + "n_capabilities": 23, + "n_capabilities_implemented": 19, + "n_mechanisms": 1, + "n_readouts": 0, + "n_interface_points": 18, + "n_sources": 14, + "n_limitations": 26, + "isaac_lab": "bridged", + "glb_up": "z", + "output_templates": true, + "files": { + "glb": "assets/expansion_batch04/t2_vacuum/inert_puresolvmd/model.glb", + "urdf": "assets/expansion_batch04/t2_vacuum/inert_puresolvmd/model.urdf", + "blend": "assets/expansion_batch04/t2_vacuum/inert_puresolvmd/model.blend", + "contract": "assets/expansion_batch04/t2_vacuum/inert_puresolvmd/asset.contract.json", + "runtime": "scripts/asset_runtime/inert_puresolvmd.py" + }, + "thumb": "media/thumb/inert_puresolvmd.webp", + "hero": "media/hero/inert_puresolvmd.webp" + }, + { + "id": "instrument.agilent_7890b_ssl_fid", + "slug": "agilent_7890b_ssl_fid", + "chem_id": null, + "name": "Gas chromatograph (S/SL inlet + FID)", + "maker": "Agilent", + "model": "7890B", + "title": "Agilent 7890B", + "name_zh": "Agilent 7890B 气相色谱仪(单 S/SL 进样口 + FID)", + "domain": "chromatography", + "domain_name": "Chromatography & Electrophoresis", + "domain_zh": "色谱与电泳分离", + "path": "assets/GC7890B", + "size_m": [ + 0.5803, + 0.545, + 0.4905 + ], + "n_components": 52, + "n_mesh_parts": 0, + "n_joints": 50, + "joint_types": { + "revolute": 3, + "prismatic": 47 + }, + "n_state_slots": 0, + "n_capabilities": 16, + "n_capabilities_implemented": 14, + "n_mechanisms": 1, + "n_readouts": 3, + "n_interface_points": 1, + "n_sources": 0, + "n_limitations": 1, + "isaac_lab": "full", + "glb_up": "y", + "output_templates": false, + "files": { + "glb": "assets/GC7890B/GC7890B.glb", + "urdf": "assets/GC7890B/GC7890B.urdf", + "blend": "assets/GC7890B/GC7890B.blend" + }, + "thumb": "media/thumb/agilent_7890b_ssl_fid.webp", + "hero": "media/hero/agilent_7890b_ssl_fid.webp" + }, + { + "id": "instrument.ohaus_px224e", + "slug": "ohaus_px224e", + "chem_id": null, + "name": "Analytical balance", + "maker": "OHAUS", + "model": "Pioneer PX224/E", + "title": "OHAUS Pioneer PX224/E", + "name_zh": "OHAUS Pioneer PX224/E 分析天平", + "domain": "metrology", + "domain_name": "Basic Metrology & Sample Handling", + "domain_zh": "基础计量与样品处理", + "path": "assets/PX224E", + "size_m": [ + 0.209, + 0.3285, + 0.309 + ], + "n_components": 25, + "n_mesh_parts": 0, + "n_joints": 16, + "joint_types": { + "prismatic": 12, + "revolute": 4 + }, + "n_state_slots": 0, + "n_capabilities": 7, + "n_capabilities_implemented": 5, + "n_mechanisms": 0, + "n_readouts": 1, + "n_interface_points": 1, + "n_sources": 0, + "n_limitations": 0, + "isaac_lab": "partial", + "glb_up": "y", + "output_templates": false, + "files": { + "glb": "assets/PX224E/PX224E.glb", + "urdf": "assets/PX224E/PX224E.urdf" + }, + "thumb": "media/thumb/ohaus_px224e.webp", + "hero": "media/hero/ohaus_px224e.webp" + }, + { + "id": "instrument.ohaus_spx2201", + "slug": "ohaus_spx2201", + "chem_id": null, + "name": "Portable precision balance", + "maker": "OHAUS", + "model": "Scout SPX2201", + "title": "OHAUS Scout SPX2201", + "name_zh": "OHAUS Scout SPX2201 电子天平", + "domain": "metrology", + "domain_name": "Basic Metrology & Sample Handling", + "domain_zh": "基础计量与样品处理", + "path": "assets/SPX2201", + "size_m": [ + 0.202, + 0.2255, + 0.054 + ], + "n_components": 23, + "n_mesh_parts": 0, + "n_joints": 15, + "joint_types": { + "prismatic": 9, + "revolute": 6 + }, + "n_state_slots": 0, + "n_capabilities": 7, + "n_capabilities_implemented": 5, + "n_mechanisms": 0, + "n_readouts": 1, + "n_interface_points": 1, + "n_sources": 0, + "n_limitations": 0, + "isaac_lab": "partial", + "glb_up": "y", + "output_templates": false, + "files": { + "glb": "assets/SPX2201/SPX2201.glb", + "urdf": "assets/SPX2201/SPX2201.urdf" + }, + "thumb": "media/thumb/ohaus_spx2201.webp", + "hero": "media/hero/ohaus_spx2201.webp" + } + ] +} \ No newline at end of file diff --git a/examples/quickstart_fume_hood.py b/examples/quickstart_fume_hood.py new file mode 100644 index 0000000000000000000000000000000000000000..8cf982ca5650217830fa450872c11e39cc68e552 --- /dev/null +++ b/examples/quickstart_fume_hood.py @@ -0,0 +1,48 @@ +"""Drive the Esco fume hood (CHEM-199) through its contract API. + +The agent raises the sash, notices that the uncalibrated airflow monitor reads low, +measures the face velocity with a handheld anemometer and calibrates the monitor. + +Run from the repository root: python examples/quickstart_fume_hood.py +""" +import sys +from pathlib import Path + +sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "scripts")) +from asset_runtime import esco_efa5uduvw as rt # noqa: E402 + +hood = rt.EscoEfa5uduvwRuntime("hood_01") +hood.register_principal("lab", "evaluator") # sets up the world and can see hidden truth +hood.register_principal("robot", "agent") # sees only what a policy may see +lab, robot = hood.session("lab"), hood.session("robot") +_n = 0 + + +def call(session, capability, **arguments): + global _n + _n += 1 + r = session.invoke(instance_id="hood_01", capability_id=capability, arguments=arguments, request_id=f"r{_n}") + if r["status"] != "succeeded": + raise RuntimeError(f"{capability}: {r['error']}") + return r["result"] + + +def show(label): + obs = robot.read(instance_id="hood_01", state_ids=["monitor.reading_m_s", "monitor.alarm"])["observations"] + print(f"{label:20s} reading {obs['monitor.reading_m_s']['value']:.2f} m/s alarm {obs['monitor.alarm']['value'] or 'none'}") + + +call(lab, "plant.configure", **rt.PLANT_EXAMPLE) # ambient 295.15 K, 101.325 kPa +call(lab, "exhaust.configure", **rt.EXHAUST_EXAMPLE) # building exhaust, damper half open +call(robot, "light.set", on=True) +call(robot, "sash.set", height_m=0.457) # raise the sash to the 18-inch stop +call(lab, "sim.step", dt_s=30.0) # let the airflow settle +show("before calibration") + +v = call(robot, "anemometer.measure")["face_velocity_m_s"] # 18-point traverse of the sash opening +print(f"{'anemometer':20s} {v:.3f} m/s") +call(robot, "monitor.calibrate", reference_m_s=round(v, 3)) +call(lab, "sim.step", dt_s=10.0) +show("after calibration") + +print("agent-visible capabilities:", len(robot.describe(instance_id="hood_01")["capabilities"])) diff --git a/outputs/expansion_batch03/t4_measure/antonpaar_litesizerdia/example_setup.py b/outputs/expansion_batch03/t4_measure/antonpaar_litesizerdia/example_setup.py new file mode 100644 index 0000000000000000000000000000000000000000..4b94b2c60a9720a84061cbd10d7e8c8d7d2bc8ee --- /dev/null +++ b/outputs/expansion_batch03/t4_measure/antonpaar_litesizerdia/example_setup.py @@ -0,0 +1,14 @@ +from pathlib import Path +import sys +R=Path(__file__).resolve().parents[4];sys.path.insert(0,str(R));from scripts.asset_runtime.antonpaar_litesizerdia import * +OBSERVED=[] +def call(h,k,**a): + out=h.invoke(k,**a);OBSERVED.append(dict(capability_id=k,arguments=copy.deepcopy(a),result=copy.deepcopy(out)));return out +def build(mode='liquid',sid='grain_capecod',method=None,plant=None,count=128): + h=AntonpaarLitesizerdiaRuntime();call(h,'plant.configure',**dict(PLANT_EXAMPLE,**(plant or {}))) + if mode!='liquid': + call(h,'latch.set',angle_rad=.65);call(h,'module.withdraw',distance_m=.32);call(h,'module.select',mode=mode);call(h,'module.withdraw',distance_m=0.);call(h,'latch.set',angle_rad=0.) + call(h,'method.configure',**dict(METHOD_EXAMPLE,**dict({'mode':mode},**(method or {}))));call(h,'lid.set',angle_rad=1.55) + if mode=='liquid':call(h,'liquid.fill',volume_m3=.0003) + if mode=='dry':call(h,'air.add',amount_mol=1.);call(h,'vacuum.set',enabled=True) + call(h,'lid.set',angle_rad=0.);call(h,'power.set',enabled=True);call(h,'background.capture');call(h,'lid.set',angle_rad=1.55);call(h,'sample.load',**dict(SAMPLE_EXAMPLE,substance_id=sid,particle_count=count));call(h,'lid.set',angle_rad=0.);return h diff --git a/outputs/expansion_batch03/t4_measure/antonpaar_litesizerdls/example_setup.py b/outputs/expansion_batch03/t4_measure/antonpaar_litesizerdls/example_setup.py new file mode 100644 index 0000000000000000000000000000000000000000..1b71f87d6f619b5361faf54ae9667cfa69edbf8e --- /dev/null +++ b/outputs/expansion_batch03/t4_measure/antonpaar_litesizerdls/example_setup.py @@ -0,0 +1,19 @@ +from pathlib import Path +import sys,copy +R=Path(__file__).resolve().parents[4];sys.path.insert(0,str(R/'scripts'));from asset_runtime import antonpaar_litesizerdls as rt +OBSERVED=[] +def call(h,k,**a): + r=h.invoke(k,**a);OBSERVED.append(dict(capability_id=k,arguments=copy.deepcopy(a),result=copy.deepcopy(r)));return r +def configure(h,kind='omega',reference=rt.SID,mode='dls'): + call(h,'plant.configure',**rt.PLANT_EXAMPLE);call(h,'power.set',enabled=True);call(h,'lid.release');call(h,'lid.set',angle_rad=1.7);call(h,'cuvette.set',lift_m=.12);call(h,'cell.configure',kind=kind);call(h,'cell_cap.set',lift_m=.022) + sample=dict(rt.SAMPLE_EXAMPLE,reference_id=reference,volume_m3=.7e-6 if kind=='omega' else 1e-6);call(h,'sample.load',**sample);call(h,'cell_cap.set',lift_m=0.);call(h,'cuvette.set',lift_m=0.);call(h,'lid.set',angle_rad=0.) + call(h,'temperature.calibrate',reference_k=[293.15,313.15],measured_k=[293.15,313.15]);call(h,'dls.calibrate',reference_m=100e-9,measured_m=100e-9);call(h,'mobility.calibrate',reference_m2_v_s=[-1e-8,1e-8],measured_m2_v_s=[-1e-8,1e-8]);call(h,'method.configure',**dict(rt.METHOD_EXAMPLE,mode=mode,angle_deg=15 if mode=='zeta' else 90));h.step(360.) + return h +def run(h): + call(h,'acquisition.start') + while h.phase=='running':h.step(.1) + return call(h,'process.measure') +def unload(h): + call(h,'lid.release');call(h,'lid.set',angle_rad=1.7);call(h,'cuvette.set',lift_m=.12);call(h,'cell_cap.set',lift_m=.022);return call(h,'sample.unload') +if __name__=='__main__': + h=configure(rt.AntonpaarLitesizerdlsRuntime());r=run(h);print(r['phase'],r['dls']['z_average_m'],r['dls']['pdi']);call(h,'method.configure',**dict(rt.METHOD_EXAMPLE,mode='zeta',angle_deg=15));r=run(h);print(r['phase'],r['els']['zeta_v']);unload(h);print(call(h,'ledger.read')) diff --git a/outputs/expansion_batch03/t4_measure/antonpaar_poremaster60/example_setup.py b/outputs/expansion_batch03/t4_measure/antonpaar_poremaster60/example_setup.py new file mode 100644 index 0000000000000000000000000000000000000000..b592e603714c36af4480fa12a5e2b06bc16b50f0 --- /dev/null +++ b/outputs/expansion_batch03/t4_measure/antonpaar_poremaster60/example_setup.py @@ -0,0 +1,37 @@ +from pathlib import Path +import sys,copy,math +R=Path(__file__).resolve().parents[4];sys.path.insert(0,str(R/'scripts'));from asset_runtime import antonpaar_poremaster60 as rt +OBSERVED={} +def call(r,k,**a): + out=r.invoke(k,**a);OBSERVED.setdefault(k,[]).append((copy.deepcopy(a),copy.deepcopy(out)));return out +def setup(name='micp_demo',plant=None,ref='hemp_shiv',mass=None,entered_mass=None,low1=False): + r=rt.AntonpaarPoremaster60Runtime(name);p=copy.deepcopy(rt.PLANT_EXAMPLE) + if plant:p.update(plant) + call(r,'plant.configure',**p);call(r,'cell.configure',bulb_volume_m3=3.2e-6,stem_capacity_m3=.5e-6);call(r,'power.set',enabled=True) + for i in range(3): + xmax=[50*rt.PSI,1500*rt.PSI,rt.P_MAX][i];xs=[0.,xmax];call(r,'pressure.calibrate',range_index=i,reference_pa=xs,measured_pa=[p['pressure_gain'][i]*x+p['pressure_offset_pa'][i] for x in xs]) + xs=[0.,.2e-6];call(r,'volume.calibrate',reference_volume_m3=xs,measured_capacitance_f=[x/p['capacitance_volume_factor_m3_f']+p['capacitance_offset_f'] for x in xs]);call(r,'mercury.fill',mass_kg=.1) + c=rt.LIB['substances'][ref]['conditions'];m=mass or c['source_sample_mass_kg'] or .0001;bulk=(c['source_bulk_volume_m3']/c['source_sample_mass_kg']*m) if c['source_bulk_volume_m3'] and c['source_sample_mass_kg'] else max(rt.CURVES[(ref,'intrusion')][1])*m*1.2 + call(r,'guard0.set',angle_rad=1.4);call(r,'sample.load',sample_id=name+'_sample',reference_id=ref,true_dry_mass_kg=m,true_bulk_volume_m3=bulk,dry=True,accept_cross_instrument_transfer=True) + if low1:call(r,'guard1.set',angle_rad=1.4);call(r,'cell.transfer',destination='low1') + call(r,'guard0.set',angle_rad=0.);call(r,'guard1.set',angle_rad=0.) + # Host-provided engineering blank at the independently specified fill volume. Not measured OEM calibration. + fill_volume=r.bulb-bulk+r.capacity;grid=[0.]+[rt.P_MAX*i/1000 for i in range(1,1001)];blank=[fill_volume*(-math.expm1(-v/p['hg_bulk_modulus_pa']))+p['glass_compliance_m3_pa']*v for v in grid];call(r,'blank.calibrate',pressures_pa=grid,volumes_m3=blank) + meth=copy.deepcopy(rt.METHOD_EXAMPLE);meth['entered_mass_kg']=entered_mass or m + if ref!='hemp_shiv': + minimum=rt.CURVES[(ref,'intrusion')][0][0];meth['pressures_pa']=[max(minimum,3*rt.PSI),10*rt.PSI,30*rt.PSI,50*rt.PSI] + call(r,'method.configure',**meth);return r + +def run(r,max_s=3600): + call(r,'acquisition.start') + for _ in range(int(max_s/rt.DT)): + r.step(rt.DT) + if r.phase!='running':break + if r.phase!='succeeded':raise RuntimeError((r.phase,r.failure,r.stage,r.p,r.index,r.v)) + return call(r,'process.measure') +def high(r,cycle=True): + call(r,'guard'+r.position[-1]+'.set',angle_rad=1.4);call(r,'cap.set',lift_m=.19);call(r,'cell.transfer',destination='high');call(r,'guard0.set',angle_rad=0.);call(r,'guard1.set',angle_rad=0.);call(r,'cap.set',lift_m=0.) + meth=copy.deepcopy(rt.METHOD_EXAMPLE);meth.update(stage='high',entered_mass_kg=r.sample['true_dry_mass_kg'],pressure_rate_pa_s=2e7,pressure_tolerance_pa=7000.,max_volume_drift_m3_s=1e-12);peak=rt.CURVES[(r.sample['reference_id'],'intrusion')][0][-1];meth['pressures_pa']=[50*rt.PSI,1e6,1e7,1e8,peak]+([1e8,1e7,1e6,rt.CURVES[(r.sample['reference_id'],'extrusion')][0][0]] if cycle else []);call(r,'method.configure',**meth);return r +if __name__=='__main__': + import json + r=setup();run(r);high(r);out=run(r);print(r.phase,len(out['points']),r.elapsed,out['max_pore_volume_m3_kg']);print(json.dumps(r._ledger(),indent=2));Path(__file__).with_name('example_porosimetry.json').write_text(json.dumps({'result':out,'ledger':r._ledger(),'scope':'engineering blank calibration; independent measured hemp fullcycle transfer'},indent=2)+'\n') diff --git a/outputs/expansion_batch03/t4_measure/antonpaar_psa1190/example_setup.py b/outputs/expansion_batch03/t4_measure/antonpaar_psa1190/example_setup.py new file mode 100644 index 0000000000000000000000000000000000000000..417099ea1eafd48fdb9a6185c492ea264e4018cc --- /dev/null +++ b/outputs/expansion_batch03/t4_measure/antonpaar_psa1190/example_setup.py @@ -0,0 +1,26 @@ +from pathlib import Path +import sys,copy +R=Path(__file__).resolve().parents[4];sys.path.insert(0,str(R));from scripts.asset_runtime.antonpaar_psa1190 import * +OBSERVED=[] +def call(h,k,**a): + r=h.invoke(k,**a);OBSERVED.append(dict(capability_id=k,arguments=copy.deepcopy(a),result=copy.deepcopy(r)));return r +def build(mode='wet',sid=SID): + h=AntonpaarPsa1190Runtime();p=dict(PLANT_EXAMPLE) + if sid.startswith('soil_'):p.update(n635=1.543,k635=.01,n830=1.543,k830=.01) + if mode=='dry':p['medium_n']=1. + call(h,'plant.configure',**p);call(h,'cover.set',angle_rad=1.2);call(h,'ultrasound.select',power_w=50.);call(h,'cover.set',angle_rad=0.);m=dict(METHOD_EXAMPLE,mode=mode,medium_n=p['medium_n'],n635=p['n635'],k635=p['k635'],n830=p['n830'],k830=p['k830']);call(h,'method.configure',**m) + if mode=='wet':call(h,'tank_lid.set',slide_m=.17);call(h,'liquid.fill',volume_m3=.00045);call(h,'tank_lid.set',slide_m=0.) + else:call(h,'air.add',amount_mol=2.) + call(h,'power.set',enabled=True);call(h,'sim.step',dt_s=60.);call(h,'background.start');call(h,'sim.step',dt_s=60.) + s=dict(SAMPLE_EXAMPLE,substance_id=sid,accept_range_truncation=True) + if sid.startswith('soil_'):s.update(mass_kg=.00045,true_density_kg_m3=2650.) + if mode=='wet':call(h,'tank_lid.set',slide_m=.17) + else:call(h,'dry_hood.set',lift_m=.20);call(h,'distributor.set',angle_rad=.6);s['mass_kg']=.030 + call(h,'sample.load',**s) + if mode=='wet':call(h,'tank_lid.set',slide_m=0.) + else:call(h,'dry_hood.set',lift_m=0.) + return h +if __name__=='__main__': + for mode,sid in [('wet',SID),('wet','soil_2014_111'),('dry',SID)]: + h=build(mode,sid);call(h,'acquisition.start');call(h,'sim.step',dt_s=15.1);r=call(h,'acquisition.result');print(mode,sid,h.phase,h.error,h.obsc,None if h.psd is None else {k:v for k,v in h.psd.items() if k in ['d10_m','d50_m','d90_m','relative_fit_residual']});print(h._ledger()) + print('caps',len(CAPS),'slots',len(SLOTS)) diff --git a/outputs/expansion_batch03/t4_measure/biolin_sigma700/example_setup.py b/outputs/expansion_batch03/t4_measure/biolin_sigma700/example_setup.py new file mode 100644 index 0000000000000000000000000000000000000000..8ae08b520c0d803a219aff3d3f036d95c24abef4 --- /dev/null +++ b/outputs/expansion_batch03/t4_measure/biolin_sigma700/example_setup.py @@ -0,0 +1,10 @@ +from pathlib import Path +import sys,copy +ROOT=Path(__file__).resolve().parents[4];sys.path.insert(0,str(ROOT/'scripts'));from asset_runtime import biolin_sigma700 as rt +OBSERVED=[] +def call(h,k,**a): + r=h.invoke(k,**a);OBSERVED.append((k,copy.deepcopy(a),copy.deepcopy(r)));return r +def build(probe='plate',sid='cas_67_56_1',method=None,plant=None,c=0.,temp=293.15): + p=dict(rt.PLANT_EXAMPLE) + if sid.startswith(('apg_','sds_')):p.update(liquid_density_kg_m3=998.20715,liquid_cp_j_kg_k=4184.0509) + p.update(plant or {});h=rt.BiolinSigma700Runtime();call(h,'plant.configure',**p);call(h,'door.set',angle_rad=2.35);call(h,'probe.select',probe=probe);call(h,'sample.load',**dict(rt.SAMPLE_EXAMPLE,substance_id=sid,concentration_kg_m3=c,temperature_k=temp));call(h,'door.set',angle_rad=0.);call(h,'method.configure',**dict(rt.METHOD_EXAMPLE,**dict({'accept_ring_proxy':probe=='ring','analysis_density_difference_kg_m3':p['liquid_density_kg_m3']-p['upper_density_kg_m3']},**(method or {}))));call(h,'power.set',enabled=True);h.step(2.);call(h,'balance.tare');return h diff --git a/outputs/expansion_batch03/t4_measure/biolin_thetaflex/example_setup.py b/outputs/expansion_batch03/t4_measure/biolin_thetaflex/example_setup.py new file mode 100644 index 0000000000000000000000000000000000000000..ed65f847f4971a56957e3c64ef367f4581ea2090 --- /dev/null +++ b/outputs/expansion_batch03/t4_measure/biolin_thetaflex/example_setup.py @@ -0,0 +1,25 @@ +from pathlib import Path +import sys,copy,math +ROOT=Path(__file__).resolve().parents[4];sys.path.insert(0,str(ROOT/'scripts'));from asset_runtime import biolin_thetaflex as rt +OBSERVED=[] +def call(h,k,**a): + r=h.invoke(k,**a);OBSERVED.append((k,copy.deepcopy(a),copy.deepcopy(r)));return r + +def finish(h,max_s=60): + start=h.time_s + while h.phase=='running' and h.time_s-start asset frame.""" + return [DISPLAY_CENTER[i] + u * U[i] + v * V[i] + n * N[i] for i in range(3)] + + +SCREEN_SIZE = (0.222, 0.125) # active area (10.1 in class, drawing estimate) +SCREEN_CENTER_UV = (0.0, 0.002) +READOUT_FIELD_U = (0.050, 0.104) # right-hand status column of the engineering UI where the digits sit +READOUT_LINES_V = {'otr_a_digits': 0.030, 'otr_b_digits': 0.000, 'temperature_digits': -0.030} +READOUT_DIGIT_H = 0.0105 +LED_BG = (0.012, 0.020, 0.030) +OTR_DISPLAY_SCALE = 22414.0 * 86400.0 # mol/(m2 s) -> cc(STP)/(m2 day) +READOUTS = [dict(name='otr_cell_a_sim', part='otr_a_digits', face='N', digits=6, decimals=3, unit='cc/(m2 day)', on=(0.40, 0.86, 0.98), off=LED_BG, + blank_channel=None, source={'bridge': ['cell_a.last_otr_mol_m2_s'], 'scale': OTR_DISPLAY_SCALE}), + dict(name='otr_cell_b_sim', part='otr_b_digits', face='N', digits=6, decimals=3, unit='cc/(m2 day)', on=(0.98, 0.78, 0.30), off=LED_BG, + blank_channel=None, source={'bridge': ['cell_b.last_otr_mol_m2_s'], 'scale': OTR_DISPLAY_SCALE}), + dict(name='cell_temperature_sim', part='temperature_digits', face='N', digits=4, decimals=1, unit='C', on=(0.92, 0.94, 0.95), off=LED_BG, + blank_channel=None, source={'bridge': ['thermal.indicated_k'], 'offset': -273.15})] +LAMPS = [dict(name='cell_a_status', part='lamp_cell_a', face='-Y', digits=0, decimals=0, unit='1', on=(0.20, 0.95, 0.25), off=(0.02, 0.05, 0.03), + source={'lamp': {'bridge': 'cell_a.indicator_on'}}), + dict(name='cell_b_status', part='lamp_cell_b', face='-Y', digits=0, decimals=0, unit='1', on=(0.20, 0.95, 0.25), off=(0.02, 0.05, 0.03), + source={'lamp': {'bridge': 'cell_b.indicator_on'}})] +READOUT_NOTE_ZH = ('厂家为彩色触摸屏(WinPerm 2 界面,照片可见OTR曲线、A/B/Z池状态与右侧菜单);本资产在屏幕右侧状态栏叠加三行工程七段读数:A池与B池最近一次报告的OTR' + '(cc/(m²·day),由运行层SI值×22414×86400换算)和池温°C,均来自公开传感/报告状态,不是原厂界面、字体或驱动;A-/B-上方的状态灯亮=该池已夹紧' + '(灯语为工程映射,厂家未公开)。') + +# ---------------------------------------------------------------- behind the cover (2/28 Fig. 2-2 layout) +RECESS_PANEL_Y = FRONT_Y - 0.0004 # dark service panel just proud of the face, hidden by the closed cover +RECESS_X = (-0.080, 0.080) +THERMOMETER_WELL = (0.0, 0.2356) # (x, z) centre, "Temp" well visible through the cover notch (Fig. 2-2 item 12) +VENTS = {'vent_zero': (0.071, 0.2751), 'vent_cell_a': (0.071, 0.2510), 'vent_cell_b': (0.071, 0.2276)} # Fig. 2-2 items 9-11 (Z/A/B) +TEST_GAS_PORT = (0.0004, 0.2755) # centre fitting behind the cover (manual: cover gives access to the test gas port) +AUX_PORT = (0.0573, 0.2309) # small unlabelled fitting next to the B vent (purpose not documented) +COVER_SCREWS = [(-0.0398, 0.3139), (0.0399, 0.3139)] +COVER_NOTCH = dict(x=(-0.021, 0.021), z=(COVER_Z[0], 0.251)) + +# ---------------------------------------------------------------- rear panel (2/28 Fig. 2-3 layout) +REAR_PANEL_X = (-0.107, 0.107) +REAR_PANEL_Z = (0.030, 0.325) +GAS_INLETS = {'carrier_gas_inlet': (-0.076, 0.263), 'test_gas_inlet': (-0.057, 0.263)} +COOLING_FAN = dict(center=(0.028, 0.220), radius=0.075) +ENCLOSURE_FANS = {'enclosure_fan_left': (-0.016, 0.075), 'enclosure_fan_right': (0.066, 0.075)} +ENCLOSURE_FAN_R = 0.038 +POWER_ENTRY = dict(center=(-0.080, 0.060), size=(0.031, 0.049)) +POWER_SWITCH = dict(center=(-0.080, 0.075), size=(0.018, 0.012)) +POWER_SWITCH_ON_RAD = 0.30 +ETHERNET = (0.127, 0.124) +USB = {'usb_1': (0.120, 0.076), 'usb_2': (0.134, 0.076)} + +# ---------------------------------------------------------------- ports, joints, process mirrors +PORTS = [('carrier_gas_inlet', 'carrier_gas_inlet', 'gas', 'in'), ('test_gas_inlet', 'test_gas_inlet', 'gas', 'in'), + ('vent_zero', 'vent_zero', 'gas', 'out'), ('vent_cell_a', 'vent_cell_a', 'gas', 'out'), ('vent_cell_b', 'vent_cell_b', 'gas', 'out'), + ('test_gas_outlet', 'test_gas_port', 'gas', 'out'), ('cell_a_film', 'cartridge_a', 'mechanical', 'bidirectional'), + ('cell_b_film', 'cartridge_b', 'mechanical', 'bidirectional'), ('thermometer_well', 'thermometer_well', 'thermal', 'in'), + ('line_power', 'power_entry', 'electrical', 'in'), ('ethernet', 'ethernet_port', 'data', 'bidirectional'), + ('usb_1', 'usb_1', 'data', 'bidirectional'), ('usb_2', 'usb_2', 'data', 'bidirectional'), ('cooling_air', 'cooling_fan', 'thermal', 'out')] +# (part, state_id, capability, blender attribute, unit, upper) ; process-authoritative mirrors +MOTION = [('drawer_a', 'drawer_a.position_m', 'drawer.move', 'location[1]', 'm', DRAWER_TRAVEL_M), + ('drawer_b', 'drawer_b.position_m', 'drawer.move', 'location[1]', 'm', DRAWER_TRAVEL_M), + ('clamp_a', 'clamp_a.position_m', 'cell.load_unload', 'location[2]', 'm', CLAMP_TRAVEL_M), + ('clamp_b', 'clamp_b.position_m', 'cell.load_unload', 'location[2]', 'm', CLAMP_TRAVEL_M), + ('power_switch', 'power.angle_rad', 'power.set', 'rotation_euler[0]', 'rad', POWER_SWITCH_ON_RAD)] +PASSIVE_JOINTS = [('cover', 'cover.angle_rad', COVER_OPEN_RAD)] +KEYS = [('button_load_a', 'a'), ('button_load_b', 'b')] +KEY_COMMANDS = {'button_load_a': ('cell.load_unload', {'cell': 'A'}), 'button_load_b': ('cell.load_unload', {'cell': 'B'})} + +PORT_GEOMETRY = { + 'carrier_gas_inlet': dict(pos=[GAS_INLETS['carrier_gas_inlet'][0], REAR_Y + 0.020, GAS_INLETS['carrier_gas_inlet'][1]], insert_axis=[0, -1, 0], radius=0.0016, capture=0.003), + 'test_gas_inlet': dict(pos=[GAS_INLETS['test_gas_inlet'][0], REAR_Y + 0.020, GAS_INLETS['test_gas_inlet'][1]], insert_axis=[0, -1, 0], radius=0.0016, capture=0.003), + 'vent_zero': dict(pos=[VENTS['vent_zero'][0], RECESS_PANEL_Y - 0.004, VENTS['vent_zero'][1]], insert_axis=[0, 1, 0], radius=0.004, capture=0.003), + 'vent_cell_a': dict(pos=[VENTS['vent_cell_a'][0], RECESS_PANEL_Y - 0.004, VENTS['vent_cell_a'][1]], insert_axis=[0, 1, 0], radius=0.004, capture=0.003), + 'vent_cell_b': dict(pos=[VENTS['vent_cell_b'][0], RECESS_PANEL_Y - 0.004, VENTS['vent_cell_b'][1]], insert_axis=[0, 1, 0], radius=0.004, capture=0.003), + 'test_gas_outlet': dict(pos=[TEST_GAS_PORT[0], RECESS_PANEL_Y - 0.004, TEST_GAS_PORT[1]], insert_axis=[0, 1, 0], radius=0.003, capture=0.003), + 'thermometer_well': dict(pos=[THERMOMETER_WELL[0], RECESS_PANEL_Y - 0.002, THERMOMETER_WELL[1]], insert_axis=[0, 1, 0], radius=0.0035, capture=0.003), + 'line_power': dict(pos=[POWER_ENTRY['center'][0], REAR_Y + 0.004, POWER_ENTRY['center'][1] - 0.010], insert_axis=[0, -1, 0], radius=0.010, capture=0.004), + 'ethernet': dict(pos=[ETHERNET[0], REAR_Y + 0.003, ETHERNET[1]], insert_axis=[0, -1, 0], radius=0.006, capture=0.003), + 'usb_1': dict(pos=[USB['usb_1'][0], REAR_Y + 0.003, USB['usb_1'][1]], insert_axis=[0, -1, 0], radius=0.004, capture=0.003), + 'usb_2': dict(pos=[USB['usb_2'][0], REAR_Y + 0.003, USB['usb_2'][1]], insert_axis=[0, -1, 0], radius=0.004, capture=0.003), + 'cooling_air': dict(pos=[COOLING_FAN['center'][0], REAR_Y + 0.010, COOLING_FAN['center'][1]], insert_axis=[0, 1, 0], radius=COOLING_FAN['radius'], capture=0.01), +} +for _cell in CELLS: + PORT_GEOMETRY[f'cell_{_cell}_film'] = dict(pos=[0.0, FRONT_Y + CARTRIDGE_Y_LOCAL, DRAWER_CENTER_Z[_cell] + CARTRIDGE_Z_LOCAL + CARTRIDGE_SIZE[2] / 2], + insert_axis=[0, 0, 1], radius=TEST_WINDOW_D / 2, capture=0.01, access=[f'drawer_{_cell}_joint']) # q=0 pose; rides the drawer link +for _row in PORT_GEOMETRY.values(): + _row.update(position_evidence='geometry_derived_simulation_assumption', capture_evidence='simulation_assumption', + note='接口位置取自2/28同机身线图与2/22照片的比例估计;捕获半径为工程几何,真实管径/pinout/机器人接触未验证。') diff --git a/outputs/expansion_batch04/t1_thermal/mt_rc1mxhfcal/interface_definition.py b/outputs/expansion_batch04/t1_thermal/mt_rc1mxhfcal/interface_definition.py new file mode 100644 index 0000000000000000000000000000000000000000..48bc53abcf416ee63cbee9842a073bff277d6561 --- /dev/null +++ b/outputs/expansion_batch04/t1_thermal/mt_rc1mxhfcal/interface_definition.py @@ -0,0 +1,177 @@ +"""CHEM-149 METTLER TOLEDO RC1mx + HFCal (standard torque stirrer, MidTemp oil, AP01-2 glass reactor): single source of the +interface numbers shared by geometry, runtime tests, Matterix metadata and the scene (SI, +Z up, +Y back, origin at the centre +of the documented RC1mx footprint, floor Z=0). + +Documented (RC1mx User Manual 30357680B, 7.1): the RC1mx with the standard stirrer motor is 669 mm wide, 670 mm deep and +1180.5 mm high and weighs 170 kg -- without reactor and touchscreen terminal. Component positions inside that envelope are +read from the dimension drawing (manual p.27, rendered at 300 dpi and calibrated on the 669 / 670 / 1180.5 mm dimension lines; +the front view is scaled 0.905 mm/px horizontally and 0.956 mm/px vertically, the side view 1.017 / 1.022 mm/px) together +with the labelled overview drawings (p.9 front side, p.10 left side, p.11 electronics cabinet bottom); they are drawing +estimates with about +-5 mm reading error. The AP01-2 reactor data (2.5 L nominal, 0.5-2 L operating volume, cover ports, +anchor stirrer, split-flange oil connections, reactor support in rod clamps and double clamps 120 mm apart) come from the RC1e +High Performance Thermostat operating instructions (predecessor thermostat, same reactor family); the reactor diameters and +wall thicknesses are engineering values. The touchscreen and the emergency button are separate units of the scope of +delivery; their bench positions are assumptions.""" +import math + +SLUG = 'mt_rc1mxhfcal' +# ---- documented envelope of the RC1mx thermostat with the standard stirrer motor (no reactor, no terminal) +ENVELOPE_M = (0.669, 0.670, 1.1805) +X_LEFT, X_RIGHT = -0.3345, 0.3345 # cabinet left face .. right rod-clamp blocks +Y_FRONT, Y_BACK = -0.335, 0.335 # stirrer-motor holder arm .. cabinet back +TOP_Z = 1.1805 # top of the standard stirrer motor +# ---- thermostat: base, rear body (column core), front module, top band, electronics cabinet +BASE_Z = 0.031 +BASE_Y = (-0.115, 0.332) +COL_X = (-0.0913, 0.310) +COL_Y = (0.030, 0.331) # rear body; its front face is recessed behind the front module +FRONT_X = (-0.0095, 0.227) # front module between the frame rods (oil connections, rotameter) +FRONT_Y = (-0.062, COL_Y[0]) +COL_TOP_Z = 1.033 +TOPBAND_Z = (1.002, COL_TOP_Z) +CAB_X = (X_LEFT, COL_X[0]) +CAB_Y = (0.0855, 0.331) +CAB_Z = (0.432, 1.031) +# ---- accessory frame: two vertical rods in front of the column, two U-bars held by clamp blocks on the corner rails +ROD_X = (-0.022, 0.238) +ROD_Y = -0.103 +ROD_R = 0.007 +ROD_TOP_Z = 0.942 +BAR_Z = (0.500, 0.906) # cross-member heights of the lower and upper U-bar +BAR_Y = -0.135 # cross members run along X in front of the rods +BAR_X = (-0.058, 0.289) # risers into the clamp blocks +BAR_R = 0.006 +CLAMP_BLOCK_Z = ((0.429, 0.471), (0.835, 0.876)) +CLAMP_BLOCK_Y = (-0.044, COL_Y[0]) +CLAMP_BLOCK_X = ((COL_X[0], -0.038), (0.254, X_RIGHT)) +# ---- stirrer motor on the holder (support clamp on the upper U-bar, horizontal arm, mounting plate) +AXIS_X, AXIS_Y = 0.1275, -0.262 # stirrer / reactor axis (front view 0.1274 m, side view -0.262 m) +MOTOR_XY = (0.077, 0.075) # motor body width (X) and depth (Y) +MOTOR_Z = (0.995, TOP_Z) +MOTOR_BAND_Z = (0.985, 0.995) +PLATE_X = (0.0615, 0.1928) +PLATE_Y = (-0.302, -0.222) +PLATE_Z = (0.959, MOTOR_BAND_Z[0]) +ARM_Z = 0.9735 +ARM_Y = (-0.151, Y_FRONT + 0.001) +CHUCK_Z = (0.935, PLATE_Z[0]) +# ---- AP01-2 double-wall glass reactor (engineering dimensions; nominal 2.5 L, operating 0.5-2 L documented for the RC1e) +REACTOR_INNER_R = 0.060 +REACTOR_WALL = 0.004 +JACKET_OUTER_R = 0.080 +REACTOR_FLANGE_Z = 0.500 # top of the glass flange / cover seat +REACTOR_BOTTOM_Z = 0.262 # inner bottom +JACKET_Z = (0.214, 0.470) +COVER_H = 0.030 +SUPPORT_RING_Z = (0.476, 0.486) # reactor support (steel ring under the glass flange) +SUPPORT_CLAMP_Z = (0.481, 0.361) # rod clamp and double clamp on each frame rod, 120 mm apart (documented distance) +NOMINAL_VOLUME_M3 = 2.5e-3 +OPERATING_VOLUME_M3 = (0.5e-3, 2.0e-3) +DRAIN_Z = 0.160 # bottom drain valve body centre +OUTLET_Z = 0.100 # BS 29 ball-joint outlet +IMPELLER_Z = REACTOR_BOTTOM_Z + 0.010 # "position the stirrer about 1 cm above the bottom of the reactor" +IMPELLER_D = 0.100 # anchor stirrer diameter (engineering) +IMPELLER_H = 0.094 +PROBE_RING_R = 0.034 # Tr sensor, calibration heater and dip tube stay inside the anchor sweep +# cover ports (documented configuration: ST 29/32 centre, ST 45/40, 2 x ST 19/26, 2 x ST 29/32): name -> (dx, dy, neck radius, neck height, joint) +COVER_PORTS = { + 'central': (0.0, 0.0, 0.016, 0.045, 'ST 29/32'), + 'large': (0.0, -0.052, 0.026, 0.036, 'ST 45/40'), + 'tr': (-PROBE_RING_R * math.cos(math.radians(30)), PROBE_RING_R * 0.5, 0.012, 0.030, 'ST 19/26'), + 'ph': (PROBE_RING_R * math.cos(math.radians(30)), PROBE_RING_R * 0.5, 0.012, 0.030, 'ST 19/26'), + 'cal': (-PROBE_RING_R * math.cos(math.radians(30)), -PROBE_RING_R * 0.5, 0.0165, 0.032, 'ST 29/32'), + 'dip': (PROBE_RING_R * math.cos(math.radians(30)), -PROBE_RING_R * 0.5, 0.0165, 0.032, 'ST 29/32'), +} +PROBE_TOP_Z = {'tr': 0.600, 'cal': 0.598, 'dip': 0.585} +PROBE_TIP_Z = REACTOR_BOTTOM_Z + 0.045 # immersed at the 0.5 L minimum operating volume (liquid height 44 mm) + + +def port_top_z(name): + return REACTOR_FLANGE_Z + COVER_H + COVER_PORTS[name][3] - 0.004 + + +# ---- oil connections to the reactor on the front module (outlet upper, inlet lower): RC1 nozzle, blue split flange, glass flange +OIL_UPPER = (0.0721, 0.389) # (x, z) +OIL_LOWER = (0.1815, 0.2284) +OIL_NOZZLE_Y = (FRONT_Y[0], -0.100) +OIL_FLANGE_Y = -0.113 # reactor-side glass flange face +# ---- front module details +ROTAMETER = dict(x=(0.038, 0.059), z=(0.756, 0.833), panel_x=(0.010, 0.085), panel_z=(0.705, 0.882), knob=(0.0473, 0.731)) +SOCKET_BOX = dict(x=(COL_X[0], -0.0383), y=(-0.044, COL_Y[0]), z=(0.619, 0.720)) +TR_SOCKET_XY = (-0.0865, -0.026) +CAL_SOCKET_XY = (-0.0743, -0.039) +STIRRER_BUTTON_XZ = (-0.081, 0.639) +OIL_WINDOW = dict(x=-0.0150, y=(-0.058, -0.046), z=(0.451, 0.615)) +# ---- left side of the column (below the cabinet): control valve cover, coolant plate, oil drain stopcock +VALVE_COVER = dict(y=0.1364, z=0.2690, r=0.057, flange_r=0.098, x0=-0.2266) +COOLANT_PLATE = dict(y=(0.042, 0.222), z=(0.044, 0.119)) +COOLANT_IN_Y, COOLANT_OUT_Y, COOLANT_Z = 0.180, 0.084, 0.082 +FITTING_X0 = -0.141 # hose-end of the coolant fittings +STOPCOCK = dict(y=0.132, z=0.083, valve_x=(-0.217, -0.157), end_x=-0.239, handle_top=0.121) +INTERFACE_STRIP = dict(y=(0.045, 0.075), z=(0.745, 0.985)) +# ---- operator units on the bench (assumed placement; separate units in the scope of delivery) +TERMINAL_CENTER = (0.470, -0.180) # touchscreen stand (x, y) +EMERGENCY_CENTER = (-0.300, -0.285) # emergency (safeguard) button box (x, y) +# ---- motion (process-authoritative mirrors) and keys +STIRRER_JOINT_MAX_RAD = 2 * math.pi # the shaft angle is mirrored modulo one turn +DRAIN_OPEN_RAD = math.pi / 2 +MOTION = [('stirrer_shaft', 'stirrer.angle_rad', 'stirrer.set', 'rotation', 'rad', STIRRER_JOINT_MAX_RAD), + ('drain_valve_handle', 'drain.angle_rad', 'reactor.discharge', 'rotation', 'rad', DRAIN_OPEN_RAD)] +PASSIVE_JOINTS = [] +KEYS = ['button_power', 'button_stirrer', 'button_emergency'] +# explicit URDF spring-key joints: press direction into the housing (the Matterix panel pass signs whole-link keys towards the +# asset centroid, which inverts the switch under the cabinet and the mushroom on top of the floor box); 1.5 mm travel +KEY_AXES = {'button_power': [0.0, 0.0, 1.0], 'button_stirrer': [0.0, 1.0, 0.0], 'button_emergency': [0.0, 0.0, -1.0]} +KEY_TRAVEL_M = 0.0015 +KEY_JOINTS = {k: k + '_joint' for k in KEYS} +KEY_COMMANDS = {'button_power': ('power.toggle', {}), 'button_stirrer': ('stirrer.toggle', {}), 'button_emergency': ('emergency.trigger', {})} +# ---- simulated overlay readouts on the touchscreen and the status light (not the original iControl GUI) +TOUCH = dict(center=(TERMINAL_CENTER[0], TERMINAL_CENTER[1] - 0.0205, 0.300), width=0.250, height=0.160) +LED_BG = (0.02, 0.03, 0.04) +READOUT_NOTE_ZH = ('RC1mx触摸屏为iControl图形界面;本资产在触摸屏上叠加三行仿真七段读数(Tr °C、Tj °C、转速rpm),不是原厂界面;' + '电控柜正面左上角状态灯(厂家:通电后变绿)用绿段表示通电且无急停程序,旁边的红段表示急停程序激活(红色语义为工程约定)。') +READOUTS = [dict(name='tr_sim', part='tr_digits', face='-Y', digits=5, decimals=1, unit='C', on=(0.98, 0.55, 0.12), off=LED_BG, blank_channel=None, + source={'bridge': ['reactor.indicated_k'], 'offset': -273.15}), + dict(name='tj_sim', part='tj_digits', face='-Y', digits=5, decimals=1, unit='C', on=(0.98, 0.55, 0.12), off=LED_BG, blank_channel=None, + source={'bridge': ['jacket.indicated_k'], 'offset': -273.15}), + dict(name='speed_sim', part='speed_digits', face='-Y', digits=4, decimals=0, unit='rpm', on=(0.98, 0.55, 0.12), off=LED_BG, blank_channel=None, + source={'bridge': ['stirrer.indicated_rpm']})] +LAMPS = [dict(name='status_ok', part='lamp_status_ok', face='-Y', digits=0, decimals=0, unit='1', on=(0.20, 0.95, 0.25), off=(0.02, 0.05, 0.03), + source={'lamp': {'bridge': 'status.ok'}}), + dict(name='status_alarm', part='lamp_status_alarm', face='-Y', digits=0, decimals=0, unit='1', on=(1.00, 0.18, 0.12), off=(0.06, 0.02, 0.02), + source={'lamp': {'bridge': 'emergency.active'}})] +# ---- ports: (name, component, medium, direction) +PORTS = [('reactor_port_large', 'reactor_cover', 'liquid', 'in'), ('dosing_dip_tube', 'dip_tube', 'liquid', 'in'), + ('drain_outlet', 'drain_valve_body', 'liquid', 'out'), ('tr_sensor_socket', 'front_socket_box', 'electrical', 'bidirectional'), + ('calibration_heater_socket', 'front_socket_box', 'electrical', 'in'), ('coolant_in', 'coolant_in_fitting', 'liquid', 'in'), + ('coolant_out', 'coolant_out_fitting', 'liquid', 'out'), ('purge_gas_inlet', 'purge_inlet', 'gas', 'in'), ('power_inlet', 'electronics_cabinet', 'electrical', 'in'), + ('data_sockets', 'interface_strip', 'data', 'bidirectional'), ('oil_drain', 'oil_drain_stopcock', 'liquid', 'out'), + ('probe_port_st19', 'reactor_cover', 'mechanical', 'in')] +PORT_MEANING = { + 'reactor_port_large': '反应器盖ST 45/40大口(厂家:free, big probes):装料漏斗或大探头(宿主装料代理;本资产只模拟液相物料)', + 'dosing_dip_tube': '加料浸管(装在ST 29/32口):外部加料泵/天平送入的加料物流在液面下进入', + 'drain_outlet': '反应器底阀出口(BS 29球磨口):放料', 'tr_sensor_socket': '正面插座盒顶部Tr传感器插座(Tr/Trs双Pt100)', + 'calibration_heater_socket': '正面插座盒顶部校准加热器插座(HFCal标定热功率)', 'coolant_in': '左侧冷却水进口(≥10 L/min)', 'coolant_out': '左侧冷却水出口', + 'purge_gas_inlet': '电控柜底部惰性吹扫气接口(Purge-1油箱/Purge-2电控柜;最高0.5 bar,≥80 mL/min)', + 'power_inlet': '电控柜底部电源线接口(Type L 200–240 V 3~ / Type H 350–415 V 3N~,最大4800 W)', + 'data_sockets': '立柱左侧接口条:CAN-1 Out、USB×4、以太网、触摸屏(Control unit)、RS-232×2', 'oil_drain': '放油旋塞(仅室温下操作)', + 'probe_port_st19': '反应器盖ST 19/26空口(厂家:free, pH electrodes),参考姿态用玻璃塞封住'} +_R_TOP = REACTOR_FLANGE_Z + COVER_H +PORT_GEOMETRY = { # insert_axis = outward normal of the interface (slot local +Z) + 'reactor_port_large': dict(pos=[AXIS_X + COVER_PORTS['large'][0], AXIS_Y + COVER_PORTS['large'][1], port_top_z('large')], insert_axis=[0, 0, 1], radius=0.0225, + capture=0.03, access=[]), + 'dosing_dip_tube': dict(pos=[AXIS_X + COVER_PORTS['dip'][0], AXIS_Y + COVER_PORTS['dip'][1], PROBE_TOP_Z['dip'] + 0.020], insert_axis=[0, 0, 1], radius=0.003, + capture=0.02, access=[]), + 'drain_outlet': dict(pos=[AXIS_X, AXIS_Y, OUTLET_Z], insert_axis=[0, 0, -1], radius=0.0145, capture=0.03, access=[]), + 'tr_sensor_socket': dict(pos=[TR_SOCKET_XY[0], TR_SOCKET_XY[1], SOCKET_BOX['z'][1] + 0.010], insert_axis=[0, 0, 1], radius=0.005, capture=0.01, access=[]), + 'calibration_heater_socket': dict(pos=[CAL_SOCKET_XY[0], CAL_SOCKET_XY[1], SOCKET_BOX['z'][1] + 0.010], insert_axis=[0, 0, 1], radius=0.005, capture=0.01, + access=[]), + 'coolant_in': dict(pos=[FITTING_X0, COOLANT_IN_Y, COOLANT_Z], insert_axis=[-1, 0, 0], radius=0.009, capture=0.02, access=[]), + 'coolant_out': dict(pos=[FITTING_X0, COOLANT_OUT_Y, COOLANT_Z], insert_axis=[-1, 0, 0], radius=0.009, capture=0.02, access=[]), + 'purge_gas_inlet': dict(pos=[-0.253, 0.245, CAB_Z[0] - 0.014], insert_axis=[0, 0, -1], radius=0.004, capture=0.01, access=[]), + 'power_inlet': dict(pos=[-0.300, 0.297, CAB_Z[0] - 0.030], insert_axis=[0, 0, -1], radius=0.008, capture=0.02, access=[]), + 'data_sockets': dict(pos=[COL_X[0] - 0.009, sum(INTERFACE_STRIP['y']) / 2, 0.865], insert_axis=[-1, 0, 0], radius=0.006, capture=0.02, access=[]), + 'oil_drain': dict(pos=[STOPCOCK['end_x'], STOPCOCK['y'], STOPCOCK['z']], insert_axis=[-1, 0, 0], radius=0.004, capture=0.02, access=[]), + 'probe_port_st19': dict(pos=[AXIS_X + COVER_PORTS['ph'][0], AXIS_Y + COVER_PORTS['ph'][1], port_top_z('ph')], insert_axis=[0, 0, 1], radius=0.0094, + capture=0.01, access=[]), +} diff --git a/outputs/expansion_batch04/t1_thermal/mt_rc1mxhfcal/source_cache/rc1e_curves_digitized.json b/outputs/expansion_batch04/t1_thermal/mt_rc1mxhfcal/source_cache/rc1e_curves_digitized.json new file mode 100644 index 0000000000000000000000000000000000000000..091d9edee1c839ad39721b09bda3b56b8fe452ee --- /dev/null +++ b/outputs/expansion_batch04/t1_thermal/mt_rc1mxhfcal/source_cache/rc1e_curves_digitized.json @@ -0,0 +1,68493 @@ +{ + "source": { + "file": "outputs/expansion_batch04/t1_thermal/mt_rc1mxhfcal/source_cache/rc1e_thermostat_manual.pdf", + "sha256": "69a3bb3394e221b9a883d7c74dd98db2e10ee894091e26cc2118b5a2f494c789", + "document": "METTLER TOLEDO RC1e High Performance Thermostat operating instructions", + "locator": "9.6 Typical heating and cooling curves with the AP01-2-L reactor (printed p.48-50, curves 1-4)" + }, + "configuration": { + "stirrer": "anchor, glass", + "oil": "MidTemp (silicone oil 47V20)", + "coolant": "water approx. 16 C, approx. 10 L/min", + "reactor": "AP01-2" + }, + "digitised_at": "2026-09-25T11:09:02.483498+00:00", + "method": [ + "20 min); Tj is the red trace, Tr the black trace (axes, tick marks and the Tj/Tr/Tc labels with their leaders masked), Tc the", + "cyan trace; the regions start 12 px right of the T axis and end before the t-axis arrow head. Writes source_cache/rc1e_curves_digitized.json with pixel calibration, per-trace samples (t in s, T in C) and the", + "sha256 of the source PDF and of the rendered pages. Reading error: about +-1 K and +-0.1 min (1 px = 0.2 K, 0.06 min)." + ], + "plots": { + "curve1_empty_Tj_mode": { + "page_png": "outputs/expansion_batch04/t1_thermal/mt_rc1mxhfcal/source_cache/img/rc1e_curves_300dpi-50.png", + "page_png_sha256": "356373ecb4b081fee43c5e7cf8b754309084a7718b39cce5f213d11c5930dae0", + "calibration": { + "y_ticks_px": [ + 1532.5, + 1631.5, + 1730.5, + 1829.5, + 1928.5, + 2027.5, + 2126.5, + 2225.5, + 2324.5, + 2423.5, + 2522.5 + ], + "x_ticks_px": [ + 728.5, + 1047.5, + 1371.5 + ], + "T_per_px": -0.20202020202020218, + "s_per_px": 3.732428658499224, + "T_fit_residual_K": 2.2737367544323206e-13, + "t_fit_residual_s": 6.220714430830412 + }, + "columns": [ + "t_s", + "T_median_C", + "T_min_C", + "T_max_C" + ], + "series": { + "Tj": [ + [ + 49.78990173915736, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 53.52233039765679, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 57.25475905615576, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 60.98718771465519, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 64.71961637315417, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 68.4520450316536, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 72.18447369015257, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 75.916902348652, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 79.64933100715098, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 83.3817596656504, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 87.11418832414938, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 90.84661698264881, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 94.57904564114824, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 98.31147429964722, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 102.04390295814665, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 105.77633161664562, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 109.50876027514505, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 113.24118893364403, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 116.97361759214346, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 120.70604625064243, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 124.43847490914186, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 128.17090356764083, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 131.90333222614026, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 135.6357608846397, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 139.36818954313867, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 143.1006182016381, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 146.83304686013707, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 150.5654755186365, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 154.29790417713548, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 158.0303328356349, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 161.76276149413388, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 165.4951901526333, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 169.2276188111323, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 172.96004746963172, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 176.69247612813115, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 180.42490478663012, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 184.15733344512955, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 187.88976210362853, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 191.62219076212796, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 195.35461942062693, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 199.08704807912636, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 202.81947673762534, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 206.55190539612477, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 210.2843340546242, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 214.01676271312317, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 217.7491913716226, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 221.48162003012158, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 225.214048688621, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 228.94647734711998, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 232.6789060056194, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 236.41133466411839, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 240.14376332261781, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 243.8761919811168, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 247.60862063961622, + 25.555555555555316, + 26.363636363636147, + 24.74747474747454 + ], + [ + 251.34104929811565, + 25.95959595959573, + 27.17171717171692, + 24.74747474747454 + ], + [ + 255.07347795661462, + 26.46464646464625, + 28.18181818181796, + 24.74747474747454 + ], + [ + 258.80590661511405, + 26.868686868686666, + 28.989898989898734, + 24.74747474747454 + ], + [ + 262.53833527361303, + 27.37373737373713, + 29.797979797979565, + 24.949494949494692 + ], + [ + 266.27076393211246, + 28.383838383838167, + 30.808080808080604, + 25.95959595959573 + ], + [ + 270.00319259061143, + 29.19191919191894, + 31.616161616161378, + 26.767676767676562 + ], + [ + 273.73562124911086, + 30.101010101009877, + 32.42424242424221, + 27.777777777777544 + ], + [ + 277.46804990760984, + 30.909090909090708, + 33.23232323232298, + 28.585858585858375 + ], + [ + 281.20047856610927, + 31.71717171717148, + 34.040404040403814, + 29.39393939393915 + ], + [ + 284.93290722460824, + 32.62626262626242, + 34.848484848484645, + 30.404040404040188 + ], + [ + 288.6653358831077, + 33.43434343434319, + 35.65656565656542, + 31.212121212120962 + ], + [ + 292.3977645416071, + 34.24242424242402, + 36.46464646464625, + 32.02020202020179 + ], + [ + 296.1301932001061, + 35.05050505050485, + 37.272727272727025, + 32.828282828282624 + ], + [ + 299.8626218586055, + 35.85858585858563, + 38.080808080807856, + 33.6363636363634 + ], + [ + 303.5950505171045, + 36.66666666666646, + 38.88888888888869, + 34.44444444444423 + ], + [ + 307.3274791756039, + 37.47474747474723, + 39.69696969696946, + 35.252525252525004 + ], + [ + 311.0599078341029, + 38.28282828282806, + 40.50505050505029, + 36.060606060605835 + ], + [ + 314.7923364926023, + 39.090909090908895, + 41.313131313131066, + 36.868686868686666 + ], + [ + 318.5247651511013, + 39.89898989898967, + 42.1212121212119, + 37.67676767676744 + ], + [ + 322.2571938096007, + 40.606060606060396, + 42.72727272727252, + 38.48484848484827 + ], + [ + 325.9896224680997, + 41.41414141414117, + 43.535353535353295, + 39.292929292929045 + ], + [ + 329.7220511265991, + 42.222222222222, + 44.343434343434126, + 40.10101010100988 + ], + [ + 333.45447978509856, + 43.03030303030283, + 45.15151515151496, + 40.90909090909071 + ], + [ + 337.18690844359753, + 43.7373737373735, + 45.75757575757552, + 41.71717171717148 + ], + [ + 340.91933710209696, + 44.44444444444423, + 46.565656565656354, + 42.323232323232105 + ], + [ + 344.65176576059594, + 45.25252525252506, + 47.373737373737185, + 43.131313131312936 + ], + [ + 348.38419441909537, + 45.95959595959573, + 47.97979797979775, + 43.93939393939371 + ], + [ + 352.11662307759434, + 46.76767676767656, + 48.78787878787858, + 44.74747474747454 + ], + [ + 355.84905173609377, + 47.47474747474729, + 49.59595959595936, + 45.353535353535165 + ], + [ + 359.58148039459275, + 48.18181818181796, + 50.20202020201998, + 46.16161616161594 + ], + [ + 363.3139090530922, + 48.98989898989879, + 51.01010101010081, + 46.96969696969677 + ], + [ + 367.0463377115916, + 49.59595959595936, + 51.61616161616138, + 47.575757575757336 + ], + [ + 370.7787663700906, + 50.40404040404019, + 52.42424242424221, + 48.38383838383817 + ], + [ + 374.51119502859, + 51.111111111110915, + 53.03030303030283, + 49.191919191919 + ], + [ + 378.243623687089, + 51.818181818181586, + 53.838383838383606, + 49.797979797979565 + ], + [ + 381.9760523455884, + 52.52525252525231, + 54.44444444444423, + 50.606060606060396 + ], + [ + 385.7084810040874, + 53.23232323232304, + 55.25252525252506, + 51.21212121212102 + ], + [ + 389.4409096625868, + 53.93939393939371, + 55.85858585858563, + 52.02020202020179 + ], + [ + 393.1733383210858, + 54.64646464646444, + 56.66666666666646, + 52.62626262626242 + ], + [ + 396.9057669795852, + 55.353535353535165, + 57.27272727272708, + 53.43434343434325 + ], + [ + 400.6381956380842, + 56.060606060605835, + 58.080808080807856, + 54.040404040403814 + ], + [ + 404.3706242965836, + 56.76767676767656, + 58.68686868686848, + 54.848484848484645 + ], + [ + 408.10305295508306, + 57.373737373737185, + 59.2929292929291, + 55.45454545454527 + ], + [ + 411.83548161358203, + 58.18181818181796, + 60.10101010100988, + 56.26262626262604 + ], + [ + 415.56791027208146, + 58.78787878787858, + 60.7070707070705, + 56.868686868686666 + ], + [ + 419.30033893058044, + 59.595959595959414, + 61.51515151515133, + 57.6767676767675 + ], + [ + 423.03276758907987, + 60.20202020201998, + 62.1212121212119, + 58.28282828282806 + ], + [ + 426.76519624757884, + 60.90909090909071, + 62.72727272727252, + 59.090909090908895 + ], + [ + 430.4976249060783, + 61.616161616161435, + 63.53535353535335, + 59.69696969696952 + ], + [ + 434.23005356457725, + 62.222222222222, + 64.14141414141392, + 60.303030303030084 + ], + [ + 437.9624822230767, + 62.92929292929273, + 64.74747474747454, + 61.111111111110915 + ], + [ + 441.69491088157565, + 63.53535353535335, + 65.35353535353516, + 61.71717171717154 + ], + [ + 445.4273395400751, + 64.24242424242402, + 66.16161616161594, + 62.323232323232105 + ], + [ + 449.1597681985745, + 64.94949494949475, + 66.76767676767656, + 63.131313131312936 + ], + [ + 452.8921968570735, + 65.55555555555537, + 67.37373737373719, + 63.73737373737356 + ], + [ + 456.6246255155729, + 66.16161616161594, + 67.97979797979781, + 64.34343434343413 + ], + [ + 460.3570541740719, + 66.86868686868667, + 68.78787878787858, + 64.94949494949475 + ], + [ + 464.0894828325713, + 67.5757575757574, + 69.3939393939392, + 65.75757575757558 + ], + [ + 467.8219114910703, + 68.18181818181796, + 69.99999999999983, + 66.36363636363615 + ], + [ + 471.5543401495697, + 68.78787878787858, + 70.6060606060604, + 66.96969696969677 + ], + [ + 475.2867688080687, + 69.3939393939392, + 71.21212121212102, + 67.5757575757574 + ], + [ + 479.01919746656813, + 70.10101010100993, + 71.81818181818164, + 68.38383838383817 + ], + [ + 482.75162612506756, + 70.8080808080806, + 72.62626262626242, + 68.98989898989879 + ], + [ + 486.48405478356653, + 71.41414141414123, + 73.23232323232304, + 69.59595959595941 + ], + [ + 490.21648344206596, + 72.02020202020185, + 73.83838383838366, + 70.20202020201998 + ], + [ + 493.94891210056494, + 72.62626262626242, + 74.44444444444423, + 70.8080808080806 + ], + [ + 497.68134075906437, + 73.33333333333314, + 75.05050505050485, + 71.61616161616143 + ], + [ + 501.41376941756334, + 73.93939393939377, + 75.65656565656548, + 72.222222222222 + ], + [ + 505.1461980760628, + 74.54545454545433, + 76.2626262626261, + 72.82828282828262 + ], + [ + 508.87862673456175, + 75.15151515151496, + 76.86868686868667, + 73.43434343434325 + ], + [ + 512.6110553930612, + 75.75757575757558, + 77.47474747474729, + 74.04040404040387 + ], + [ + 516.3434840515602, + 76.36363636363615, + 78.08080808080791, + 74.64646464646444 + ], + [ + 520.0759127100596, + 76.96969696969677, + 78.68686868686848, + 75.25252525252506 + ], + [ + 523.808341368559, + 77.5757575757574, + 79.2929292929291, + 75.85858585858568 + ], + [ + 527.540770027058, + 78.18181818181802, + 79.89898989898973, + 76.46464646464625 + ], + [ + 531.2731986855574, + 78.78787878787858, + 80.50505050505029, + 77.07070707070687 + ], + [ + 535.0056273440564, + 79.3939393939392, + 81.11111111111092, + 77.6767676767675 + ], + [ + 538.7380560025558, + 79.99999999999983, + 81.71717171717154, + 78.28282828282812 + ], + [ + 542.4704846610548, + 80.7070707070705, + 82.32323232323216, + 79.0909090909089 + ], + [ + 546.2029133195542, + 81.31313131313112, + 82.92929292929273, + 79.69696969696952 + ], + [ + 549.9353419780532, + 81.91919191919175, + 83.53535353535335, + 80.30303030303014 + ], + [ + 553.6677706365526, + 82.52525252525231, + 84.14141414141397, + 80.90909090909071 + ], + [ + 557.4001992950516, + 83.13131313131294, + 84.74747474747454, + 81.51515151515133 + ], + [ + 561.132627953551, + 83.63636363636346, + 85.35353535353516, + 81.91919191919175 + ], + [ + 564.8650566120505, + 84.24242424242408, + 85.95959595959579, + 82.52525252525231 + ], + [ + 568.5974852705494, + 84.84848484848465, + 86.56565656565641, + 83.13131313131294 + ], + [ + 572.3299139290489, + 85.45454545454527, + 87.17171717171698, + 83.73737373737356 + ], + [ + 576.0623425875478, + 86.06060606060589, + 87.7777777777776, + 84.34343434343418 + ], + [ + 579.7947712460473, + 86.66666666666646, + 88.38383838383822, + 84.94949494949475 + ], + [ + 583.5271999045463, + 87.17171717171698, + 88.78787878787858, + 85.55555555555537 + ], + [ + 587.2596285630457, + 87.7777777777776, + 89.3939393939392, + 86.161616161616 + ], + [ + 590.9920572215447, + 88.38383838383822, + 89.99999999999983, + 86.76767676767656 + ], + [ + 594.7244858800441, + 88.98989898989879, + 90.60606060606045, + 87.37373737373719 + ], + [ + 598.4569145385431, + 89.59595959595941, + 91.21212121212102, + 87.97979797979781 + ], + [ + 602.1893431970425, + 90.20202020202004, + 91.81818181818164, + 88.58585858585843 + ], + [ + 605.9217718555419, + 90.60606060606045, + 92.22222222222206, + 88.98989898989879 + ], + [ + 609.6542005140409, + 91.21212121212102, + 92.82828282828262, + 89.59595959595941 + ], + [ + 613.3866291725403, + 91.81818181818164, + 93.43434343434325, + 90.20202020202004 + ], + [ + 617.1190578310393, + 92.42424242424227, + 94.04040404040387, + 90.8080808080806 + ], + [ + 620.8514864895387, + 93.03030303030283, + 94.6464646464645, + 91.41414141414123 + ], + [ + 624.5839151480377, + 93.53535353535335, + 95.05050505050485, + 92.02020202020185 + ], + [ + 628.3163438065371, + 94.04040404040387, + 95.65656565656548, + 92.42424242424227 + ], + [ + 632.0487724650361, + 94.6464646464645, + 96.2626262626261, + 93.03030303030283 + ], + [ + 635.7812011235355, + 95.25252525252506, + 96.86868686868672, + 93.63636363636346 + ], + [ + 639.513629782035, + 95.75757575757558, + 97.27272727272708, + 94.24242424242408 + ], + [ + 643.246058440534, + 96.3636363636362, + 97.8787878787877, + 94.84848484848465 + ], + [ + 646.9784870990334, + 96.86868686868672, + 98.48484848484833, + 95.25252525252506 + ], + [ + 650.7109157575323, + 97.47474747474729, + 99.0909090909089, + 95.85858585858568 + ], + [ + 654.4433444160318, + 97.97979797979781, + 99.49494949494931, + 96.46464646464631 + ], + [ + 658.1757730745308, + 98.58585858585843, + 100.10101010100993, + 97.07070707070687 + ], + [ + 661.9082017330302, + 99.0909090909089, + 100.70707070707056, + 97.47474747474729 + ], + [ + 665.6406303915292, + 99.59595959595941, + 101.11111111111092, + 98.08080808080791 + ], + [ + 669.3730590500286, + 100.20202020202004, + 101.71717171717154, + 98.68686868686854 + ], + [ + 673.1054877085276, + 100.70707070707056, + 102.32323232323216, + 99.0909090909089 + ], + [ + 676.837916367027, + 101.21212121212102, + 102.72727272727258, + 99.69696969696952 + ], + [ + 680.5703450255264, + 101.81818181818164, + 103.33333333333314, + 100.30303030303014 + ], + [ + 684.3027736840254, + 102.32323232323216, + 103.93939393939377, + 100.70707070707056 + ], + [ + 688.0352023425248, + 102.82828282828268, + 104.34343434343418, + 101.31313131313112 + ], + [ + 691.7676310010238, + 103.43434343434325, + 104.9494949494948, + 101.91919191919175 + ], + [ + 695.5000596595232, + 103.83838383838366, + 105.35353535353516, + 102.32323232323216 + ], + [ + 699.2324883180222, + 104.44444444444429, + 105.95959595959579, + 102.92929292929279 + ], + [ + 702.9649169765216, + 105.05050505050491, + 106.56565656565641, + 103.53535353535335 + ], + [ + 706.6973456350206, + 105.45454545454527, + 106.96969696969683, + 103.93939393939377 + ], + [ + 710.42977429352, + 106.06060606060589, + 107.5757575757574, + 104.54545454545439 + ], + [ + 714.162202952019, + 106.56565656565641, + 107.97979797979781, + 105.15151515151496 + ], + [ + 717.8946316105184, + 107.07070707070693, + 108.58585858585843, + 105.55555555555537 + ], + [ + 721.6270602690179, + 107.6767676767675, + 109.19191919191906, + 106.161616161616 + ], + [ + 725.3594889275168, + 108.08080808080791, + 109.59595959595941, + 106.56565656565641 + ], + [ + 729.0919175860163, + 108.68686868686854, + 110.20202020202004, + 107.17171717171703 + ], + [ + 732.8243462445153, + 109.19191919191906, + 110.60606060606045, + 107.7777777777776 + ], + [ + 736.5567749030147, + 109.69696969696952, + 111.21212121212108, + 108.18181818181802 + ], + [ + 740.2892035615137, + 110.20202020202004, + 111.61616161616143, + 108.78787878787864 + ], + [ + 744.0216322200131, + 110.70707070707056, + 112.22222222222206, + 109.19191919191906 + ], + [ + 747.7540608785121, + 111.21212121212108, + 112.62626262626247, + 109.79797979797962 + ], + [ + 751.4864895370115, + 111.71717171717154, + 113.2323232323231, + 110.20202020202004 + ], + [ + 755.2189181955109, + 112.22222222222206, + 113.63636363636346, + 110.80808080808066 + ], + [ + 758.9513468540099, + 112.82828282828268, + 114.24242424242408, + 111.41414141414123 + ], + [ + 762.6837755125093, + 113.2323232323231, + 114.6464646464645, + 111.81818181818164 + ], + [ + 766.4162041710083, + 113.83838383838366, + 115.25252525252512, + 112.42424242424227 + ], + [ + 770.1486328295077, + 114.24242424242408, + 115.65656565656548, + 112.82828282828268 + ], + [ + 773.8810614880067, + 114.8484848484847, + 116.2626262626261, + 113.43434343434325 + ], + [ + 777.6134901465061, + 115.25252525252512, + 116.66666666666652, + 113.83838383838366 + ], + [ + 781.3459188050051, + 115.85858585858568, + 117.27272727272714, + 114.44444444444429 + ], + [ + 785.0783474635045, + 116.2626262626261, + 117.6767676767675, + 114.8484848484847 + ], + [ + 788.8107761220035, + 116.66666666666652, + 118.08080808080791, + 115.25252525252512 + ], + [ + 792.543204780503, + 117.27272727272714, + 118.68686868686854, + 115.85858585858568 + ], + [ + 796.2756334390024, + 117.6767676767675, + 119.09090909090895, + 116.2626262626261 + ], + [ + 800.0080620975014, + 118.28282828282812, + 119.69696969696952, + 116.86868686868672 + ], + [ + 803.7404907560008, + 118.68686868686854, + 120.10101010100993, + 117.27272727272714 + ], + [ + 807.4729194144998, + 119.29292929292916, + 120.70707070707056, + 117.8787878787877 + ], + [ + 811.2053480729992, + 119.69696969696952, + 121.11111111111097, + 118.28282828282812 + ], + [ + 814.9377767314982, + 120.20202020202004, + 121.51515151515139, + 118.88888888888874 + ], + [ + 818.6702053899976, + 120.70707070707056, + 122.12121212121195, + 119.29292929292916 + ], + [ + 822.4026340484966, + 121.11111111111097, + 122.52525252525237, + 119.69696969696952 + ], + [ + 826.135062706996, + 121.61616161616143, + 122.92929292929279, + 120.30303030303014 + ], + [ + 829.867491365495, + 122.12121212121195, + 123.53535353535341, + 120.70707070707056 + ], + [ + 833.5999200239944, + 122.62626262626247, + 123.93939393939377, + 121.31313131313118 + ], + [ + 837.3323486824938, + 123.131313131313, + 124.54545454545439, + 121.71717171717154 + ], + [ + 841.0647773409928, + 123.53535353535341, + 124.9494949494948, + 122.12121212121195 + ], + [ + 844.7972059994922, + 124.04040404040387, + 125.35353535353522, + 122.72727272727258 + ], + [ + 848.5296346579912, + 124.54545454545439, + 125.95959595959579, + 123.131313131313 + ], + [ + 852.2620633164906, + 125.05050505050491, + 126.3636363636362, + 123.73737373737356 + ], + [ + 855.9944919749896, + 125.45454545454533, + 126.76767676767662, + 124.14141414141397 + ], + [ + 859.726920633489, + 125.85858585858568, + 127.17171717171703, + 124.54545454545439 + ], + [ + 863.459349291988, + 126.46464646464631, + 127.7777777777776, + 125.15151515151501 + ], + [ + 867.1917779504874, + 126.86868686868672, + 128.18181818181802, + 125.55555555555543 + ], + [ + 870.9242066089864, + 127.27272727272714, + 128.58585858585843, + 125.95959595959579 + ], + [ + 874.6566352674859, + 127.8787878787877, + 129.19191919191906, + 126.56565656565641 + ], + [ + 878.3890639259853, + 128.28282828282812, + 129.59595959595947, + 126.96969696969683 + ], + [ + 882.1214925844843, + 128.68686868686854, + 129.99999999999983, + 127.37373737373724 + ], + [ + 885.8539212429837, + 129.19191919191906, + 130.60606060606045, + 127.7777777777776 + ], + [ + 889.5863499014827, + 129.69696969696957, + 131.01010101010087, + 128.38383838383822 + ], + [ + 893.3187785599821, + 130.10101010100993, + 131.41414141414128, + 128.78787878787864 + ], + [ + 897.0512072184811, + 130.50505050505035, + 131.8181818181817, + 129.19191919191906 + ], + [ + 900.7836358769805, + 131.11111111111097, + 132.42424242424227, + 129.79797979797968 + ], + [ + 904.5160645354795, + 131.5151515151514, + 132.82828282828268, + 130.20202020202004 + ], + [ + 908.2484931939789, + 131.91919191919175, + 133.2323232323231, + 130.60606060606045 + ], + [ + 911.9809218524783, + 132.32323232323216, + 133.6363636363635, + 131.01010101010087 + ], + [ + 915.7133505109773, + 132.82828282828268, + 134.04040404040387, + 131.6161616161615 + ], + [ + 919.4457791694767, + 133.3333333333332, + 134.6464646464645, + 132.02020202020185 + ], + [ + 923.1782078279757, + 133.73737373737362, + 135.0505050505049, + 132.42424242424227 + ], + [ + 926.9106364864751, + 134.14141414141397, + 135.45454545454533, + 132.82828282828268 + ], + [ + 930.6430651449741, + 134.6464646464645, + 135.85858585858574, + 133.4343434343433 + ], + [ + 934.3754938034735, + 135.151515151515, + 136.4646464646463, + 133.83838383838372 + ], + [ + 938.1079224619725, + 135.55555555555543, + 136.86868686868672, + 134.24242424242408 + ], + [ + 941.840351120472, + 135.95959595959584, + 137.27272727272714, + 134.6464646464645 + ], + [ + 945.5727797789709, + 136.4646464646463, + 137.67676767676755, + 135.25252525252512 + ], + [ + 949.3052084374704, + 136.86868686868672, + 138.0808080808079, + 135.65656565656553 + ], + [ + 953.0376370959698, + 137.27272727272714, + 138.48484848484833, + 136.0606060606059 + ], + [ + 956.7700657544688, + 137.77777777777766, + 139.09090909090895, + 136.4646464646463 + ], + [ + 960.5024944129682, + 138.18181818181802, + 139.49494949494937, + 136.86868686868672 + ], + [ + 964.2349230714672, + 138.58585858585843, + 139.89898989898978, + 137.27272727272714 + ], + [ + 967.9673517299666, + 139.09090909090895, + 140.30303030303014, + 137.87878787878776 + ], + [ + 971.6997803884656, + 139.49494949494937, + 140.70707070707056, + 138.28282828282812 + ], + [ + 975.432209046965, + 139.89898989898978, + 141.11111111111097, + 138.68686868686854 + ], + [ + 979.164637705464, + 140.30303030303014, + 141.5151515151514, + 139.09090909090895 + ], + [ + 982.8970663639634, + 140.70707070707056, + 141.9191919191918, + 139.49494949494937 + ], + [ + 986.6294950224624, + 140.90909090909076, + 141.9191919191918, + 139.89898989898978 + ], + [ + 990.3619236809618, + 141.21212121212108, + 141.9191919191918, + 140.50505050505035 + ], + [ + 994.0943523394612, + 141.41414141414128, + 141.9191919191918, + 140.90909090909076 + ], + [ + 997.8267809979602, + 141.6161616161615, + 141.9191919191918, + 141.31313131313118 + ], + [ + 1001.5592096564596, + 141.8181818181817, + 141.9191919191918, + 141.7171717171716 + ], + [ + 1053.8132108754485, + 148.78787878787864, + 149.9999999999999, + 147.57575757575745 + ], + [ + 1057.545639533948, + 149.19191919191906, + 150.4040404040403, + 147.97979797979787 + ], + [ + 1061.2780681924469, + 149.59595959595947, + 150.80808080808066, + 148.38383838383822 + ], + [ + 1065.0104968509463, + 149.9999999999999, + 151.21212121212108, + 148.78787878787864 + ], + [ + 1068.7429255094457, + 150.4040404040403, + 151.6161616161615, + 149.19191919191906 + ], + [ + 1072.4753541679447, + 150.80808080808066, + 152.0202020202019, + 149.59595959595947 + ], + [ + 1076.2077828264441, + 151.21212121212108, + 152.42424242424232, + 149.9999999999999 + ], + [ + 1079.9402114849431, + 151.6161616161615, + 152.82828282828268, + 150.4040404040403 + ], + [ + 1083.6726401434425, + 152.0202020202019, + 153.2323232323231, + 150.80808080808066 + ], + [ + 1087.4050688019415, + 152.42424242424232, + 153.6363636363635, + 151.21212121212108 + ], + [ + 1091.137497460441, + 152.82828282828268, + 154.04040404040393, + 151.6161616161615 + ], + [ + 1094.86992611894, + 153.2323232323231, + 154.44444444444434, + 152.0202020202019 + ], + [ + 1098.6023547774394, + 153.6363636363635, + 154.8484848484847, + 152.42424242424232 + ], + [ + 1102.3347834359383, + 154.04040404040393, + 155.25252525252512, + 152.82828282828268 + ], + [ + 1106.0672120944378, + 154.44444444444434, + 155.65656565656553, + 153.2323232323231 + ], + [ + 1109.7996407529372, + 154.8484848484847, + 156.06060606060595, + 153.6363636363635 + ], + [ + 1113.5320694114362, + 155.151515151515, + 156.26262626262616, + 154.04040404040393 + ], + [ + 1117.2644980699356, + 155.55555555555543, + 156.66666666666652, + 154.44444444444434 + ], + [ + 1120.9969267284346, + 155.95959595959584, + 157.07070707070693, + 154.8484848484847 + ], + [ + 1124.729355386934, + 156.36363636363626, + 157.47474747474735, + 155.25252525252512 + ], + [ + 1128.461784045433, + 156.76767676767662, + 157.87878787878776, + 155.65656565656553 + ], + [ + 1132.1942127039324, + 157.17171717171703, + 158.28282828282818, + 156.06060606060595 + ], + [ + 1135.9266413624314, + 157.57575757575745, + 158.68686868686854, + 156.46464646464636 + ], + [ + 1139.6590700209308, + 157.97979797979787, + 159.09090909090895, + 156.86868686868672 + ], + [ + 1143.3914986794298, + 158.38383838383828, + 159.49494949494937, + 157.27272727272714 + ], + [ + 1147.1239273379292, + 158.78787878787864, + 159.89898989898978, + 157.67676767676755 + ], + [ + 1150.8563559964286, + 159.19191919191906, + 160.3030303030302, + 158.08080808080797 + ], + [ + 1154.5887846549276, + 159.49494949494937, + 160.70707070707056, + 158.28282828282818 + ], + [ + 1158.321213313427, + 159.79797979797968, + 160.90909090909076, + 158.68686868686854 + ], + [ + 1162.053641971926, + 160.2020202020201, + 161.31313131313118, + 159.09090909090895 + ], + [ + 1165.7860706304255, + 160.6060606060605, + 161.7171717171716, + 159.49494949494937 + ], + [ + 1169.5184992889244, + 161.01010101010087, + 162.121212121212, + 159.89898989898978 + ], + [ + 1173.2509279474239, + 161.41414141414128, + 162.52525252525243, + 160.3030303030302 + ], + [ + 1176.9833566059228, + 161.8181818181817, + 162.92929292929279, + 160.70707070707056 + ], + [ + 1180.7157852644223, + 162.22222222222211, + 163.3333333333332, + 161.11111111111097 + ], + [ + 1184.4482139229217, + 162.52525252525243, + 163.5353535353534, + 161.5151515151514 + ], + [ + 1188.1806425814207, + 162.82828282828268, + 163.93939393939382, + 161.7171717171716 + ], + [ + 1191.91307123992, + 163.2323232323231, + 164.34343434343424, + 162.121212121212 + ], + [ + 1195.645499898419, + 163.6363636363635, + 164.74747474747466, + 162.52525252525243 + ], + [ + 1199.3779285569185, + 164.04040404040393, + 165.151515151515, + 162.92929292929279 + ], + [ + 1203.1103572154175, + 164.44444444444434, + 165.55555555555543, + 163.3333333333332 + ], + [ + 1206.842785873917, + 164.74747474747466, + 165.75757575757564, + 163.73737373737362 + ], + [ + 1210.5752145324159, + 165.151515151515, + 166.16161616161605, + 164.14141414141403 + ], + [ + 1214.3076431909153, + 165.45454545454533, + 166.56565656565647, + 164.34343434343424 + ], + [ + 1218.0400718494143, + 165.85858585858574, + 166.96969696969683, + 164.74747474747466 + ], + [ + 1221.7725005079137, + 166.26262626262616, + 167.37373737373724, + 165.151515151515 + ], + [ + 1225.5049291664131, + 166.56565656565647, + 167.57575757575745, + 165.55555555555543 + ], + [ + 1229.2373578249121, + 166.96969696969683, + 167.97979797979787, + 165.95959595959584 + ], + [ + 1232.9697864834116, + 167.27272727272714, + 168.38383838383828, + 166.16161616161605 + ], + [ + 1236.7022151419105, + 167.67676767676755, + 168.7878787878787, + 166.56565656565647 + ], + [ + 1240.43464380041, + 168.08080808080797, + 169.19191919191906, + 166.96969696969683 + ], + [ + 1244.167072458909, + 168.38383838383828, + 169.39393939393926, + 167.37373737373724 + ], + [ + 1247.8995011174084, + 168.7878787878787, + 169.79797979797968, + 167.77777777777766 + ], + [ + 1251.6319297759073, + 169.09090909090895, + 170.2020202020201, + 167.97979797979787 + ], + [ + 1255.3643584344068, + 169.49494949494937, + 170.6060606060605, + 168.38383838383828 + ], + [ + 1259.0967870929057, + 169.79797979797968, + 170.80808080808072, + 168.7878787878787 + ], + [ + 1262.8292157514052, + 170.2020202020201, + 171.21212121212108, + 169.19191919191906 + ], + [ + 1266.5616444099046, + 170.6060606060605, + 171.6161616161615, + 169.59595959595947 + ], + [ + 1270.2940730684036, + 170.90909090909082, + 172.0202020202019, + 169.79797979797968 + ], + [ + 1274.026501726903, + 171.21212121212108, + 172.22222222222211, + 170.2020202020201 + ], + [ + 1277.758930385402, + 171.6161616161615, + 172.62626262626253, + 170.6060606060605 + ], + [ + 1281.4913590439014, + 172.0202020202019, + 173.03030303030295, + 171.01010101010087 + ], + [ + 1285.2237877024004, + 172.32323232323222, + 173.4343434343433, + 171.21212121212108 + ], + [ + 1288.9562163608998, + 172.62626262626253, + 173.6363636363635, + 171.6161616161615 + ], + [ + 1292.6886450193988, + 173.03030303030295, + 174.04040404040393, + 172.0202020202019 + ], + [ + 1296.4210736778982, + 173.4343434343433, + 174.44444444444434, + 172.42424242424232 + ], + [ + 1300.1535023363972, + 173.73737373737362, + 174.84848484848476, + 172.62626262626253 + ], + [ + 1303.8859309948966, + 174.04040404040393, + 175.05050505050497, + 173.03030303030295 + ], + [ + 1307.618359653396, + 174.44444444444434, + 175.45454545454533, + 173.4343434343433 + ], + [ + 1311.350788311895, + 174.74747474747466, + 175.85858585858574, + 173.6363636363635 + ], + [ + 1315.0832169703945, + 175.05050505050497, + 176.06060606060595, + 174.04040404040393 + ], + [ + 1318.8156456288934, + 175.45454545454533, + 176.46464646464636, + 174.44444444444434 + ], + [ + 1322.5480742873929, + 175.85858585858574, + 176.86868686868678, + 174.84848484848476 + ], + [ + 1326.2805029458918, + 176.06060606060595, + 177.070707070707, + 175.05050505050497 + ], + [ + 1330.0129316043913, + 176.46464646464636, + 177.47474747474735, + 175.45454545454533 + ], + [ + 1333.7453602628902, + 176.86868686868678, + 177.87878787878776, + 175.85858585858574 + ], + [ + 1337.4777889213897, + 177.070707070707, + 178.08080808080797, + 176.06060606060595 + ], + [ + 1341.210217579889, + 177.47474747474735, + 178.48484848484838, + 176.46464646464636 + ], + [ + 1344.942646238388, + 177.87878787878776, + 178.8888888888888, + 176.86868686868678 + ], + [ + 1348.6750748968875, + 178.08080808080797, + 179.090909090909, + 177.070707070707 + ], + [ + 1352.4075035553865, + 178.48484848484838, + 179.49494949494937, + 177.47474747474735 + ], + [ + 1356.139932213886, + 178.8888888888888, + 179.89898989898978, + 177.87878787878776 + ], + [ + 1359.872360872385, + 179.090909090909, + 180.10101010101, + 178.08080808080797 + ], + [ + 1363.6047895308843, + 179.49494949494937, + 180.5050505050504, + 178.48484848484838 + ], + [ + 1367.3372181893833, + 179.89898989898978, + 180.90909090909082, + 178.8888888888888 + ], + [ + 1371.0696468478827, + 180.10101010101, + 181.11111111111103, + 179.090909090909 + ], + [ + 1374.8020755063817, + 180.5050505050504, + 181.5151515151514, + 179.49494949494937 + ], + [ + 1378.5345041648811, + 180.90909090909082, + 181.9191919191918, + 179.89898989898978 + ], + [ + 1382.2669328233806, + 181.11111111111103, + 182.121212121212, + 180.10101010101 + ], + [ + 1385.9993614818795, + 181.5151515151514, + 182.52525252525243, + 180.5050505050504 + ], + [ + 1389.7317901403785, + 181.8181818181817, + 182.72727272727263, + 180.90909090909082 + ], + [ + 1393.4642187988784, + 182.121212121212, + 183.13131313131305, + 181.11111111111103 + ], + [ + 1397.1966474573774, + 182.52525252525243, + 183.5353535353534, + 181.5151515151514 + ], + [ + 1400.9290761158763, + 182.72727272727263, + 183.73737373737362, + 181.7171717171716 + ], + [ + 1404.6615047743753, + 183.13131313131305, + 184.14141414141403, + 182.121212121212 + ], + [ + 1408.3939334328752, + 183.4343434343433, + 184.34343434343424, + 182.52525252525243 + ], + [ + 1412.1263620913742, + 183.73737373737362, + 184.74747474747466, + 182.72727272727263 + ], + [ + 1415.8587907498732, + 184.14141414141403, + 185.15151515151507, + 183.13131313131305 + ], + [ + 1419.591219408373, + 184.34343434343424, + 185.35353535353528, + 183.33333333333326 + ], + [ + 1423.323648066872, + 184.74747474747466, + 185.75757575757564, + 183.73737373737362 + ], + [ + 1427.056076725371, + 185.05050505050497, + 185.95959595959584, + 184.14141414141403 + ], + [ + 1430.78850538387, + 185.35353535353528, + 186.36363636363626, + 184.34343434343424 + ], + [ + 1434.5209340423698, + 185.65656565656553, + 186.56565656565647, + 184.74747474747466 + ], + [ + 1438.2533627008688, + 185.95959595959584, + 186.96969696969688, + 184.94949494949486 + ], + [ + 1441.9857913593678, + 186.26262626262616, + 187.1717171717171, + 185.35353535353528 + ], + [ + 1445.7182200178668, + 186.66666666666657, + 187.57575757575745, + 185.75757575757564 + ], + [ + 1449.4506486763667, + 186.96969696969688, + 187.97979797979787, + 185.95959595959584 + ], + [ + 1453.1830773348656, + 187.2727272727272, + 188.18181818181807, + 186.36363636363626 + ], + [ + 1456.9155059933646, + 187.57575757575745, + 188.5858585858585, + 186.56565656565647 + ], + [ + 1460.6479346518645, + 187.87878787878776, + 188.7878787878787, + 186.96969696969688 + ], + [ + 1464.3803633103635, + 188.18181818181807, + 189.1919191919191, + 187.1717171717171 + ], + [ + 1468.1127919688624, + 188.48484848484838, + 189.39393939393932, + 187.57575757575745 + ], + [ + 1471.8452206273614, + 188.7878787878787, + 189.79797979797968, + 187.77777777777766 + ], + [ + 1475.5776492858613, + 189.090909090909, + 189.9999999999999, + 188.18181818181807 + ], + [ + 1479.3100779443603, + 189.39393939393932, + 190.4040404040403, + 188.38383838383828 + ], + [ + 1483.0425066028592, + 189.69696969696957, + 190.6060606060605, + 188.7878787878787 + ], + [ + 1486.7749352613582, + 190.10101010101, + 191.01010101010093, + 189.1919191919191 + ], + [ + 1490.507363919858, + 190.3030303030302, + 191.21212121212113, + 189.39393939393932 + ], + [ + 1494.239792578357, + 190.7070707070706, + 191.6161616161615, + 189.79797979797968 + ], + [ + 1497.972221236856, + 190.90909090909082, + 191.8181818181817, + 189.9999999999999 + ], + [ + 1501.704649895356, + 191.31313131313124, + 192.22222222222211, + 190.4040404040403 + ], + [ + 1505.437078553855, + 191.51515151515144, + 192.42424242424232, + 190.6060606060605 + ], + [ + 1509.169507212354, + 191.9191919191918, + 192.82828282828274, + 191.01010101010093 + ], + [ + 1512.9019358708529, + 192.121212121212, + 193.03030303030295, + 191.21212121212113 + ], + [ + 1516.6343645293528, + 192.52525252525243, + 193.43434343434336, + 191.6161616161615 + ], + [ + 1520.3667931878517, + 192.72727272727263, + 193.6363636363635, + 191.8181818181817 + ], + [ + 1524.0992218463507, + 193.13131313131305, + 194.04040404040393, + 192.22222222222211 + ], + [ + 1527.8316505048497, + 193.33333333333326, + 194.24242424242414, + 192.42424242424232 + ], + [ + 1531.5640791633496, + 193.73737373737362, + 194.64646464646455, + 192.82828282828274 + ], + [ + 1535.2965078218485, + 193.93939393939382, + 194.84848484848476, + 193.03030303030295 + ], + [ + 1539.0289364803475, + 194.24242424242414, + 195.25252525252517, + 193.23232323232315 + ], + [ + 1542.7613651388474, + 194.54545454545445, + 195.45454545454538, + 193.6363636363635 + ], + [ + 1546.4937937973464, + 194.74747474747466, + 195.6565656565656, + 193.83838383838372 + ], + [ + 1550.2262224558453, + 195.15151515151507, + 196.06060606060595, + 194.24242424242414 + ], + [ + 1553.9586511143443, + 195.35353535353528, + 196.26262626262616, + 194.44444444444434 + ], + [ + 1557.6910797728442, + 195.75757575757564, + 196.66666666666657, + 194.84848484848476 + ], + [ + 1561.4235084313432, + 195.95959595959584, + 196.86868686868678, + 195.05050505050497 + ], + [ + 1565.1559370898422, + 196.36363636363626, + 197.2727272727272, + 195.45454545454538 + ], + [ + 1568.8883657483411, + 196.56565656565647, + 197.4747474747474, + 195.6565656565656 + ], + [ + 1572.620794406841, + 196.96969696969688, + 197.87878787878776, + 196.06060606060595 + ], + [ + 1576.35322306534, + 197.1717171717171, + 198.08080808080797, + 196.26262626262616 + ], + [ + 1580.085651723839, + 197.3737373737373, + 198.28282828282818, + 196.46464646464636 + ], + [ + 1583.8180803823388, + 197.77777777777766, + 198.6868686868686, + 196.86868686868678 + ], + [ + 1587.5505090408378, + 197.97979797979787, + 198.8888888888888, + 197.070707070707 + ], + [ + 1591.2829376993368, + 198.38383838383828, + 199.29292929292922, + 197.4747474747474 + ], + [ + 1595.0153663578358, + 198.5858585858585, + 199.49494949494942, + 197.6767676767676 + ], + [ + 1598.7477950163357, + 198.8888888888888, + 199.69696969696963, + 198.08080808080797 + ], + [ + 1602.4802236748346, + 199.1919191919191, + 200.10101010101, + 198.28282828282818 + ], + [ + 1606.2126523333336, + 199.39393939393932, + 200.3030303030302, + 198.48484848484838 + ], + [ + 1609.9450809918326, + 199.59595959595953, + 200.3030303030302, + 198.8888888888888 + ], + [ + 1613.6775096503325, + 199.69696969696963, + 200.3030303030302, + 199.090909090909 + ], + [ + 1617.4099383088314, + 199.79797979797974, + 200.3030303030302, + 199.29292929292922 + ], + [ + 1621.1423669673304, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1624.8747956258303, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1628.6072242843293, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1632.3396529428283, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1636.0720816013272, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1639.804510259827, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1643.536938918326, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1647.269367576825, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1651.001796235324, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1654.734224893824, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1658.466653552323, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1662.1990822108219, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1665.9315108693218, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1669.6639395278207, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1673.3963681863197, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1677.1287968448187, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1680.8612255033186, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1684.5936541618175, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1688.3260828203165, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1692.0585114788164, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1695.7909401373154, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1699.5233687958143, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1703.2557974543133, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1706.9882261128132, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1710.7206547713122, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1714.4530834298112, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1718.1855120883101, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1721.91794074681, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1725.650369405309, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1729.382798063808, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1733.1152267223079, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1736.8476553808068, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1740.5800840393058, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1744.3125126978048, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1748.0449413563047, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1751.7773700148036, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1755.5097986733026, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1759.2422273318016, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1762.9746559903015, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1766.7070846488004, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1770.4395133072994, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1774.1719419657993, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1777.9043706242983, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1781.6367992827973, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1785.3692279412962, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1789.1016565997961, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1792.834085258295, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1796.566513916794, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1800.298942575293, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1804.031371233793, + 199.89898989898978, + 200.3030303030302, + 199.49494949494942 + ], + [ + 1807.763799892292, + 198.48484848484838, + 200.3030303030302, + 196.66666666666657 + ], + [ + 1811.4962285507909, + 195.05050505050497, + 200.3030303030302, + 189.79797979797968 + ], + [ + 1815.2286572092908, + 192.121212121212, + 200.3030303030302, + 183.93939393939382 + ], + [ + 1818.9610858677897, + 189.39393939393932, + 200.3030303030302, + 178.48484848484838 + ], + [ + 1822.6935145262887, + 186.96969696969688, + 200.3030303030302, + 173.6363636363635 + ], + [ + 1826.4259431847877, + 184.24242424242414, + 199.49494949494942, + 168.98989898989885 + ], + [ + 1830.1583718432876, + 178.38383838383828, + 192.0202020202019, + 164.74747474747466 + ], + [ + 1833.8908005017865, + 173.2323232323231, + 185.75757575757564, + 160.70707070707056 + ], + [ + 1837.6232291602855, + 168.5858585858585, + 180.3030303030302, + 156.86868686868672 + ], + [ + 1841.3556578187845, + 164.14141414141403, + 175.25252525252512, + 153.0303030303029 + ], + [ + 1845.0880864772844, + 160.10101010101, + 170.6060606060605, + 149.59595959595947 + ], + [ + 1848.8205151357834, + 156.16161616161605, + 166.16161616161605, + 146.16161616161605 + ], + [ + 1852.5529437942823, + 152.42424242424232, + 161.9191919191918, + 142.92929292929279 + ], + [ + 1856.2853724527822, + 148.88888888888874, + 158.08080808080797, + 139.69696969696957 + ], + [ + 1860.0178011112812, + 145.55555555555543, + 154.24242424242414, + 136.86868686868672 + ], + [ + 1863.7502297697802, + 142.32323232323216, + 150.80808080808066, + 133.83838383838372 + ], + [ + 1867.4826584282791, + 139.19191919191906, + 147.37373737373724, + 131.01010101010087 + ], + [ + 1871.215087086779, + 136.161616161616, + 143.93939393939382, + 128.38383838383822 + ], + [ + 1874.947515745278, + 133.3333333333332, + 140.90909090909076, + 125.75757575757558 + ], + [ + 1878.679944403777, + 130.50505050505035, + 137.87878787878776, + 123.131313131313 + ], + [ + 1882.412373062276, + 127.7777777777776, + 134.8484848484847, + 120.70707070707056 + ], + [ + 1886.1448017207758, + 125.15151515151501, + 132.02020202020185, + 118.28282828282812 + ], + [ + 1889.8772303792748, + 122.52525252525237, + 129.19191919191906, + 115.85858585858568 + ], + [ + 1893.6096590377738, + 120.10101010100993, + 126.56565656565641, + 113.63636363636346 + ], + [ + 1897.3420876962737, + 117.7777777777776, + 124.14141414141397, + 111.41414141414123 + ], + [ + 1901.0745163547726, + 115.45454545454527, + 121.51515151515139, + 109.3939393939392 + ], + [ + 1904.8069450132716, + 113.131313131313, + 119.09090909090895, + 107.17171717171703 + ], + [ + 1908.5393736717706, + 111.01010101010087, + 116.86868686868672, + 105.15151515151496 + ], + [ + 1912.2718023302705, + 108.88888888888874, + 114.44444444444429, + 103.33333333333314 + ], + [ + 1916.0042309887695, + 106.76767676767662, + 112.22222222222206, + 101.31313131313112 + ], + [ + 1919.7366596472684, + 104.8484848484847, + 110.20202020202004, + 99.49494949494931 + ], + [ + 1923.4690883057674, + 102.82828282828268, + 107.97979797979781, + 97.6767676767675 + ], + [ + 1927.2015169642673, + 100.90909090909076, + 105.95959595959579, + 95.85858585858568 + ], + [ + 1930.9339456227663, + 99.0909090909089, + 103.93939393939377, + 94.24242424242408 + ], + [ + 1934.6663742812652, + 97.27272727272708, + 102.12121212121195, + 92.42424242424227 + ], + [ + 1938.3988029397651, + 95.45454545454527, + 100.10101010100993, + 90.8080808080806 + ], + [ + 1942.131231598264, + 93.73737373737356, + 98.28282828282812, + 89.191919191919 + ], + [ + 1945.863660256763, + 92.02020202020185, + 96.46464646464631, + 87.5757575757574 + ], + [ + 1949.596088915262, + 90.50505050505035, + 94.84848484848465, + 86.161616161616 + ], + [ + 1953.328517573762, + 88.78787878787858, + 93.03030303030283, + 84.54545454545433 + ], + [ + 1957.060946232261, + 87.27272727272708, + 91.41414141414123, + 83.13131313131294 + ], + [ + 1960.7933748907599, + 85.75757575757558, + 89.79797979797962, + 81.71717171717154 + ], + [ + 1964.5258035492598, + 84.24242424242408, + 88.18181818181802, + 80.30303030303014 + ], + [ + 1968.2582322077587, + 82.82828282828262, + 86.76767676767656, + 78.88888888888869 + ], + [ + 1971.9906608662577, + 81.41414141414123, + 85.15151515151496, + 77.6767676767675 + ], + [ + 1975.7230895247567, + 80.10101010100993, + 83.73737373737356, + 76.46464646464625 + ], + [ + 1979.4555181832566, + 78.68686868686848, + 82.32323232323216, + 75.05050505050485 + ], + [ + 1983.1879468417555, + 77.37373737373719, + 80.90909090909071, + 73.83838383838366 + ], + [ + 1986.9203755002545, + 76.06060606060589, + 79.49494949494931, + 72.62626262626242 + ], + [ + 1990.6528041587535, + 74.84848484848465, + 78.28282828282812, + 71.41414141414123 + ], + [ + 1994.3852328172534, + 73.63636363636346, + 76.86868686868667, + 70.40404040404019 + ], + [ + 1998.1176614757524, + 72.42424242424221, + 75.65656565656548, + 69.191919191919 + ], + [ + 2001.8500901342513, + 71.31313131313112, + 74.44444444444423, + 68.18181818181796 + ], + [ + 2005.5825187927512, + 70.20202020201998, + 73.23232323232304, + 67.17171717171698 + ], + [ + 2009.3149474512502, + 68.98989898989879, + 72.02020202020185, + 65.95959595959579 + ], + [ + 2013.0473761097492, + 67.8787878787877, + 70.8080808080806, + 64.94949494949475 + ], + [ + 2016.7798047682481, + 66.96969696969677, + 69.79797979797962, + 64.14141414141392 + ], + [ + 2020.512233426748, + 65.85858585858568, + 68.58585858585838, + 63.131313131312936 + ], + [ + 2024.244662085247, + 64.84848484848465, + 67.5757575757574, + 62.1212121212119 + ], + [ + 2027.977090743746, + 63.93939393939377, + 66.56565656565635, + 61.31313131313112 + ], + [ + 2031.709519402245, + 62.92929292929273, + 65.55555555555537, + 60.303030303030084 + ], + [ + 2035.4419480607448, + 62.02020202020179, + 64.54545454545433, + 59.49494949494931 + ], + [ + 2039.1743767192438, + 61.111111111110915, + 63.53535353535335, + 58.68686868686848 + ], + [ + 2042.9068053777428, + 60.10101010100988, + 62.52525252525231, + 57.6767676767675 + ], + [ + 2046.6392340362427, + 59.2929292929291, + 61.71717171717154, + 56.868686868686666 + ], + [ + 2050.3716626947416, + 58.48484848484827, + 60.7070707070705, + 56.26262626262604 + ], + [ + 2054.1040913532406, + 57.6767676767675, + 59.89898989898967, + 55.45454545454527 + ], + [ + 2057.8365200117396, + 56.868686868686666, + 59.090909090908895, + 54.64646464646444 + ], + [ + 2061.5689486702395, + 56.060606060605835, + 58.28282828282806, + 53.838383838383606 + ], + [ + 2065.3013773287385, + 55.353535353535165, + 57.47474747474729, + 53.23232323232304 + ], + [ + 2069.0338059872374, + 54.545454545454334, + 56.66666666666646, + 52.42424242424221 + ], + [ + 2072.7662346457364, + 53.838383838383606, + 55.85858585858563, + 51.818181818181586 + ], + [ + 2076.4986633042363, + 53.131313131312936, + 55.05050505050485, + 51.21212121212102 + ], + [ + 2080.2310919627353, + 52.42424242424221, + 54.24242424242402, + 50.606060606060396 + ], + [ + 2083.9635206212342, + 51.818181818181586, + 53.636363636363455, + 49.99999999999977 + ], + [ + 2087.695949279734, + 51.111111111110915, + 52.828282828282624, + 49.393939393939206 + ], + [ + 2091.428377938233, + 50.50505050505029, + 52.222222222222, + 48.78787878787858 + ], + [ + 2095.160806596732, + 49.89898989898967, + 51.61616161616138, + 48.18181818181796 + ], + [ + 2098.893235255231, + 49.2929292929291, + 51.01010101010081, + 47.575757575757336 + ], + [ + 2102.625663913731, + 48.78787878787858, + 50.40404040404019, + 47.17171717171698 + ], + [ + 2106.35809257223, + 48.18181818181796, + 49.797979797979565, + 46.565656565656354 + ], + [ + 2110.090521230729, + 47.67676767676744, + 49.191919191919, + 46.16161616161594 + ], + [ + 2113.822949889228, + 47.070707070706874, + 48.585858585858375, + 45.555555555555316 + ], + [ + 2117.5553785477277, + 46.565656565656354, + 47.97979797979775, + 45.15151515151496 + ], + [ + 2121.2878072062267, + 46.16161616161594, + 47.575757575757336, + 44.74747474747454 + ], + [ + 2125.0202358647257, + 45.65656565656542, + 46.96969696969677, + 44.343434343434126 + ], + [ + 2128.7526645232256, + 45.15151515151496, + 46.36363636363615, + 43.93939393939371 + ], + [ + 2132.4850931817246, + 44.74747474747454, + 45.95959595959573, + 43.535353535353295 + ], + [ + 2136.2175218402235, + 44.343434343434126, + 45.555555555555316, + 43.131313131312936 + ], + [ + 2139.9499504987225, + 43.838383838383606, + 44.94949494949475, + 42.72727272727252 + ], + [ + 2143.6823791572224, + 43.43434343434319, + 44.545454545454334, + 42.323232323232105 + ], + [ + 2147.4148078157214, + 43.03030303030283, + 44.14141414141392, + 41.91919191919169 + ], + [ + 2151.1472364742203, + 42.62626262626242, + 43.7373737373735, + 41.515151515151274 + ], + [ + 2154.8796651327193, + 42.323232323232105, + 43.333333333333144, + 41.313131313131066 + ], + [ + 2158.612093791219, + 41.91919191919169, + 42.92929292929273, + 40.90909090909071 + ], + [ + 2162.344522449718, + 41.61616161616138, + 42.52525252525231, + 40.7070707070705 + ], + [ + 2166.076951108217, + 41.313131313131066, + 42.323232323232105, + 40.303030303030084 + ], + [ + 2169.809379766717, + 41.01010101010081, + 41.91919191919169, + 40.10101010100988 + ], + [ + 2173.541808425216, + 40.808080808080604, + 41.71717171717148, + 39.89898989898967 + ], + [ + 2177.274237083715, + 40.40404040404019, + 41.313131313131066, + 39.49494949494925 + ], + [ + 2181.006665742214, + 40.10101010100988, + 41.111111111110915, + 39.090909090908895 + ], + [ + 2184.739094400714, + 39.69696969696946, + 40.7070707070705, + 38.68686868686848 + ], + [ + 2188.471523059213, + 39.39393939393915, + 40.50505050505029, + 38.28282828282806 + ], + [ + 2192.203951717712, + 39.090909090908895, + 40.303030303030084, + 37.87878787878765 + ], + [ + 2195.9363803762108, + 38.585858585858375, + 39.69696969696946, + 37.47474747474723 + ], + [ + 2199.6688090347106, + 38.28282828282806, + 39.292929292929045, + 37.272727272727025 + ], + [ + 2203.4012376932096, + 37.87878787878765, + 38.88888888888869, + 36.868686868686666 + ], + [ + 2207.1336663517086, + 37.67676767676744, + 38.68686868686848, + 36.66666666666646 + ], + [ + 2210.8660950102085, + 37.272727272727025, + 38.28282828282806, + 36.26262626262604 + ], + [ + 2214.5985236687075, + 36.868686868686666, + 37.87878787878765, + 35.85858585858563 + ], + [ + 2218.3309523272064, + 36.565656565656354, + 37.47474747474723, + 35.65656565656542 + ], + [ + 2222.0633809857054, + 36.36363636363615, + 37.272727272727025, + 35.45454545454521 + ], + [ + 2225.7958096442053, + 35.95959595959573, + 36.868686868686666, + 35.05050505050485 + ], + [ + 2229.5282383027043, + 35.75757575757552, + 36.66666666666646, + 34.848484848484645 + ], + [ + 2233.2606669612032, + 35.35353535353511, + 36.26262626262604, + 34.44444444444423 + ], + [ + 2236.993095619702, + 35.1515151515149, + 36.060606060605835, + 34.24242424242402 + ], + [ + 2240.725524278202, + 34.848484848484645, + 35.65656565656542, + 34.040404040403814 + ], + [ + 2244.457952936701, + 34.64646464646444, + 35.45454545454521, + 33.838383838383606 + ], + [ + 2248.1903815952, + 34.343434343434126, + 35.252525252525004, + 33.43434343434319 + ], + [ + 2251.9228102537, + 34.040404040403814, + 34.848484848484645, + 33.23232323232298 + ], + [ + 2255.655238912199, + 33.838383838383606, + 34.64646464646444, + 33.03030303030283 + ], + [ + 2259.387667570698, + 33.6363636363634, + 34.44444444444423, + 32.828282828282624 + ], + [ + 2263.120096229197, + 33.43434343434319, + 34.24242424242402, + 32.62626262626242 + ], + [ + 2266.8525248876967, + 33.13131313131288, + 33.838383838383606, + 32.42424242424221 + ], + [ + 2270.5849535461957, + 32.92929292929273, + 33.6363636363634, + 32.222222222222 + ], + [ + 2274.3173822046947, + 32.72727272727252, + 33.43434343434319, + 32.02020202020179 + ], + [ + 2278.0498108631946, + 32.42424242424221, + 33.23232323232298, + 31.616161616161378 + ], + [ + 2281.7822395216936, + 32.222222222222, + 33.03030303030283, + 31.41414141414117 + ], + [ + 2285.5146681801925, + 32.02020202020179, + 32.828282828282624, + 31.212121212120962 + ], + [ + 2289.2470968386915, + 31.818181818181586, + 32.62626262626242, + 31.01010101010081 + ], + [ + 2292.9795254971914, + 31.71717171717148, + 32.42424242424221, + 31.01010101010081 + ], + [ + 2296.7119541556904, + 31.515151515151274, + 32.222222222222, + 30.808080808080604 + ], + [ + 2300.4443828141893, + 31.313131313131066, + 32.02020202020179, + 30.606060606060396 + ], + [ + 2304.1768114726883, + 31.11111111111086, + 31.818181818181586, + 30.404040404040188 + ], + [ + 2307.909240131188, + 30.909090909090708, + 31.616161616161378, + 30.20202020201998 + ], + [ + 2311.641668789687, + 30.7070707070705, + 31.41414141414117, + 29.999999999999773 + ], + [ + 2315.374097448186, + 30.505050505050292, + 31.212121212120962, + 29.797979797979565 + ], + [ + 2319.106526106686, + 30.303030303030084, + 31.01010101010081, + 29.595959595959357 + ], + [ + 2322.838954765185, + 30.20202020201998, + 30.808080808080604, + 29.595959595959357 + ], + [ + 2326.571383423684, + 29.999999999999773, + 30.606060606060396, + 29.39393939393915 + ], + [ + 2330.303812082183, + 29.797979797979565, + 30.404040404040188, + 29.19191919191894 + ], + [ + 2334.036240740683, + 29.69696969696946, + 30.404040404040188, + 28.989898989898734 + ], + [ + 2337.768669399182, + 29.494949494949253, + 30.20202020201998, + 28.787878787878583 + ], + [ + 2341.501098057681, + 29.39393939393915, + 29.999999999999773, + 28.787878787878583 + ], + [ + 2345.2335267161798, + 29.19191919191894, + 29.797979797979565, + 28.585858585858375 + ], + [ + 2348.9659553746797, + 28.989898989898734, + 29.595959595959357, + 28.383838383838167 + ], + [ + 2352.6983840331786, + 28.989898989898734, + 29.595959595959357, + 28.383838383838167 + ], + [ + 2356.4308126916776, + 28.787878787878583, + 29.39393939393915, + 28.18181818181796 + ], + [ + 2360.1632413501775, + 28.585858585858375, + 29.19191919191894, + 27.979797979797752 + ], + [ + 2363.8956700086765, + 28.585858585858375, + 29.19191919191894, + 27.979797979797752 + ], + [ + 2367.6280986671754, + 28.383838383838167, + 28.989898989898734, + 27.777777777777544 + ], + [ + 2371.3605273256744, + 28.18181818181796, + 28.787878787878583, + 27.575757575757336 + ], + [ + 2375.0929559841743, + 28.080808080807856, + 28.585858585858375, + 27.575757575757336 + ], + [ + 2378.8253846426733, + 27.979797979797752, + 28.585858585858375, + 27.37373737373713 + ], + [ + 2382.5578133011722, + 27.878787878787648, + 28.383838383838167, + 27.37373737373713 + ], + [ + 2386.290241959671, + 27.777777777777544, + 28.383838383838167, + 27.17171717171692 + ], + [ + 2390.022670618171, + 27.67676767676744, + 28.18181818181796, + 27.17171717171692 + ], + [ + 2393.75509927667, + 27.474747474747232, + 27.979797979797752, + 26.969696969696713 + ], + [ + 2397.487527935169, + 27.37373737373713, + 27.979797979797752, + 26.767676767676562 + ], + [ + 2401.219956593669, + 27.272727272727025, + 27.777777777777544, + 26.767676767676562 + ], + [ + 2404.952385252168, + 27.17171717171692, + 27.777777777777544, + 26.565656565656354 + ], + [ + 2408.684813910667, + 27.070707070706817, + 27.575757575757336, + 26.565656565656354 + ], + [ + 2412.417242569166, + 26.969696969696713, + 27.575757575757336, + 26.363636363636147 + ], + [ + 2416.1496712276657, + 26.868686868686666, + 27.37373737373713, + 26.363636363636147 + ], + [ + 2419.8820998861647, + 26.767676767676562, + 27.37373737373713, + 26.16161616161594 + ], + [ + 2423.6145285446637, + 26.66666666666646, + 27.17171717171692, + 26.16161616161594 + ], + [ + 2427.3469572031627, + 26.66666666666646, + 27.17171717171692, + 26.16161616161594 + ], + [ + 2431.0793858616626, + 26.46464646464625, + 26.969696969696713, + 25.95959595959573 + ], + [ + 2434.8118145201615, + 26.46464646464625, + 26.969696969696713, + 25.95959595959573 + ], + [ + 2438.5442431786605, + 26.262626262626043, + 26.767676767676562, + 25.757575757575523 + ], + [ + 2442.2766718371604, + 26.262626262626043, + 26.767676767676562, + 25.757575757575523 + ], + [ + 2446.0091004956594, + 26.262626262626043, + 26.767676767676562, + 25.757575757575523 + ], + [ + 2449.7415291541583, + 26.060606060605835, + 26.565656565656354, + 25.555555555555316 + ], + [ + 2453.4739578126573, + 26.060606060605835, + 26.565656565656354, + 25.555555555555316 + ], + [ + 2457.206386471157, + 25.858585858585627, + 26.363636363636147, + 25.353535353535108 + ], + [ + 2460.938815129656, + 25.858585858585627, + 26.363636363636147, + 25.353535353535108 + ], + [ + 2464.671243788155, + 25.858585858585627, + 26.363636363636147, + 25.353535353535108 + ], + [ + 2468.403672446654, + 25.65656565656542, + 26.16161616161594, + 25.1515151515149 + ], + [ + 2472.136101105154, + 25.65656565656542, + 26.16161616161594, + 25.1515151515149 + ], + [ + 2475.868529763653, + 25.65656565656542, + 26.16161616161594, + 25.1515151515149 + ], + [ + 2479.600958422152, + 25.555555555555316, + 25.95959595959573, + 25.1515151515149 + ], + [ + 2483.333387080652, + 25.45454545454521, + 25.95959595959573, + 24.949494949494692 + ], + [ + 2487.065815739151, + 25.45454545454521, + 25.95959595959573, + 24.949494949494692 + ], + [ + 2490.79824439765, + 25.45454545454521, + 25.95959595959573, + 24.949494949494692 + ], + [ + 2494.5306730561488, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 2498.2631017146487, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 2501.9955303731476, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 2505.7279590316466, + 25.1515151515149, + 25.555555555555316, + 24.74747474747454 + ], + [ + 2509.4603876901456, + 25.1515151515149, + 25.555555555555316, + 24.74747474747454 + ], + [ + 2513.1928163486455, + 25.050505050504796, + 25.555555555555316, + 24.545454545454334 + ], + [ + 2516.9252450071444, + 25.050505050504796, + 25.555555555555316, + 24.545454545454334 + ], + [ + 2520.6576736656434, + 25.050505050504796, + 25.555555555555316, + 24.545454545454334 + ], + [ + 2524.3901023241433, + 24.949494949494692, + 25.353535353535108, + 24.545454545454334 + ], + [ + 2528.1225309826423, + 24.949494949494692, + 25.353535353535108, + 24.545454545454334 + ], + [ + 2531.8549596411412, + 24.84848484848459, + 25.353535353535108, + 24.343434343434126 + ], + [ + 2535.58738829964, + 24.84848484848459, + 25.353535353535108, + 24.343434343434126 + ], + [ + 2539.31981695814, + 24.84848484848459, + 25.353535353535108, + 24.343434343434126 + ], + [ + 2543.052245616639, + 24.84848484848459, + 25.353535353535108, + 24.343434343434126 + ], + [ + 2546.784674275138, + 24.74747474747454, + 25.1515151515149, + 24.343434343434126 + ], + [ + 2550.517102933638, + 24.74747474747454, + 25.1515151515149, + 24.343434343434126 + ], + [ + 2554.249531592137, + 24.74747474747454, + 25.1515151515149, + 24.343434343434126 + ], + [ + 2557.981960250636, + 24.74747474747454, + 25.1515151515149, + 24.343434343434126 + ], + [ + 2561.714388909135, + 24.646464646464437, + 25.1515151515149, + 24.141414141413918 + ], + [ + 2565.4468175676348, + 24.646464646464437, + 25.1515151515149, + 24.141414141413918 + ], + [ + 2569.1792462261337, + 24.646464646464437, + 25.1515151515149, + 24.141414141413918 + ], + [ + 2572.9116748846327, + 24.646464646464437, + 25.1515151515149, + 24.141414141413918 + ], + [ + 2576.6441035431317, + 24.646464646464437, + 25.1515151515149, + 24.141414141413918 + ], + [ + 2580.3765322016316, + 24.646464646464437, + 25.1515151515149, + 24.141414141413918 + ], + [ + 2584.1089608601305, + 24.545454545454334, + 24.949494949494692, + 24.141414141413918 + ], + [ + 2587.8413895186295, + 24.545454545454334, + 24.949494949494692, + 24.141414141413918 + ], + [ + 2591.5738181771294, + 24.545454545454334, + 24.949494949494692, + 24.141414141413918 + ], + [ + 2595.3062468356284, + 24.545454545454334, + 24.949494949494692, + 24.141414141413918 + ], + [ + 2599.0386754941273, + 24.545454545454334, + 24.949494949494692, + 24.141414141413918 + ], + [ + 2602.7711041526263, + 24.545454545454334, + 24.949494949494692, + 24.141414141413918 + ], + [ + 2606.503532811126, + 24.545454545454334, + 24.949494949494692, + 24.141414141413918 + ], + [ + 2610.235961469625, + 24.545454545454334, + 24.949494949494692, + 24.141414141413918 + ], + [ + 2613.968390128124, + 24.545454545454334, + 24.949494949494692, + 24.141414141413918 + ], + [ + 2617.700818786623, + 24.545454545454334, + 24.949494949494692, + 24.141414141413918 + ], + [ + 2621.433247445123, + 24.545454545454334, + 24.949494949494692, + 24.141414141413918 + ], + [ + 2625.165676103622, + 24.545454545454334, + 24.949494949494692, + 24.141414141413918 + ], + [ + 2628.898104762121, + 24.646464646464437, + 25.1515151515149, + 24.141414141413918 + ], + [ + 2632.630533420621, + 24.646464646464437, + 25.1515151515149, + 24.141414141413918 + ], + [ + 2636.36296207912, + 24.646464646464437, + 25.1515151515149, + 24.141414141413918 + ], + [ + 2640.095390737619, + 24.646464646464437, + 25.1515151515149, + 24.141414141413918 + ], + [ + 2643.827819396118, + 24.646464646464437, + 25.1515151515149, + 24.141414141413918 + ], + [ + 2647.5602480546177, + 24.646464646464437, + 25.1515151515149, + 24.141414141413918 + ], + [ + 2651.2926767131166, + 24.74747474747454, + 25.1515151515149, + 24.343434343434126 + ], + [ + 2655.0251053716156, + 24.74747474747454, + 25.1515151515149, + 24.343434343434126 + ], + [ + 2658.7575340301146, + 24.74747474747454, + 25.1515151515149, + 24.343434343434126 + ], + [ + 2662.4899626886145, + 24.74747474747454, + 25.1515151515149, + 24.343434343434126 + ], + [ + 2666.2223913471134, + 24.74747474747454, + 25.1515151515149, + 24.343434343434126 + ], + [ + 2669.9548200056124, + 24.84848484848459, + 25.353535353535108, + 24.343434343434126 + ], + [ + 2673.6872486641123, + 24.84848484848459, + 25.353535353535108, + 24.343434343434126 + ], + [ + 2677.4196773226113, + 24.84848484848459, + 25.353535353535108, + 24.343434343434126 + ], + [ + 2681.1521059811103, + 24.84848484848459, + 25.353535353535108, + 24.343434343434126 + ], + [ + 2684.8845346396092, + 24.949494949494692, + 25.353535353535108, + 24.545454545454334 + ], + [ + 2688.616963298109, + 24.949494949494692, + 25.353535353535108, + 24.545454545454334 + ], + [ + 2692.349391956608, + 24.949494949494692, + 25.353535353535108, + 24.545454545454334 + ], + [ + 2696.081820615107, + 25.050505050504796, + 25.555555555555316, + 24.545454545454334 + ], + [ + 2699.814249273606, + 25.050505050504796, + 25.555555555555316, + 24.545454545454334 + ], + [ + 2703.546677932106, + 25.050505050504796, + 25.555555555555316, + 24.545454545454334 + ], + [ + 2707.279106590605, + 25.1515151515149, + 25.555555555555316, + 24.74747474747454 + ], + [ + 2711.011535249104, + 25.1515151515149, + 25.555555555555316, + 24.74747474747454 + ], + [ + 2714.7439639076038, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 2718.4763925661027, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 2722.2088212246017, + 25.252525252525004, + 25.757575757575523, + 24.74747474747454 + ], + [ + 2725.9412498831007, + 25.353535353535108, + 25.757575757575523, + 24.949494949494692 + ], + [ + 2729.6736785416006, + 25.45454545454521, + 25.95959595959573, + 24.949494949494692 + ], + [ + 2733.4061072000995, + 25.45454545454521, + 25.95959595959573, + 24.949494949494692 + ], + [ + 2737.1385358585985, + 25.45454545454521, + 25.95959595959573, + 24.949494949494692 + ], + [ + 2740.8709645170975, + 25.555555555555316, + 25.95959595959573, + 25.1515151515149 + ], + [ + 2744.6033931755974, + 25.65656565656542, + 26.16161616161594, + 25.1515151515149 + ], + [ + 2748.3358218340964, + 25.45454545454521, + 25.757575757575523, + 25.1515151515149 + ] + ], + "Tc": [ + [ + 49.78990173915736, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 53.52233039765679, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 57.25475905615576, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 60.98718771465519, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 64.71961637315417, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 68.4520450316536, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 72.18447369015257, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 75.916902348652, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 79.64933100715098, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 83.3817596656504, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 87.11418832414938, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 90.84661698264881, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 94.57904564114824, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 98.31147429964722, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 102.04390295814665, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 105.77633161664562, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 109.50876027514505, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 113.24118893364403, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 116.97361759214346, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 120.70604625064243, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 124.43847490914186, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 128.17090356764083, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 131.90333222614026, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 135.6357608846397, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 139.36818954313867, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 143.1006182016381, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 146.83304686013707, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 150.5654755186365, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 154.29790417713548, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 158.0303328356349, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 161.76276149413388, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 165.4951901526333, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 169.2276188111323, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 172.96004746963172, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 176.69247612813115, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 180.42490478663012, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 184.15733344512955, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 187.88976210362853, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 191.62219076212796, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 195.35461942062693, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 199.08704807912636, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 202.81947673762534, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 206.55190539612477, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 210.2843340546242, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 214.01676271312317, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 217.7491913716226, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 221.48162003012158, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 225.214048688621, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 228.94647734711998, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 232.6789060056194, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 236.41133466411839, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 240.14376332261781, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 243.8761919811168, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 247.60862063961622, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 251.34104929811565, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 255.07347795661462, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 258.80590661511405, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 262.53833527361303, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 266.27076393211246, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 270.00319259061143, + 18.282828282828063, + 18.88888888888863, + 17.67676767676744 + ], + [ + 273.73562124911086, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 277.46804990760984, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 281.20047856610927, + 17.979797979797752, + 18.48484848484827, + 17.474747474747232 + ], + [ + 284.93290722460824, + 17.979797979797752, + 18.48484848484827, + 17.474747474747232 + ], + [ + 288.6653358831077, + 17.979797979797752, + 18.48484848484827, + 17.474747474747232 + ], + [ + 292.3977645416071, + 17.979797979797752, + 18.48484848484827, + 17.474747474747232 + ], + [ + 296.1301932001061, + 17.979797979797752, + 18.48484848484827, + 17.474747474747232 + ], + [ + 299.8626218586055, + 17.979797979797752, + 18.48484848484827, + 17.474747474747232 + ], + [ + 303.5950505171045, + 17.979797979797752, + 18.48484848484827, + 17.474747474747232 + ], + [ + 307.3274791756039, + 17.878787878787648, + 18.282828282828063, + 17.474747474747232 + ], + [ + 311.0599078341029, + 17.878787878787648, + 18.282828282828063, + 17.474747474747232 + ], + [ + 314.7923364926023, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 318.5247651511013, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 322.2571938096007, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 325.9896224680997, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 329.7220511265991, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 333.45447978509856, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 337.18690844359753, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 340.91933710209696, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 344.65176576059594, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 348.38419441909537, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 352.11662307759434, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 355.84905173609377, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 359.58148039459275, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 363.3139090530922, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 367.0463377115916, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 370.7787663700906, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 374.51119502859, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 378.243623687089, + 17.67676767676744, + 18.080808080807856, + 17.272727272727025 + ], + [ + 381.9760523455884, + 17.67676767676744, + 18.080808080807856, + 17.272727272727025 + ], + [ + 385.7084810040874, + 17.67676767676744, + 18.080808080807856, + 17.272727272727025 + ], + [ + 389.4409096625868, + 17.67676767676744, + 18.080808080807856, + 17.272727272727025 + ], + [ + 393.1733383210858, + 17.67676767676744, + 18.080808080807856, + 17.272727272727025 + ], + [ + 396.9057669795852, + 17.67676767676744, + 18.080808080807856, + 17.272727272727025 + ], + [ + 400.6381956380842, + 17.67676767676744, + 18.080808080807856, + 17.272727272727025 + ], + [ + 404.3706242965836, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 408.10305295508306, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 411.83548161358203, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 415.56791027208146, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 419.30033893058044, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 423.03276758907987, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 426.76519624757884, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 430.4976249060783, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 434.23005356457725, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 437.9624822230767, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 441.69491088157565, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 445.4273395400751, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 449.1597681985745, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 452.8921968570735, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 456.6246255155729, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 460.3570541740719, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 464.0894828325713, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 467.8219114910703, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 471.5543401495697, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 475.2867688080687, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 479.01919746656813, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 482.75162612506756, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 486.48405478356653, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 490.21648344206596, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 493.94891210056494, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 497.68134075906437, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 501.41376941756334, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 505.1461980760628, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 508.87862673456175, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 512.6110553930612, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 516.3434840515602, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 520.0759127100596, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 523.808341368559, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 527.540770027058, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 531.2731986855574, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 535.0056273440564, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 538.7380560025558, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 542.4704846610548, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 546.2029133195542, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 549.9353419780532, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 553.6677706365526, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 557.4001992950516, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 561.132627953551, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 564.8650566120505, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 568.5974852705494, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 572.3299139290489, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 576.0623425875478, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 579.7947712460473, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 583.5271999045463, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 587.2596285630457, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 590.9920572215447, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 594.7244858800441, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 598.4569145385431, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 602.1893431970425, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 605.9217718555419, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 609.6542005140409, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 613.3866291725403, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 617.1190578310393, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 620.8514864895387, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 624.5839151480377, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 628.3163438065371, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 632.0487724650361, + 17.575757575757336, + 18.080808080807856, + 17.070707070706817 + ], + [ + 635.7812011235355, + 17.67676767676744, + 18.080808080807856, + 17.272727272727025 + ], + [ + 639.513629782035, + 17.67676767676744, + 18.080808080807856, + 17.272727272727025 + ], + [ + 643.246058440534, + 17.67676767676744, + 18.080808080807856, + 17.272727272727025 + ], + [ + 646.9784870990334, + 17.67676767676744, + 18.080808080807856, + 17.272727272727025 + ], + [ + 650.7109157575323, + 17.67676767676744, + 18.080808080807856, + 17.272727272727025 + ], + [ + 654.4433444160318, + 17.67676767676744, + 18.080808080807856, + 17.272727272727025 + ], + [ + 658.1757730745308, + 17.67676767676744, + 18.080808080807856, + 17.272727272727025 + ], + [ + 661.9082017330302, + 17.67676767676744, + 18.080808080807856, + 17.272727272727025 + ], + [ + 665.6406303915292, + 17.67676767676744, + 18.080808080807856, + 17.272727272727025 + ], + [ + 669.3730590500286, + 17.67676767676744, + 18.080808080807856, + 17.272727272727025 + ], + [ + 673.1054877085276, + 17.67676767676744, + 18.080808080807856, + 17.272727272727025 + ], + [ + 676.837916367027, + 17.67676767676744, + 18.080808080807856, + 17.272727272727025 + ], + [ + 680.5703450255264, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 684.3027736840254, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 688.0352023425248, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 691.7676310010238, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 695.5000596595232, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 699.2324883180222, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 702.9649169765216, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 706.6973456350206, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 710.42977429352, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 714.162202952019, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 717.8946316105184, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 721.6270602690179, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 725.3594889275168, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 729.0919175860163, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 732.8243462445153, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 736.5567749030147, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 740.2892035615137, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 744.0216322200131, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 747.7540608785121, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 751.4864895370115, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 755.2189181955109, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 758.9513468540099, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 762.6837755125093, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 766.4162041710083, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 770.1486328295077, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 773.8810614880067, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 777.6134901465061, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 781.3459188050051, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 785.0783474635045, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 788.8107761220035, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 792.543204780503, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 796.2756334390024, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 800.0080620975014, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 803.7404907560008, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 807.4729194144998, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 811.2053480729992, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 814.9377767314982, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 818.6702053899976, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 822.4026340484966, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 826.135062706996, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 829.867491365495, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 833.5999200239944, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 837.3323486824938, + 17.777777777777544, + 18.282828282828063, + 17.272727272727025 + ], + [ + 841.0647773409928, + 17.878787878787648, + 18.282828282828063, + 17.474747474747232 + ], + [ + 844.7972059994922, + 17.878787878787648, + 18.282828282828063, + 17.474747474747232 + ], + [ + 848.5296346579912, + 17.878787878787648, + 18.282828282828063, + 17.474747474747232 + ], + [ + 852.2620633164906, + 17.878787878787648, + 18.282828282828063, + 17.474747474747232 + ], + [ + 855.9944919749896, + 17.878787878787648, + 18.282828282828063, + 17.474747474747232 + ], + [ + 859.726920633489, + 17.878787878787648, + 18.282828282828063, + 17.474747474747232 + ], + [ + 863.459349291988, + 17.878787878787648, + 18.282828282828063, + 17.474747474747232 + ], + [ + 867.1917779504874, + 17.979797979797752, + 18.48484848484827, + 17.474747474747232 + ], + [ + 870.9242066089864, + 17.979797979797752, + 18.48484848484827, + 17.474747474747232 + ], + [ + 874.6566352674859, + 17.979797979797752, + 18.48484848484827, + 17.474747474747232 + ], + [ + 878.3890639259853, + 17.979797979797752, + 18.48484848484827, + 17.474747474747232 + ], + [ + 882.1214925844843, + 17.979797979797752, + 18.48484848484827, + 17.474747474747232 + ], + [ + 885.8539212429837, + 17.979797979797752, + 18.48484848484827, + 17.474747474747232 + ], + [ + 889.5863499014827, + 17.979797979797752, + 18.48484848484827, + 17.474747474747232 + ], + [ + 893.3187785599821, + 17.979797979797752, + 18.48484848484827, + 17.474747474747232 + ], + [ + 897.0512072184811, + 17.979797979797752, + 18.48484848484827, + 17.474747474747232 + ], + [ + 900.7836358769805, + 17.979797979797752, + 18.48484848484827, + 17.474747474747232 + ], + [ + 904.5160645354795, + 17.979797979797752, + 18.48484848484827, + 17.474747474747232 + ], + [ + 908.2484931939789, + 17.979797979797752, + 18.48484848484827, + 17.474747474747232 + ], + [ + 911.9809218524783, + 17.979797979797752, + 18.48484848484827, + 17.474747474747232 + ], + [ + 915.7133505109773, + 17.979797979797752, + 18.48484848484827, + 17.474747474747232 + ], + [ + 919.4457791694767, + 17.979797979797752, + 18.48484848484827, + 17.474747474747232 + ], + [ + 923.1782078279757, + 17.979797979797752, + 18.48484848484827, + 17.474747474747232 + ], + [ + 926.9106364864751, + 17.979797979797752, + 18.48484848484827, + 17.474747474747232 + ], + [ + 930.6430651449741, + 17.979797979797752, + 18.48484848484827, + 17.474747474747232 + ], + [ + 934.3754938034735, + 17.979797979797752, + 18.48484848484827, + 17.474747474747232 + ], + [ + 938.1079224619725, + 17.979797979797752, + 18.48484848484827, + 17.474747474747232 + ], + [ + 941.840351120472, + 17.979797979797752, + 18.48484848484827, + 17.474747474747232 + ], + [ + 945.5727797789709, + 17.979797979797752, + 18.48484848484827, + 17.474747474747232 + ], + [ + 949.3052084374704, + 17.979797979797752, + 18.48484848484827, + 17.474747474747232 + ], + [ + 953.0376370959698, + 17.979797979797752, + 18.48484848484827, + 17.474747474747232 + ], + [ + 956.7700657544688, + 17.979797979797752, + 18.48484848484827, + 17.474747474747232 + ], + [ + 960.5024944129682, + 17.979797979797752, + 18.48484848484827, + 17.474747474747232 + ], + [ + 964.2349230714672, + 17.979797979797752, + 18.48484848484827, + 17.474747474747232 + ], + [ + 967.9673517299666, + 17.979797979797752, + 18.48484848484827, + 17.474747474747232 + ], + [ + 971.6997803884656, + 18.080808080807856, + 18.48484848484827, + 17.67676767676744 + ], + [ + 975.432209046965, + 18.18181818181796, + 18.48484848484827, + 17.878787878787648 + ], + [ + 979.164637705464, + 18.282828282828063, + 18.48484848484827, + 17.474747474747232 + ], + [ + 982.8970663639634, + 17.979797979797752, + 18.48484848484827, + 17.474747474747232 + ], + [ + 986.6294950224624, + 17.979797979797752, + 18.48484848484827, + 17.474747474747232 + ], + [ + 990.3619236809618, + 18.080808080807856, + 18.48484848484827, + 17.67676767676744 + ], + [ + 994.0943523394612, + 18.080808080807856, + 18.48484848484827, + 17.67676767676744 + ], + [ + 997.8267809979602, + 18.080808080807856, + 18.48484848484827, + 17.67676767676744 + ], + [ + 1001.5592096564596, + 18.080808080807856, + 18.48484848484827, + 17.67676767676744 + ], + [ + 1005.2916383149586, + 18.080808080807856, + 18.48484848484827, + 17.67676767676744 + ], + [ + 1009.024066973458, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 1012.756495631957, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 1016.4889242904565, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 1020.2213529489554, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 1023.9537816074549, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 1027.6862102659538, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 1031.4186389244533, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 1035.1510675829527, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 1038.8834962414517, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 1042.615924899951, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 1046.34835355845, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 1050.0807822169495, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 1053.8132108754485, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 1057.545639533948, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 1061.2780681924469, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 1065.0104968509463, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 1068.7429255094457, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 1072.4753541679447, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 1076.2077828264441, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 1079.9402114849431, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 1083.6726401434425, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 1087.4050688019415, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 1091.137497460441, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 1094.86992611894, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 1098.6023547774394, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 1102.3347834359383, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 1106.0672120944378, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 1109.7996407529372, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 1113.5320694114362, + 18.282828282828063, + 18.686868686868422, + 17.878787878787648 + ], + [ + 1117.2644980699356, + 18.282828282828063, + 18.686868686868422, + 17.878787878787648 + ], + [ + 1120.9969267284346, + 18.282828282828063, + 18.686868686868422, + 17.878787878787648 + ], + [ + 1124.729355386934, + 18.282828282828063, + 18.686868686868422, + 17.878787878787648 + ], + [ + 1128.461784045433, + 18.282828282828063, + 18.686868686868422, + 17.878787878787648 + ], + [ + 1132.1942127039324, + 18.282828282828063, + 18.686868686868422, + 17.878787878787648 + ], + [ + 1135.9266413624314, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 1139.6590700209308, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 1143.3914986794298, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 1147.1239273379292, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 1150.8563559964286, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 1154.5887846549276, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 1158.321213313427, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 1162.053641971926, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 1165.7860706304255, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 1169.5184992889244, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 1173.2509279474239, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 1176.9833566059228, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 1180.7157852644223, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 1184.4482139229217, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 1188.1806425814207, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 1191.91307123992, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 1195.645499898419, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 1199.3779285569185, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 1203.1103572154175, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 1206.842785873917, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 1210.5752145324159, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 1214.3076431909153, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 1218.0400718494143, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 1221.7725005079137, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 1225.5049291664131, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 1229.2373578249121, + 18.48484848484827, + 18.88888888888863, + 18.080808080807856 + ], + [ + 1232.9697864834116, + 18.48484848484827, + 18.88888888888863, + 18.080808080807856 + ], + [ + 1236.7022151419105, + 18.48484848484827, + 18.88888888888863, + 18.080808080807856 + ], + [ + 1240.43464380041, + 18.48484848484827, + 18.88888888888863, + 18.080808080807856 + ], + [ + 1244.167072458909, + 18.48484848484827, + 18.88888888888863, + 18.080808080807856 + ], + [ + 1247.8995011174084, + 18.585858585858375, + 19.090909090908838, + 18.080808080807856 + ], + [ + 1251.6319297759073, + 18.585858585858375, + 19.090909090908838, + 18.080808080807856 + ], + [ + 1255.3643584344068, + 18.585858585858375, + 19.090909090908838, + 18.080808080807856 + ], + [ + 1259.0967870929057, + 18.585858585858375, + 19.090909090908838, + 18.080808080807856 + ], + [ + 1262.8292157514052, + 18.585858585858375, + 19.090909090908838, + 18.080808080807856 + ], + [ + 1266.5616444099046, + 18.585858585858375, + 19.090909090908838, + 18.080808080807856 + ], + [ + 1270.2940730684036, + 18.585858585858375, + 19.090909090908838, + 18.080808080807856 + ], + [ + 1274.026501726903, + 18.585858585858375, + 19.090909090908838, + 18.080808080807856 + ], + [ + 1277.758930385402, + 18.585858585858375, + 19.090909090908838, + 18.080808080807856 + ], + [ + 1281.4913590439014, + 18.585858585858375, + 19.090909090908838, + 18.080808080807856 + ], + [ + 1285.2237877024004, + 18.585858585858375, + 19.090909090908838, + 18.080808080807856 + ], + [ + 1288.9562163608998, + 18.585858585858375, + 19.090909090908838, + 18.080808080807856 + ], + [ + 1292.6886450193988, + 18.585858585858375, + 19.090909090908838, + 18.080808080807856 + ], + [ + 1296.4210736778982, + 18.585858585858375, + 19.090909090908838, + 18.080808080807856 + ], + [ + 1300.1535023363972, + 18.585858585858375, + 19.090909090908838, + 18.080808080807856 + ], + [ + 1303.8859309948966, + 18.585858585858375, + 19.090909090908838, + 18.080808080807856 + ], + [ + 1307.618359653396, + 18.585858585858375, + 19.090909090908838, + 18.080808080807856 + ], + [ + 1311.350788311895, + 18.585858585858375, + 19.090909090908838, + 18.080808080807856 + ], + [ + 1315.0832169703945, + 18.585858585858375, + 19.090909090908838, + 18.080808080807856 + ], + [ + 1318.8156456288934, + 18.585858585858375, + 19.090909090908838, + 18.080808080807856 + ], + [ + 1322.5480742873929, + 18.585858585858375, + 19.090909090908838, + 18.080808080807856 + ], + [ + 1326.2805029458918, + 18.585858585858375, + 19.090909090908838, + 18.080808080807856 + ], + [ + 1330.0129316043913, + 18.585858585858375, + 19.090909090908838, + 18.080808080807856 + ], + [ + 1333.7453602628902, + 18.585858585858375, + 19.090909090908838, + 18.080808080807856 + ], + [ + 1337.4777889213897, + 18.686868686868422, + 19.090909090908838, + 18.282828282828063 + ], + [ + 1341.210217579889, + 18.686868686868422, + 19.090909090908838, + 18.282828282828063 + ], + [ + 1344.942646238388, + 18.686868686868422, + 19.090909090908838, + 18.282828282828063 + ], + [ + 1348.6750748968875, + 18.686868686868422, + 19.090909090908838, + 18.282828282828063 + ], + [ + 1352.4075035553865, + 18.787878787878526, + 19.292929292929045, + 18.282828282828063 + ], + [ + 1356.139932213886, + 18.787878787878526, + 19.292929292929045, + 18.282828282828063 + ], + [ + 1359.872360872385, + 18.787878787878526, + 19.292929292929045, + 18.282828282828063 + ], + [ + 1363.6047895308843, + 18.787878787878526, + 19.292929292929045, + 18.282828282828063 + ], + [ + 1367.3372181893833, + 18.787878787878526, + 19.292929292929045, + 18.282828282828063 + ], + [ + 1371.0696468478827, + 18.787878787878526, + 19.292929292929045, + 18.282828282828063 + ], + [ + 1374.8020755063817, + 18.787878787878526, + 19.292929292929045, + 18.282828282828063 + ], + [ + 1378.5345041648811, + 18.787878787878526, + 19.292929292929045, + 18.282828282828063 + ], + [ + 1382.2669328233806, + 18.787878787878526, + 19.292929292929045, + 18.282828282828063 + ], + [ + 1385.9993614818795, + 18.787878787878526, + 19.292929292929045, + 18.282828282828063 + ], + [ + 1389.7317901403785, + 18.787878787878526, + 19.292929292929045, + 18.282828282828063 + ], + [ + 1393.4642187988784, + 18.787878787878526, + 19.292929292929045, + 18.282828282828063 + ], + [ + 1397.1966474573774, + 18.787878787878526, + 19.292929292929045, + 18.282828282828063 + ], + [ + 1400.9290761158763, + 18.787878787878526, + 19.292929292929045, + 18.282828282828063 + ], + [ + 1404.6615047743753, + 18.787878787878526, + 19.292929292929045, + 18.282828282828063 + ], + [ + 1408.3939334328752, + 18.787878787878526, + 19.292929292929045, + 18.282828282828063 + ], + [ + 1412.1263620913742, + 18.787878787878526, + 19.292929292929045, + 18.282828282828063 + ], + [ + 1415.8587907498732, + 18.787878787878526, + 19.292929292929045, + 18.282828282828063 + ], + [ + 1419.591219408373, + 18.787878787878526, + 19.292929292929045, + 18.282828282828063 + ], + [ + 1423.323648066872, + 18.787878787878526, + 19.292929292929045, + 18.282828282828063 + ], + [ + 1427.056076725371, + 18.787878787878526, + 19.292929292929045, + 18.282828282828063 + ], + [ + 1430.78850538387, + 18.787878787878526, + 19.292929292929045, + 18.282828282828063 + ], + [ + 1434.5209340423698, + 18.787878787878526, + 19.292929292929045, + 18.282828282828063 + ], + [ + 1438.2533627008688, + 18.88888888888863, + 19.292929292929045, + 18.48484848484827 + ], + [ + 1441.9857913593678, + 18.88888888888863, + 19.292929292929045, + 18.48484848484827 + ], + [ + 1445.7182200178668, + 18.88888888888863, + 19.292929292929045, + 18.48484848484827 + ], + [ + 1449.4506486763667, + 18.88888888888863, + 19.292929292929045, + 18.48484848484827 + ], + [ + 1453.1830773348656, + 18.989898989898734, + 19.494949494949253, + 18.48484848484827 + ], + [ + 1456.9155059933646, + 18.989898989898734, + 19.494949494949253, + 18.48484848484827 + ], + [ + 1460.6479346518645, + 18.989898989898734, + 19.494949494949253, + 18.48484848484827 + ], + [ + 1464.3803633103635, + 18.989898989898734, + 19.494949494949253, + 18.48484848484827 + ], + [ + 1468.1127919688624, + 18.989898989898734, + 19.494949494949253, + 18.48484848484827 + ], + [ + 1471.8452206273614, + 18.989898989898734, + 19.494949494949253, + 18.48484848484827 + ], + [ + 1475.5776492858613, + 18.989898989898734, + 19.494949494949253, + 18.48484848484827 + ], + [ + 1479.3100779443603, + 18.989898989898734, + 19.494949494949253, + 18.48484848484827 + ], + [ + 1483.0425066028592, + 18.989898989898734, + 19.494949494949253, + 18.48484848484827 + ], + [ + 1486.7749352613582, + 18.989898989898734, + 19.494949494949253, + 18.48484848484827 + ], + [ + 1490.507363919858, + 18.989898989898734, + 19.494949494949253, + 18.48484848484827 + ], + [ + 1494.239792578357, + 18.989898989898734, + 19.494949494949253, + 18.48484848484827 + ], + [ + 1497.972221236856, + 18.989898989898734, + 19.494949494949253, + 18.48484848484827 + ], + [ + 1501.704649895356, + 18.989898989898734, + 19.494949494949253, + 18.48484848484827 + ], + [ + 1505.437078553855, + 18.989898989898734, + 19.494949494949253, + 18.48484848484827 + ], + [ + 1509.169507212354, + 18.989898989898734, + 19.494949494949253, + 18.48484848484827 + ], + [ + 1512.9019358708529, + 18.989898989898734, + 19.494949494949253, + 18.48484848484827 + ], + [ + 1516.6343645293528, + 18.989898989898734, + 19.494949494949253, + 18.48484848484827 + ], + [ + 1520.3667931878517, + 18.989898989898734, + 19.494949494949253, + 18.48484848484827 + ], + [ + 1524.0992218463507, + 18.989898989898734, + 19.494949494949253, + 18.48484848484827 + ], + [ + 1527.8316505048497, + 18.989898989898734, + 19.494949494949253, + 18.48484848484827 + ], + [ + 1531.5640791633496, + 19.090909090908838, + 19.494949494949253, + 18.686868686868422 + ], + [ + 1535.2965078218485, + 19.090909090908838, + 19.494949494949253, + 18.686868686868422 + ], + [ + 1539.0289364803475, + 19.090909090908838, + 19.494949494949253, + 18.686868686868422 + ], + [ + 1542.7613651388474, + 19.090909090908838, + 19.494949494949253, + 18.686868686868422 + ], + [ + 1546.4937937973464, + 19.19191919191894, + 19.69696969696946, + 18.686868686868422 + ], + [ + 1550.2262224558453, + 19.19191919191894, + 19.69696969696946, + 18.686868686868422 + ], + [ + 1553.9586511143443, + 19.19191919191894, + 19.69696969696946, + 18.686868686868422 + ], + [ + 1557.6910797728442, + 19.19191919191894, + 19.69696969696946, + 18.686868686868422 + ], + [ + 1561.4235084313432, + 19.19191919191894, + 19.69696969696946, + 18.686868686868422 + ], + [ + 1565.1559370898422, + 19.19191919191894, + 19.69696969696946, + 18.686868686868422 + ], + [ + 1568.8883657483411, + 19.19191919191894, + 19.69696969696946, + 18.686868686868422 + ], + [ + 1572.620794406841, + 19.19191919191894, + 19.69696969696946, + 18.686868686868422 + ], + [ + 1576.35322306534, + 19.19191919191894, + 19.69696969696946, + 18.686868686868422 + ], + [ + 1580.085651723839, + 19.19191919191894, + 19.69696969696946, + 18.686868686868422 + ], + [ + 1583.8180803823388, + 19.19191919191894, + 19.69696969696946, + 18.686868686868422 + ], + [ + 1587.5505090408378, + 19.19191919191894, + 19.69696969696946, + 18.686868686868422 + ], + [ + 1591.2829376993368, + 19.19191919191894, + 19.69696969696946, + 18.686868686868422 + ], + [ + 1595.0153663578358, + 19.19191919191894, + 19.69696969696946, + 18.686868686868422 + ], + [ + 1598.7477950163357, + 19.19191919191894, + 19.69696969696946, + 18.686868686868422 + ], + [ + 1602.4802236748346, + 19.19191919191894, + 19.69696969696946, + 18.686868686868422 + ], + [ + 1606.2126523333336, + 19.19191919191894, + 19.69696969696946, + 18.686868686868422 + ], + [ + 1609.9450809918326, + 19.19191919191894, + 19.69696969696946, + 18.686868686868422 + ], + [ + 1613.6775096503325, + 19.19191919191894, + 19.69696969696946, + 18.686868686868422 + ], + [ + 1617.4099383088314, + 19.19191919191894, + 19.69696969696946, + 18.686868686868422 + ], + [ + 1621.1423669673304, + 19.19191919191894, + 19.69696969696946, + 18.686868686868422 + ], + [ + 1624.8747956258303, + 19.292929292929045, + 19.69696969696946, + 18.88888888888863 + ], + [ + 1628.6072242843293, + 19.292929292929045, + 19.69696969696946, + 18.88888888888863 + ], + [ + 1632.3396529428283, + 19.292929292929045, + 19.69696969696946, + 18.88888888888863 + ], + [ + 1636.0720816013272, + 19.292929292929045, + 19.69696969696946, + 18.88888888888863 + ], + [ + 1639.804510259827, + 19.39393939393915, + 19.89898989898967, + 18.88888888888863 + ], + [ + 1643.536938918326, + 19.39393939393915, + 19.89898989898967, + 18.88888888888863 + ], + [ + 1647.269367576825, + 19.39393939393915, + 19.89898989898967, + 18.88888888888863 + ], + [ + 1651.001796235324, + 19.39393939393915, + 19.89898989898967, + 18.88888888888863 + ], + [ + 1654.734224893824, + 19.39393939393915, + 19.89898989898967, + 18.88888888888863 + ], + [ + 1658.466653552323, + 19.39393939393915, + 19.89898989898967, + 18.88888888888863 + ], + [ + 1662.1990822108219, + 19.39393939393915, + 19.89898989898967, + 18.88888888888863 + ], + [ + 1665.9315108693218, + 19.39393939393915, + 19.89898989898967, + 18.88888888888863 + ], + [ + 1669.6639395278207, + 19.39393939393915, + 19.89898989898967, + 18.88888888888863 + ], + [ + 1673.3963681863197, + 19.39393939393915, + 19.89898989898967, + 18.88888888888863 + ], + [ + 1677.1287968448187, + 19.39393939393915, + 19.89898989898967, + 18.88888888888863 + ], + [ + 1680.8612255033186, + 19.39393939393915, + 19.89898989898967, + 18.88888888888863 + ], + [ + 1684.5936541618175, + 19.39393939393915, + 19.89898989898967, + 18.88888888888863 + ], + [ + 1688.3260828203165, + 19.39393939393915, + 19.89898989898967, + 18.88888888888863 + ], + [ + 1692.0585114788164, + 19.39393939393915, + 19.89898989898967, + 18.88888888888863 + ], + [ + 1695.7909401373154, + 19.39393939393915, + 19.89898989898967, + 18.88888888888863 + ], + [ + 1699.5233687958143, + 19.39393939393915, + 19.89898989898967, + 18.88888888888863 + ], + [ + 1703.2557974543133, + 19.39393939393915, + 19.89898989898967, + 18.88888888888863 + ], + [ + 1706.9882261128132, + 19.39393939393915, + 19.89898989898967, + 18.88888888888863 + ], + [ + 1710.7206547713122, + 19.39393939393915, + 19.89898989898967, + 18.88888888888863 + ], + [ + 1714.4530834298112, + 19.494949494949253, + 19.89898989898967, + 19.090909090908838 + ], + [ + 1718.1855120883101, + 19.494949494949253, + 19.89898989898967, + 19.090909090908838 + ], + [ + 1721.91794074681, + 19.494949494949253, + 19.89898989898967, + 19.090909090908838 + ], + [ + 1725.650369405309, + 19.595959595959357, + 20.101010101009877, + 19.090909090908838 + ], + [ + 1729.382798063808, + 19.595959595959357, + 20.101010101009877, + 19.090909090908838 + ], + [ + 1733.1152267223079, + 19.595959595959357, + 20.101010101009877, + 19.090909090908838 + ], + [ + 1736.8476553808068, + 19.595959595959357, + 20.101010101009877, + 19.090909090908838 + ], + [ + 1740.5800840393058, + 19.595959595959357, + 20.101010101009877, + 19.090909090908838 + ], + [ + 1744.3125126978048, + 19.595959595959357, + 20.101010101009877, + 19.090909090908838 + ], + [ + 1748.0449413563047, + 19.595959595959357, + 20.101010101009877, + 19.090909090908838 + ], + [ + 1751.7773700148036, + 19.595959595959357, + 20.101010101009877, + 19.090909090908838 + ], + [ + 1755.5097986733026, + 19.595959595959357, + 20.101010101009877, + 19.090909090908838 + ], + [ + 1759.2422273318016, + 19.595959595959357, + 20.101010101009877, + 19.090909090908838 + ], + [ + 1762.9746559903015, + 19.595959595959357, + 20.101010101009877, + 19.090909090908838 + ], + [ + 1766.7070846488004, + 19.595959595959357, + 20.101010101009877, + 19.090909090908838 + ], + [ + 1770.4395133072994, + 19.595959595959357, + 20.101010101009877, + 19.090909090908838 + ], + [ + 1774.1719419657993, + 19.595959595959357, + 20.101010101009877, + 19.090909090908838 + ], + [ + 1777.9043706242983, + 19.595959595959357, + 20.101010101009877, + 19.090909090908838 + ], + [ + 1781.6367992827973, + 19.595959595959357, + 20.101010101009877, + 19.090909090908838 + ], + [ + 1785.3692279412962, + 19.595959595959357, + 20.101010101009877, + 19.090909090908838 + ], + [ + 1789.1016565997961, + 19.595959595959357, + 20.101010101009877, + 19.090909090908838 + ], + [ + 1792.834085258295, + 19.595959595959357, + 20.101010101009877, + 19.090909090908838 + ], + [ + 1796.566513916794, + 19.69696969696946, + 20.101010101009877, + 19.292929292929045 + ], + [ + 1800.298942575293, + 19.69696969696946, + 20.101010101009877, + 19.292929292929045 + ], + [ + 1804.031371233793, + 19.69696969696946, + 20.101010101009877, + 19.292929292929045 + ], + [ + 1807.763799892292, + 19.69696969696946, + 20.101010101009877, + 19.292929292929045 + ], + [ + 1811.4962285507909, + 19.797979797979565, + 20.303030303030084, + 19.292929292929045 + ], + [ + 1815.2286572092908, + 19.797979797979565, + 20.303030303030084, + 19.292929292929045 + ], + [ + 1818.9610858677897, + 19.999999999999773, + 20.7070707070705, + 19.292929292929045 + ], + [ + 1822.6935145262887, + 22.020202020201793, + 24.74747474747454, + 19.292929292929045 + ], + [ + 1826.4259431847877, + 23.333333333333087, + 27.37373737373713, + 19.292929292929045 + ], + [ + 1830.1583718432876, + 24.343434343434126, + 29.39393939393915, + 19.292929292929045 + ], + [ + 1833.8908005017865, + 25.1515151515149, + 31.01010101010081, + 19.292929292929045 + ], + [ + 1837.6232291602855, + 25.858585858585627, + 32.222222222222, + 19.494949494949253 + ], + [ + 1841.3556578187845, + 27.474747474747232, + 33.23232323232298, + 21.71717171717148 + ], + [ + 1845.0880864772844, + 29.797979797979565, + 34.24242424242402, + 25.353535353535108 + ], + [ + 1848.8205151357834, + 31.41414141414117, + 34.848484848484645, + 27.979797979797752 + ], + [ + 1852.5529437942823, + 32.72727272727252, + 35.65656565656542, + 29.797979797979565 + ], + [ + 1856.2853724527822, + 33.7373737373735, + 36.060606060605835, + 31.41414141414117 + ], + [ + 1860.0178011112812, + 34.64646464646444, + 36.66666666666646, + 32.62626262626242 + ], + [ + 1863.7502297697802, + 35.252525252525004, + 37.070707070706874, + 33.43434343434319 + ], + [ + 1867.4826584282791, + 35.85858585858563, + 37.272727272727025, + 34.44444444444423 + ], + [ + 1871.215087086779, + 36.36363636363615, + 37.67676767676744, + 35.05050505050485 + ], + [ + 1874.947515745278, + 36.76767676767656, + 37.87878787878765, + 35.65656565656542 + ], + [ + 1878.679944403777, + 37.17171717171698, + 38.080808080807856, + 36.26262626262604 + ], + [ + 1882.412373062276, + 37.37373737373713, + 38.28282828282806, + 36.46464646464625 + ], + [ + 1886.1448017207758, + 37.575757575757336, + 38.28282828282806, + 36.868686868686666 + ], + [ + 1889.8772303792748, + 37.777777777777544, + 38.28282828282806, + 37.272727272727025 + ], + [ + 1893.6096590377738, + 37.87878787878765, + 38.48484848484827, + 37.272727272727025 + ], + [ + 1897.3420876962737, + 37.97979797979775, + 38.48484848484827, + 37.47474747474723 + ], + [ + 1901.0745163547726, + 38.080808080807856, + 38.68686868686848, + 37.47474747474723 + ], + [ + 1904.8069450132716, + 38.18181818181796, + 38.68686868686848, + 37.67676767676744 + ], + [ + 1908.5393736717706, + 37.97979797979775, + 38.48484848484827, + 37.47474747474723 + ], + [ + 1912.2718023302705, + 37.97979797979775, + 38.48484848484827, + 37.47474747474723 + ], + [ + 1916.0042309887695, + 37.87878787878765, + 38.48484848484827, + 37.272727272727025 + ], + [ + 1919.7366596472684, + 37.87878787878765, + 38.48484848484827, + 37.272727272727025 + ], + [ + 1923.4690883057674, + 37.67676767676744, + 38.28282828282806, + 37.070707070706874 + ], + [ + 1927.2015169642673, + 37.575757575757336, + 38.28282828282806, + 36.868686868686666 + ], + [ + 1930.9339456227663, + 37.37373737373713, + 38.080808080807856, + 36.66666666666646 + ], + [ + 1934.6663742812652, + 37.17171717171698, + 37.87878787878765, + 36.46464646464625 + ], + [ + 1938.3988029397651, + 36.868686868686666, + 37.67676767676744, + 36.060606060605835 + ], + [ + 1942.131231598264, + 36.66666666666646, + 37.47474747474723, + 35.85858585858563 + ], + [ + 1945.863660256763, + 36.46464646464625, + 37.272727272727025, + 35.65656565656542 + ], + [ + 1949.596088915262, + 36.16161616161594, + 37.070707070706874, + 35.252525252525004 + ], + [ + 1953.328517573762, + 35.95959595959573, + 36.868686868686666, + 35.05050505050485 + ], + [ + 1957.060946232261, + 35.65656565656542, + 36.66666666666646, + 34.64646464646444 + ], + [ + 1960.7933748907599, + 35.252525252525004, + 36.26262626262604, + 34.24242424242402 + ], + [ + 1964.5258035492598, + 35.05050505050485, + 36.060606060605835, + 34.040404040403814 + ], + [ + 1968.2582322077587, + 34.64646464646444, + 35.65656565656542, + 33.6363636363634 + ], + [ + 1971.9906608662577, + 34.44444444444423, + 35.45454545454521, + 33.43434343434319 + ], + [ + 1975.7230895247567, + 34.040404040403814, + 35.05050505050485, + 33.03030303030283 + ], + [ + 1979.4555181832566, + 33.838383838383606, + 34.848484848484645, + 32.828282828282624 + ], + [ + 1983.1879468417555, + 33.43434343434319, + 34.44444444444423, + 32.42424242424221 + ], + [ + 1986.9203755002545, + 33.13131313131288, + 34.040404040403814, + 32.222222222222 + ], + [ + 1990.6528041587535, + 32.828282828282624, + 33.838383838383606, + 31.818181818181586 + ], + [ + 1994.3852328172534, + 32.52525252525231, + 33.43434343434319, + 31.616161616161378 + ], + [ + 1998.1176614757524, + 32.323232323232105, + 33.23232323232298, + 31.41414141414117 + ], + [ + 2001.8500901342513, + 31.91919191919169, + 32.828282828282624, + 31.01010101010081 + ], + [ + 2005.5825187927512, + 31.71717171717148, + 32.62626262626242, + 30.808080808080604 + ], + [ + 2009.3149474512502, + 31.515151515151274, + 32.42424242424221, + 30.606060606060396 + ], + [ + 2013.0473761097492, + 31.212121212120962, + 32.02020202020179, + 30.404040404040188 + ], + [ + 2016.7798047682481, + 31.01010101010081, + 31.818181818181586, + 30.20202020201998 + ], + [ + 2020.512233426748, + 30.808080808080604, + 31.616161616161378, + 29.999999999999773 + ], + [ + 2024.244662085247, + 30.404040404040188, + 31.212121212120962, + 29.595959595959357 + ], + [ + 2027.977090743746, + 30.20202020201998, + 31.01010101010081, + 29.39393939393915 + ], + [ + 2031.709519402245, + 29.999999999999773, + 30.808080808080604, + 29.19191919191894 + ], + [ + 2035.4419480607448, + 29.797979797979565, + 30.606060606060396, + 28.989898989898734 + ], + [ + 2039.1743767192438, + 29.595959595959357, + 30.404040404040188, + 28.787878787878583 + ], + [ + 2042.9068053777428, + 29.39393939393915, + 30.20202020201998, + 28.585858585858375 + ], + [ + 2046.6392340362427, + 29.19191919191894, + 29.999999999999773, + 28.383838383838167 + ], + [ + 2050.3716626947416, + 28.888888888888687, + 29.595959595959357, + 28.18181818181796 + ], + [ + 2054.1040913532406, + 28.68686868686848, + 29.39393939393915, + 27.979797979797752 + ], + [ + 2057.8365200117396, + 28.48484848484827, + 29.19191919191894, + 27.777777777777544 + ], + [ + 2061.5689486702395, + 28.282828282828063, + 28.989898989898734, + 27.575757575757336 + ], + [ + 2065.3013773287385, + 28.080808080807856, + 28.787878787878583, + 27.37373737373713 + ], + [ + 2069.0338059872374, + 28.080808080807856, + 28.787878787878583, + 27.37373737373713 + ], + [ + 2072.7662346457364, + 27.878787878787648, + 28.585858585858375, + 27.17171717171692 + ], + [ + 2076.4986633042363, + 27.67676767676744, + 28.383838383838167, + 26.969696969696713 + ], + [ + 2080.2310919627353, + 27.474747474747232, + 28.18181818181796, + 26.767676767676562 + ], + [ + 2083.9635206212342, + 27.272727272727025, + 27.979797979797752, + 26.565656565656354 + ], + [ + 2087.695949279734, + 27.070707070706817, + 27.777777777777544, + 26.363636363636147 + ], + [ + 2091.428377938233, + 26.969696969696713, + 27.575757575757336, + 26.363636363636147 + ], + [ + 2095.160806596732, + 26.767676767676562, + 27.37373737373713, + 26.16161616161594 + ], + [ + 2098.893235255231, + 26.66666666666646, + 27.37373737373713, + 25.95959595959573 + ], + [ + 2102.625663913731, + 26.46464646464625, + 27.17171717171692, + 25.757575757575523 + ], + [ + 2106.35809257223, + 26.363636363636147, + 26.969696969696713, + 25.757575757575523 + ], + [ + 2110.090521230729, + 26.16161616161594, + 26.767676767676562, + 25.555555555555316 + ], + [ + 2113.822949889228, + 25.95959595959573, + 26.565656565656354, + 25.353535353535108 + ], + [ + 2117.5553785477277, + 25.858585858585627, + 26.565656565656354, + 25.1515151515149 + ], + [ + 2121.2878072062267, + 25.757575757575523, + 26.363636363636147, + 25.1515151515149 + ], + [ + 2125.0202358647257, + 25.555555555555316, + 26.16161616161594, + 24.949494949494692 + ], + [ + 2128.7526645232256, + 25.45454545454521, + 26.16161616161594, + 24.74747474747454 + ], + [ + 2132.4850931817246, + 25.353535353535108, + 25.95959595959573, + 24.74747474747454 + ], + [ + 2136.2175218402235, + 25.1515151515149, + 25.757575757575523, + 24.545454545454334 + ], + [ + 2139.9499504987225, + 25.050505050504796, + 25.757575757575523, + 24.343434343434126 + ], + [ + 2143.6823791572224, + 24.949494949494692, + 25.555555555555316, + 24.343434343434126 + ], + [ + 2147.4148078157214, + 24.74747474747454, + 25.353535353535108, + 24.141414141413918 + ], + [ + 2151.1472364742203, + 24.74747474747454, + 25.353535353535108, + 24.141414141413918 + ], + [ + 2154.8796651327193, + 24.545454545454334, + 25.1515151515149, + 23.93939393939371 + ], + [ + 2158.612093791219, + 24.343434343434126, + 24.949494949494692, + 23.737373737373503 + ], + [ + 2162.344522449718, + 24.343434343434126, + 24.949494949494692, + 23.737373737373503 + ], + [ + 2166.076951108217, + 24.141414141413918, + 24.74747474747454, + 23.535353535353295 + ], + [ + 2169.809379766717, + 24.141414141413918, + 24.74747474747454, + 23.535353535353295 + ], + [ + 2173.541808425216, + 23.93939393939371, + 24.545454545454334, + 23.333333333333087 + ], + [ + 2177.274237083715, + 23.838383838383606, + 24.343434343434126, + 23.333333333333087 + ], + [ + 2181.006665742214, + 23.737373737373503, + 24.343434343434126, + 23.13131313131288 + ], + [ + 2184.739094400714, + 23.6363636363634, + 24.141414141413918, + 23.13131313131288 + ], + [ + 2188.471523059213, + 23.535353535353295, + 24.141414141413918, + 22.92929292929267 + ], + [ + 2192.203951717712, + 23.43434343434319, + 23.93939393939371, + 22.92929292929267 + ], + [ + 2195.9363803762108, + 23.333333333333087, + 23.93939393939371, + 22.72727272727252 + ], + [ + 2199.6688090347106, + 23.232323232322983, + 23.737373737373503, + 22.72727272727252 + ], + [ + 2203.4012376932096, + 23.13131313131288, + 23.737373737373503, + 22.525252525252313 + ], + [ + 2207.1336663517086, + 23.030303030302775, + 23.535353535353295, + 22.525252525252313 + ], + [ + 2210.8660950102085, + 22.92929292929267, + 23.535353535353295, + 22.323232323232105 + ], + [ + 2214.5985236687075, + 22.828282828282568, + 23.333333333333087, + 22.323232323232105 + ], + [ + 2218.3309523272064, + 22.72727272727252, + 23.333333333333087, + 22.121212121211897 + ], + [ + 2222.0633809857054, + 22.626262626262417, + 23.13131313131288, + 22.121212121211897 + ], + [ + 2225.7958096442053, + 22.525252525252313, + 23.13131313131288, + 21.91919191919169 + ], + [ + 2229.5282383027043, + 22.42424242424221, + 22.92929292929267, + 21.91919191919169 + ], + [ + 2233.2606669612032, + 22.42424242424221, + 22.92929292929267, + 21.91919191919169 + ], + [ + 2236.993095619702, + 22.323232323232105, + 22.92929292929267, + 21.71717171717148 + ], + [ + 2240.725524278202, + 22.222222222222, + 22.72727272727252, + 21.71717171717148 + ], + [ + 2244.457952936701, + 22.121212121211897, + 22.72727272727252, + 21.515151515151274 + ], + [ + 2248.1903815952, + 22.020202020201793, + 22.525252525252313, + 21.515151515151274 + ], + [ + 2251.9228102537, + 22.020202020201793, + 22.525252525252313, + 21.515151515151274 + ], + [ + 2255.655238912199, + 21.818181818181586, + 22.323232323232105, + 21.313131313131066 + ], + [ + 2259.387667570698, + 21.818181818181586, + 22.323232323232105, + 21.313131313131066 + ], + [ + 2263.120096229197, + 21.71717171717148, + 22.323232323232105, + 21.11111111111086 + ], + [ + 2266.8525248876967, + 21.616161616161378, + 22.121212121211897, + 21.11111111111086 + ], + [ + 2270.5849535461957, + 21.616161616161378, + 22.121212121211897, + 21.11111111111086 + ], + [ + 2274.3173822046947, + 21.515151515151274, + 22.121212121211897, + 20.90909090909065 + ], + [ + 2278.0498108631946, + 21.41414141414117, + 21.91919191919169, + 20.90909090909065 + ], + [ + 2281.7822395216936, + 21.41414141414117, + 21.91919191919169, + 20.90909090909065 + ], + [ + 2285.5146681801925, + 21.313131313131066, + 21.91919191919169, + 20.7070707070705 + ], + [ + 2289.2470968386915, + 21.212121212120962, + 21.71717171717148, + 20.7070707070705 + ], + [ + 2292.9795254971914, + 21.212121212120962, + 21.71717171717148, + 20.7070707070705 + ], + [ + 2296.7119541556904, + 21.11111111111086, + 21.71717171717148, + 20.505050505050292 + ], + [ + 2300.4443828141893, + 21.010101010100755, + 21.515151515151274, + 20.505050505050292 + ], + [ + 2304.1768114726883, + 21.010101010100755, + 21.515151515151274, + 20.505050505050292 + ], + [ + 2307.909240131188, + 20.90909090909065, + 21.515151515151274, + 20.303030303030084 + ], + [ + 2311.641668789687, + 20.808080808080547, + 21.313131313131066, + 20.303030303030084 + ], + [ + 2315.374097448186, + 20.808080808080547, + 21.313131313131066, + 20.303030303030084 + ], + [ + 2319.106526106686, + 20.808080808080547, + 21.313131313131066, + 20.303030303030084 + ], + [ + 2322.838954765185, + 20.606060606060396, + 21.11111111111086, + 20.101010101009877 + ], + [ + 2326.571383423684, + 20.606060606060396, + 21.11111111111086, + 20.101010101009877 + ], + [ + 2330.303812082183, + 20.606060606060396, + 21.11111111111086, + 20.101010101009877 + ], + [ + 2334.036240740683, + 20.404040404040188, + 20.90909090909065, + 19.89898989898967 + ], + [ + 2337.768669399182, + 20.404040404040188, + 20.90909090909065, + 19.89898989898967 + ], + [ + 2341.501098057681, + 20.404040404040188, + 20.90909090909065, + 19.89898989898967 + ], + [ + 2345.2335267161798, + 20.404040404040188, + 20.90909090909065, + 19.89898989898967 + ], + [ + 2348.9659553746797, + 20.20202020201998, + 20.7070707070705, + 19.69696969696946 + ], + [ + 2352.6983840331786, + 20.20202020201998, + 20.7070707070705, + 19.69696969696946 + ], + [ + 2356.4308126916776, + 20.20202020201998, + 20.7070707070705, + 19.69696969696946 + ], + [ + 2360.1632413501775, + 20.20202020201998, + 20.7070707070705, + 19.69696969696946 + ], + [ + 2363.8956700086765, + 19.999999999999773, + 20.505050505050292, + 19.494949494949253 + ], + [ + 2367.6280986671754, + 19.999999999999773, + 20.505050505050292, + 19.494949494949253 + ], + [ + 2371.3605273256744, + 19.999999999999773, + 20.505050505050292, + 19.494949494949253 + ], + [ + 2375.0929559841743, + 19.999999999999773, + 20.505050505050292, + 19.494949494949253 + ], + [ + 2378.8253846426733, + 19.797979797979565, + 20.303030303030084, + 19.292929292929045 + ], + [ + 2382.5578133011722, + 19.797979797979565, + 20.303030303030084, + 19.292929292929045 + ], + [ + 2386.290241959671, + 19.797979797979565, + 20.303030303030084, + 19.292929292929045 + ], + [ + 2390.022670618171, + 19.797979797979565, + 20.303030303030084, + 19.292929292929045 + ], + [ + 2393.75509927667, + 19.797979797979565, + 20.303030303030084, + 19.292929292929045 + ], + [ + 2397.487527935169, + 19.595959595959357, + 20.101010101009877, + 19.090909090908838 + ], + [ + 2401.219956593669, + 19.595959595959357, + 20.101010101009877, + 19.090909090908838 + ], + [ + 2404.952385252168, + 19.595959595959357, + 20.101010101009877, + 19.090909090908838 + ], + [ + 2408.684813910667, + 19.595959595959357, + 20.101010101009877, + 19.090909090908838 + ], + [ + 2412.417242569166, + 19.595959595959357, + 20.101010101009877, + 19.090909090908838 + ], + [ + 2416.1496712276657, + 19.39393939393915, + 19.89898989898967, + 18.88888888888863 + ], + [ + 2419.8820998861647, + 19.39393939393915, + 19.89898989898967, + 18.88888888888863 + ], + [ + 2423.6145285446637, + 19.39393939393915, + 19.89898989898967, + 18.88888888888863 + ], + [ + 2427.3469572031627, + 19.39393939393915, + 19.89898989898967, + 18.88888888888863 + ], + [ + 2431.0793858616626, + 19.39393939393915, + 19.89898989898967, + 18.88888888888863 + ], + [ + 2434.8118145201615, + 19.292929292929045, + 19.69696969696946, + 18.88888888888863 + ], + [ + 2438.5442431786605, + 19.19191919191894, + 19.69696969696946, + 18.686868686868422 + ], + [ + 2442.2766718371604, + 19.19191919191894, + 19.69696969696946, + 18.686868686868422 + ], + [ + 2446.0091004956594, + 19.19191919191894, + 19.69696969696946, + 18.686868686868422 + ], + [ + 2449.7415291541583, + 19.19191919191894, + 19.69696969696946, + 18.686868686868422 + ], + [ + 2453.4739578126573, + 19.19191919191894, + 19.69696969696946, + 18.686868686868422 + ], + [ + 2457.206386471157, + 19.19191919191894, + 19.69696969696946, + 18.686868686868422 + ], + [ + 2460.938815129656, + 18.989898989898734, + 19.494949494949253, + 18.48484848484827 + ], + [ + 2464.671243788155, + 18.989898989898734, + 19.494949494949253, + 18.48484848484827 + ], + [ + 2468.403672446654, + 18.989898989898734, + 19.494949494949253, + 18.48484848484827 + ], + [ + 2472.136101105154, + 18.989898989898734, + 19.494949494949253, + 18.48484848484827 + ], + [ + 2475.868529763653, + 18.989898989898734, + 19.494949494949253, + 18.48484848484827 + ], + [ + 2479.600958422152, + 18.989898989898734, + 19.494949494949253, + 18.48484848484827 + ], + [ + 2483.333387080652, + 18.989898989898734, + 19.494949494949253, + 18.48484848484827 + ], + [ + 2487.065815739151, + 18.787878787878526, + 19.292929292929045, + 18.282828282828063 + ], + [ + 2490.79824439765, + 18.787878787878526, + 19.292929292929045, + 18.282828282828063 + ], + [ + 2494.5306730561488, + 18.787878787878526, + 19.292929292929045, + 18.282828282828063 + ], + [ + 2498.2631017146487, + 18.787878787878526, + 19.292929292929045, + 18.282828282828063 + ], + [ + 2501.9955303731476, + 18.787878787878526, + 19.292929292929045, + 18.282828282828063 + ], + [ + 2505.7279590316466, + 18.787878787878526, + 19.292929292929045, + 18.282828282828063 + ], + [ + 2509.4603876901456, + 18.787878787878526, + 19.292929292929045, + 18.282828282828063 + ], + [ + 2513.1928163486455, + 18.787878787878526, + 19.292929292929045, + 18.282828282828063 + ], + [ + 2516.9252450071444, + 18.686868686868422, + 19.090909090908838, + 18.282828282828063 + ], + [ + 2520.6576736656434, + 18.585858585858375, + 19.090909090908838, + 18.080808080807856 + ], + [ + 2524.3901023241433, + 18.585858585858375, + 19.090909090908838, + 18.080808080807856 + ], + [ + 2528.1225309826423, + 18.585858585858375, + 19.090909090908838, + 18.080808080807856 + ], + [ + 2531.8549596411412, + 18.585858585858375, + 19.090909090908838, + 18.080808080807856 + ], + [ + 2535.58738829964, + 18.585858585858375, + 19.090909090908838, + 18.080808080807856 + ], + [ + 2539.31981695814, + 18.585858585858375, + 19.090909090908838, + 18.080808080807856 + ], + [ + 2543.052245616639, + 18.585858585858375, + 19.090909090908838, + 18.080808080807856 + ], + [ + 2546.784674275138, + 18.585858585858375, + 19.090909090908838, + 18.080808080807856 + ], + [ + 2550.517102933638, + 18.585858585858375, + 19.090909090908838, + 18.080808080807856 + ], + [ + 2554.249531592137, + 18.48484848484827, + 18.88888888888863, + 18.080808080807856 + ], + [ + 2557.981960250636, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 2561.714388909135, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 2565.4468175676348, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 2569.1792462261337, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 2572.9116748846327, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 2576.6441035431317, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 2580.3765322016316, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 2584.1089608601305, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 2587.8413895186295, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 2591.5738181771294, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 2595.3062468356284, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 2599.0386754941273, + 18.383838383838167, + 18.88888888888863, + 17.878787878787648 + ], + [ + 2602.7711041526263, + 18.282828282828063, + 18.686868686868422, + 17.878787878787648 + ], + [ + 2606.503532811126, + 18.282828282828063, + 18.686868686868422, + 17.878787878787648 + ], + [ + 2610.235961469625, + 18.282828282828063, + 18.686868686868422, + 17.878787878787648 + ], + [ + 2613.968390128124, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 2617.700818786623, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 2621.433247445123, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 2625.165676103622, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 2628.898104762121, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 2632.630533420621, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 2636.36296207912, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 2640.095390737619, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 2643.827819396118, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 2647.5602480546177, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 2651.2926767131166, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 2655.0251053716156, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 2658.7575340301146, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 2662.4899626886145, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 2666.2223913471134, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 2669.9548200056124, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 2673.6872486641123, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 2677.4196773226113, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 2681.1521059811103, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 2684.8845346396092, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 2688.616963298109, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 2692.349391956608, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 2696.081820615107, + 18.18181818181796, + 18.686868686868422, + 17.67676767676744 + ], + [ + 2699.814249273606, + 18.080808080807856, + 18.48484848484827, + 17.67676767676744 + ], + [ + 2703.546677932106, + 18.080808080807856, + 18.48484848484827, + 17.67676767676744 + ], + [ + 2707.279106590605, + 18.080808080807856, + 18.48484848484827, + 17.67676767676744 + ], + [ + 2711.011535249104, + 18.080808080807856, + 18.48484848484827, + 17.67676767676744 + ], + [ + 2714.7439639076038, + 18.080808080807856, + 18.48484848484827, + 17.67676767676744 + ], + [ + 2718.4763925661027, + 18.080808080807856, + 18.48484848484827, + 17.67676767676744 + ], + [ + 2722.2088212246017, + 18.080808080807856, + 18.48484848484827, + 17.67676767676744 + ], + [ + 2725.9412498831007, + 18.080808080807856, + 18.48484848484827, + 17.67676767676744 + ], + [ + 2729.6736785416006, + 18.080808080807856, + 18.48484848484827, + 17.67676767676744 + ], + [ + 2733.4061072000995, + 18.080808080807856, + 18.48484848484827, + 17.67676767676744 + ], + [ + 2737.1385358585985, + 18.080808080807856, + 18.48484848484827, + 17.67676767676744 + ], + [ + 2740.8709645170975, + 18.080808080807856, + 18.48484848484827, + 17.67676767676744 + ], + [ + 2744.6033931755974, + 18.080808080807856, + 18.48484848484827, + 17.67676767676744 + ] + ] + }, + "samples": { + "Tj": 711, + "Tc": 723 + } + }, + "curve2_1L_water_Tr_mode": { + "page_png": "outputs/expansion_batch04/t1_thermal/mt_rc1mxhfcal/source_cache/img/rc1e_curves_300dpi-51.png", + "page_png_sha256": "27e075b0a0aef47aefd131f8ece09d706070c6abb5faf64ebb73779f5c490f67", + "calibration": { + "y_ticks_px": [ + 1025.5, + 1124.5, + 1223.5, + 1322.5, + 1421.5, + 1520.5, + 1619.5, + 1718.5 + ], + "x_ticks_px": [ + 663.5, + 982.5, + 1306.5, + 1628.5 + ], + "T_per_px": -0.20202020202020196, + "s_per_px": 3.727831979274381, + "T_fit_residual_K": 2.842170943040401e-14, + "t_fit_residual_s": 6.704654626906631 + }, + "columns": [ + "t_s", + "T_median_C", + "T_min_C", + "T_max_C" + ], + "series": { + "Tj": [ + [ + 50.714843725495484, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 54.442675704769954, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 58.17050768404442, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 61.89833966331844, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 65.62617164259291, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 69.35400362186738, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 73.08183560114185, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 76.80966758041632, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 80.53749955969033, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 84.2653315389648, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 87.99316351823927, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 91.72099549751374, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 95.44882747678821, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 99.17665945606223, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 102.9044914353367, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 106.63232341461116, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 110.36015539388563, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 114.0879873731601, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 117.81581935243412, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 121.54365133170859, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 125.27148331098306, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 128.99931529025753, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 132.727147269532, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 136.454979248806, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 140.18281122808048, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 143.91064320735495, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 147.63847518662942, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 151.3663071659039, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 155.0941391451779, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 158.82197112445238, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 162.54980310372684, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 166.27763508300131, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 170.00546706227578, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 173.73329904155025, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 177.46113102082427, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 181.18896300009874, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 184.9167949793732, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 188.64462695864768, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 192.37245893792215, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 196.10029091719616, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 199.82812289647063, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 203.5559548757451, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 207.28378685501957, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 211.01161883429404, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 214.73945081356806, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 218.46728279284252, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 222.195114772117, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 225.92294675139146, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 229.65077873066593, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 233.37861070993995, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 237.10644268921442, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 240.8342746684889, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 244.56210664776336, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 248.28993862703783, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 252.01777060631184, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 255.7456025855863, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 259.4734345648608, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 263.20126654413525, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 266.9290985234097, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 270.65693050268374, + 25.252525252525288, + 25.555555555555543, + 24.949494949494976 + ], + [ + 307.9352502954275, + 26.26262626262627, + 26.76767676767679, + 25.75757575757575 + ], + [ + 311.663082274702, + 26.868686868686893, + 27.97979797979798, + 25.75757575757575 + ], + [ + 315.39091425397646, + 27.373737373737413, + 28.989898989899018, + 25.75757575757575 + ], + [ + 319.11874623325093, + 27.878787878787875, + 30.0, + 25.75757575757575 + ], + [ + 322.8465782125254, + 28.383838383838395, + 31.01010101010104, + 25.75757575757575 + ], + [ + 326.57441019179987, + 29.191919191919226, + 32.02020202020202, + 26.363636363636374 + ], + [ + 330.3022421710739, + 30.30303030303031, + 33.03030303030306, + 27.575757575757564 + ], + [ + 334.03007415034836, + 31.212121212121247, + 33.838383838383834, + 28.585858585858603 + ], + [ + 337.7579061296228, + 32.22222222222223, + 34.84848484848487, + 29.595959595959584 + ], + [ + 341.4857381088973, + 33.13131313131316, + 35.65656565656565, + 30.606060606060623 + ], + [ + 345.21357008817176, + 34.04040404040404, + 36.46464646464648, + 31.616161616161605 + ], + [ + 348.9414020674458, + 34.94949494949498, + 37.27272727272731, + 32.626262626262644 + ], + [ + 352.66923404672025, + 35.75757575757575, + 38.08080808080808, + 33.43434343434342 + ], + [ + 356.3970660259947, + 36.666666666666686, + 38.888888888888914, + 34.44444444444446 + ], + [ + 360.1248980052692, + 37.47474747474746, + 39.69696969696969, + 35.25252525252529 + ], + [ + 363.85272998454366, + 38.28282828282829, + 40.50505050505052, + 36.06060606060606 + ], + [ + 367.5805619638177, + 39.09090909090912, + 41.31313131313135, + 36.86868686868689 + ], + [ + 371.30839394309214, + 39.898989898989896, + 42.121212121212125, + 37.67676767676767 + ], + [ + 375.0362259223666, + 40.60606060606062, + 42.72727272727275, + 38.4848484848485 + ], + [ + 378.7640579016411, + 41.4141414141414, + 43.53535353535352, + 39.29292929292933 + ], + [ + 382.49188988091555, + 42.121212121212125, + 44.141414141414145, + 40.101010101010104 + ], + [ + 386.21972186018957, + 42.929292929292956, + 44.94949494949498, + 40.909090909090935 + ], + [ + 389.94755383946404, + 43.636363636363626, + 45.55555555555554, + 41.71717171717171 + ], + [ + 393.6753858187385, + 44.34343434343435, + 46.363636363636374, + 42.32323232323233 + ], + [ + 397.403217798013, + 45.05050505050508, + 46.969696969697, + 43.13131313131316 + ], + [ + 401.13104977728744, + 45.75757575757575, + 47.77777777777777, + 43.73737373737373 + ], + [ + 404.85888175656146, + 46.46464646464648, + 48.383838383838395, + 44.54545454545456 + ], + [ + 408.58671373583593, + 47.0707070707071, + 48.98989898989902, + 45.151515151515184 + ], + [ + 412.3145457151104, + 47.878787878787875, + 49.79797979797979, + 45.95959595959596 + ], + [ + 416.04237769438487, + 48.4848484848485, + 50.404040404040416, + 46.56565656565658 + ], + [ + 419.77020967365934, + 49.191919191919226, + 51.01010101010104, + 47.373737373737356 + ], + [ + 423.49804165293335, + 49.79797979797979, + 51.616161616161605, + 47.97979797979798 + ], + [ + 427.2258736322078, + 50.404040404040416, + 52.22222222222223, + 48.5858585858586 + ], + [ + 430.9537056114823, + 51.21212121212125, + 53.03030303030306, + 49.39393939393938 + ], + [ + 434.68153759075676, + 51.81818181818181, + 53.636363636363626, + 50.0 + ], + [ + 438.40936957003123, + 52.424242424242436, + 54.24242424242425, + 50.60606060606062 + ], + [ + 442.13720154930525, + 53.03030303030306, + 54.84848484848487, + 51.21212121212125 + ], + [ + 445.8650335285797, + 53.636363636363626, + 55.45454545454544, + 51.81818181818181 + ], + [ + 449.5928655078542, + 54.34343434343435, + 56.06060606060606, + 52.626262626262644 + ], + [ + 453.32069748712865, + 54.94949494949498, + 56.666666666666686, + 53.23232323232321 + ], + [ + 457.0485294664031, + 55.55555555555554, + 57.27272727272725, + 53.838383838383834 + ], + [ + 460.77636144567714, + 56.161616161616166, + 57.878787878787875, + 54.44444444444446 + ], + [ + 464.5041934249516, + 56.76767676767679, + 58.4848484848485, + 55.05050505050508 + ], + [ + 468.2320254042261, + 57.27272727272725, + 58.888888888888914, + 55.65656565656565 + ], + [ + 471.95985738350055, + 57.878787878787875, + 59.49494949494948, + 56.26262626262627 + ], + [ + 475.687689362775, + 58.4848484848485, + 60.101010101010104, + 56.86868686868689 + ], + [ + 479.4155213420495, + 59.09090909090912, + 60.70707070707073, + 57.47474747474746 + ], + [ + 483.1433533213235, + 59.69696969696969, + 61.313131313131294, + 58.08080808080808 + ], + [ + 486.871185300598, + 60.30303030303031, + 61.91919191919192, + 58.686868686868706 + ], + [ + 490.59901727987244, + 60.70707070707073, + 62.32323232323233, + 59.09090909090912 + ], + [ + 494.3268492591469, + 61.313131313131294, + 62.929292929292956, + 59.69696969696969 + ], + [ + 498.0546812384214, + 61.91919191919192, + 63.53535353535352, + 60.30303030303031 + ], + [ + 501.7825132176954, + 62.52525252525254, + 64.14141414141415, + 60.909090909090935 + ], + [ + 505.51034519696987, + 63.03030303030306, + 64.54545454545456, + 61.5151515151515 + ], + [ + 509.23817717624433, + 63.636363636363626, + 65.15151515151513, + 62.121212121212125 + ], + [ + 512.9660091555188, + 64.14141414141415, + 65.75757575757575, + 62.52525252525254 + ], + [ + 516.6938411347933, + 64.64646464646466, + 66.16161616161617, + 63.13131313131311 + ], + [ + 520.4216731140673, + 65.25252525252523, + 66.76767676767679, + 63.73737373737373 + ], + [ + 524.1495050933418, + 65.85858585858585, + 67.37373737373736, + 64.34343434343435 + ], + [ + 527.8773370726162, + 66.26262626262627, + 67.77777777777777, + 64.74747474747477 + ], + [ + 531.6051690518907, + 66.8686868686869, + 68.3838383838384, + 65.35353535353534 + ], + [ + 535.3330010311652, + 67.47474747474746, + 68.98989898989902, + 65.95959595959596 + ], + [ + 539.0608330104392, + 67.87878787878788, + 69.39393939393938, + 66.36363636363637 + ], + [ + 542.7886649897137, + 68.4848484848485, + 70.0, + 66.969696969697 + ], + [ + 546.5164969689881, + 68.98989898989902, + 70.40404040404042, + 67.57575757575756 + ], + [ + 550.2443289482626, + 69.49494949494948, + 71.01010101010104, + 67.97979797979798 + ], + [ + 553.9721609275371, + 70.0, + 71.4141414141414, + 68.5858585858586 + ], + [ + 557.6999929068111, + 70.50505050505052, + 72.02020202020202, + 68.98989898989902 + ], + [ + 561.4278248860855, + 71.01010101010104, + 72.42424242424244, + 69.59595959595958 + ], + [ + 565.15565686536, + 71.6161616161616, + 73.030303030303, + 70.20202020202021 + ], + [ + 568.8834888446345, + 72.02020202020202, + 73.43434343434342, + 70.60606060606062 + ], + [ + 572.611320823909, + 72.62626262626264, + 74.04040404040404, + 71.21212121212119 + ], + [ + 576.339152803183, + 73.030303030303, + 74.44444444444446, + 71.6161616161616 + ], + [ + 580.0669847824574, + 73.63636363636363, + 75.05050505050502, + 72.22222222222223 + ], + [ + 583.7948167617319, + 74.04040404040404, + 75.45454545454544, + 72.62626262626264 + ], + [ + 587.5226487410064, + 74.64646464646466, + 76.06060606060606, + 73.23232323232321 + ], + [ + 591.2504807202808, + 75.05050505050502, + 76.46464646464648, + 73.63636363636363 + ], + [ + 594.9783126995549, + 75.55555555555554, + 76.8686868686869, + 74.24242424242425 + ], + [ + 598.7061446788293, + 76.06060606060606, + 77.47474747474746, + 74.64646464646466 + ], + [ + 602.4339766581038, + 76.46464646464648, + 77.87878787878788, + 75.05050505050502 + ], + [ + 606.1618086373783, + 77.07070707070704, + 78.4848484848485, + 75.65656565656565 + ], + [ + 609.8896406166527, + 77.47474747474746, + 78.88888888888891, + 76.06060606060606 + ], + [ + 613.6174725959268, + 77.97979797979798, + 79.29292929292927, + 76.66666666666669 + ], + [ + 617.3453045752012, + 78.4848484848485, + 79.8989898989899, + 77.07070707070704 + ], + [ + 621.0731365544757, + 78.98989898989896, + 80.30303030303031, + 77.67676767676767 + ], + [ + 624.8009685337502, + 79.39393939393938, + 80.70707070707073, + 78.08080808080808 + ], + [ + 628.5288005130246, + 79.8989898989899, + 81.3131313131313, + 78.4848484848485 + ], + [ + 632.2566324922991, + 80.40404040404042, + 81.71717171717171, + 79.09090909090907 + ], + [ + 635.9844644715731, + 80.80808080808083, + 82.12121212121212, + 79.49494949494948 + ], + [ + 639.7122964508476, + 81.21212121212119, + 82.52525252525254, + 79.8989898989899 + ], + [ + 643.4401284301221, + 81.81818181818181, + 83.1313131313131, + 80.50505050505052 + ], + [ + 647.1679604093965, + 82.22222222222223, + 83.53535353535352, + 80.90909090909093 + ], + [ + 650.895792388671, + 82.62626262626264, + 83.93939393939394, + 81.3131313131313 + ], + [ + 654.623624367945, + 83.23232323232321, + 84.54545454545456, + 81.91919191919192 + ], + [ + 658.3514563472195, + 83.63636363636363, + 84.94949494949492, + 82.32323232323233 + ], + [ + 662.079288326494, + 84.04040404040404, + 85.35353535353534, + 82.72727272727275 + ], + [ + 665.8071203057684, + 84.44444444444446, + 85.75757575757575, + 83.1313131313131 + ], + [ + 669.5349522850429, + 84.94949494949492, + 86.16161616161617, + 83.73737373737373 + ], + [ + 673.2627842643169, + 85.45454545454544, + 86.76767676767679, + 84.14141414141415 + ], + [ + 676.9906162435914, + 85.85858585858585, + 87.17171717171715, + 84.54545454545456 + ], + [ + 680.7184482228658, + 86.26262626262627, + 87.57575757575756, + 84.94949494949492 + ], + [ + 684.4462802021403, + 86.76767676767679, + 87.97979797979798, + 85.55555555555554 + ], + [ + 688.1741121814148, + 87.17171717171715, + 88.3838383838384, + 85.95959595959596 + ], + [ + 691.9019441606888, + 87.67676767676767, + 88.98989898989896, + 86.36363636363637 + ], + [ + 695.6297761399633, + 88.08080808080808, + 89.39393939393938, + 86.76767676767679 + ], + [ + 699.3576081192377, + 88.4848484848485, + 89.79797979797979, + 87.17171717171715 + ], + [ + 703.0854400985122, + 88.98989898989896, + 90.20202020202021, + 87.77777777777777 + ], + [ + 706.8132720777867, + 89.39393939393938, + 90.60606060606062, + 88.18181818181819 + ], + [ + 710.5411040570607, + 89.79797979797979, + 91.01010101010098, + 88.5858585858586 + ], + [ + 714.2689360363352, + 90.20202020202021, + 91.4141414141414, + 88.98989898989896 + ], + [ + 717.9967680156096, + 90.70707070707073, + 92.02020202020202, + 89.39393939393938 + ], + [ + 721.7245999948841, + 91.11111111111109, + 92.42424242424241, + 89.79797979797979 + ], + [ + 725.4524319741586, + 91.6161616161616, + 92.82828282828282, + 90.40404040404042 + ], + [ + 729.1802639534326, + 92.02020202020202, + 93.23232323232324, + 90.80808080808083 + ], + [ + 732.908095932707, + 92.42424242424241, + 93.63636363636363, + 91.21212121212122 + ], + [ + 781.3699116632743, + 98.98989898989899, + 99.0909090909091, + 98.88888888888889 + ], + [ + 785.0977436425483, + 99.1919191919192, + 99.49494949494948, + 98.88888888888889 + ], + [ + 788.8255756218227, + 99.39393939393938, + 99.8989898989899, + 98.88888888888889 + ], + [ + 792.5534076010972, + 99.59595959595958, + 100.30303030303028, + 98.88888888888889 + ], + [ + 796.2812395803717, + 99.79797979797979, + 100.7070707070707, + 98.88888888888889 + ], + [ + 800.0090715596461, + 100.0, + 101.11111111111111, + 98.88888888888889 + ], + [ + 803.7369035389206, + 100.30303030303028, + 101.5151515151515, + 99.0909090909091 + ], + [ + 807.4647355181946, + 100.7070707070707, + 101.91919191919192, + 99.49494949494948 + ], + [ + 811.1925674974691, + 101.11111111111111, + 102.3232323232323, + 99.8989898989899 + ], + [ + 814.9203994767436, + 101.4141414141414, + 102.52525252525251, + 100.30303030303028 + ], + [ + 818.648231456018, + 101.81818181818181, + 102.92929292929293, + 100.7070707070707 + ], + [ + 822.3760634352925, + 102.2222222222222, + 103.33333333333331, + 101.11111111111111 + ], + [ + 826.1038954145665, + 102.62626262626262, + 103.73737373737373, + 101.5151515151515 + ], + [ + 829.831727393841, + 103.03030303030303, + 104.14141414141415, + 101.91919191919192 + ], + [ + 833.5595593731155, + 103.43434343434342, + 104.54545454545453, + 102.3232323232323 + ], + [ + 837.2873913523899, + 103.83838383838383, + 104.94949494949495, + 102.72727272727272 + ], + [ + 841.0152233316644, + 104.24242424242422, + 105.35353535353534, + 103.13131313131314 + ], + [ + 844.7430553109384, + 104.64646464646464, + 105.75757575757575, + 103.53535353535352 + ], + [ + 848.4708872902129, + 105.05050505050505, + 106.16161616161614, + 103.93939393939394 + ], + [ + 852.1987192694874, + 105.45454545454544, + 106.56565656565655, + 104.34343434343432 + ], + [ + 855.9265512487618, + 105.85858585858585, + 106.96969696969697, + 104.74747474747474 + ], + [ + 859.6543832280363, + 106.16161616161614, + 107.37373737373736, + 104.94949494949495 + ], + [ + 863.3822152073103, + 106.46464646464645, + 107.57575757575756, + 105.35353535353534 + ], + [ + 867.1100471865848, + 106.86868686868686, + 107.97979797979798, + 105.75757575757575 + ], + [ + 870.8378791658592, + 107.27272727272725, + 108.38383838383837, + 106.16161616161614 + ], + [ + 874.5657111451337, + 107.67676767676767, + 108.78787878787878, + 106.56565656565655 + ], + [ + 878.2935431244082, + 108.08080808080808, + 109.19191919191917, + 106.96969696969697 + ], + [ + 882.0213751036822, + 108.48484848484847, + 109.59595959595958, + 107.37373737373736 + ], + [ + 885.7492070829567, + 108.88888888888889, + 110.0, + 107.77777777777777 + ], + [ + 889.4770390622311, + 109.29292929292927, + 110.40404040404039, + 108.18181818181816 + ], + [ + 893.2048710415056, + 109.59595959595958, + 110.6060606060606, + 108.58585858585857 + ], + [ + 896.9327030207801, + 109.8989898989899, + 111.01010101010101, + 108.78787878787878 + ], + [ + 900.6605350000541, + 110.30303030303028, + 111.4141414141414, + 109.19191919191917 + ], + [ + 904.3883669793286, + 110.7070707070707, + 111.81818181818181, + 109.59595959595958 + ], + [ + 908.116198958603, + 111.11111111111109, + 112.2222222222222, + 110.0 + ], + [ + 911.8440309378775, + 111.5151515151515, + 112.62626262626262, + 110.40404040404039 + ], + [ + 915.571862917152, + 111.81818181818181, + 112.82828282828282, + 110.8080808080808 + ], + [ + 919.299694896426, + 112.2222222222222, + 113.23232323232321, + 111.21212121212119 + ], + [ + 923.0275268757005, + 112.52525252525251, + 113.63636363636363, + 111.4141414141414 + ], + [ + 926.7553588549749, + 112.92929292929293, + 114.04040404040404, + 111.81818181818181 + ], + [ + 930.4831908342494, + 113.33333333333331, + 114.44444444444443, + 112.2222222222222 + ], + [ + 934.2110228135239, + 113.73737373737373, + 114.84848484848484, + 112.62626262626262 + ], + [ + 937.9388547927979, + 114.04040404040404, + 115.05050505050505, + 113.03030303030303 + ], + [ + 941.6666867720724, + 114.34343434343432, + 115.45454545454544, + 113.23232323232321 + ], + [ + 945.3945187513468, + 114.74747474747474, + 115.85858585858585, + 113.63636363636363 + ], + [ + 949.1223507306213, + 115.15151515151513, + 116.26262626262624, + 114.04040404040404 + ], + [ + 952.8501827098958, + 115.45454545454544, + 116.46464646464645, + 114.44444444444443 + ], + [ + 956.5780146891702, + 115.85858585858585, + 116.86868686868686, + 114.84848484848484 + ], + [ + 960.3058466684442, + 116.16161616161614, + 117.27272727272725, + 115.05050505050505 + ], + [ + 964.0336786477187, + 116.56565656565655, + 117.67676767676767, + 115.45454545454544 + ], + [ + 967.7615106269932, + 116.96969696969697, + 118.08080808080805, + 115.85858585858585 + ], + [ + 971.4893426062677, + 117.27272727272725, + 118.28282828282826, + 116.26262626262624 + ], + [ + 975.2171745855421, + 117.67676767676767, + 118.68686868686868, + 116.66666666666666 + ], + [ + 978.9450065648161, + 117.97979797979798, + 119.09090909090907, + 116.86868686868686 + ], + [ + 982.6728385440906, + 118.38383838383837, + 119.49494949494948, + 117.27272727272725 + ], + [ + 986.4006705233651, + 118.68686868686868, + 119.69696969696969, + 117.67676767676767 + ], + [ + 990.1285025026395, + 119.09090909090907, + 120.10101010101008, + 118.08080808080805 + ], + [ + 993.856334481914, + 119.39393939393938, + 120.50505050505049, + 118.28282828282826 + ], + [ + 997.584166461188, + 119.79797979797979, + 120.9090909090909, + 118.68686868686868 + ], + [ + 1001.3119984404625, + 120.10101010101008, + 121.11111111111109, + 119.09090909090907 + ], + [ + 1005.039830419737, + 120.20202020202018, + 120.9090909090909, + 119.49494949494948 + ], + [ + 1008.7676623990114, + 120.50505050505049, + 121.91919191919192, + 119.69696969696969 + ], + [ + 1012.4954943782859, + 121.01010101010098, + 122.1212121212121, + 120.10101010101008 + ], + [ + 1016.2233263575599, + 121.5151515151515, + 122.52525252525251, + 120.50505050505049 + ], + [ + 1019.9511583368344, + 121.91919191919192, + 122.92929292929293, + 120.9090909090909 + ], + [ + 1023.6789903161089, + 122.02020202020199, + 122.92929292929293, + 121.11111111111109 + ], + [ + 1027.4068222953833, + 122.2222222222222, + 122.92929292929293, + 121.5151515151515 + ], + [ + 1031.1346542746578, + 122.42424242424241, + 122.92929292929293, + 121.91919191919192 + ], + [ + 1034.8624862539318, + 122.62626262626262, + 122.92929292929293, + 122.3232323232323 + ], + [ + 1038.5903182332063, + 122.72727272727272, + 122.92929292929293, + 122.52525252525251 + ], + [ + 1109.4191258394194, + 129.99999999999997, + 131.01010101010098, + 128.98989898989896 + ], + [ + 1113.1469578186939, + 130.4040404040404, + 131.4141414141414, + 129.39393939393938 + ], + [ + 1116.8747897979683, + 130.6060606060606, + 131.6161616161616, + 129.59595959595958 + ], + [ + 1120.6026217772428, + 131.01010101010098, + 132.020202020202, + 129.99999999999997 + ], + [ + 1124.3304537565173, + 131.3131313131313, + 132.2222222222222, + 130.4040404040404 + ], + [ + 1128.0582857357917, + 131.6161616161616, + 132.62626262626262, + 130.6060606060606 + ], + [ + 1131.7861177150658, + 132.020202020202, + 133.030303030303, + 131.01010101010098 + ], + [ + 1135.5139496943402, + 132.2222222222222, + 133.2323232323232, + 131.2121212121212 + ], + [ + 1139.2417816736147, + 132.62626262626262, + 133.63636363636363, + 131.6161616161616 + ], + [ + 1142.9696136528892, + 132.9292929292929, + 133.83838383838383, + 132.020202020202 + ], + [ + 1146.6974456321636, + 133.2323232323232, + 134.24242424242422, + 132.2222222222222 + ], + [ + 1150.4252776114377, + 133.63636363636363, + 134.64646464646464, + 132.62626262626262 + ], + [ + 1154.1531095907121, + 133.9393939393939, + 134.84848484848484, + 133.030303030303 + ], + [ + 1157.8809415699866, + 134.24242424242422, + 135.25252525252523, + 133.2323232323232 + ], + [ + 1161.608773549261, + 134.54545454545453, + 135.45454545454544, + 133.63636363636363 + ], + [ + 1165.3366055285355, + 134.84848484848484, + 135.85858585858583, + 133.83838383838383 + ], + [ + 1169.0644375078095, + 135.25252525252523, + 136.26262626262624, + 134.24242424242422 + ], + [ + 1172.792269487084, + 135.55555555555554, + 136.46464646464645, + 134.64646464646464 + ], + [ + 1176.5201014663585, + 135.85858585858583, + 136.86868686868684, + 134.84848484848484 + ], + [ + 1180.247933445633, + 136.16161616161614, + 137.07070707070704, + 135.25252525252523 + ], + [ + 1183.9757654249074, + 136.46464646464645, + 137.47474747474746, + 135.45454545454544 + ], + [ + 1187.7035974041814, + 136.76767676767676, + 137.67676767676767, + 135.85858585858583 + ], + [ + 1191.431429383456, + 137.07070707070704, + 138.08080808080805, + 136.06060606060603 + ], + [ + 1195.1592613627304, + 137.47474747474746, + 138.48484848484847, + 136.46464646464645 + ], + [ + 1198.8870933420048, + 137.77777777777777, + 138.68686868686868, + 136.86868686868684 + ], + [ + 1202.6149253212793, + 138.08080808080805, + 139.09090909090907, + 137.07070707070704 + ], + [ + 1206.3427573005533, + 138.38383838383837, + 139.29292929292927, + 137.47474747474746 + ], + [ + 1210.0705892798278, + 138.68686868686868, + 139.6969696969697, + 137.67676767676767 + ], + [ + 1213.7984212591023, + 139.09090909090907, + 140.10101010101008, + 138.08080808080805 + ], + [ + 1217.5262532383767, + 139.29292929292927, + 140.30303030303028, + 138.28282828282826 + ], + [ + 1221.2540852176512, + 139.59595959595958, + 140.5050505050505, + 138.68686868686868 + ], + [ + 1224.9819171969252, + 139.59595959595958, + 140.30303030303028, + 138.88888888888886 + ], + [ + 1228.7097491761997, + 139.59595959595958, + 140.30303030303028, + 138.88888888888886 + ], + [ + 1232.4375811554742, + 139.29292929292927, + 140.30303030303028, + 138.28282828282826 + ], + [ + 1236.1654131347486, + 138.68686868686868, + 140.30303030303028, + 137.07070707070704 + ], + [ + 1239.893245114023, + 137.87878787878785, + 140.10101010101008, + 135.65656565656565 + ], + [ + 1243.6210770932971, + 136.66666666666666, + 139.6969696969697, + 133.63636363636363 + ], + [ + 1247.3489090725716, + 135.15151515151513, + 139.29292929292927, + 131.01010101010098 + ], + [ + 1251.076741051846, + 133.1313131313131, + 138.68686868686868, + 127.57575757575756 + ], + [ + 1254.8045730311205, + 129.8989898989899, + 137.67676767676767, + 122.1212121212121 + ], + [ + 1258.532405010395, + 123.83838383838383, + 136.26262626262624, + 111.4141414141414 + ], + [ + 1262.260236989669, + 121.4141414141414, + 134.44444444444443, + 108.38383838383837 + ], + [ + 1265.9880689689435, + 119.69696969696969, + 132.020202020202, + 107.37373737373736 + ], + [ + 1269.715900948218, + 117.87878787878788, + 128.98989898989896, + 106.76767676767676 + ], + [ + 1273.4437329274924, + 115.25252525252523, + 124.34343434343432, + 106.16161616161614 + ], + [ + 1277.171564906767, + 111.01010101010101, + 116.26262626262624, + 105.75757575757575 + ], + [ + 1280.8993968860414, + 107.17171717171715, + 108.98989898989899, + 105.35353535353534 + ], + [ + 1284.6272288653154, + 106.36363636363635, + 107.77777777777777, + 104.94949494949495 + ], + [ + 1288.3550608445898, + 105.95959595959596, + 107.17171717171715, + 104.74747474747474 + ], + [ + 1292.0828928238643, + 105.55555555555554, + 106.56565656565655, + 104.54545454545453 + ], + [ + 1295.8107248031388, + 105.25252525252523, + 106.16161616161614, + 104.34343434343432 + ], + [ + 1299.5385567824133, + 104.94949494949495, + 105.75757575757575, + 104.14141414141415 + ], + [ + 1303.2663887616873, + 104.64646464646464, + 105.35353535353534, + 103.93939393939394 + ], + [ + 1306.9942207409617, + 104.54545454545453, + 105.15151515151516, + 103.93939393939394 + ], + [ + 1310.7220527202362, + 104.34343434343432, + 104.94949494949495, + 103.73737373737373 + ], + [ + 1314.4498846995107, + 104.24242424242422, + 104.74747474747474, + 103.73737373737373 + ], + [ + 1318.1777166787851, + 104.24242424242422, + 104.74747474747474, + 103.73737373737373 + ], + [ + 1321.9055486580592, + 104.04040404040404, + 104.54545454545453, + 103.53535353535352 + ], + [ + 1325.6333806373336, + 104.04040404040404, + 104.54545454545453, + 103.53535353535352 + ], + [ + 1329.361212616608, + 104.04040404040404, + 104.54545454545453, + 103.53535353535352 + ], + [ + 1333.0890445958826, + 103.93939393939394, + 104.34343434343432, + 103.53535353535352 + ], + [ + 1336.816876575157, + 103.93939393939394, + 104.34343434343432, + 103.53535353535352 + ], + [ + 1340.544708554431, + 103.93939393939394, + 104.34343434343432, + 103.53535353535352 + ], + [ + 1344.2725405337055, + 104.04040404040404, + 104.54545454545453, + 103.53535353535352 + ], + [ + 1348.00037251298, + 104.04040404040404, + 104.54545454545453, + 103.53535353535352 + ], + [ + 1351.7282044922545, + 104.04040404040404, + 104.54545454545453, + 103.53535353535352 + ], + [ + 1355.456036471529, + 104.24242424242422, + 104.74747474747474, + 103.73737373737373 + ], + [ + 1359.183868450803, + 104.24242424242422, + 104.74747474747474, + 103.73737373737373 + ], + [ + 1362.9117004300774, + 104.34343434343432, + 104.94949494949495, + 103.73737373737373 + ], + [ + 1366.639532409352, + 104.54545454545453, + 105.15151515151516, + 103.93939393939394 + ], + [ + 1370.3673643886264, + 104.54545454545453, + 105.15151515151516, + 103.93939393939394 + ], + [ + 1374.0951963679008, + 104.74747474747474, + 105.35353535353534, + 104.14141414141415 + ], + [ + 1377.8230283471748, + 105.05050505050505, + 105.75757575757575, + 104.34343434343432 + ], + [ + 1381.5508603264493, + 105.25252525252523, + 106.16161616161614, + 104.34343434343432 + ], + [ + 1385.2786923057238, + 105.45454545454544, + 106.36363636363635, + 104.54545454545453 + ], + [ + 1389.0065242849982, + 105.55555555555554, + 106.36363636363635, + 104.74747474747474 + ], + [ + 1392.7343562642727, + 105.65656565656565, + 106.36363636363635, + 104.94949494949495 + ], + [ + 1396.4621882435467, + 105.85858585858585, + 106.36363636363635, + 105.35353535353534 + ], + [ + 1400.1900202228212, + 105.95959595959596, + 106.36363636363635, + 105.55555555555554 + ], + [ + 1403.9178522020957, + 106.06060606060606, + 106.56565656565655, + 105.55555555555554 + ], + [ + 1407.6456841813701, + 106.06060606060606, + 106.56565656565655, + 105.55555555555554 + ], + [ + 1411.3735161606446, + 106.06060606060606, + 106.56565656565655, + 105.55555555555554 + ], + [ + 1415.1013481399186, + 106.06060606060606, + 106.56565656565655, + 105.55555555555554 + ], + [ + 1418.829180119193, + 106.06060606060606, + 106.56565656565655, + 105.55555555555554 + ], + [ + 1422.5570120984676, + 105.95959595959596, + 106.36363636363635, + 105.55555555555554 + ], + [ + 1426.284844077742, + 105.95959595959596, + 106.36363636363635, + 105.55555555555554 + ], + [ + 1430.0126760570165, + 105.95959595959596, + 106.36363636363635, + 105.55555555555554 + ], + [ + 1433.740508036291, + 105.95959595959596, + 106.36363636363635, + 105.55555555555554 + ], + [ + 1437.468340015565, + 105.95959595959596, + 106.36363636363635, + 105.55555555555554 + ], + [ + 1441.1961719948395, + 105.85858585858585, + 106.36363636363635, + 105.35353535353534 + ], + [ + 1444.924003974114, + 105.85858585858585, + 106.36363636363635, + 105.35353535353534 + ], + [ + 1448.6518359533884, + 105.85858585858585, + 106.36363636363635, + 105.35353535353534 + ], + [ + 1452.3796679326629, + 105.75757575757575, + 106.16161616161614, + 105.35353535353534 + ], + [ + 1456.1074999119369, + 105.75757575757575, + 106.16161616161614, + 105.35353535353534 + ], + [ + 1459.8353318912114, + 105.65656565656565, + 106.16161616161614, + 105.15151515151516 + ], + [ + 1463.5631638704858, + 105.65656565656565, + 106.16161616161614, + 105.15151515151516 + ], + [ + 1467.2909958497603, + 105.65656565656565, + 106.16161616161614, + 105.15151515151516 + ], + [ + 1471.0188278290348, + 105.55555555555554, + 105.95959595959596, + 105.15151515151516 + ], + [ + 1474.7466598083088, + 105.45454545454544, + 105.95959595959596, + 104.94949494949495 + ], + [ + 1478.4744917875832, + 105.45454545454544, + 105.95959595959596, + 104.94949494949495 + ], + [ + 1482.2023237668577, + 105.45454545454544, + 105.95959595959596, + 104.94949494949495 + ], + [ + 1485.9301557461322, + 105.35353535353534, + 105.75757575757575, + 104.94949494949495 + ], + [ + 1489.6579877254067, + 105.25252525252523, + 105.75757575757575, + 104.74747474747474 + ], + [ + 1493.3858197046807, + 105.25252525252523, + 105.75757575757575, + 104.74747474747474 + ], + [ + 1497.1136516839551, + 105.25252525252523, + 105.75757575757575, + 104.74747474747474 + ], + [ + 1500.8414836632296, + 105.15151515151516, + 105.55555555555554, + 104.74747474747474 + ], + [ + 1504.569315642504, + 105.05050505050505, + 105.55555555555554, + 104.54545454545453 + ], + [ + 1508.2971476217785, + 105.05050505050505, + 105.55555555555554, + 104.54545454545453 + ], + [ + 1512.0249796010526, + 105.05050505050505, + 105.55555555555554, + 104.54545454545453 + ], + [ + 1515.752811580327, + 104.84848484848484, + 105.35353535353534, + 104.34343434343432 + ], + [ + 1519.4806435596015, + 104.84848484848484, + 105.35353535353534, + 104.34343434343432 + ], + [ + 1523.208475538876, + 104.84848484848484, + 105.35353535353534, + 104.34343434343432 + ], + [ + 1526.9363075181504, + 104.64646464646464, + 105.15151515151516, + 104.14141414141415 + ], + [ + 1530.6641394974245, + 104.64646464646464, + 105.15151515151516, + 104.14141414141415 + ], + [ + 1534.391971476699, + 104.64646464646464, + 105.15151515151516, + 104.14141414141415 + ], + [ + 1538.1198034559734, + 104.44444444444443, + 104.94949494949495, + 103.93939393939394 + ], + [ + 1541.8476354352479, + 104.44444444444443, + 104.94949494949495, + 103.93939393939394 + ], + [ + 1545.5754674145223, + 104.44444444444443, + 104.94949494949495, + 103.93939393939394 + ], + [ + 1549.3032993937964, + 104.24242424242422, + 104.74747474747474, + 103.73737373737373 + ], + [ + 1553.0311313730708, + 104.24242424242422, + 104.74747474747474, + 103.73737373737373 + ], + [ + 1556.7589633523453, + 104.24242424242422, + 104.74747474747474, + 103.73737373737373 + ], + [ + 1560.4867953316198, + 104.04040404040404, + 104.54545454545453, + 103.53535353535352 + ], + [ + 1564.2146273108942, + 104.04040404040404, + 104.54545454545453, + 103.53535353535352 + ], + [ + 1567.9424592901682, + 104.04040404040404, + 104.54545454545453, + 103.53535353535352 + ], + [ + 1571.6702912694427, + 103.83838383838383, + 104.34343434343432, + 103.33333333333331 + ], + [ + 1575.3981232487172, + 103.83838383838383, + 104.34343434343432, + 103.33333333333331 + ], + [ + 1579.1259552279917, + 103.83838383838383, + 104.34343434343432, + 103.33333333333331 + ], + [ + 1582.8537872072661, + 103.63636363636363, + 104.14141414141415, + 103.13131313131314 + ], + [ + 1586.5816191865406, + 103.63636363636363, + 104.14141414141415, + 103.13131313131314 + ], + [ + 1590.3094511658146, + 103.43434343434342, + 103.93939393939394, + 102.92929292929293 + ], + [ + 1594.037283145089, + 103.43434343434342, + 103.93939393939394, + 102.92929292929293 + ], + [ + 1597.7651151243635, + 103.43434343434342, + 103.93939393939394, + 102.92929292929293 + ], + [ + 1601.492947103638, + 103.23232323232321, + 103.73737373737373, + 102.72727272727272 + ], + [ + 1605.2207790829125, + 103.23232323232321, + 103.73737373737373, + 102.72727272727272 + ], + [ + 1608.9486110621865, + 103.13131313131314, + 103.73737373737373, + 102.52525252525251 + ], + [ + 1612.676443041461, + 103.03030303030303, + 103.53535353535352, + 102.52525252525251 + ], + [ + 1616.4042750207354, + 103.03030303030303, + 103.53535353535352, + 102.52525252525251 + ], + [ + 1620.13210700001, + 102.82828282828282, + 103.33333333333331, + 102.3232323232323 + ], + [ + 1623.8599389792844, + 102.82828282828282, + 103.33333333333331, + 102.3232323232323 + ], + [ + 1627.5877709585584, + 102.72727272727272, + 103.33333333333331, + 102.12121212121212 + ], + [ + 1631.3156029378333, + 102.62626262626262, + 103.13131313131314, + 102.12121212121212 + ], + [ + 1635.0434349171073, + 102.62626262626262, + 103.13131313131314, + 102.12121212121212 + ], + [ + 1638.7712668963813, + 102.42424242424241, + 102.92929292929293, + 101.91919191919192 + ], + [ + 1642.4990988756563, + 102.42424242424241, + 102.92929292929293, + 101.91919191919192 + ], + [ + 1646.2269308549303, + 102.3232323232323, + 102.92929292929293, + 101.71717171717171 + ], + [ + 1649.9547628342052, + 102.2222222222222, + 102.72727272727272, + 101.71717171717171 + ], + [ + 1653.6825948134792, + 102.2222222222222, + 102.72727272727272, + 101.71717171717171 + ], + [ + 1657.4104267927532, + 102.02020202020202, + 102.52525252525251, + 101.5151515151515 + ], + [ + 1661.1382587720282, + 102.02020202020202, + 102.52525252525251, + 101.5151515151515 + ], + [ + 1664.8660907513022, + 101.81818181818181, + 102.3232323232323, + 101.3131313131313 + ], + [ + 1668.593922730577, + 101.81818181818181, + 102.3232323232323, + 101.3131313131313 + ], + [ + 1672.3217547098511, + 101.71717171717171, + 102.3232323232323, + 101.11111111111111 + ], + [ + 1676.0495866891251, + 101.6161616161616, + 102.12121212121212, + 101.11111111111111 + ], + [ + 1679.7774186684, + 101.6161616161616, + 102.12121212121212, + 101.11111111111111 + ], + [ + 1683.505250647674, + 101.4141414141414, + 101.91919191919192, + 100.9090909090909 + ], + [ + 1687.233082626949, + 101.4141414141414, + 101.91919191919192, + 100.9090909090909 + ], + [ + 1690.960914606223, + 101.21212121212119, + 101.71717171717171, + 100.7070707070707 + ], + [ + 1694.688746585497, + 101.21212121212119, + 101.71717171717171, + 100.7070707070707 + ], + [ + 1698.416578564772, + 95.25252525252526, + 101.5151515151515, + 87.57575757575756 + ], + [ + 1702.144410544046, + 92.12121212121212, + 101.5151515151515, + 83.93939393939394 + ], + [ + 1705.872242523321, + 90.80808080808083, + 101.5151515151515, + 81.3131313131313 + ], + [ + 1709.600074502595, + 89.59595959595958, + 101.3131313131313, + 79.09090909090907 + ], + [ + 1713.327906481869, + 88.5858585858586, + 101.3131313131313, + 77.27272727272725 + ], + [ + 1717.0557384611438, + 84.74747474747477, + 100.7070707070707, + 75.65656565656565 + ], + [ + 1720.7835704404179, + 79.49494949494948, + 84.94949494949492, + 74.04040404040404 + ], + [ + 1724.5114024196928, + 77.37373737373736, + 82.12121212121212, + 72.62626262626264 + ], + [ + 1728.2392343989668, + 75.65656565656565, + 79.8989898989899, + 71.4141414141414 + ], + [ + 1731.9670663782408, + 74.04040404040404, + 77.87878787878788, + 70.20202020202021 + ], + [ + 1735.6948983575157, + 72.62626262626264, + 76.26262626262627, + 68.98989898989902 + ], + [ + 1739.4227303367898, + 71.3131313131313, + 74.64646464646466, + 67.97979797979798 + ], + [ + 1743.1505623160647, + 70.0, + 73.23232323232321, + 66.76767676767679 + ], + [ + 1746.8783942953387, + 68.78787878787881, + 71.81818181818181, + 65.75757575757575 + ], + [ + 1750.6062262746127, + 67.77777777777777, + 70.60606060606062, + 64.94949494949498 + ], + [ + 1754.3340582538876, + 66.66666666666669, + 69.39393939393938, + 63.93939393939394 + ], + [ + 1758.0618902331616, + 65.75757575757575, + 68.3838383838384, + 63.13131313131311 + ], + [ + 1761.7897222124366, + 64.84848484848487, + 67.37373737373736, + 62.32323232323233 + ], + [ + 1765.5175541917106, + 63.93939393939394, + 66.36363636363637, + 61.5151515151515 + ], + [ + 1769.2453861709846, + 63.03030303030306, + 65.35353535353534, + 60.70707070707073 + ], + [ + 1772.9732181502595, + 62.121212121212125, + 64.34343434343435, + 59.898989898989896 + ], + [ + 1776.7010501295335, + 61.313131313131294, + 63.53535353535352, + 59.09090909090912 + ], + [ + 1780.4288821088085, + 60.60606060606062, + 62.72727272727275, + 58.4848484848485 + ], + [ + 1784.1567140880825, + 59.79797979797979, + 61.91919191919192, + 57.67676767676767 + ], + [ + 1787.8845460673565, + 59.09090909090912, + 61.11111111111114, + 57.0707070707071 + ], + [ + 1791.6123780466314, + 58.383838383838395, + 60.30303030303031, + 56.46464646464648 + ], + [ + 1795.3402100259054, + 57.575757575757564, + 59.49494949494948, + 55.65656565656565 + ], + [ + 1799.0680420051804, + 56.969696969697, + 58.888888888888914, + 55.05050505050508 + ], + [ + 1802.7958739844544, + 56.26262626262627, + 58.08080808080808, + 54.44444444444446 + ], + [ + 1806.5237059637284, + 55.65656565656565, + 57.47474747474746, + 53.838383838383834 + ], + [ + 1810.2515379430033, + 55.05050505050508, + 56.86868686868689, + 53.23232323232321 + ], + [ + 1813.9793699222773, + 54.44444444444446, + 56.06060606060606, + 52.82828282828285 + ], + [ + 1817.7072019015523, + 53.838383838383834, + 55.45454545454544, + 52.22222222222223 + ], + [ + 1821.4350338808263, + 53.23232323232321, + 54.84848484848487, + 51.616161616161605 + ], + [ + 1825.1628658601012, + 52.72727272727275, + 54.24242424242425, + 51.21212121212125 + ], + [ + 1828.8906978393752, + 52.121212121212125, + 53.636363636363626, + 50.60606060606062 + ], + [ + 1832.6185298186492, + 51.616161616161605, + 53.23232323232321, + 50.0 + ], + [ + 1836.3463617979241, + 51.11111111111114, + 52.626262626262644, + 49.595959595959584 + ], + [ + 1840.0741937771982, + 50.60606060606062, + 52.02020202020202, + 49.191919191919226 + ], + [ + 1843.802025756473, + 50.0, + 51.4141414141414, + 48.5858585858586 + ], + [ + 1847.529857735747, + 49.595959595959584, + 51.01010101010104, + 48.18181818181819 + ], + [ + 1851.2576897150211, + 49.09090909090912, + 50.404040404040416, + 47.77777777777777 + ], + [ + 1854.985521694296, + 48.5858585858586, + 50.0, + 47.171717171717205 + ], + [ + 1858.71335367357, + 48.08080808080808, + 49.39393939393938, + 46.76767676767679 + ], + [ + 1862.441185652845, + 47.67676767676767, + 48.98989898989902, + 46.363636363636374 + ], + [ + 1866.169017632119, + 47.27272727272725, + 48.5858585858586, + 45.95959595959596 + ], + [ + 1869.896849611393, + 46.76767676767679, + 47.97979797979798, + 45.55555555555554 + ], + [ + 1873.624681590668, + 46.363636363636374, + 47.575757575757564, + 45.151515151515184 + ], + [ + 1877.352513569942, + 45.95959595959596, + 47.171717171717205, + 44.74747474747477 + ], + [ + 1881.0803455492169, + 45.55555555555554, + 46.76767676767679, + 44.34343434343435 + ], + [ + 1884.808177528491, + 45.05050505050508, + 46.161616161616166, + 43.93939393939394 + ], + [ + 1888.536009507765, + 44.646464646464665, + 45.75757575757575, + 43.53535353535352 + ], + [ + 1892.2638414870398, + 44.24242424242425, + 45.353535353535335, + 43.13131313131316 + ], + [ + 1895.9916734663138, + 43.838383838383834, + 44.94949494949498, + 42.72727272727275 + ], + [ + 1899.7195054455888, + 43.43434343434342, + 44.54545454545456, + 42.32323232323233 + ], + [ + 1903.4473374248628, + 43.03030303030306, + 44.141414141414145, + 41.91919191919192 + ], + [ + 1907.1751694041368, + 42.72727272727275, + 43.73737373737373, + 41.71717171717171 + ], + [ + 1910.9030013834117, + 42.32323232323233, + 43.333333333333314, + 41.31313131313135 + ], + [ + 1914.6308333626857, + 42.02020202020202, + 43.13131313131316, + 40.909090909090935 + ], + [ + 1918.3586653419607, + 41.616161616161605, + 42.72727272727275, + 40.50505050505052 + ], + [ + 1922.0864973212347, + 41.31313131313135, + 42.32323232323233, + 40.30303030303031 + ], + [ + 1925.8143293005087, + 40.909090909090935, + 41.91919191919192, + 39.898989898989896 + ], + [ + 1929.5421612797836, + 40.50505050505052, + 41.5151515151515, + 39.49494949494948 + ], + [ + 1933.2699932590576, + 40.30303030303031, + 41.31313131313135, + 39.29292929292933 + ], + [ + 1936.9978252383326, + 39.898989898989896, + 40.909090909090935, + 38.888888888888914 + ], + [ + 1940.7256572176066, + 39.595959595959584, + 40.50505050505052, + 38.686868686868706 + ], + [ + 1944.4534891968806, + 39.39393939393938, + 40.30303030303031, + 38.4848484848485 + ], + [ + 1948.1813211761555, + 39.09090909090912, + 39.898989898989896, + 38.28282828282829 + ], + [ + 1951.9091531554295, + 38.78787878787881, + 39.69696969696969, + 37.878787878787875 + ], + [ + 1955.6369851347044, + 38.4848484848485, + 39.29292929292933, + 37.67676767676767 + ], + [ + 1959.3648171139785, + 38.28282828282829, + 39.09090909090912, + 37.47474747474746 + ], + [ + 1963.0926490932525, + 38.08080808080808, + 38.888888888888914, + 37.27272727272731 + ], + [ + 1966.8204810725274, + 37.878787878787875, + 38.686868686868706, + 37.0707070707071 + ], + [ + 1970.5483130518014, + 37.575757575757564, + 38.28282828282829, + 36.86868686868689 + ], + [ + 1974.2761450310763, + 37.373737373737356, + 38.08080808080808, + 36.666666666666686 + ], + [ + 1978.0039770103504, + 37.171717171717205, + 37.878787878787875, + 36.46464646464648 + ], + [ + 1981.7318089896244, + 36.969696969697, + 37.67676767676767, + 36.26262626262627 + ], + [ + 1985.4596409688993, + 36.76767676767679, + 37.47474747474746, + 36.06060606060606 + ], + [ + 1989.1874729481733, + 36.56565656565658, + 37.27272727272731, + 35.858585858585855 + ], + [ + 1992.9153049274482, + 36.363636363636374, + 37.0707070707071, + 35.65656565656565 + ], + [ + 1996.6431369067222, + 36.161616161616166, + 36.86868686868689, + 35.45454545454544 + ], + [ + 2000.3709688859963, + 36.06060606060606, + 36.666666666666686, + 35.45454545454544 + ], + [ + 2004.0988008652712, + 35.858585858585855, + 36.46464646464648, + 35.25252525252529 + ], + [ + 2007.8266328445452, + 35.65656565656565, + 36.26262626262627, + 35.05050505050508 + ], + [ + 2011.5544648238201, + 35.55555555555554, + 36.26262626262627, + 34.84848484848487 + ], + [ + 2015.2822968030941, + 35.35353535353539, + 36.06060606060606, + 34.646464646464665 + ], + [ + 2019.0101287823682, + 35.151515151515184, + 35.858585858585855, + 34.44444444444446 + ], + [ + 2022.737960761643, + 35.05050505050508, + 35.65656565656565, + 34.44444444444446 + ], + [ + 2026.465792740917, + 34.84848484848487, + 35.45454545454544, + 34.24242424242425 + ], + [ + 2030.193624720192, + 34.646464646464665, + 35.25252525252529, + 34.04040404040404 + ], + [ + 2033.921456699466, + 34.54545454545456, + 35.25252525252529, + 33.838383838383834 + ], + [ + 2037.64928867874, + 34.44444444444446, + 35.05050505050508, + 33.838383838383834 + ], + [ + 2041.377120658015, + 34.24242424242425, + 34.84848484848487, + 33.636363636363626 + ], + [ + 2045.104952637289, + 34.04040404040404, + 34.646464646464665, + 33.43434343434342 + ], + [ + 2048.832784616564, + 34.04040404040404, + 34.646464646464665, + 33.43434343434342 + ], + [ + 2052.560616595838, + 33.838383838383834, + 34.44444444444446, + 33.23232323232327 + ], + [ + 2056.288448575112, + 33.636363636363626, + 34.24242424242425, + 33.03030303030306 + ], + [ + 2060.016280554387, + 33.53535353535352, + 34.04040404040404, + 33.03030303030306 + ], + [ + 2063.744112533661, + 33.43434343434342, + 34.04040404040404, + 32.82828282828285 + ], + [ + 2067.471944512936, + 33.23232323232327, + 33.838383838383834, + 32.626262626262644 + ], + [ + 2071.19977649221, + 33.13131313131316, + 33.636363636363626, + 32.626262626262644 + ], + [ + 2074.927608471484, + 33.03030303030306, + 33.636363636363626, + 32.424242424242436 + ], + [ + 2078.6554404507588, + 32.82828282828285, + 33.43434343434342, + 32.22222222222223 + ], + [ + 2082.383272430033, + 32.72727272727275, + 33.23232323232327, + 32.22222222222223 + ], + [ + 2086.1111044093077, + 32.626262626262644, + 33.23232323232327, + 32.02020202020202 + ], + [ + 2089.8389363885817, + 32.424242424242436, + 33.03030303030306, + 31.818181818181813 + ], + [ + 2093.5667683678557, + 32.32323232323233, + 32.82828282828285, + 31.818181818181813 + ], + [ + 2097.2946003471307, + 32.22222222222223, + 32.82828282828285, + 31.616161616161605 + ], + [ + 2101.0224323264047, + 32.121212121212125, + 32.626262626262644, + 31.616161616161605 + ], + [ + 2104.7502643056796, + 32.02020202020202, + 32.626262626262644, + 31.414141414141454 + ], + [ + 2108.4780962849536, + 31.818181818181813, + 32.424242424242436, + 31.212121212121247 + ], + [ + 2112.2059282642276, + 31.71717171717171, + 32.22222222222223, + 31.212121212121247 + ], + [ + 2115.9337602435025, + 31.616161616161605, + 32.22222222222223, + 31.01010101010104 + ], + [ + 2119.6615922227766, + 31.5151515151515, + 32.02020202020202, + 31.01010101010104 + ], + [ + 2123.3894242020515, + 31.414141414141454, + 32.02020202020202, + 30.80808080808083 + ], + [ + 2127.1172561813255, + 31.31313131313135, + 31.818181818181813, + 30.80808080808083 + ], + [ + 2130.8450881605995, + 31.212121212121247, + 31.818181818181813, + 30.606060606060623 + ], + [ + 2134.5729201398744, + 31.111111111111143, + 31.616161616161605, + 30.606060606060623 + ], + [ + 2138.3007521191485, + 30.909090909090935, + 31.414141414141454, + 30.404040404040416 + ], + [ + 2142.0285840984234, + 30.80808080808083, + 31.414141414141454, + 30.202020202020208 + ], + [ + 2145.7564160776974, + 30.707070707070727, + 31.212121212121247, + 30.202020202020208 + ], + [ + 2149.4842480569723, + 30.606060606060623, + 31.212121212121247, + 30.0 + ], + [ + 2153.2120800362463, + 30.50505050505052, + 31.01010101010104, + 30.0 + ], + [ + 2156.9399120155203, + 30.404040404040416, + 31.01010101010104, + 29.797979797979792 + ], + [ + 2160.6677439947953, + 30.30303030303031, + 30.80808080808083, + 29.797979797979792 + ], + [ + 2164.3955759740693, + 30.202020202020208, + 30.80808080808083, + 29.595959595959584 + ], + [ + 2168.123407953344, + 30.101010101010104, + 30.606060606060623, + 29.595959595959584 + ], + [ + 2171.8512399326182, + 30.0, + 30.606060606060623, + 29.393939393939434 + ], + [ + 2175.5790719118922, + 29.898989898989896, + 30.404040404040416, + 29.393939393939434 + ], + [ + 2179.306903891167, + 29.797979797979792, + 30.404040404040416, + 29.191919191919226 + ], + [ + 2183.034735870441, + 29.69696969696969, + 30.202020202020208, + 29.191919191919226 + ], + [ + 2186.762567849716, + 29.69696969696969, + 30.202020202020208, + 29.191919191919226 + ], + [ + 2190.49039982899, + 29.49494949494948, + 30.0, + 28.989898989899018 + ], + [ + 2194.218231808264, + 29.49494949494948, + 30.0, + 28.989898989899018 + ], + [ + 2197.946063787539, + 29.29292929292933, + 29.797979797979792, + 28.78787878787881 + ], + [ + 2201.673895766813, + 29.29292929292933, + 29.797979797979792, + 28.78787878787881 + ], + [ + 2205.401727746088, + 29.090909090909122, + 29.595959595959584, + 28.585858585858603 + ], + [ + 2209.129559725362, + 29.090909090909122, + 29.595959595959584, + 28.585858585858603 + ], + [ + 2212.857391704636, + 28.888888888888914, + 29.393939393939434, + 28.383838383838395 + ], + [ + 2216.585223683911, + 28.888888888888914, + 29.393939393939434, + 28.383838383838395 + ], + [ + 2220.313055663185, + 28.78787878787881, + 29.393939393939434, + 28.181818181818187 + ], + [ + 2224.04088764246, + 28.686868686868706, + 29.191919191919226, + 28.181818181818187 + ], + [ + 2227.768719621734, + 28.686868686868706, + 29.191919191919226, + 28.181818181818187 + ], + [ + 2231.496551601008, + 28.4848484848485, + 28.989898989899018, + 27.97979797979798 + ], + [ + 2235.224383580283, + 28.4848484848485, + 28.989898989899018, + 27.97979797979798 + ], + [ + 2238.952215559557, + 28.28282828282829, + 28.78787878787881, + 27.77777777777777 + ], + [ + 2242.680047538832, + 28.28282828282829, + 28.78787878787881, + 27.77777777777777 + ], + [ + 2246.407879518106, + 28.181818181818187, + 28.78787878787881, + 27.575757575757564 + ], + [ + 2250.13571149738, + 28.080808080808083, + 28.585858585858603, + 27.575757575757564 + ], + [ + 2253.8635434766547, + 28.080808080808083, + 28.585858585858603, + 27.575757575757564 + ], + [ + 2257.5913754559288, + 27.878787878787875, + 28.383838383838395, + 27.373737373737413 + ], + [ + 2261.3192074352037, + 27.878787878787875, + 28.383838383838395, + 27.373737373737413 + ], + [ + 2265.0470394144777, + 27.77777777777777, + 28.383838383838395, + 27.171717171717205 + ], + [ + 2268.7748713937517, + 27.676767676767668, + 28.181818181818187, + 27.171717171717205 + ], + [ + 2272.5027033730266, + 27.676767676767668, + 28.181818181818187, + 27.171717171717205 + ], + [ + 2276.2305353523006, + 27.47474747474746, + 27.97979797979798, + 26.969696969696997 + ], + [ + 2279.9583673315756, + 27.47474747474746, + 27.97979797979798, + 26.969696969696997 + ], + [ + 2283.6861993108496, + 27.47474747474746, + 27.97979797979798, + 26.969696969696997 + ], + [ + 2287.4140312901236, + 27.27272727272731, + 27.77777777777777, + 26.76767676767679 + ], + [ + 2291.1418632693985, + 27.27272727272731, + 27.77777777777777, + 26.76767676767679 + ], + [ + 2294.8696952486725, + 27.0707070707071, + 27.575757575757564, + 26.56565656565658 + ], + [ + 2298.5975272279475, + 27.0707070707071, + 27.575757575757564, + 26.56565656565658 + ], + [ + 2302.3253592072215, + 27.0707070707071, + 27.575757575757564, + 26.56565656565658 + ], + [ + 2306.0531911864955, + 26.868686868686893, + 27.373737373737413, + 26.363636363636374 + ], + [ + 2309.7810231657704, + 26.868686868686893, + 27.373737373737413, + 26.363636363636374 + ], + [ + 2313.5088551450444, + 26.868686868686893, + 27.373737373737413, + 26.363636363636374 + ], + [ + 2317.2366871243194, + 26.666666666666686, + 27.171717171717205, + 26.161616161616166 + ], + [ + 2320.9645191035934, + 26.666666666666686, + 27.171717171717205, + 26.161616161616166 + ], + [ + 2324.6923510828674, + 26.666666666666686, + 27.171717171717205, + 26.161616161616166 + ], + [ + 2328.4201830621423, + 26.464646464646478, + 26.969696969696997, + 25.95959595959596 + ], + [ + 2332.1480150414163, + 26.464646464646478, + 26.969696969696997, + 25.95959595959596 + ], + [ + 2335.8758470206913, + 26.464646464646478, + 26.969696969696997, + 25.95959595959596 + ], + [ + 2339.6036789999653, + 26.26262626262627, + 26.76767676767679, + 25.75757575757575 + ], + [ + 2343.3315109792393, + 26.26262626262627, + 26.76767676767679, + 25.75757575757575 + ], + [ + 2347.059342958514, + 26.26262626262627, + 26.76767676767679, + 25.75757575757575 + ], + [ + 2350.787174937788, + 26.060606060606062, + 26.56565656565658, + 25.555555555555543 + ], + [ + 2354.515006917063, + 26.060606060606062, + 26.56565656565658, + 25.555555555555543 + ], + [ + 2358.242838896337, + 26.060606060606062, + 26.56565656565658, + 25.555555555555543 + ], + [ + 2361.970670875611, + 25.858585858585855, + 26.363636363636374, + 25.353535353535392 + ], + [ + 2365.698502854886, + 25.858585858585855, + 26.363636363636374, + 25.353535353535392 + ], + [ + 2369.42633483416, + 25.858585858585855, + 26.363636363636374, + 25.353535353535392 + ], + [ + 2373.154166813435, + 25.656565656565647, + 26.161616161616166, + 25.151515151515184 + ], + [ + 2376.881998792709, + 25.656565656565647, + 26.161616161616166, + 25.151515151515184 + ], + [ + 2380.609830771983, + 25.656565656565647, + 26.161616161616166, + 25.151515151515184 + ], + [ + 2384.337662751258, + 25.454545454545496, + 25.95959595959596, + 24.949494949494976 + ], + [ + 2388.065494730532, + 25.454545454545496, + 25.95959595959596, + 24.949494949494976 + ], + [ + 2391.793326709807, + 25.454545454545496, + 25.95959595959596, + 24.949494949494976 + ], + [ + 2395.521158689081, + 25.353535353535392, + 25.75757575757575, + 24.949494949494976 + ], + [ + 2399.248990668355, + 25.252525252525288, + 25.75757575757575, + 24.74747474747477 + ], + [ + 2402.97682264763, + 25.252525252525288, + 25.75757575757575, + 24.74747474747477 + ], + [ + 2406.704654626904, + 25.252525252525288, + 25.75757575757575, + 24.74747474747477 + ], + [ + 2410.432486606179, + 25.05050505050508, + 25.555555555555543, + 24.54545454545456 + ], + [ + 2414.160318585453, + 25.05050505050508, + 25.555555555555543, + 24.54545454545456 + ], + [ + 2417.888150564727, + 25.05050505050508, + 25.555555555555543, + 24.54545454545456 + ], + [ + 2421.615982544002, + 24.949494949494976, + 25.353535353535392, + 24.54545454545456 + ], + [ + 2425.343814523276, + 24.848484848484873, + 25.353535353535392, + 24.343434343434353 + ], + [ + 2429.0716465025507, + 24.848484848484873, + 25.353535353535392, + 24.343434343434353 + ], + [ + 2432.7994784818247, + 24.848484848484873, + 25.353535353535392, + 24.343434343434353 + ], + [ + 2436.5273104610988, + 24.646464646464665, + 25.151515151515184, + 24.141414141414145 + ], + [ + 2440.2551424403737, + 24.646464646464665, + 25.151515151515184, + 24.141414141414145 + ], + [ + 2443.9829744196477, + 24.646464646464665, + 25.151515151515184, + 24.141414141414145 + ], + [ + 2447.7108063989226, + 24.54545454545456, + 24.949494949494976, + 24.141414141414145 + ], + [ + 2451.4386383781966, + 24.444444444444457, + 24.949494949494976, + 23.939393939393938 + ], + [ + 2455.1664703574706, + 24.444444444444457, + 24.949494949494976, + 23.939393939393938 + ], + [ + 2458.8943023367456, + 24.444444444444457, + 24.949494949494976, + 23.939393939393938 + ], + [ + 2462.6221343160196, + 24.343434343434353, + 24.74747474747477, + 23.939393939393938 + ], + [ + 2466.3499662952945, + 24.24242424242425, + 24.74747474747477, + 23.73737373737373 + ], + [ + 2470.0777982745685, + 24.24242424242425, + 24.74747474747477, + 23.73737373737373 + ], + [ + 2473.8056302538434, + 24.24242424242425, + 24.74747474747477, + 23.73737373737373 + ], + [ + 2477.5334622331175, + 24.141414141414145, + 24.54545454545456, + 23.73737373737373 + ], + [ + 2481.2612942123915, + 24.04040404040404, + 24.54545454545456, + 23.535353535353522 + ], + [ + 2484.9891261916664, + 24.04040404040404, + 24.54545454545456, + 23.535353535353522 + ], + [ + 2488.7169581709404, + 24.04040404040404, + 24.54545454545456, + 23.535353535353522 + ], + [ + 2492.4447901502153, + 23.939393939393938, + 24.343434343434353, + 23.535353535353522 + ], + [ + 2496.1726221294894, + 23.838383838383834, + 24.343434343434353, + 23.33333333333337 + ], + [ + 2499.9004541087634, + 23.838383838383834, + 24.343434343434353, + 23.33333333333337 + ], + [ + 2503.6282860880383, + 23.838383838383834, + 24.343434343434353, + 23.33333333333337 + ], + [ + 2507.3561180673123, + 23.73737373737373, + 24.141414141414145, + 23.33333333333337 + ], + [ + 2511.0839500465872, + 23.636363636363626, + 24.141414141414145, + 23.131313131313163 + ], + [ + 2514.8117820258612, + 23.636363636363626, + 24.141414141414145, + 23.131313131313163 + ], + [ + 2518.5396140051353, + 23.636363636363626, + 24.141414141414145, + 23.131313131313163 + ], + [ + 2522.26744598441, + 23.535353535353522, + 23.939393939393938, + 23.131313131313163 + ], + [ + 2525.995277963684, + 23.434343434343475, + 23.939393939393938, + 22.929292929292956 + ], + [ + 2529.723109942959, + 23.434343434343475, + 23.939393939393938, + 22.929292929292956 + ], + [ + 2533.450941922233, + 23.434343434343475, + 23.939393939393938, + 22.929292929292956 + ], + [ + 2537.178773901507, + 23.434343434343475, + 23.939393939393938, + 22.929292929292956 + ], + [ + 2540.906605880782, + 23.33333333333337, + 23.73737373737373, + 22.929292929292956 + ], + [ + 2544.634437860056, + 23.232323232323267, + 23.73737373737373, + 22.727272727272748 + ], + [ + 2548.362269839331, + 23.232323232323267, + 23.73737373737373, + 22.727272727272748 + ], + [ + 2552.090101818605, + 23.232323232323267, + 23.73737373737373, + 22.727272727272748 + ], + [ + 2555.817933797879, + 23.131313131313163, + 23.535353535353522, + 22.727272727272748 + ], + [ + 2559.545765777154, + 23.131313131313163, + 23.535353535353522, + 22.727272727272748 + ], + [ + 2563.273597756428, + 23.03030303030306, + 23.535353535353522, + 22.52525252525254 + ], + [ + 2567.001429735703, + 23.03030303030306, + 23.535353535353522, + 22.52525252525254 + ], + [ + 2570.729261714977, + 23.03030303030306, + 23.535353535353522, + 22.52525252525254 + ], + [ + 2574.457093694251, + 22.929292929292956, + 23.33333333333337, + 22.52525252525254 + ], + [ + 2578.184925673526, + 22.828282828282852, + 23.33333333333337, + 22.323232323232332 + ], + [ + 2581.9127576528, + 22.828282828282852, + 23.33333333333337, + 22.323232323232332 + ], + [ + 2585.640589632075, + 22.828282828282852, + 23.33333333333337, + 22.323232323232332 + ], + [ + 2589.368421611349, + 22.828282828282852, + 23.33333333333337, + 22.323232323232332 + ], + [ + 2593.096253590623, + 22.727272727272748, + 23.131313131313163, + 22.323232323232332 + ], + [ + 2596.8240855698978, + 22.626262626262644, + 23.131313131313163, + 22.121212121212125 + ], + [ + 2600.551917549172, + 22.626262626262644, + 23.131313131313163, + 22.121212121212125 + ], + [ + 2604.2797495284467, + 22.626262626262644, + 23.131313131313163, + 22.121212121212125 + ], + [ + 2608.0075815077207, + 22.626262626262644, + 23.131313131313163, + 22.121212121212125 + ], + [ + 2611.7354134869947, + 22.52525252525254, + 22.929292929292956, + 22.121212121212125 + ], + [ + 2615.4632454662697, + 22.424242424242436, + 22.929292929292956, + 21.919191919191917 + ], + [ + 2619.1910774455437, + 22.424242424242436, + 22.929292929292956, + 21.919191919191917 + ], + [ + 2622.9189094248186, + 22.424242424242436, + 22.929292929292956, + 21.919191919191917 + ], + [ + 2626.6467414040926, + 22.424242424242436, + 22.929292929292956, + 21.919191919191917 + ], + [ + 2630.3745733833666, + 22.323232323232332, + 22.727272727272748, + 21.919191919191917 + ], + [ + 2634.1024053626415, + 22.323232323232332, + 22.727272727272748, + 21.919191919191917 + ], + [ + 2637.8302373419156, + 22.22222222222223, + 22.727272727272748, + 21.71717171717171 + ], + [ + 2641.5580693211905, + 22.22222222222223, + 22.727272727272748, + 21.71717171717171 + ], + [ + 2645.2859013004645, + 22.22222222222223, + 22.727272727272748, + 21.71717171717171 + ], + [ + 2649.0137332797385, + 22.121212121212125, + 22.52525252525254, + 21.71717171717171 + ], + [ + 2652.7415652590134, + 22.121212121212125, + 22.52525252525254, + 21.71717171717171 + ], + [ + 2656.4693972382875, + 22.121212121212125, + 22.52525252525254, + 21.71717171717171 + ], + [ + 2660.1972292175624, + 22.02020202020202, + 22.52525252525254, + 21.515151515151558 + ], + [ + 2663.9250611968364, + 22.02020202020202, + 22.52525252525254, + 21.515151515151558 + ], + [ + 2667.6528931761104, + 22.02020202020202, + 22.52525252525254, + 21.515151515151558 + ], + [ + 2671.3807251553853, + 21.919191919191917, + 22.323232323232332, + 21.515151515151558 + ], + [ + 2675.1085571346593, + 21.919191919191917, + 22.323232323232332, + 21.515151515151558 + ], + [ + 2678.8363891139343, + 21.818181818181813, + 22.323232323232332, + 21.31313131313135 + ], + [ + 2682.5642210932083, + 21.818181818181813, + 22.323232323232332, + 21.31313131313135 + ], + [ + 2686.2920530724823, + 21.818181818181813, + 22.323232323232332, + 21.31313131313135 + ], + [ + 2690.0198850517572, + 21.818181818181813, + 22.323232323232332, + 21.31313131313135 + ], + [ + 2693.7477170310312, + 21.71717171717171, + 22.121212121212125, + 21.31313131313135 + ], + [ + 2697.475549010306, + 21.71717171717171, + 22.121212121212125, + 21.31313131313135 + ], + [ + 2701.20338098958, + 21.71717171717171, + 22.121212121212125, + 21.31313131313135 + ], + [ + 2704.931212968854, + 21.616161616161605, + 22.121212121212125, + 21.111111111111143 + ], + [ + 2708.659044948129, + 21.616161616161605, + 22.121212121212125, + 21.111111111111143 + ], + [ + 2712.386876927403, + 21.616161616161605, + 22.121212121212125, + 21.111111111111143 + ], + [ + 2716.114708906678, + 21.515151515151558, + 21.919191919191917, + 21.111111111111143 + ], + [ + 2719.842540885952, + 21.515151515151558, + 21.919191919191917, + 21.111111111111143 + ], + [ + 2723.570372865226, + 21.515151515151558, + 21.919191919191917, + 21.111111111111143 + ], + [ + 2727.298204844501, + 21.414141414141454, + 21.919191919191917, + 20.909090909090935 + ], + [ + 2731.026036823775, + 21.414141414141454, + 21.919191919191917, + 20.909090909090935 + ], + [ + 2734.75386880305, + 21.414141414141454, + 21.919191919191917, + 20.909090909090935 + ], + [ + 2738.481700782324, + 21.414141414141454, + 21.919191919191917, + 20.909090909090935 + ], + [ + 2742.209532761598, + 21.31313131313135, + 21.71717171717171, + 20.909090909090935 + ], + [ + 2745.937364740873, + 21.31313131313135, + 21.71717171717171, + 20.909090909090935 + ], + [ + 2749.665196720147, + 21.31313131313135, + 21.71717171717171, + 20.909090909090935 + ], + [ + 2753.393028699422, + 21.212121212121247, + 21.71717171717171, + 20.707070707070727 + ], + [ + 2757.120860678696, + 21.212121212121247, + 21.71717171717171, + 20.707070707070727 + ], + [ + 2760.84869265797, + 21.212121212121247, + 21.71717171717171, + 20.707070707070727 + ], + [ + 2764.576524637245, + 21.212121212121247, + 21.71717171717171, + 20.707070707070727 + ], + [ + 2768.304356616519, + 21.111111111111143, + 21.515151515151558, + 20.707070707070727 + ], + [ + 2772.0321885957937, + 21.111111111111143, + 21.515151515151558, + 20.707070707070727 + ], + [ + 2775.7600205750678, + 21.111111111111143, + 21.515151515151558, + 20.707070707070727 + ], + [ + 2779.4878525543418, + 21.01010101010104, + 21.515151515151558, + 20.50505050505052 + ], + [ + 2783.2156845336167, + 21.01010101010104, + 21.515151515151558, + 20.50505050505052 + ], + [ + 2786.9435165128907, + 21.01010101010104, + 21.515151515151558, + 20.50505050505052 + ], + [ + 2790.6713484921656, + 21.01010101010104, + 21.515151515151558, + 20.50505050505052 + ], + [ + 2794.3991804714396, + 20.909090909090935, + 21.31313131313135, + 20.50505050505052 + ], + [ + 2798.1270124507146, + 20.909090909090935, + 21.31313131313135, + 20.50505050505052 + ], + [ + 2801.8548444299886, + 20.909090909090935, + 21.31313131313135, + 20.50505050505052 + ], + [ + 2805.5826764092626, + 20.909090909090935, + 21.31313131313135, + 20.50505050505052 + ], + [ + 2809.3105083885375, + 20.80808080808083, + 21.31313131313135, + 20.30303030303031 + ], + [ + 2813.0383403678115, + 20.80808080808083, + 21.31313131313135, + 20.30303030303031 + ], + [ + 2816.7661723470865, + 20.80808080808083, + 21.31313131313135, + 20.30303030303031 + ], + [ + 2820.4940043263605, + 20.80808080808083, + 21.31313131313135, + 20.30303030303031 + ], + [ + 2824.2218363056345, + 20.707070707070727, + 21.111111111111143, + 20.30303030303031 + ], + [ + 2827.9496682849094, + 20.707070707070727, + 21.111111111111143, + 20.30303030303031 + ], + [ + 2831.6775002641834, + 20.707070707070727, + 21.111111111111143, + 20.30303030303031 + ], + [ + 2835.4053322434584, + 20.707070707070727, + 21.111111111111143, + 20.30303030303031 + ], + [ + 2839.1331642227324, + 20.707070707070727, + 21.111111111111143, + 20.30303030303031 + ], + [ + 2842.8609962020064, + 20.606060606060623, + 21.111111111111143, + 20.101010101010104 + ], + [ + 2846.5888281812813, + 20.606060606060623, + 21.111111111111143, + 20.101010101010104 + ], + [ + 2850.3166601605553, + 20.606060606060623, + 21.111111111111143, + 20.101010101010104 + ], + [ + 2854.0444921398303, + 20.606060606060623, + 21.111111111111143, + 20.101010101010104 + ], + [ + 2857.7723241191043, + 20.50505050505052, + 20.909090909090935, + 20.101010101010104 + ], + [ + 2861.5001560983783, + 20.50505050505052, + 20.909090909090935, + 20.101010101010104 + ], + [ + 2865.227988077653, + 20.50505050505052, + 20.909090909090935, + 20.101010101010104 + ], + [ + 2868.955820056927, + 20.50505050505052, + 20.909090909090935, + 20.101010101010104 + ], + [ + 2872.683652036202, + 20.50505050505052, + 20.909090909090935, + 20.101010101010104 + ], + [ + 2876.411484015476, + 20.404040404040416, + 20.909090909090935, + 19.898989898989896 + ], + [ + 2880.13931599475, + 20.404040404040416, + 20.909090909090935, + 19.898989898989896 + ], + [ + 2883.867147974025, + 20.404040404040416, + 20.909090909090935, + 19.898989898989896 + ], + [ + 2887.594979953299, + 20.404040404040416, + 20.909090909090935, + 19.898989898989896 + ], + [ + 2891.322811932574, + 20.30303030303031, + 20.707070707070727, + 19.898989898989896 + ], + [ + 2895.050643911848, + 20.30303030303031, + 20.707070707070727, + 19.898989898989896 + ], + [ + 2898.778475891122, + 20.30303030303031, + 20.707070707070727, + 19.898989898989896 + ], + [ + 2902.506307870397, + 20.30303030303031, + 20.707070707070727, + 19.898989898989896 + ], + [ + 2906.234139849671, + 20.30303030303031, + 20.707070707070727, + 19.898989898989896 + ], + [ + 2909.961971828946, + 20.30303030303031, + 20.707070707070727, + 19.898989898989896 + ], + [ + 2913.68980380822, + 20.202020202020208, + 20.707070707070727, + 19.69696969696969 + ], + [ + 2917.417635787494, + 20.202020202020208, + 20.707070707070727, + 19.69696969696969 + ], + [ + 2921.145467766769, + 20.202020202020208, + 20.707070707070727, + 19.69696969696969 + ], + [ + 2924.873299746043, + 20.202020202020208, + 20.707070707070727, + 19.69696969696969 + ], + [ + 2928.601131725318, + 20.101010101010104, + 20.50505050505052, + 19.69696969696969 + ], + [ + 2932.328963704592, + 20.101010101010104, + 20.50505050505052, + 19.69696969696969 + ], + [ + 2936.056795683866, + 20.101010101010104, + 20.50505050505052, + 19.69696969696969 + ], + [ + 2939.784627663141, + 20.101010101010104, + 20.50505050505052, + 19.69696969696969 + ], + [ + 2943.512459642415, + 20.101010101010104, + 20.50505050505052, + 19.69696969696969 + ], + [ + 2947.2402916216897, + 20.101010101010104, + 20.50505050505052, + 19.69696969696969 + ], + [ + 2950.9681236009637, + 20.101010101010104, + 20.50505050505052, + 19.69696969696969 + ], + [ + 2954.6959555802378, + 20.0, + 20.50505050505052, + 19.494949494949537 + ], + [ + 2958.4237875595127, + 20.0, + 20.50505050505052, + 19.494949494949537 + ], + [ + 2962.1516195387867, + 20.0, + 20.50505050505052, + 19.494949494949537 + ], + [ + 2965.8794515180616, + 20.0, + 20.50505050505052, + 19.494949494949537 + ], + [ + 2969.6072834973356, + 20.0, + 20.50505050505052, + 19.494949494949537 + ], + [ + 2973.3351154766096, + 19.898989898989896, + 20.30303030303031, + 19.494949494949537 + ], + [ + 2977.0629474558846, + 19.898989898989896, + 20.30303030303031, + 19.494949494949537 + ], + [ + 2980.7907794351586, + 19.898989898989896, + 20.30303030303031, + 19.494949494949537 + ], + [ + 2984.5186114144335, + 19.898989898989896, + 20.30303030303031, + 19.494949494949537 + ], + [ + 2988.2464433937075, + 19.898989898989896, + 20.30303030303031, + 19.494949494949537 + ], + [ + 2991.9742753729815, + 19.898989898989896, + 20.30303030303031, + 19.494949494949537 + ], + [ + 2995.7021073522565, + 19.898989898989896, + 20.30303030303031, + 19.494949494949537 + ], + [ + 2999.4299393315305, + 19.797979797979792, + 20.30303030303031, + 19.29292929292933 + ], + [ + 3003.1577713108054, + 19.797979797979792, + 20.30303030303031, + 19.29292929292933 + ], + [ + 3006.8856032900794, + 19.797979797979792, + 20.30303030303031, + 19.29292929292933 + ], + [ + 3010.6134352693534, + 19.797979797979792, + 20.30303030303031, + 19.29292929292933 + ], + [ + 3014.3412672486284, + 19.797979797979792, + 20.30303030303031, + 19.29292929292933 + ], + [ + 3018.0690992279024, + 19.797979797979792, + 20.30303030303031, + 19.29292929292933 + ], + [ + 3021.7969312071773, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3025.5247631864513, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3029.2525951657253, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3032.9804271450002, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3036.7082591242743, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3040.436091103549, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3044.163923082823, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3047.891755062097, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3051.619587041372, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3055.347419020646, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3059.075250999921, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3062.803082979195, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3066.530914958469, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3070.258746937744, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3073.986578917018, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3077.714410896293, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3081.442242875567, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3085.170074854841, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3088.897906834116, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3092.62573881339, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3096.353570792665, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3100.081402771939, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3103.809234751214, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3107.537066730488, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3111.264898709762, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3114.9927306890368, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3118.720562668311, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3122.4483946475857, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3126.1762266268597, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3129.9040586061337, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3133.6318905854087, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3137.3597225646827, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3141.0875545439576, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3144.8153865232316, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3148.5432185025056, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3152.2710504817805, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3155.9988824610546, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3159.7267144403295, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3163.4545464196035, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3167.1823783988775, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3170.9102103781524, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3174.6380423574265, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3178.3658743367014, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3182.0937063159754, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3185.8215382952494, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3189.5493702745243, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3193.2772022537984, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3197.0050342330733, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3200.7328662123473, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3204.4606981916213, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3208.1885301708962, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3211.9163621501702, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3215.644194129445, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3219.372026108719, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3223.099858087993, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3226.827690067268, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3230.555522046542, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3234.283354025817, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3238.011186005091, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3241.739017984365, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3245.46684996364, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3249.194681942914, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3252.922513922189, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3256.650345901463, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3260.378177880737, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3264.106009860012, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3267.833841839286, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3271.561673818561, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3275.289505797835, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3279.017337777109, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3282.745169756384, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3286.473001735658, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3290.2008337149327, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3293.9286656942068, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3297.6564976734808, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3301.3843296527557, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3305.1121616320297, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3308.8399936113046, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3312.5678255905787, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3316.2956575698527, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3320.0234895491276, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3323.7513215284016, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3327.4791535076765, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3331.2069854869505, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3334.9348174662246, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3338.6626494454995, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3342.3904814247735, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3346.1183134040484, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3349.8461453833224, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3353.5739773625965, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3357.3018093418714, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3361.0296413211454, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3364.7574733004203, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3368.4853052796943, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3372.2131372589683, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3375.9409692382433, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3379.6688012175173, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3383.396633196792, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3387.124465176066, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3390.8522971553402, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3394.580129134615, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3398.307961113889, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3402.035793093164, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3405.763625072438, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3409.491457051712, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3413.219289030987, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3416.947121010261, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3420.674952989536, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3424.40278496881, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3428.130616948085, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3431.858448927359, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3435.586280906633, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3439.314112885908, + 19.69696969696969, + 20.101010101010104, + 19.29292929292933 + ], + [ + 3443.041944865182, + 19.898989898989896, + 20.50505050505052, + 19.29292929292933 + ], + [ + 3446.769776844457, + 20.202020202020208, + 21.111111111111143, + 19.29292929292933 + ], + [ + 3450.497608823731, + 20.404040404040416, + 21.515151515151558, + 19.29292929292933 + ], + [ + 3454.225440803005, + 20.606060606060623, + 21.919191919191917, + 19.29292929292933 + ], + [ + 3457.95327278228, + 21.01010101010104, + 22.323232323232332, + 19.69696969696969 + ], + [ + 3461.681104761554, + 21.515151515151558, + 22.727272727272748, + 20.30303030303031 + ], + [ + 3465.4089367408287, + 21.818181818181813, + 22.929292929292956, + 20.707070707070727 + ], + [ + 3469.1367687201027, + 22.22222222222223, + 23.33333333333337, + 21.111111111111143 + ], + [ + 3472.8646006993768, + 22.626262626262644, + 23.73737373737373, + 21.515151515151558 + ], + [ + 3476.5924326786517, + 22.929292929292956, + 23.939393939393938, + 21.919191919191917 + ], + [ + 3480.3202646579257, + 23.232323232323267, + 24.141414141414145, + 22.323232323232332 + ], + [ + 3484.0480966372006, + 23.636363636363626, + 24.54545454545456, + 22.727272727272748 + ], + [ + 3487.7759286164746, + 23.838383838383834, + 24.74747474747477, + 22.929292929292956 + ], + [ + 3491.5037605957486, + 24.141414141414145, + 24.949494949494976, + 23.33333333333337 + ], + [ + 3495.2315925750236, + 24.343434343434353, + 25.151515151515184, + 23.535353535353522 + ], + [ + 3498.9594245542976, + 24.444444444444457, + 25.151515151515184, + 23.73737373737373 + ], + [ + 3502.6872565335725, + 24.54545454545456, + 25.151515151515184, + 23.939393939393938 + ], + [ + 3506.4150885128465, + 24.74747474747477, + 25.151515151515184, + 24.343434343434353 + ], + [ + 3510.1429204921205, + 24.848484848484873, + 25.151515151515184, + 24.54545454545456 + ], + [ + 3513.8707524713955, + 24.848484848484873, + 25.151515151515184, + 24.54545454545456 + ], + [ + 3517.5985844506695, + 24.949494949494976, + 25.151515151515184, + 24.74747474747477 + ], + [ + 3521.3264164299444, + 25.05050505050508, + 25.151515151515184, + 24.949494949494976 + ] + ], + "Tc": [ + [ + 50.714843725495484, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 54.442675704769954, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 58.17050768404442, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 61.89833966331844, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 65.62617164259291, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 69.35400362186738, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 73.08183560114185, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 76.80966758041632, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 80.53749955969033, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 84.2653315389648, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 87.99316351823927, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 91.72099549751374, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 95.44882747678821, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 99.17665945606223, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 102.9044914353367, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 106.63232341461116, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 110.36015539388563, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 114.0879873731601, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 117.81581935243412, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 121.54365133170859, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 125.27148331098306, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 128.99931529025753, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 132.727147269532, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 136.454979248806, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 140.18281122808048, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 143.91064320735495, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 147.63847518662942, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 151.3663071659039, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 155.0941391451779, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 158.82197112445238, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 162.54980310372684, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 166.27763508300131, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 170.00546706227578, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 173.73329904155025, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 177.46113102082427, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 181.18896300009874, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 184.9167949793732, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 188.64462695864768, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 192.37245893792215, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 196.10029091719616, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 199.82812289647063, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 203.5559548757451, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 207.28378685501957, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 211.01161883429404, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 214.73945081356806, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 218.46728279284252, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 222.195114772117, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 225.92294675139146, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 229.65077873066593, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 233.37861070993995, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 237.10644268921442, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 240.8342746684889, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 244.56210664776336, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 248.28993862703783, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 252.01777060631184, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 255.7456025855863, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 259.4734345648608, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 263.20126654413525, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 266.9290985234097, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 270.65693050268374, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 274.3847624819582, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 278.1125944612327, + 18.080808080808083, + 18.686868686868706, + 17.474747474747517 + ], + [ + 281.84042644050714, + 18.080808080808083, + 18.686868686868706, + 17.474747474747517 + ], + [ + 285.5682584197816, + 17.878787878787875, + 18.4848484848485, + 17.27272727272731 + ], + [ + 289.29609039905563, + 17.77777777777777, + 18.28282828282829, + 17.27272727272731 + ], + [ + 293.0239223783301, + 17.676767676767668, + 18.28282828282829, + 17.0707070707071 + ], + [ + 296.75175435760457, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 300.47958633687904, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 304.2074183161535, + 17.373737373737413, + 17.878787878787875, + 16.868686868686893 + ], + [ + 307.9352502954275, + 17.373737373737413, + 17.878787878787875, + 16.868686868686893 + ], + [ + 311.663082274702, + 17.373737373737413, + 17.878787878787875, + 16.868686868686893 + ], + [ + 315.39091425397646, + 17.171717171717205, + 17.676767676767668, + 16.666666666666686 + ], + [ + 319.11874623325093, + 17.171717171717205, + 17.676767676767668, + 16.666666666666686 + ], + [ + 322.8465782125254, + 17.171717171717205, + 17.676767676767668, + 16.666666666666686 + ], + [ + 326.57441019179987, + 17.171717171717205, + 17.676767676767668, + 16.666666666666686 + ], + [ + 330.3022421710739, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 334.03007415034836, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 337.7579061296228, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 341.4857381088973, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 345.21357008817176, + 16.868686868686893, + 17.27272727272731, + 16.464646464646478 + ], + [ + 348.9414020674458, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 352.66923404672025, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 356.3970660259947, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 360.1248980052692, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 363.85272998454366, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 367.5805619638177, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 371.30839394309214, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 375.0362259223666, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 378.7640579016411, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 382.49188988091555, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 386.21972186018957, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 389.94755383946404, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 393.6753858187385, + 16.464646464646478, + 16.868686868686893, + 16.060606060606062 + ], + [ + 397.403217798013, + 16.464646464646478, + 16.868686868686893, + 16.060606060606062 + ], + [ + 401.13104977728744, + 16.363636363636374, + 16.868686868686893, + 15.858585858585855 + ], + [ + 404.85888175656146, + 16.363636363636374, + 16.868686868686893, + 15.858585858585855 + ], + [ + 408.58671373583593, + 16.363636363636374, + 16.868686868686893, + 15.858585858585855 + ], + [ + 412.3145457151104, + 16.363636363636374, + 16.868686868686893, + 15.858585858585855 + ], + [ + 416.04237769438487, + 16.363636363636374, + 16.868686868686893, + 15.858585858585855 + ], + [ + 419.77020967365934, + 16.363636363636374, + 16.868686868686893, + 15.858585858585855 + ], + [ + 423.49804165293335, + 16.363636363636374, + 16.868686868686893, + 15.858585858585855 + ], + [ + 427.2258736322078, + 16.363636363636374, + 16.868686868686893, + 15.858585858585855 + ], + [ + 430.9537056114823, + 16.363636363636374, + 16.868686868686893, + 15.858585858585855 + ], + [ + 434.68153759075676, + 16.363636363636374, + 16.868686868686893, + 15.858585858585855 + ], + [ + 438.40936957003123, + 16.363636363636374, + 16.868686868686893, + 15.858585858585855 + ], + [ + 442.13720154930525, + 16.363636363636374, + 16.868686868686893, + 15.858585858585855 + ], + [ + 445.8650335285797, + 16.363636363636374, + 16.868686868686893, + 15.858585858585855 + ], + [ + 449.5928655078542, + 16.363636363636374, + 16.868686868686893, + 15.858585858585855 + ], + [ + 453.32069748712865, + 16.363636363636374, + 16.868686868686893, + 15.858585858585855 + ], + [ + 457.0485294664031, + 16.363636363636374, + 16.868686868686893, + 15.858585858585855 + ], + [ + 460.77636144567714, + 16.363636363636374, + 16.868686868686893, + 15.858585858585855 + ], + [ + 464.5041934249516, + 16.363636363636374, + 16.868686868686893, + 15.858585858585855 + ], + [ + 468.2320254042261, + 16.363636363636374, + 16.868686868686893, + 15.858585858585855 + ], + [ + 471.95985738350055, + 16.363636363636374, + 16.868686868686893, + 15.858585858585855 + ], + [ + 475.687689362775, + 16.363636363636374, + 16.868686868686893, + 15.858585858585855 + ], + [ + 479.4155213420495, + 16.464646464646478, + 16.868686868686893, + 16.060606060606062 + ], + [ + 483.1433533213235, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 486.871185300598, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 490.59901727987244, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 494.3268492591469, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 498.0546812384214, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 501.7825132176954, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 505.51034519696987, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 509.23817717624433, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 512.9660091555188, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 516.6938411347933, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 520.4216731140673, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 524.1495050933418, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 527.8773370726162, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 531.6051690518907, + 17.0707070707071, + 17.676767676767668, + 16.464646464646478 + ], + [ + 535.3330010311652, + 17.171717171717205, + 17.676767676767668, + 16.666666666666686 + ], + [ + 539.0608330104392, + 17.27272727272731, + 17.878787878787875, + 16.666666666666686 + ], + [ + 542.7886649897137, + 17.373737373737413, + 17.878787878787875, + 16.868686868686893 + ], + [ + 546.5164969689881, + 17.474747474747517, + 18.080808080808083, + 16.868686868686893 + ], + [ + 550.2443289482626, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 553.9721609275371, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 557.6999929068111, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 561.4278248860855, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 565.15565686536, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 568.8834888446345, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 572.611320823909, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 576.339152803183, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 580.0669847824574, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 583.7948167617319, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 587.5226487410064, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 591.2504807202808, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 594.9783126995549, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 598.7061446788293, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 602.4339766581038, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 606.1618086373783, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 609.8896406166527, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 613.6174725959268, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 617.3453045752012, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 621.0731365544757, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 624.8009685337502, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 628.5288005130246, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 632.2566324922991, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 635.9844644715731, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 639.7122964508476, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 643.4401284301221, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 647.1679604093965, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 650.895792388671, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 654.623624367945, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 658.3514563472195, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 662.079288326494, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 665.8071203057684, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 669.5349522850429, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 673.2627842643169, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 676.9906162435914, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 680.7184482228658, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 684.4462802021403, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 688.1741121814148, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 691.9019441606888, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 695.6297761399633, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 699.3576081192377, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 703.0854400985122, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 706.8132720777867, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 710.5411040570607, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 714.2689360363352, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 717.9967680156096, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 721.7245999948841, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 725.4524319741586, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 729.1802639534326, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 732.908095932707, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 736.6359279119815, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 740.363759891256, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 744.0915918705305, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 747.8194238498045, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 751.547255829079, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 755.2750878083534, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 759.0029197876279, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 762.7307517669024, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 766.4585837461764, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 770.1864157254508, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 773.9142477047253, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 777.6420796839998, + 17.474747474747517, + 17.878787878787875, + 17.0707070707071 + ], + [ + 781.3699116632743, + 17.474747474747517, + 17.878787878787875, + 17.0707070707071 + ], + [ + 785.0977436425483, + 17.474747474747517, + 17.878787878787875, + 17.0707070707071 + ], + [ + 788.8255756218227, + 17.474747474747517, + 17.878787878787875, + 17.0707070707071 + ], + [ + 792.5534076010972, + 17.474747474747517, + 17.878787878787875, + 17.0707070707071 + ], + [ + 796.2812395803717, + 17.474747474747517, + 17.878787878787875, + 17.0707070707071 + ], + [ + 800.0090715596461, + 17.474747474747517, + 17.878787878787875, + 17.0707070707071 + ], + [ + 803.7369035389206, + 17.474747474747517, + 17.878787878787875, + 17.0707070707071 + ], + [ + 807.4647355181946, + 17.474747474747517, + 17.878787878787875, + 17.0707070707071 + ], + [ + 1295.8107248031388, + 24.24242424242425, + 24.949494949494976, + 23.535353535353522 + ], + [ + 1299.5385567824133, + 23.939393939393938, + 24.74747474747477, + 23.131313131313163 + ], + [ + 1303.2663887616873, + 23.838383838383834, + 24.74747474747477, + 22.929292929292956 + ], + [ + 1306.9942207409617, + 23.535353535353522, + 24.343434343434353, + 22.727272727272748 + ], + [ + 1310.7220527202362, + 23.232323232323267, + 24.141414141414145, + 22.323232323232332 + ], + [ + 1314.4498846995107, + 23.03030303030306, + 23.939393939393938, + 22.121212121212125 + ], + [ + 1318.1777166787851, + 22.727272727272748, + 23.535353535353522, + 21.919191919191917 + ], + [ + 1321.9055486580592, + 22.52525252525254, + 23.33333333333337, + 21.71717171717171 + ], + [ + 1325.6333806373336, + 22.323232323232332, + 23.131313131313163, + 21.515151515151558 + ], + [ + 1329.361212616608, + 22.121212121212125, + 22.929292929292956, + 21.31313131313135 + ], + [ + 1333.0890445958826, + 21.818181818181813, + 22.52525252525254, + 21.111111111111143 + ], + [ + 1336.816876575157, + 21.616161616161605, + 22.323232323232332, + 20.909090909090935 + ], + [ + 1340.544708554431, + 21.414141414141454, + 22.121212121212125, + 20.707070707070727 + ], + [ + 1344.2725405337055, + 21.212121212121247, + 21.919191919191917, + 20.50505050505052 + ], + [ + 1348.00037251298, + 21.111111111111143, + 21.71717171717171, + 20.50505050505052 + ], + [ + 1351.7282044922545, + 21.01010101010104, + 21.71717171717171, + 20.30303030303031 + ], + [ + 1355.456036471529, + 20.80808080808083, + 21.515151515151558, + 20.101010101010104 + ], + [ + 1359.183868450803, + 20.606060606060623, + 21.31313131313135, + 19.898989898989896 + ], + [ + 1362.9117004300774, + 20.50505050505052, + 21.111111111111143, + 19.898989898989896 + ], + [ + 1366.639532409352, + 20.30303030303031, + 20.909090909090935, + 19.69696969696969 + ], + [ + 1370.3673643886264, + 20.101010101010104, + 20.707070707070727, + 19.494949494949537 + ], + [ + 1374.0951963679008, + 20.101010101010104, + 20.707070707070727, + 19.494949494949537 + ], + [ + 1377.8230283471748, + 19.898989898989896, + 20.50505050505052, + 19.29292929292933 + ], + [ + 1381.5508603264493, + 19.69696969696969, + 20.30303030303031, + 19.090909090909122 + ], + [ + 1385.2786923057238, + 19.69696969696969, + 20.30303030303031, + 19.090909090909122 + ], + [ + 1389.0065242849982, + 19.494949494949537, + 20.101010101010104, + 18.888888888888914 + ], + [ + 1392.7343562642727, + 19.393939393939434, + 19.898989898989896, + 18.888888888888914 + ], + [ + 1396.4621882435467, + 19.29292929292933, + 19.898989898989896, + 18.686868686868706 + ], + [ + 1400.1900202228212, + 19.191919191919226, + 19.69696969696969, + 18.686868686868706 + ], + [ + 1403.9178522020957, + 19.090909090909122, + 19.69696969696969, + 18.4848484848485 + ], + [ + 1407.6456841813701, + 18.989898989899018, + 19.494949494949537, + 18.4848484848485 + ], + [ + 1411.3735161606446, + 18.888888888888914, + 19.494949494949537, + 18.28282828282829 + ], + [ + 1415.1013481399186, + 18.78787878787881, + 19.29292929292933, + 18.28282828282829 + ], + [ + 1418.829180119193, + 18.686868686868706, + 19.29292929292933, + 18.080808080808083 + ], + [ + 1422.5570120984676, + 18.585858585858603, + 19.090909090909122, + 18.080808080808083 + ], + [ + 1426.284844077742, + 18.585858585858603, + 19.090909090909122, + 18.080808080808083 + ], + [ + 1430.0126760570165, + 18.383838383838395, + 18.888888888888914, + 17.878787878787875 + ], + [ + 1433.740508036291, + 18.383838383838395, + 18.888888888888914, + 17.878787878787875 + ], + [ + 1437.468340015565, + 18.383838383838395, + 18.888888888888914, + 17.878787878787875 + ], + [ + 1441.1961719948395, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 1444.924003974114, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 1448.6518359533884, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 1452.3796679326629, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 1456.1074999119369, + 18.080808080808083, + 18.4848484848485, + 17.676767676767668 + ], + [ + 1459.8353318912114, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1463.5631638704858, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1467.2909958497603, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1471.0188278290348, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1474.7466598083088, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1478.4744917875832, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1482.2023237668577, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1485.9301557461322, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1489.6579877254067, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1493.3858197046807, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1497.1136516839551, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1500.8414836632296, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1504.569315642504, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1508.2971476217785, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1512.0249796010526, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1515.752811580327, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1519.4806435596015, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1523.208475538876, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1526.9363075181504, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1530.6641394974245, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1534.391971476699, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1538.1198034559734, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1541.8476354352479, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1545.5754674145223, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1549.3032993937964, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1553.0311313730708, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1556.7589633523453, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1560.4867953316198, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1564.2146273108942, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1567.9424592901682, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1571.6702912694427, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1575.3981232487172, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1579.1259552279917, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1582.8537872072661, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1586.5816191865406, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1590.3094511658146, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1594.037283145089, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1597.7651151243635, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1601.492947103638, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1605.2207790829125, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1608.9486110621865, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1612.676443041461, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1616.4042750207354, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1620.13210700001, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1623.8599389792844, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1627.5877709585584, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1631.3156029378333, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1635.0434349171073, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1638.7712668963813, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1642.4990988756563, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1646.2269308549303, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1649.9547628342052, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1653.6825948134792, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1657.4104267927532, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1661.1382587720282, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1664.8660907513022, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1668.593922730577, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1672.3217547098511, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1676.0495866891251, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1679.7774186684, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1683.505250647674, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1687.233082626949, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1690.960914606223, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1694.688746585497, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1698.416578564772, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1702.144410544046, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1705.872242523321, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 1709.600074502595, + 18.181818181818187, + 18.888888888888914, + 17.474747474747517 + ], + [ + 1713.327906481869, + 18.585858585858603, + 19.494949494949537, + 17.676767676767668 + ], + [ + 1717.0557384611438, + 18.989898989899018, + 20.30303030303031, + 17.676767676767668 + ], + [ + 1720.7835704404179, + 19.595959595959584, + 21.31313131313135, + 17.878787878787875 + ], + [ + 1724.5114024196928, + 20.202020202020208, + 22.323232323232332, + 18.080808080808083 + ], + [ + 1728.2392343989668, + 20.80808080808083, + 23.131313131313163, + 18.4848484848485 + ], + [ + 1731.9670663782408, + 21.515151515151558, + 23.939393939393938, + 19.090909090909122 + ], + [ + 1735.6948983575157, + 22.02020202020202, + 24.343434343434353, + 19.69696969696969 + ], + [ + 1739.4227303367898, + 22.727272727272748, + 24.949494949494976, + 20.50505050505052 + ], + [ + 1743.1505623160647, + 23.434343434343475, + 25.353535353535392, + 21.515151515151558 + ], + [ + 1746.8783942953387, + 24.141414141414145, + 25.75757575757575, + 22.52525252525254 + ], + [ + 1750.6062262746127, + 24.646464646464665, + 25.95959595959596, + 23.33333333333337 + ], + [ + 1754.3340582538876, + 25.05050505050508, + 26.161616161616166, + 23.939393939393938 + ], + [ + 1758.0618902331616, + 25.454545454545496, + 26.363636363636374, + 24.54545454545456 + ], + [ + 1761.7897222124366, + 25.75757575757575, + 26.56565656565658, + 24.949494949494976 + ], + [ + 1765.5175541917106, + 25.95959595959596, + 26.76767676767679, + 25.151515151515184 + ], + [ + 1769.2453861709846, + 26.161616161616166, + 26.76767676767679, + 25.555555555555543 + ], + [ + 1772.9732181502595, + 26.363636363636374, + 26.969696969696997, + 25.75757575757575 + ], + [ + 1776.7010501295335, + 26.464646464646478, + 26.969696969696997, + 25.95959595959596 + ], + [ + 1780.4288821088085, + 26.464646464646478, + 26.969696969696997, + 25.95959595959596 + ], + [ + 1784.1567140880825, + 26.666666666666686, + 27.171717171717205, + 26.161616161616166 + ], + [ + 1787.8845460673565, + 26.666666666666686, + 27.171717171717205, + 26.161616161616166 + ], + [ + 1791.6123780466314, + 26.666666666666686, + 27.171717171717205, + 26.161616161616166 + ], + [ + 1795.3402100259054, + 26.666666666666686, + 27.171717171717205, + 26.161616161616166 + ], + [ + 1799.0680420051804, + 26.666666666666686, + 27.171717171717205, + 26.161616161616166 + ], + [ + 1802.7958739844544, + 26.464646464646478, + 26.969696969696997, + 25.95959595959596 + ], + [ + 1806.5237059637284, + 26.464646464646478, + 26.969696969696997, + 25.95959595959596 + ], + [ + 1810.2515379430033, + 26.464646464646478, + 26.969696969696997, + 25.95959595959596 + ], + [ + 1813.9793699222773, + 26.363636363636374, + 26.969696969696997, + 25.75757575757575 + ], + [ + 1817.7072019015523, + 26.26262626262627, + 26.969696969696997, + 25.555555555555543 + ], + [ + 1821.4350338808263, + 26.161616161616166, + 26.76767676767679, + 25.555555555555543 + ], + [ + 1825.1628658601012, + 25.95959595959596, + 26.56565656565658, + 25.353535353535392 + ], + [ + 1828.8906978393752, + 25.858585858585855, + 26.56565656565658, + 25.151515151515184 + ], + [ + 1832.6185298186492, + 25.75757575757575, + 26.363636363636374, + 25.151515151515184 + ], + [ + 1836.3463617979241, + 25.555555555555543, + 26.161616161616166, + 24.949494949494976 + ], + [ + 1840.0741937771982, + 25.454545454545496, + 26.161616161616166, + 24.74747474747477 + ], + [ + 1843.802025756473, + 25.353535353535392, + 25.95959595959596, + 24.74747474747477 + ], + [ + 1847.529857735747, + 25.151515151515184, + 25.75757575757575, + 24.54545454545456 + ], + [ + 1851.2576897150211, + 25.151515151515184, + 25.75757575757575, + 24.54545454545456 + ], + [ + 1854.985521694296, + 24.949494949494976, + 25.555555555555543, + 24.343434343434353 + ], + [ + 1858.71335367357, + 24.848484848484873, + 25.353535353535392, + 24.343434343434353 + ], + [ + 1862.441185652845, + 24.74747474747477, + 25.353535353535392, + 24.141414141414145 + ], + [ + 1866.169017632119, + 24.54545454545456, + 25.151515151515184, + 23.939393939393938 + ], + [ + 1869.896849611393, + 24.54545454545456, + 25.151515151515184, + 23.939393939393938 + ], + [ + 1873.624681590668, + 24.343434343434353, + 24.949494949494976, + 23.73737373737373 + ], + [ + 1877.352513569942, + 24.24242424242425, + 24.74747474747477, + 23.73737373737373 + ], + [ + 1881.0803455492169, + 24.141414141414145, + 24.74747474747477, + 23.535353535353522 + ], + [ + 1884.808177528491, + 24.04040404040404, + 24.54545454545456, + 23.535353535353522 + ], + [ + 1888.536009507765, + 23.939393939393938, + 24.54545454545456, + 23.33333333333337 + ], + [ + 1892.2638414870398, + 23.838383838383834, + 24.343434343434353, + 23.33333333333337 + ], + [ + 1895.9916734663138, + 23.73737373737373, + 24.343434343434353, + 23.131313131313163 + ], + [ + 1899.7195054455888, + 23.636363636363626, + 24.141414141414145, + 23.131313131313163 + ], + [ + 1903.4473374248628, + 23.535353535353522, + 24.141414141414145, + 22.929292929292956 + ], + [ + 1907.1751694041368, + 23.434343434343475, + 23.939393939393938, + 22.929292929292956 + ], + [ + 1910.9030013834117, + 23.33333333333337, + 23.939393939393938, + 22.727272727272748 + ], + [ + 1914.6308333626857, + 23.232323232323267, + 23.73737373737373, + 22.727272727272748 + ], + [ + 1918.3586653419607, + 23.131313131313163, + 23.73737373737373, + 22.52525252525254 + ], + [ + 1922.0864973212347, + 23.03030303030306, + 23.535353535353522, + 22.52525252525254 + ], + [ + 1925.8143293005087, + 22.929292929292956, + 23.535353535353522, + 22.323232323232332 + ], + [ + 1929.5421612797836, + 22.828282828282852, + 23.33333333333337, + 22.323232323232332 + ], + [ + 1933.2699932590576, + 22.828282828282852, + 23.33333333333337, + 22.323232323232332 + ], + [ + 1936.9978252383326, + 22.626262626262644, + 23.131313131313163, + 22.121212121212125 + ], + [ + 1940.7256572176066, + 22.626262626262644, + 23.131313131313163, + 22.121212121212125 + ], + [ + 1944.4534891968806, + 22.52525252525254, + 23.131313131313163, + 21.919191919191917 + ], + [ + 1948.1813211761555, + 22.424242424242436, + 22.929292929292956, + 21.919191919191917 + ], + [ + 1951.9091531554295, + 22.323232323232332, + 22.929292929292956, + 21.71717171717171 + ], + [ + 1955.6369851347044, + 22.22222222222223, + 22.727272727272748, + 21.71717171717171 + ], + [ + 1959.3648171139785, + 22.22222222222223, + 22.727272727272748, + 21.71717171717171 + ], + [ + 1963.0926490932525, + 22.121212121212125, + 22.727272727272748, + 21.515151515151558 + ], + [ + 1966.8204810725274, + 22.02020202020202, + 22.52525252525254, + 21.515151515151558 + ], + [ + 1970.5483130518014, + 21.919191919191917, + 22.52525252525254, + 21.31313131313135 + ], + [ + 1974.2761450310763, + 21.818181818181813, + 22.323232323232332, + 21.31313131313135 + ], + [ + 1978.0039770103504, + 21.818181818181813, + 22.323232323232332, + 21.31313131313135 + ], + [ + 1981.7318089896244, + 21.71717171717171, + 22.323232323232332, + 21.111111111111143 + ], + [ + 1985.4596409688993, + 21.616161616161605, + 22.121212121212125, + 21.111111111111143 + ], + [ + 1989.1874729481733, + 21.616161616161605, + 22.121212121212125, + 21.111111111111143 + ], + [ + 1992.9153049274482, + 21.414141414141454, + 21.919191919191917, + 20.909090909090935 + ], + [ + 1996.6431369067222, + 21.414141414141454, + 21.919191919191917, + 20.909090909090935 + ], + [ + 2000.3709688859963, + 21.414141414141454, + 21.919191919191917, + 20.909090909090935 + ], + [ + 2004.0988008652712, + 21.212121212121247, + 21.71717171717171, + 20.707070707070727 + ], + [ + 2007.8266328445452, + 21.212121212121247, + 21.71717171717171, + 20.707070707070727 + ], + [ + 2011.5544648238201, + 21.212121212121247, + 21.71717171717171, + 20.707070707070727 + ], + [ + 2015.2822968030941, + 21.01010101010104, + 21.515151515151558, + 20.50505050505052 + ], + [ + 2019.0101287823682, + 21.01010101010104, + 21.515151515151558, + 20.50505050505052 + ], + [ + 2022.737960761643, + 21.01010101010104, + 21.515151515151558, + 20.50505050505052 + ], + [ + 2026.465792740917, + 20.80808080808083, + 21.31313131313135, + 20.30303030303031 + ], + [ + 2030.193624720192, + 20.80808080808083, + 21.31313131313135, + 20.30303030303031 + ], + [ + 2033.921456699466, + 20.80808080808083, + 21.31313131313135, + 20.30303030303031 + ], + [ + 2037.64928867874, + 20.707070707070727, + 21.31313131313135, + 20.101010101010104 + ], + [ + 2041.377120658015, + 20.606060606060623, + 21.111111111111143, + 20.101010101010104 + ], + [ + 2045.104952637289, + 20.606060606060623, + 21.111111111111143, + 20.101010101010104 + ], + [ + 2048.832784616564, + 20.606060606060623, + 21.111111111111143, + 20.101010101010104 + ], + [ + 2052.560616595838, + 20.404040404040416, + 20.909090909090935, + 19.898989898989896 + ], + [ + 2056.288448575112, + 20.404040404040416, + 20.909090909090935, + 19.898989898989896 + ], + [ + 2060.016280554387, + 20.404040404040416, + 20.909090909090935, + 19.898989898989896 + ], + [ + 2063.744112533661, + 20.404040404040416, + 20.909090909090935, + 19.898989898989896 + ], + [ + 2067.471944512936, + 20.202020202020208, + 20.707070707070727, + 19.69696969696969 + ], + [ + 2071.19977649221, + 20.202020202020208, + 20.707070707070727, + 19.69696969696969 + ], + [ + 2074.927608471484, + 20.202020202020208, + 20.707070707070727, + 19.69696969696969 + ], + [ + 2078.6554404507588, + 20.202020202020208, + 20.707070707070727, + 19.69696969696969 + ], + [ + 2082.383272430033, + 20.0, + 20.50505050505052, + 19.494949494949537 + ], + [ + 2086.1111044093077, + 20.0, + 20.50505050505052, + 19.494949494949537 + ], + [ + 2089.8389363885817, + 20.0, + 20.50505050505052, + 19.494949494949537 + ], + [ + 2093.5667683678557, + 20.0, + 20.50505050505052, + 19.494949494949537 + ], + [ + 2097.2946003471307, + 19.797979797979792, + 20.30303030303031, + 19.29292929292933 + ], + [ + 2101.0224323264047, + 19.797979797979792, + 20.30303030303031, + 19.29292929292933 + ], + [ + 2104.7502643056796, + 19.797979797979792, + 20.30303030303031, + 19.29292929292933 + ], + [ + 2108.4780962849536, + 19.797979797979792, + 20.30303030303031, + 19.29292929292933 + ], + [ + 2112.2059282642276, + 19.797979797979792, + 20.30303030303031, + 19.29292929292933 + ], + [ + 2115.9337602435025, + 19.595959595959584, + 20.101010101010104, + 19.090909090909122 + ], + [ + 2119.6615922227766, + 19.595959595959584, + 20.101010101010104, + 19.090909090909122 + ], + [ + 2123.3894242020515, + 19.595959595959584, + 20.101010101010104, + 19.090909090909122 + ], + [ + 2127.1172561813255, + 19.595959595959584, + 20.101010101010104, + 19.090909090909122 + ], + [ + 2130.8450881605995, + 19.595959595959584, + 20.101010101010104, + 19.090909090909122 + ], + [ + 2134.5729201398744, + 19.393939393939434, + 19.898989898989896, + 18.888888888888914 + ], + [ + 2138.3007521191485, + 19.393939393939434, + 19.898989898989896, + 18.888888888888914 + ], + [ + 2142.0285840984234, + 19.393939393939434, + 19.898989898989896, + 18.888888888888914 + ], + [ + 2145.7564160776974, + 19.393939393939434, + 19.898989898989896, + 18.888888888888914 + ], + [ + 2149.4842480569723, + 19.393939393939434, + 19.898989898989896, + 18.888888888888914 + ], + [ + 2153.2120800362463, + 19.393939393939434, + 19.898989898989896, + 18.888888888888914 + ], + [ + 2156.9399120155203, + 19.29292929292933, + 19.69696969696969, + 18.888888888888914 + ], + [ + 2160.6677439947953, + 19.191919191919226, + 19.69696969696969, + 18.686868686868706 + ], + [ + 2164.3955759740693, + 19.191919191919226, + 19.69696969696969, + 18.686868686868706 + ], + [ + 2168.123407953344, + 19.191919191919226, + 19.69696969696969, + 18.686868686868706 + ], + [ + 2171.8512399326182, + 19.191919191919226, + 19.69696969696969, + 18.686868686868706 + ], + [ + 2175.5790719118922, + 19.191919191919226, + 19.69696969696969, + 18.686868686868706 + ], + [ + 2179.306903891167, + 19.191919191919226, + 19.69696969696969, + 18.686868686868706 + ], + [ + 2183.034735870441, + 19.090909090909122, + 19.494949494949537, + 18.686868686868706 + ], + [ + 2186.762567849716, + 18.989898989899018, + 19.494949494949537, + 18.4848484848485 + ], + [ + 2190.49039982899, + 18.989898989899018, + 19.494949494949537, + 18.4848484848485 + ], + [ + 2194.218231808264, + 18.989898989899018, + 19.494949494949537, + 18.4848484848485 + ], + [ + 2197.946063787539, + 18.989898989899018, + 19.494949494949537, + 18.4848484848485 + ], + [ + 2201.673895766813, + 18.989898989899018, + 19.494949494949537, + 18.4848484848485 + ], + [ + 2205.401727746088, + 18.989898989899018, + 19.494949494949537, + 18.4848484848485 + ], + [ + 2209.129559725362, + 18.989898989899018, + 19.494949494949537, + 18.4848484848485 + ], + [ + 2212.857391704636, + 18.989898989899018, + 19.494949494949537, + 18.4848484848485 + ], + [ + 2216.585223683911, + 18.888888888888914, + 19.29292929292933, + 18.4848484848485 + ], + [ + 2220.313055663185, + 18.78787878787881, + 19.29292929292933, + 18.28282828282829 + ], + [ + 2224.04088764246, + 18.78787878787881, + 19.29292929292933, + 18.28282828282829 + ], + [ + 2227.768719621734, + 18.78787878787881, + 19.29292929292933, + 18.28282828282829 + ], + [ + 2231.496551601008, + 18.78787878787881, + 19.29292929292933, + 18.28282828282829 + ], + [ + 2235.224383580283, + 18.78787878787881, + 19.29292929292933, + 18.28282828282829 + ], + [ + 2238.952215559557, + 18.78787878787881, + 19.29292929292933, + 18.28282828282829 + ], + [ + 2242.680047538832, + 18.78787878787881, + 19.29292929292933, + 18.28282828282829 + ], + [ + 2246.407879518106, + 18.78787878787881, + 19.29292929292933, + 18.28282828282829 + ], + [ + 2250.13571149738, + 18.78787878787881, + 19.29292929292933, + 18.28282828282829 + ], + [ + 2253.8635434766547, + 18.686868686868706, + 19.090909090909122, + 18.28282828282829 + ], + [ + 2257.5913754559288, + 18.585858585858603, + 19.090909090909122, + 18.080808080808083 + ], + [ + 2261.3192074352037, + 18.585858585858603, + 19.090909090909122, + 18.080808080808083 + ], + [ + 2265.0470394144777, + 18.585858585858603, + 19.090909090909122, + 18.080808080808083 + ], + [ + 2268.7748713937517, + 18.585858585858603, + 19.090909090909122, + 18.080808080808083 + ], + [ + 2272.5027033730266, + 18.585858585858603, + 19.090909090909122, + 18.080808080808083 + ], + [ + 2276.2305353523006, + 18.585858585858603, + 19.090909090909122, + 18.080808080808083 + ], + [ + 2279.9583673315756, + 18.585858585858603, + 19.090909090909122, + 18.080808080808083 + ], + [ + 2283.6861993108496, + 18.585858585858603, + 19.090909090909122, + 18.080808080808083 + ], + [ + 2287.4140312901236, + 18.585858585858603, + 19.090909090909122, + 18.080808080808083 + ], + [ + 2291.1418632693985, + 18.4848484848485, + 18.888888888888914, + 18.080808080808083 + ], + [ + 2294.8696952486725, + 18.4848484848485, + 18.888888888888914, + 18.080808080808083 + ], + [ + 2298.5975272279475, + 18.383838383838395, + 18.888888888888914, + 17.878787878787875 + ], + [ + 2302.3253592072215, + 18.383838383838395, + 18.888888888888914, + 17.878787878787875 + ], + [ + 2306.0531911864955, + 18.383838383838395, + 18.888888888888914, + 17.878787878787875 + ], + [ + 2309.7810231657704, + 18.383838383838395, + 18.888888888888914, + 17.878787878787875 + ], + [ + 2313.5088551450444, + 18.383838383838395, + 18.888888888888914, + 17.878787878787875 + ], + [ + 2317.2366871243194, + 18.383838383838395, + 18.888888888888914, + 17.878787878787875 + ], + [ + 2320.9645191035934, + 18.383838383838395, + 18.888888888888914, + 17.878787878787875 + ], + [ + 2324.6923510828674, + 18.383838383838395, + 18.888888888888914, + 17.878787878787875 + ], + [ + 2328.4201830621423, + 18.383838383838395, + 18.888888888888914, + 17.878787878787875 + ], + [ + 2332.1480150414163, + 18.28282828282829, + 18.686868686868706, + 17.878787878787875 + ], + [ + 2335.8758470206913, + 18.28282828282829, + 18.686868686868706, + 17.878787878787875 + ], + [ + 2339.6036789999653, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 2343.3315109792393, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 2347.059342958514, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 2350.787174937788, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 2354.515006917063, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 2358.242838896337, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 2361.970670875611, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 2365.698502854886, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 2369.42633483416, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 2373.154166813435, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 2376.881998792709, + 18.181818181818187, + 18.686868686868706, + 17.676767676767668 + ], + [ + 2380.609830771983, + 18.080808080808083, + 18.4848484848485, + 17.676767676767668 + ], + [ + 2384.337662751258, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 2388.065494730532, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 2391.793326709807, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 2395.521158689081, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 2399.248990668355, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 2402.97682264763, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 2406.704654626904, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 2410.432486606179, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 2414.160318585453, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 2417.888150564727, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 2421.615982544002, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 2425.343814523276, + 17.97979797979798, + 18.4848484848485, + 17.474747474747517 + ], + [ + 2429.0716465025507, + 17.878787878787875, + 18.28282828282829, + 17.474747474747517 + ], + [ + 2432.7994784818247, + 17.878787878787875, + 18.28282828282829, + 17.474747474747517 + ], + [ + 2436.5273104610988, + 17.77777777777777, + 18.28282828282829, + 17.27272727272731 + ], + [ + 2440.2551424403737, + 17.77777777777777, + 18.28282828282829, + 17.27272727272731 + ], + [ + 2443.9829744196477, + 17.77777777777777, + 18.28282828282829, + 17.27272727272731 + ], + [ + 2447.7108063989226, + 17.77777777777777, + 18.28282828282829, + 17.27272727272731 + ], + [ + 2451.4386383781966, + 17.77777777777777, + 18.28282828282829, + 17.27272727272731 + ], + [ + 2455.1664703574706, + 17.77777777777777, + 18.28282828282829, + 17.27272727272731 + ], + [ + 2458.8943023367456, + 17.77777777777777, + 18.28282828282829, + 17.27272727272731 + ], + [ + 2462.6221343160196, + 17.77777777777777, + 18.28282828282829, + 17.27272727272731 + ], + [ + 2466.3499662952945, + 17.77777777777777, + 18.28282828282829, + 17.27272727272731 + ], + [ + 2470.0777982745685, + 17.77777777777777, + 18.28282828282829, + 17.27272727272731 + ], + [ + 2473.8056302538434, + 17.77777777777777, + 18.28282828282829, + 17.27272727272731 + ], + [ + 2477.5334622331175, + 17.77777777777777, + 18.28282828282829, + 17.27272727272731 + ], + [ + 2481.2612942123915, + 17.676767676767668, + 18.080808080808083, + 17.27272727272731 + ], + [ + 2484.9891261916664, + 17.676767676767668, + 18.080808080808083, + 17.27272727272731 + ], + [ + 2488.7169581709404, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 2492.4447901502153, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 2496.1726221294894, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 2499.9004541087634, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 2503.6282860880383, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 2507.3561180673123, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 2511.0839500465872, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 2514.8117820258612, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 2518.5396140051353, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 2522.26744598441, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 2525.995277963684, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 2529.723109942959, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 2533.450941922233, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 2537.178773901507, + 17.575757575757564, + 18.080808080808083, + 17.0707070707071 + ], + [ + 2540.906605880782, + 17.474747474747517, + 17.878787878787875, + 17.0707070707071 + ], + [ + 2544.634437860056, + 17.474747474747517, + 17.878787878787875, + 17.0707070707071 + ], + [ + 2548.362269839331, + 17.373737373737413, + 17.878787878787875, + 16.868686868686893 + ], + [ + 2552.090101818605, + 17.373737373737413, + 17.878787878787875, + 16.868686868686893 + ], + [ + 2555.817933797879, + 17.373737373737413, + 17.878787878787875, + 16.868686868686893 + ], + [ + 2559.545765777154, + 17.373737373737413, + 17.878787878787875, + 16.868686868686893 + ], + [ + 2563.273597756428, + 17.373737373737413, + 17.878787878787875, + 16.868686868686893 + ], + [ + 2567.001429735703, + 17.373737373737413, + 17.878787878787875, + 16.868686868686893 + ], + [ + 2570.729261714977, + 17.373737373737413, + 17.878787878787875, + 16.868686868686893 + ], + [ + 2574.457093694251, + 17.373737373737413, + 17.878787878787875, + 16.868686868686893 + ], + [ + 2578.184925673526, + 17.373737373737413, + 17.878787878787875, + 16.868686868686893 + ], + [ + 2581.9127576528, + 17.373737373737413, + 17.878787878787875, + 16.868686868686893 + ], + [ + 2585.640589632075, + 17.373737373737413, + 17.878787878787875, + 16.868686868686893 + ], + [ + 2589.368421611349, + 17.373737373737413, + 17.878787878787875, + 16.868686868686893 + ], + [ + 2593.096253590623, + 17.373737373737413, + 17.878787878787875, + 16.868686868686893 + ], + [ + 2596.8240855698978, + 17.373737373737413, + 17.878787878787875, + 16.868686868686893 + ], + [ + 2600.551917549172, + 17.373737373737413, + 17.878787878787875, + 16.868686868686893 + ], + [ + 2604.2797495284467, + 17.27272727272731, + 17.676767676767668, + 16.868686868686893 + ], + [ + 2608.0075815077207, + 17.27272727272731, + 17.676767676767668, + 16.868686868686893 + ], + [ + 2611.7354134869947, + 17.27272727272731, + 17.676767676767668, + 16.868686868686893 + ], + [ + 2615.4632454662697, + 17.171717171717205, + 17.676767676767668, + 16.666666666666686 + ], + [ + 2619.1910774455437, + 17.171717171717205, + 17.676767676767668, + 16.666666666666686 + ], + [ + 2622.9189094248186, + 17.171717171717205, + 17.676767676767668, + 16.666666666666686 + ], + [ + 2626.6467414040926, + 17.171717171717205, + 17.676767676767668, + 16.666666666666686 + ], + [ + 2630.3745733833666, + 17.171717171717205, + 17.676767676767668, + 16.666666666666686 + ], + [ + 2634.1024053626415, + 17.171717171717205, + 17.676767676767668, + 16.666666666666686 + ], + [ + 2637.8302373419156, + 17.171717171717205, + 17.676767676767668, + 16.666666666666686 + ], + [ + 2641.5580693211905, + 17.171717171717205, + 17.676767676767668, + 16.666666666666686 + ], + [ + 2645.2859013004645, + 17.171717171717205, + 17.676767676767668, + 16.666666666666686 + ], + [ + 2649.0137332797385, + 17.171717171717205, + 17.676767676767668, + 16.666666666666686 + ], + [ + 2652.7415652590134, + 17.171717171717205, + 17.676767676767668, + 16.666666666666686 + ], + [ + 2656.4693972382875, + 17.171717171717205, + 17.676767676767668, + 16.666666666666686 + ], + [ + 2660.1972292175624, + 17.171717171717205, + 17.676767676767668, + 16.666666666666686 + ], + [ + 2663.9250611968364, + 17.171717171717205, + 17.676767676767668, + 16.666666666666686 + ], + [ + 2667.6528931761104, + 17.171717171717205, + 17.676767676767668, + 16.666666666666686 + ], + [ + 2671.3807251553853, + 17.171717171717205, + 17.676767676767668, + 16.666666666666686 + ], + [ + 2675.1085571346593, + 17.171717171717205, + 17.676767676767668, + 16.666666666666686 + ], + [ + 2678.8363891139343, + 17.0707070707071, + 17.474747474747517, + 16.666666666666686 + ], + [ + 2682.5642210932083, + 17.0707070707071, + 17.474747474747517, + 16.666666666666686 + ], + [ + 2686.2920530724823, + 17.0707070707071, + 17.474747474747517, + 16.666666666666686 + ], + [ + 2690.0198850517572, + 17.0707070707071, + 17.474747474747517, + 16.666666666666686 + ], + [ + 2693.7477170310312, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 2697.475549010306, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 2701.20338098958, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 2704.931212968854, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 2708.659044948129, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 2712.386876927403, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 2716.114708906678, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 2719.842540885952, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 2723.570372865226, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 2727.298204844501, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 2731.026036823775, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 2734.75386880305, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 2738.481700782324, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 2742.209532761598, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 2745.937364740873, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 2749.665196720147, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 2753.393028699422, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 2757.120860678696, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 2760.84869265797, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 2764.576524637245, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 2768.304356616519, + 16.868686868686893, + 17.27272727272731, + 16.464646464646478 + ], + [ + 2772.0321885957937, + 16.868686868686893, + 17.27272727272731, + 16.464646464646478 + ], + [ + 2775.7600205750678, + 16.868686868686893, + 17.27272727272731, + 16.464646464646478 + ], + [ + 2779.4878525543418, + 16.868686868686893, + 17.27272727272731, + 16.464646464646478 + ], + [ + 2783.2156845336167, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 2786.9435165128907, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 2790.6713484921656, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 2794.3991804714396, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 2798.1270124507146, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 2801.8548444299886, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 2805.5826764092626, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 2809.3105083885375, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 2813.0383403678115, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 2816.7661723470865, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 2820.4940043263605, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 2824.2218363056345, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 2827.9496682849094, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 2831.6775002641834, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 2835.4053322434584, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 2839.1331642227324, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 2842.8609962020064, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 2846.5888281812813, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 2850.3166601605553, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 2854.0444921398303, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 2857.7723241191043, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 2861.5001560983783, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 2865.227988077653, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 2868.955820056927, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 2872.683652036202, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 2876.411484015476, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 2880.13931599475, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 2883.867147974025, + 16.666666666666686, + 17.0707070707071, + 16.26262626262627 + ], + [ + 2887.594979953299, + 16.666666666666686, + 17.0707070707071, + 16.26262626262627 + ], + [ + 2891.322811932574, + 16.666666666666686, + 17.0707070707071, + 16.26262626262627 + ], + [ + 2895.050643911848, + 16.666666666666686, + 17.0707070707071, + 16.26262626262627 + ], + [ + 2898.778475891122, + 16.666666666666686, + 17.0707070707071, + 16.26262626262627 + ], + [ + 2902.506307870397, + 16.666666666666686, + 17.0707070707071, + 16.26262626262627 + ], + [ + 2906.234139849671, + 16.666666666666686, + 17.0707070707071, + 16.26262626262627 + ], + [ + 2909.961971828946, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 2913.68980380822, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 2917.417635787494, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 2921.145467766769, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 2924.873299746043, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 2928.601131725318, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 2932.328963704592, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 2936.056795683866, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 2939.784627663141, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 2943.512459642415, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 2947.2402916216897, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 2950.9681236009637, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 2954.6959555802378, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 2958.4237875595127, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 2962.1516195387867, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 2965.8794515180616, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 2969.6072834973356, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 2973.3351154766096, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 2977.0629474558846, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 2980.7907794351586, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 2984.5186114144335, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 2988.2464433937075, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 2991.9742753729815, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 2995.7021073522565, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 2999.4299393315305, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3003.1577713108054, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3006.8856032900794, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3010.6134352693534, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3014.3412672486284, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3018.0690992279024, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3021.7969312071773, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3025.5247631864513, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3029.2525951657253, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3032.9804271450002, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3036.7082591242743, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3040.436091103549, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3044.163923082823, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3047.891755062097, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3051.619587041372, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3055.347419020646, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3059.075250999921, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3062.803082979195, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3066.530914958469, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3070.258746937744, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3073.986578917018, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3077.714410896293, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3081.442242875567, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3085.170074854841, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3088.897906834116, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3092.62573881339, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3096.353570792665, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3100.081402771939, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3103.809234751214, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3107.537066730488, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3111.264898709762, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3114.9927306890368, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3118.720562668311, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3122.4483946475857, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3126.1762266268597, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3129.9040586061337, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3133.6318905854087, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3137.3597225646827, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3141.0875545439576, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3144.8153865232316, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3148.5432185025056, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3152.2710504817805, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3155.9988824610546, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3159.7267144403295, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3163.4545464196035, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3167.1823783988775, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3170.9102103781524, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3174.6380423574265, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3178.3658743367014, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3182.0937063159754, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3185.8215382952494, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3189.5493702745243, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3193.2772022537984, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3197.0050342330733, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3200.7328662123473, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3204.4606981916213, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3208.1885301708962, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3211.9163621501702, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3215.644194129445, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3219.372026108719, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3223.099858087993, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3226.827690067268, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3230.555522046542, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3234.283354025817, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3238.011186005091, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3241.739017984365, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3245.46684996364, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3249.194681942914, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3252.922513922189, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3256.650345901463, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3260.378177880737, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3264.106009860012, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3267.833841839286, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3271.561673818561, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3275.289505797835, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3279.017337777109, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3282.745169756384, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3286.473001735658, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3290.2008337149327, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3293.9286656942068, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3297.6564976734808, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3301.3843296527557, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3305.1121616320297, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3308.8399936113046, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3312.5678255905787, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3316.2956575698527, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3320.0234895491276, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3323.7513215284016, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3327.4791535076765, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3331.2069854869505, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3334.9348174662246, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3338.6626494454995, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3342.3904814247735, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3346.1183134040484, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3349.8461453833224, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3353.5739773625965, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3357.3018093418714, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3361.0296413211454, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3364.7574733004203, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3368.4853052796943, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3372.2131372589683, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3375.9409692382433, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3379.6688012175173, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3383.396633196792, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3387.124465176066, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3390.8522971553402, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3394.580129134615, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3398.307961113889, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3402.035793093164, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3405.763625072438, + 16.56565656565658, + 17.0707070707071, + 16.060606060606062 + ], + [ + 3409.491457051712, + 16.666666666666686, + 17.0707070707071, + 16.26262626262627 + ], + [ + 3413.219289030987, + 16.666666666666686, + 17.0707070707071, + 16.26262626262627 + ], + [ + 3416.947121010261, + 16.666666666666686, + 17.0707070707071, + 16.26262626262627 + ], + [ + 3420.674952989536, + 16.666666666666686, + 17.0707070707071, + 16.26262626262627 + ], + [ + 3424.40278496881, + 16.666666666666686, + 17.0707070707071, + 16.26262626262627 + ], + [ + 3428.130616948085, + 16.666666666666686, + 17.0707070707071, + 16.26262626262627 + ], + [ + 3431.858448927359, + 16.666666666666686, + 17.0707070707071, + 16.26262626262627 + ], + [ + 3435.586280906633, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 3439.314112885908, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 3443.041944865182, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 3446.769776844457, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 3450.497608823731, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 3454.225440803005, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 3457.95327278228, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 3461.681104761554, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 3465.4089367408287, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 3469.1367687201027, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 3472.8646006993768, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 3476.5924326786517, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 3480.3202646579257, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 3484.0480966372006, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 3487.7759286164746, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 3491.5037605957486, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 3495.2315925750236, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 3498.9594245542976, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 3502.6872565335725, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 3506.4150885128465, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 3510.1429204921205, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 3513.8707524713955, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 3517.5985844506695, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 3521.3264164299444, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 3525.0542484092184, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 3528.7820803884924, + 16.76767676767679, + 17.27272727272731, + 16.26262626262627 + ], + [ + 3532.5099123677674, + 16.868686868686893, + 17.27272727272731, + 16.464646464646478 + ], + [ + 3536.2377443470414, + 16.868686868686893, + 17.27272727272731, + 16.464646464646478 + ], + [ + 3539.9655763263163, + 16.868686868686893, + 17.27272727272731, + 16.464646464646478 + ], + [ + 3543.6934083055903, + 16.868686868686893, + 17.27272727272731, + 16.464646464646478 + ], + [ + 3547.4212402848643, + 16.868686868686893, + 17.27272727272731, + 16.464646464646478 + ], + [ + 3551.1490722641392, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 3554.8769042434133, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 3558.604736222688, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 3562.332568201962, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 3566.060400181236, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 3569.788232160511, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 3573.516064139785, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 3577.24389611906, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 3580.971728098334, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 3584.699560077608, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 3588.427392056883, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 3592.155224036157, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 3595.883056015432, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 3599.610887994706, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 3603.33871997398, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 3607.066551953255, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 3610.794383932529, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 3614.522215911804, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 3618.250047891078, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 3621.977879870352, + 16.969696969696997, + 17.474747474747517, + 16.464646464646478 + ], + [ + 3625.705711849627, + 17.0707070707071, + 17.474747474747517, + 16.666666666666686 + ], + [ + 3629.433543828901, + 17.0707070707071, + 17.474747474747517, + 16.666666666666686 + ], + [ + 3633.1613758081758, + 17.0707070707071, + 17.474747474747517, + 16.666666666666686 + ], + [ + 3636.88920778745, + 17.171717171717205, + 17.676767676767668, + 16.666666666666686 + ], + [ + 3640.617039766724, + 17.171717171717205, + 17.676767676767668, + 16.666666666666686 + ], + [ + 3644.3448717459987, + 17.171717171717205, + 17.676767676767668, + 16.666666666666686 + ], + [ + 3648.0727037252727, + 17.171717171717205, + 17.676767676767668, + 16.666666666666686 + ], + [ + 3651.8005357045477, + 17.171717171717205, + 17.676767676767668, + 16.666666666666686 + ], + [ + 3655.5283676838217, + 17.171717171717205, + 17.676767676767668, + 16.666666666666686 + ], + [ + 3659.2561996630957, + 17.171717171717205, + 17.676767676767668, + 16.666666666666686 + ] + ], + "Tr": [ + [ + 274.3847624819582, + 25.05050505050508, + 25.353535353535392, + 24.74747474747477 + ], + [ + 278.1125944612327, + 25.05050505050508, + 25.555555555555543, + 24.54545454545456 + ], + [ + 281.84042644050714, + 25.05050505050508, + 25.555555555555543, + 24.54545454545456 + ], + [ + 285.5682584197816, + 25.05050505050508, + 25.555555555555543, + 24.54545454545456 + ], + [ + 289.29609039905563, + 24.949494949494976, + 25.353535353535392, + 24.54545454545456 + ], + [ + 293.0239223783301, + 24.949494949494976, + 25.353535353535392, + 24.54545454545456 + ], + [ + 296.75175435760457, + 24.949494949494976, + 25.353535353535392, + 24.54545454545456 + ], + [ + 300.47958633687904, + 24.949494949494976, + 25.353535353535392, + 24.54545454545456 + ], + [ + 304.2074183161535, + 24.949494949494976, + 25.353535353535392, + 24.54545454545456 + ], + [ + 307.9352502954275, + 24.949494949494976, + 25.353535353535392, + 24.54545454545456 + ], + [ + 311.663082274702, + 24.949494949494976, + 25.353535353535392, + 24.54545454545456 + ], + [ + 315.39091425397646, + 25.05050505050508, + 25.555555555555543, + 24.54545454545456 + ], + [ + 319.11874623325093, + 25.05050505050508, + 25.555555555555543, + 24.54545454545456 + ], + [ + 322.8465782125254, + 25.05050505050508, + 25.555555555555543, + 24.54545454545456 + ], + [ + 326.57441019179987, + 25.05050505050508, + 25.555555555555543, + 24.54545454545456 + ], + [ + 330.3022421710739, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 334.03007415034836, + 25.151515151515184, + 25.555555555555543, + 24.74747474747477 + ], + [ + 337.7579061296228, + 25.252525252525288, + 25.75757575757575, + 24.74747474747477 + ], + [ + 341.4857381088973, + 25.252525252525288, + 25.75757575757575, + 24.74747474747477 + ], + [ + 345.21357008817176, + 25.353535353535392, + 25.75757575757575, + 24.949494949494976 + ], + [ + 348.9414020674458, + 25.454545454545496, + 25.95959595959596, + 24.949494949494976 + ], + [ + 352.66923404672025, + 25.454545454545496, + 25.95959595959596, + 24.949494949494976 + ], + [ + 356.3970660259947, + 25.454545454545496, + 25.95959595959596, + 24.949494949494976 + ], + [ + 360.1248980052692, + 25.656565656565647, + 26.161616161616166, + 25.151515151515184 + ], + [ + 363.85272998454366, + 25.656565656565647, + 26.161616161616166, + 25.151515151515184 + ], + [ + 367.5805619638177, + 25.75757575757575, + 26.161616161616166, + 25.353535353535392 + ], + [ + 371.30839394309214, + 25.858585858585855, + 26.363636363636374, + 25.353535353535392 + ], + [ + 375.0362259223666, + 25.858585858585855, + 26.363636363636374, + 25.353535353535392 + ], + [ + 378.7640579016411, + 26.060606060606062, + 26.56565656565658, + 25.555555555555543 + ], + [ + 382.49188988091555, + 26.060606060606062, + 26.56565656565658, + 25.555555555555543 + ], + [ + 386.21972186018957, + 26.26262626262627, + 26.76767676767679, + 25.75757575757575 + ], + [ + 389.94755383946404, + 26.26262626262627, + 26.76767676767679, + 25.75757575757575 + ], + [ + 393.6753858187385, + 26.464646464646478, + 26.969696969696997, + 25.95959595959596 + ], + [ + 397.403217798013, + 26.464646464646478, + 26.969696969696997, + 25.95959595959596 + ], + [ + 401.13104977728744, + 26.666666666666686, + 27.171717171717205, + 26.161616161616166 + ], + [ + 404.85888175656146, + 26.76767676767679, + 27.373737373737413, + 26.161616161616166 + ], + [ + 408.58671373583593, + 26.868686868686893, + 27.373737373737413, + 26.363636363636374 + ], + [ + 412.3145457151104, + 26.969696969696997, + 27.575757575757564, + 26.363636363636374 + ], + [ + 416.04237769438487, + 27.0707070707071, + 27.575757575757564, + 26.56565656565658 + ], + [ + 419.77020967365934, + 27.171717171717205, + 27.77777777777777, + 26.56565656565658 + ], + [ + 423.49804165293335, + 27.373737373737413, + 27.97979797979798, + 26.76767676767679 + ], + [ + 427.2258736322078, + 27.47474747474746, + 27.97979797979798, + 26.969696969696997 + ], + [ + 430.9537056114823, + 27.575757575757564, + 28.181818181818187, + 26.969696969696997 + ], + [ + 434.68153759075676, + 27.77777777777777, + 28.383838383838395, + 27.171717171717205 + ], + [ + 438.40936957003123, + 27.878787878787875, + 28.383838383838395, + 27.373737373737413 + ], + [ + 442.13720154930525, + 27.97979797979798, + 28.585858585858603, + 27.373737373737413 + ], + [ + 445.8650335285797, + 28.181818181818187, + 28.78787878787881, + 27.575757575757564 + ], + [ + 449.5928655078542, + 28.383838383838395, + 28.989898989899018, + 27.77777777777777 + ], + [ + 453.32069748712865, + 28.4848484848485, + 28.989898989899018, + 27.97979797979798 + ], + [ + 457.0485294664031, + 28.585858585858603, + 29.191919191919226, + 27.97979797979798 + ], + [ + 460.77636144567714, + 28.78787878787881, + 29.393939393939434, + 28.181818181818187 + ], + [ + 464.5041934249516, + 28.989898989899018, + 29.595959595959584, + 28.383838383838395 + ], + [ + 468.2320254042261, + 29.191919191919226, + 29.797979797979792, + 28.585858585858603 + ], + [ + 471.95985738350055, + 29.29292929292933, + 30.0, + 28.585858585858603 + ], + [ + 475.687689362775, + 29.393939393939434, + 30.0, + 28.78787878787881 + ], + [ + 479.4155213420495, + 29.595959595959584, + 30.202020202020208, + 28.989898989899018 + ], + [ + 483.1433533213235, + 29.797979797979792, + 30.404040404040416, + 29.191919191919226 + ], + [ + 486.871185300598, + 30.0, + 30.606060606060623, + 29.393939393939434 + ], + [ + 490.59901727987244, + 30.202020202020208, + 30.80808080808083, + 29.595959595959584 + ], + [ + 494.3268492591469, + 30.404040404040416, + 31.01010101010104, + 29.797979797979792 + ], + [ + 498.0546812384214, + 30.50505050505052, + 31.212121212121247, + 29.797979797979792 + ], + [ + 501.7825132176954, + 30.707070707070727, + 31.414141414141454, + 30.0 + ], + [ + 505.51034519696987, + 30.909090909090935, + 31.616161616161605, + 30.202020202020208 + ], + [ + 509.23817717624433, + 31.111111111111143, + 31.818181818181813, + 30.404040404040416 + ], + [ + 512.9660091555188, + 31.31313131313135, + 32.02020202020202, + 30.606060606060623 + ], + [ + 516.6938411347933, + 31.5151515151515, + 32.22222222222223, + 30.80808080808083 + ], + [ + 520.4216731140673, + 31.71717171717171, + 32.424242424242436, + 31.01010101010104 + ], + [ + 524.1495050933418, + 31.919191919191917, + 32.626262626262644, + 31.212121212121247 + ], + [ + 527.8773370726162, + 32.121212121212125, + 32.82828282828285, + 31.414141414141454 + ], + [ + 531.6051690518907, + 32.32323232323233, + 33.03030303030306, + 31.616161616161605 + ], + [ + 535.3330010311652, + 32.52525252525254, + 33.23232323232327, + 31.818181818181813 + ], + [ + 539.0608330104392, + 32.72727272727275, + 33.43434343434342, + 32.02020202020202 + ], + [ + 542.7886649897137, + 33.03030303030306, + 33.838383838383834, + 32.22222222222223 + ], + [ + 546.5164969689881, + 33.23232323232327, + 34.04040404040404, + 32.424242424242436 + ], + [ + 550.2443289482626, + 33.53535353535352, + 34.24242424242425, + 32.82828282828285 + ], + [ + 553.9721609275371, + 33.73737373737373, + 34.44444444444446, + 33.03030303030306 + ], + [ + 557.6999929068111, + 33.93939393939394, + 34.646464646464665, + 33.23232323232327 + ], + [ + 561.4278248860855, + 34.141414141414145, + 34.84848484848487, + 33.43434343434342 + ], + [ + 565.15565686536, + 34.34343434343435, + 35.05050505050508, + 33.636363636363626 + ], + [ + 568.8834888446345, + 34.646464646464665, + 35.45454545454544, + 33.838383838383834 + ], + [ + 572.611320823909, + 34.84848484848487, + 35.65656565656565, + 34.04040404040404 + ], + [ + 576.339152803183, + 35.05050505050508, + 35.858585858585855, + 34.24242424242425 + ], + [ + 580.0669847824574, + 35.35353535353539, + 36.06060606060606, + 34.646464646464665 + ], + [ + 583.7948167617319, + 35.65656565656565, + 36.46464646464648, + 34.84848484848487 + ], + [ + 587.5226487410064, + 35.858585858585855, + 36.666666666666686, + 35.05050505050508 + ], + [ + 591.2504807202808, + 36.06060606060606, + 36.86868686868689, + 35.25252525252529 + ], + [ + 594.9783126995549, + 36.46464646464648, + 37.27272727272731, + 35.65656565656565 + ], + [ + 598.7061446788293, + 36.666666666666686, + 37.47474747474746, + 35.858585858585855 + ], + [ + 602.4339766581038, + 36.86868686868689, + 37.67676767676767, + 36.06060606060606 + ], + [ + 606.1618086373783, + 37.171717171717205, + 38.08080808080808, + 36.26262626262627 + ], + [ + 609.8896406166527, + 37.47474747474746, + 38.28282828282829, + 36.666666666666686 + ], + [ + 613.6174725959268, + 37.67676767676767, + 38.4848484848485, + 36.86868686868689 + ], + [ + 617.3453045752012, + 37.97979797979798, + 38.888888888888914, + 37.0707070707071 + ], + [ + 621.0731365544757, + 38.28282828282829, + 39.09090909090912, + 37.47474747474746 + ], + [ + 624.8009685337502, + 38.4848484848485, + 39.29292929292933, + 37.67676767676767 + ], + [ + 628.5288005130246, + 38.78787878787881, + 39.69696969696969, + 37.878787878787875 + ], + [ + 632.2566324922991, + 39.09090909090912, + 39.898989898989896, + 38.28282828282829 + ], + [ + 635.9844644715731, + 39.39393939393938, + 40.30303030303031, + 38.4848484848485 + ], + [ + 639.7122964508476, + 39.595959595959584, + 40.50505050505052, + 38.686868686868706 + ], + [ + 643.4401284301221, + 40.0, + 40.909090909090935, + 39.09090909090912 + ], + [ + 647.1679604093965, + 40.20202020202021, + 41.11111111111114, + 39.29292929292933 + ], + [ + 650.895792388671, + 40.60606060606062, + 41.5151515151515, + 39.69696969696969 + ], + [ + 654.623624367945, + 40.80808080808083, + 41.71717171717171, + 39.898989898989896 + ], + [ + 658.3514563472195, + 41.21212121212125, + 42.121212121212125, + 40.30303030303031 + ], + [ + 662.079288326494, + 41.4141414141414, + 42.32323232323233, + 40.50505050505052 + ], + [ + 665.8071203057684, + 41.81818181818181, + 42.72727272727275, + 40.909090909090935 + ], + [ + 669.5349522850429, + 42.02020202020202, + 42.929292929292956, + 41.11111111111114 + ], + [ + 673.2627842643169, + 42.424242424242436, + 43.333333333333314, + 41.5151515151515 + ], + [ + 676.9906162435914, + 42.626262626262644, + 43.53535353535352, + 41.71717171717171 + ], + [ + 680.7184482228658, + 43.03030303030306, + 43.93939393939394, + 42.121212121212125 + ], + [ + 684.4462802021403, + 43.333333333333314, + 44.34343434343435, + 42.32323232323233 + ], + [ + 688.1741121814148, + 43.636363636363626, + 44.54545454545456, + 42.72727272727275 + ], + [ + 691.9019441606888, + 43.93939393939394, + 44.94949494949498, + 42.929292929292956 + ], + [ + 695.6297761399633, + 44.24242424242425, + 45.151515151515184, + 43.333333333333314 + ], + [ + 699.3576081192377, + 44.54545454545456, + 45.55555555555554, + 43.53535353535352 + ], + [ + 703.0854400985122, + 44.94949494949498, + 45.95959595959596, + 43.93939393939394 + ], + [ + 706.8132720777867, + 45.25252525252529, + 46.161616161616166, + 44.34343434343435 + ], + [ + 710.5411040570607, + 45.55555555555554, + 46.56565656565658, + 44.54545454545456 + ], + [ + 714.2689360363352, + 45.95959595959596, + 46.969696969697, + 44.94949494949498 + ], + [ + 717.9967680156096, + 46.26262626262627, + 47.171717171717205, + 45.353535353535335 + ], + [ + 721.7245999948841, + 46.56565656565658, + 47.575757575757564, + 45.55555555555554 + ], + [ + 725.4524319741586, + 46.969696969697, + 47.97979797979798, + 45.95959595959596 + ], + [ + 729.1802639534326, + 47.373737373737356, + 48.383838383838395, + 46.363636363636374 + ], + [ + 732.908095932707, + 47.575757575757564, + 48.5858585858586, + 46.56565656565658 + ], + [ + 736.6359279119815, + 47.97979797979798, + 48.98989898989902, + 46.969696969697 + ], + [ + 740.363759891256, + 48.383838383838395, + 49.39393939393938, + 47.373737373737356 + ], + [ + 744.0915918705305, + 48.686868686868706, + 49.79797979797979, + 47.575757575757564 + ], + [ + 747.8194238498045, + 49.09090909090912, + 50.20202020202021, + 47.97979797979798 + ], + [ + 751.547255829079, + 49.39393939393938, + 50.404040404040416, + 48.383838383838395 + ], + [ + 755.2750878083534, + 49.79797979797979, + 50.80808080808083, + 48.78787878787881 + ], + [ + 759.0029197876279, + 50.101010101010104, + 51.21212121212125, + 48.98989898989902 + ], + [ + 762.7307517669024, + 50.50505050505052, + 51.616161616161605, + 49.39393939393938 + ], + [ + 766.4585837461764, + 50.909090909090935, + 52.02020202020202, + 49.79797979797979 + ], + [ + 770.1864157254508, + 51.313131313131294, + 52.424242424242436, + 50.20202020202021 + ], + [ + 773.9142477047253, + 51.71717171717171, + 52.82828282828285, + 50.60606060606062 + ], + [ + 777.6420796839998, + 52.121212121212125, + 53.23232323232321, + 51.01010101010104 + ], + [ + 781.3699116632743, + 52.32323232323233, + 53.43434343434342, + 51.21212121212125 + ], + [ + 785.0977436425483, + 52.72727272727275, + 53.838383838383834, + 51.616161616161605 + ], + [ + 788.8255756218227, + 53.13131313131316, + 54.24242424242425, + 52.02020202020202 + ], + [ + 792.5534076010972, + 53.53535353535352, + 54.646464646464665, + 52.424242424242436 + ], + [ + 796.2812395803717, + 53.93939393939394, + 55.05050505050508, + 52.82828282828285 + ], + [ + 800.0090715596461, + 54.34343434343435, + 55.45454545454544, + 53.23232323232321 + ], + [ + 803.7369035389206, + 54.74747474747477, + 55.858585858585855, + 53.636363636363626 + ], + [ + 807.4647355181946, + 55.151515151515184, + 56.26262626262627, + 54.04040404040404 + ], + [ + 811.1925674974691, + 55.55555555555554, + 56.666666666666686, + 54.44444444444446 + ], + [ + 814.9203994767436, + 55.95959595959596, + 57.0707070707071, + 54.84848484848487 + ], + [ + 818.648231456018, + 56.363636363636374, + 57.47474747474746, + 55.25252525252523 + ], + [ + 822.3760634352925, + 56.76767676767679, + 57.878787878787875, + 55.65656565656565 + ], + [ + 826.1038954145665, + 57.17171717171715, + 58.28282828282829, + 56.06060606060606 + ], + [ + 829.831727393841, + 57.575757575757564, + 58.686868686868706, + 56.46464646464648 + ], + [ + 833.5595593731155, + 57.97979797979798, + 59.09090909090912, + 56.86868686868689 + ], + [ + 837.2873913523899, + 58.383838383838395, + 59.49494949494948, + 57.27272727272725 + ], + [ + 841.0152233316644, + 58.5858585858586, + 59.69696969696969, + 57.47474747474746 + ], + [ + 844.7430553109384, + 58.98989898989902, + 60.101010101010104, + 57.878787878787875 + ], + [ + 848.4708872902129, + 59.39393939393938, + 60.50505050505052, + 58.28282828282829 + ], + [ + 852.1987192694874, + 59.79797979797979, + 60.909090909090935, + 58.686868686868706 + ], + [ + 855.9265512487618, + 60.20202020202021, + 61.313131313131294, + 59.09090909090912 + ], + [ + 859.6543832280363, + 60.50505050505052, + 61.5151515151515, + 59.49494949494948 + ], + [ + 863.3822152073103, + 60.909090909090935, + 61.91919191919192, + 59.898989898989896 + ], + [ + 867.1100471865848, + 61.313131313131294, + 62.32323232323233, + 60.30303030303031 + ], + [ + 870.8378791658592, + 61.616161616161605, + 62.72727272727275, + 60.50505050505052 + ], + [ + 874.5657111451337, + 62.02020202020202, + 63.13131313131311, + 60.909090909090935 + ], + [ + 878.2935431244082, + 62.32323232323233, + 63.333333333333314, + 61.313131313131294 + ], + [ + 882.0213751036822, + 62.72727272727275, + 63.73737373737373, + 61.71717171717171 + ], + [ + 885.7492070829567, + 63.13131313131311, + 64.14141414141415, + 62.121212121212125 + ], + [ + 889.4770390622311, + 63.43434343434342, + 64.54545454545456, + 62.32323232323233 + ], + [ + 893.2048710415056, + 63.73737373737373, + 64.74747474747477, + 62.72727272727275 + ], + [ + 896.9327030207801, + 64.14141414141415, + 65.15151515151513, + 63.13131313131311 + ], + [ + 900.6605350000541, + 64.54545454545456, + 65.55555555555554, + 63.53535353535352 + ], + [ + 904.3883669793286, + 64.74747474747477, + 65.75757575757575, + 63.73737373737373 + ], + [ + 908.116198958603, + 65.15151515151513, + 66.16161616161617, + 64.14141414141415 + ], + [ + 911.8440309378775, + 65.55555555555554, + 66.56565656565658, + 64.54545454545456 + ], + [ + 915.571862917152, + 65.95959595959596, + 66.969696969697, + 64.94949494949498 + ], + [ + 919.299694896426, + 66.16161616161617, + 67.17171717171715, + 65.15151515151513 + ], + [ + 923.0275268757005, + 66.56565656565658, + 67.57575757575756, + 65.55555555555554 + ], + [ + 926.7553588549749, + 66.969696969697, + 67.97979797979798, + 65.95959595959596 + ], + [ + 930.4831908342494, + 67.17171717171715, + 68.18181818181819, + 66.16161616161617 + ], + [ + 934.2110228135239, + 67.57575757575756, + 68.5858585858586, + 66.56565656565658 + ], + [ + 937.9388547927979, + 67.97979797979798, + 68.98989898989902, + 66.969696969697 + ], + [ + 941.6666867720724, + 68.18181818181819, + 69.19191919191917, + 67.17171717171715 + ], + [ + 945.3945187513468, + 68.5858585858586, + 69.59595959595958, + 67.57575757575756 + ], + [ + 949.1223507306213, + 68.98989898989902, + 70.0, + 67.97979797979798 + ], + [ + 952.8501827098958, + 69.19191919191917, + 70.20202020202021, + 68.18181818181819 + ], + [ + 956.5780146891702, + 69.59595959595958, + 70.60606060606062, + 68.5858585858586 + ], + [ + 960.3058466684442, + 70.0, + 71.01010101010104, + 68.98989898989902 + ], + [ + 964.0336786477187, + 70.20202020202021, + 71.21212121212119, + 69.19191919191917 + ], + [ + 967.7615106269932, + 70.60606060606062, + 71.6161616161616, + 69.59595959595958 + ], + [ + 971.4893426062677, + 70.90909090909093, + 71.81818181818181, + 70.0 + ], + [ + 975.2171745855421, + 71.21212121212119, + 72.22222222222223, + 70.20202020202021 + ], + [ + 978.9450065648161, + 71.6161616161616, + 72.62626262626264, + 70.60606060606062 + ], + [ + 982.6728385440906, + 72.02020202020202, + 122.92929292929293, + 71.01010101010104 + ], + [ + 986.4006705233651, + 72.42424242424244, + 122.92929292929293, + 71.21212121212119 + ], + [ + 990.1285025026395, + 72.92929292929296, + 122.72727272727272, + 71.6161616161616 + ], + [ + 993.856334481914, + 73.23232323232321, + 122.52525252525251, + 72.02020202020202 + ], + [ + 997.584166461188, + 73.43434343434342, + 122.1212121212121, + 72.22222222222223 + ], + [ + 1001.3119984404625, + 73.83838383838383, + 121.91919191919192, + 72.62626262626264 + ], + [ + 1005.039830419737, + 74.14141414141415, + 121.71717171717171, + 72.82828282828285 + ], + [ + 1008.7676623990114, + 74.54545454545456, + 121.5151515151515, + 73.23232323232321 + ], + [ + 1012.4954943782859, + 74.54545454545456, + 75.45454545454544, + 73.63636363636363 + ], + [ + 1016.2233263575599, + 74.84848484848487, + 75.85858585858585, + 73.83838383838383 + ], + [ + 1019.9511583368344, + 75.15151515151513, + 76.06060606060606, + 74.24242424242425 + ], + [ + 1023.6789903161089, + 75.45454545454544, + 76.46464646464648, + 74.44444444444446 + ], + [ + 1027.4068222953833, + 75.75757575757575, + 76.66666666666669, + 74.84848484848487 + ], + [ + 1031.1346542746578, + 76.16161616161617, + 77.07070707070704, + 75.25252525252523 + ], + [ + 1034.8624862539318, + 76.46464646464648, + 77.47474747474746, + 75.45454545454544 + ], + [ + 1038.5903182332063, + 76.76767676767679, + 77.67676767676767, + 75.85858585858585 + ], + [ + 1042.3181502124808, + 77.07070707070704, + 78.08080808080808, + 76.06060606060606 + ], + [ + 1046.0459821917552, + 77.37373737373736, + 78.28282828282829, + 76.46464646464648 + ], + [ + 1049.7738141710297, + 77.67676767676767, + 78.4848484848485, + 76.8686868686869 + ], + [ + 1053.5016461503037, + 77.77777777777777, + 78.4848484848485, + 77.07070707070704 + ], + [ + 1057.2294781295782, + 77.97979797979798, + 78.4848484848485, + 77.47474747474746 + ], + [ + 1060.9573101088527, + 78.08080808080808, + 78.4848484848485, + 77.67676767676767 + ], + [ + 1064.6851420881271, + 78.28282828282829, + 78.4848484848485, + 78.08080808080808 + ], + [ + 1068.4129740674016, + 78.3838383838384, + 78.4848484848485, + 78.28282828282829 + ], + [ + 1183.9757654249074, + 88.6868686868687, + 89.59595959595958, + 87.77777777777777 + ], + [ + 1187.7035974041814, + 89.09090909090907, + 90.0, + 88.18181818181819 + ], + [ + 1191.431429383456, + 89.29292929292927, + 90.20202020202021, + 88.3838383838384 + ], + [ + 1195.1592613627304, + 89.69696969696969, + 90.60606060606062, + 88.78787878787881 + ], + [ + 1198.8870933420048, + 89.8989898989899, + 90.80808080808083, + 88.98989898989896 + ], + [ + 1202.6149253212793, + 90.20202020202021, + 91.01010101010098, + 89.39393939393938 + ], + [ + 1206.3427573005533, + 90.50505050505052, + 91.4141414141414, + 89.59595959595958 + ], + [ + 1210.0705892798278, + 90.80808080808083, + 91.6161616161616, + 90.0 + ], + [ + 1213.7984212591023, + 91.11111111111109, + 92.02020202020202, + 90.20202020202021 + ], + [ + 1217.5262532383767, + 91.3131313131313, + 92.22222222222223, + 90.40404040404042 + ], + [ + 1221.2540852176512, + 91.6161616161616, + 92.42424242424241, + 90.80808080808083 + ], + [ + 1224.9819171969252, + 91.91919191919192, + 92.82828282828282, + 91.01010101010098 + ], + [ + 1228.7097491761997, + 92.22222222222223, + 93.03030303030303, + 91.4141414141414 + ], + [ + 1232.4375811554742, + 92.52525252525251, + 93.43434343434342, + 91.6161616161616 + ], + [ + 1236.1654131347486, + 92.82828282828282, + 93.63636363636363, + 92.02020202020202 + ], + [ + 1239.893245114023, + 93.03030303030303, + 93.83838383838383, + 92.22222222222223 + ], + [ + 1243.6210770932971, + 93.23232323232324, + 94.04040404040404, + 92.42424242424241 + ], + [ + 1247.3489090725716, + 93.53535353535352, + 94.24242424242425, + 92.82828282828282 + ], + [ + 1251.076741051846, + 93.73737373737373, + 94.44444444444443, + 93.03030303030303 + ], + [ + 1254.8045730311205, + 93.93939393939394, + 94.64646464646464, + 93.23232323232324 + ], + [ + 1258.532405010395, + 94.14141414141415, + 94.64646464646464, + 93.63636363636363 + ], + [ + 1262.260236989669, + 94.24242424242425, + 94.64646464646464, + 93.83838383838383 + ], + [ + 1265.9880689689435, + 94.24242424242425, + 94.64646464646464, + 93.83838383838383 + ], + [ + 1269.715900948218, + 94.34343434343432, + 94.84848484848484, + 93.83838383838383 + ], + [ + 1273.4437329274924, + 94.34343434343432, + 94.84848484848484, + 93.83838383838383 + ], + [ + 1277.171564906767, + 94.34343434343432, + 94.84848484848484, + 93.83838383838383 + ], + [ + 1280.8993968860414, + 94.34343434343432, + 94.84848484848484, + 93.83838383838383 + ], + [ + 1284.6272288653154, + 94.34343434343432, + 94.84848484848484, + 93.83838383838383 + ], + [ + 1288.3550608445898, + 94.44444444444443, + 94.84848484848484, + 94.04040404040404 + ], + [ + 1292.0828928238643, + 94.44444444444443, + 94.84848484848484, + 94.04040404040404 + ], + [ + 1295.8107248031388, + 94.44444444444443, + 94.84848484848484, + 94.04040404040404 + ], + [ + 1299.5385567824133, + 94.44444444444443, + 94.84848484848484, + 94.04040404040404 + ], + [ + 1303.2663887616873, + 94.44444444444443, + 94.84848484848484, + 94.04040404040404 + ], + [ + 1306.9942207409617, + 94.44444444444443, + 94.84848484848484, + 94.04040404040404 + ], + [ + 1310.7220527202362, + 94.44444444444443, + 94.84848484848484, + 94.04040404040404 + ], + [ + 1314.4498846995107, + 94.44444444444443, + 94.84848484848484, + 94.04040404040404 + ], + [ + 1318.1777166787851, + 94.44444444444443, + 94.84848484848484, + 94.04040404040404 + ], + [ + 1321.9055486580592, + 94.44444444444443, + 94.84848484848484, + 94.04040404040404 + ], + [ + 1325.6333806373336, + 94.44444444444443, + 94.84848484848484, + 94.04040404040404 + ], + [ + 1329.361212616608, + 94.44444444444443, + 94.84848484848484, + 94.04040404040404 + ], + [ + 1333.0890445958826, + 94.44444444444443, + 94.84848484848484, + 94.04040404040404 + ], + [ + 1336.816876575157, + 94.44444444444443, + 94.84848484848484, + 94.04040404040404 + ], + [ + 1340.544708554431, + 94.44444444444443, + 94.84848484848484, + 94.04040404040404 + ], + [ + 1344.2725405337055, + 94.44444444444443, + 94.84848484848484, + 94.04040404040404 + ], + [ + 1348.00037251298, + 94.44444444444443, + 94.84848484848484, + 94.04040404040404 + ], + [ + 1351.7282044922545, + 94.44444444444443, + 94.84848484848484, + 94.04040404040404 + ], + [ + 1355.456036471529, + 94.44444444444443, + 94.84848484848484, + 94.04040404040404 + ], + [ + 1359.183868450803, + 94.44444444444443, + 94.84848484848484, + 94.04040404040404 + ], + [ + 1362.9117004300774, + 94.44444444444443, + 94.84848484848484, + 94.04040404040404 + ], + [ + 1366.639532409352, + 94.44444444444443, + 94.84848484848484, + 94.04040404040404 + ], + [ + 1370.3673643886264, + 94.44444444444443, + 94.84848484848484, + 94.04040404040404 + ], + [ + 1374.0951963679008, + 94.44444444444443, + 94.84848484848484, + 94.04040404040404 + ], + [ + 1377.8230283471748, + 94.44444444444443, + 94.84848484848484, + 94.04040404040404 + ], + [ + 1381.5508603264493, + 94.44444444444443, + 94.84848484848484, + 94.04040404040404 + ], + [ + 1385.2786923057238, + 94.44444444444443, + 94.84848484848484, + 94.04040404040404 + ], + [ + 1389.0065242849982, + 94.44444444444443, + 94.84848484848484, + 94.04040404040404 + ], + [ + 1392.7343562642727, + 94.44444444444443, + 94.84848484848484, + 94.04040404040404 + ], + [ + 1396.4621882435467, + 94.44444444444443, + 94.84848484848484, + 94.04040404040404 + ], + [ + 1400.1900202228212, + 94.44444444444443, + 94.84848484848484, + 94.04040404040404 + ], + [ + 1403.9178522020957, + 94.44444444444443, + 94.84848484848484, + 94.04040404040404 + ], + [ + 1407.6456841813701, + 94.44444444444443, + 94.84848484848484, + 94.04040404040404 + ], + [ + 1411.3735161606446, + 94.44444444444443, + 94.84848484848484, + 94.04040404040404 + ], + [ + 1415.1013481399186, + 94.44444444444443, + 94.84848484848484, + 94.04040404040404 + ], + [ + 1418.829180119193, + 94.44444444444443, + 94.84848484848484, + 94.04040404040404 + ], + [ + 1422.5570120984676, + 94.44444444444443, + 94.84848484848484, + 94.04040404040404 + ], + [ + 1426.284844077742, + 94.44444444444443, + 94.84848484848484, + 94.04040404040404 + ], + [ + 1430.0126760570165, + 94.44444444444443, + 94.84848484848484, + 94.04040404040404 + ], + [ + 1433.740508036291, + 94.44444444444443, + 94.84848484848484, + 94.04040404040404 + ], + [ + 1437.468340015565, + 94.44444444444443, + 94.84848484848484, + 94.04040404040404 + ], + [ + 1441.1961719948395, + 94.34343434343432, + 94.84848484848484, + 93.83838383838383 + ], + [ + 1444.924003974114, + 94.34343434343432, + 94.84848484848484, + 93.83838383838383 + ], + [ + 1448.6518359533884, + 94.34343434343432, + 94.84848484848484, + 93.83838383838383 + ], + [ + 1452.3796679326629, + 94.34343434343432, + 94.84848484848484, + 93.83838383838383 + ], + [ + 1456.1074999119369, + 94.34343434343432, + 94.84848484848484, + 93.83838383838383 + ], + [ + 1459.8353318912114, + 94.34343434343432, + 94.84848484848484, + 93.83838383838383 + ], + [ + 1463.5631638704858, + 94.34343434343432, + 94.84848484848484, + 93.83838383838383 + ], + [ + 1467.2909958497603, + 94.34343434343432, + 94.84848484848484, + 93.83838383838383 + ], + [ + 1471.0188278290348, + 94.34343434343432, + 94.84848484848484, + 93.83838383838383 + ], + [ + 1474.7466598083088, + 94.34343434343432, + 94.84848484848484, + 93.83838383838383 + ], + [ + 1478.4744917875832, + 94.24242424242425, + 94.64646464646464, + 93.83838383838383 + ], + [ + 1482.2023237668577, + 94.24242424242425, + 94.64646464646464, + 93.83838383838383 + ], + [ + 1485.9301557461322, + 94.24242424242425, + 94.64646464646464, + 93.83838383838383 + ], + [ + 1489.6579877254067, + 94.24242424242425, + 94.64646464646464, + 93.83838383838383 + ], + [ + 1493.3858197046807, + 94.24242424242425, + 94.64646464646464, + 93.83838383838383 + ], + [ + 1497.1136516839551, + 94.24242424242425, + 94.64646464646464, + 93.83838383838383 + ], + [ + 1500.8414836632296, + 94.24242424242425, + 94.64646464646464, + 93.83838383838383 + ], + [ + 1504.569315642504, + 94.24242424242425, + 94.64646464646464, + 93.83838383838383 + ], + [ + 1508.2971476217785, + 94.24242424242425, + 94.64646464646464, + 93.83838383838383 + ], + [ + 1512.0249796010526, + 94.24242424242425, + 94.64646464646464, + 93.83838383838383 + ], + [ + 1515.752811580327, + 94.24242424242425, + 94.64646464646464, + 93.83838383838383 + ], + [ + 1519.4806435596015, + 94.24242424242425, + 94.64646464646464, + 93.83838383838383 + ], + [ + 1523.208475538876, + 94.24242424242425, + 94.64646464646464, + 93.83838383838383 + ], + [ + 1526.9363075181504, + 94.24242424242425, + 94.64646464646464, + 93.83838383838383 + ], + [ + 1530.6641394974245, + 94.24242424242425, + 94.64646464646464, + 93.83838383838383 + ], + [ + 1534.391971476699, + 94.14141414141415, + 94.64646464646464, + 93.63636363636363 + ], + [ + 1538.1198034559734, + 94.14141414141415, + 94.64646464646464, + 93.63636363636363 + ], + [ + 1541.8476354352479, + 94.14141414141415, + 94.64646464646464, + 93.63636363636363 + ], + [ + 1545.5754674145223, + 94.14141414141415, + 94.64646464646464, + 93.63636363636363 + ], + [ + 1549.3032993937964, + 94.14141414141415, + 94.64646464646464, + 93.63636363636363 + ], + [ + 1553.0311313730708, + 94.14141414141415, + 94.64646464646464, + 93.63636363636363 + ], + [ + 1556.7589633523453, + 94.14141414141415, + 94.64646464646464, + 93.63636363636363 + ], + [ + 1560.4867953316198, + 94.14141414141415, + 94.64646464646464, + 93.63636363636363 + ], + [ + 1564.2146273108942, + 94.04040404040404, + 94.44444444444443, + 93.63636363636363 + ], + [ + 1567.9424592901682, + 94.04040404040404, + 94.44444444444443, + 93.63636363636363 + ], + [ + 1571.6702912694427, + 94.04040404040404, + 94.44444444444443, + 93.63636363636363 + ], + [ + 1575.3981232487172, + 94.04040404040404, + 94.44444444444443, + 93.63636363636363 + ], + [ + 1579.1259552279917, + 94.04040404040404, + 94.44444444444443, + 93.63636363636363 + ], + [ + 1582.8537872072661, + 94.04040404040404, + 94.44444444444443, + 93.63636363636363 + ], + [ + 1586.5816191865406, + 94.04040404040404, + 94.44444444444443, + 93.63636363636363 + ], + [ + 1590.3094511658146, + 94.04040404040404, + 94.44444444444443, + 93.63636363636363 + ], + [ + 1594.037283145089, + 94.04040404040404, + 94.44444444444443, + 93.63636363636363 + ], + [ + 1597.7651151243635, + 94.04040404040404, + 94.44444444444443, + 93.63636363636363 + ], + [ + 1601.492947103638, + 94.04040404040404, + 94.44444444444443, + 93.63636363636363 + ], + [ + 1605.2207790829125, + 94.04040404040404, + 94.44444444444443, + 93.63636363636363 + ], + [ + 1608.9486110621865, + 93.93939393939394, + 94.44444444444443, + 93.43434343434342 + ], + [ + 1612.676443041461, + 93.93939393939394, + 94.44444444444443, + 93.43434343434342 + ], + [ + 1616.4042750207354, + 93.93939393939394, + 94.44444444444443, + 93.43434343434342 + ], + [ + 1620.13210700001, + 93.93939393939394, + 94.44444444444443, + 93.43434343434342 + ], + [ + 1623.8599389792844, + 93.93939393939394, + 94.44444444444443, + 93.43434343434342 + ], + [ + 1627.5877709585584, + 93.93939393939394, + 94.44444444444443, + 93.43434343434342 + ], + [ + 1631.3156029378333, + 93.93939393939394, + 94.44444444444443, + 93.43434343434342 + ], + [ + 1635.0434349171073, + 93.83838383838383, + 94.24242424242425, + 93.43434343434342 + ], + [ + 1638.7712668963813, + 93.83838383838383, + 94.24242424242425, + 93.43434343434342 + ], + [ + 1642.4990988756563, + 93.83838383838383, + 94.24242424242425, + 93.43434343434342 + ], + [ + 1646.2269308549303, + 93.83838383838383, + 94.24242424242425, + 93.43434343434342 + ], + [ + 1649.9547628342052, + 93.83838383838383, + 94.24242424242425, + 93.43434343434342 + ], + [ + 1653.6825948134792, + 93.83838383838383, + 94.24242424242425, + 93.43434343434342 + ], + [ + 1657.4104267927532, + 93.83838383838383, + 94.24242424242425, + 93.43434343434342 + ], + [ + 1661.1382587720282, + 93.83838383838383, + 94.24242424242425, + 93.43434343434342 + ], + [ + 1664.8660907513022, + 93.83838383838383, + 94.24242424242425, + 93.43434343434342 + ], + [ + 1668.593922730577, + 93.83838383838383, + 94.24242424242425, + 93.43434343434342 + ], + [ + 1672.3217547098511, + 93.73737373737373, + 94.24242424242425, + 93.23232323232324 + ], + [ + 1676.0495866891251, + 93.73737373737373, + 94.24242424242425, + 93.23232323232324 + ], + [ + 1679.7774186684, + 93.73737373737373, + 94.24242424242425, + 93.23232323232324 + ], + [ + 1683.505250647674, + 93.93939393939394, + 94.44444444444443, + 93.43434343434342 + ], + [ + 1687.233082626949, + 93.93939393939394, + 94.44444444444443, + 93.43434343434342 + ], + [ + 1690.960914606223, + 94.04040404040404, + 94.44444444444443, + 93.63636363636363 + ], + [ + 1694.688746585497, + 94.04040404040404, + 94.44444444444443, + 93.63636363636363 + ], + [ + 1698.416578564772, + 94.04040404040404, + 94.44444444444443, + 93.63636363636363 + ], + [ + 1702.144410544046, + 94.04040404040404, + 94.44444444444443, + 93.63636363636363 + ], + [ + 1705.872242523321, + 93.93939393939394, + 94.44444444444443, + 93.43434343434342 + ], + [ + 1709.600074502595, + 93.93939393939394, + 94.44444444444443, + 93.43434343434342 + ], + [ + 1713.327906481869, + 93.93939393939394, + 94.44444444444443, + 93.43434343434342 + ], + [ + 1717.0557384611438, + 93.73737373737373, + 94.24242424242425, + 93.23232323232324 + ], + [ + 1720.7835704404179, + 93.73737373737373, + 94.24242424242425, + 93.23232323232324 + ], + [ + 1724.5114024196928, + 93.63636363636363, + 94.24242424242425, + 93.03030303030303 + ], + [ + 1728.2392343989668, + 93.53535353535352, + 94.04040404040404, + 93.03030303030303 + ], + [ + 1731.9670663782408, + 93.43434343434342, + 94.04040404040404, + 92.82828282828282 + ], + [ + 1735.6948983575157, + 93.33333333333331, + 93.83838383838383, + 92.82828282828282 + ], + [ + 1739.4227303367898, + 93.23232323232324, + 93.83838383838383, + 92.62626262626262 + ], + [ + 1743.1505623160647, + 93.03030303030303, + 93.63636363636363, + 92.42424242424241 + ], + [ + 1746.8783942953387, + 92.92929292929293, + 93.43434343434342, + 92.42424242424241 + ], + [ + 1750.6062262746127, + 92.82828282828282, + 93.43434343434342, + 92.22222222222223 + ], + [ + 1754.3340582538876, + 92.62626262626262, + 93.23232323232324, + 92.02020202020202 + ], + [ + 1758.0618902331616, + 92.42424242424241, + 93.03030303030303, + 91.81818181818181 + ], + [ + 1761.7897222124366, + 92.22222222222223, + 92.82828282828282, + 91.6161616161616 + ], + [ + 1765.5175541917106, + 92.12121212121212, + 92.82828282828282, + 91.4141414141414 + ], + [ + 1769.2453861709846, + 91.91919191919192, + 92.62626262626262, + 91.21212121212122 + ], + [ + 1772.9732181502595, + 91.71717171717171, + 92.42424242424241, + 91.01010101010098 + ], + [ + 1776.7010501295335, + 91.5151515151515, + 92.22222222222223, + 90.80808080808083 + ], + [ + 1780.4288821088085, + 91.3131313131313, + 92.02020202020202, + 90.60606060606062 + ], + [ + 1784.1567140880825, + 91.11111111111109, + 91.81818181818181, + 90.40404040404042 + ], + [ + 1787.8845460673565, + 90.90909090909088, + 91.6161616161616, + 90.20202020202021 + ], + [ + 1791.6123780466314, + 90.70707070707073, + 91.4141414141414, + 90.0 + ], + [ + 1795.3402100259054, + 90.50505050505052, + 91.21212121212122, + 89.79797979797979 + ], + [ + 1799.0680420051804, + 90.30303030303031, + 91.01010101010098, + 89.59595959595958 + ], + [ + 1802.7958739844544, + 90.1010101010101, + 90.80808080808083, + 89.39393939393938 + ], + [ + 1806.5237059637284, + 89.79797979797979, + 90.60606060606062, + 88.98989898989896 + ], + [ + 1810.2515379430033, + 89.59595959595958, + 90.40404040404042, + 88.78787878787881 + ], + [ + 1813.9793699222773, + 89.39393939393938, + 90.20202020202021, + 88.5858585858586 + ], + [ + 1817.7072019015523, + 88.98989898989896, + 89.79797979797979, + 88.18181818181819 + ], + [ + 1821.4350338808263, + 88.78787878787881, + 89.59595959595958, + 87.97979797979798 + ], + [ + 1825.1628658601012, + 88.5858585858586, + 89.39393939393938, + 87.77777777777777 + ], + [ + 1828.8906978393752, + 88.28282828282829, + 89.19191919191917, + 87.37373737373736 + ], + [ + 1832.6185298186492, + 87.97979797979798, + 88.78787878787881, + 87.17171717171715 + ], + [ + 1836.3463617979241, + 87.77777777777777, + 88.5858585858586, + 86.96969696969694 + ], + [ + 1840.0741937771982, + 87.47474747474746, + 88.3838383838384, + 86.56565656565658 + ], + [ + 1843.802025756473, + 87.17171717171715, + 87.97979797979798, + 86.36363636363637 + ], + [ + 1847.529857735747, + 86.86868686868684, + 87.77777777777777, + 85.95959595959596 + ], + [ + 1851.2576897150211, + 86.56565656565658, + 87.37373737373736, + 85.75757575757575 + ], + [ + 1854.985521694296, + 86.26262626262627, + 87.17171717171715, + 85.35353535353534 + ], + [ + 1858.71335367357, + 85.95959595959596, + 86.96969696969694, + 84.94949494949492 + ], + [ + 1862.441185652845, + 85.65656565656565, + 86.56565656565658, + 84.74747474747477 + ], + [ + 1866.169017632119, + 85.35353535353534, + 86.36363636363637, + 84.34343434343435 + ], + [ + 1869.896849611393, + 85.05050505050502, + 85.95959595959596, + 84.14141414141415 + ], + [ + 1873.624681590668, + 84.74747474747477, + 85.75757575757575, + 83.73737373737373 + ], + [ + 1877.352513569942, + 84.34343434343435, + 85.35353535353534, + 83.33333333333331 + ], + [ + 1881.0803455492169, + 84.04040404040404, + 84.94949494949492, + 83.1313131313131 + ], + [ + 1884.808177528491, + 83.73737373737373, + 84.74747474747477, + 82.72727272727275 + ], + [ + 1888.536009507765, + 83.33333333333331, + 84.34343434343435, + 82.32323232323233 + ], + [ + 1892.2638414870398, + 83.1313131313131, + 84.14141414141415, + 82.12121212121212 + ], + [ + 1895.9916734663138, + 82.72727272727275, + 83.73737373737373, + 81.71717171717171 + ], + [ + 1899.7195054455888, + 82.32323232323233, + 83.33333333333331, + 81.3131313131313 + ], + [ + 1903.4473374248628, + 81.91919191919192, + 82.9292929292929, + 80.90909090909093 + ], + [ + 1907.1751694041368, + 81.6161616161616, + 82.72727272727275, + 80.50505050505052 + ], + [ + 1910.9030013834117, + 81.3131313131313, + 82.32323232323233, + 80.30303030303031 + ], + [ + 1914.6308333626857, + 80.90909090909093, + 81.91919191919192, + 79.8989898989899 + ], + [ + 1918.3586653419607, + 80.60606060606062, + 81.71717171717171, + 79.49494949494948 + ], + [ + 1922.0864973212347, + 80.20202020202021, + 81.3131313131313, + 79.09090909090907 + ], + [ + 1925.8143293005087, + 79.8989898989899, + 80.90909090909093, + 78.88888888888891 + ], + [ + 1929.5421612797836, + 79.49494949494948, + 80.50505050505052, + 78.4848484848485 + ], + [ + 1933.2699932590576, + 79.09090909090907, + 80.1010101010101, + 78.08080808080808 + ], + [ + 1936.9978252383326, + 78.88888888888891, + 79.8989898989899, + 77.87878787878788 + ], + [ + 1940.7256572176066, + 78.4848484848485, + 79.49494949494948, + 77.47474747474746 + ], + [ + 1944.4534891968806, + 78.18181818181819, + 79.09090909090907, + 77.27272727272725 + ], + [ + 1948.1813211761555, + 77.87878787878788, + 78.88888888888891, + 76.8686868686869 + ], + [ + 1951.9091531554295, + 77.57575757575756, + 78.4848484848485, + 76.66666666666669 + ], + [ + 1955.6369851347044, + 77.17171717171715, + 78.08080808080808, + 76.26262626262627 + ], + [ + 1959.3648171139785, + 76.96969696969694, + 77.87878787878788, + 76.06060606060606 + ], + [ + 1963.0926490932525, + 76.56565656565658, + 77.47474747474746, + 75.65656565656565 + ], + [ + 1966.8204810725274, + 76.36363636363637, + 77.27272727272725, + 75.45454545454544 + ], + [ + 1970.5483130518014, + 75.95959595959596, + 76.8686868686869, + 75.05050505050502 + ], + [ + 1974.2761450310763, + 75.75757575757575, + 76.66666666666669, + 74.84848484848487 + ], + [ + 1978.0039770103504, + 75.35353535353534, + 76.26262626262627, + 74.44444444444446 + ], + [ + 1981.7318089896244, + 75.15151515151513, + 76.06060606060606, + 74.24242424242425 + ], + [ + 1985.4596409688993, + 74.84848484848487, + 75.65656565656565, + 74.04040404040404 + ], + [ + 1989.1874729481733, + 74.54545454545456, + 75.45454545454544, + 73.63636363636363 + ], + [ + 1992.9153049274482, + 74.24242424242425, + 75.05050505050502, + 73.43434343434342 + ], + [ + 1996.6431369067222, + 73.93939393939394, + 74.84848484848487, + 73.030303030303 + ], + [ + 2000.3709688859963, + 73.73737373737373, + 74.64646464646466, + 72.82828282828285 + ], + [ + 2004.0988008652712, + 73.43434343434342, + 74.24242424242425, + 72.62626262626264 + ], + [ + 2007.8266328445452, + 73.1313131313131, + 74.04040404040404, + 72.22222222222223 + ], + [ + 2011.5544648238201, + 72.82828282828285, + 73.63636363636363, + 72.02020202020202 + ], + [ + 2015.2822968030941, + 72.62626262626264, + 73.43434343434342, + 71.81818181818181 + ], + [ + 2019.0101287823682, + 72.32323232323233, + 73.23232323232321, + 71.4141414141414 + ], + [ + 2022.737960761643, + 72.02020202020202, + 72.82828282828285, + 71.21212121212119 + ], + [ + 2026.465792740917, + 71.71717171717171, + 72.62626262626264, + 70.80808080808083 + ], + [ + 2030.193624720192, + 71.4141414141414, + 72.22222222222223, + 70.60606060606062 + ], + [ + 2033.921456699466, + 71.21212121212119, + 72.02020202020202, + 70.40404040404042 + ], + [ + 2037.64928867874, + 70.90909090909093, + 71.81818181818181, + 70.0 + ], + [ + 2041.377120658015, + 70.60606060606062, + 71.4141414141414, + 69.79797979797979 + ], + [ + 2045.104952637289, + 70.40404040404042, + 71.21212121212119, + 69.59595959595958 + ], + [ + 2048.832784616564, + 70.20202020202021, + 71.01010101010104, + 69.39393939393938 + ], + [ + 2052.560616595838, + 69.79797979797979, + 70.60606060606062, + 68.98989898989902 + ], + [ + 2056.288448575112, + 69.59595959595958, + 70.40404040404042, + 68.78787878787881 + ], + [ + 2060.016280554387, + 69.39393939393938, + 70.20202020202021, + 68.5858585858586 + ], + [ + 2063.744112533661, + 68.98989898989902, + 69.79797979797979, + 68.18181818181819 + ], + [ + 2067.471944512936, + 68.78787878787881, + 69.59595959595958, + 67.97979797979798 + ], + [ + 2071.19977649221, + 68.5858585858586, + 69.39393939393938, + 67.77777777777777 + ], + [ + 2074.927608471484, + 68.3838383838384, + 69.19191919191917, + 67.57575757575756 + ], + [ + 2078.6554404507588, + 67.97979797979798, + 68.78787878787881, + 67.17171717171715 + ], + [ + 2082.383272430033, + 67.77777777777777, + 68.5858585858586, + 66.969696969697 + ], + [ + 2086.1111044093077, + 67.57575757575756, + 68.3838383838384, + 66.76767676767679 + ], + [ + 2089.8389363885817, + 67.27272727272725, + 67.97979797979798, + 66.56565656565658 + ], + [ + 2093.5667683678557, + 66.969696969697, + 67.77777777777777, + 66.16161616161617 + ], + [ + 2097.2946003471307, + 66.76767676767679, + 67.57575757575756, + 65.95959595959596 + ], + [ + 2101.0224323264047, + 66.56565656565658, + 67.37373737373736, + 65.75757575757575 + ], + [ + 2104.7502643056796, + 66.26262626262627, + 66.969696969697, + 65.55555555555554 + ], + [ + 2108.4780962849536, + 65.95959595959596, + 66.76767676767679, + 65.15151515151513 + ], + [ + 2112.2059282642276, + 65.75757575757575, + 66.56565656565658, + 64.94949494949498 + ], + [ + 2115.9337602435025, + 65.55555555555554, + 66.36363636363637, + 64.74747474747477 + ], + [ + 2119.6615922227766, + 65.25252525252523, + 65.95959595959596, + 64.54545454545456 + ], + [ + 2123.3894242020515, + 65.05050505050508, + 65.75757575757575, + 64.34343434343435 + ], + [ + 2127.1172561813255, + 64.74747474747477, + 65.55555555555554, + 63.93939393939394 + ], + [ + 2130.8450881605995, + 64.54545454545456, + 65.35353535353534, + 63.73737373737373 + ], + [ + 2134.5729201398744, + 64.34343434343435, + 65.15151515151513, + 63.53535353535352 + ], + [ + 2138.3007521191485, + 64.04040404040404, + 64.74747474747477, + 63.333333333333314 + ], + [ + 2142.0285840984234, + 63.838383838383834, + 64.54545454545456, + 63.13131313131311 + ], + [ + 2145.7564160776974, + 63.53535353535352, + 64.34343434343435, + 62.72727272727275 + ], + [ + 2149.4842480569723, + 63.333333333333314, + 64.14141414141415, + 62.52525252525254 + ], + [ + 2153.2120800362463, + 63.13131313131311, + 63.93939393939394, + 62.32323232323233 + ], + [ + 2156.9399120155203, + 62.82828282828285, + 63.53535353535352, + 62.121212121212125 + ], + [ + 2160.6677439947953, + 62.626262626262644, + 63.333333333333314, + 61.91919191919192 + ], + [ + 2164.3955759740693, + 62.424242424242436, + 63.13131313131311, + 61.71717171717171 + ], + [ + 2168.123407953344, + 62.22222222222223, + 62.929292929292956, + 61.5151515151515 + ], + [ + 2171.8512399326182, + 61.91919191919192, + 62.72727272727275, + 61.11111111111114 + ], + [ + 2175.5790719118922, + 61.71717171717171, + 62.52525252525254, + 60.909090909090935 + ], + [ + 2179.306903891167, + 61.4141414141414, + 62.121212121212125, + 60.70707070707073 + ], + [ + 2183.034735870441, + 61.21212121212119, + 61.91919191919192, + 60.50505050505052 + ], + [ + 2186.762567849716, + 61.01010101010104, + 61.71717171717171, + 60.30303030303031 + ], + [ + 2190.49039982899, + 60.80808080808083, + 61.5151515151515, + 60.101010101010104 + ], + [ + 2194.218231808264, + 60.60606060606062, + 61.313131313131294, + 59.898989898989896 + ], + [ + 2197.946063787539, + 60.404040404040416, + 61.11111111111114, + 59.69696969696969 + ], + [ + 2201.673895766813, + 60.101010101010104, + 60.909090909090935, + 59.29292929292927 + ], + [ + 2205.401727746088, + 59.898989898989896, + 60.70707070707073, + 59.09090909090912 + ], + [ + 2209.129559725362, + 59.595959595959584, + 60.30303030303031, + 58.888888888888914 + ], + [ + 2212.857391704636, + 59.39393939393938, + 60.101010101010104, + 58.686868686868706 + ], + [ + 2216.585223683911, + 59.19191919191917, + 59.898989898989896, + 58.4848484848485 + ], + [ + 2220.313055663185, + 58.98989898989902, + 59.69696969696969, + 58.28282828282829 + ], + [ + 2224.04088764246, + 58.78787878787881, + 59.49494949494948, + 58.08080808080808 + ], + [ + 2227.768719621734, + 58.5858585858586, + 59.29292929292927, + 57.878787878787875 + ], + [ + 2231.496551601008, + 58.383838383838395, + 59.09090909090912, + 57.67676767676767 + ], + [ + 2235.224383580283, + 58.18181818181819, + 58.888888888888914, + 57.47474747474746 + ], + [ + 2238.952215559557, + 57.97979797979798, + 58.686868686868706, + 57.27272727272725 + ], + [ + 2242.680047538832, + 57.77777777777777, + 58.4848484848485, + 57.0707070707071 + ], + [ + 2246.407879518106, + 57.575757575757564, + 58.28282828282829, + 56.86868686868689 + ], + [ + 2250.13571149738, + 57.17171717171715, + 57.878787878787875, + 56.46464646464648 + ], + [ + 2253.8635434766547, + 56.969696969697, + 57.67676767676767, + 56.26262626262627 + ], + [ + 2257.5913754559288, + 56.76767676767679, + 57.47474747474746, + 56.06060606060606 + ], + [ + 2261.3192074352037, + 56.56565656565658, + 57.27272727272725, + 55.858585858585855 + ], + [ + 2265.0470394144777, + 56.363636363636374, + 57.0707070707071, + 55.65656565656565 + ], + [ + 2268.7748713937517, + 56.161616161616166, + 56.86868686868689, + 55.45454545454544 + ], + [ + 2272.5027033730266, + 55.95959595959596, + 56.666666666666686, + 55.25252525252523 + ], + [ + 2276.2305353523006, + 55.75757575757575, + 56.46464646464648, + 55.05050505050508 + ], + [ + 2279.9583673315756, + 55.55555555555554, + 56.26262626262627, + 54.84848484848487 + ], + [ + 2283.6861993108496, + 55.353535353535335, + 56.06060606060606, + 54.646464646464665 + ], + [ + 2287.4140312901236, + 55.151515151515184, + 55.858585858585855, + 54.44444444444446 + ], + [ + 2291.1418632693985, + 54.94949494949498, + 55.65656565656565, + 54.24242424242425 + ], + [ + 2294.8696952486725, + 54.74747474747477, + 55.45454545454544, + 54.04040404040404 + ], + [ + 2298.5975272279475, + 54.54545454545456, + 55.25252525252523, + 53.838383838383834 + ], + [ + 2302.3253592072215, + 54.34343434343435, + 55.05050505050508, + 53.636363636363626 + ], + [ + 2306.0531911864955, + 54.141414141414145, + 54.84848484848487, + 53.43434343434342 + ], + [ + 2309.7810231657704, + 53.93939393939394, + 54.646464646464665, + 53.23232323232321 + ], + [ + 2313.5088551450444, + 53.73737373737373, + 54.44444444444446, + 53.03030303030306 + ], + [ + 2317.2366871243194, + 53.53535353535352, + 54.24242424242425, + 52.82828282828285 + ], + [ + 2320.9645191035934, + 53.333333333333314, + 54.04040404040404, + 52.626262626262644 + ], + [ + 2324.6923510828674, + 53.13131313131316, + 53.838383838383834, + 52.424242424242436 + ], + [ + 2328.4201830621423, + 52.929292929292956, + 53.636363636363626, + 52.22222222222223 + ], + [ + 2332.1480150414163, + 52.72727272727275, + 53.43434343434342, + 52.02020202020202 + ], + [ + 2335.8758470206913, + 52.52525252525254, + 53.23232323232321, + 51.81818181818181 + ], + [ + 2339.6036789999653, + 52.424242424242436, + 53.03030303030306, + 51.81818181818181 + ], + [ + 2343.3315109792393, + 52.22222222222223, + 52.82828282828285, + 51.616161616161605 + ], + [ + 2347.059342958514, + 52.02020202020202, + 52.626262626262644, + 51.4141414141414 + ], + [ + 2350.787174937788, + 51.81818181818181, + 52.424242424242436, + 51.21212121212125 + ], + [ + 2354.515006917063, + 51.616161616161605, + 52.22222222222223, + 51.01010101010104 + ], + [ + 2358.242838896337, + 51.4141414141414, + 52.02020202020202, + 50.80808080808083 + ], + [ + 2361.970670875611, + 51.21212121212125, + 51.81818181818181, + 50.60606060606062 + ], + [ + 2365.698502854886, + 51.01010101010104, + 51.616161616161605, + 50.404040404040416 + ], + [ + 2369.42633483416, + 50.909090909090935, + 51.616161616161605, + 50.20202020202021 + ], + [ + 2373.154166813435, + 50.70707070707073, + 51.4141414141414, + 50.0 + ], + [ + 2376.881998792709, + 50.50505050505052, + 51.21212121212125, + 49.79797979797979 + ], + [ + 2380.609830771983, + 50.30303030303031, + 51.01010101010104, + 49.595959595959584 + ], + [ + 2384.337662751258, + 50.101010101010104, + 50.80808080808083, + 49.39393939393938 + ], + [ + 2388.065494730532, + 50.0, + 50.60606060606062, + 49.39393939393938 + ], + [ + 2391.793326709807, + 49.79797979797979, + 50.404040404040416, + 49.191919191919226 + ], + [ + 2395.521158689081, + 49.595959595959584, + 50.20202020202021, + 48.98989898989902 + ], + [ + 2399.248990668355, + 49.39393939393938, + 50.0, + 48.78787878787881 + ], + [ + 2402.97682264763, + 49.191919191919226, + 49.79797979797979, + 48.5858585858586 + ], + [ + 2406.704654626904, + 48.98989898989902, + 49.595959595959584, + 48.383838383838395 + ], + [ + 2410.432486606179, + 48.888888888888914, + 49.595959595959584, + 48.18181818181819 + ], + [ + 2414.160318585453, + 48.686868686868706, + 49.39393939393938, + 47.97979797979798 + ], + [ + 2417.888150564727, + 48.4848484848485, + 49.191919191919226, + 47.77777777777777 + ], + [ + 2421.615982544002, + 48.383838383838395, + 48.98989898989902, + 47.77777777777777 + ], + [ + 2425.343814523276, + 48.18181818181819, + 48.78787878787881, + 47.575757575757564 + ], + [ + 2429.0716465025507, + 47.97979797979798, + 48.5858585858586, + 47.373737373737356 + ], + [ + 2432.7994784818247, + 47.77777777777777, + 48.383838383838395, + 47.171717171717205 + ], + [ + 2436.5273104610988, + 47.575757575757564, + 48.18181818181819, + 46.969696969697 + ], + [ + 2440.2551424403737, + 47.47474747474746, + 48.18181818181819, + 46.76767676767679 + ], + [ + 2443.9829744196477, + 47.27272727272725, + 47.97979797979798, + 46.56565656565658 + ], + [ + 2447.7108063989226, + 47.171717171717205, + 47.77777777777777, + 46.56565656565658 + ], + [ + 2451.4386383781966, + 46.969696969697, + 47.575757575757564, + 46.363636363636374 + ], + [ + 2455.1664703574706, + 46.76767676767679, + 47.373737373737356, + 46.161616161616166 + ], + [ + 2458.8943023367456, + 46.56565656565658, + 47.171717171717205, + 45.95959595959596 + ], + [ + 2462.6221343160196, + 46.363636363636374, + 46.969696969697, + 45.75757575757575 + ], + [ + 2466.3499662952945, + 46.363636363636374, + 46.969696969697, + 45.75757575757575 + ], + [ + 2470.0777982745685, + 46.161616161616166, + 46.76767676767679, + 45.55555555555554 + ], + [ + 2473.8056302538434, + 45.95959595959596, + 46.56565656565658, + 45.353535353535335 + ], + [ + 2477.5334622331175, + 45.75757575757575, + 46.363636363636374, + 45.151515151515184 + ], + [ + 2481.2612942123915, + 45.55555555555554, + 46.161616161616166, + 44.94949494949498 + ], + [ + 2484.9891261916664, + 45.45454545454544, + 46.161616161616166, + 44.74747474747477 + ], + [ + 2488.7169581709404, + 45.353535353535335, + 45.95959595959596, + 44.74747474747477 + ], + [ + 2492.4447901502153, + 45.151515151515184, + 45.75757575757575, + 44.54545454545456 + ], + [ + 2496.1726221294894, + 44.94949494949498, + 45.55555555555554, + 44.34343434343435 + ], + [ + 2499.9004541087634, + 44.74747474747477, + 45.353535353535335, + 44.141414141414145 + ], + [ + 2503.6282860880383, + 44.74747474747477, + 45.353535353535335, + 44.141414141414145 + ], + [ + 2507.3561180673123, + 44.54545454545456, + 45.151515151515184, + 43.93939393939394 + ], + [ + 2511.0839500465872, + 44.34343434343435, + 44.94949494949498, + 43.73737373737373 + ], + [ + 2514.8117820258612, + 44.141414141414145, + 44.74747474747477, + 43.53535353535352 + ], + [ + 2518.5396140051353, + 43.93939393939394, + 44.54545454545456, + 43.333333333333314 + ], + [ + 2522.26744598441, + 43.93939393939394, + 44.54545454545456, + 43.333333333333314 + ], + [ + 2525.995277963684, + 43.73737373737373, + 44.34343434343435, + 43.13131313131316 + ], + [ + 2529.723109942959, + 43.53535353535352, + 44.141414141414145, + 42.929292929292956 + ], + [ + 2533.450941922233, + 43.333333333333314, + 43.93939393939394, + 42.72727272727275 + ], + [ + 2537.178773901507, + 43.333333333333314, + 43.93939393939394, + 42.72727272727275 + ], + [ + 2540.906605880782, + 43.13131313131316, + 43.73737373737373, + 42.52525252525254 + ], + [ + 2544.634437860056, + 42.929292929292956, + 43.53535353535352, + 42.32323232323233 + ], + [ + 2548.362269839331, + 42.82828282828285, + 43.333333333333314, + 42.32323232323233 + ], + [ + 2552.090101818605, + 42.72727272727275, + 43.333333333333314, + 42.121212121212125 + ], + [ + 2555.817933797879, + 42.52525252525254, + 43.13131313131316, + 41.91919191919192 + ], + [ + 2559.545765777154, + 42.32323232323233, + 42.929292929292956, + 41.71717171717171 + ], + [ + 2563.273597756428, + 42.22222222222223, + 42.72727272727275, + 41.71717171717171 + ], + [ + 2567.001429735703, + 42.121212121212125, + 42.72727272727275, + 41.5151515151515 + ], + [ + 2570.729261714977, + 41.91919191919192, + 42.52525252525254, + 41.31313131313135 + ], + [ + 2574.457093694251, + 41.81818181818181, + 42.32323232323233, + 41.31313131313135 + ], + [ + 2578.184925673526, + 41.71717171717171, + 42.32323232323233, + 41.11111111111114 + ], + [ + 2581.9127576528, + 41.5151515151515, + 42.121212121212125, + 40.909090909090935 + ], + [ + 2585.640589632075, + 41.31313131313135, + 41.91919191919192, + 40.70707070707073 + ], + [ + 2589.368421611349, + 41.31313131313135, + 41.91919191919192, + 40.70707070707073 + ], + [ + 2593.096253590623, + 41.11111111111114, + 41.71717171717171, + 40.50505050505052 + ], + [ + 2596.8240855698978, + 40.909090909090935, + 41.5151515151515, + 40.30303030303031 + ], + [ + 2600.551917549172, + 40.80808080808083, + 41.31313131313135, + 40.30303030303031 + ], + [ + 2604.2797495284467, + 40.70707070707073, + 41.31313131313135, + 40.101010101010104 + ], + [ + 2608.0075815077207, + 40.50505050505052, + 41.11111111111114, + 39.898989898989896 + ], + [ + 2611.7354134869947, + 40.404040404040416, + 40.909090909090935, + 39.898989898989896 + ], + [ + 2615.4632454662697, + 40.30303030303031, + 40.909090909090935, + 39.69696969696969 + ], + [ + 2619.1910774455437, + 40.101010101010104, + 40.70707070707073, + 39.49494949494948 + ], + [ + 2622.9189094248186, + 40.0, + 40.50505050505052, + 39.49494949494948 + ], + [ + 2626.6467414040926, + 39.898989898989896, + 40.50505050505052, + 39.29292929292933 + ], + [ + 2630.3745733833666, + 39.69696969696969, + 40.30303030303031, + 39.09090909090912 + ], + [ + 2634.1024053626415, + 39.595959595959584, + 40.101010101010104, + 39.09090909090912 + ], + [ + 2637.8302373419156, + 39.49494949494948, + 40.101010101010104, + 38.888888888888914 + ], + [ + 2641.5580693211905, + 39.39393939393938, + 39.898989898989896, + 38.888888888888914 + ], + [ + 2645.2859013004645, + 39.29292929292933, + 39.898989898989896, + 38.686868686868706 + ], + [ + 2649.0137332797385, + 39.09090909090912, + 39.69696969696969, + 38.4848484848485 + ], + [ + 2652.7415652590134, + 38.98989898989902, + 39.49494949494948, + 38.4848484848485 + ], + [ + 2656.4693972382875, + 38.888888888888914, + 39.49494949494948, + 38.28282828282829 + ], + [ + 2660.1972292175624, + 38.686868686868706, + 39.29292929292933, + 38.08080808080808 + ], + [ + 2663.9250611968364, + 38.5858585858586, + 39.09090909090912, + 38.08080808080808 + ], + [ + 2667.6528931761104, + 38.4848484848485, + 39.09090909090912, + 37.878787878787875 + ], + [ + 2671.3807251553853, + 38.383838383838395, + 38.888888888888914, + 37.878787878787875 + ], + [ + 2675.1085571346593, + 38.28282828282829, + 38.888888888888914, + 37.67676767676767 + ], + [ + 2678.8363891139343, + 38.08080808080808, + 38.686868686868706, + 37.47474747474746 + ], + [ + 2682.5642210932083, + 37.97979797979798, + 38.4848484848485, + 37.47474747474746 + ], + [ + 2686.2920530724823, + 37.878787878787875, + 38.4848484848485, + 37.27272727272731 + ], + [ + 2690.0198850517572, + 37.77777777777777, + 38.28282828282829, + 37.27272727272731 + ], + [ + 2693.7477170310312, + 37.67676767676767, + 38.28282828282829, + 37.0707070707071 + ], + [ + 2697.475549010306, + 37.575757575757564, + 38.08080808080808, + 37.0707070707071 + ], + [ + 2701.20338098958, + 37.373737373737356, + 37.878787878787875, + 36.86868686868689 + ], + [ + 2704.931212968854, + 37.27272727272731, + 37.878787878787875, + 36.666666666666686 + ], + [ + 2708.659044948129, + 37.171717171717205, + 37.67676767676767, + 36.666666666666686 + ], + [ + 2712.386876927403, + 37.0707070707071, + 37.67676767676767, + 36.46464646464648 + ], + [ + 2716.114708906678, + 36.969696969697, + 37.47474747474746, + 36.46464646464648 + ], + [ + 2719.842540885952, + 36.86868686868689, + 37.47474747474746, + 36.26262626262627 + ], + [ + 2723.570372865226, + 36.76767676767679, + 37.27272727272731, + 36.26262626262627 + ], + [ + 2727.298204844501, + 36.666666666666686, + 37.27272727272731, + 36.06060606060606 + ], + [ + 2731.026036823775, + 36.56565656565658, + 37.0707070707071, + 36.06060606060606 + ], + [ + 2734.75386880305, + 36.363636363636374, + 36.86868686868689, + 35.858585858585855 + ], + [ + 2738.481700782324, + 36.363636363636374, + 36.86868686868689, + 35.858585858585855 + ], + [ + 2742.209532761598, + 36.161616161616166, + 36.666666666666686, + 35.65656565656565 + ], + [ + 2745.937364740873, + 36.161616161616166, + 36.666666666666686, + 35.65656565656565 + ], + [ + 2749.665196720147, + 35.95959595959596, + 36.46464646464648, + 35.45454545454544 + ], + [ + 2753.393028699422, + 35.95959595959596, + 36.46464646464648, + 35.45454545454544 + ], + [ + 2757.120860678696, + 35.75757575757575, + 36.26262626262627, + 35.25252525252529 + ], + [ + 2760.84869265797, + 35.75757575757575, + 36.26262626262627, + 35.25252525252529 + ], + [ + 2764.576524637245, + 35.55555555555554, + 36.06060606060606, + 35.05050505050508 + ], + [ + 2768.304356616519, + 35.55555555555554, + 36.06060606060606, + 35.05050505050508 + ], + [ + 2772.0321885957937, + 35.35353535353539, + 35.858585858585855, + 34.84848484848487 + ], + [ + 2775.7600205750678, + 35.35353535353539, + 35.858585858585855, + 34.84848484848487 + ], + [ + 2779.4878525543418, + 35.151515151515184, + 35.65656565656565, + 34.646464646464665 + ], + [ + 2783.2156845336167, + 35.151515151515184, + 35.65656565656565, + 34.646464646464665 + ], + [ + 2786.9435165128907, + 34.94949494949498, + 35.45454545454544, + 34.44444444444446 + ], + [ + 2790.6713484921656, + 34.94949494949498, + 35.45454545454544, + 34.44444444444446 + ], + [ + 2794.3991804714396, + 34.74747474747477, + 35.25252525252529, + 34.24242424242425 + ], + [ + 2798.1270124507146, + 34.74747474747477, + 35.25252525252529, + 34.24242424242425 + ], + [ + 2801.8548444299886, + 34.54545454545456, + 35.05050505050508, + 34.04040404040404 + ], + [ + 2805.5826764092626, + 34.54545454545456, + 35.05050505050508, + 34.04040404040404 + ], + [ + 2809.3105083885375, + 34.44444444444446, + 35.05050505050508, + 33.838383838383834 + ], + [ + 2813.0383403678115, + 34.34343434343435, + 34.84848484848487, + 33.838383838383834 + ], + [ + 2816.7661723470865, + 34.34343434343435, + 34.84848484848487, + 33.838383838383834 + ], + [ + 2820.4940043263605, + 34.141414141414145, + 34.646464646464665, + 33.636363636363626 + ], + [ + 2824.2218363056345, + 34.141414141414145, + 34.646464646464665, + 33.636363636363626 + ], + [ + 2827.9496682849094, + 33.93939393939394, + 34.44444444444446, + 33.43434343434342 + ], + [ + 2831.6775002641834, + 33.93939393939394, + 34.44444444444446, + 33.43434343434342 + ], + [ + 2835.4053322434584, + 33.838383838383834, + 34.44444444444446, + 33.23232323232327 + ], + [ + 2839.1331642227324, + 33.73737373737373, + 34.24242424242425, + 33.23232323232327 + ], + [ + 2842.8609962020064, + 33.73737373737373, + 34.24242424242425, + 33.23232323232327 + ], + [ + 2846.5888281812813, + 33.53535353535352, + 34.04040404040404, + 33.03030303030306 + ], + [ + 2850.3166601605553, + 33.53535353535352, + 34.04040404040404, + 33.03030303030306 + ], + [ + 2854.0444921398303, + 33.33333333333337, + 33.838383838383834, + 32.82828282828285 + ], + [ + 2857.7723241191043, + 33.33333333333337, + 33.838383838383834, + 32.82828282828285 + ], + [ + 2861.5001560983783, + 33.33333333333337, + 33.838383838383834, + 32.82828282828285 + ], + [ + 2865.227988077653, + 33.13131313131316, + 33.636363636363626, + 32.626262626262644 + ], + [ + 2868.955820056927, + 33.13131313131316, + 33.636363636363626, + 32.626262626262644 + ], + [ + 2872.683652036202, + 33.13131313131316, + 33.636363636363626, + 32.626262626262644 + ], + [ + 2876.411484015476, + 32.929292929292956, + 33.43434343434342, + 32.424242424242436 + ], + [ + 2880.13931599475, + 32.929292929292956, + 33.43434343434342, + 32.424242424242436 + ], + [ + 2883.867147974025, + 32.72727272727275, + 33.23232323232327, + 32.22222222222223 + ], + [ + 2887.594979953299, + 32.72727272727275, + 33.23232323232327, + 32.22222222222223 + ], + [ + 2891.322811932574, + 32.72727272727275, + 33.23232323232327, + 32.22222222222223 + ], + [ + 2895.050643911848, + 32.52525252525254, + 33.03030303030306, + 32.02020202020202 + ], + [ + 2898.778475891122, + 32.52525252525254, + 33.03030303030306, + 32.02020202020202 + ], + [ + 2902.506307870397, + 32.52525252525254, + 33.03030303030306, + 32.02020202020202 + ], + [ + 2906.234139849671, + 32.32323232323233, + 32.82828282828285, + 31.818181818181813 + ], + [ + 2909.961971828946, + 32.32323232323233, + 32.82828282828285, + 31.818181818181813 + ], + [ + 2913.68980380822, + 32.32323232323233, + 32.82828282828285, + 31.818181818181813 + ], + [ + 2917.417635787494, + 32.121212121212125, + 32.626262626262644, + 31.616161616161605 + ], + [ + 2921.145467766769, + 32.121212121212125, + 32.626262626262644, + 31.616161616161605 + ], + [ + 2924.873299746043, + 32.121212121212125, + 32.626262626262644, + 31.616161616161605 + ], + [ + 2928.601131725318, + 32.02020202020202, + 32.424242424242436, + 31.616161616161605 + ], + [ + 2932.328963704592, + 31.919191919191917, + 32.424242424242436, + 31.414141414141454 + ], + [ + 2936.056795683866, + 31.919191919191917, + 32.424242424242436, + 31.414141414141454 + ], + [ + 2939.784627663141, + 31.818181818181813, + 32.22222222222223, + 31.414141414141454 + ], + [ + 2943.512459642415, + 31.71717171717171, + 32.22222222222223, + 31.212121212121247 + ], + [ + 2947.2402916216897, + 31.71717171717171, + 32.22222222222223, + 31.212121212121247 + ], + [ + 2950.9681236009637, + 31.71717171717171, + 32.22222222222223, + 31.212121212121247 + ], + [ + 2954.6959555802378, + 31.616161616161605, + 32.02020202020202, + 31.212121212121247 + ], + [ + 2958.4237875595127, + 31.5151515151515, + 32.02020202020202, + 31.01010101010104 + ], + [ + 2962.1516195387867, + 31.5151515151515, + 32.02020202020202, + 31.01010101010104 + ], + [ + 2965.8794515180616, + 31.414141414141454, + 31.818181818181813, + 31.01010101010104 + ], + [ + 2969.6072834973356, + 31.414141414141454, + 31.818181818181813, + 31.01010101010104 + ], + [ + 2973.3351154766096, + 31.31313131313135, + 31.818181818181813, + 30.80808080808083 + ], + [ + 2977.0629474558846, + 31.31313131313135, + 31.818181818181813, + 30.80808080808083 + ], + [ + 2980.7907794351586, + 31.212121212121247, + 31.616161616161605, + 30.80808080808083 + ], + [ + 2984.5186114144335, + 31.212121212121247, + 31.616161616161605, + 30.80808080808083 + ], + [ + 2988.2464433937075, + 31.111111111111143, + 31.616161616161605, + 30.606060606060623 + ], + [ + 2991.9742753729815, + 31.111111111111143, + 31.616161616161605, + 30.606060606060623 + ], + [ + 2995.7021073522565, + 31.01010101010104, + 31.414141414141454, + 30.606060606060623 + ], + [ + 2999.4299393315305, + 31.01010101010104, + 31.414141414141454, + 30.606060606060623 + ], + [ + 3003.1577713108054, + 30.909090909090935, + 31.414141414141454, + 30.404040404040416 + ], + [ + 3006.8856032900794, + 30.909090909090935, + 31.414141414141454, + 30.404040404040416 + ], + [ + 3010.6134352693534, + 30.909090909090935, + 31.414141414141454, + 30.404040404040416 + ], + [ + 3014.3412672486284, + 30.80808080808083, + 31.212121212121247, + 30.404040404040416 + ], + [ + 3018.0690992279024, + 30.80808080808083, + 31.212121212121247, + 30.404040404040416 + ], + [ + 3021.7969312071773, + 30.707070707070727, + 31.212121212121247, + 30.202020202020208 + ], + [ + 3025.5247631864513, + 30.707070707070727, + 31.212121212121247, + 30.202020202020208 + ], + [ + 3029.2525951657253, + 30.707070707070727, + 31.212121212121247, + 30.202020202020208 + ], + [ + 3032.9804271450002, + 30.606060606060623, + 31.01010101010104, + 30.202020202020208 + ], + [ + 3036.7082591242743, + 30.606060606060623, + 31.01010101010104, + 30.202020202020208 + ], + [ + 3040.436091103549, + 30.50505050505052, + 31.01010101010104, + 30.0 + ], + [ + 3044.163923082823, + 30.50505050505052, + 31.01010101010104, + 30.0 + ], + [ + 3047.891755062097, + 30.404040404040416, + 30.80808080808083, + 30.0 + ], + [ + 3051.619587041372, + 30.404040404040416, + 30.80808080808083, + 30.0 + ], + [ + 3055.347419020646, + 30.30303030303031, + 30.80808080808083, + 29.797979797979792 + ], + [ + 3059.075250999921, + 30.30303030303031, + 30.80808080808083, + 29.797979797979792 + ], + [ + 3062.803082979195, + 30.202020202020208, + 30.606060606060623, + 29.797979797979792 + ], + [ + 3066.530914958469, + 30.101010101010104, + 30.606060606060623, + 29.595959595959584 + ], + [ + 3070.258746937744, + 30.101010101010104, + 30.606060606060623, + 29.595959595959584 + ], + [ + 3073.986578917018, + 30.101010101010104, + 30.606060606060623, + 29.595959595959584 + ], + [ + 3077.714410896293, + 30.0, + 30.404040404040416, + 29.595959595959584 + ], + [ + 3081.442242875567, + 29.898989898989896, + 30.404040404040416, + 29.393939393939434 + ], + [ + 3085.170074854841, + 29.898989898989896, + 30.404040404040416, + 29.393939393939434 + ], + [ + 3088.897906834116, + 29.898989898989896, + 30.404040404040416, + 29.393939393939434 + ], + [ + 3092.62573881339, + 29.797979797979792, + 30.202020202020208, + 29.393939393939434 + ], + [ + 3096.353570792665, + 29.69696969696969, + 30.202020202020208, + 29.191919191919226 + ], + [ + 3100.081402771939, + 29.69696969696969, + 30.202020202020208, + 29.191919191919226 + ], + [ + 3103.809234751214, + 29.69696969696969, + 30.202020202020208, + 29.191919191919226 + ], + [ + 3107.537066730488, + 29.595959595959584, + 30.0, + 29.191919191919226 + ], + [ + 3111.264898709762, + 29.49494949494948, + 30.0, + 28.989898989899018 + ], + [ + 3114.9927306890368, + 29.49494949494948, + 30.0, + 28.989898989899018 + ], + [ + 3118.720562668311, + 29.49494949494948, + 30.0, + 28.989898989899018 + ], + [ + 3122.4483946475857, + 29.393939393939434, + 29.797979797979792, + 28.989898989899018 + ], + [ + 3126.1762266268597, + 29.29292929292933, + 29.797979797979792, + 28.78787878787881 + ], + [ + 3129.9040586061337, + 29.29292929292933, + 29.797979797979792, + 28.78787878787881 + ], + [ + 3133.6318905854087, + 29.29292929292933, + 29.797979797979792, + 28.78787878787881 + ], + [ + 3137.3597225646827, + 29.191919191919226, + 29.595959595959584, + 28.78787878787881 + ], + [ + 3141.0875545439576, + 29.191919191919226, + 29.595959595959584, + 28.78787878787881 + ], + [ + 3144.8153865232316, + 29.090909090909122, + 29.595959595959584, + 28.585858585858603 + ], + [ + 3148.5432185025056, + 29.090909090909122, + 29.595959595959584, + 28.585858585858603 + ], + [ + 3152.2710504817805, + 28.989898989899018, + 29.393939393939434, + 28.585858585858603 + ], + [ + 3155.9988824610546, + 28.989898989899018, + 29.393939393939434, + 28.585858585858603 + ], + [ + 3159.7267144403295, + 28.888888888888914, + 29.393939393939434, + 28.383838383838395 + ], + [ + 3163.4545464196035, + 28.888888888888914, + 29.393939393939434, + 28.383838383838395 + ], + [ + 3167.1823783988775, + 28.888888888888914, + 29.393939393939434, + 28.383838383838395 + ], + [ + 3170.9102103781524, + 28.78787878787881, + 29.191919191919226, + 28.383838383838395 + ], + [ + 3174.6380423574265, + 28.686868686868706, + 29.191919191919226, + 28.181818181818187 + ], + [ + 3178.3658743367014, + 28.686868686868706, + 29.191919191919226, + 28.181818181818187 + ], + [ + 3182.0937063159754, + 28.686868686868706, + 29.191919191919226, + 28.181818181818187 + ], + [ + 3185.8215382952494, + 28.585858585858603, + 28.989898989899018, + 28.181818181818187 + ], + [ + 3189.5493702745243, + 28.585858585858603, + 28.989898989899018, + 28.181818181818187 + ], + [ + 3193.2772022537984, + 28.4848484848485, + 28.989898989899018, + 27.97979797979798 + ], + [ + 3197.0050342330733, + 28.4848484848485, + 28.989898989899018, + 27.97979797979798 + ], + [ + 3200.7328662123473, + 28.4848484848485, + 28.989898989899018, + 27.97979797979798 + ], + [ + 3204.4606981916213, + 28.383838383838395, + 28.78787878787881, + 27.97979797979798 + ], + [ + 3208.1885301708962, + 28.383838383838395, + 28.78787878787881, + 27.97979797979798 + ], + [ + 3211.9163621501702, + 28.28282828282829, + 28.78787878787881, + 27.77777777777777 + ], + [ + 3215.644194129445, + 28.28282828282829, + 28.78787878787881, + 27.77777777777777 + ], + [ + 3219.372026108719, + 28.181818181818187, + 28.585858585858603, + 27.77777777777777 + ], + [ + 3223.099858087993, + 28.181818181818187, + 28.585858585858603, + 27.77777777777777 + ], + [ + 3226.827690067268, + 28.080808080808083, + 28.585858585858603, + 27.575757575757564 + ], + [ + 3230.555522046542, + 28.080808080808083, + 28.585858585858603, + 27.575757575757564 + ], + [ + 3234.283354025817, + 28.080808080808083, + 28.585858585858603, + 27.575757575757564 + ], + [ + 3238.011186005091, + 27.97979797979798, + 28.383838383838395, + 27.575757575757564 + ], + [ + 3241.739017984365, + 27.97979797979798, + 28.383838383838395, + 27.575757575757564 + ], + [ + 3245.46684996364, + 27.97979797979798, + 28.383838383838395, + 27.575757575757564 + ], + [ + 3249.194681942914, + 27.878787878787875, + 28.383838383838395, + 27.373737373737413 + ], + [ + 3252.922513922189, + 27.878787878787875, + 28.383838383838395, + 27.373737373737413 + ], + [ + 3256.650345901463, + 27.77777777777777, + 28.181818181818187, + 27.373737373737413 + ], + [ + 3260.378177880737, + 27.77777777777777, + 28.181818181818187, + 27.373737373737413 + ], + [ + 3264.106009860012, + 27.77777777777777, + 28.181818181818187, + 27.373737373737413 + ], + [ + 3267.833841839286, + 27.676767676767668, + 28.181818181818187, + 27.171717171717205 + ], + [ + 3271.561673818561, + 27.676767676767668, + 28.181818181818187, + 27.171717171717205 + ], + [ + 3275.289505797835, + 27.676767676767668, + 28.181818181818187, + 27.171717171717205 + ], + [ + 3279.017337777109, + 27.575757575757564, + 27.97979797979798, + 27.171717171717205 + ], + [ + 3282.745169756384, + 27.575757575757564, + 27.97979797979798, + 27.171717171717205 + ], + [ + 3286.473001735658, + 27.47474747474746, + 27.97979797979798, + 26.969696969696997 + ], + [ + 3290.2008337149327, + 27.47474747474746, + 27.97979797979798, + 26.969696969696997 + ], + [ + 3293.9286656942068, + 27.47474747474746, + 27.97979797979798, + 26.969696969696997 + ], + [ + 3297.6564976734808, + 27.373737373737413, + 27.77777777777777, + 26.969696969696997 + ], + [ + 3301.3843296527557, + 27.373737373737413, + 27.77777777777777, + 26.969696969696997 + ], + [ + 3305.1121616320297, + 27.373737373737413, + 27.77777777777777, + 26.969696969696997 + ], + [ + 3308.8399936113046, + 27.27272727272731, + 27.77777777777777, + 26.76767676767679 + ], + [ + 3312.5678255905787, + 27.27272727272731, + 27.77777777777777, + 26.76767676767679 + ], + [ + 3316.2956575698527, + 27.27272727272731, + 27.77777777777777, + 26.76767676767679 + ], + [ + 3320.0234895491276, + 27.171717171717205, + 27.575757575757564, + 26.76767676767679 + ], + [ + 3323.7513215284016, + 27.171717171717205, + 27.575757575757564, + 26.76767676767679 + ], + [ + 3327.4791535076765, + 27.171717171717205, + 27.575757575757564, + 26.76767676767679 + ], + [ + 3331.2069854869505, + 27.0707070707071, + 27.575757575757564, + 26.56565656565658 + ], + [ + 3334.9348174662246, + 27.0707070707071, + 27.575757575757564, + 26.56565656565658 + ], + [ + 3338.6626494454995, + 27.0707070707071, + 27.575757575757564, + 26.56565656565658 + ], + [ + 3342.3904814247735, + 26.969696969696997, + 27.373737373737413, + 26.56565656565658 + ], + [ + 3346.1183134040484, + 26.969696969696997, + 27.373737373737413, + 26.56565656565658 + ], + [ + 3349.8461453833224, + 26.969696969696997, + 27.373737373737413, + 26.56565656565658 + ], + [ + 3353.5739773625965, + 26.868686868686893, + 27.373737373737413, + 26.363636363636374 + ], + [ + 3357.3018093418714, + 26.868686868686893, + 27.373737373737413, + 26.363636363636374 + ], + [ + 3361.0296413211454, + 26.868686868686893, + 27.373737373737413, + 26.363636363636374 + ], + [ + 3364.7574733004203, + 26.868686868686893, + 27.373737373737413, + 26.363636363636374 + ], + [ + 3368.4853052796943, + 26.76767676767679, + 27.171717171717205, + 26.363636363636374 + ], + [ + 3372.2131372589683, + 26.76767676767679, + 27.171717171717205, + 26.363636363636374 + ], + [ + 3375.9409692382433, + 26.76767676767679, + 27.171717171717205, + 26.363636363636374 + ], + [ + 3379.6688012175173, + 26.666666666666686, + 27.171717171717205, + 26.161616161616166 + ], + [ + 3383.396633196792, + 26.666666666666686, + 27.171717171717205, + 26.161616161616166 + ], + [ + 3387.124465176066, + 26.666666666666686, + 27.171717171717205, + 26.161616161616166 + ], + [ + 3390.8522971553402, + 26.666666666666686, + 27.171717171717205, + 26.161616161616166 + ], + [ + 3394.580129134615, + 26.56565656565658, + 26.969696969696997, + 26.161616161616166 + ], + [ + 3398.307961113889, + 26.56565656565658, + 26.969696969696997, + 26.161616161616166 + ], + [ + 3402.035793093164, + 26.56565656565658, + 26.969696969696997, + 26.161616161616166 + ], + [ + 3405.763625072438, + 26.56565656565658, + 26.969696969696997, + 26.161616161616166 + ], + [ + 3409.491457051712, + 26.464646464646478, + 26.969696969696997, + 25.95959595959596 + ], + [ + 3413.219289030987, + 26.464646464646478, + 26.969696969696997, + 25.95959595959596 + ], + [ + 3416.947121010261, + 26.464646464646478, + 26.969696969696997, + 25.95959595959596 + ], + [ + 3420.674952989536, + 26.363636363636374, + 26.76767676767679, + 25.95959595959596 + ], + [ + 3424.40278496881, + 26.363636363636374, + 26.76767676767679, + 25.95959595959596 + ], + [ + 3428.130616948085, + 26.363636363636374, + 26.76767676767679, + 25.95959595959596 + ], + [ + 3431.858448927359, + 26.363636363636374, + 26.76767676767679, + 25.95959595959596 + ], + [ + 3435.586280906633, + 26.363636363636374, + 26.76767676767679, + 25.95959595959596 + ], + [ + 3439.314112885908, + 26.26262626262627, + 26.76767676767679, + 25.75757575757575 + ], + [ + 3443.041944865182, + 26.26262626262627, + 26.76767676767679, + 25.75757575757575 + ], + [ + 3446.769776844457, + 26.26262626262627, + 26.76767676767679, + 25.75757575757575 + ], + [ + 3450.497608823731, + 26.26262626262627, + 26.76767676767679, + 25.75757575757575 + ], + [ + 3454.225440803005, + 26.161616161616166, + 26.56565656565658, + 25.75757575757575 + ], + [ + 3457.95327278228, + 26.161616161616166, + 26.56565656565658, + 25.75757575757575 + ], + [ + 3461.681104761554, + 26.161616161616166, + 26.56565656565658, + 25.75757575757575 + ], + [ + 3465.4089367408287, + 26.161616161616166, + 26.56565656565658, + 25.75757575757575 + ], + [ + 3469.1367687201027, + 26.161616161616166, + 26.56565656565658, + 25.75757575757575 + ], + [ + 3472.8646006993768, + 26.060606060606062, + 26.56565656565658, + 25.555555555555543 + ], + [ + 3476.5924326786517, + 26.060606060606062, + 26.56565656565658, + 25.555555555555543 + ], + [ + 3480.3202646579257, + 26.060606060606062, + 26.56565656565658, + 25.555555555555543 + ], + [ + 3484.0480966372006, + 26.060606060606062, + 26.56565656565658, + 25.555555555555543 + ], + [ + 3487.7759286164746, + 26.060606060606062, + 26.56565656565658, + 25.555555555555543 + ], + [ + 3491.5037605957486, + 25.95959595959596, + 26.363636363636374, + 25.555555555555543 + ], + [ + 3495.2315925750236, + 25.95959595959596, + 26.363636363636374, + 25.555555555555543 + ], + [ + 3498.9594245542976, + 25.95959595959596, + 26.363636363636374, + 25.555555555555543 + ], + [ + 3502.6872565335725, + 25.95959595959596, + 26.363636363636374, + 25.555555555555543 + ], + [ + 3506.4150885128465, + 25.95959595959596, + 26.363636363636374, + 25.555555555555543 + ], + [ + 3510.1429204921205, + 25.95959595959596, + 26.363636363636374, + 25.555555555555543 + ], + [ + 3513.8707524713955, + 25.858585858585855, + 26.363636363636374, + 25.353535353535392 + ], + [ + 3517.5985844506695, + 25.858585858585855, + 26.363636363636374, + 25.353535353535392 + ], + [ + 3521.3264164299444, + 25.858585858585855, + 26.363636363636374, + 25.353535353535392 + ], + [ + 3525.0542484092184, + 25.858585858585855, + 26.363636363636374, + 25.353535353535392 + ], + [ + 3528.7820803884924, + 25.858585858585855, + 26.363636363636374, + 25.353535353535392 + ], + [ + 3532.5099123677674, + 25.858585858585855, + 26.363636363636374, + 25.353535353535392 + ], + [ + 3536.2377443470414, + 25.75757575757575, + 26.161616161616166, + 25.353535353535392 + ], + [ + 3539.9655763263163, + 25.75757575757575, + 26.161616161616166, + 25.353535353535392 + ], + [ + 3543.6934083055903, + 25.75757575757575, + 26.161616161616166, + 25.353535353535392 + ], + [ + 3547.4212402848643, + 25.75757575757575, + 26.161616161616166, + 25.353535353535392 + ], + [ + 3551.1490722641392, + 25.75757575757575, + 26.161616161616166, + 25.353535353535392 + ], + [ + 3554.8769042434133, + 25.75757575757575, + 26.161616161616166, + 25.353535353535392 + ], + [ + 3558.604736222688, + 25.75757575757575, + 26.161616161616166, + 25.353535353535392 + ], + [ + 3562.332568201962, + 25.75757575757575, + 26.161616161616166, + 25.353535353535392 + ], + [ + 3566.060400181236, + 25.75757575757575, + 26.161616161616166, + 25.353535353535392 + ], + [ + 3569.788232160511, + 25.75757575757575, + 26.161616161616166, + 25.353535353535392 + ], + [ + 3573.516064139785, + 25.656565656565647, + 26.161616161616166, + 25.151515151515184 + ], + [ + 3577.24389611906, + 25.656565656565647, + 26.161616161616166, + 25.151515151515184 + ], + [ + 3580.971728098334, + 25.656565656565647, + 26.161616161616166, + 25.151515151515184 + ], + [ + 3584.699560077608, + 25.656565656565647, + 26.161616161616166, + 25.151515151515184 + ], + [ + 3588.427392056883, + 25.656565656565647, + 26.161616161616166, + 25.151515151515184 + ], + [ + 3592.155224036157, + 25.656565656565647, + 26.161616161616166, + 25.151515151515184 + ], + [ + 3595.883056015432, + 25.656565656565647, + 26.161616161616166, + 25.151515151515184 + ], + [ + 3599.610887994706, + 25.656565656565647, + 26.161616161616166, + 25.151515151515184 + ], + [ + 3603.33871997398, + 25.656565656565647, + 26.161616161616166, + 25.151515151515184 + ], + [ + 3607.066551953255, + 25.555555555555543, + 25.95959595959596, + 25.151515151515184 + ], + [ + 3610.794383932529, + 25.555555555555543, + 25.95959595959596, + 25.151515151515184 + ], + [ + 3614.522215911804, + 25.555555555555543, + 25.95959595959596, + 25.151515151515184 + ], + [ + 3618.250047891078, + 25.555555555555543, + 25.95959595959596, + 25.151515151515184 + ], + [ + 3621.977879870352, + 25.555555555555543, + 25.95959595959596, + 25.151515151515184 + ], + [ + 3625.705711849627, + 25.555555555555543, + 25.95959595959596, + 25.151515151515184 + ], + [ + 3629.433543828901, + 25.555555555555543, + 25.95959595959596, + 25.151515151515184 + ], + [ + 3633.1613758081758, + 25.555555555555543, + 25.95959595959596, + 25.151515151515184 + ], + [ + 3636.88920778745, + 25.555555555555543, + 25.95959595959596, + 25.151515151515184 + ], + [ + 3640.617039766724, + 25.555555555555543, + 25.95959595959596, + 25.151515151515184 + ], + [ + 3644.3448717459987, + 25.555555555555543, + 25.95959595959596, + 25.151515151515184 + ], + [ + 3648.0727037252727, + 25.555555555555543, + 25.95959595959596, + 25.151515151515184 + ], + [ + 3651.8005357045477, + 25.555555555555543, + 25.95959595959596, + 25.151515151515184 + ], + [ + 3655.5283676838217, + 25.555555555555543, + 25.95959595959596, + 25.151515151515184 + ] + ] + }, + "samples": { + "Tj": 893, + "Tc": 839, + "Tr": 878 + } + }, + "curve3_2L_water_Tr_mode": { + "page_png": "outputs/expansion_batch04/t1_thermal/mt_rc1mxhfcal/source_cache/img/rc1e_curves_300dpi-51.png", + "page_png_sha256": "27e075b0a0aef47aefd131f8ece09d706070c6abb5faf64ebb73779f5c490f67", + "calibration": { + "y_ticks_px": [ + 2201.5, + 2300.5, + 2399.5, + 2498.0, + 2597.5, + 2696.5, + 2795.5, + 2894.5 + ], + "x_ticks_px": [ + 679.5, + 999.5, + 1322.5, + 1644.5, + 1968.5 + ], + "T_per_px": -0.20200794966804292, + "s_per_px": 3.7232238058363247, + "T_fit_residual_K": 0.08777198654769336, + "t_fit_residual_s": 4.477803324907654 + }, + "columns": [ + "t_s", + "T_median_C", + "T_min_C", + "T_max_C" + ], + "series": { + "Tj": [ + [ + 51.018100897861586, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 54.741324703697956, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 58.464548509534325, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 62.187772315370694, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 65.91099612120706, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 69.63421992704343, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 73.3574437328798, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 77.08066753871617, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 80.80389134455254, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 84.52711515038891, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 88.25033895622482, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 91.97356276206119, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 95.69678656789756, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 99.42001037373393, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 103.1432341795703, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 106.86645798540667, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 110.58968179124304, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 114.3129055970794, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 118.03612940291578, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 121.75935320875215, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 125.48257701458806, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 129.20580082042443, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 132.9290246262608, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 136.65224843209717, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 140.37547223793354, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 144.0986960437699, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 147.82191984960627, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 151.54514365544264, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 155.268367461279, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 158.99159126711538, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 162.7148150729513, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 166.43803887878767, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 170.16126268462403, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 173.8844864904604, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 177.60771029629677, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 181.33093410213314, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 185.0541579079695, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 188.77738171380588, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 192.50060551964225, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 196.22382932547862, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 199.947053131315, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 203.6702769371509, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 207.39350074298727, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 211.11672454882364, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 214.83994835466, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 218.56317216049638, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 222.28639596633275, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 226.00961977216912, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 229.7328435780055, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 233.45606738384186, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 237.17929118967822, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 240.90251499551414, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 244.6257388013505, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 248.34896260718688, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 252.07218641302325, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 255.79541021885962, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 259.518634024696, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 263.24185783053235, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 266.9650816363687, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 270.6883054422051, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 274.41152924804146, + 25.444621601342078, + 25.54562557617612, + 25.343617626508035 + ], + [ + 307.92054350056833, + 25.94964147551218, + 26.151649425180153, + 25.747633525844094 + ], + [ + 311.6437673064047, + 26.7576732741843, + 27.767713022524504, + 25.747633525844094 + ], + [ + 315.3669911122406, + 27.464701098022488, + 29.18176867020088, + 25.747633525844094 + ], + [ + 319.090214918077, + 28.171728921860677, + 30.39381636820906, + 25.94964147551218 + ], + [ + 322.81343872391335, + 28.777752770864822, + 31.60586406621735, + 25.94964147551218 + ], + [ + 326.5366625297497, + 29.282772645034925, + 32.615903814557555, + 25.94964147551218 + ], + [ + 330.2598863355861, + 30.494820343043102, + 33.827951512565846, + 27.16168917352047 + ], + [ + 333.98311014142246, + 31.706868041051393, + 34.83799126090605, + 28.575744821196736 + ], + [ + 337.7063339472588, + 32.7169077893916, + 35.64602305957817, + 29.787792519205027 + ], + [ + 341.4295577530952, + 33.827951512565846, + 36.65606280791849, + 30.999840217213205 + ], + [ + 345.15278155893157, + 34.938995235740094, + 37.66610255625869, + 32.211887915221496 + ], + [ + 348.87600536476793, + 35.848031009246256, + 38.47413435493081, + 33.2219276635617 + ], + [ + 352.5992291706043, + 36.75706678275242, + 39.28216615360304, + 34.231967411901906 + ], + [ + 356.3224529764402, + 37.76710653109262, + 40.29220590194325, + 35.24200716024211 + ], + [ + 360.0456767822766, + 38.6761423045989, + 41.10023770061537, + 36.252046908582315 + ], + [ + 363.76890058811296, + 39.58517807810506, + 41.9082694992876, + 37.26208665692252 + ], + [ + 367.4921243939493, + 40.39320987677718, + 42.71630129795972, + 38.07011845559475 + ], + [ + 371.2153481997857, + 41.20124167544941, + 43.52433309663195, + 38.87815025426687 + ], + [ + 374.93857200562206, + 42.00927347412153, + 44.13035694563598, + 39.888190002607075 + ], + [ + 378.66179581145843, + 42.81730527279376, + 44.93838874430821, + 40.69622180127931 + ], + [ + 382.3850196172948, + 43.62533707146588, + 45.74642054298033, + 41.504253599951426 + ], + [ + 386.10824342313117, + 44.33236489530407, + 46.35244439198448, + 42.31228539862366 + ], + [ + 389.83146722896754, + 45.140396693976186, + 47.16047619065671, + 43.120317197295776 + ], + [ + 393.55469103480345, + 45.847424517814375, + 47.96850798932883, + 43.72634104629992 + ], + [ + 397.2779148406398, + 46.55445234165256, + 48.57453183833297, + 44.534372844972154 + ], + [ + 401.0011386464762, + 47.26148016549064, + 49.18055568733712, + 45.34240464364427 + ], + [ + 404.72436245231256, + 47.96850798932883, + 49.98858748600924, + 45.94842849264842 + ], + [ + 408.44758625814893, + 48.675535813167016, + 50.59461133501338, + 46.756460291320536 + ], + [ + 412.1708100639853, + 49.38256363700509, + 51.20063518401753, + 47.56449208999277 + ], + [ + 415.89403386982167, + 49.98858748600924, + 51.806659033021674, + 48.170515938996914 + ], + [ + 419.61725767565804, + 50.695615309847426, + 52.61469083169379, + 48.77653978800106 + ], + [ + 423.3404814814944, + 51.402643133685615, + 53.22071468069794, + 49.58457158667318 + ], + [ + 427.0637052873308, + 52.00866698268965, + 53.826738529702084, + 50.190595435677324 + ], + [ + 430.7869290931667, + 52.61469083169379, + 54.43276237870623, + 50.79661928468147 + ], + [ + 434.51015289900306, + 53.32171865553198, + 55.038786227710375, + 51.60465108335359 + ], + [ + 438.23337670483943, + 53.92774250453613, + 55.64481007671452, + 52.21067493235773 + ], + [ + 441.9566005106758, + 54.53376635354027, + 56.25083392571855, + 52.81669878136188 + ], + [ + 445.67982431651217, + 55.13979020254442, + 56.8568577747227, + 53.422722630366025 + ], + [ + 449.40304812234854, + 55.74581405154845, + 57.462881623726844, + 54.02874647937017 + ], + [ + 453.1262719281849, + 56.351837900552596, + 58.06890547273099, + 54.6347703283742 + ], + [ + 456.8494957340213, + 56.95786174955674, + 58.674929321735135, + 55.24079417737835 + ], + [ + 460.57271953985764, + 57.462881623726844, + 59.078945221071194, + 55.84681802638249 + ], + [ + 464.295943345694, + 58.06890547273099, + 59.68496907007534, + 56.45284187538664 + ], + [ + 468.0191671515299, + 58.674929321735135, + 60.290992919079486, + 57.058865724390785 + ], + [ + 471.7423909573663, + 59.28095317073928, + 60.89701676808363, + 57.66488957339493 + ], + [ + 475.46561476320267, + 59.78597304490938, + 61.30103266741969, + 58.270913422399076 + ], + [ + 479.18883856903904, + 60.290992919079486, + 61.907056516423836, + 58.674929321735135 + ], + [ + 482.9120623748754, + 60.89701676808363, + 62.51308036542798, + 59.28095317073928 + ], + [ + 486.6352861807118, + 61.402036642253734, + 62.91709626476404, + 59.886977019743426 + ], + [ + 490.35850998654814, + 62.00806049125788, + 63.52312011376819, + 60.49300086874746 + ], + [ + 494.0817337923845, + 62.61408434026191, + 64.12914396277233, + 61.099024717751604 + ], + [ + 497.8049575982209, + 63.018100239598084, + 64.53315986210839, + 61.50304061708766 + ], + [ + 501.52818140405725, + 63.624124088602116, + 65.13918371111254, + 62.10906446609181 + ], + [ + 505.2514052098936, + 64.12914396277233, + 65.5431996104486, + 62.715088315095954 + ], + [ + 508.97462901572953, + 64.63416383694243, + 66.14922345945274, + 63.119104214432014 + ], + [ + 512.6978528215659, + 65.13918371111254, + 66.5532393587888, + 63.72512806343616 + ], + [ + 516.4210766274023, + 65.64420358528264, + 67.15926320779295, + 64.12914396277233 + ], + [ + 520.1443004332386, + 66.14922345945274, + 67.563279107129, + 64.73516781177636 + ], + [ + 523.867524239075, + 66.75524730845689, + 68.16930295613315, + 65.34119166078051 + ], + [ + 527.5907480449114, + 67.15926320779295, + 68.57331885546921, + 65.74520756011657 + ], + [ + 531.3139718507477, + 67.76528705679709, + 69.17934270447336, + 66.35123140912071 + ], + [ + 535.0371956565841, + 68.16930295613315, + 69.58335860380942, + 66.75524730845689 + ], + [ + 538.7604194624205, + 68.67432283030325, + 69.98737450314547, + 67.36127115746092 + ], + [ + 542.4836432682569, + 69.17934270447336, + 70.59339835214962, + 67.76528705679709 + ], + [ + 546.2068670740928, + 69.58335860380942, + 70.99741425148568, + 68.16930295613315 + ], + [ + 549.9300908799291, + 70.08837847797952, + 71.40143015082185, + 68.7753268051373 + ], + [ + 553.6533146857655, + 70.59339835214962, + 72.007453999826, + 69.17934270447336 + ], + [ + 557.3765384916019, + 71.09841822631972, + 72.41146989916206, + 69.7853665534775 + ], + [ + 561.0997622974382, + 71.5024341256559, + 72.81548579849812, + 70.18938245281356 + ], + [ + 564.8229861032746, + 72.007453999826, + 73.42150964750226, + 70.59339835214962 + ], + [ + 568.546209909111, + 72.5124738739961, + 73.82552554683832, + 71.19942220115377 + ], + [ + 572.2694337149474, + 72.91648977333216, + 74.22954144617444, + 71.60343810048983 + ], + [ + 575.9926575207837, + 73.32050567266822, + 74.6335573455105, + 72.007453999826 + ], + [ + 579.7158813266201, + 73.92652952167236, + 75.23958119451464, + 72.61347784883003 + ], + [ + 583.439105132456, + 74.33054542100842, + 75.6435970938507, + 73.01749374816615 + ], + [ + 587.1623289382924, + 74.73456132034454, + 76.04761299318682, + 73.42150964750226 + ], + [ + 590.8855527441287, + 75.1385772196806, + 76.45162889252288, + 73.82552554683832 + ], + [ + 594.6087765499651, + 75.6435970938507, + 76.85564479185899, + 74.43154939584247 + ], + [ + 598.3320003558015, + 76.04761299318682, + 77.25966069119505, + 74.83556529517853 + ], + [ + 602.0552241616379, + 76.55263286735692, + 77.8656845401992, + 75.23958119451464 + ], + [ + 605.7784479674742, + 76.95664876669298, + 78.26970043953526, + 75.6435970938507 + ], + [ + 609.5016717733106, + 77.46166864086308, + 78.67371633887137, + 76.24962094285485 + ], + [ + 613.224895579147, + 77.8656845401992, + 79.07773223820743, + 76.65363684219096 + ], + [ + 616.9481193849833, + 78.26970043953526, + 79.48174813754355, + 77.05765274152702 + ], + [ + 620.6713431908192, + 78.67371633887137, + 79.8857640368796, + 77.46166864086308 + ], + [ + 624.3945669966556, + 79.07773223820743, + 80.28977993621572, + 77.8656845401992 + ], + [ + 628.117790802492, + 79.48174813754355, + 80.69379583555178, + 78.26970043953526 + ], + [ + 631.8410146083284, + 79.8857640368796, + 81.0978117348879, + 78.67371633887137 + ], + [ + 635.5642384141647, + 80.28977993621572, + 81.50182763422396, + 79.07773223820743 + ], + [ + 639.2874622200011, + 80.79479981038583, + 81.90584353356007, + 79.68375608721158 + ], + [ + 643.0106860258375, + 81.19881570972188, + 82.30985943289613, + 80.0877719865477 + ], + [ + 646.7339098316738, + 81.602831609058, + 82.71387533223225, + 80.49178788588375 + ], + [ + 650.4571336375102, + 82.00684750839406, + 83.11789123156831, + 80.89580378521981 + ], + [ + 654.1803574433466, + 82.41086340773018, + 83.52190713090442, + 81.29981968455593 + ], + [ + 657.9035812491829, + 82.81487930706624, + 83.92592303024048, + 81.70383558389199 + ], + [ + 661.6268050550188, + 83.21889520640235, + 84.32993892957654, + 82.1078514832281 + ], + [ + 665.3500288608552, + 83.62291110573841, + 84.73395482891266, + 82.51186738256416 + ], + [ + 669.0732526666916, + 84.02692700507453, + 85.13797072824872, + 82.91588328190028 + ], + [ + 672.796476472528, + 84.43094290441059, + 85.54198662758483, + 83.31989918123634 + ], + [ + 676.5197002783643, + 84.8349588037467, + 85.94600252692089, + 83.72391508057245 + ], + [ + 680.2429240842007, + 85.23897470308276, + 86.35001842625701, + 84.12793097990851 + ], + [ + 683.9661478900371, + 85.64299060241882, + 86.75403432559307, + 84.53194687924463 + ], + [ + 687.6893716958734, + 86.04700650175494, + 87.15805022492918, + 84.93596277858069 + ], + [ + 691.4125955017098, + 86.451022401091, + 87.56206612426524, + 85.3399786779168 + ], + [ + 695.1358193075462, + 86.85503830042711, + 87.96608202360136, + 85.74399457725286 + ], + [ + 698.8590431133821, + 87.15805022492918, + 88.37009792293742, + 85.94600252692089 + ], + [ + 702.5822669192185, + 87.46106214943126, + 88.57210587260545, + 86.35001842625701 + ], + [ + 706.3054907250548, + 87.86507804876732, + 88.97612177194156, + 86.75403432559307 + ], + [ + 710.0287145308912, + 88.26909394810343, + 89.38013767127762, + 87.15805022492918 + ], + [ + 713.7519383367276, + 88.67310984743949, + 89.78415357061374, + 87.56206612426524 + ], + [ + 717.4751621425639, + 89.07712574677555, + 90.1881694699498, + 87.96608202360136 + ], + [ + 721.1983859484003, + 89.48114164611167, + 90.59218536928591, + 88.37009792293742 + ], + [ + 724.9216097542367, + 89.78415357061374, + 90.79419331895394, + 88.77411382227353 + ], + [ + 728.644833560073, + 90.08716549511581, + 91.19820921829, + 88.97612177194156 + ], + [ + 732.3680573659094, + 90.49118139445187, + 91.60222511762612, + 89.38013767127762 + ], + [ + 736.0912811717453, + 90.89519729378799, + 92.00624101696218, + 89.78415357061374 + ], + [ + 739.8145049775817, + 91.29921319312405, + 92.4102569162983, + 90.1881694699498 + ], + [ + 743.5377287834181, + 91.60222511762612, + 92.61226486596632, + 90.59218536928591 + ], + [ + 747.2609525892544, + 92.00624101696218, + 93.01628076530244, + 90.99620126862197 + ], + [ + 750.9841763950908, + 92.30925294146425, + 93.4202966646385, + 91.19820921829 + ], + [ + 754.7074002009272, + 92.71326884080037, + 93.82431256397456, + 91.60222511762612 + ], + [ + 758.4306240067635, + 93.01628076530244, + 94.02632051364264, + 92.00624101696218 + ], + [ + 762.1538478125999, + 93.4202966646385, + 94.4303364129787, + 92.4102569162983 + ], + [ + 765.8770716184363, + 93.82431256397456, + 94.83435231231482, + 92.81427281563435 + ], + [ + 769.6002954242726, + 94.12732448847663, + 95.23836821165088, + 93.01628076530244 + ], + [ + 773.3235192301086, + 94.4303364129787, + 95.44037616131891, + 93.4202966646385 + ], + [ + 777.0467430359449, + 94.83435231231482, + 95.84439206065503, + 93.82431256397456 + ], + [ + 780.7699668417813, + 95.23836821165088, + 96.24840795999108, + 94.22832846331067 + ], + [ + 784.4931906476177, + 95.44037616131891, + 96.45041590965917, + 94.4303364129787 + ], + [ + 788.216414453454, + 96.45041590965917, + 96.85443180899523, + 96.04640001032305 + ], + [ + 791.9396382592904, + 96.6524238593272, + 97.25844770833129, + 96.04640001032305 + ], + [ + 795.6628620651268, + 96.85443180899523, + 97.6624636076674, + 96.04640001032305 + ], + [ + 799.3860858709631, + 96.95543578382927, + 97.86447155733543, + 96.04640001032305 + ], + [ + 803.1093096767995, + 97.25844770833129, + 98.26848745667155, + 96.24840795999108 + ], + [ + 806.8325334826359, + 97.56145963283336, + 98.67250335600761, + 96.45041590965917 + ], + [ + 810.5557572884718, + 97.86447155733543, + 98.87451130567564, + 96.85443180899523 + ], + [ + 814.2789810943082, + 98.26848745667155, + 99.27852720501176, + 97.25844770833129 + ], + [ + 818.0022049001445, + 98.57149938117357, + 99.48053515467979, + 97.6624636076674 + ], + [ + 821.7254287059809, + 98.87451130567564, + 99.8845510540159, + 97.86447155733543 + ], + [ + 825.4486525118173, + 99.27852720501176, + 100.28856695335196, + 98.26848745667155 + ], + [ + 829.1718763176536, + 99.48053515467979, + 100.49057490301999, + 98.47049540633958 + ], + [ + 832.89510012349, + 99.8845510540159, + 100.8945908023561, + 98.87451130567564 + ], + [ + 836.6183239293264, + 100.28856695335196, + 101.29860670169217, + 99.27852720501176 + ], + [ + 840.3415477351627, + 100.49057490301999, + 101.5006146513602, + 99.48053515467979 + ], + [ + 844.0647715409991, + 100.8945908023561, + 101.90463055069631, + 99.8845510540159 + ], + [ + 847.7879953468355, + 101.19760272685818, + 102.10663850036434, + 100.28856695335196 + ], + [ + 851.5112191526714, + 101.5006146513602, + 102.51065439970046, + 100.49057490301999 + ], + [ + 855.2344429585078, + 101.90463055069631, + 102.91467029903652, + 100.8945908023561 + ], + [ + 858.9576667643441, + 102.10663850036434, + 103.11667824870455, + 101.09659875202414 + ], + [ + 862.6808905701805, + 102.51065439970046, + 103.52069414804066, + 101.5006146513602 + ], + [ + 866.4041143760169, + 102.81366632420247, + 103.72270209770869, + 101.90463055069631 + ], + [ + 870.1273381818532, + 103.11667824870455, + 104.12671799704475, + 102.10663850036434 + ], + [ + 873.8505619876896, + 103.41969017320662, + 104.32872594671284, + 102.51065439970046 + ], + [ + 877.573785793526, + 103.72270209770869, + 104.7327418460489, + 102.71266234936849 + ], + [ + 881.2970095993624, + 104.02571402221076, + 104.93474979571693, + 103.11667824870455 + ], + [ + 885.0202334051987, + 104.42972992154682, + 105.33876569505304, + 103.52069414804066 + ], + [ + 888.7434572110346, + 104.7327418460489, + 105.7427815943891, + 103.72270209770869 + ], + [ + 892.466681016871, + 105.03575377055097, + 105.94478954405719, + 104.12671799704475 + ], + [ + 896.1899048227074, + 105.33876569505304, + 106.34880544339325, + 104.32872594671284 + ], + [ + 899.9131286285437, + 105.64177761955511, + 106.55081339306128, + 104.7327418460489 + ], + [ + 903.6363524343801, + 105.94478954405719, + 106.95482929239739, + 104.93474979571693 + ], + [ + 907.3595762402165, + 106.2478014685592, + 107.15683724206542, + 105.33876569505304 + ], + [ + 911.0828000460529, + 106.55081339306128, + 107.56085314140148, + 105.54077364472107 + ], + [ + 914.8060238518892, + 106.85382531756335, + 107.76286109106957, + 105.94478954405719 + ], + [ + 918.5292476577256, + 107.15683724206542, + 108.16687699040563, + 106.14679749372522 + ], + [ + 922.252471463562, + 107.4598491665675, + 108.36888494007366, + 106.55081339306128 + ], + [ + 925.9756952693979, + 107.76286109106957, + 108.77290083940977, + 106.7528213427293 + ], + [ + 929.6989190752342, + 108.06587301557158, + 108.9749087890778, + 107.15683724206542 + ], + [ + 933.4221428810706, + 108.26788096523967, + 109.17691673874583, + 107.35884519173345 + ], + [ + 937.145366686907, + 108.67189686457573, + 109.58093263808195, + 107.76286109106957 + ], + [ + 940.8685904927434, + 108.87390481424376, + 109.78294058774998, + 107.9648690407376 + ], + [ + 944.5918142985797, + 109.27792071357987, + 110.18695648708604, + 108.36888494007366 + ], + [ + 948.3150381044161, + 109.4799286632479, + 110.38896443675412, + 108.57089288974174 + ], + [ + 952.0382619102525, + 109.88394456258402, + 110.79298033609018, + 108.9749087890778 + ], + [ + 955.7614857160888, + 110.08595251225205, + 110.99498828575821, + 109.17691673874583 + ], + [ + 959.4847095219252, + 110.48996841158811, + 111.39900418509433, + 109.58093263808195 + ], + [ + 963.2079333277611, + 110.6919763612562, + 111.60101213476236, + 109.78294058774998 + ], + [ + 966.9311571335975, + 111.09599226059225, + 112.00502803409847, + 110.18695648708604 + ], + [ + 970.6543809394338, + 111.29800021026028, + 112.2070359837665, + 110.38896443675412 + ], + [ + 974.3776047452702, + 111.50000815992831, + 112.40904393343453, + 110.59097238642215 + ], + [ + 978.1008285511066, + 111.90402405926443, + 112.81305983277059, + 110.99498828575821 + ], + [ + 981.824052356943, + 112.10603200893246, + 113.01506778243868, + 111.1969962354263 + ], + [ + 985.5472761627793, + 112.51004790826858, + 113.41908368177474, + 111.60101213476236 + ], + [ + 989.2704999686157, + 112.7120558579366, + 113.62109163144277, + 111.80302008443039 + ], + [ + 992.9937237744521, + 113.01506778243868, + 113.82309958111085, + 112.2070359837665 + ], + [ + 996.7169475802884, + 113.31807970694075, + 114.22711548044691, + 112.40904393343453 + ], + [ + 1000.4401713861248, + 113.52008765660878, + 114.42912343011494, + 112.61105188310256 + ], + [ + 1004.1633951919607, + 113.92410355594484, + 114.83313932945106, + 113.01506778243868 + ], + [ + 1007.8866189977971, + 114.12611150561293, + 115.03514727911909, + 113.21707573210671 + ], + [ + 1011.6098428036335, + 114.42912343011494, + 115.23715522878712, + 113.62109163144277 + ], + [ + 1015.3330666094698, + 114.73213535461701, + 115.64117112812323, + 113.82309958111085 + ], + [ + 1019.0562904153062, + 114.93414330428504, + 115.84317907779126, + 114.02510753077888 + ], + [ + 1022.7795142211426, + 115.23715522878712, + 116.04518702745929, + 114.42912343011494 + ], + [ + 1026.502738026979, + 115.54016715328919, + 116.44920292679541, + 114.63113137978303 + ], + [ + 1030.2259618328153, + 115.74217510295722, + 116.65121087646344, + 114.83313932945106 + ], + [ + 1033.9491856386517, + 116.04518702745929, + 116.85321882613147, + 115.23715522878712 + ], + [ + 1037.672409444488, + 116.34819895196136, + 117.25723472546758, + 115.4391631784552 + ], + [ + 1041.395633250324, + 116.65121087646344, + 117.45924267513561, + 115.84317907779126 + ], + [ + 1045.1188570561603, + 116.85321882613147, + 117.66125062480364, + 116.04518702745929 + ], + [ + 1048.8420808619967, + 117.15623075063354, + 118.06526652413976, + 116.24719497712732 + ], + [ + 1052.565304667833, + 117.45924267513561, + 118.26727447380779, + 116.65121087646344 + ], + [ + 1056.2885284736694, + 117.66125062480364, + 118.46928242347582, + 116.85321882613147 + ], + [ + 1060.0117522795058, + 117.96426254930572, + 118.87329832281193, + 117.0552267757995 + ], + [ + 1063.7349760853422, + 118.26727447380779, + 119.07530627247996, + 117.45924267513561 + ], + [ + 1067.4581998911785, + 118.46928242347582, + 119.277314222148, + 117.66125062480364 + ], + [ + 1071.181423697015, + 118.77229434797789, + 119.68133012148405, + 117.86325857447167 + ], + [ + 1074.9046475028513, + 119.07530627247996, + 119.88333807115214, + 118.26727447380779 + ], + [ + 1078.6278713086872, + 119.277314222148, + 120.08534602082017, + 118.46928242347582 + ], + [ + 1082.3510951145236, + 119.37831819698204, + 120.08534602082017, + 118.67129037314385 + ], + [ + 1086.07431892036, + 119.58032614665007, + 120.08534602082017, + 119.07530627247996 + ], + [ + 1089.7975427261963, + 119.68133012148405, + 120.08534602082017, + 119.277314222148 + ], + [ + 1093.5207665320327, + 119.7823340963181, + 120.08534602082017, + 119.47932217181602 + ], + [ + 1097.243990337869, + 119.88333807115214, + 120.08534602082017, + 119.68133012148405 + ], + [ + 1160.5387950370864, + 124.93353681285322, + 125.7415686115254, + 124.12550501418104 + ], + [ + 1164.2620188429228, + 125.13554476252125, + 125.94357656119342, + 124.32751296384907 + ], + [ + 1167.9852426487591, + 125.43855668702332, + 126.34759246052948, + 124.5295209135171 + ], + [ + 1171.7084664545955, + 125.7415686115254, + 126.54960041019751, + 124.93353681285322 + ], + [ + 1175.4316902604319, + 125.94357656119342, + 126.7516083598656, + 125.13554476252125 + ], + [ + 1179.1549140662682, + 126.14558451086145, + 126.95361630953363, + 125.33755271218928 + ], + [ + 1182.8781378721046, + 126.34759246052948, + 127.15562425920166, + 125.53956066185731 + ], + [ + 1186.601361677941, + 126.7516083598656, + 127.55964015853777, + 125.94357656119342 + ], + [ + 1190.3245854837774, + 126.95361630953363, + 127.7616481082058, + 126.14558451086145 + ], + [ + 1194.0478092896133, + 127.15562425920166, + 127.96365605787383, + 126.34759246052948 + ], + [ + 1197.7710330954496, + 127.35763220886969, + 128.16566400754186, + 126.54960041019751 + ], + [ + 1201.494256901286, + 127.55964015853777, + 128.36767195720995, + 126.7516083598656 + ], + [ + 1205.2174807071224, + 127.96365605787383, + 128.771687856546, + 127.15562425920166 + ], + [ + 1208.9407045129587, + 128.16566400754186, + 128.97369580621404, + 127.35763220886969 + ], + [ + 1212.6639283187951, + 128.36767195720995, + 129.17570375588207, + 127.55964015853777 + ], + [ + 1216.3871521246315, + 128.56967990687798, + 129.37771170555015, + 127.7616481082058 + ], + [ + 1220.1103759304679, + 128.771687856546, + 129.57971965521818, + 127.96365605787383 + ], + [ + 1223.8335997363042, + 129.07469978104808, + 129.7817276048862, + 128.36767195720995 + ], + [ + 1227.5568235421406, + 129.37771170555015, + 130.18574350422233, + 128.56967990687798 + ], + [ + 1231.2800473479765, + 129.57971965521818, + 130.38775145389036, + 128.771687856546 + ], + [ + 1235.0032711538129, + 129.7817276048862, + 130.5897594035584, + 128.97369580621404 + ], + [ + 1238.7264949596492, + 129.98373555455424, + 130.79176735322642, + 129.17570375588207 + ], + [ + 1242.4497187654856, + 130.18574350422233, + 130.9937753028945, + 129.37771170555015 + ], + [ + 1246.172942571322, + 130.4887554287244, + 131.19578325256253, + 129.7817276048862 + ], + [ + 1249.8961663771584, + 130.79176735322642, + 131.5997991518986, + 129.98373555455424 + ], + [ + 1253.6193901829947, + 130.9937753028945, + 131.80180710156668, + 130.18574350422233 + ], + [ + 1257.342613988831, + 131.19578325256253, + 132.0038150512347, + 130.38775145389036 + ], + [ + 1261.0658377946675, + 131.39779120223056, + 132.20582300090274, + 130.5897594035584 + ], + [ + 1264.7890616005038, + 131.5997991518986, + 132.40783095057077, + 130.79176735322642 + ], + [ + 1268.5122854063397, + 131.90281107640067, + 132.6098389002388, + 131.19578325256253 + ], + [ + 1272.235509212176, + 132.1048190260687, + 132.81184684990689, + 131.39779120223056 + ], + [ + 1275.9587330180125, + 132.40783095057077, + 133.21586274924294, + 131.5997991518986 + ], + [ + 1279.6819568238489, + 132.6098389002388, + 133.41787069891097, + 131.80180710156668 + ], + [ + 1283.4051806296852, + 132.81184684990689, + 133.61987864857906, + 132.0038150512347 + ], + [ + 1287.1284044355216, + 133.01385479957491, + 133.8218865982471, + 132.20582300090274 + ], + [ + 1290.851628241358, + 133.21586274924294, + 134.02389454791512, + 132.40783095057077 + ], + [ + 1294.5748520471943, + 133.41787069891097, + 134.22590249758315, + 132.6098389002388 + ], + [ + 1298.2980758530307, + 133.72088262341305, + 134.42791044725124, + 133.01385479957491 + ], + [ + 1302.021299658867, + 133.92289057308108, + 134.62991839691927, + 133.21586274924294 + ], + [ + 1305.7445234647034, + 134.22590249758315, + 135.03393429625532, + 133.41787069891097 + ], + [ + 1309.4677472705393, + 134.42791044725124, + 135.2359422459234, + 133.61987864857906 + ], + [ + 1313.1909710763757, + 134.62991839691927, + 135.43795019559144, + 133.8218865982471 + ], + [ + 1316.914194882212, + 134.8319263465873, + 135.63995814525947, + 134.02389454791512 + ], + [ + 1320.6374186880485, + 135.03393429625532, + 135.8419660949275, + 134.22590249758315 + ], + [ + 1324.3606424938848, + 135.2359422459234, + 136.04397404459553, + 134.42791044725124 + ], + [ + 1328.0838662997212, + 135.53895417042543, + 136.24598199426362, + 134.8319263465873 + ], + [ + 1331.8070901055576, + 135.7409621200935, + 136.44798994393165, + 135.03393429625532 + ], + [ + 1335.530313911394, + 135.94297006976154, + 136.64999789359968, + 135.2359422459234 + ], + [ + 1339.2535377172303, + 136.14497801942957, + 136.8520058432677, + 135.43795019559144 + ], + [ + 1342.9767615230667, + 136.3469859690976, + 137.0540137929358, + 135.63995814525947 + ], + [ + 1346.6999853289026, + 136.64999789359968, + 137.45802969227185, + 135.8419660949275 + ], + [ + 1350.423209134739, + 136.8520058432677, + 137.66003764193988, + 136.04397404459553 + ], + [ + 1354.1464329405753, + 137.0540137929358, + 137.86204559160797, + 136.24598199426362 + ], + [ + 1357.8696567464117, + 137.25602174260382, + 138.064053541276, + 136.44798994393165 + ], + [ + 1361.592880552248, + 137.45802969227185, + 138.26606149094403, + 136.64999789359968 + ], + [ + 1365.3161043580844, + 137.66003764193988, + 138.46806944061206, + 136.8520058432677 + ], + [ + 1369.0393281639208, + 137.86204559160797, + 138.67007739028008, + 137.0540137929358 + ], + [ + 1372.7625519697572, + 138.16505751610998, + 138.87208533994817, + 137.45802969227185 + ], + [ + 1376.4857757755935, + 138.36706546577807, + 139.0740932896162, + 137.66003764193988 + ], + [ + 1380.20899958143, + 138.46806944061206, + 139.0740932896162, + 137.86204559160797 + ], + [ + 1383.9322233872658, + 138.67007739028008, + 139.27610123928423, + 138.064053541276 + ], + [ + 1387.6554471931022, + 138.77108136511413, + 139.27610123928423, + 138.26606149094403 + ], + [ + 1391.3786709989386, + 138.87208533994817, + 139.47810918895226, + 138.26606149094403 + ], + [ + 1395.101894804775, + 138.97308931478216, + 139.47810918895226, + 138.46806944061206 + ], + [ + 1398.8251186106113, + 138.97308931478216, + 139.47810918895226, + 138.46806944061206 + ], + [ + 1402.5483424164477, + 139.0740932896162, + 139.47810918895226, + 138.67007739028008 + ], + [ + 1406.271566222284, + 139.0740932896162, + 139.47810918895226, + 138.67007739028008 + ], + [ + 1409.9947900281204, + 139.0740932896162, + 139.47810918895226, + 138.67007739028008 + ], + [ + 1413.7180138339568, + 139.0740932896162, + 139.47810918895226, + 138.67007739028008 + ], + [ + 1417.4412376397931, + 138.97308931478216, + 139.47810918895226, + 138.46806944061206 + ], + [ + 1421.164461445629, + 138.87208533994817, + 139.47810918895226, + 138.26606149094403 + ], + [ + 1424.8876852514654, + 138.67007739028008, + 139.27610123928423, + 138.064053541276 + ], + [ + 1428.6109090573018, + 138.46806944061206, + 139.27610123928423, + 137.66003764193988 + ], + [ + 1432.3341328631382, + 138.26606149094403, + 139.0740932896162, + 137.45802969227185 + ], + [ + 1436.0573566689745, + 137.96304956644195, + 138.87208533994817, + 137.0540137929358 + ], + [ + 1439.780580474811, + 137.5590336671059, + 138.67007739028008, + 136.44798994393165 + ], + [ + 1443.5038042806473, + 137.15501776776978, + 138.46806944061206, + 135.8419660949275 + ], + [ + 1447.2270280864836, + 136.5489939187657, + 138.064053541276, + 135.03393429625532 + ], + [ + 1450.95025189232, + 135.8419660949275, + 137.66003764193988, + 134.02389454791512 + ], + [ + 1454.6734756981564, + 134.93293032142134, + 137.25602174260382, + 132.6098389002388 + ], + [ + 1458.3966995039927, + 133.8218865982471, + 136.8520058432677, + 130.79176735322642 + ], + [ + 1462.1199233098287, + 132.0038150512347, + 136.24598199426362, + 127.7616481082058 + ], + [ + 1465.843147115665, + 127.66064413337176, + 135.43795019559144, + 119.88333807115214 + ], + [ + 1469.5663709215014, + 125.84257258635938, + 134.42791044725124, + 117.25723472546758 + ], + [ + 1473.2895947273378, + 124.42851693868306, + 133.21586274924294, + 115.64117112812323 + ], + [ + 1477.0128185331741, + 122.91345731617275, + 131.5997991518986, + 114.22711548044691 + ], + [ + 1480.7360423390105, + 121.09538576916037, + 129.17570375588207, + 113.01506778243868 + ], + [ + 1484.4592661448469, + 116.65121087646344, + 121.2973937188284, + 112.00502803409847 + ], + [ + 1488.1824899506832, + 114.63113137978303, + 118.06526652413976, + 111.1969962354263 + ], + [ + 1491.9057137565196, + 113.31807970694075, + 116.24719497712732, + 110.38896443675412 + ], + [ + 1495.628937562356, + 112.2070359837665, + 114.63113137978303, + 109.78294058774998 + ], + [ + 1499.352161368192, + 111.39900418509433, + 113.62109163144277, + 109.17691673874583 + ], + [ + 1503.0753851740283, + 110.59097238642215, + 112.61105188310256, + 108.57089288974174 + ], + [ + 1506.7986089798646, + 109.78294058774998, + 111.60101213476236, + 107.9648690407376 + ], + [ + 1510.521832785701, + 109.17691673874583, + 110.79298033609018, + 107.56085314140148 + ], + [ + 1514.2450565915374, + 108.67189686457573, + 110.18695648708604, + 107.15683724206542 + ], + [ + 1517.9682803973737, + 108.16687699040563, + 109.58093263808195, + 106.7528213427293 + ], + [ + 1521.6915042032101, + 107.66185711623552, + 108.9749087890778, + 106.34880544339325 + ], + [ + 1525.4147280090465, + 107.15683724206542, + 108.36888494007366, + 105.94478954405719 + ], + [ + 1529.1379518148829, + 106.7528213427293, + 107.9648690407376, + 105.54077364472107 + ], + [ + 1532.8611756207192, + 106.34880544339325, + 107.35884519173345, + 105.33876569505304 + ], + [ + 1536.5843994265551, + 105.94478954405719, + 106.95482929239739, + 104.93474979571693 + ], + [ + 1540.3076232323915, + 105.64177761955511, + 106.55081339306128, + 104.7327418460489 + ], + [ + 1544.0308470382279, + 105.33876569505304, + 106.34880544339325, + 104.32872594671284 + ], + [ + 1547.7540708440642, + 105.03575377055097, + 105.94478954405719, + 104.12671799704475 + ], + [ + 1551.4772946499006, + 104.7327418460489, + 105.54077364472107, + 103.92471004737672 + ], + [ + 1555.200518455737, + 104.53073389638087, + 105.33876569505304, + 103.72270209770869 + ], + [ + 1558.9237422615734, + 104.32872594671284, + 105.13675774538501, + 103.52069414804066 + ], + [ + 1562.6469660674097, + 104.02571402221076, + 104.7327418460489, + 103.31868619837257 + ], + [ + 1566.370189873246, + 103.82370607254273, + 104.53073389638087, + 103.11667824870455 + ], + [ + 1570.0934136790825, + 103.62169812287465, + 104.32872594671284, + 102.91467029903652 + ], + [ + 1573.8166374849188, + 103.41969017320662, + 104.12671799704475, + 102.71266234936849 + ], + [ + 1577.5398612907547, + 103.21768222353859, + 103.92471004737672, + 102.51065439970046 + ], + [ + 1581.2630850965916, + 103.11667824870455, + 103.72270209770869, + 102.51065439970046 + ], + [ + 1584.9863089024275, + 102.91467029903652, + 103.52069414804066, + 102.30864645003237 + ], + [ + 1588.7095327082643, + 102.71266234936849, + 103.31868619837257, + 102.10663850036434 + ], + [ + 1592.4327565141002, + 102.71266234936849, + 103.31868619837257, + 102.10663850036434 + ], + [ + 1596.1559803199361, + 102.51065439970046, + 103.11667824870455, + 101.90463055069631 + ], + [ + 1599.879204125773, + 102.40965042486641, + 102.91467029903652, + 101.90463055069631 + ], + [ + 1603.6024279316089, + 102.30864645003237, + 102.91467029903652, + 101.70262260102828 + ], + [ + 1607.3256517374457, + 102.20764247519838, + 102.71266234936849, + 101.70262260102828 + ], + [ + 1611.0488755432816, + 102.0056345255303, + 102.51065439970046, + 101.5006146513602 + ], + [ + 1614.7720993491184, + 102.0056345255303, + 102.51065439970046, + 101.5006146513602 + ], + [ + 1618.4953231549543, + 102.0056345255303, + 102.51065439970046, + 101.5006146513602 + ], + [ + 1622.2185469607912, + 101.80362657586227, + 102.30864645003237, + 101.29860670169217 + ], + [ + 1625.941770766627, + 101.80362657586227, + 102.30864645003237, + 101.29860670169217 + ], + [ + 1629.664994572464, + 101.80362657586227, + 102.30864645003237, + 101.29860670169217 + ], + [ + 1633.3882183782998, + 101.70262260102828, + 102.10663850036434, + 101.29860670169217 + ], + [ + 1637.1114421841357, + 101.60161862619424, + 102.10663850036434, + 101.09659875202414 + ], + [ + 1640.8346659899726, + 101.60161862619424, + 102.10663850036434, + 101.09659875202414 + ], + [ + 1644.5578897958085, + 101.60161862619424, + 102.10663850036434, + 101.09659875202414 + ], + [ + 1648.2811136016453, + 101.5006146513602, + 101.90463055069631, + 101.09659875202414 + ], + [ + 1652.0043374074812, + 101.5006146513602, + 101.90463055069631, + 101.09659875202414 + ], + [ + 1655.727561213318, + 101.5006146513602, + 101.90463055069631, + 101.09659875202414 + ], + [ + 1659.450785019154, + 101.5006146513602, + 101.90463055069631, + 101.09659875202414 + ], + [ + 1663.1740088249908, + 101.5006146513602, + 101.90463055069631, + 101.09659875202414 + ], + [ + 1666.8972326308267, + 101.5006146513602, + 101.90463055069631, + 101.09659875202414 + ], + [ + 1670.6204564366626, + 101.5006146513602, + 101.90463055069631, + 101.09659875202414 + ], + [ + 1674.3436802424994, + 101.5006146513602, + 101.90463055069631, + 101.09659875202414 + ], + [ + 1678.0669040483353, + 101.60161862619424, + 102.10663850036434, + 101.09659875202414 + ], + [ + 1681.7901278541722, + 101.60161862619424, + 102.10663850036434, + 101.09659875202414 + ], + [ + 1685.513351660008, + 101.60161862619424, + 102.10663850036434, + 101.09659875202414 + ], + [ + 1689.236575465845, + 101.60161862619424, + 102.10663850036434, + 101.09659875202414 + ], + [ + 1692.9597992716808, + 101.70262260102828, + 102.10663850036434, + 101.29860670169217 + ], + [ + 1696.6830230775176, + 101.80362657586227, + 102.30864645003237, + 101.29860670169217 + ], + [ + 1700.4062468833536, + 101.80362657586227, + 102.30864645003237, + 101.29860670169217 + ], + [ + 1704.1294706891904, + 101.80362657586227, + 102.30864645003237, + 101.29860670169217 + ], + [ + 1707.8526944950263, + 102.0056345255303, + 102.51065439970046, + 101.5006146513602 + ], + [ + 1711.5759183008622, + 102.0056345255303, + 102.51065439970046, + 101.5006146513602 + ], + [ + 1715.299142106699, + 102.0056345255303, + 102.51065439970046, + 101.5006146513602 + ], + [ + 1719.022365912535, + 102.10663850036434, + 102.51065439970046, + 101.70262260102828 + ], + [ + 1722.7455897183718, + 102.10663850036434, + 102.51065439970046, + 101.70262260102828 + ], + [ + 1726.4688135242077, + 102.10663850036434, + 102.51065439970046, + 101.70262260102828 + ], + [ + 1730.1920373300445, + 102.10663850036434, + 102.51065439970046, + 101.70262260102828 + ], + [ + 1733.9152611358804, + 102.10663850036434, + 102.51065439970046, + 101.70262260102828 + ], + [ + 1737.6384849417173, + 102.0056345255303, + 102.51065439970046, + 101.5006146513602 + ], + [ + 1741.3617087475532, + 102.0056345255303, + 102.51065439970046, + 101.5006146513602 + ], + [ + 1745.084932553389, + 102.0056345255303, + 102.51065439970046, + 101.5006146513602 + ], + [ + 1748.808156359226, + 101.80362657586227, + 102.30864645003237, + 101.29860670169217 + ], + [ + 1752.5313801650618, + 101.70262260102828, + 102.30864645003237, + 101.09659875202414 + ], + [ + 1756.2546039708986, + 101.5006146513602, + 102.10663850036434, + 100.8945908023561 + ], + [ + 1759.9778277767346, + 101.39961067652621, + 102.10663850036434, + 100.69258285268802 + ], + [ + 1763.7010515825714, + 101.19760272685818, + 101.90463055069631, + 100.49057490301999 + ], + [ + 1767.4242753884073, + 100.8945908023561, + 101.70262260102828, + 100.08655900368393 + ], + [ + 1771.1474991942441, + 100.59157887785403, + 101.5006146513602, + 99.68254310434781 + ], + [ + 1774.87072300008, + 100.28856695335196, + 101.29860670169217, + 99.27852720501176 + ], + [ + 1778.5939468059169, + 99.8845510540159, + 101.09659875202414, + 98.67250335600761 + ], + [ + 1782.3171706117528, + 99.37953117984574, + 100.8945908023561, + 97.86447155733543 + ], + [ + 1786.0403944175887, + 98.57149938117357, + 100.49057490301999, + 96.6524238593272 + ], + [ + 1789.7636182234255, + 97.56145963283336, + 100.08655900368393, + 93.82431256397456 + ], + [ + 1793.4868420292614, + 92.61226486596632, + 99.48053515467979, + 87.15805022492918 + ], + [ + 1797.2100658350982, + 90.99620126862197, + 99.07651925534373, + 84.12793097990851 + ], + [ + 1800.9332896409342, + 89.38013767127762, + 98.26848745667155, + 81.90584353356007 + ], + [ + 1804.656513446771, + 87.96608202360136, + 97.25844770833129, + 80.0877719865477 + ], + [ + 1808.379737252607, + 86.14801047658898, + 95.44037616131891, + 78.26970043953526 + ], + [ + 1812.1029610584437, + 82.6128713573982, + 88.37009792293742, + 76.85564479185899 + ], + [ + 1815.8261848642796, + 80.28977993621572, + 85.13797072824872, + 75.44158914418267 + ], + [ + 1819.5494086701165, + 78.47170838920334, + 82.71387533223225, + 74.22954144617444 + ], + [ + 1823.2726324759524, + 76.85564479185899, + 80.69379583555178, + 73.01749374816615 + ], + [ + 1826.9958562817883, + 75.34058516934869, + 78.8757242885394, + 71.80544605015791 + ], + [ + 1830.7190800876251, + 74.1285374713404, + 77.46166864086308, + 70.7954063018177 + ], + [ + 1834.442303893461, + 72.81548579849812, + 76.04761299318682, + 69.58335860380942 + ], + [ + 1838.1655276992979, + 71.60343810048983, + 74.6335573455105, + 68.57331885546921 + ], + [ + 1841.8887515051338, + 70.59339835214962, + 73.42150964750226, + 67.76528705679709 + ], + [ + 1845.6119753109706, + 69.48235462897537, + 72.20946194949397, + 66.75524730845689 + ], + [ + 1849.3351991168065, + 68.57331885546921, + 71.19942220115377, + 65.94721550978466 + ], + [ + 1853.0584229226433, + 67.66428308196305, + 70.18938245281356, + 65.13918371111254 + ], + [ + 1856.7816467284792, + 66.75524730845689, + 69.17934270447336, + 64.3311519124403 + ], + [ + 1860.5048705343152, + 65.84621153495061, + 68.16930295613315, + 63.52312011376819 + ], + [ + 1864.228094340152, + 64.93717576144445, + 67.15926320779295, + 62.715088315095954 + ], + [ + 1867.951318145988, + 64.12914396277233, + 66.35123140912071, + 61.907056516423836 + ], + [ + 1871.6745419518247, + 63.3211121641001, + 65.5431996104486, + 61.099024717751604 + ], + [ + 1875.3977657576606, + 62.61408434026191, + 64.73516781177636, + 60.49300086874746 + ], + [ + 1879.1209895634975, + 61.80605254158979, + 63.927136013104246, + 59.68496907007534 + ], + [ + 1882.8442133693334, + 61.099024717751604, + 63.119104214432014, + 59.078945221071194 + ], + [ + 1886.5674371751702, + 60.39199689391353, + 62.311072415759895, + 58.47292137206705 + ], + [ + 1890.290660981006, + 59.68496907007534, + 61.50304061708766, + 57.8668975230629 + ], + [ + 1894.013884786843, + 59.078945221071194, + 60.89701676808363, + 57.26087367405887 + ], + [ + 1897.7371085926789, + 58.270913422399076, + 60.0889849694114, + 56.45284187538664 + ], + [ + 1901.4603323985148, + 57.66488957339493, + 59.48296112040725, + 55.84681802638249 + ], + [ + 1905.1835562043516, + 57.15986969922483, + 58.87693727140311, + 55.442802127046434 + ], + [ + 1908.9067800101875, + 56.55384585022068, + 58.270913422399076, + 54.83677827804229 + ], + [ + 1912.6300038160243, + 55.84681802638249, + 57.462881623726844, + 54.23075442903814 + ], + [ + 1916.3532276218602, + 55.24079417737835, + 56.8568577747227, + 53.624730580034 + ], + [ + 1920.076451427697, + 54.6347703283742, + 56.25083392571855, + 53.018706731029965 + ], + [ + 1923.799675233533, + 54.1297504542041, + 55.64481007671452, + 52.61469083169379 + ], + [ + 1927.5228990393698, + 53.624730580034, + 55.24079417737835, + 52.00866698268965 + ], + [ + 1931.2461228452057, + 53.018706731029965, + 54.6347703283742, + 51.402643133685615 + ], + [ + 1934.9693466510425, + 52.51368685685986, + 54.02874647937017, + 50.99862723434944 + ], + [ + 1938.6925704568785, + 51.90766300785572, + 53.422722630366025, + 50.39260338534541 + ], + [ + 1942.4157942627144, + 51.402643133685615, + 52.81669878136188, + 49.98858748600924 + ], + [ + 1946.1390180685512, + 50.99862723434944, + 52.41268288202582, + 49.58457158667318 + ], + [ + 1949.862241874387, + 50.39260338534541, + 51.806659033021674, + 48.97854773766903 + ], + [ + 1953.585465680224, + 49.98858748600924, + 51.402643133685615, + 48.57453183833297 + ], + [ + 1957.3086894860598, + 49.483567611839135, + 50.79661928468147, + 48.170515938996914 + ], + [ + 1961.0319132918967, + 48.97854773766903, + 50.39260338534541, + 47.56449208999277 + ], + [ + 1964.7551370977326, + 48.47352786349893, + 49.786579536341264, + 47.16047619065671 + ], + [ + 1968.4783609035694, + 48.06951196416287, + 49.38256363700509, + 46.756460291320536 + ], + [ + 1972.2015847094053, + 47.66549606482681, + 48.97854773766903, + 46.35244439198448 + ], + [ + 1975.9248085152412, + 47.16047619065671, + 48.37252388866489, + 45.94842849264842 + ], + [ + 1979.648032321078, + 46.65545631648661, + 47.96850798932883, + 45.34240464364427 + ], + [ + 1983.371256126914, + 46.251440417150434, + 47.56449208999277, + 44.93838874430821 + ], + [ + 1987.0944799327508, + 45.74642054298033, + 46.95846824098862, + 44.534372844972154 + ], + [ + 1990.8177037385867, + 45.34240464364427, + 46.55445234165256, + 44.13035694563598 + ], + [ + 1994.5409275444235, + 44.93838874430821, + 46.150436442316504, + 43.72634104629992 + ], + [ + 1998.2641513502595, + 44.43336887013811, + 45.74642054298033, + 43.120317197295776 + ], + [ + 2001.9873751560963, + 44.02935297080205, + 45.34240464364427, + 42.71630129795972 + ], + [ + 2005.7105989619322, + 43.52433309663195, + 44.93838874430821, + 42.11027744895557 + ], + [ + 2009.433822767769, + 43.120317197295776, + 44.534372844972154, + 41.70626154961951 + ], + [ + 2013.157046573605, + 42.71630129795972, + 44.13035694563598, + 41.30224565028345 + ], + [ + 2016.8802703794408, + 42.211281423789615, + 43.52433309663195, + 40.898229750947394 + ], + [ + 2020.6034941852777, + 41.807265524453555, + 42.9183092476278, + 40.69622180127931 + ], + [ + 2024.3267179911136, + 41.403249625117496, + 42.51429334829163, + 40.29220590194325 + ], + [ + 2028.0499417969504, + 40.99923372578132, + 42.11027744895557, + 39.888190002607075 + ], + [ + 2031.7731656027863, + 40.69622180127931, + 41.70626154961951, + 39.6861820529391 + ], + [ + 2035.4963894086231, + 40.29220590194325, + 41.30224565028345, + 39.28216615360304 + ], + [ + 2039.219613214459, + 39.98919397744112, + 40.898229750947394, + 39.08015820393496 + ], + [ + 2042.9428370202959, + 39.787186027773146, + 40.69622180127931, + 38.87815025426687 + ], + [ + 2046.6660608261318, + 39.38317012843697, + 40.29220590194325, + 38.47413435493081 + ], + [ + 2050.3892846319677, + 39.181162178769, + 40.09019795227516, + 38.27212640526284 + ], + [ + 2054.1125084378045, + 38.87815025426687, + 39.6861820529391, + 38.07011845559475 + ], + [ + 2057.8357322436405, + 38.6761423045989, + 39.484174103271016, + 37.868110505926666 + ], + [ + 2061.5589560494773, + 38.47413435493081, + 39.28216615360304, + 37.66610255625869 + ], + [ + 2065.282179855313, + 38.171122430428795, + 38.87815025426687, + 37.464094606590606 + ], + [ + 2069.00540366115, + 37.868110505926666, + 38.6761423045989, + 37.06007870725455 + ], + [ + 2072.728627466986, + 37.66610255625869, + 38.47413435493081, + 36.85807075758646 + ], + [ + 2076.4518512728228, + 37.464094606590606, + 38.27212640526284, + 36.65606280791849 + ], + [ + 2080.1750750786587, + 37.26208665692252, + 38.07011845559475, + 36.4540548582504 + ], + [ + 2083.8982988844955, + 37.06007870725455, + 37.868110505926666, + 36.252046908582315 + ], + [ + 2087.6215226903314, + 36.85807075758646, + 37.66610255625869, + 36.05003895891434 + ], + [ + 2091.3447464961673, + 36.65606280791849, + 37.464094606590606, + 35.848031009246256 + ], + [ + 2095.067970302004, + 36.555058833084445, + 37.26208665692252, + 35.848031009246256 + ], + [ + 2098.79119410784, + 36.35305088341636, + 37.06007870725455, + 35.64602305957817 + ], + [ + 2102.514417913677, + 36.151042933748386, + 36.85807075758646, + 35.4440151099102 + ], + [ + 2106.237641719513, + 35.9490349840803, + 36.65606280791849, + 35.24200716024211 + ], + [ + 2109.9608655253496, + 35.74702703441221, + 36.4540548582504, + 35.03999921057414 + ], + [ + 2113.6840893311855, + 35.54501908474424, + 36.252046908582315, + 34.83799126090605 + ], + [ + 2117.4073131370224, + 35.34301113507615, + 36.05003895891434, + 34.635983311237965 + ], + [ + 2121.1305369428583, + 35.24200716024211, + 35.848031009246256, + 34.635983311237965 + ], + [ + 2124.853760748695, + 35.03999921057414, + 35.64602305957817, + 34.43397536156999 + ], + [ + 2128.576984554531, + 34.83799126090605, + 35.4440151099102, + 34.231967411901906 + ], + [ + 2132.300208360367, + 34.73698728607201, + 35.4440151099102, + 34.02995946223393 + ], + [ + 2136.0234321662037, + 34.534979336404035, + 35.24200716024211, + 33.827951512565846 + ], + [ + 2139.7466559720397, + 34.43397536156999, + 35.03999921057414, + 33.827951512565846 + ], + [ + 2143.4698797778765, + 34.231967411901906, + 34.83799126090605, + 33.62594356289776 + ], + [ + 2147.1931035837124, + 34.02995946223393, + 34.635983311237965, + 33.42393561322979 + ], + [ + 2150.916327389549, + 33.92895548739989, + 34.635983311237965, + 33.2219276635617 + ], + [ + 2154.639551195385, + 33.827951512565846, + 34.43397536156999, + 33.2219276635617 + ], + [ + 2158.362775001222, + 33.62594356289776, + 34.231967411901906, + 33.019919713893614 + ], + [ + 2162.085998807058, + 33.42393561322979, + 34.02995946223393, + 32.81791176422564 + ], + [ + 2165.809222612894, + 33.42393561322979, + 34.02995946223393, + 32.81791176422564 + ], + [ + 2169.5324464187306, + 33.2219276635617, + 33.827951512565846, + 32.615903814557555 + ], + [ + 2173.2556702245665, + 33.019919713893614, + 33.62594356289776, + 32.41389586488958 + ], + [ + 2176.9788940304034, + 33.019919713893614, + 33.62594356289776, + 32.41389586488958 + ], + [ + 2180.7021178362393, + 32.81791176422564, + 33.42393561322979, + 32.211887915221496 + ], + [ + 2184.425341642076, + 32.7169077893916, + 33.2219276635617, + 32.211887915221496 + ], + [ + 2188.148565447912, + 32.615903814557555, + 33.2219276635617, + 32.00987996555341 + ], + [ + 2191.871789253749, + 32.41389586488958, + 33.019919713893614, + 31.807872015885437 + ], + [ + 2195.5950130595847, + 32.31289189005554, + 32.81791176422564, + 31.807872015885437 + ], + [ + 2199.3182368654216, + 32.211887915221496, + 32.81791176422564, + 31.60586406621735 + ], + [ + 2203.0414606712575, + 32.00987996555341, + 32.615903814557555, + 31.403856116549377 + ], + [ + 2206.7646844770934, + 31.90887599071948, + 32.41389586488958, + 31.403856116549377 + ], + [ + 2210.48790828293, + 31.807872015885437, + 32.41389586488958, + 31.20184816688129 + ], + [ + 2214.211132088766, + 31.706868041051393, + 32.211887915221496, + 31.20184816688129 + ], + [ + 2217.934355894603, + 31.60586406621735, + 32.211887915221496, + 30.999840217213205 + ], + [ + 2221.657579700439, + 31.504860091383307, + 32.00987996555341, + 30.999840217213205 + ], + [ + 2225.3808035062757, + 31.403856116549377, + 32.00987996555341, + 30.797832267545232 + ], + [ + 2229.1040273121116, + 31.302852141715334, + 31.807872015885437, + 30.797832267545232 + ], + [ + 2232.8272511179484, + 31.100844192047248, + 31.60586406621735, + 30.595824317877145 + ], + [ + 2236.5504749237843, + 31.100844192047248, + 31.60586406621735, + 30.595824317877145 + ], + [ + 2240.273698729621, + 30.89883624237916, + 31.403856116549377, + 30.39381636820906 + ], + [ + 2243.996922535457, + 30.89883624237916, + 31.403856116549377, + 30.39381636820906 + ], + [ + 2247.720146341293, + 30.69682829271119, + 31.20184816688129, + 30.191808418541086 + ], + [ + 2251.44337014713, + 30.69682829271119, + 31.20184816688129, + 30.191808418541086 + ], + [ + 2255.1665939529657, + 30.494820343043102, + 30.999840217213205, + 29.989800468873 + ], + [ + 2258.8898177588026, + 30.494820343043102, + 30.999840217213205, + 29.989800468873 + ], + [ + 2262.6130415646385, + 30.29281239337513, + 30.797832267545232, + 29.787792519205027 + ], + [ + 2266.3362653704753, + 30.29281239337513, + 30.797832267545232, + 29.787792519205027 + ], + [ + 2270.059489176311, + 30.090804443707043, + 30.595824317877145, + 29.58578456953694 + ], + [ + 2273.782712982148, + 30.090804443707043, + 30.595824317877145, + 29.58578456953694 + ], + [ + 2277.505936787984, + 29.888796494038957, + 30.39381636820906, + 29.383776619868854 + ], + [ + 2281.22916059382, + 29.888796494038957, + 30.39381636820906, + 29.383776619868854 + ], + [ + 2284.9523843996567, + 29.686788544370984, + 30.191808418541086, + 29.18176867020088 + ], + [ + 2288.6756082054926, + 29.686788544370984, + 30.191808418541086, + 29.18176867020088 + ], + [ + 2292.3988320113294, + 29.58578456953694, + 30.191808418541086, + 28.979760720532795 + ], + [ + 2296.1220558171653, + 29.484780594702897, + 29.989800468873, + 28.979760720532795 + ], + [ + 2299.845279623002, + 29.383776619868854, + 29.989800468873, + 28.777752770864822 + ], + [ + 2303.568503428838, + 29.282772645034925, + 29.787792519205027, + 28.777752770864822 + ], + [ + 2307.291727234675, + 29.282772645034925, + 29.787792519205027, + 28.777752770864822 + ], + [ + 2311.014951040511, + 29.080764695366838, + 29.58578456953694, + 28.575744821196736 + ], + [ + 2314.7381748463476, + 29.080764695366838, + 29.58578456953694, + 28.575744821196736 + ], + [ + 2318.4613986521836, + 28.87875674569875, + 29.383776619868854, + 28.37373687152865 + ], + [ + 2322.1846224580195, + 28.87875674569875, + 29.383776619868854, + 28.37373687152865 + ], + [ + 2325.9078462638563, + 28.87875674569875, + 29.383776619868854, + 28.37373687152865 + ], + [ + 2329.631070069692, + 28.67674879603078, + 29.18176867020088, + 28.171728921860677 + ], + [ + 2333.354293875529, + 28.67674879603078, + 29.18176867020088, + 28.171728921860677 + ], + [ + 2337.077517681365, + 28.474740846362693, + 28.979760720532795, + 27.96972097219259 + ], + [ + 2340.800741487202, + 28.474740846362693, + 28.979760720532795, + 27.96972097219259 + ], + [ + 2344.5239652930377, + 28.474740846362693, + 28.979760720532795, + 27.96972097219259 + ], + [ + 2348.2471890988745, + 28.272732896694606, + 28.777752770864822, + 27.767713022524504 + ], + [ + 2351.9704129047104, + 28.272732896694606, + 28.777752770864822, + 27.767713022524504 + ], + [ + 2355.6936367105463, + 28.272732896694606, + 28.777752770864822, + 27.767713022524504 + ], + [ + 2359.416860516383, + 28.070724947026633, + 28.575744821196736, + 27.56570507285653 + ], + [ + 2363.140084322219, + 28.070724947026633, + 28.575744821196736, + 27.56570507285653 + ], + [ + 2366.863308128056, + 27.868716997358547, + 28.37373687152865, + 27.363697123188444 + ], + [ + 2370.586531933892, + 27.868716997358547, + 28.37373687152865, + 27.363697123188444 + ], + [ + 2374.3097557397286, + 27.868716997358547, + 28.37373687152865, + 27.363697123188444 + ], + [ + 2378.0329795455646, + 27.666709047690574, + 28.171728921860677, + 27.16168917352047 + ], + [ + 2381.7562033514014, + 27.666709047690574, + 28.171728921860677, + 27.16168917352047 + ], + [ + 2385.4794271572373, + 27.666709047690574, + 28.171728921860677, + 27.16168917352047 + ], + [ + 2389.202650963074, + 27.464701098022488, + 27.96972097219259, + 26.959681223852385 + ], + [ + 2392.92587476891, + 27.464701098022488, + 27.96972097219259, + 26.959681223852385 + ], + [ + 2396.649098574746, + 27.464701098022488, + 27.96972097219259, + 26.959681223852385 + ], + [ + 2400.372322380583, + 27.2626931483544, + 27.767713022524504, + 26.7576732741843 + ], + [ + 2404.0955461864187, + 27.2626931483544, + 27.767713022524504, + 26.7576732741843 + ], + [ + 2407.8187699922555, + 27.2626931483544, + 27.767713022524504, + 26.7576732741843 + ], + [ + 2411.5419937980914, + 27.16168917352047, + 27.56570507285653, + 26.7576732741843 + ], + [ + 2415.2652176039282, + 27.06068519868643, + 27.56570507285653, + 26.555665324516326 + ], + [ + 2418.988441409764, + 27.06068519868643, + 27.56570507285653, + 26.555665324516326 + ], + [ + 2422.711665215601, + 26.959681223852385, + 27.363697123188444, + 26.555665324516326 + ], + [ + 2426.434889021437, + 26.858677249018342, + 27.363697123188444, + 26.35365737484824 + ], + [ + 2430.1581128272737, + 26.858677249018342, + 27.363697123188444, + 26.35365737484824 + ], + [ + 2433.8813366331096, + 26.858677249018342, + 27.363697123188444, + 26.35365737484824 + ], + [ + 2437.6045604389456, + 26.65666929935037, + 27.16168917352047, + 26.151649425180153 + ], + [ + 2441.3277842447824, + 26.65666929935037, + 27.16168917352047, + 26.151649425180153 + ], + [ + 2445.0510080506183, + 26.65666929935037, + 27.16168917352047, + 26.151649425180153 + ], + [ + 2448.774231856455, + 26.555665324516326, + 26.959681223852385, + 26.151649425180153 + ], + [ + 2452.497455662291, + 26.454661349682283, + 26.959681223852385, + 25.94964147551218 + ], + [ + 2456.220679468128, + 26.454661349682283, + 26.959681223852385, + 25.94964147551218 + ], + [ + 2459.9439032739638, + 26.454661349682283, + 26.959681223852385, + 25.94964147551218 + ], + [ + 2463.6671270798006, + 26.252653400014196, + 26.7576732741843, + 25.747633525844094 + ], + [ + 2467.3903508856365, + 26.252653400014196, + 26.7576732741843, + 25.747633525844094 + ], + [ + 2471.1135746914724, + 26.252653400014196, + 26.7576732741843, + 25.747633525844094 + ], + [ + 2474.8367984973092, + 26.151649425180153, + 26.555665324516326, + 25.747633525844094 + ], + [ + 2478.560022303145, + 26.050645450346224, + 26.555665324516326, + 25.54562557617612 + ], + [ + 2482.283246108982, + 26.050645450346224, + 26.555665324516326, + 25.54562557617612 + ], + [ + 2486.006469914818, + 26.050645450346224, + 26.555665324516326, + 25.54562557617612 + ], + [ + 2489.7296937206547, + 25.94964147551218, + 26.35365737484824, + 25.54562557617612 + ], + [ + 2493.4529175264906, + 25.848637500678137, + 26.35365737484824, + 25.343617626508035 + ], + [ + 2497.1761413323275, + 25.848637500678137, + 26.35365737484824, + 25.343617626508035 + ], + [ + 2500.8993651381634, + 25.848637500678137, + 26.35365737484824, + 25.343617626508035 + ], + [ + 2504.622588944, + 25.747633525844094, + 26.151649425180153, + 25.343617626508035 + ], + [ + 2508.345812749836, + 25.64662955101005, + 26.151649425180153, + 25.14160967683995 + ], + [ + 2512.069036555672, + 25.64662955101005, + 26.151649425180153, + 25.14160967683995 + ], + [ + 2515.792260361509, + 25.64662955101005, + 26.151649425180153, + 25.14160967683995 + ], + [ + 2519.5154841673448, + 25.54562557617612, + 25.94964147551218, + 25.14160967683995 + ], + [ + 2523.2387079731816, + 25.54562557617612, + 25.94964147551218, + 25.14160967683995 + ], + [ + 2526.9619317790175, + 25.444621601342078, + 25.94964147551218, + 24.939601727171976 + ], + [ + 2530.6851555848543, + 25.444621601342078, + 25.94964147551218, + 24.939601727171976 + ], + [ + 2534.4083793906902, + 25.444621601342078, + 25.94964147551218, + 24.939601727171976 + ], + [ + 2538.131603196527, + 25.343617626508035, + 25.747633525844094, + 24.939601727171976 + ], + [ + 2541.854827002363, + 25.24261365167399, + 25.747633525844094, + 24.73759377750389 + ], + [ + 2545.578050808199, + 25.24261365167399, + 25.747633525844094, + 24.73759377750389 + ], + [ + 2549.3012746140357, + 25.24261365167399, + 25.747633525844094, + 24.73759377750389 + ], + [ + 2553.0244984198716, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 2556.7477222257085, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 2560.4709460315444, + 25.04060570200602, + 25.54562557617612, + 24.535585827835916 + ], + [ + 2564.194169837381, + 25.04060570200602, + 25.54562557617612, + 24.535585827835916 + ], + [ + 2567.917393643217, + 25.04060570200602, + 25.54562557617612, + 24.535585827835916 + ], + [ + 2571.640617449054, + 24.939601727171976, + 25.343617626508035, + 24.535585827835916 + ], + [ + 2575.36384125489, + 24.939601727171976, + 25.343617626508035, + 24.535585827835916 + ], + [ + 2579.0870650607267, + 24.838597752337932, + 25.343617626508035, + 24.33357787816783 + ], + [ + 2582.8102888665626, + 24.838597752337932, + 25.343617626508035, + 24.33357787816783 + ], + [ + 2586.5335126723985, + 24.838597752337932, + 25.343617626508035, + 24.33357787816783 + ], + [ + 2590.2567364782353, + 24.73759377750389, + 25.14160967683995, + 24.33357787816783 + ], + [ + 2593.9799602840712, + 24.73759377750389, + 25.14160967683995, + 24.33357787816783 + ], + [ + 2597.703184089908, + 24.636589802669846, + 25.14160967683995, + 24.131569928499744 + ], + [ + 2601.426407895744, + 24.636589802669846, + 25.14160967683995, + 24.131569928499744 + ], + [ + 2605.149631701581, + 24.636589802669846, + 25.14160967683995, + 24.131569928499744 + ], + [ + 2608.8728555074167, + 24.636589802669846, + 25.14160967683995, + 24.131569928499744 + ], + [ + 2612.5960793132535, + 24.535585827835916, + 24.939601727171976, + 24.131569928499744 + ], + [ + 2616.3193031190895, + 24.535585827835916, + 24.939601727171976, + 24.131569928499744 + ], + [ + 2620.0425269249263, + 24.434581853001873, + 24.939601727171976, + 23.92956197883177 + ], + [ + 2623.765750730762, + 24.434581853001873, + 24.939601727171976, + 23.92956197883177 + ], + [ + 2627.488974536598, + 24.434581853001873, + 24.939601727171976, + 23.92956197883177 + ], + [ + 2631.212198342435, + 24.434581853001873, + 24.939601727171976, + 23.92956197883177 + ], + [ + 2634.935422148271, + 24.33357787816783, + 24.73759377750389, + 23.92956197883177 + ], + [ + 2638.6586459541077, + 24.33357787816783, + 24.73759377750389, + 23.92956197883177 + ], + [ + 2642.3818697599436, + 24.232573903333787, + 24.73759377750389, + 23.727554029163684 + ], + [ + 2646.1050935657804, + 24.232573903333787, + 24.73759377750389, + 23.727554029163684 + ], + [ + 2649.8283173716163, + 24.232573903333787, + 24.73759377750389, + 23.727554029163684 + ], + [ + 2653.551541177453, + 24.232573903333787, + 24.73759377750389, + 23.727554029163684 + ], + [ + 2657.274764983289, + 24.131569928499744, + 24.535585827835916, + 23.727554029163684 + ], + [ + 2660.997988789125, + 24.131569928499744, + 24.535585827835916, + 23.727554029163684 + ], + [ + 2664.721212594962, + 24.131569928499744, + 24.535585827835916, + 23.727554029163684 + ], + [ + 2668.4444364007977, + 24.0305659536657, + 24.535585827835916, + 23.525546079495598 + ], + [ + 2672.1676602066345, + 24.0305659536657, + 24.535585827835916, + 23.525546079495598 + ], + [ + 2675.8908840124705, + 24.0305659536657, + 24.535585827835916, + 23.525546079495598 + ], + [ + 2679.6141078183073, + 24.0305659536657, + 24.535585827835916, + 23.525546079495598 + ], + [ + 2683.337331624143, + 23.92956197883177, + 24.33357787816783, + 23.525546079495598 + ], + [ + 2687.06055542998, + 23.92956197883177, + 24.33357787816783, + 23.525546079495598 + ], + [ + 2690.783779235816, + 23.92956197883177, + 24.33357787816783, + 23.525546079495598 + ], + [ + 2694.5070030416528, + 23.828558003997728, + 24.33357787816783, + 23.323538129827625 + ], + [ + 2698.2302268474887, + 23.828558003997728, + 24.33357787816783, + 23.323538129827625 + ], + [ + 2701.9534506533246, + 23.828558003997728, + 24.33357787816783, + 23.323538129827625 + ], + [ + 2705.6766744591614, + 23.828558003997728, + 24.33357787816783, + 23.323538129827625 + ], + [ + 2709.3998982649973, + 23.727554029163684, + 24.131569928499744, + 23.323538129827625 + ], + [ + 2713.123122070834, + 23.727554029163684, + 24.131569928499744, + 23.323538129827625 + ], + [ + 2716.84634587667, + 23.727554029163684, + 24.131569928499744, + 23.323538129827625 + ], + [ + 2720.569569682507, + 23.727554029163684, + 24.131569928499744, + 23.323538129827625 + ], + [ + 2724.292793488343, + 23.62655005432964, + 24.131569928499744, + 23.12153018015954 + ], + [ + 2728.0160172941796, + 23.62655005432964, + 24.131569928499744, + 23.12153018015954 + ], + [ + 2731.7392411000155, + 23.62655005432964, + 24.131569928499744, + 23.12153018015954 + ], + [ + 2735.4624649058524, + 23.62655005432964, + 24.131569928499744, + 23.12153018015954 + ], + [ + 2739.1856887116883, + 23.525546079495598, + 23.92956197883177, + 23.12153018015954 + ], + [ + 2742.908912517524, + 23.525546079495598, + 23.92956197883177, + 23.12153018015954 + ], + [ + 2746.632136323361, + 23.525546079495598, + 23.92956197883177, + 23.12153018015954 + ], + [ + 2750.355360129197, + 23.525546079495598, + 23.92956197883177, + 23.12153018015954 + ], + [ + 2754.0785839350337, + 23.525546079495598, + 23.92956197883177, + 23.12153018015954 + ], + [ + 2757.8018077408697, + 23.42454210466167, + 23.92956197883177, + 22.919522230491566 + ], + [ + 2761.5250315467065, + 23.42454210466167, + 23.92956197883177, + 22.919522230491566 + ], + [ + 2765.2482553525424, + 23.42454210466167, + 23.92956197883177, + 22.919522230491566 + ], + [ + 2768.971479158379, + 23.42454210466167, + 23.92956197883177, + 22.919522230491566 + ], + [ + 2772.694702964215, + 23.323538129827625, + 23.727554029163684, + 22.919522230491566 + ], + [ + 2776.417926770051, + 23.323538129827625, + 23.727554029163684, + 22.919522230491566 + ], + [ + 2780.141150575888, + 23.323538129827625, + 23.727554029163684, + 22.919522230491566 + ], + [ + 2783.864374381724, + 23.323538129827625, + 23.727554029163684, + 22.919522230491566 + ], + [ + 2787.5875981875606, + 23.323538129827625, + 23.727554029163684, + 22.919522230491566 + ], + [ + 2791.3108219933965, + 23.323538129827625, + 23.727554029163684, + 22.919522230491566 + ], + [ + 2795.0340457992334, + 23.222534154993582, + 23.727554029163684, + 22.71751428082348 + ], + [ + 2798.7572696050693, + 23.222534154993582, + 23.727554029163684, + 22.71751428082348 + ], + [ + 2802.480493410906, + 23.222534154993582, + 23.727554029163684, + 22.71751428082348 + ], + [ + 2806.203717216742, + 23.222534154993582, + 23.727554029163684, + 22.71751428082348 + ], + [ + 2809.926941022579, + 23.222534154993582, + 23.727554029163684, + 22.71751428082348 + ], + [ + 2813.6501648284147, + 23.12153018015954, + 23.525546079495598, + 22.71751428082348 + ], + [ + 2817.3733886342507, + 23.12153018015954, + 23.525546079495598, + 22.71751428082348 + ], + [ + 2821.0966124400875, + 23.12153018015954, + 23.525546079495598, + 22.71751428082348 + ], + [ + 2824.8198362459234, + 23.12153018015954, + 23.525546079495598, + 22.71751428082348 + ], + [ + 2828.54306005176, + 23.12153018015954, + 23.525546079495598, + 22.71751428082348 + ], + [ + 2832.266283857596, + 23.12153018015954, + 23.525546079495598, + 22.71751428082348 + ], + [ + 2835.989507663433, + 23.12153018015954, + 23.525546079495598, + 22.71751428082348 + ], + [ + 2839.712731469269, + 23.020526205325496, + 23.525546079495598, + 22.515506331155393 + ], + [ + 2843.4359552751057, + 23.020526205325496, + 23.525546079495598, + 22.515506331155393 + ], + [ + 2847.1591790809416, + 23.020526205325496, + 23.525546079495598, + 22.515506331155393 + ], + [ + 2850.8824028867775, + 23.020526205325496, + 23.525546079495598, + 22.515506331155393 + ], + [ + 2854.6056266926144, + 23.020526205325496, + 23.525546079495598, + 22.515506331155393 + ], + [ + 2858.3288504984503, + 22.919522230491566, + 23.323538129827625, + 22.515506331155393 + ], + [ + 2862.052074304287, + 22.919522230491566, + 23.323538129827625, + 22.515506331155393 + ], + [ + 2865.775298110123, + 22.919522230491566, + 23.323538129827625, + 22.515506331155393 + ], + [ + 2869.49852191596, + 22.919522230491566, + 23.323538129827625, + 22.515506331155393 + ], + [ + 2873.2217457217957, + 22.919522230491566, + 23.323538129827625, + 22.515506331155393 + ], + [ + 2876.9449695276326, + 22.919522230491566, + 23.323538129827625, + 22.515506331155393 + ], + [ + 2880.6681933334685, + 22.919522230491566, + 23.323538129827625, + 22.515506331155393 + ], + [ + 2884.3914171393053, + 22.919522230491566, + 23.323538129827625, + 22.515506331155393 + ], + [ + 2888.114640945141, + 22.919522230491566, + 23.323538129827625, + 22.515506331155393 + ], + [ + 2891.837864750977, + 22.919522230491566, + 23.323538129827625, + 22.515506331155393 + ], + [ + 2895.561088556814, + 22.818518255657523, + 23.323538129827625, + 22.31349838148742 + ], + [ + 2899.28431236265, + 22.818518255657523, + 23.323538129827625, + 22.31349838148742 + ], + [ + 2903.0075361684867, + 22.818518255657523, + 23.323538129827625, + 22.31349838148742 + ], + [ + 2906.7307599743226, + 22.818518255657523, + 23.323538129827625, + 22.31349838148742 + ], + [ + 2910.4539837801594, + 22.818518255657523, + 23.323538129827625, + 22.31349838148742 + ], + [ + 2914.1772075859953, + 22.818518255657523, + 23.323538129827625, + 22.31349838148742 + ], + [ + 2917.900431391832, + 22.818518255657523, + 23.323538129827625, + 22.31349838148742 + ], + [ + 2921.623655197668, + 22.71751428082348, + 23.12153018015954, + 22.31349838148742 + ], + [ + 2925.346879003505, + 22.71751428082348, + 23.12153018015954, + 22.31349838148742 + ], + [ + 2929.070102809341, + 22.71751428082348, + 23.12153018015954, + 22.31349838148742 + ], + [ + 2932.7933266151767, + 22.71751428082348, + 23.12153018015954, + 22.31349838148742 + ], + [ + 2936.5165504210136, + 22.71751428082348, + 23.12153018015954, + 22.31349838148742 + ], + [ + 2940.2397742268495, + 22.71751428082348, + 23.12153018015954, + 22.31349838148742 + ], + [ + 2943.9629980326863, + 22.71751428082348, + 23.12153018015954, + 22.31349838148742 + ], + [ + 2947.686221838522, + 22.71751428082348, + 23.12153018015954, + 22.31349838148742 + ], + [ + 2951.409445644359, + 22.71751428082348, + 23.12153018015954, + 22.31349838148742 + ], + [ + 2955.132669450195, + 22.71751428082348, + 23.12153018015954, + 22.31349838148742 + ], + [ + 2958.855893256032, + 22.71751428082348, + 23.12153018015954, + 22.31349838148742 + ], + [ + 2962.5791170618677, + 22.71751428082348, + 23.12153018015954, + 22.31349838148742 + ], + [ + 2966.3023408677036, + 22.71751428082348, + 23.12153018015954, + 22.31349838148742 + ], + [ + 2970.0255646735404, + 22.71751428082348, + 23.12153018015954, + 22.31349838148742 + ], + [ + 2973.7487884793763, + 22.71751428082348, + 23.12153018015954, + 22.31349838148742 + ], + [ + 2977.472012285213, + 22.71751428082348, + 23.12153018015954, + 22.31349838148742 + ], + [ + 2981.195236091049, + 22.71751428082348, + 23.12153018015954, + 22.31349838148742 + ], + [ + 2984.918459896886, + 22.616510305989436, + 23.12153018015954, + 22.111490431819334 + ], + [ + 2988.641683702722, + 22.616510305989436, + 23.12153018015954, + 22.111490431819334 + ], + [ + 2992.3649075085586, + 22.616510305989436, + 23.12153018015954, + 22.111490431819334 + ], + [ + 2996.0881313143946, + 22.616510305989436, + 23.12153018015954, + 22.111490431819334 + ], + [ + 2999.8113551202314, + 22.616510305989436, + 23.12153018015954, + 22.111490431819334 + ], + [ + 3003.5345789260673, + 22.616510305989436, + 23.12153018015954, + 22.111490431819334 + ], + [ + 3007.257802731903, + 22.616510305989436, + 23.12153018015954, + 22.111490431819334 + ], + [ + 3010.98102653774, + 22.616510305989436, + 23.12153018015954, + 22.111490431819334 + ], + [ + 3014.704250343576, + 22.616510305989436, + 23.12153018015954, + 22.111490431819334 + ], + [ + 3018.427474149413, + 22.616510305989436, + 23.12153018015954, + 22.111490431819334 + ], + [ + 3022.1506979552487, + 22.616510305989436, + 23.12153018015954, + 22.111490431819334 + ], + [ + 3025.8739217610855, + 22.616510305989436, + 23.12153018015954, + 22.111490431819334 + ], + [ + 3029.5971455669214, + 22.616510305989436, + 23.12153018015954, + 22.111490431819334 + ], + [ + 3033.3203693727583, + 22.616510305989436, + 23.12153018015954, + 22.111490431819334 + ], + [ + 3037.043593178594, + 22.616510305989436, + 23.12153018015954, + 22.111490431819334 + ], + [ + 3040.766816984431, + 22.616510305989436, + 23.12153018015954, + 22.111490431819334 + ], + [ + 3044.490040790267, + 22.616510305989436, + 23.12153018015954, + 22.111490431819334 + ], + [ + 3048.213264596103, + 22.616510305989436, + 23.12153018015954, + 22.111490431819334 + ], + [ + 3051.9364884019396, + 22.515506331155393, + 22.919522230491566, + 22.111490431819334 + ], + [ + 3055.6597122077756, + 22.515506331155393, + 22.919522230491566, + 22.111490431819334 + ], + [ + 3059.3829360136124, + 22.515506331155393, + 22.919522230491566, + 22.111490431819334 + ], + [ + 3063.1061598194483, + 22.515506331155393, + 22.919522230491566, + 22.111490431819334 + ], + [ + 3066.829383625285, + 22.515506331155393, + 22.919522230491566, + 22.111490431819334 + ], + [ + 3070.552607431121, + 22.515506331155393, + 22.919522230491566, + 22.111490431819334 + ], + [ + 3074.275831236958, + 22.515506331155393, + 22.919522230491566, + 22.111490431819334 + ], + [ + 3077.9990550427938, + 22.515506331155393, + 22.919522230491566, + 22.111490431819334 + ], + [ + 3081.7222788486297, + 22.515506331155393, + 22.919522230491566, + 22.111490431819334 + ], + [ + 3085.4455026544665, + 22.515506331155393, + 22.919522230491566, + 22.111490431819334 + ], + [ + 3089.1687264603024, + 22.515506331155393, + 22.919522230491566, + 22.111490431819334 + ], + [ + 3092.8919502661392, + 22.515506331155393, + 22.919522230491566, + 22.111490431819334 + ], + [ + 3096.615174071975, + 22.515506331155393, + 22.919522230491566, + 22.111490431819334 + ], + [ + 3100.338397877812, + 22.515506331155393, + 22.919522230491566, + 22.111490431819334 + ], + [ + 3104.061621683648, + 22.515506331155393, + 22.919522230491566, + 22.111490431819334 + ], + [ + 3107.7848454894847, + 22.515506331155393, + 22.919522230491566, + 22.111490431819334 + ], + [ + 3111.5080692953206, + 22.414502356321464, + 22.919522230491566, + 21.90948248215136 + ], + [ + 3115.2312931011575, + 22.414502356321464, + 22.919522230491566, + 21.90948248215136 + ], + [ + 3118.9545169069934, + 22.414502356321464, + 22.919522230491566, + 21.90948248215136 + ], + [ + 3122.6777407128293, + 22.414502356321464, + 22.919522230491566, + 21.90948248215136 + ], + [ + 3126.400964518666, + 22.414502356321464, + 22.919522230491566, + 21.90948248215136 + ], + [ + 3130.124188324502, + 22.414502356321464, + 22.919522230491566, + 21.90948248215136 + ], + [ + 3133.847412130339, + 22.414502356321464, + 22.919522230491566, + 21.90948248215136 + ], + [ + 3137.5706359361748, + 22.414502356321464, + 22.919522230491566, + 21.90948248215136 + ], + [ + 3141.2938597420116, + 22.414502356321464, + 22.919522230491566, + 21.90948248215136 + ], + [ + 3145.0170835478475, + 22.414502356321464, + 22.919522230491566, + 21.90948248215136 + ], + [ + 3148.7403073536843, + 22.31349838148742, + 22.71751428082348, + 21.90948248215136 + ], + [ + 3152.4635311595202, + 22.31349838148742, + 22.71751428082348, + 21.90948248215136 + ], + [ + 3156.186754965356, + 22.31349838148742, + 22.71751428082348, + 21.90948248215136 + ], + [ + 3159.909978771193, + 22.31349838148742, + 22.71751428082348, + 21.90948248215136 + ], + [ + 3163.633202577029, + 22.31349838148742, + 22.71751428082348, + 21.90948248215136 + ], + [ + 3167.3564263828657, + 22.31349838148742, + 22.71751428082348, + 21.90948248215136 + ], + [ + 3171.0796501887016, + 22.31349838148742, + 22.71751428082348, + 21.90948248215136 + ], + [ + 3174.8028739945385, + 22.31349838148742, + 22.71751428082348, + 21.90948248215136 + ], + [ + 3178.5260978003744, + 22.31349838148742, + 22.71751428082348, + 21.90948248215136 + ], + [ + 3182.249321606211, + 22.31349838148742, + 22.71751428082348, + 21.90948248215136 + ], + [ + 3185.972545412047, + 22.31349838148742, + 22.71751428082348, + 21.90948248215136 + ], + [ + 3189.695769217884, + 22.31349838148742, + 22.71751428082348, + 21.90948248215136 + ], + [ + 3193.41899302372, + 22.31349838148742, + 22.71751428082348, + 21.90948248215136 + ], + [ + 3197.1422168295558, + 22.31349838148742, + 22.71751428082348, + 21.90948248215136 + ], + [ + 3200.8654406353926, + 22.31349838148742, + 22.71751428082348, + 21.90948248215136 + ], + [ + 3204.5886644412285, + 22.212494406653377, + 22.71751428082348, + 21.707474532483275 + ], + [ + 3208.3118882470653, + 22.212494406653377, + 22.71751428082348, + 21.707474532483275 + ], + [ + 3212.0351120529012, + 22.212494406653377, + 22.71751428082348, + 21.707474532483275 + ], + [ + 3215.758335858738, + 22.212494406653377, + 22.71751428082348, + 21.707474532483275 + ], + [ + 3219.481559664574, + 22.212494406653377, + 22.71751428082348, + 21.707474532483275 + ], + [ + 3223.204783470411, + 22.212494406653377, + 22.71751428082348, + 21.707474532483275 + ], + [ + 3226.9280072762467, + 22.212494406653377, + 22.71751428082348, + 21.707474532483275 + ], + [ + 3230.6512310820835, + 22.212494406653377, + 22.71751428082348, + 21.707474532483275 + ], + [ + 3234.3744548879195, + 22.212494406653377, + 22.71751428082348, + 21.707474532483275 + ], + [ + 3238.0976786937554, + 22.111490431819334, + 22.515506331155393, + 21.707474532483275 + ], + [ + 3241.820902499592, + 22.111490431819334, + 22.515506331155393, + 21.707474532483275 + ], + [ + 3245.544126305428, + 22.111490431819334, + 22.515506331155393, + 21.707474532483275 + ], + [ + 3249.267350111265, + 22.111490431819334, + 22.515506331155393, + 21.707474532483275 + ], + [ + 3252.990573917101, + 22.111490431819334, + 22.515506331155393, + 21.707474532483275 + ], + [ + 3256.7137977229377, + 22.111490431819334, + 22.515506331155393, + 21.707474532483275 + ], + [ + 3260.4370215287736, + 22.111490431819334, + 22.515506331155393, + 21.707474532483275 + ], + [ + 3264.1602453346104, + 22.111490431819334, + 22.515506331155393, + 21.707474532483275 + ], + [ + 3267.8834691404463, + 22.111490431819334, + 22.515506331155393, + 21.707474532483275 + ], + [ + 3271.6066929462822, + 22.111490431819334, + 22.515506331155393, + 21.707474532483275 + ], + [ + 3275.329916752119, + 22.111490431819334, + 22.515506331155393, + 21.707474532483275 + ], + [ + 3279.053140557955, + 22.111490431819334, + 22.515506331155393, + 21.707474532483275 + ], + [ + 3282.776364363792, + 22.111490431819334, + 22.515506331155393, + 21.707474532483275 + ], + [ + 3286.4995881696277, + 22.111490431819334, + 22.515506331155393, + 21.707474532483275 + ], + [ + 3290.2228119754645, + 22.111490431819334, + 22.515506331155393, + 21.707474532483275 + ], + [ + 3293.9460357813005, + 22.01048645698529, + 22.515506331155393, + 21.50546658281519 + ], + [ + 3297.6692595871373, + 22.01048645698529, + 22.515506331155393, + 21.50546658281519 + ], + [ + 3301.392483392973, + 22.01048645698529, + 22.515506331155393, + 21.50546658281519 + ], + [ + 3305.11570719881, + 22.01048645698529, + 22.515506331155393, + 21.50546658281519 + ], + [ + 3308.838931004646, + 22.01048645698529, + 22.515506331155393, + 21.50546658281519 + ], + [ + 3312.562154810482, + 22.01048645698529, + 22.515506331155393, + 21.50546658281519 + ], + [ + 3316.2853786163187, + 22.01048645698529, + 22.515506331155393, + 21.50546658281519 + ], + [ + 3320.0086024221546, + 22.01048645698529, + 22.515506331155393, + 21.50546658281519 + ], + [ + 3323.7318262279914, + 22.01048645698529, + 22.515506331155393, + 21.50546658281519 + ], + [ + 3327.4550500338273, + 21.90948248215136, + 22.31349838148742, + 21.50546658281519 + ], + [ + 3331.178273839664, + 21.90948248215136, + 22.31349838148742, + 21.50546658281519 + ], + [ + 3334.9014976455, + 21.90948248215136, + 22.31349838148742, + 21.50546658281519 + ], + [ + 3338.624721451337, + 21.90948248215136, + 22.31349838148742, + 21.50546658281519 + ], + [ + 3342.347945257173, + 21.90948248215136, + 22.31349838148742, + 21.50546658281519 + ], + [ + 3346.0711690630087, + 21.90948248215136, + 22.31349838148742, + 21.50546658281519 + ], + [ + 3349.7943928688455, + 21.90948248215136, + 22.31349838148742, + 21.50546658281519 + ], + [ + 3353.5176166746814, + 21.90948248215136, + 22.31349838148742, + 21.50546658281519 + ], + [ + 3357.2408404805183, + 21.90948248215136, + 22.31349838148742, + 21.50546658281519 + ], + [ + 3360.964064286354, + 21.90948248215136, + 22.31349838148742, + 21.50546658281519 + ], + [ + 3364.687288092191, + 21.90948248215136, + 22.31349838148742, + 21.50546658281519 + ], + [ + 3368.410511898027, + 21.90948248215136, + 22.31349838148742, + 21.50546658281519 + ], + [ + 3372.1337357038637, + 21.90948248215136, + 22.31349838148742, + 21.50546658281519 + ], + [ + 3375.8569595096997, + 21.90948248215136, + 22.31349838148742, + 21.50546658281519 + ], + [ + 3379.5801833155365, + 21.90948248215136, + 22.31349838148742, + 21.50546658281519 + ], + [ + 3383.3034071213724, + 21.90948248215136, + 22.31349838148742, + 21.50546658281519 + ], + [ + 3387.0266309272083, + 21.808478507317318, + 22.31349838148742, + 21.303458633147216 + ], + [ + 3390.749854733045, + 21.808478507317318, + 22.31349838148742, + 21.303458633147216 + ], + [ + 3394.473078538881, + 21.808478507317318, + 22.31349838148742, + 21.303458633147216 + ], + [ + 3398.196302344718, + 21.808478507317318, + 22.31349838148742, + 21.303458633147216 + ], + [ + 3401.919526150554, + 21.808478507317318, + 22.31349838148742, + 21.303458633147216 + ], + [ + 3405.6427499563906, + 21.808478507317318, + 22.31349838148742, + 21.303458633147216 + ], + [ + 3409.3659737622265, + 21.808478507317318, + 22.31349838148742, + 21.303458633147216 + ], + [ + 3413.0891975680634, + 21.808478507317318, + 22.31349838148742, + 21.303458633147216 + ], + [ + 3416.8124213738993, + 21.808478507317318, + 22.31349838148742, + 21.303458633147216 + ], + [ + 3420.535645179736, + 21.707474532483275, + 22.111490431819334, + 21.303458633147216 + ], + [ + 3424.258868985572, + 21.707474532483275, + 22.111490431819334, + 21.303458633147216 + ], + [ + 3427.982092791408, + 21.707474532483275, + 22.111490431819334, + 21.303458633147216 + ], + [ + 3431.7053165972447, + 21.707474532483275, + 22.111490431819334, + 21.303458633147216 + ], + [ + 3435.4285404030807, + 21.707474532483275, + 22.111490431819334, + 21.303458633147216 + ], + [ + 3439.1517642089175, + 21.707474532483275, + 22.111490431819334, + 21.303458633147216 + ], + [ + 3442.8749880147534, + 21.707474532483275, + 22.111490431819334, + 21.303458633147216 + ], + [ + 3446.59821182059, + 21.707474532483275, + 22.111490431819334, + 21.303458633147216 + ], + [ + 3450.321435626426, + 21.707474532483275, + 22.111490431819334, + 21.303458633147216 + ], + [ + 3454.044659432263, + 21.707474532483275, + 22.111490431819334, + 21.303458633147216 + ], + [ + 3457.767883238099, + 21.707474532483275, + 22.111490431819334, + 21.303458633147216 + ], + [ + 3461.491107043935, + 21.707474532483275, + 22.111490431819334, + 21.303458633147216 + ], + [ + 3465.2143308497716, + 21.707474532483275, + 22.111490431819334, + 21.303458633147216 + ], + [ + 3468.9375546556075, + 21.707474532483275, + 22.111490431819334, + 21.303458633147216 + ], + [ + 3472.6607784614444, + 21.707474532483275, + 22.111490431819334, + 21.303458633147216 + ], + [ + 3476.3840022672803, + 21.707474532483275, + 22.111490431819334, + 21.303458633147216 + ], + [ + 3480.107226073117, + 21.60647055764923, + 22.111490431819334, + 21.10145068347913 + ], + [ + 3483.830449878953, + 21.60647055764923, + 22.111490431819334, + 21.10145068347913 + ], + [ + 3487.55367368479, + 21.60647055764923, + 22.111490431819334, + 21.10145068347913 + ], + [ + 3491.2768974906257, + 21.60647055764923, + 22.111490431819334, + 21.10145068347913 + ], + [ + 3495.0001212964626, + 21.60647055764923, + 22.111490431819334, + 21.10145068347913 + ], + [ + 3498.7233451022985, + 21.60647055764923, + 22.111490431819334, + 21.10145068347913 + ], + [ + 3502.4465689081344, + 21.60647055764923, + 22.111490431819334, + 21.10145068347913 + ], + [ + 3506.169792713971, + 21.60647055764923, + 22.111490431819334, + 21.10145068347913 + ], + [ + 3509.893016519807, + 21.60647055764923, + 22.111490431819334, + 21.10145068347913 + ], + [ + 3513.616240325644, + 21.60647055764923, + 22.111490431819334, + 21.10145068347913 + ], + [ + 3517.33946413148, + 21.50546658281519, + 21.90948248215136, + 21.10145068347913 + ], + [ + 3521.0626879373167, + 21.50546658281519, + 21.90948248215136, + 21.10145068347913 + ], + [ + 3524.7859117431526, + 21.50546658281519, + 21.90948248215136, + 21.10145068347913 + ], + [ + 3528.5091355489894, + 21.50546658281519, + 21.90948248215136, + 21.10145068347913 + ], + [ + 3532.2323593548253, + 21.50546658281519, + 21.90948248215136, + 21.10145068347913 + ], + [ + 3535.955583160662, + 21.50546658281519, + 21.90948248215136, + 21.10145068347913 + ], + [ + 3539.678806966498, + 21.50546658281519, + 21.90948248215136, + 21.10145068347913 + ], + [ + 3543.402030772334, + 21.50546658281519, + 21.90948248215136, + 21.10145068347913 + ], + [ + 3547.125254578171, + 21.50546658281519, + 21.90948248215136, + 21.10145068347913 + ], + [ + 3550.8484783840067, + 21.50546658281519, + 21.90948248215136, + 21.10145068347913 + ], + [ + 3554.5717021898436, + 21.50546658281519, + 21.90948248215136, + 21.10145068347913 + ], + [ + 3558.2949259956795, + 21.50546658281519, + 21.90948248215136, + 21.10145068347913 + ], + [ + 3562.0181498015163, + 21.50546658281519, + 21.90948248215136, + 21.10145068347913 + ], + [ + 3565.741373607352, + 21.50546658281519, + 21.90948248215136, + 21.10145068347913 + ], + [ + 3569.464597413189, + 21.50546658281519, + 21.90948248215136, + 21.10145068347913 + ], + [ + 3573.187821219025, + 21.50546658281519, + 21.90948248215136, + 21.10145068347913 + ], + [ + 3576.911045024861, + 21.50546658281519, + 21.90948248215136, + 21.10145068347913 + ], + [ + 3580.6342688306977, + 21.404462607981145, + 21.90948248215136, + 20.899442733811043 + ], + [ + 3584.3574926365336, + 21.404462607981145, + 21.90948248215136, + 20.899442733811043 + ], + [ + 3588.0807164423704, + 21.404462607981145, + 21.90948248215136, + 20.899442733811043 + ], + [ + 3591.8039402482063, + 21.404462607981145, + 21.90948248215136, + 20.899442733811043 + ], + [ + 3595.527164054043, + 21.404462607981145, + 21.90948248215136, + 20.899442733811043 + ], + [ + 3599.250387859879, + 21.404462607981145, + 21.90948248215136, + 20.899442733811043 + ], + [ + 3602.973611665716, + 21.404462607981145, + 21.90948248215136, + 20.899442733811043 + ], + [ + 3606.696835471552, + 21.404462607981145, + 21.90948248215136, + 20.899442733811043 + ], + [ + 3610.4200592773886, + 21.404462607981145, + 21.90948248215136, + 20.899442733811043 + ], + [ + 3614.1432830832246, + 21.404462607981145, + 21.90948248215136, + 20.899442733811043 + ], + [ + 3617.8665068890605, + 21.303458633147216, + 21.707474532483275, + 20.899442733811043 + ], + [ + 3621.5897306948973, + 21.303458633147216, + 21.707474532483275, + 20.899442733811043 + ], + [ + 3625.312954500733, + 21.303458633147216, + 21.707474532483275, + 20.899442733811043 + ], + [ + 3629.03617830657, + 21.303458633147216, + 21.707474532483275, + 20.899442733811043 + ], + [ + 3632.759402112406, + 21.303458633147216, + 21.707474532483275, + 20.899442733811043 + ], + [ + 3636.482625918243, + 21.303458633147216, + 21.707474532483275, + 20.899442733811043 + ], + [ + 3640.2058497240787, + 21.303458633147216, + 21.707474532483275, + 20.899442733811043 + ], + [ + 3643.9290735299155, + 21.303458633147216, + 21.707474532483275, + 20.899442733811043 + ], + [ + 3647.6522973357514, + 21.303458633147216, + 21.707474532483275, + 20.899442733811043 + ], + [ + 3651.3755211415873, + 21.303458633147216, + 21.707474532483275, + 20.899442733811043 + ], + [ + 3655.098744947424, + 21.303458633147216, + 21.707474532483275, + 20.899442733811043 + ], + [ + 3658.82196875326, + 21.303458633147216, + 21.707474532483275, + 20.899442733811043 + ], + [ + 3662.545192559097, + 21.303458633147216, + 21.707474532483275, + 20.899442733811043 + ], + [ + 3666.268416364933, + 21.303458633147216, + 21.707474532483275, + 20.899442733811043 + ], + [ + 3669.9916401707696, + 21.303458633147216, + 21.707474532483275, + 20.899442733811043 + ], + [ + 3673.7148639766056, + 21.303458633147216, + 21.707474532483275, + 20.899442733811043 + ], + [ + 3677.4380877824424, + 21.202454658313172, + 21.707474532483275, + 20.69743478414307 + ], + [ + 3681.1613115882783, + 21.202454658313172, + 21.707474532483275, + 20.69743478414307 + ], + [ + 3684.884535394115, + 21.202454658313172, + 21.707474532483275, + 20.69743478414307 + ], + [ + 3688.607759199951, + 21.202454658313172, + 21.707474532483275, + 20.69743478414307 + ], + [ + 3692.330983005787, + 21.202454658313172, + 21.707474532483275, + 20.69743478414307 + ], + [ + 3696.0542068116238, + 21.202454658313172, + 21.707474532483275, + 20.69743478414307 + ], + [ + 3699.7774306174597, + 21.202454658313172, + 21.707474532483275, + 20.69743478414307 + ], + [ + 3703.5006544232965, + 21.202454658313172, + 21.707474532483275, + 20.69743478414307 + ], + [ + 3707.2238782291324, + 21.202454658313172, + 21.707474532483275, + 20.69743478414307 + ], + [ + 3710.9471020349692, + 21.202454658313172, + 21.707474532483275, + 20.69743478414307 + ], + [ + 3714.670325840805, + 21.202454658313172, + 21.707474532483275, + 20.69743478414307 + ], + [ + 3718.393549646642, + 21.10145068347913, + 21.50546658281519, + 20.69743478414307 + ], + [ + 3722.116773452478, + 21.10145068347913, + 21.50546658281519, + 20.69743478414307 + ], + [ + 3725.8399972583147, + 21.10145068347913, + 21.50546658281519, + 20.69743478414307 + ], + [ + 3729.5632210641506, + 21.10145068347913, + 21.50546658281519, + 20.69743478414307 + ], + [ + 3733.2864448699866, + 21.10145068347913, + 21.50546658281519, + 20.69743478414307 + ], + [ + 3737.0096686758234, + 21.10145068347913, + 21.50546658281519, + 20.69743478414307 + ], + [ + 3740.7328924816593, + 21.10145068347913, + 21.50546658281519, + 20.69743478414307 + ], + [ + 3744.456116287496, + 21.10145068347913, + 21.50546658281519, + 20.69743478414307 + ], + [ + 3748.179340093332, + 21.10145068347913, + 21.50546658281519, + 20.69743478414307 + ], + [ + 3751.902563899169, + 21.10145068347913, + 21.50546658281519, + 20.69743478414307 + ], + [ + 3755.6257877050048, + 21.10145068347913, + 21.50546658281519, + 20.69743478414307 + ], + [ + 3759.3490115108416, + 21.10145068347913, + 21.50546658281519, + 20.69743478414307 + ], + [ + 3763.0722353166775, + 21.10145068347913, + 21.50546658281519, + 20.69743478414307 + ], + [ + 3766.7954591225134, + 21.10145068347913, + 21.50546658281519, + 20.69743478414307 + ], + [ + 3770.5186829283502, + 21.10145068347913, + 21.50546658281519, + 20.69743478414307 + ], + [ + 3774.241906734186, + 21.10145068347913, + 21.50546658281519, + 20.69743478414307 + ], + [ + 3777.965130540023, + 21.10145068347913, + 21.50546658281519, + 20.69743478414307 + ], + [ + 3781.688354345859, + 21.000446708645086, + 21.50546658281519, + 20.495426834474983 + ], + [ + 3785.4115781516957, + 21.000446708645086, + 21.50546658281519, + 20.495426834474983 + ], + [ + 3789.1348019575316, + 21.000446708645086, + 21.50546658281519, + 20.495426834474983 + ], + [ + 3792.8580257633685, + 21.000446708645086, + 21.50546658281519, + 20.495426834474983 + ], + [ + 3796.5812495692044, + 21.000446708645086, + 21.50546658281519, + 20.495426834474983 + ], + [ + 3800.304473375041, + 21.000446708645086, + 21.50546658281519, + 20.495426834474983 + ], + [ + 3804.027697180877, + 21.000446708645086, + 21.50546658281519, + 20.495426834474983 + ], + [ + 3807.750920986713, + 21.000446708645086, + 21.50546658281519, + 20.495426834474983 + ], + [ + 3811.47414479255, + 21.000446708645086, + 21.50546658281519, + 20.495426834474983 + ], + [ + 3815.1973685983858, + 21.000446708645086, + 21.50546658281519, + 20.495426834474983 + ], + [ + 3818.9205924042226, + 21.000446708645086, + 21.50546658281519, + 20.495426834474983 + ], + [ + 3822.6438162100585, + 20.899442733811043, + 21.303458633147216, + 20.495426834474983 + ], + [ + 3826.3670400158953, + 20.899442733811043, + 21.303458633147216, + 20.495426834474983 + ], + [ + 3830.0902638217312, + 20.899442733811043, + 21.303458633147216, + 20.495426834474983 + ], + [ + 3833.813487627568, + 20.899442733811043, + 21.303458633147216, + 20.495426834474983 + ], + [ + 3837.536711433404, + 20.899442733811043, + 21.303458633147216, + 20.495426834474983 + ], + [ + 3841.259935239241, + 20.899442733811043, + 21.303458633147216, + 20.495426834474983 + ], + [ + 3844.9831590450767, + 20.899442733811043, + 21.303458633147216, + 20.495426834474983 + ], + [ + 3848.7063828509126, + 20.899442733811043, + 21.303458633147216, + 20.495426834474983 + ], + [ + 3852.4296066567495, + 20.899442733811043, + 21.303458633147216, + 20.495426834474983 + ], + [ + 3856.1528304625854, + 20.899442733811043, + 21.303458633147216, + 20.495426834474983 + ], + [ + 3859.876054268422, + 20.899442733811043, + 21.303458633147216, + 20.495426834474983 + ], + [ + 3863.599278074258, + 20.899442733811043, + 21.303458633147216, + 20.495426834474983 + ], + [ + 3867.322501880095, + 20.899442733811043, + 21.303458633147216, + 20.495426834474983 + ], + [ + 3871.045725685931, + 20.899442733811043, + 21.303458633147216, + 20.495426834474983 + ], + [ + 3874.7689494917677, + 20.899442733811043, + 21.303458633147216, + 20.495426834474983 + ], + [ + 3878.4921732976036, + 20.899442733811043, + 21.303458633147216, + 20.495426834474983 + ], + [ + 3882.2153971034395, + 20.899442733811043, + 21.303458633147216, + 20.495426834474983 + ], + [ + 3885.9386209092763, + 20.899442733811043, + 21.303458633147216, + 20.495426834474983 + ], + [ + 3889.6618447151122, + 20.899442733811043, + 21.303458633147216, + 20.495426834474983 + ], + [ + 3893.385068520949, + 20.798438758977113, + 21.303458633147216, + 20.29341888480701 + ], + [ + 3897.108292326785, + 20.798438758977113, + 21.303458633147216, + 20.29341888480701 + ], + [ + 3900.831516132622, + 20.798438758977113, + 21.303458633147216, + 20.29341888480701 + ], + [ + 3904.5547399384577, + 20.798438758977113, + 21.303458633147216, + 20.29341888480701 + ], + [ + 3908.2779637442945, + 20.798438758977113, + 21.303458633147216, + 20.29341888480701 + ], + [ + 3912.0011875501305, + 20.798438758977113, + 21.303458633147216, + 20.29341888480701 + ], + [ + 3915.7244113559673, + 20.798438758977113, + 21.303458633147216, + 20.29341888480701 + ], + [ + 3919.447635161803, + 20.798438758977113, + 21.303458633147216, + 20.29341888480701 + ], + [ + 3923.170858967639, + 20.798438758977113, + 21.303458633147216, + 20.29341888480701 + ], + [ + 3926.894082773476, + 20.798438758977113, + 21.303458633147216, + 20.29341888480701 + ], + [ + 3930.617306579312, + 20.798438758977113, + 21.303458633147216, + 20.29341888480701 + ], + [ + 3934.3405303851487, + 20.69743478414307, + 21.10145068347913, + 20.29341888480701 + ], + [ + 3938.0637541909846, + 20.69743478414307, + 21.10145068347913, + 20.29341888480701 + ], + [ + 3941.7869779968214, + 20.69743478414307, + 21.10145068347913, + 20.29341888480701 + ], + [ + 3945.5102018026573, + 20.69743478414307, + 21.10145068347913, + 20.29341888480701 + ], + [ + 3949.233425608494, + 20.69743478414307, + 21.10145068347913, + 20.29341888480701 + ], + [ + 3952.95664941433, + 20.69743478414307, + 21.10145068347913, + 20.29341888480701 + ], + [ + 3956.679873220166, + 20.69743478414307, + 21.10145068347913, + 20.29341888480701 + ], + [ + 3960.403097026003, + 20.69743478414307, + 21.10145068347913, + 20.29341888480701 + ], + [ + 3964.1263208318387, + 20.69743478414307, + 21.10145068347913, + 20.29341888480701 + ], + [ + 3967.8495446376755, + 20.69743478414307, + 21.10145068347913, + 20.29341888480701 + ], + [ + 3971.5727684435114, + 20.69743478414307, + 21.10145068347913, + 20.29341888480701 + ], + [ + 3975.2959922493483, + 20.69743478414307, + 21.10145068347913, + 20.29341888480701 + ], + [ + 3979.019216055184, + 20.69743478414307, + 21.10145068347913, + 20.29341888480701 + ], + [ + 3982.742439861021, + 20.69743478414307, + 21.10145068347913, + 20.29341888480701 + ], + [ + 3986.465663666857, + 20.69743478414307, + 21.10145068347913, + 20.29341888480701 + ], + [ + 3990.1888874726938, + 20.69743478414307, + 21.10145068347913, + 20.29341888480701 + ], + [ + 3993.9121112785297, + 20.69743478414307, + 21.10145068347913, + 20.29341888480701 + ], + [ + 3997.6353350843656, + 20.69743478414307, + 21.10145068347913, + 20.29341888480701 + ], + [ + 4001.3585588902024, + 20.69743478414307, + 21.10145068347913, + 20.29341888480701 + ], + [ + 4005.0817826960383, + 20.69743478414307, + 21.10145068347913, + 20.29341888480701 + ], + [ + 4008.805006501875, + 20.69743478414307, + 21.10145068347913, + 20.29341888480701 + ], + [ + 4012.528230307711, + 20.596430809309027, + 21.10145068347913, + 20.091410935138924 + ], + [ + 4016.251454113548, + 20.596430809309027, + 21.10145068347913, + 20.091410935138924 + ], + [ + 4019.974677919384, + 20.596430809309027, + 21.10145068347913, + 20.091410935138924 + ], + [ + 4023.6979017252206, + 20.596430809309027, + 21.10145068347913, + 20.091410935138924 + ], + [ + 4027.4211255310565, + 20.596430809309027, + 21.10145068347913, + 20.091410935138924 + ], + [ + 4031.1443493368934, + 20.596430809309027, + 21.10145068347913, + 20.091410935138924 + ], + [ + 4034.8675731427293, + 20.596430809309027, + 21.10145068347913, + 20.091410935138924 + ], + [ + 4038.590796948565, + 20.596430809309027, + 21.10145068347913, + 20.091410935138924 + ], + [ + 4042.314020754402, + 20.596430809309027, + 21.10145068347913, + 20.091410935138924 + ], + [ + 4046.037244560238, + 20.596430809309027, + 21.10145068347913, + 20.091410935138924 + ], + [ + 4049.7604683660747, + 20.596430809309027, + 21.10145068347913, + 20.091410935138924 + ], + [ + 4053.4836921719107, + 20.596430809309027, + 21.10145068347913, + 20.091410935138924 + ], + [ + 4057.2069159777475, + 20.495426834474983, + 20.899442733811043, + 20.091410935138924 + ], + [ + 4060.9301397835834, + 20.495426834474983, + 20.899442733811043, + 20.091410935138924 + ], + [ + 4064.65336358942, + 20.495426834474983, + 20.899442733811043, + 20.091410935138924 + ], + [ + 4068.376587395256, + 20.495426834474983, + 20.899442733811043, + 20.091410935138924 + ], + [ + 4072.099811201092, + 20.495426834474983, + 20.899442733811043, + 20.091410935138924 + ], + [ + 4075.823035006929, + 20.495426834474983, + 20.899442733811043, + 20.091410935138924 + ], + [ + 4079.546258812765, + 20.495426834474983, + 20.899442733811043, + 20.091410935138924 + ], + [ + 4083.2694826186016, + 20.495426834474983, + 20.899442733811043, + 20.091410935138924 + ], + [ + 4086.9927064244375, + 20.495426834474983, + 20.899442733811043, + 20.091410935138924 + ], + [ + 4090.7159302302744, + 20.495426834474983, + 20.899442733811043, + 20.091410935138924 + ], + [ + 4094.4391540361103, + 20.495426834474983, + 20.899442733811043, + 20.091410935138924 + ], + [ + 4098.162377841947, + 20.495426834474983, + 20.899442733811043, + 20.091410935138924 + ], + [ + 4101.885601647783, + 20.495426834474983, + 20.899442733811043, + 20.091410935138924 + ], + [ + 4105.60882545362, + 20.495426834474983, + 20.899442733811043, + 20.091410935138924 + ], + [ + 4109.332049259456, + 20.495426834474983, + 20.899442733811043, + 20.091410935138924 + ], + [ + 4113.055273065292, + 20.495426834474983, + 20.899442733811043, + 20.091410935138924 + ], + [ + 4116.7784968711285, + 20.495426834474983, + 20.899442733811043, + 20.091410935138924 + ], + [ + 4120.501720676964, + 20.495426834474983, + 20.899442733811043, + 20.091410935138924 + ], + [ + 4124.224944482801, + 20.495426834474983, + 20.899442733811043, + 20.091410935138924 + ], + [ + 4127.948168288637, + 20.495426834474983, + 20.899442733811043, + 20.091410935138924 + ], + [ + 4131.671392094474, + 20.495426834474983, + 20.899442733811043, + 20.091410935138924 + ], + [ + 4135.39461590031, + 20.495426834474983, + 20.899442733811043, + 20.091410935138924 + ], + [ + 4139.117839706147, + 20.495426834474983, + 20.899442733811043, + 20.091410935138924 + ], + [ + 4142.841063511983, + 20.495426834474983, + 20.899442733811043, + 20.091410935138924 + ], + [ + 4146.5642873178185, + 20.495426834474983, + 20.899442733811043, + 20.091410935138924 + ], + [ + 4150.287511123655, + 20.39442285964094, + 20.899442733811043, + 19.889402985470838 + ], + [ + 4154.010734929491, + 20.39442285964094, + 20.899442733811043, + 19.889402985470838 + ], + [ + 4157.733958735328, + 20.39442285964094, + 20.899442733811043, + 19.889402985470838 + ], + [ + 4161.457182541164, + 20.39442285964094, + 20.899442733811043, + 19.889402985470838 + ], + [ + 4165.180406347001, + 20.39442285964094, + 20.899442733811043, + 19.889402985470838 + ], + [ + 4168.903630152837, + 20.39442285964094, + 20.899442733811043, + 19.889402985470838 + ], + [ + 4172.626853958674, + 20.39442285964094, + 20.899442733811043, + 19.889402985470838 + ], + [ + 4176.3500777645095, + 20.39442285964094, + 20.899442733811043, + 19.889402985470838 + ], + [ + 4180.073301570346, + 20.39442285964094, + 20.899442733811043, + 19.889402985470838 + ], + [ + 4183.796525376182, + 20.39442285964094, + 20.899442733811043, + 19.889402985470838 + ], + [ + 4187.519749182018, + 20.39442285964094, + 20.899442733811043, + 19.889402985470838 + ], + [ + 4191.242972987855, + 20.39442285964094, + 20.899442733811043, + 19.889402985470838 + ], + [ + 4194.966196793691, + 20.39442285964094, + 20.899442733811043, + 19.889402985470838 + ], + [ + 4198.689420599528, + 20.39442285964094, + 20.899442733811043, + 19.889402985470838 + ], + [ + 4202.412644405364, + 20.39442285964094, + 20.899442733811043, + 19.889402985470838 + ], + [ + 4206.1358682112, + 20.39442285964094, + 20.899442733811043, + 19.889402985470838 + ], + [ + 4209.859092017036, + 20.29341888480701, + 20.69743478414307, + 19.889402985470838 + ], + [ + 4213.582315822873, + 20.29341888480701, + 20.69743478414307, + 19.889402985470838 + ], + [ + 4217.305539628709, + 20.29341888480701, + 20.69743478414307, + 19.889402985470838 + ], + [ + 4221.028763434546, + 20.29341888480701, + 20.69743478414307, + 19.889402985470838 + ], + [ + 4224.751987240382, + 20.29341888480701, + 20.69743478414307, + 19.889402985470838 + ], + [ + 4228.475211046218, + 20.29341888480701, + 20.69743478414307, + 19.889402985470838 + ], + [ + 4232.198434852055, + 20.29341888480701, + 20.69743478414307, + 19.889402985470838 + ], + [ + 4235.9216586578905, + 20.29341888480701, + 20.69743478414307, + 19.889402985470838 + ], + [ + 4239.644882463727, + 20.29341888480701, + 20.69743478414307, + 19.889402985470838 + ], + [ + 4243.368106269563, + 20.29341888480701, + 20.69743478414307, + 19.889402985470838 + ], + [ + 4247.0913300754, + 20.29341888480701, + 20.69743478414307, + 19.889402985470838 + ], + [ + 4250.814553881236, + 20.29341888480701, + 20.69743478414307, + 19.889402985470838 + ], + [ + 4254.537777687073, + 20.29341888480701, + 20.69743478414307, + 19.889402985470838 + ], + [ + 4258.261001492909, + 20.29341888480701, + 20.69743478414307, + 19.889402985470838 + ], + [ + 4261.984225298745, + 20.29341888480701, + 20.69743478414307, + 19.889402985470838 + ], + [ + 4265.707449104581, + 20.29341888480701, + 20.69743478414307, + 19.889402985470838 + ], + [ + 4269.430672910417, + 20.29341888480701, + 20.69743478414307, + 19.889402985470838 + ], + [ + 4273.153896716254, + 20.29341888480701, + 20.69743478414307, + 19.889402985470838 + ], + [ + 4276.87712052209, + 20.29341888480701, + 20.69743478414307, + 19.889402985470838 + ], + [ + 4280.600344327927, + 20.29341888480701, + 20.69743478414307, + 19.889402985470838 + ], + [ + 4284.323568133763, + 20.29341888480701, + 20.69743478414307, + 19.889402985470838 + ], + [ + 4288.0467919396, + 20.29341888480701, + 20.69743478414307, + 19.889402985470838 + ], + [ + 4291.770015745436, + 20.29341888480701, + 20.69743478414307, + 19.889402985470838 + ], + [ + 4295.493239551272, + 20.29341888480701, + 20.69743478414307, + 19.889402985470838 + ], + [ + 4299.216463357108, + 20.29341888480701, + 20.69743478414307, + 19.889402985470838 + ], + [ + 4302.939687162944, + 20.29341888480701, + 20.69743478414307, + 19.889402985470838 + ], + [ + 4306.662910968781, + 20.29341888480701, + 20.69743478414307, + 19.889402985470838 + ], + [ + 4310.386134774617, + 20.29341888480701, + 20.69743478414307, + 19.889402985470838 + ], + [ + 4314.109358580454, + 20.29341888480701, + 20.69743478414307, + 19.889402985470838 + ], + [ + 4317.83258238629, + 20.29341888480701, + 20.69743478414307, + 19.889402985470838 + ], + [ + 4321.5558061921265, + 20.29341888480701, + 20.69743478414307, + 19.889402985470838 + ], + [ + 4325.279029997962, + 20.29341888480701, + 20.69743478414307, + 19.889402985470838 + ], + [ + 4329.002253803799, + 20.29341888480701, + 20.69743478414307, + 19.889402985470838 + ], + [ + 4332.725477609635, + 20.29341888480701, + 20.69743478414307, + 19.889402985470838 + ], + [ + 4336.448701415472, + 20.29341888480701, + 20.69743478414307, + 19.889402985470838 + ], + [ + 4340.171925221308, + 20.29341888480701, + 20.69743478414307, + 19.889402985470838 + ], + [ + 4343.895149027144, + 20.29341888480701, + 20.69743478414307, + 19.889402985470838 + ], + [ + 4347.618372832981, + 20.29341888480701, + 20.69743478414307, + 19.889402985470838 + ], + [ + 4351.341596638817, + 20.29341888480701, + 20.69743478414307, + 19.889402985470838 + ], + [ + 4355.064820444653, + 20.39442285964094, + 20.899442733811043, + 19.889402985470838 + ], + [ + 4358.788044250489, + 20.596430809309027, + 21.303458633147216, + 19.889402985470838 + ], + [ + 4362.511268056326, + 20.798438758977113, + 21.707474532483275, + 19.889402985470838 + ], + [ + 4366.234491862162, + 20.899442733811043, + 21.90948248215136, + 19.889402985470838 + ], + [ + 4369.957715667999, + 21.202454658313172, + 22.111490431819334, + 20.29341888480701 + ], + [ + 4373.680939473835, + 21.50546658281519, + 22.31349838148742, + 20.69743478414307 + ], + [ + 4377.404163279671, + 21.808478507317318, + 22.71751428082348, + 20.899442733811043 + ], + [ + 4381.1273870855075, + 22.111490431819334, + 22.919522230491566, + 21.303458633147216 + ], + [ + 4384.850610891343, + 22.31349838148742, + 23.12153018015954, + 21.50546658281519 + ], + [ + 4388.57383469718, + 22.515506331155393, + 23.323538129827625, + 21.707474532483275 + ], + [ + 4392.297058503016, + 22.71751428082348, + 23.525546079495598, + 21.90948248215136 + ], + [ + 4396.020282308853, + 22.818518255657523, + 23.525546079495598, + 22.111490431819334 + ], + [ + 4399.743506114689, + 23.020526205325496, + 23.727554029163684, + 22.31349838148742 + ], + [ + 4403.466729920526, + 23.222534154993582, + 23.92956197883177, + 22.515506331155393 + ], + [ + 4407.189953726362, + 23.42454210466167, + 24.131569928499744, + 22.71751428082348 + ], + [ + 4410.9131775321985, + 23.525546079495598, + 24.131569928499744, + 22.919522230491566 + ], + [ + 4414.636401338034, + 23.727554029163684, + 24.33357787816783, + 23.12153018015954 + ], + [ + 4418.35962514387, + 23.92956197883177, + 24.535585827835916, + 23.323538129827625 + ], + [ + 4422.082848949707, + 23.92956197883177, + 24.535585827835916, + 23.323538129827625 + ], + [ + 4425.806072755543, + 24.131569928499744, + 24.73759377750389, + 23.525546079495598 + ], + [ + 4429.52929656138, + 24.232573903333787, + 24.73759377750389, + 23.727554029163684 + ], + [ + 4433.252520367216, + 24.33357787816783, + 24.939601727171976, + 23.727554029163684 + ], + [ + 4436.975744173053, + 24.434581853001873, + 24.939601727171976, + 23.92956197883177 + ], + [ + 4440.6989679788885, + 24.636589802669846, + 25.14160967683995, + 24.131569928499744 + ], + [ + 4444.422191784725, + 24.636589802669846, + 25.14160967683995, + 24.131569928499744 + ], + [ + 4448.145415590561, + 24.838597752337932, + 25.343617626508035, + 24.33357787816783 + ], + [ + 4451.868639396397, + 24.838597752337932, + 25.343617626508035, + 24.33357787816783 + ], + [ + 4455.591863202234, + 24.838597752337932, + 25.343617626508035, + 24.33357787816783 + ], + [ + 4459.31508700807, + 24.939601727171976, + 25.343617626508035, + 24.535585827835916 + ], + [ + 4463.038310813907, + 24.939601727171976, + 25.343617626508035, + 24.535585827835916 + ], + [ + 4466.761534619743, + 25.04060570200602, + 25.343617626508035, + 24.73759377750389 + ], + [ + 4470.4847584255795, + 24.939601727171976, + 25.14160967683995, + 24.73759377750389 + ], + [ + 4474.207982231415, + 24.939601727171976, + 25.14160967683995, + 24.73759377750389 + ], + [ + 4477.931206037252, + 25.04060570200602, + 25.14160967683995, + 24.939601727171976 + ], + [ + 4481.654429843088, + 25.04060570200602, + 25.14160967683995, + 24.939601727171976 + ], + [ + 4485.377653648925, + 25.04060570200602, + 25.14160967683995, + 24.939601727171976 + ] + ], + "Tc": [ + [ + 51.018100897861586, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 54.741324703697956, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 58.464548509534325, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 62.187772315370694, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 65.91099612120706, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 69.63421992704343, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 73.3574437328798, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 77.08066753871617, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 80.80389134455254, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 84.52711515038891, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 88.25033895622482, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 91.97356276206119, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 95.69678656789756, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 99.42001037373393, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 103.1432341795703, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 106.86645798540667, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 110.58968179124304, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 114.3129055970794, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 118.03612940291578, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 121.75935320875215, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 125.48257701458806, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 129.20580082042443, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 132.9290246262608, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 136.65224843209717, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 140.37547223793354, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 144.0986960437699, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 147.82191984960627, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 151.54514365544264, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 155.268367461279, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 158.99159126711538, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 162.7148150729513, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 166.43803887878767, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 170.16126268462403, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 173.8844864904604, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 177.60771029629677, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 181.33093410213314, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 185.0541579079695, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 188.77738171380588, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 192.50060551964225, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 196.22382932547862, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 199.947053131315, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 203.6702769371509, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 207.39350074298727, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 211.11672454882364, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 214.83994835466, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 218.56317216049638, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 222.28639596633275, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 226.00961977216912, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 229.7328435780055, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 233.45606738384186, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 237.17929118967822, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 240.90251499551414, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 244.6257388013505, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 248.34896260718688, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 252.07218641302325, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 255.79541021885962, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 259.518634024696, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 263.24185783053235, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 266.9650816363687, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 270.6883054422051, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 274.41152924804146, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 278.1347530538774, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 281.85797685971374, + 18.071331438458515, + 18.67735528746266, + 17.46530758945437 + ], + [ + 285.5812006655501, + 17.869323488790428, + 18.475347337794574, + 17.263299639786283 + ], + [ + 289.3044244713865, + 17.869323488790428, + 18.475347337794574, + 17.263299639786283 + ], + [ + 293.02764827722285, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 296.7508720830592, + 17.667315539122455, + 18.273339388126487, + 17.06129169011831 + ], + [ + 300.4740958888956, + 17.566311564288412, + 18.071331438458515, + 17.06129169011831 + ], + [ + 304.19731969473196, + 17.566311564288412, + 18.071331438458515, + 17.06129169011831 + ], + [ + 307.92054350056833, + 17.566311564288412, + 18.071331438458515, + 17.06129169011831 + ], + [ + 311.6437673064047, + 17.364303614620326, + 17.869323488790428, + 16.859283740450223 + ], + [ + 315.3669911122406, + 17.364303614620326, + 17.869323488790428, + 16.859283740450223 + ], + [ + 319.090214918077, + 17.364303614620326, + 17.869323488790428, + 16.859283740450223 + ], + [ + 322.81343872391335, + 17.364303614620326, + 17.869323488790428, + 16.859283740450223 + ], + [ + 326.5366625297497, + 17.364303614620326, + 17.869323488790428, + 16.859283740450223 + ], + [ + 330.2598863355861, + 17.263299639786283, + 17.667315539122455, + 16.859283740450223 + ], + [ + 333.98311014142246, + 17.162295664952353, + 17.667315539122455, + 16.657275790782137 + ], + [ + 337.7063339472588, + 17.162295664952353, + 17.667315539122455, + 16.657275790782137 + ], + [ + 341.4295577530952, + 17.162295664952353, + 17.667315539122455, + 16.657275790782137 + ], + [ + 345.15278155893157, + 17.162295664952353, + 17.667315539122455, + 16.657275790782137 + ], + [ + 348.87600536476793, + 17.162295664952353, + 17.667315539122455, + 16.657275790782137 + ], + [ + 352.5992291706043, + 17.162295664952353, + 17.667315539122455, + 16.657275790782137 + ], + [ + 356.3224529764402, + 17.162295664952353, + 17.667315539122455, + 16.657275790782137 + ], + [ + 360.0456767822766, + 17.06129169011831, + 17.46530758945437, + 16.657275790782137 + ], + [ + 363.76890058811296, + 16.960287715284267, + 17.46530758945437, + 16.455267841114164 + ], + [ + 367.4921243939493, + 16.960287715284267, + 17.46530758945437, + 16.455267841114164 + ], + [ + 371.2153481997857, + 16.960287715284267, + 17.46530758945437, + 16.455267841114164 + ], + [ + 374.93857200562206, + 16.960287715284267, + 17.46530758945437, + 16.455267841114164 + ], + [ + 378.66179581145843, + 16.960287715284267, + 17.46530758945437, + 16.455267841114164 + ], + [ + 382.3850196172948, + 16.960287715284267, + 17.46530758945437, + 16.455267841114164 + ], + [ + 386.10824342313117, + 16.960287715284267, + 17.46530758945437, + 16.455267841114164 + ], + [ + 389.83146722896754, + 16.960287715284267, + 17.46530758945437, + 16.455267841114164 + ], + [ + 393.55469103480345, + 16.960287715284267, + 17.46530758945437, + 16.455267841114164 + ], + [ + 397.2779148406398, + 16.960287715284267, + 17.46530758945437, + 16.455267841114164 + ], + [ + 401.0011386464762, + 16.859283740450223, + 17.263299639786283, + 16.455267841114164 + ], + [ + 404.72436245231256, + 16.859283740450223, + 17.263299639786283, + 16.455267841114164 + ], + [ + 408.44758625814893, + 16.75827976561618, + 17.263299639786283, + 16.253259891446078 + ], + [ + 412.1708100639853, + 16.75827976561618, + 17.263299639786283, + 16.253259891446078 + ], + [ + 415.89403386982167, + 16.75827976561618, + 17.263299639786283, + 16.253259891446078 + ], + [ + 419.61725767565804, + 16.75827976561618, + 17.263299639786283, + 16.253259891446078 + ], + [ + 423.3404814814944, + 16.75827976561618, + 17.263299639786283, + 16.253259891446078 + ], + [ + 427.0637052873308, + 16.75827976561618, + 17.263299639786283, + 16.253259891446078 + ], + [ + 430.7869290931667, + 16.75827976561618, + 17.263299639786283, + 16.253259891446078 + ], + [ + 434.51015289900306, + 16.75827976561618, + 17.263299639786283, + 16.253259891446078 + ], + [ + 438.23337670483943, + 16.75827976561618, + 17.263299639786283, + 16.253259891446078 + ], + [ + 441.9566005106758, + 16.75827976561618, + 17.263299639786283, + 16.253259891446078 + ], + [ + 445.67982431651217, + 16.75827976561618, + 17.263299639786283, + 16.253259891446078 + ], + [ + 449.40304812234854, + 16.75827976561618, + 17.263299639786283, + 16.253259891446078 + ], + [ + 453.1262719281849, + 16.75827976561618, + 17.263299639786283, + 16.253259891446078 + ], + [ + 456.8494957340213, + 16.75827976561618, + 17.263299639786283, + 16.253259891446078 + ], + [ + 460.57271953985764, + 16.75827976561618, + 17.263299639786283, + 16.253259891446078 + ], + [ + 464.295943345694, + 16.75827976561618, + 17.263299639786283, + 16.253259891446078 + ], + [ + 468.0191671515299, + 16.75827976561618, + 17.263299639786283, + 16.253259891446078 + ], + [ + 471.7423909573663, + 16.75827976561618, + 17.263299639786283, + 16.253259891446078 + ], + [ + 475.46561476320267, + 16.75827976561618, + 17.263299639786283, + 16.253259891446078 + ], + [ + 479.18883856903904, + 16.657275790782137, + 17.06129169011831, + 16.253259891446078 + ], + [ + 482.9120623748754, + 16.657275790782137, + 17.06129169011831, + 16.253259891446078 + ], + [ + 486.6352861807118, + 16.657275790782137, + 17.06129169011831, + 16.253259891446078 + ], + [ + 490.35850998654814, + 16.657275790782137, + 17.06129169011831, + 16.253259891446078 + ], + [ + 494.0817337923845, + 16.657275790782137, + 17.06129169011831, + 16.253259891446078 + ], + [ + 497.8049575982209, + 16.657275790782137, + 17.06129169011831, + 16.253259891446078 + ], + [ + 501.52818140405725, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 505.2514052098936, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 508.97462901572953, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 512.6978528215659, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 516.4210766274023, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 520.1443004332386, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 523.867524239075, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 527.5907480449114, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 531.3139718507477, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 535.0371956565841, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 538.7604194624205, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 542.4836432682569, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 546.2068670740928, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 549.9300908799291, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 553.6533146857655, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 557.3765384916019, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 561.0997622974382, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 564.8229861032746, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 568.546209909111, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 572.2694337149474, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 575.9926575207837, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 579.7158813266201, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 583.439105132456, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 587.1623289382924, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 590.8855527441287, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 594.6087765499651, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 598.3320003558015, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 602.0552241616379, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 605.7784479674742, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 609.5016717733106, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 613.224895579147, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 616.9481193849833, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 620.6713431908192, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 624.3945669966556, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 628.117790802492, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 631.8410146083284, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 635.5642384141647, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 639.2874622200011, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 643.0106860258375, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 646.7339098316738, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 650.4571336375102, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 654.1803574433466, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 657.9035812491829, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 661.6268050550188, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 665.3500288608552, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 669.0732526666916, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 672.796476472528, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 676.5197002783643, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 680.2429240842007, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 683.9661478900371, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 687.6893716958734, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 691.4125955017098, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 695.1358193075462, + 16.556271815948207, + 17.06129169011831, + 16.051251941778105 + ], + [ + 698.8590431133821, + 16.657275790782137, + 17.06129169011831, + 16.253259891446078 + ], + [ + 702.5822669192185, + 16.657275790782137, + 17.06129169011831, + 16.253259891446078 + ], + [ + 706.3054907250548, + 16.657275790782137, + 17.06129169011831, + 16.253259891446078 + ], + [ + 710.0287145308912, + 16.657275790782137, + 17.06129169011831, + 16.253259891446078 + ], + [ + 713.7519383367276, + 16.657275790782137, + 17.06129169011831, + 16.253259891446078 + ], + [ + 717.4751621425639, + 16.657275790782137, + 17.06129169011831, + 16.253259891446078 + ], + [ + 721.1983859484003, + 16.657275790782137, + 17.06129169011831, + 16.253259891446078 + ], + [ + 724.9216097542367, + 16.657275790782137, + 17.06129169011831, + 16.253259891446078 + ], + [ + 728.644833560073, + 16.657275790782137, + 17.06129169011831, + 16.253259891446078 + ], + [ + 732.3680573659094, + 16.75827976561618, + 17.263299639786283, + 16.253259891446078 + ], + [ + 736.0912811717453, + 16.75827976561618, + 17.263299639786283, + 16.253259891446078 + ], + [ + 739.8145049775817, + 16.75827976561618, + 17.263299639786283, + 16.253259891446078 + ], + [ + 743.5377287834181, + 16.859283740450223, + 17.46530758945437, + 16.253259891446078 + ], + [ + 747.2609525892544, + 16.859283740450223, + 17.46530758945437, + 16.253259891446078 + ], + [ + 750.9841763950908, + 17.06129169011831, + 17.667315539122455, + 16.455267841114164 + ], + [ + 754.7074002009272, + 17.162295664952353, + 17.667315539122455, + 16.657275790782137 + ], + [ + 758.4306240067635, + 17.162295664952353, + 17.667315539122455, + 16.657275790782137 + ], + [ + 762.1538478125999, + 17.364303614620326, + 17.869323488790428, + 16.859283740450223 + ], + [ + 765.8770716184363, + 17.364303614620326, + 17.869323488790428, + 16.859283740450223 + ], + [ + 769.6002954242726, + 17.364303614620326, + 17.869323488790428, + 16.859283740450223 + ], + [ + 773.3235192301086, + 17.364303614620326, + 17.869323488790428, + 16.859283740450223 + ], + [ + 777.0467430359449, + 17.566311564288412, + 18.071331438458515, + 17.06129169011831 + ], + [ + 780.7699668417813, + 17.566311564288412, + 18.071331438458515, + 17.06129169011831 + ], + [ + 784.4931906476177, + 17.566311564288412, + 18.071331438458515, + 17.06129169011831 + ], + [ + 788.216414453454, + 17.566311564288412, + 18.071331438458515, + 17.06129169011831 + ], + [ + 791.9396382592904, + 17.566311564288412, + 18.071331438458515, + 17.06129169011831 + ], + [ + 795.6628620651268, + 17.566311564288412, + 18.071331438458515, + 17.06129169011831 + ], + [ + 799.3860858709631, + 17.667315539122455, + 18.071331438458515, + 17.263299639786283 + ], + [ + 803.1093096767995, + 17.667315539122455, + 18.071331438458515, + 17.263299639786283 + ], + [ + 806.8325334826359, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 810.5557572884718, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 814.2789810943082, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 818.0022049001445, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 821.7254287059809, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 825.4486525118173, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 829.1718763176536, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 832.89510012349, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 836.6183239293264, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 840.3415477351627, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 844.0647715409991, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 847.7879953468355, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 851.5112191526714, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 855.2344429585078, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 858.9576667643441, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 862.6808905701805, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 866.4041143760169, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 870.1273381818532, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 873.8505619876896, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 877.573785793526, + 17.768319513956385, + 18.475347337794574, + 17.46530758945437 + ], + [ + 881.2970095993624, + 17.667315539122455, + 17.869323488790428, + 17.46530758945437 + ], + [ + 885.0202334051987, + 17.768319513956385, + 18.071331438458515, + 17.46530758945437 + ], + [ + 888.7434572110346, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 892.466681016871, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 896.1899048227074, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 899.9131286285437, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 903.6363524343801, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 907.3595762402165, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 911.0828000460529, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 914.8060238518892, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 918.5292476577256, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 922.252471463562, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 925.9756952693979, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 929.6989190752342, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 933.4221428810706, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 937.145366686907, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 940.8685904927434, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 944.5918142985797, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 948.3150381044161, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 952.0382619102525, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 955.7614857160888, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 959.4847095219252, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 963.2079333277611, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 966.9311571335975, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 970.6543809394338, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 974.3776047452702, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 978.1008285511066, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 981.824052356943, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 985.5472761627793, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 989.2704999686157, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 992.9937237744521, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 996.7169475802884, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 1000.4401713861248, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 1004.1633951919607, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 1007.8866189977971, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 1011.6098428036335, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 1015.3330666094698, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 1019.0562904153062, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 1022.7795142211426, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 1026.502738026979, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 1030.2259618328153, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 1033.9491856386517, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 1037.672409444488, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 1041.395633250324, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 1045.1188570561603, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 1048.8420808619967, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 1052.565304667833, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 1056.2885284736694, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1060.0117522795058, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1063.7349760853422, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1067.4581998911785, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1071.181423697015, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1074.9046475028513, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1078.6278713086872, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1082.3510951145236, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1086.07431892036, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1089.7975427261963, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1093.5207665320327, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1097.243990337869, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1100.9672141437054, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1104.6904379495418, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1108.4136617553781, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1112.1368855612145, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1115.8601093670504, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1119.5833331728868, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1123.3065569787232, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1127.0297807845595, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1130.753004590396, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1134.4762283962323, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1138.1994522020686, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1141.922676007905, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1145.6458998137414, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1149.3691236195777, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1153.0923474254141, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1156.81557123125, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1160.5387950370864, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1164.2620188429228, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1167.9852426487591, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1171.7084664545955, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1175.4316902604319, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1179.1549140662682, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1182.8781378721046, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1186.601361677941, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1190.3245854837774, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1194.0478092896133, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1197.7710330954496, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1201.494256901286, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1205.2174807071224, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1208.9407045129587, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1212.6639283187951, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1216.3871521246315, + 17.667315539122455, + 18.071331438458515, + 17.263299639786283 + ], + [ + 1220.1103759304679, + 17.667315539122455, + 18.071331438458515, + 17.263299639786283 + ], + [ + 1223.8335997363042, + 17.667315539122455, + 18.071331438458515, + 17.263299639786283 + ], + [ + 1227.5568235421406, + 17.667315539122455, + 18.071331438458515, + 17.263299639786283 + ], + [ + 1231.2800473479765, + 17.667315539122455, + 18.071331438458515, + 17.263299639786283 + ], + [ + 1235.0032711538129, + 17.667315539122455, + 18.071331438458515, + 17.263299639786283 + ], + [ + 1238.7264949596492, + 17.667315539122455, + 18.071331438458515, + 17.263299639786283 + ], + [ + 1242.4497187654856, + 17.667315539122455, + 18.071331438458515, + 17.263299639786283 + ], + [ + 1246.172942571322, + 17.667315539122455, + 18.071331438458515, + 17.263299639786283 + ], + [ + 1249.8961663771584, + 17.667315539122455, + 18.071331438458515, + 17.263299639786283 + ], + [ + 1253.6193901829947, + 17.667315539122455, + 18.071331438458515, + 17.263299639786283 + ], + [ + 1257.342613988831, + 17.667315539122455, + 18.071331438458515, + 17.263299639786283 + ], + [ + 1261.0658377946675, + 17.667315539122455, + 18.071331438458515, + 17.263299639786283 + ], + [ + 1264.7890616005038, + 17.566311564288412, + 18.071331438458515, + 17.06129169011831 + ], + [ + 1268.5122854063397, + 17.566311564288412, + 18.071331438458515, + 17.06129169011831 + ], + [ + 1272.235509212176, + 17.566311564288412, + 18.071331438458515, + 17.06129169011831 + ], + [ + 1275.9587330180125, + 17.566311564288412, + 18.071331438458515, + 17.06129169011831 + ], + [ + 1279.6819568238489, + 17.566311564288412, + 18.071331438458515, + 17.06129169011831 + ], + [ + 1283.4051806296852, + 17.566311564288412, + 18.071331438458515, + 17.06129169011831 + ], + [ + 1287.1284044355216, + 17.566311564288412, + 18.071331438458515, + 17.06129169011831 + ], + [ + 1290.851628241358, + 17.566311564288412, + 18.071331438458515, + 17.06129169011831 + ], + [ + 1294.5748520471943, + 17.566311564288412, + 18.071331438458515, + 17.06129169011831 + ], + [ + 1298.2980758530307, + 17.566311564288412, + 18.071331438458515, + 17.06129169011831 + ], + [ + 1302.021299658867, + 17.566311564288412, + 18.071331438458515, + 17.06129169011831 + ], + [ + 1305.7445234647034, + 17.566311564288412, + 18.071331438458515, + 17.06129169011831 + ], + [ + 1309.4677472705393, + 17.566311564288412, + 18.071331438458515, + 17.06129169011831 + ], + [ + 1313.1909710763757, + 17.566311564288412, + 18.071331438458515, + 17.06129169011831 + ], + [ + 1316.914194882212, + 17.566311564288412, + 18.071331438458515, + 17.06129169011831 + ], + [ + 1320.6374186880485, + 17.566311564288412, + 18.071331438458515, + 17.06129169011831 + ], + [ + 1324.3606424938848, + 17.566311564288412, + 18.071331438458515, + 17.06129169011831 + ], + [ + 1328.0838662997212, + 17.566311564288412, + 18.071331438458515, + 17.06129169011831 + ], + [ + 1331.8070901055576, + 17.566311564288412, + 18.071331438458515, + 17.06129169011831 + ], + [ + 1335.530313911394, + 17.566311564288412, + 18.071331438458515, + 17.06129169011831 + ], + [ + 1339.2535377172303, + 17.566311564288412, + 18.071331438458515, + 17.06129169011831 + ], + [ + 1342.9767615230667, + 17.566311564288412, + 18.071331438458515, + 17.06129169011831 + ], + [ + 1346.6999853289026, + 17.566311564288412, + 18.071331438458515, + 17.06129169011831 + ], + [ + 1350.423209134739, + 17.566311564288412, + 18.071331438458515, + 17.06129169011831 + ], + [ + 1354.1464329405753, + 17.566311564288412, + 18.071331438458515, + 17.06129169011831 + ], + [ + 1357.8696567464117, + 17.566311564288412, + 18.071331438458515, + 17.06129169011831 + ], + [ + 1361.592880552248, + 17.566311564288412, + 18.071331438458515, + 17.06129169011831 + ], + [ + 1365.3161043580844, + 17.566311564288412, + 18.071331438458515, + 17.06129169011831 + ], + [ + 1369.0393281639208, + 17.566311564288412, + 18.071331438458515, + 17.06129169011831 + ], + [ + 1372.7625519697572, + 17.667315539122455, + 18.071331438458515, + 17.263299639786283 + ], + [ + 1376.4857757755935, + 17.667315539122455, + 18.071331438458515, + 17.263299639786283 + ], + [ + 1380.20899958143, + 17.667315539122455, + 18.071331438458515, + 17.263299639786283 + ], + [ + 1383.9322233872658, + 17.667315539122455, + 18.071331438458515, + 17.263299639786283 + ], + [ + 1387.6554471931022, + 17.667315539122455, + 18.071331438458515, + 17.263299639786283 + ], + [ + 1391.3786709989386, + 17.667315539122455, + 18.071331438458515, + 17.263299639786283 + ], + [ + 1395.101894804775, + 17.667315539122455, + 18.071331438458515, + 17.263299639786283 + ], + [ + 1398.8251186106113, + 17.667315539122455, + 18.071331438458515, + 17.263299639786283 + ], + [ + 1402.5483424164477, + 17.667315539122455, + 18.071331438458515, + 17.263299639786283 + ], + [ + 1406.271566222284, + 17.667315539122455, + 18.071331438458515, + 17.263299639786283 + ], + [ + 1409.9947900281204, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1413.7180138339568, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1417.4412376397931, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1421.164461445629, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1424.8876852514654, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1428.6109090573018, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1432.3341328631382, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1436.0573566689745, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1439.780580474811, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1443.5038042806473, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1447.2270280864836, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1450.95025189232, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 1454.6734756981564, + 17.97032746362447, + 18.67735528746266, + 17.263299639786283 + ], + [ + 1458.3966995039927, + 18.475347337794574, + 19.687395035802865, + 17.263299639786283 + ], + [ + 1462.1199233098287, + 18.879363237130633, + 20.495426834474983, + 17.263299639786283 + ], + [ + 1465.843147115665, + 19.283379136466692, + 21.303458633147216, + 17.263299639786283 + ], + [ + 1469.5663709215014, + 19.687395035802865, + 22.111490431819334, + 17.263299639786283 + ], + [ + 1473.2895947273378, + 20.29341888480701, + 22.71751428082348, + 17.869323488790428 + ], + [ + 1477.0128185331741, + 21.000446708645086, + 23.12153018015954, + 18.879363237130633 + ], + [ + 1480.7360423390105, + 21.808478507317318, + 23.727554029163684, + 19.889402985470838 + ], + [ + 1484.4592661448469, + 22.414502356321464, + 24.131569928499744, + 20.69743478414307 + ], + [ + 1488.1824899506832, + 23.020526205325496, + 24.535585827835916, + 21.50546658281519 + ], + [ + 1491.9057137565196, + 23.42454210466167, + 24.73759377750389, + 22.111490431819334 + ], + [ + 1495.628937562356, + 23.92956197883177, + 25.14160967683995, + 22.71751428082348 + ], + [ + 1499.352161368192, + 24.33357787816783, + 25.343617626508035, + 23.323538129827625 + ], + [ + 1503.0753851740283, + 24.636589802669846, + 25.54562557617612, + 23.727554029163684 + ], + [ + 1506.7986089798646, + 24.838597752337932, + 25.54562557617612, + 24.131569928499744 + ], + [ + 1510.521832785701, + 25.04060570200602, + 25.747633525844094, + 24.33357787816783 + ], + [ + 1514.2450565915374, + 25.14160967683995, + 25.747633525844094, + 24.535585827835916 + ], + [ + 1517.9682803973737, + 25.24261365167399, + 25.747633525844094, + 24.73759377750389 + ], + [ + 1521.6915042032101, + 25.343617626508035, + 25.747633525844094, + 24.939601727171976 + ], + [ + 1525.4147280090465, + 25.24261365167399, + 25.747633525844094, + 24.73759377750389 + ], + [ + 1529.1379518148829, + 25.24261365167399, + 25.747633525844094, + 24.73759377750389 + ], + [ + 1532.8611756207192, + 25.14160967683995, + 25.747633525844094, + 24.535585827835916 + ], + [ + 1536.5843994265551, + 24.939601727171976, + 25.54562557617612, + 24.33357787816783 + ], + [ + 1540.3076232323915, + 24.838597752337932, + 25.54562557617612, + 24.131569928499744 + ], + [ + 1544.0308470382279, + 24.73759377750389, + 25.343617626508035, + 24.131569928499744 + ], + [ + 1547.7540708440642, + 24.535585827835916, + 25.14160967683995, + 23.92956197883177 + ], + [ + 1551.4772946499006, + 24.434581853001873, + 25.14160967683995, + 23.727554029163684 + ], + [ + 1555.200518455737, + 24.232573903333787, + 24.939601727171976, + 23.525546079495598 + ], + [ + 1558.9237422615734, + 24.0305659536657, + 24.73759377750389, + 23.323538129827625 + ], + [ + 1562.6469660674097, + 23.828558003997728, + 24.535585827835916, + 23.12153018015954 + ], + [ + 1566.370189873246, + 23.62655005432964, + 24.33357787816783, + 22.919522230491566 + ], + [ + 1570.0934136790825, + 23.42454210466167, + 24.131569928499744, + 22.71751428082348 + ], + [ + 1573.8166374849188, + 23.222534154993582, + 23.92956197883177, + 22.515506331155393 + ], + [ + 1577.5398612907547, + 23.020526205325496, + 23.727554029163684, + 22.31349838148742 + ], + [ + 1581.2630850965916, + 22.818518255657523, + 23.525546079495598, + 22.111490431819334 + ], + [ + 1584.9863089024275, + 22.616510305989436, + 23.323538129827625, + 21.90948248215136 + ], + [ + 1588.7095327082643, + 22.414502356321464, + 23.12153018015954, + 21.707474532483275 + ], + [ + 1592.4327565141002, + 22.212494406653377, + 22.919522230491566, + 21.50546658281519 + ], + [ + 1596.1559803199361, + 21.90948248215136, + 22.71751428082348, + 21.10145068347913 + ], + [ + 1599.879204125773, + 21.707474532483275, + 22.515506331155393, + 20.899442733811043 + ], + [ + 1603.6024279316089, + 21.50546658281519, + 22.31349838148742, + 20.69743478414307 + ], + [ + 1607.3256517374457, + 21.303458633147216, + 22.111490431819334, + 20.495426834474983 + ], + [ + 1611.0488755432816, + 21.10145068347913, + 21.90948248215136, + 20.29341888480701 + ], + [ + 1614.7720993491184, + 20.899442733811043, + 21.707474532483275, + 20.091410935138924 + ], + [ + 1618.4953231549543, + 20.69743478414307, + 21.50546658281519, + 19.889402985470838 + ], + [ + 1622.2185469607912, + 20.39442285964094, + 21.10145068347913, + 19.687395035802865 + ], + [ + 1625.941770766627, + 20.192414909972968, + 20.899442733811043, + 19.48538708613478 + ], + [ + 1629.664994572464, + 19.99040696030488, + 20.69743478414307, + 19.283379136466692 + ], + [ + 1633.3882183782998, + 19.78839901063691, + 20.495426834474983, + 19.08137118679872 + ], + [ + 1637.1114421841357, + 19.687395035802865, + 20.29341888480701, + 19.08137118679872 + ], + [ + 1640.8346659899726, + 19.48538708613478, + 20.091410935138924, + 18.879363237130633 + ], + [ + 1644.5578897958085, + 19.384383111300735, + 20.091410935138924, + 18.67735528746266 + ], + [ + 1648.2811136016453, + 19.182375161632763, + 19.889402985470838, + 18.475347337794574 + ], + [ + 1652.0043374074812, + 19.08137118679872, + 19.687395035802865, + 18.475347337794574 + ], + [ + 1655.727561213318, + 18.879363237130633, + 19.48538708613478, + 18.273339388126487 + ], + [ + 1659.450785019154, + 18.879363237130633, + 19.48538708613478, + 18.273339388126487 + ], + [ + 1663.1740088249908, + 18.67735528746266, + 19.283379136466692, + 18.071331438458515 + ], + [ + 1666.8972326308267, + 18.576351312628617, + 19.08137118679872, + 18.071331438458515 + ], + [ + 1670.6204564366626, + 18.576351312628617, + 19.08137118679872, + 18.071331438458515 + ], + [ + 1674.3436802424994, + 18.576351312628617, + 19.08137118679872, + 18.071331438458515 + ], + [ + 1678.0669040483353, + 18.475347337794574, + 18.879363237130633, + 18.071331438458515 + ], + [ + 1681.7901278541722, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 1685.513351660008, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 1689.236575465845, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 1692.9597992716808, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 1696.6830230775176, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 1700.4062468833536, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 1704.1294706891904, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 1707.8526944950263, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 1711.5759183008622, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 1715.299142106699, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 1719.022365912535, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 1722.7455897183718, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 1726.4688135242077, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 1730.1920373300445, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 1733.9152611358804, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 1737.6384849417173, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 1741.3617087475532, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 1745.084932553389, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 1748.808156359226, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 1752.5313801650618, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 1756.2546039708986, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 1759.9778277767346, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 1763.7010515825714, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 1767.4242753884073, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 1771.1474991942441, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 1774.87072300008, + 18.475347337794574, + 19.08137118679872, + 17.869323488790428 + ], + [ + 1778.5939468059169, + 18.576351312628617, + 19.283379136466692, + 17.869323488790428 + ], + [ + 1782.3171706117528, + 18.980367211964676, + 19.889402985470838, + 18.071331438458515 + ], + [ + 1786.0403944175887, + 19.283379136466692, + 20.495426834474983, + 18.071331438458515 + ], + [ + 1789.7636182234255, + 19.78839901063691, + 21.303458633147216, + 18.273339388126487 + ], + [ + 1793.4868420292614, + 20.29341888480701, + 22.111490431819334, + 18.475347337794574 + ], + [ + 1797.2100658350982, + 20.899442733811043, + 22.919522230491566, + 18.879363237130633 + ], + [ + 1800.9332896409342, + 21.60647055764923, + 23.727554029163684, + 19.48538708613478 + ], + [ + 1804.656513446771, + 22.212494406653377, + 24.33357787816783, + 20.091410935138924 + ], + [ + 1808.379737252607, + 22.818518255657523, + 24.939601727171976, + 20.69743478414307 + ], + [ + 1812.1029610584437, + 23.525546079495598, + 25.54562557617612, + 21.50546658281519 + ], + [ + 1815.8261848642796, + 24.131569928499744, + 25.94964147551218, + 22.31349838148742 + ], + [ + 1819.5494086701165, + 24.73759377750389, + 26.35365737484824, + 23.12153018015954 + ], + [ + 1823.2726324759524, + 25.343617626508035, + 26.7576732741843, + 23.92956197883177 + ], + [ + 1826.9958562817883, + 25.747633525844094, + 26.959681223852385, + 24.535585827835916 + ], + [ + 1830.7190800876251, + 26.050645450346224, + 27.16168917352047, + 24.939601727171976 + ], + [ + 1834.442303893461, + 26.454661349682283, + 27.363697123188444, + 25.54562557617612 + ], + [ + 1838.1655276992979, + 26.7576732741843, + 27.56570507285653, + 25.94964147551218 + ], + [ + 1841.8887515051338, + 26.959681223852385, + 27.767713022524504, + 26.151649425180153 + ], + [ + 1845.6119753109706, + 27.2626931483544, + 27.96972097219259, + 26.555665324516326 + ], + [ + 1849.3351991168065, + 27.363697123188444, + 27.96972097219259, + 26.7576732741843 + ], + [ + 1853.0584229226433, + 27.56570507285653, + 28.171728921860677, + 26.959681223852385 + ], + [ + 1856.7816467284792, + 27.666709047690574, + 28.171728921860677, + 27.16168917352047 + ], + [ + 1860.5048705343152, + 27.767713022524504, + 28.37373687152865, + 27.16168917352047 + ], + [ + 1864.228094340152, + 27.868716997358547, + 28.37373687152865, + 27.363697123188444 + ], + [ + 1867.951318145988, + 27.868716997358547, + 28.37373687152865, + 27.363697123188444 + ], + [ + 1871.6745419518247, + 27.868716997358547, + 28.37373687152865, + 27.363697123188444 + ], + [ + 1875.3977657576606, + 27.868716997358547, + 28.37373687152865, + 27.363697123188444 + ], + [ + 1879.1209895634975, + 27.868716997358547, + 28.37373687152865, + 27.363697123188444 + ], + [ + 1882.8442133693334, + 27.868716997358547, + 28.37373687152865, + 27.363697123188444 + ], + [ + 1886.5674371751702, + 27.868716997358547, + 28.37373687152865, + 27.363697123188444 + ], + [ + 1890.290660981006, + 27.666709047690574, + 28.171728921860677, + 27.16168917352047 + ], + [ + 1894.013884786843, + 27.666709047690574, + 28.171728921860677, + 27.16168917352047 + ], + [ + 1897.7371085926789, + 27.666709047690574, + 28.171728921860677, + 27.16168917352047 + ], + [ + 1901.4603323985148, + 27.464701098022488, + 27.96972097219259, + 26.959681223852385 + ], + [ + 1905.1835562043516, + 27.464701098022488, + 27.96972097219259, + 26.959681223852385 + ], + [ + 1908.9067800101875, + 27.363697123188444, + 27.96972097219259, + 26.7576732741843 + ], + [ + 1912.6300038160243, + 27.2626931483544, + 27.767713022524504, + 26.7576732741843 + ], + [ + 1916.3532276218602, + 27.16168917352047, + 27.767713022524504, + 26.555665324516326 + ], + [ + 1920.076451427697, + 27.06068519868643, + 27.56570507285653, + 26.555665324516326 + ], + [ + 1923.799675233533, + 26.959681223852385, + 27.56570507285653, + 26.35365737484824 + ], + [ + 1927.5228990393698, + 26.858677249018342, + 27.363697123188444, + 26.35365737484824 + ], + [ + 1931.2461228452057, + 26.7576732741843, + 27.363697123188444, + 26.151649425180153 + ], + [ + 1934.9693466510425, + 26.65666929935037, + 27.16168917352047, + 26.151649425180153 + ], + [ + 1938.6925704568785, + 26.65666929935037, + 27.16168917352047, + 26.151649425180153 + ], + [ + 1942.4157942627144, + 26.555665324516326, + 27.16168917352047, + 25.94964147551218 + ], + [ + 1946.1390180685512, + 26.454661349682283, + 26.959681223852385, + 25.94964147551218 + ], + [ + 1949.862241874387, + 26.35365737484824, + 26.959681223852385, + 25.747633525844094 + ], + [ + 1953.585465680224, + 26.252653400014196, + 26.7576732741843, + 25.747633525844094 + ], + [ + 1957.3086894860598, + 26.151649425180153, + 26.7576732741843, + 25.54562557617612 + ], + [ + 1961.0319132918967, + 26.050645450346224, + 26.555665324516326, + 25.54562557617612 + ], + [ + 1964.7551370977326, + 25.94964147551218, + 26.555665324516326, + 25.343617626508035 + ], + [ + 1968.4783609035694, + 25.848637500678137, + 26.35365737484824, + 25.343617626508035 + ], + [ + 1972.2015847094053, + 25.848637500678137, + 26.35365737484824, + 25.343617626508035 + ], + [ + 1975.9248085152412, + 25.747633525844094, + 26.35365737484824, + 25.14160967683995 + ], + [ + 1979.648032321078, + 25.64662955101005, + 26.151649425180153, + 25.14160967683995 + ], + [ + 1983.371256126914, + 25.54562557617612, + 26.151649425180153, + 24.939601727171976 + ], + [ + 1987.0944799327508, + 25.444621601342078, + 25.94964147551218, + 24.939601727171976 + ], + [ + 1990.8177037385867, + 25.343617626508035, + 25.94964147551218, + 24.73759377750389 + ], + [ + 1994.5409275444235, + 25.24261365167399, + 25.747633525844094, + 24.73759377750389 + ], + [ + 1998.2641513502595, + 25.24261365167399, + 25.747633525844094, + 24.73759377750389 + ], + [ + 2001.9873751560963, + 25.04060570200602, + 25.54562557617612, + 24.535585827835916 + ], + [ + 2005.7105989619322, + 25.04060570200602, + 25.54562557617612, + 24.535585827835916 + ], + [ + 2009.433822767769, + 24.939601727171976, + 25.54562557617612, + 24.33357787816783 + ], + [ + 2013.157046573605, + 24.838597752337932, + 25.343617626508035, + 24.33357787816783 + ], + [ + 2016.8802703794408, + 24.73759377750389, + 25.343617626508035, + 24.131569928499744 + ], + [ + 2020.6034941852777, + 24.636589802669846, + 25.14160967683995, + 24.131569928499744 + ], + [ + 2024.3267179911136, + 24.636589802669846, + 25.14160967683995, + 24.131569928499744 + ], + [ + 2028.0499417969504, + 24.434581853001873, + 24.939601727171976, + 23.92956197883177 + ], + [ + 2031.7731656027863, + 24.434581853001873, + 24.939601727171976, + 23.92956197883177 + ], + [ + 2035.4963894086231, + 24.33357787816783, + 24.939601727171976, + 23.727554029163684 + ], + [ + 2039.219613214459, + 24.232573903333787, + 24.73759377750389, + 23.727554029163684 + ], + [ + 2042.9428370202959, + 24.131569928499744, + 24.73759377750389, + 23.525546079495598 + ], + [ + 2046.6660608261318, + 24.0305659536657, + 24.535585827835916, + 23.525546079495598 + ], + [ + 2050.3892846319677, + 24.0305659536657, + 24.535585827835916, + 23.525546079495598 + ], + [ + 2054.1125084378045, + 23.828558003997728, + 24.33357787816783, + 23.323538129827625 + ], + [ + 2057.8357322436405, + 23.828558003997728, + 24.33357787816783, + 23.323538129827625 + ], + [ + 2061.5589560494773, + 23.727554029163684, + 24.33357787816783, + 23.12153018015954 + ], + [ + 2065.282179855313, + 23.62655005432964, + 24.131569928499744, + 23.12153018015954 + ], + [ + 2069.00540366115, + 23.525546079495598, + 24.131569928499744, + 22.919522230491566 + ], + [ + 2072.728627466986, + 23.42454210466167, + 23.92956197883177, + 22.919522230491566 + ], + [ + 2076.4518512728228, + 23.42454210466167, + 23.92956197883177, + 22.919522230491566 + ], + [ + 2080.1750750786587, + 23.222534154993582, + 23.727554029163684, + 22.71751428082348 + ], + [ + 2083.8982988844955, + 23.222534154993582, + 23.727554029163684, + 22.71751428082348 + ], + [ + 2087.6215226903314, + 23.12153018015954, + 23.727554029163684, + 22.515506331155393 + ], + [ + 2091.3447464961673, + 23.020526205325496, + 23.525546079495598, + 22.515506331155393 + ], + [ + 2095.067970302004, + 22.919522230491566, + 23.525546079495598, + 22.31349838148742 + ], + [ + 2098.79119410784, + 22.818518255657523, + 23.323538129827625, + 22.31349838148742 + ], + [ + 2102.514417913677, + 22.818518255657523, + 23.323538129827625, + 22.31349838148742 + ], + [ + 2106.237641719513, + 22.616510305989436, + 23.12153018015954, + 22.111490431819334 + ], + [ + 2109.9608655253496, + 22.616510305989436, + 23.12153018015954, + 22.111490431819334 + ], + [ + 2113.6840893311855, + 22.515506331155393, + 23.12153018015954, + 21.90948248215136 + ], + [ + 2117.4073131370224, + 22.414502356321464, + 22.919522230491566, + 21.90948248215136 + ], + [ + 2121.1305369428583, + 22.31349838148742, + 22.919522230491566, + 21.707474532483275 + ], + [ + 2124.853760748695, + 22.212494406653377, + 22.71751428082348, + 21.707474532483275 + ], + [ + 2128.576984554531, + 22.212494406653377, + 22.71751428082348, + 21.707474532483275 + ], + [ + 2132.300208360367, + 22.111490431819334, + 22.71751428082348, + 21.50546658281519 + ], + [ + 2136.0234321662037, + 22.01048645698529, + 22.515506331155393, + 21.50546658281519 + ], + [ + 2139.7466559720397, + 21.90948248215136, + 22.515506331155393, + 21.303458633147216 + ], + [ + 2143.4698797778765, + 21.808478507317318, + 22.31349838148742, + 21.303458633147216 + ], + [ + 2147.1931035837124, + 21.808478507317318, + 22.31349838148742, + 21.303458633147216 + ], + [ + 2150.916327389549, + 21.60647055764923, + 22.111490431819334, + 21.10145068347913 + ], + [ + 2154.639551195385, + 21.60647055764923, + 22.111490431819334, + 21.10145068347913 + ], + [ + 2158.362775001222, + 21.50546658281519, + 22.111490431819334, + 20.899442733811043 + ], + [ + 2162.085998807058, + 21.404462607981145, + 21.90948248215136, + 20.899442733811043 + ], + [ + 2165.809222612894, + 21.303458633147216, + 21.90948248215136, + 20.69743478414307 + ], + [ + 2169.5324464187306, + 21.202454658313172, + 21.707474532483275, + 20.69743478414307 + ], + [ + 2173.2556702245665, + 21.202454658313172, + 21.707474532483275, + 20.69743478414307 + ], + [ + 2176.9788940304034, + 21.10145068347913, + 21.707474532483275, + 20.495426834474983 + ], + [ + 2180.7021178362393, + 21.000446708645086, + 21.50546658281519, + 20.495426834474983 + ], + [ + 2184.425341642076, + 20.899442733811043, + 21.50546658281519, + 20.29341888480701 + ], + [ + 2188.148565447912, + 20.798438758977113, + 21.303458633147216, + 20.29341888480701 + ], + [ + 2191.871789253749, + 20.798438758977113, + 21.303458633147216, + 20.29341888480701 + ], + [ + 2195.5950130595847, + 20.596430809309027, + 21.10145068347913, + 20.091410935138924 + ], + [ + 2199.3182368654216, + 20.596430809309027, + 21.10145068347913, + 20.091410935138924 + ], + [ + 2203.0414606712575, + 20.495426834474983, + 21.10145068347913, + 19.889402985470838 + ], + [ + 2206.7646844770934, + 20.39442285964094, + 20.899442733811043, + 19.889402985470838 + ], + [ + 2210.48790828293, + 20.29341888480701, + 20.899442733811043, + 19.687395035802865 + ], + [ + 2214.211132088766, + 20.192414909972968, + 20.69743478414307, + 19.687395035802865 + ], + [ + 2217.934355894603, + 20.192414909972968, + 20.69743478414307, + 19.687395035802865 + ], + [ + 2221.657579700439, + 20.091410935138924, + 20.69743478414307, + 19.48538708613478 + ], + [ + 2225.3808035062757, + 19.99040696030488, + 20.495426834474983, + 19.48538708613478 + ], + [ + 2229.1040273121116, + 19.889402985470838, + 20.495426834474983, + 19.283379136466692 + ], + [ + 2232.8272511179484, + 19.78839901063691, + 20.29341888480701, + 19.283379136466692 + ], + [ + 2236.5504749237843, + 19.78839901063691, + 20.29341888480701, + 19.283379136466692 + ], + [ + 2240.273698729621, + 19.78839901063691, + 20.29341888480701, + 19.283379136466692 + ], + [ + 2243.996922535457, + 19.586391060968822, + 20.091410935138924, + 19.08137118679872 + ], + [ + 2247.720146341293, + 19.586391060968822, + 20.091410935138924, + 19.08137118679872 + ], + [ + 2251.44337014713, + 19.586391060968822, + 20.091410935138924, + 19.08137118679872 + ], + [ + 2255.1665939529657, + 19.586391060968822, + 20.091410935138924, + 19.08137118679872 + ], + [ + 2258.8898177588026, + 19.586391060968822, + 20.091410935138924, + 19.08137118679872 + ], + [ + 2262.6130415646385, + 19.586391060968822, + 20.091410935138924, + 19.08137118679872 + ], + [ + 2266.3362653704753, + 19.48538708613478, + 19.889402985470838, + 19.08137118679872 + ], + [ + 2270.059489176311, + 19.384383111300735, + 19.889402985470838, + 18.879363237130633 + ], + [ + 2273.782712982148, + 19.384383111300735, + 19.889402985470838, + 18.879363237130633 + ], + [ + 2277.505936787984, + 19.384383111300735, + 19.889402985470838, + 18.879363237130633 + ], + [ + 2281.22916059382, + 19.384383111300735, + 19.889402985470838, + 18.879363237130633 + ], + [ + 2284.9523843996567, + 19.384383111300735, + 19.889402985470838, + 18.879363237130633 + ], + [ + 2288.6756082054926, + 19.384383111300735, + 19.889402985470838, + 18.879363237130633 + ], + [ + 2292.3988320113294, + 19.384383111300735, + 19.889402985470838, + 18.879363237130633 + ], + [ + 2296.1220558171653, + 19.384383111300735, + 19.889402985470838, + 18.879363237130633 + ], + [ + 2299.845279623002, + 19.283379136466692, + 19.687395035802865, + 18.879363237130633 + ], + [ + 2303.568503428838, + 19.182375161632763, + 19.687395035802865, + 18.67735528746266 + ], + [ + 2307.291727234675, + 19.182375161632763, + 19.687395035802865, + 18.67735528746266 + ], + [ + 2311.014951040511, + 19.182375161632763, + 19.687395035802865, + 18.67735528746266 + ], + [ + 2314.7381748463476, + 19.182375161632763, + 19.687395035802865, + 18.67735528746266 + ], + [ + 2318.4613986521836, + 19.182375161632763, + 19.687395035802865, + 18.67735528746266 + ], + [ + 2322.1846224580195, + 19.182375161632763, + 19.687395035802865, + 18.67735528746266 + ], + [ + 2325.9078462638563, + 19.182375161632763, + 19.687395035802865, + 18.67735528746266 + ], + [ + 2329.631070069692, + 19.182375161632763, + 19.687395035802865, + 18.67735528746266 + ], + [ + 2333.354293875529, + 19.182375161632763, + 19.687395035802865, + 18.67735528746266 + ], + [ + 2337.077517681365, + 19.182375161632763, + 19.687395035802865, + 18.67735528746266 + ], + [ + 2340.800741487202, + 19.182375161632763, + 19.687395035802865, + 18.67735528746266 + ], + [ + 2344.5239652930377, + 19.08137118679872, + 19.48538708613478, + 18.67735528746266 + ], + [ + 2348.2471890988745, + 19.08137118679872, + 19.48538708613478, + 18.67735528746266 + ], + [ + 2351.9704129047104, + 18.980367211964676, + 19.48538708613478, + 18.475347337794574 + ], + [ + 2355.6936367105463, + 18.980367211964676, + 19.48538708613478, + 18.475347337794574 + ], + [ + 2359.416860516383, + 18.980367211964676, + 19.48538708613478, + 18.475347337794574 + ], + [ + 2363.140084322219, + 18.980367211964676, + 19.48538708613478, + 18.475347337794574 + ], + [ + 2366.863308128056, + 18.980367211964676, + 19.48538708613478, + 18.475347337794574 + ], + [ + 2370.586531933892, + 18.980367211964676, + 19.48538708613478, + 18.475347337794574 + ], + [ + 2374.3097557397286, + 18.980367211964676, + 19.48538708613478, + 18.475347337794574 + ], + [ + 2378.0329795455646, + 18.980367211964676, + 19.48538708613478, + 18.475347337794574 + ], + [ + 2381.7562033514014, + 18.980367211964676, + 19.48538708613478, + 18.475347337794574 + ], + [ + 2385.4794271572373, + 18.980367211964676, + 19.48538708613478, + 18.475347337794574 + ], + [ + 2389.202650963074, + 18.980367211964676, + 19.48538708613478, + 18.475347337794574 + ], + [ + 2392.92587476891, + 18.980367211964676, + 19.48538708613478, + 18.475347337794574 + ], + [ + 2396.649098574746, + 18.980367211964676, + 19.48538708613478, + 18.475347337794574 + ], + [ + 2400.372322380583, + 18.980367211964676, + 19.48538708613478, + 18.475347337794574 + ], + [ + 2404.0955461864187, + 18.879363237130633, + 19.283379136466692, + 18.475347337794574 + ], + [ + 2407.8187699922555, + 18.879363237130633, + 19.283379136466692, + 18.475347337794574 + ], + [ + 2411.5419937980914, + 18.879363237130633, + 19.283379136466692, + 18.475347337794574 + ], + [ + 2415.2652176039282, + 18.77835926229659, + 19.283379136466692, + 18.273339388126487 + ], + [ + 2418.988441409764, + 18.77835926229659, + 19.283379136466692, + 18.273339388126487 + ], + [ + 2422.711665215601, + 18.77835926229659, + 19.283379136466692, + 18.273339388126487 + ], + [ + 2426.434889021437, + 18.77835926229659, + 19.283379136466692, + 18.273339388126487 + ], + [ + 2430.1581128272737, + 18.77835926229659, + 19.283379136466692, + 18.273339388126487 + ], + [ + 2433.8813366331096, + 18.77835926229659, + 19.283379136466692, + 18.273339388126487 + ], + [ + 2437.6045604389456, + 18.77835926229659, + 19.283379136466692, + 18.273339388126487 + ], + [ + 2441.3277842447824, + 18.77835926229659, + 19.283379136466692, + 18.273339388126487 + ], + [ + 2445.0510080506183, + 18.77835926229659, + 19.283379136466692, + 18.273339388126487 + ], + [ + 2448.774231856455, + 18.77835926229659, + 19.283379136466692, + 18.273339388126487 + ], + [ + 2452.497455662291, + 18.77835926229659, + 19.283379136466692, + 18.273339388126487 + ], + [ + 2456.220679468128, + 18.77835926229659, + 19.283379136466692, + 18.273339388126487 + ], + [ + 2459.9439032739638, + 18.77835926229659, + 19.283379136466692, + 18.273339388126487 + ], + [ + 2463.6671270798006, + 18.77835926229659, + 19.283379136466692, + 18.273339388126487 + ], + [ + 2467.3903508856365, + 18.77835926229659, + 19.283379136466692, + 18.273339388126487 + ], + [ + 2471.1135746914724, + 18.77835926229659, + 19.283379136466692, + 18.273339388126487 + ], + [ + 2474.8367984973092, + 18.77835926229659, + 19.283379136466692, + 18.273339388126487 + ], + [ + 2478.560022303145, + 18.77835926229659, + 19.283379136466692, + 18.273339388126487 + ], + [ + 2482.283246108982, + 18.77835926229659, + 19.283379136466692, + 18.273339388126487 + ], + [ + 2486.006469914818, + 18.67735528746266, + 19.08137118679872, + 18.273339388126487 + ], + [ + 2489.7296937206547, + 18.67735528746266, + 19.08137118679872, + 18.273339388126487 + ], + [ + 2493.4529175264906, + 18.67735528746266, + 19.08137118679872, + 18.273339388126487 + ], + [ + 2497.1761413323275, + 18.67735528746266, + 19.08137118679872, + 18.273339388126487 + ], + [ + 2500.8993651381634, + 18.576351312628617, + 19.08137118679872, + 18.071331438458515 + ], + [ + 2504.622588944, + 18.576351312628617, + 19.08137118679872, + 18.071331438458515 + ], + [ + 2508.345812749836, + 18.576351312628617, + 19.08137118679872, + 18.071331438458515 + ], + [ + 2512.069036555672, + 18.576351312628617, + 19.08137118679872, + 18.071331438458515 + ], + [ + 2515.792260361509, + 18.576351312628617, + 19.08137118679872, + 18.071331438458515 + ], + [ + 2519.5154841673448, + 18.576351312628617, + 19.08137118679872, + 18.071331438458515 + ], + [ + 2523.2387079731816, + 18.576351312628617, + 19.08137118679872, + 18.071331438458515 + ], + [ + 2526.9619317790175, + 18.576351312628617, + 19.08137118679872, + 18.071331438458515 + ], + [ + 2530.6851555848543, + 18.576351312628617, + 19.08137118679872, + 18.071331438458515 + ], + [ + 2534.4083793906902, + 18.576351312628617, + 19.08137118679872, + 18.071331438458515 + ], + [ + 2538.131603196527, + 18.576351312628617, + 19.08137118679872, + 18.071331438458515 + ], + [ + 2541.854827002363, + 18.576351312628617, + 19.08137118679872, + 18.071331438458515 + ], + [ + 2545.578050808199, + 18.576351312628617, + 19.08137118679872, + 18.071331438458515 + ], + [ + 2549.3012746140357, + 18.576351312628617, + 19.08137118679872, + 18.071331438458515 + ], + [ + 2553.0244984198716, + 18.576351312628617, + 19.08137118679872, + 18.071331438458515 + ], + [ + 2556.7477222257085, + 18.576351312628617, + 19.08137118679872, + 18.071331438458515 + ], + [ + 2560.4709460315444, + 18.576351312628617, + 19.08137118679872, + 18.071331438458515 + ], + [ + 2564.194169837381, + 18.576351312628617, + 19.08137118679872, + 18.071331438458515 + ], + [ + 2567.917393643217, + 18.576351312628617, + 19.08137118679872, + 18.071331438458515 + ], + [ + 2571.640617449054, + 18.576351312628617, + 19.08137118679872, + 18.071331438458515 + ], + [ + 2575.36384125489, + 18.576351312628617, + 19.08137118679872, + 18.071331438458515 + ], + [ + 2579.0870650607267, + 18.576351312628617, + 19.08137118679872, + 18.071331438458515 + ], + [ + 2582.8102888665626, + 18.576351312628617, + 19.08137118679872, + 18.071331438458515 + ], + [ + 2586.5335126723985, + 18.475347337794574, + 18.879363237130633, + 18.071331438458515 + ], + [ + 2590.2567364782353, + 18.475347337794574, + 18.879363237130633, + 18.071331438458515 + ], + [ + 2593.9799602840712, + 18.475347337794574, + 18.879363237130633, + 18.071331438458515 + ], + [ + 2597.703184089908, + 18.475347337794574, + 18.879363237130633, + 18.071331438458515 + ], + [ + 2601.426407895744, + 18.475347337794574, + 18.879363237130633, + 18.071331438458515 + ], + [ + 2605.149631701581, + 18.475347337794574, + 18.879363237130633, + 18.071331438458515 + ], + [ + 2608.8728555074167, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 2612.5960793132535, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 2616.3193031190895, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 2620.0425269249263, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 2623.765750730762, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 2627.488974536598, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 2631.212198342435, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 2634.935422148271, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 2638.6586459541077, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 2642.3818697599436, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 2646.1050935657804, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 2649.8283173716163, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 2653.551541177453, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 2657.274764983289, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 2660.997988789125, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 2664.721212594962, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 2668.4444364007977, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 2672.1676602066345, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 2675.8908840124705, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 2679.6141078183073, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 2683.337331624143, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 2687.06055542998, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 2690.783779235816, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 2694.5070030416528, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 2698.2302268474887, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 2701.9534506533246, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 2705.6766744591614, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 2709.3998982649973, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 2713.123122070834, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 2716.84634587667, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 2720.569569682507, + 18.37434336296053, + 18.879363237130633, + 17.869323488790428 + ], + [ + 2724.292793488343, + 18.273339388126487, + 18.67735528746266, + 17.869323488790428 + ], + [ + 2728.0160172941796, + 18.273339388126487, + 18.67735528746266, + 17.869323488790428 + ], + [ + 2731.7392411000155, + 18.273339388126487, + 18.67735528746266, + 17.869323488790428 + ], + [ + 2735.4624649058524, + 18.273339388126487, + 18.67735528746266, + 17.869323488790428 + ], + [ + 2739.1856887116883, + 18.273339388126487, + 18.67735528746266, + 17.869323488790428 + ], + [ + 2742.908912517524, + 18.273339388126487, + 18.67735528746266, + 17.869323488790428 + ], + [ + 2746.632136323361, + 18.273339388126487, + 18.67735528746266, + 17.869323488790428 + ], + [ + 2750.355360129197, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 2754.0785839350337, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 2757.8018077408697, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 2761.5250315467065, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 2765.2482553525424, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 2768.971479158379, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 2772.694702964215, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 2776.417926770051, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 2780.141150575888, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 2783.864374381724, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 2787.5875981875606, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 2791.3108219933965, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 2795.0340457992334, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 2798.7572696050693, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 2802.480493410906, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 2806.203717216742, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 2809.926941022579, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 2813.6501648284147, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 2817.3733886342507, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 2821.0966124400875, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 2824.8198362459234, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 2828.54306005176, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 2832.266283857596, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 2835.989507663433, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 2839.712731469269, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 2843.4359552751057, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 2847.1591790809416, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 2850.8824028867775, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 2854.6056266926144, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 2858.3288504984503, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 2862.052074304287, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 2865.775298110123, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 2869.49852191596, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 2873.2217457217957, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 2876.9449695276326, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 2880.6681933334685, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 2884.3914171393053, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 2888.114640945141, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 2891.837864750977, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 2895.561088556814, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 2899.28431236265, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 2903.0075361684867, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 2906.7307599743226, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 2910.4539837801594, + 18.071331438458515, + 18.475347337794574, + 17.667315539122455 + ], + [ + 2914.1772075859953, + 18.071331438458515, + 18.475347337794574, + 17.667315539122455 + ], + [ + 2917.900431391832, + 18.071331438458515, + 18.475347337794574, + 17.667315539122455 + ], + [ + 2921.623655197668, + 18.071331438458515, + 18.475347337794574, + 17.667315539122455 + ], + [ + 2925.346879003505, + 18.071331438458515, + 18.475347337794574, + 17.667315539122455 + ], + [ + 2929.070102809341, + 18.071331438458515, + 18.475347337794574, + 17.667315539122455 + ], + [ + 2932.7933266151767, + 18.071331438458515, + 18.475347337794574, + 17.667315539122455 + ], + [ + 2936.5165504210136, + 18.071331438458515, + 18.475347337794574, + 17.667315539122455 + ], + [ + 2940.2397742268495, + 18.071331438458515, + 18.475347337794574, + 17.667315539122455 + ], + [ + 2943.9629980326863, + 18.071331438458515, + 18.475347337794574, + 17.667315539122455 + ], + [ + 2947.686221838522, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 2951.409445644359, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 2955.132669450195, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 2958.855893256032, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 2962.5791170618677, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 2966.3023408677036, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 2970.0255646735404, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 2973.7487884793763, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 2977.472012285213, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 2981.195236091049, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 2984.918459896886, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 2988.641683702722, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 2992.3649075085586, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 2996.0881313143946, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 2999.8113551202314, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3003.5345789260673, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3007.257802731903, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3010.98102653774, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3014.704250343576, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3018.427474149413, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3022.1506979552487, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3025.8739217610855, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3029.5971455669214, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3033.3203693727583, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3037.043593178594, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3040.766816984431, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3044.490040790267, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3048.213264596103, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3051.9364884019396, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3055.6597122077756, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3059.3829360136124, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3063.1061598194483, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3066.829383625285, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3070.552607431121, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3074.275831236958, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3077.9990550427938, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3081.7222788486297, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3085.4455026544665, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3089.1687264603024, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3092.8919502661392, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3096.615174071975, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3100.338397877812, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3104.061621683648, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3107.7848454894847, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3111.5080692953206, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3115.2312931011575, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3118.9545169069934, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3122.6777407128293, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3126.400964518666, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3130.124188324502, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3133.847412130339, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3137.5706359361748, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3141.2938597420116, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3145.0170835478475, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3148.7403073536843, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3152.4635311595202, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3156.186754965356, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3159.909978771193, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3163.633202577029, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3167.3564263828657, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3171.0796501887016, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3174.8028739945385, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3178.5260978003744, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3182.249321606211, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3185.972545412047, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3189.695769217884, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 3193.41899302372, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 3197.1422168295558, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 3200.8654406353926, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 3204.5886644412285, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 3208.3118882470653, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 3212.0351120529012, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 3215.758335858738, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 3219.481559664574, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 3223.204783470411, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 3226.9280072762467, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 3230.6512310820835, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 3234.3744548879195, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 3238.0976786937554, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 3241.820902499592, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 3245.544126305428, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 3249.267350111265, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 3252.990573917101, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 3256.7137977229377, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 3260.4370215287736, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3264.1602453346104, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3267.8834691404463, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3271.6066929462822, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3275.329916752119, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3279.053140557955, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3282.776364363792, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3286.4995881696277, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3290.2228119754645, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3293.9460357813005, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3297.6692595871373, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3301.392483392973, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3305.11570719881, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3308.838931004646, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3312.562154810482, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3316.2853786163187, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3320.0086024221546, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3323.7318262279914, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3327.4550500338273, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3331.178273839664, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3334.9014976455, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3338.624721451337, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3342.347945257173, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3346.0711690630087, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3349.7943928688455, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3353.5176166746814, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3357.2408404805183, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3360.964064286354, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3364.687288092191, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3368.410511898027, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3372.1337357038637, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3375.8569595096997, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3379.5801833155365, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3383.3034071213724, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3387.0266309272083, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3390.749854733045, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3394.473078538881, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3398.196302344718, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3401.919526150554, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3405.6427499563906, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3409.3659737622265, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3413.0891975680634, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3416.8124213738993, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3420.535645179736, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3424.258868985572, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3427.982092791408, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3431.7053165972447, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3435.4285404030807, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3439.1517642089175, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3442.8749880147534, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3446.59821182059, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3450.321435626426, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3454.044659432263, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3457.767883238099, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3461.491107043935, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3465.2143308497716, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3468.9375546556075, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3472.6607784614444, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3476.3840022672803, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3480.107226073117, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3483.830449878953, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3487.55367368479, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3491.2768974906257, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3495.0001212964626, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3498.7233451022985, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3502.4465689081344, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3506.169792713971, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3509.893016519807, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3513.616240325644, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3517.33946413148, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3521.0626879373167, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3524.7859117431526, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3528.5091355489894, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3532.2323593548253, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3535.955583160662, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3539.678806966498, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3543.402030772334, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3547.125254578171, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3550.8484783840067, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3554.5717021898436, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3558.2949259956795, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3562.0181498015163, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3565.741373607352, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3569.464597413189, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3573.187821219025, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3576.911045024861, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3580.6342688306977, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3584.3574926365336, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3588.0807164423704, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3591.8039402482063, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3595.527164054043, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3599.250387859879, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3602.973611665716, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3606.696835471552, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3610.4200592773886, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3614.1432830832246, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3617.8665068890605, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3621.5897306948973, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3625.312954500733, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3629.03617830657, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3632.759402112406, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3636.482625918243, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3640.2058497240787, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3643.9290735299155, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3647.6522973357514, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3651.3755211415873, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3655.098744947424, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3658.82196875326, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3662.545192559097, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3666.268416364933, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3669.9916401707696, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3673.7148639766056, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3677.4380877824424, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3681.1613115882783, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3684.884535394115, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3688.607759199951, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3692.330983005787, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3696.0542068116238, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3699.7774306174597, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3703.5006544232965, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3707.2238782291324, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3710.9471020349692, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3714.670325840805, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3718.393549646642, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3722.116773452478, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3725.8399972583147, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3729.5632210641506, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3733.2864448699866, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3737.0096686758234, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3740.7328924816593, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3744.456116287496, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3748.179340093332, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3751.902563899169, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3755.6257877050048, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3759.3490115108416, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3763.0722353166775, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3766.7954591225134, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3770.5186829283502, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3774.241906734186, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3777.965130540023, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3781.688354345859, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3785.4115781516957, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3789.1348019575316, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3792.8580257633685, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3796.5812495692044, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3800.304473375041, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3804.027697180877, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3807.750920986713, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3811.47414479255, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3815.1973685983858, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3818.9205924042226, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3822.6438162100585, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3826.3670400158953, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3830.0902638217312, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3833.813487627568, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3837.536711433404, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3841.259935239241, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3844.9831590450767, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3848.7063828509126, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3852.4296066567495, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3856.1528304625854, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3859.876054268422, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3863.599278074258, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3867.322501880095, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3871.045725685931, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3874.7689494917677, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3878.4921732976036, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3882.2153971034395, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3885.9386209092763, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3889.6618447151122, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3893.385068520949, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3897.108292326785, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3900.831516132622, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3904.5547399384577, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3908.2779637442945, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3912.0011875501305, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3915.7244113559673, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3919.447635161803, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3923.170858967639, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3926.894082773476, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3930.617306579312, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3934.3405303851487, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3938.0637541909846, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3941.7869779968214, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3945.5102018026573, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3949.233425608494, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3952.95664941433, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3956.679873220166, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3960.403097026003, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3964.1263208318387, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3967.8495446376755, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3971.5727684435114, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3975.2959922493483, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3979.019216055184, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3982.742439861021, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3986.465663666857, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3990.1888874726938, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3993.9121112785297, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 3997.6353350843656, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4001.3585588902024, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4005.0817826960383, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4008.805006501875, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4012.528230307711, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4016.251454113548, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4019.974677919384, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4023.6979017252206, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4027.4211255310565, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4031.1443493368934, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4034.8675731427293, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4038.590796948565, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4042.314020754402, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4046.037244560238, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4049.7604683660747, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4053.4836921719107, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4057.2069159777475, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4060.9301397835834, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4064.65336358942, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4068.376587395256, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4072.099811201092, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4075.823035006929, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4079.546258812765, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4083.2694826186016, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4086.9927064244375, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4090.7159302302744, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4094.4391540361103, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4098.162377841947, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4101.885601647783, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4105.60882545362, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4109.332049259456, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4113.055273065292, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4116.7784968711285, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4120.501720676964, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4124.224944482801, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4127.948168288637, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4131.671392094474, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4135.39461590031, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4139.117839706147, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4142.841063511983, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4146.5642873178185, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4150.287511123655, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4154.010734929491, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4157.733958735328, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4161.457182541164, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4165.180406347001, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4168.903630152837, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4172.626853958674, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4176.3500777645095, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4180.073301570346, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4183.796525376182, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4187.519749182018, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4191.242972987855, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4194.966196793691, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4198.689420599528, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4202.412644405364, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4206.1358682112, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4209.859092017036, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4213.582315822873, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4217.305539628709, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4221.028763434546, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4224.751987240382, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4228.475211046218, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4232.198434852055, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4235.9216586578905, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4239.644882463727, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4243.368106269563, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4247.0913300754, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4250.814553881236, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4254.537777687073, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4258.261001492909, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4261.984225298745, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4265.707449104581, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4269.430672910417, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4273.153896716254, + 17.768319513956385, + 18.273339388126487, + 17.263299639786283 + ], + [ + 4276.87712052209, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 4280.600344327927, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 4284.323568133763, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 4288.0467919396, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 4291.770015745436, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 4295.493239551272, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 4299.216463357108, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 4302.939687162944, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 4306.662910968781, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 4310.386134774617, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 4314.109358580454, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 4317.83258238629, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 4321.5558061921265, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 4325.279029997962, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 4329.002253803799, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 4332.725477609635, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 4336.448701415472, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 4340.171925221308, + 17.869323488790428, + 18.273339388126487, + 17.46530758945437 + ], + [ + 4343.895149027144, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4347.618372832981, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4351.341596638817, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4355.064820444653, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4358.788044250489, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4362.511268056326, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4366.234491862162, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4369.957715667999, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4373.680939473835, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4377.404163279671, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4381.1273870855075, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4384.850610891343, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4388.57383469718, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4392.297058503016, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4396.020282308853, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4399.743506114689, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4403.466729920526, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4407.189953726362, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4410.9131775321985, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4414.636401338034, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4418.35962514387, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4422.082848949707, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4425.806072755543, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4429.52929656138, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4433.252520367216, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4436.975744173053, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4440.6989679788885, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4444.422191784725, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4448.145415590561, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4451.868639396397, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4455.591863202234, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4459.31508700807, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4463.038310813907, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4466.761534619743, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4470.4847584255795, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4474.207982231415, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4477.931206037252, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4481.654429843088, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4485.377653648925, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4489.100877454761, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4492.824101260597, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4496.547325066434, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4500.2705488722695, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4503.993772678106, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4507.716996483942, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4511.440220289779, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4515.163444095615, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4518.886667901452, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4522.609891707288, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4526.3331155131245, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4530.05633931896, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4533.779563124796, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4537.502786930633, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4541.226010736469, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4544.949234542306, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4548.672458348142, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4552.395682153979, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4556.118905959815, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4559.842129765651, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4563.565353571487, + 17.97032746362447, + 18.475347337794574, + 17.46530758945437 + ], + [ + 4567.288577377323, + 18.071331438458515, + 18.475347337794574, + 17.667315539122455 + ], + [ + 4571.01180118316, + 18.071331438458515, + 18.475347337794574, + 17.667315539122455 + ], + [ + 4574.735024988996, + 18.071331438458515, + 18.475347337794574, + 17.667315539122455 + ], + [ + 4578.458248794833, + 18.071331438458515, + 18.475347337794574, + 17.667315539122455 + ], + [ + 4582.181472600669, + 18.071331438458515, + 18.475347337794574, + 17.667315539122455 + ], + [ + 4585.9046964065055, + 18.071331438458515, + 18.475347337794574, + 17.667315539122455 + ], + [ + 4589.627920212341, + 18.071331438458515, + 18.475347337794574, + 17.667315539122455 + ], + [ + 4593.351144018178, + 18.071331438458515, + 18.475347337794574, + 17.667315539122455 + ], + [ + 4597.074367824014, + 18.071331438458515, + 18.475347337794574, + 17.667315539122455 + ], + [ + 4600.797591629851, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 4604.520815435687, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 4608.244039241523, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 4611.96726304736, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 4615.690486853196, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 4619.413710659032, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 4623.136934464868, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 4626.860158270705, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 4630.583382076541, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 4634.306605882378, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 4638.029829688214, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 4641.753053494051, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 4645.4762772998865, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 4649.199501105722, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 4652.922724911559, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 4656.645948717395, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 4660.369172523232, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 4664.092396329068, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 4667.815620134905, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 4671.538843940741, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 4675.2620677465775, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 4678.985291552413, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 4682.708515358249, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 4686.431739164086, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ], + [ + 4690.154962969922, + 18.172335413292558, + 18.67735528746266, + 17.667315539122455 + ] + ], + "Tr": [ + [ + 278.1347530538774, + 25.04060570200602, + 25.54562557617612, + 24.535585827835916 + ], + [ + 281.85797685971374, + 25.04060570200602, + 25.54562557617612, + 24.535585827835916 + ], + [ + 285.5812006655501, + 25.04060570200602, + 25.54562557617612, + 24.535585827835916 + ], + [ + 289.3044244713865, + 25.04060570200602, + 25.54562557617612, + 24.535585827835916 + ], + [ + 293.02764827722285, + 25.04060570200602, + 25.54562557617612, + 24.535585827835916 + ], + [ + 296.7508720830592, + 25.04060570200602, + 25.54562557617612, + 24.535585827835916 + ], + [ + 300.4740958888956, + 25.04060570200602, + 25.54562557617612, + 24.535585827835916 + ], + [ + 304.19731969473196, + 25.04060570200602, + 25.54562557617612, + 24.535585827835916 + ], + [ + 307.92054350056833, + 25.04060570200602, + 25.54562557617612, + 24.535585827835916 + ], + [ + 311.6437673064047, + 25.04060570200602, + 25.54562557617612, + 24.535585827835916 + ], + [ + 315.3669911122406, + 25.04060570200602, + 25.54562557617612, + 24.535585827835916 + ], + [ + 319.090214918077, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 322.81343872391335, + 25.14160967683995, + 25.54562557617612, + 24.73759377750389 + ], + [ + 326.5366625297497, + 25.24261365167399, + 25.747633525844094, + 24.73759377750389 + ], + [ + 330.2598863355861, + 25.24261365167399, + 25.747633525844094, + 24.73759377750389 + ], + [ + 333.98311014142246, + 25.24261365167399, + 25.747633525844094, + 24.73759377750389 + ], + [ + 337.7063339472588, + 25.343617626508035, + 25.747633525844094, + 24.939601727171976 + ], + [ + 341.4295577530952, + 25.444621601342078, + 25.94964147551218, + 24.939601727171976 + ], + [ + 345.15278155893157, + 25.444621601342078, + 25.94964147551218, + 24.939601727171976 + ], + [ + 348.87600536476793, + 25.54562557617612, + 25.94964147551218, + 25.14160967683995 + ], + [ + 352.5992291706043, + 25.64662955101005, + 26.151649425180153, + 25.14160967683995 + ], + [ + 356.3224529764402, + 25.64662955101005, + 26.151649425180153, + 25.14160967683995 + ], + [ + 360.0456767822766, + 25.64662955101005, + 26.151649425180153, + 25.14160967683995 + ], + [ + 363.76890058811296, + 25.848637500678137, + 26.35365737484824, + 25.343617626508035 + ], + [ + 367.4921243939493, + 25.848637500678137, + 26.35365737484824, + 25.343617626508035 + ], + [ + 371.2153481997857, + 26.050645450346224, + 26.555665324516326, + 25.54562557617612 + ], + [ + 374.93857200562206, + 26.050645450346224, + 26.555665324516326, + 25.54562557617612 + ], + [ + 378.66179581145843, + 26.050645450346224, + 26.555665324516326, + 25.54562557617612 + ], + [ + 382.3850196172948, + 26.252653400014196, + 26.7576732741843, + 25.747633525844094 + ], + [ + 386.10824342313117, + 26.252653400014196, + 26.7576732741843, + 25.747633525844094 + ], + [ + 389.83146722896754, + 26.454661349682283, + 26.959681223852385, + 25.94964147551218 + ], + [ + 393.55469103480345, + 26.454661349682283, + 26.959681223852385, + 25.94964147551218 + ], + [ + 397.2779148406398, + 26.65666929935037, + 27.16168917352047, + 26.151649425180153 + ], + [ + 401.0011386464762, + 26.65666929935037, + 27.16168917352047, + 26.151649425180153 + ], + [ + 404.72436245231256, + 26.7576732741843, + 27.363697123188444, + 26.151649425180153 + ], + [ + 408.44758625814893, + 26.858677249018342, + 27.363697123188444, + 26.35365737484824 + ], + [ + 412.1708100639853, + 26.959681223852385, + 27.56570507285653, + 26.35365737484824 + ], + [ + 415.89403386982167, + 27.06068519868643, + 27.56570507285653, + 26.555665324516326 + ], + [ + 419.61725767565804, + 27.2626931483544, + 27.767713022524504, + 26.7576732741843 + ], + [ + 423.3404814814944, + 27.363697123188444, + 27.96972097219259, + 26.7576732741843 + ], + [ + 427.0637052873308, + 27.464701098022488, + 27.96972097219259, + 26.959681223852385 + ], + [ + 430.7869290931667, + 27.56570507285653, + 28.171728921860677, + 26.959681223852385 + ], + [ + 434.51015289900306, + 27.666709047690574, + 28.171728921860677, + 27.16168917352047 + ], + [ + 438.23337670483943, + 27.767713022524504, + 28.37373687152865, + 27.16168917352047 + ], + [ + 441.9566005106758, + 27.96972097219259, + 28.575744821196736, + 27.363697123188444 + ], + [ + 445.67982431651217, + 28.070724947026633, + 28.575744821196736, + 27.56570507285653 + ], + [ + 449.40304812234854, + 28.171728921860677, + 28.777752770864822, + 27.56570507285653 + ], + [ + 453.1262719281849, + 28.272732896694606, + 28.777752770864822, + 27.767713022524504 + ], + [ + 456.8494957340213, + 28.37373687152865, + 28.979760720532795, + 27.767713022524504 + ], + [ + 460.57271953985764, + 28.575744821196736, + 29.18176867020088, + 27.96972097219259 + ], + [ + 464.295943345694, + 28.67674879603078, + 29.18176867020088, + 28.171728921860677 + ], + [ + 468.0191671515299, + 28.777752770864822, + 29.383776619868854, + 28.171728921860677 + ], + [ + 471.7423909573663, + 28.979760720532795, + 29.58578456953694, + 28.37373687152865 + ], + [ + 475.46561476320267, + 29.18176867020088, + 29.787792519205027, + 28.575744821196736 + ], + [ + 479.18883856903904, + 29.282772645034925, + 29.787792519205027, + 28.777752770864822 + ], + [ + 482.9120623748754, + 29.383776619868854, + 29.989800468873, + 28.777752770864822 + ], + [ + 486.6352861807118, + 29.58578456953694, + 30.191808418541086, + 28.979760720532795 + ], + [ + 490.35850998654814, + 29.787792519205027, + 30.39381636820906, + 29.18176867020088 + ], + [ + 494.0817337923845, + 29.787792519205027, + 30.39381636820906, + 29.18176867020088 + ], + [ + 497.8049575982209, + 29.989800468873, + 30.595824317877145, + 29.383776619868854 + ], + [ + 501.52818140405725, + 30.191808418541086, + 30.797832267545232, + 29.58578456953694 + ], + [ + 505.2514052098936, + 30.39381636820906, + 30.999840217213205, + 29.787792519205027 + ], + [ + 508.97462901572953, + 30.39381636820906, + 30.999840217213205, + 29.787792519205027 + ], + [ + 512.6978528215659, + 30.595824317877145, + 31.20184816688129, + 29.989800468873 + ], + [ + 516.4210766274023, + 30.797832267545232, + 31.403856116549377, + 30.191808418541086 + ], + [ + 520.1443004332386, + 30.999840217213205, + 31.60586406621735, + 30.39381636820906 + ], + [ + 523.867524239075, + 31.20184816688129, + 31.807872015885437, + 30.595824317877145 + ], + [ + 527.5907480449114, + 31.302852141715334, + 32.00987996555341, + 30.595824317877145 + ], + [ + 531.3139718507477, + 31.403856116549377, + 32.00987996555341, + 30.797832267545232 + ], + [ + 535.0371956565841, + 31.60586406621735, + 32.211887915221496, + 30.999840217213205 + ], + [ + 538.7604194624205, + 31.807872015885437, + 32.41389586488958, + 31.20184816688129 + ], + [ + 542.4836432682569, + 32.00987996555341, + 32.615903814557555, + 31.403856116549377 + ], + [ + 546.2068670740928, + 32.211887915221496, + 32.81791176422564, + 31.60586406621735 + ], + [ + 549.9300908799291, + 32.31289189005554, + 33.019919713893614, + 31.60586406621735 + ], + [ + 553.6533146857655, + 32.51489983972351, + 33.2219276635617, + 31.807872015885437 + ], + [ + 557.3765384916019, + 32.7169077893916, + 33.42393561322979, + 32.00987996555341 + ], + [ + 561.0997622974382, + 32.81791176422564, + 33.42393561322979, + 32.211887915221496 + ], + [ + 564.8229861032746, + 33.019919713893614, + 33.62594356289776, + 32.41389586488958 + ], + [ + 568.546209909111, + 33.2219276635617, + 33.827951512565846, + 32.615903814557555 + ], + [ + 572.2694337149474, + 33.42393561322979, + 34.02995946223393, + 32.81791176422564 + ], + [ + 575.9926575207837, + 33.62594356289776, + 34.231967411901906, + 33.019919713893614 + ], + [ + 579.7158813266201, + 33.827951512565846, + 34.43397536156999, + 33.2219276635617 + ], + [ + 583.439105132456, + 33.92895548739989, + 34.635983311237965, + 33.2219276635617 + ], + [ + 587.1623289382924, + 34.13096343706786, + 34.83799126090605, + 33.42393561322979 + ], + [ + 590.8855527441287, + 34.33297138673595, + 35.03999921057414, + 33.62594356289776 + ], + [ + 594.6087765499651, + 34.534979336404035, + 35.24200716024211, + 33.827951512565846 + ], + [ + 598.3320003558015, + 34.73698728607201, + 35.4440151099102, + 34.02995946223393 + ], + [ + 602.0552241616379, + 34.938995235740094, + 35.64602305957817, + 34.231967411901906 + ], + [ + 605.7784479674742, + 35.14100318540807, + 35.848031009246256, + 34.43397536156999 + ], + [ + 609.5016717733106, + 35.34301113507615, + 36.05003895891434, + 34.635983311237965 + ], + [ + 613.224895579147, + 35.54501908474424, + 36.252046908582315, + 34.83799126090605 + ], + [ + 616.9481193849833, + 35.74702703441221, + 36.4540548582504, + 35.03999921057414 + ], + [ + 620.6713431908192, + 35.9490349840803, + 36.65606280791849, + 35.24200716024211 + ], + [ + 624.3945669966556, + 36.151042933748386, + 36.85807075758646, + 35.4440151099102 + ], + [ + 628.117790802492, + 36.35305088341636, + 37.06007870725455, + 35.64602305957817 + ], + [ + 631.8410146083284, + 36.555058833084445, + 37.26208665692252, + 35.848031009246256 + ], + [ + 635.5642384141647, + 36.75706678275242, + 37.464094606590606, + 36.05003895891434 + ], + [ + 639.2874622200011, + 36.959074732420504, + 37.66610255625869, + 36.252046908582315 + ], + [ + 643.0106860258375, + 37.16108268208859, + 37.868110505926666, + 36.4540548582504 + ], + [ + 646.7339098316738, + 37.36309063175656, + 38.07011845559475, + 36.65606280791849 + ], + [ + 650.4571336375102, + 37.56509858142465, + 38.27212640526284, + 36.85807075758646 + ], + [ + 654.1803574433466, + 37.868110505926666, + 38.6761423045989, + 37.06007870725455 + ], + [ + 657.9035812491829, + 38.171122430428795, + 38.87815025426687, + 37.464094606590606 + ], + [ + 661.6268050550188, + 38.37313038009677, + 39.08015820393496, + 37.66610255625869 + ], + [ + 665.3500288608552, + 38.575138329764854, + 39.28216615360304, + 37.868110505926666 + ], + [ + 669.0732526666916, + 38.77714627943294, + 39.484174103271016, + 38.07011845559475 + ], + [ + 672.796476472528, + 38.979154229100914, + 39.6861820529391, + 38.27212640526284 + ], + [ + 676.5197002783643, + 39.181162178769, + 39.888190002607075, + 38.47413435493081 + ], + [ + 680.2429240842007, + 39.38317012843697, + 40.09019795227516, + 38.6761423045989 + ], + [ + 683.9661478900371, + 39.58517807810506, + 40.29220590194325, + 38.87815025426687 + ], + [ + 687.6893716958734, + 39.888190002607075, + 40.69622180127931, + 39.08015820393496 + ], + [ + 691.4125955017098, + 40.09019795227516, + 40.898229750947394, + 39.28216615360304 + ], + [ + 695.1358193075462, + 40.39320987677718, + 41.10023770061537, + 39.6861820529391 + ], + [ + 698.8590431133821, + 40.595217826445264, + 41.30224565028345, + 39.888190002607075 + ], + [ + 702.5822669192185, + 40.79722577611335, + 41.504253599951426, + 40.09019795227516 + ], + [ + 706.3054907250548, + 40.99923372578132, + 41.70626154961951, + 40.29220590194325 + ], + [ + 710.0287145308912, + 41.30224565028345, + 42.11027744895557, + 40.49421385161122 + ], + [ + 713.7519383367276, + 41.504253599951426, + 42.31228539862366, + 40.69622180127931 + ], + [ + 717.4751621425639, + 41.70626154961951, + 42.51429334829163, + 40.898229750947394 + ], + [ + 721.1983859484003, + 42.00927347412153, + 42.71630129795972, + 41.30224565028345 + ], + [ + 724.9216097542367, + 42.211281423789615, + 42.9183092476278, + 41.504253599951426 + ], + [ + 728.644833560073, + 42.51429334829163, + 43.32232514696386, + 41.70626154961951 + ], + [ + 732.3680573659094, + 42.71630129795972, + 43.52433309663195, + 41.9082694992876 + ], + [ + 736.0912811717453, + 42.9183092476278, + 43.72634104629992, + 42.11027744895557 + ], + [ + 739.8145049775817, + 43.22132117212982, + 43.92834899596801, + 42.51429334829163 + ], + [ + 743.5377287834181, + 43.52433309663195, + 44.33236489530407, + 42.71630129795972 + ], + [ + 747.2609525892544, + 43.72634104629992, + 44.534372844972154, + 42.9183092476278 + ], + [ + 750.9841763950908, + 43.92834899596801, + 44.73638079464013, + 43.120317197295776 + ], + [ + 754.7074002009272, + 44.13035694563598, + 44.93838874430821, + 43.32232514696386 + ], + [ + 758.4306240067635, + 44.534372844972154, + 45.34240464364427, + 43.72634104629992 + ], + [ + 762.1538478125999, + 44.73638079464013, + 45.54441259331236, + 43.92834899596801 + ], + [ + 765.8770716184363, + 44.93838874430821, + 45.74642054298033, + 44.13035694563598 + ], + [ + 769.6002954242726, + 45.140396693976186, + 45.94842849264842, + 44.33236489530407 + ], + [ + 773.3235192301086, + 45.54441259331236, + 46.35244439198448, + 44.73638079464013 + ], + [ + 777.0467430359449, + 45.74642054298033, + 46.55445234165256, + 44.93838874430821 + ], + [ + 780.7699668417813, + 45.94842849264842, + 46.756460291320536, + 45.140396693976186 + ], + [ + 784.4931906476177, + 46.150436442316504, + 46.95846824098862, + 45.34240464364427 + ], + [ + 788.216414453454, + 46.55445234165256, + 47.36248414032468, + 45.74642054298033 + ], + [ + 791.9396382592904, + 46.756460291320536, + 47.56449208999277, + 45.94842849264842 + ], + [ + 795.6628620651268, + 46.95846824098862, + 47.766500039660855, + 46.150436442316504 + ], + [ + 799.3860858709631, + 47.36248414032468, + 48.170515938996914, + 46.55445234165256 + ], + [ + 803.1093096767995, + 47.56449208999277, + 48.37252388866489, + 46.756460291320536 + ], + [ + 806.8325334826359, + 47.766500039660855, + 48.57453183833297, + 46.95846824098862 + ], + [ + 810.5557572884718, + 48.170515938996914, + 48.97854773766903, + 47.36248414032468 + ], + [ + 814.2789810943082, + 48.37252388866489, + 49.18055568733712, + 47.56449208999277 + ], + [ + 818.0022049001445, + 48.57453183833297, + 49.38256363700509, + 47.766500039660855 + ], + [ + 821.7254287059809, + 48.97854773766903, + 49.786579536341264, + 48.170515938996914 + ], + [ + 825.4486525118173, + 49.18055568733712, + 49.98858748600924, + 48.37252388866489 + ], + [ + 829.1718763176536, + 49.483567611839135, + 50.39260338534541, + 48.57453183833297 + ], + [ + 832.89510012349, + 49.786579536341264, + 50.59461133501338, + 48.97854773766903 + ], + [ + 836.6183239293264, + 49.98858748600924, + 50.79661928468147, + 49.18055568733712 + ], + [ + 840.3415477351627, + 50.29159941051137, + 51.20063518401753, + 49.38256363700509 + ], + [ + 844.0647715409991, + 50.59461133501338, + 51.402643133685615, + 49.786579536341264 + ], + [ + 847.7879953468355, + 50.79661928468147, + 51.60465108335359, + 49.98858748600924 + ], + [ + 851.5112191526714, + 51.099631209183485, + 52.00866698268965, + 50.190595435677324 + ], + [ + 855.2344429585078, + 51.402643133685615, + 52.21067493235773, + 50.59461133501338 + ], + [ + 858.9576667643441, + 51.70565505818763, + 52.61469083169379, + 50.79661928468147 + ], + [ + 862.6808905701805, + 52.00866698268965, + 52.81669878136188, + 51.20063518401753 + ], + [ + 866.4041143760169, + 52.21067493235773, + 53.018706731029965, + 51.402643133685615 + ], + [ + 870.1273381818532, + 52.51368685685986, + 53.422722630366025, + 51.60465108335359 + ], + [ + 873.8505619876896, + 52.81669878136188, + 53.624730580034, + 52.00866698268965 + ], + [ + 877.573785793526, + 52.91770275619592, + 54.02874647937017, + 18.071331438458515 + ], + [ + 881.2970095993624, + 53.119710705863895, + 54.23075442903814, + 18.071331438458515 + ], + [ + 885.0202334051987, + 53.32171865553198, + 54.6347703283742, + 18.273339388126487 + ], + [ + 888.7434572110346, + 53.624730580034, + 54.83677827804229, + 18.67735528746266 + ], + [ + 892.466681016871, + 54.02874647937017, + 55.038786227710375, + 18.879363237130633 + ], + [ + 896.1899048227074, + 54.53376635354027, + 55.442802127046434, + 53.624730580034 + ], + [ + 899.9131286285437, + 54.83677827804229, + 55.64481007671452, + 54.02874647937017 + ], + [ + 903.6363524343801, + 55.13979020254442, + 56.04882597605058, + 54.23075442903814 + ], + [ + 907.3595762402165, + 55.34179815221239, + 56.25083392571855, + 54.43276237870623 + ], + [ + 911.0828000460529, + 55.64481007671452, + 56.45284187538664, + 54.83677827804229 + ], + [ + 914.8060238518892, + 55.94782200121654, + 56.8568577747227, + 55.038786227710375 + ], + [ + 918.5292476577256, + 56.25083392571855, + 57.058865724390785, + 55.442802127046434 + ], + [ + 922.252471463562, + 56.45284187538664, + 57.26087367405887, + 55.64481007671452 + ], + [ + 925.9756952693979, + 56.755853799888655, + 57.66488957339493, + 55.84681802638249 + ], + [ + 929.6989190752342, + 57.058865724390785, + 57.8668975230629, + 56.25083392571855 + ], + [ + 933.4221428810706, + 57.26087367405887, + 58.06890547273099, + 56.45284187538664 + ], + [ + 937.145366686907, + 57.56388559856089, + 58.47292137206705, + 56.654849825054725 + ], + [ + 940.8685904927434, + 57.8668975230629, + 58.674929321735135, + 57.058865724390785 + ], + [ + 944.5918142985797, + 58.06890547273099, + 58.87693727140311, + 57.26087367405887 + ], + [ + 948.3150381044161, + 58.371917397233005, + 59.28095317073928, + 57.462881623726844 + ], + [ + 952.0382619102525, + 58.674929321735135, + 59.48296112040725, + 57.8668975230629 + ], + [ + 955.7614857160888, + 58.87693727140311, + 59.68496907007534, + 58.06890547273099 + ], + [ + 959.4847095219252, + 59.17994919590524, + 60.0889849694114, + 58.270913422399076 + ], + [ + 963.2079333277611, + 59.48296112040725, + 60.290992919079486, + 58.674929321735135 + ], + [ + 966.9311571335975, + 59.68496907007534, + 60.49300086874746, + 58.87693727140311 + ], + [ + 970.6543809394338, + 59.987980994577356, + 60.89701676808363, + 59.078945221071194 + ], + [ + 974.3776047452702, + 60.290992919079486, + 61.099024717751604, + 59.48296112040725 + ], + [ + 978.1008285511066, + 60.49300086874746, + 61.30103266741969, + 59.68496907007534 + ], + [ + 981.824052356943, + 60.79601279324959, + 61.70504856675575, + 59.886977019743426 + ], + [ + 985.5472761627793, + 61.099024717751604, + 61.907056516423836, + 60.290992919079486 + ], + [ + 989.2704999686157, + 61.30103266741969, + 62.10906446609181, + 60.49300086874746 + ], + [ + 992.9937237744521, + 61.50304061708766, + 62.311072415759895, + 60.695008818415545 + ], + [ + 996.7169475802884, + 61.907056516423836, + 62.715088315095954, + 61.099024717751604 + ], + [ + 1000.4401713861248, + 62.10906446609181, + 62.91709626476404, + 61.30103266741969 + ], + [ + 1004.1633951919607, + 62.41207639059394, + 120.08534602082017, + 61.50304061708766 + ], + [ + 1007.8866189977971, + 62.91709626476404, + 120.08534602082017, + 61.907056516423836 + ], + [ + 1011.6098428036335, + 63.22010818926606, + 120.08534602082017, + 62.10906446609181 + ], + [ + 1015.3330666094698, + 63.42211613893414, + 119.68133012148405, + 62.311072415759895 + ], + [ + 1019.0562904153062, + 63.8261320382702, + 119.47932217181602, + 62.715088315095954 + ], + [ + 1022.7795142211426, + 64.02813998793829, + 119.277314222148, + 62.91709626476404 + ], + [ + 1026.502738026979, + 64.23014793760626, + 118.87329832281193, + 63.119104214432014 + ], + [ + 1030.2259618328153, + 64.43215588727435, + 118.67129037314385, + 63.3211121641001 + ], + [ + 1033.9491856386517, + 64.83617178661041, + 118.46928242347582, + 63.72512806343616 + ], + [ + 1037.672409444488, + 64.93717576144445, + 118.06526652413976, + 63.927136013104246 + ], + [ + 1041.395633250324, + 65.0381797362785, + 117.86325857447167, + 64.12914396277233 + ], + [ + 1045.1188570561603, + 65.34119166078051, + 66.14922345945274, + 64.53315986210839 + ], + [ + 1048.8420808619967, + 65.5431996104486, + 66.35123140912071, + 64.73516781177636 + ], + [ + 1052.565304667833, + 65.74520756011657, + 66.5532393587888, + 64.93717576144445 + ], + [ + 1056.2885284736694, + 65.94721550978466, + 66.75524730845689, + 65.13918371111254 + ], + [ + 1060.0117522795058, + 66.35123140912071, + 67.15926320779295, + 65.5431996104486 + ], + [ + 1063.7349760853422, + 66.5532393587888, + 67.36127115746092, + 65.74520756011657 + ], + [ + 1067.4581998911785, + 66.75524730845689, + 67.563279107129, + 65.94721550978466 + ], + [ + 1071.181423697015, + 67.15926320779295, + 67.96729500646506, + 66.35123140912071 + ], + [ + 1074.9046475028513, + 67.36127115746092, + 68.16930295613315, + 66.5532393587888 + ], + [ + 1078.6278713086872, + 67.563279107129, + 68.37131090580112, + 66.75524730845689 + ], + [ + 1082.3510951145236, + 67.76528705679709, + 68.57331885546921, + 66.95725525812486 + ], + [ + 1086.07431892036, + 68.16930295613315, + 68.97733475480527, + 67.36127115746092 + ], + [ + 1089.7975427261963, + 68.37131090580112, + 69.17934270447336, + 67.563279107129 + ], + [ + 1093.5207665320327, + 68.57331885546921, + 69.38135065414144, + 67.76528705679709 + ], + [ + 1097.243990337869, + 68.87633077997134, + 69.58335860380942, + 68.16930295613315 + ], + [ + 1100.9672141437054, + 69.17934270447336, + 69.98737450314547, + 68.37131090580112 + ], + [ + 1104.6904379495418, + 69.38135065414144, + 70.18938245281356, + 68.57331885546921 + ], + [ + 1108.4136617553781, + 69.68436257864346, + 75.6435970938507, + 68.7753268051373 + ], + [ + 1112.1368855612145, + 70.18938245281356, + 75.6435970938507, + 69.17934270447336 + ], + [ + 1115.8601093670504, + 70.49239437731558, + 75.44158914418267, + 69.38135065414144 + ], + [ + 1119.5833331728868, + 70.69440232698366, + 75.23958119451464, + 69.58335860380942 + ], + [ + 1123.3065569787232, + 70.89641027665175, + 74.83556529517853, + 69.7853665534775 + ], + [ + 1127.0297807845595, + 71.30042617598781, + 74.6335573455105, + 70.18938245281356 + ], + [ + 1130.753004590396, + 71.5024341256559, + 74.43154939584247, + 70.39139040248165 + ], + [ + 1134.4762283962323, + 71.70444207532387, + 74.02753349650641, + 70.59339835214962 + ], + [ + 1138.1994522020686, + 71.90645002499195, + 73.82552554683832, + 70.7954063018177 + ], + [ + 1141.922676007905, + 72.31046592432801, + 73.62351759717029, + 71.19942220115377 + ], + [ + 1145.6458998137414, + 72.31046592432801, + 73.21950169783423, + 71.40143015082185 + ], + [ + 1149.3691236195777, + 72.41146989916206, + 73.21950169783423, + 71.60343810048983 + ], + [ + 1153.0923474254141, + 72.61347784883003, + 73.42150964750226, + 71.80544605015791 + ], + [ + 1156.81557123125, + 73.01749374816615, + 73.82552554683832, + 72.20946194949397 + ], + [ + 1160.5387950370864, + 73.21950169783423, + 74.02753349650641, + 72.41146989916206 + ], + [ + 1164.2620188429228, + 73.42150964750226, + 74.22954144617444, + 72.61347784883003 + ], + [ + 1167.9852426487591, + 73.62351759717029, + 74.43154939584247, + 72.81548579849812 + ], + [ + 1171.7084664545955, + 74.02753349650641, + 74.83556529517853, + 73.21950169783423 + ], + [ + 1175.4316902604319, + 74.22954144617444, + 75.03757324484661, + 73.42150964750226 + ], + [ + 1179.1549140662682, + 74.43154939584247, + 75.23958119451464, + 73.62351759717029 + ], + [ + 1182.8781378721046, + 74.6335573455105, + 75.44158914418267, + 73.82552554683832 + ], + [ + 1186.601361677941, + 74.93656927001257, + 75.6435970938507, + 74.22954144617444 + ], + [ + 1190.3245854837774, + 75.03757324484661, + 75.6435970938507, + 74.43154939584247 + ], + [ + 1194.0478092896133, + 75.1385772196806, + 75.6435970938507, + 74.6335573455105 + ], + [ + 1197.7710330954496, + 75.23958119451464, + 75.6435970938507, + 74.83556529517853 + ], + [ + 1201.494256901286, + 75.44158914418267, + 75.6435970938507, + 75.23958119451464 + ], + [ + 1205.2174807071224, + 75.54259311901671, + 75.6435970938507, + 75.44158914418267 + ], + [ + 1235.0032711538129, + 78.26970043953526, + 79.07773223820743, + 77.46166864086308 + ], + [ + 1238.7264949596492, + 78.47170838920334, + 79.27974018787552, + 77.66367659053117 + ], + [ + 1242.4497187654856, + 78.67371633887137, + 79.48174813754355, + 77.8656845401992 + ], + [ + 1246.172942571322, + 78.97672826337345, + 79.68375608721158, + 78.26970043953526 + ], + [ + 1249.8961663771584, + 79.27974018787552, + 80.0877719865477, + 78.47170838920334 + ], + [ + 1253.6193901829947, + 79.48174813754355, + 80.28977993621572, + 78.67371633887137 + ], + [ + 1257.342613988831, + 79.68375608721158, + 80.49178788588375, + 78.8757242885394 + ], + [ + 1261.0658377946675, + 79.98676801171365, + 80.69379583555178, + 79.27974018787552 + ], + [ + 1264.7890616005038, + 80.28977993621572, + 81.0978117348879, + 79.48174813754355 + ], + [ + 1268.5122854063397, + 80.49178788588375, + 81.29981968455593, + 79.68375608721158 + ], + [ + 1272.235509212176, + 80.69379583555178, + 81.50182763422396, + 79.8857640368796 + ], + [ + 1275.9587330180125, + 80.89580378521981, + 81.70383558389199, + 80.0877719865477 + ], + [ + 1279.6819568238489, + 81.19881570972188, + 81.90584353356007, + 80.49178788588375 + ], + [ + 1283.4051806296852, + 81.50182763422396, + 82.30985943289613, + 80.69379583555178 + ], + [ + 1287.1284044355216, + 81.70383558389199, + 82.51186738256416, + 80.89580378521981 + ], + [ + 1290.851628241358, + 81.90584353356007, + 82.71387533223225, + 81.0978117348879 + ], + [ + 1294.5748520471943, + 82.20885545806209, + 82.91588328190028, + 81.50182763422396 + ], + [ + 1298.2980758530307, + 82.51186738256416, + 83.31989918123634, + 81.70383558389199 + ], + [ + 1302.021299658867, + 82.71387533223225, + 83.52190713090442, + 81.90584353356007 + ], + [ + 1305.7445234647034, + 82.91588328190028, + 83.72391508057245, + 82.1078514832281 + ], + [ + 1309.4677472705393, + 83.21889520640235, + 83.92592303024048, + 82.51186738256416 + ], + [ + 1313.1909710763757, + 83.42090315607038, + 84.12793097990851, + 82.71387533223225 + ], + [ + 1316.914194882212, + 83.72391508057245, + 84.53194687924463, + 82.91588328190028 + ], + [ + 1320.6374186880485, + 83.92592303024048, + 84.73395482891266, + 83.11789123156831 + ], + [ + 1324.3606424938848, + 84.12793097990851, + 84.93596277858069, + 83.31989918123634 + ], + [ + 1328.0838662997212, + 84.43094290441059, + 85.13797072824872, + 83.72391508057245 + ], + [ + 1331.8070901055576, + 84.73395482891266, + 85.54198662758483, + 83.92592303024048 + ], + [ + 1335.530313911394, + 84.93596277858069, + 85.74399457725286, + 84.12793097990851 + ], + [ + 1339.2535377172303, + 85.13797072824872, + 85.94600252692089, + 84.32993892957654 + ], + [ + 1342.9767615230667, + 85.3399786779168, + 86.14801047658898, + 84.53194687924463 + ], + [ + 1346.6999853289026, + 85.64299060241882, + 86.35001842625701, + 84.93596277858069 + ], + [ + 1350.423209134739, + 85.94600252692089, + 86.75403432559307, + 85.13797072824872 + ], + [ + 1354.1464329405753, + 86.14801047658898, + 86.9560422752611, + 85.3399786779168 + ], + [ + 1357.8696567464117, + 86.35001842625701, + 87.15805022492918, + 85.54198662758483 + ], + [ + 1361.592880552248, + 86.65303035075908, + 87.36005817459721, + 85.94600252692089 + ], + [ + 1365.3161043580844, + 86.85503830042711, + 87.56206612426524, + 86.14801047658898 + ], + [ + 1369.0393281639208, + 87.15805022492918, + 87.96608202360136, + 86.35001842625701 + ], + [ + 1372.7625519697572, + 87.36005817459721, + 88.16808997326939, + 86.55202637592504 + ], + [ + 1376.4857757755935, + 87.56206612426524, + 88.37009792293742, + 86.75403432559307 + ], + [ + 1380.20899958143, + 87.86507804876732, + 88.57210587260545, + 87.15805022492918 + ], + [ + 1383.9322233872658, + 88.06708599843535, + 88.77411382227353, + 87.36005817459721 + ], + [ + 1387.6554471931022, + 88.37009792293742, + 89.1781297216096, + 87.56206612426524 + ], + [ + 1391.3786709989386, + 88.57210587260545, + 89.38013767127762, + 87.76407407393327 + ], + [ + 1395.101894804775, + 88.77411382227353, + 89.58214562094571, + 87.96608202360136 + ], + [ + 1398.8251186106113, + 89.07712574677555, + 89.78415357061374, + 88.37009792293742 + ], + [ + 1402.5483424164477, + 89.27913369644364, + 89.98616152028177, + 88.57210587260545 + ], + [ + 1406.271566222284, + 89.58214562094571, + 90.39017741961783, + 88.77411382227353 + ], + [ + 1409.9947900281204, + 89.78415357061374, + 90.59218536928591, + 88.97612177194156 + ], + [ + 1413.7180138339568, + 89.98616152028177, + 90.79419331895394, + 89.1781297216096 + ], + [ + 1417.4412376397931, + 90.28917344478384, + 90.99620126862197, + 89.58214562094571 + ], + [ + 1421.164461445629, + 90.49118139445187, + 91.19820921829, + 89.78415357061374 + ], + [ + 1424.8876852514654, + 90.79419331895394, + 91.60222511762612, + 89.98616152028177 + ], + [ + 1428.6109090573018, + 90.99620126862197, + 91.80423306729415, + 90.1881694699498 + ], + [ + 1432.3341328631382, + 91.19820921829, + 92.00624101696218, + 90.39017741961783 + ], + [ + 1436.0573566689745, + 91.50122114279208, + 92.20824896663026, + 90.79419331895394 + ], + [ + 1439.780580474811, + 91.70322909246016, + 92.4102569162983, + 90.99620126862197 + ], + [ + 1443.5038042806473, + 91.90523704212819, + 92.61226486596632, + 91.19820921829 + ], + [ + 1447.2270280864836, + 92.20824896663026, + 93.01628076530244, + 91.40021716795809 + ], + [ + 1450.95025189232, + 92.4102569162983, + 93.21828871497047, + 91.60222511762612 + ], + [ + 1454.6734756981564, + 92.61226486596632, + 93.4202966646385, + 91.80423306729415 + ], + [ + 1458.3966995039927, + 92.9152767904684, + 93.62230461430653, + 92.20824896663026 + ], + [ + 1462.1199233098287, + 93.11728474013643, + 93.82431256397456, + 92.4102569162983 + ], + [ + 1465.843147115665, + 93.31929268980446, + 94.02632051364264, + 92.61226486596632 + ], + [ + 1469.5663709215014, + 93.52130063947254, + 94.22832846331067, + 92.81427281563435 + ], + [ + 1473.2895947273378, + 93.72330858914057, + 94.4303364129787, + 93.01628076530244 + ], + [ + 1477.0128185331741, + 93.9253165388086, + 94.63234436264673, + 93.21828871497047 + ], + [ + 1480.7360423390105, + 94.02632051364264, + 94.63234436264673, + 93.4202966646385 + ], + [ + 1484.4592661448469, + 94.12732448847663, + 94.63234436264673, + 93.62230461430653 + ], + [ + 1488.1824899506832, + 94.32933243814472, + 94.83435231231482, + 93.82431256397456 + ], + [ + 1491.9057137565196, + 94.32933243814472, + 94.83435231231482, + 93.82431256397456 + ], + [ + 1495.628937562356, + 94.4303364129787, + 94.83435231231482, + 94.02632051364264 + ], + [ + 1499.352161368192, + 94.4303364129787, + 94.83435231231482, + 94.02632051364264 + ], + [ + 1503.0753851740283, + 94.53134038781275, + 95.03636026198285, + 94.02632051364264 + ], + [ + 1506.7986089798646, + 94.53134038781275, + 95.03636026198285, + 94.02632051364264 + ], + [ + 1510.521832785701, + 94.53134038781275, + 95.03636026198285, + 94.02632051364264 + ], + [ + 1514.2450565915374, + 94.63234436264673, + 95.03636026198285, + 94.22832846331067 + ], + [ + 1517.9682803973737, + 94.63234436264673, + 95.03636026198285, + 94.22832846331067 + ], + [ + 1521.6915042032101, + 94.63234436264673, + 95.03636026198285, + 94.22832846331067 + ], + [ + 1525.4147280090465, + 94.63234436264673, + 95.03636026198285, + 94.22832846331067 + ], + [ + 1529.1379518148829, + 94.73334833748078, + 95.23836821165088, + 94.22832846331067 + ], + [ + 1532.8611756207192, + 94.73334833748078, + 95.23836821165088, + 94.22832846331067 + ], + [ + 1536.5843994265551, + 94.73334833748078, + 95.23836821165088, + 94.22832846331067 + ], + [ + 1540.3076232323915, + 94.83435231231482, + 95.23836821165088, + 94.4303364129787 + ], + [ + 1544.0308470382279, + 94.83435231231482, + 95.23836821165088, + 94.4303364129787 + ], + [ + 1547.7540708440642, + 94.83435231231482, + 95.23836821165088, + 94.4303364129787 + ], + [ + 1551.4772946499006, + 94.83435231231482, + 95.23836821165088, + 94.4303364129787 + ], + [ + 1555.200518455737, + 94.83435231231482, + 95.23836821165088, + 94.4303364129787 + ], + [ + 1558.9237422615734, + 94.83435231231482, + 95.23836821165088, + 94.4303364129787 + ], + [ + 1562.6469660674097, + 94.83435231231482, + 95.23836821165088, + 94.4303364129787 + ], + [ + 1566.370189873246, + 94.83435231231482, + 95.23836821165088, + 94.4303364129787 + ], + [ + 1570.0934136790825, + 94.83435231231482, + 95.23836821165088, + 94.4303364129787 + ], + [ + 1573.8166374849188, + 94.9353562871488, + 95.44037616131891, + 94.4303364129787 + ], + [ + 1577.5398612907547, + 94.9353562871488, + 95.44037616131891, + 94.4303364129787 + ], + [ + 1581.2630850965916, + 94.9353562871488, + 95.44037616131891, + 94.4303364129787 + ], + [ + 1584.9863089024275, + 94.9353562871488, + 95.44037616131891, + 94.4303364129787 + ], + [ + 1588.7095327082643, + 94.9353562871488, + 95.44037616131891, + 94.4303364129787 + ], + [ + 1592.4327565141002, + 94.9353562871488, + 95.44037616131891, + 94.4303364129787 + ], + [ + 1596.1559803199361, + 94.9353562871488, + 95.44037616131891, + 94.4303364129787 + ], + [ + 1599.879204125773, + 94.9353562871488, + 95.44037616131891, + 94.4303364129787 + ], + [ + 1603.6024279316089, + 95.03636026198285, + 95.44037616131891, + 94.63234436264673 + ], + [ + 1607.3256517374457, + 95.03636026198285, + 95.44037616131891, + 94.63234436264673 + ], + [ + 1611.0488755432816, + 95.03636026198285, + 95.44037616131891, + 94.63234436264673 + ], + [ + 1614.7720993491184, + 95.03636026198285, + 95.44037616131891, + 94.63234436264673 + ], + [ + 1618.4953231549543, + 95.03636026198285, + 95.44037616131891, + 94.63234436264673 + ], + [ + 1622.2185469607912, + 95.03636026198285, + 95.44037616131891, + 94.63234436264673 + ], + [ + 1625.941770766627, + 95.03636026198285, + 95.44037616131891, + 94.63234436264673 + ], + [ + 1629.664994572464, + 95.03636026198285, + 95.44037616131891, + 94.63234436264673 + ], + [ + 1633.3882183782998, + 95.03636026198285, + 95.44037616131891, + 94.63234436264673 + ], + [ + 1637.1114421841357, + 95.03636026198285, + 95.44037616131891, + 94.63234436264673 + ], + [ + 1640.8346659899726, + 95.03636026198285, + 95.44037616131891, + 94.63234436264673 + ], + [ + 1644.5578897958085, + 95.03636026198285, + 95.44037616131891, + 94.63234436264673 + ], + [ + 1648.2811136016453, + 95.03636026198285, + 95.44037616131891, + 94.63234436264673 + ], + [ + 1652.0043374074812, + 95.03636026198285, + 95.44037616131891, + 94.63234436264673 + ], + [ + 1655.727561213318, + 95.03636026198285, + 95.44037616131891, + 94.63234436264673 + ], + [ + 1659.450785019154, + 95.03636026198285, + 95.44037616131891, + 94.63234436264673 + ], + [ + 1663.1740088249908, + 95.03636026198285, + 95.44037616131891, + 94.63234436264673 + ], + [ + 1666.8972326308267, + 95.03636026198285, + 95.44037616131891, + 94.63234436264673 + ], + [ + 1670.6204564366626, + 95.03636026198285, + 95.44037616131891, + 94.63234436264673 + ], + [ + 1674.3436802424994, + 95.03636026198285, + 95.44037616131891, + 94.63234436264673 + ], + [ + 1678.0669040483353, + 95.03636026198285, + 95.44037616131891, + 94.63234436264673 + ], + [ + 1681.7901278541722, + 95.03636026198285, + 95.44037616131891, + 94.63234436264673 + ], + [ + 1685.513351660008, + 95.03636026198285, + 95.44037616131891, + 94.63234436264673 + ], + [ + 1689.236575465845, + 95.03636026198285, + 95.44037616131891, + 94.63234436264673 + ], + [ + 1692.9597992716808, + 95.03636026198285, + 95.44037616131891, + 94.63234436264673 + ], + [ + 1696.6830230775176, + 95.03636026198285, + 95.44037616131891, + 94.63234436264673 + ], + [ + 1700.4062468833536, + 95.03636026198285, + 95.44037616131891, + 94.63234436264673 + ], + [ + 1704.1294706891904, + 95.03636026198285, + 95.44037616131891, + 94.63234436264673 + ], + [ + 1707.8526944950263, + 95.03636026198285, + 95.44037616131891, + 94.63234436264673 + ], + [ + 1711.5759183008622, + 95.03636026198285, + 95.44037616131891, + 94.63234436264673 + ], + [ + 1715.299142106699, + 95.03636026198285, + 95.44037616131891, + 94.63234436264673 + ], + [ + 1719.022365912535, + 95.03636026198285, + 95.44037616131891, + 94.63234436264673 + ], + [ + 1722.7455897183718, + 95.03636026198285, + 95.44037616131891, + 94.63234436264673 + ], + [ + 1726.4688135242077, + 95.03636026198285, + 95.44037616131891, + 94.63234436264673 + ], + [ + 1730.1920373300445, + 95.03636026198285, + 95.44037616131891, + 94.63234436264673 + ], + [ + 1733.9152611358804, + 95.03636026198285, + 95.44037616131891, + 94.63234436264673 + ], + [ + 1737.6384849417173, + 95.03636026198285, + 95.44037616131891, + 94.63234436264673 + ], + [ + 1741.3617087475532, + 95.03636026198285, + 95.44037616131891, + 94.63234436264673 + ], + [ + 1745.084932553389, + 95.03636026198285, + 95.44037616131891, + 94.63234436264673 + ], + [ + 1748.808156359226, + 95.03636026198285, + 95.44037616131891, + 94.63234436264673 + ], + [ + 1752.5313801650618, + 95.03636026198285, + 95.44037616131891, + 94.63234436264673 + ], + [ + 1756.2546039708986, + 94.9353562871488, + 95.44037616131891, + 94.4303364129787 + ], + [ + 1759.9778277767346, + 94.9353562871488, + 95.44037616131891, + 94.4303364129787 + ], + [ + 1763.7010515825714, + 94.9353562871488, + 95.44037616131891, + 94.4303364129787 + ], + [ + 1767.4242753884073, + 94.9353562871488, + 95.44037616131891, + 94.4303364129787 + ], + [ + 1771.1474991942441, + 94.83435231231482, + 95.23836821165088, + 94.4303364129787 + ], + [ + 1774.87072300008, + 94.73334833748078, + 95.23836821165088, + 94.22832846331067 + ], + [ + 1778.5939468059169, + 94.73334833748078, + 95.23836821165088, + 94.22832846331067 + ], + [ + 1782.3171706117528, + 94.73334833748078, + 95.23836821165088, + 94.22832846331067 + ], + [ + 1786.0403944175887, + 94.53134038781275, + 95.03636026198285, + 94.02632051364264 + ], + [ + 1789.7636182234255, + 94.53134038781275, + 95.03636026198285, + 94.02632051364264 + ], + [ + 1793.4868420292614, + 94.4303364129787, + 95.03636026198285, + 93.82431256397456 + ], + [ + 1797.2100658350982, + 94.32933243814472, + 94.83435231231482, + 93.82431256397456 + ], + [ + 1800.9332896409342, + 94.22832846331067, + 94.83435231231482, + 93.62230461430653 + ], + [ + 1804.656513446771, + 94.12732448847663, + 94.63234436264673, + 93.62230461430653 + ], + [ + 1808.379737252607, + 94.02632051364264, + 94.63234436264673, + 93.4202966646385 + ], + [ + 1812.1029610584437, + 93.9253165388086, + 94.4303364129787, + 93.4202966646385 + ], + [ + 1815.8261848642796, + 93.82431256397456, + 94.4303364129787, + 93.21828871497047 + ], + [ + 1819.5494086701165, + 93.72330858914057, + 94.22832846331067, + 93.21828871497047 + ], + [ + 1823.2726324759524, + 93.62230461430653, + 94.22832846331067, + 93.01628076530244 + ], + [ + 1826.9958562817883, + 93.52130063947254, + 94.02632051364264, + 93.01628076530244 + ], + [ + 1830.7190800876251, + 93.4202966646385, + 94.02632051364264, + 92.81427281563435 + ], + [ + 1834.442303893461, + 93.21828871497047, + 93.82431256397456, + 92.61226486596632 + ], + [ + 1838.1655276992979, + 93.11728474013643, + 93.62230461430653, + 92.61226486596632 + ], + [ + 1841.8887515051338, + 93.01628076530244, + 93.62230461430653, + 92.4102569162983 + ], + [ + 1845.6119753109706, + 92.81427281563435, + 93.4202966646385, + 92.20824896663026 + ], + [ + 1849.3351991168065, + 92.71326884080037, + 93.21828871497047, + 92.20824896663026 + ], + [ + 1853.0584229226433, + 92.61226486596632, + 93.21828871497047, + 92.00624101696218 + ], + [ + 1856.7816467284792, + 92.4102569162983, + 93.01628076530244, + 91.80423306729415 + ], + [ + 1860.5048705343152, + 92.20824896663026, + 92.81427281563435, + 91.60222511762612 + ], + [ + 1864.228094340152, + 92.10724499179622, + 92.61226486596632, + 91.60222511762612 + ], + [ + 1867.951318145988, + 92.00624101696218, + 92.61226486596632, + 91.40021716795809 + ], + [ + 1871.6745419518247, + 91.80423306729415, + 92.4102569162983, + 91.19820921829 + ], + [ + 1875.3977657576606, + 91.60222511762612, + 92.20824896663026, + 90.99620126862197 + ], + [ + 1879.1209895634975, + 91.40021716795809, + 92.00624101696218, + 90.79419331895394 + ], + [ + 1882.8442133693334, + 91.29921319312405, + 92.00624101696218, + 90.59218536928591 + ], + [ + 1886.5674371751702, + 91.19820921829, + 91.80423306729415, + 90.59218536928591 + ], + [ + 1890.290660981006, + 90.99620126862197, + 91.60222511762612, + 90.39017741961783 + ], + [ + 1894.013884786843, + 90.79419331895394, + 91.40021716795809, + 90.1881694699498 + ], + [ + 1897.7371085926789, + 90.59218536928591, + 91.19820921829, + 89.98616152028177 + ], + [ + 1901.4603323985148, + 90.39017741961783, + 90.99620126862197, + 89.78415357061374 + ], + [ + 1905.1835562043516, + 90.28917344478384, + 90.99620126862197, + 89.58214562094571 + ], + [ + 1908.9067800101875, + 90.08716549511581, + 90.79419331895394, + 89.38013767127762 + ], + [ + 1912.6300038160243, + 89.88515754544773, + 90.59218536928591, + 89.1781297216096 + ], + [ + 1916.3532276218602, + 89.6831495957797, + 90.39017741961783, + 88.97612177194156 + ], + [ + 1920.076451427697, + 89.48114164611167, + 90.1881694699498, + 88.77411382227353 + ], + [ + 1923.799675233533, + 89.27913369644364, + 89.98616152028177, + 88.57210587260545 + ], + [ + 1927.5228990393698, + 89.07712574677555, + 89.78415357061374, + 88.37009792293742 + ], + [ + 1931.2461228452057, + 88.87511779710752, + 89.58214562094571, + 88.16808997326939 + ], + [ + 1934.9693466510425, + 88.67310984743949, + 89.38013767127762, + 87.96608202360136 + ], + [ + 1938.6925704568785, + 88.47110189777146, + 89.1781297216096, + 87.76407407393327 + ], + [ + 1942.4157942627144, + 88.26909394810343, + 88.97612177194156, + 87.56206612426524 + ], + [ + 1946.1390180685512, + 88.06708599843535, + 88.77411382227353, + 87.36005817459721 + ], + [ + 1949.862241874387, + 87.86507804876732, + 88.57210587260545, + 87.15805022492918 + ], + [ + 1953.585465680224, + 87.66307009909929, + 88.37009792293742, + 86.9560422752611 + ], + [ + 1957.3086894860598, + 87.46106214943126, + 88.16808997326939, + 86.75403432559307 + ], + [ + 1961.0319132918967, + 87.25905419976317, + 87.96608202360136, + 86.55202637592504 + ], + [ + 1964.7551370977326, + 87.05704625009514, + 87.76407407393327, + 86.35001842625701 + ], + [ + 1968.4783609035694, + 86.85503830042711, + 87.56206612426524, + 86.14801047658898 + ], + [ + 1972.2015847094053, + 86.65303035075908, + 87.36005817459721, + 85.94600252692089 + ], + [ + 1975.9248085152412, + 86.35001842625701, + 87.15805022492918, + 85.54198662758483 + ], + [ + 1979.648032321078, + 86.14801047658898, + 86.9560422752611, + 85.3399786779168 + ], + [ + 1983.371256126914, + 85.8449985520869, + 86.55202637592504, + 85.13797072824872 + ], + [ + 1987.0944799327508, + 85.64299060241882, + 86.35001842625701, + 84.93596277858069 + ], + [ + 1990.8177037385867, + 85.44098265275079, + 86.14801047658898, + 84.73395482891266 + ], + [ + 1994.5409275444235, + 85.23897470308276, + 85.94600252692089, + 84.53194687924463 + ], + [ + 1998.2641513502595, + 84.93596277858069, + 85.74399457725286, + 84.12793097990851 + ], + [ + 2001.9873751560963, + 84.73395482891266, + 85.54198662758483, + 83.92592303024048 + ], + [ + 2005.7105989619322, + 84.53194687924463, + 85.3399786779168, + 83.72391508057245 + ], + [ + 2009.433822767769, + 84.22893495474256, + 84.93596277858069, + 83.52190713090442 + ], + [ + 2013.157046573605, + 83.92592303024048, + 84.73395482891266, + 83.11789123156831 + ], + [ + 2016.8802703794408, + 83.72391508057245, + 84.53194687924463, + 82.91588328190028 + ], + [ + 2020.6034941852777, + 83.52190713090442, + 84.32993892957654, + 82.71387533223225 + ], + [ + 2024.3267179911136, + 83.31989918123634, + 84.12793097990851, + 82.51186738256416 + ], + [ + 2028.0499417969504, + 82.91588328190028, + 83.72391508057245, + 82.1078514832281 + ], + [ + 2031.7731656027863, + 82.71387533223225, + 83.52190713090442, + 81.90584353356007 + ], + [ + 2035.4963894086231, + 82.51186738256416, + 83.31989918123634, + 81.70383558389199 + ], + [ + 2039.219613214459, + 82.20885545806209, + 83.11789123156831, + 81.29981968455593 + ], + [ + 2042.9428370202959, + 81.90584353356007, + 82.71387533223225, + 81.0978117348879 + ], + [ + 2046.6660608261318, + 81.70383558389199, + 82.51186738256416, + 80.89580378521981 + ], + [ + 2050.3892846319677, + 81.50182763422396, + 82.30985943289613, + 80.69379583555178 + ], + [ + 2054.1125084378045, + 81.0978117348879, + 81.90584353356007, + 80.28977993621572 + ], + [ + 2057.8357322436405, + 80.89580378521981, + 81.70383558389199, + 80.0877719865477 + ], + [ + 2061.5589560494773, + 80.69379583555178, + 81.50182763422396, + 79.8857640368796 + ], + [ + 2065.282179855313, + 80.39078391104971, + 81.0978117348879, + 79.68375608721158 + ], + [ + 2069.00540366115, + 80.0877719865477, + 80.89580378521981, + 79.27974018787552 + ], + [ + 2072.728627466986, + 79.8857640368796, + 80.69379583555178, + 79.07773223820743 + ], + [ + 2076.4518512728228, + 79.68375608721158, + 80.49178788588375, + 78.8757242885394 + ], + [ + 2080.1750750786587, + 79.3807441627095, + 80.0877719865477, + 78.67371633887137 + ], + [ + 2083.8982988844955, + 79.17873621304147, + 79.8857640368796, + 78.47170838920334 + ], + [ + 2087.6215226903314, + 78.97672826337345, + 79.68375608721158, + 78.26970043953526 + ], + [ + 2091.3447464961673, + 78.77472031370542, + 79.48174813754355, + 78.06769248986723 + ], + [ + 2095.067970302004, + 78.47170838920334, + 79.27974018787552, + 77.66367659053117 + ], + [ + 2098.79119410784, + 78.26970043953526, + 79.07773223820743, + 77.46166864086308 + ], + [ + 2102.514417913677, + 77.96668851503324, + 78.67371633887137, + 77.25966069119505 + ], + [ + 2106.237641719513, + 77.76468056536515, + 78.47170838920334, + 77.05765274152702 + ], + [ + 2109.9608655253496, + 77.56267261569712, + 78.26970043953526, + 76.85564479185899 + ], + [ + 2113.6840893311855, + 77.3606646660291, + 78.06769248986723, + 76.65363684219096 + ], + [ + 2117.4073131370224, + 77.15865671636107, + 77.8656845401992, + 76.45162889252288 + ], + [ + 2121.1305369428583, + 76.95664876669298, + 77.66367659053117, + 76.24962094285485 + ], + [ + 2124.853760748695, + 76.75464081702495, + 77.46166864086308, + 76.04761299318682 + ], + [ + 2128.576984554531, + 76.55263286735692, + 77.25966069119505, + 75.84560504351879 + ], + [ + 2132.300208360367, + 76.35062491768889, + 77.05765274152702, + 75.6435970938507 + ], + [ + 2136.0234321662037, + 76.1486169680208, + 76.85564479185899, + 75.44158914418267 + ], + [ + 2139.7466559720397, + 75.94660901835277, + 76.65363684219096, + 75.23958119451464 + ], + [ + 2143.4698797778765, + 75.6435970938507, + 76.24962094285485, + 75.03757324484661 + ], + [ + 2147.1931035837124, + 75.34058516934869, + 76.04761299318682, + 74.6335573455105 + ], + [ + 2150.916327389549, + 75.1385772196806, + 75.84560504351879, + 74.43154939584247 + ], + [ + 2154.639551195385, + 74.93656927001257, + 75.6435970938507, + 74.22954144617444 + ], + [ + 2158.362775001222, + 74.73456132034454, + 75.44158914418267, + 74.02753349650641 + ], + [ + 2162.085998807058, + 74.53255337067651, + 75.23958119451464, + 73.82552554683832 + ], + [ + 2165.809222612894, + 74.33054542100842, + 75.03757324484661, + 73.62351759717029 + ], + [ + 2169.5324464187306, + 74.1285374713404, + 74.83556529517853, + 73.42150964750226 + ], + [ + 2173.2556702245665, + 73.92652952167236, + 74.6335573455105, + 73.21950169783423 + ], + [ + 2176.9788940304034, + 73.72452157200433, + 74.43154939584247, + 73.01749374816615 + ], + [ + 2180.7021178362393, + 73.52251362233625, + 74.22954144617444, + 72.81548579849812 + ], + [ + 2184.425341642076, + 73.32050567266822, + 74.02753349650641, + 72.61347784883003 + ], + [ + 2188.148565447912, + 73.11849772300019, + 73.82552554683832, + 72.41146989916206 + ], + [ + 2191.871789253749, + 72.91648977333216, + 73.62351759717029, + 72.20946194949397 + ], + [ + 2195.5950130595847, + 72.71448182366407, + 73.42150964750226, + 72.007453999826 + ], + [ + 2199.3182368654216, + 72.5124738739961, + 73.21950169783423, + 71.80544605015791 + ], + [ + 2203.0414606712575, + 72.31046592432801, + 73.01749374816615, + 71.60343810048983 + ], + [ + 2206.7646844770934, + 72.10845797465993, + 72.81548579849812, + 71.40143015082185 + ], + [ + 2210.48790828293, + 72.007453999826, + 72.61347784883003, + 71.40143015082185 + ], + [ + 2214.211132088766, + 71.80544605015791, + 72.41146989916206, + 71.19942220115377 + ], + [ + 2217.934355894603, + 71.60343810048983, + 72.20946194949397, + 70.99741425148568 + ], + [ + 2221.657579700439, + 71.40143015082185, + 72.007453999826, + 70.7954063018177 + ], + [ + 2225.3808035062757, + 71.19942220115377, + 71.80544605015791, + 70.59339835214962 + ], + [ + 2229.1040273121116, + 70.99741425148568, + 71.60343810048983, + 70.39139040248165 + ], + [ + 2232.8272511179484, + 70.7954063018177, + 71.40143015082185, + 70.18938245281356 + ], + [ + 2236.5504749237843, + 70.59339835214962, + 71.19942220115377, + 69.98737450314547 + ], + [ + 2240.273698729621, + 70.39139040248165, + 70.99741425148568, + 69.7853665534775 + ], + [ + 2243.996922535457, + 70.18938245281356, + 70.7954063018177, + 69.58335860380942 + ], + [ + 2247.720146341293, + 70.08837847797952, + 70.7954063018177, + 69.38135065414144 + ], + [ + 2251.44337014713, + 69.88637052831155, + 70.59339835214962, + 69.17934270447336 + ], + [ + 2255.1665939529657, + 69.68436257864346, + 70.39139040248165, + 68.97733475480527 + ], + [ + 2258.8898177588026, + 69.48235462897537, + 70.18938245281356, + 68.7753268051373 + ], + [ + 2262.6130415646385, + 69.2803466793074, + 69.98737450314547, + 68.57331885546921 + ], + [ + 2266.3362653704753, + 69.07833872963931, + 69.7853665534775, + 68.37131090580112 + ], + [ + 2270.059489176311, + 68.87633077997134, + 69.58335860380942, + 68.16930295613315 + ], + [ + 2273.782712982148, + 68.7753268051373, + 69.38135065414144, + 68.16930295613315 + ], + [ + 2277.505936787984, + 68.57331885546921, + 69.17934270447336, + 67.96729500646506 + ], + [ + 2281.22916059382, + 68.37131090580112, + 68.97733475480527, + 67.76528705679709 + ], + [ + 2284.9523843996567, + 68.16930295613315, + 68.7753268051373, + 67.563279107129 + ], + [ + 2288.6756082054926, + 67.96729500646506, + 68.57331885546921, + 67.36127115746092 + ], + [ + 2292.3988320113294, + 67.76528705679709, + 68.37131090580112, + 67.15926320779295 + ], + [ + 2296.1220558171653, + 67.66428308196305, + 68.37131090580112, + 66.95725525812486 + ], + [ + 2299.845279623002, + 67.46227513229496, + 68.16930295613315, + 66.75524730845689 + ], + [ + 2303.568503428838, + 67.26026718262699, + 67.96729500646506, + 66.5532393587888 + ], + [ + 2307.291727234675, + 67.0582592329589, + 67.76528705679709, + 66.35123140912071 + ], + [ + 2311.014951040511, + 66.95725525812486, + 67.563279107129, + 66.35123140912071 + ], + [ + 2314.7381748463476, + 66.75524730845689, + 67.36127115746092, + 66.14922345945274 + ], + [ + 2318.4613986521836, + 66.5532393587888, + 67.15926320779295, + 65.94721550978466 + ], + [ + 2322.1846224580195, + 66.35123140912071, + 66.95725525812486, + 65.74520756011657 + ], + [ + 2325.9078462638563, + 66.14922345945274, + 66.75524730845689, + 65.5431996104486 + ], + [ + 2329.631070069692, + 65.94721550978466, + 66.5532393587888, + 65.34119166078051 + ], + [ + 2333.354293875529, + 65.84621153495061, + 66.5532393587888, + 65.13918371111254 + ], + [ + 2337.077517681365, + 65.64420358528264, + 66.35123140912071, + 64.93717576144445 + ], + [ + 2340.800741487202, + 65.5431996104486, + 66.14922345945274, + 64.93717576144445 + ], + [ + 2344.5239652930377, + 65.34119166078051, + 65.94721550978466, + 64.73516781177636 + ], + [ + 2348.2471890988745, + 65.13918371111254, + 65.74520756011657, + 64.53315986210839 + ], + [ + 2351.9704129047104, + 64.93717576144445, + 65.5431996104486, + 64.3311519124403 + ], + [ + 2355.6936367105463, + 64.73516781177636, + 65.34119166078051, + 64.12914396277233 + ], + [ + 2359.416860516383, + 64.63416383694243, + 65.34119166078051, + 63.927136013104246 + ], + [ + 2363.140084322219, + 64.43215588727435, + 65.13918371111254, + 63.72512806343616 + ], + [ + 2366.863308128056, + 64.3311519124403, + 64.93717576144445, + 63.72512806343616 + ], + [ + 2370.586531933892, + 64.12914396277233, + 64.73516781177636, + 63.52312011376819 + ], + [ + 2374.3097557397286, + 63.927136013104246, + 64.53315986210839, + 63.3211121641001 + ], + [ + 2378.0329795455646, + 63.72512806343616, + 64.3311519124403, + 63.119104214432014 + ], + [ + 2381.7562033514014, + 63.52312011376819, + 64.12914396277233, + 62.91709626476404 + ], + [ + 2385.4794271572373, + 63.42211613893414, + 64.12914396277233, + 62.715088315095954 + ], + [ + 2389.202650963074, + 63.3211121641001, + 63.927136013104246, + 62.715088315095954 + ], + [ + 2392.92587476891, + 63.119104214432014, + 63.72512806343616, + 62.51308036542798 + ], + [ + 2396.649098574746, + 62.91709626476404, + 63.52312011376819, + 62.311072415759895 + ], + [ + 2400.372322380583, + 62.715088315095954, + 63.3211121641001, + 62.10906446609181 + ], + [ + 2404.0955461864187, + 62.51308036542798, + 63.119104214432014, + 61.907056516423836 + ], + [ + 2407.8187699922555, + 62.51308036542798, + 63.119104214432014, + 61.907056516423836 + ], + [ + 2411.5419937980914, + 62.311072415759895, + 62.91709626476404, + 61.70504856675575 + ], + [ + 2415.2652176039282, + 62.10906446609181, + 62.715088315095954, + 61.50304061708766 + ], + [ + 2418.988441409764, + 61.907056516423836, + 62.51308036542798, + 61.30103266741969 + ], + [ + 2422.711665215601, + 61.70504856675575, + 62.311072415759895, + 61.099024717751604 + ], + [ + 2426.434889021437, + 61.604044591921706, + 62.311072415759895, + 60.89701676808363 + ], + [ + 2430.1581128272737, + 61.50304061708766, + 62.10906446609181, + 60.89701676808363 + ], + [ + 2433.8813366331096, + 61.30103266741969, + 61.907056516423836, + 60.695008818415545 + ], + [ + 2437.6045604389456, + 61.099024717751604, + 61.70504856675575, + 60.49300086874746 + ], + [ + 2441.3277842447824, + 60.89701676808363, + 61.50304061708766, + 60.290992919079486 + ], + [ + 2445.0510080506183, + 60.79601279324959, + 61.50304061708766, + 60.0889849694114 + ], + [ + 2448.774231856455, + 60.695008818415545, + 61.30103266741969, + 60.0889849694114 + ], + [ + 2452.497455662291, + 60.49300086874746, + 61.099024717751604, + 59.886977019743426 + ], + [ + 2456.220679468128, + 60.290992919079486, + 60.89701676808363, + 59.68496907007534 + ], + [ + 2459.9439032739638, + 60.0889849694114, + 60.695008818415545, + 59.48296112040725 + ], + [ + 2463.6671270798006, + 60.0889849694114, + 60.695008818415545, + 59.48296112040725 + ], + [ + 2467.3903508856365, + 59.886977019743426, + 60.49300086874746, + 59.28095317073928 + ], + [ + 2471.1135746914724, + 59.68496907007534, + 60.290992919079486, + 59.078945221071194 + ], + [ + 2474.8367984973092, + 59.48296112040725, + 60.0889849694114, + 58.87693727140311 + ], + [ + 2478.560022303145, + 59.28095317073928, + 59.886977019743426, + 58.674929321735135 + ], + [ + 2482.283246108982, + 59.28095317073928, + 59.886977019743426, + 58.674929321735135 + ], + [ + 2486.006469914818, + 59.078945221071194, + 59.68496907007534, + 58.47292137206705 + ], + [ + 2489.7296937206547, + 58.87693727140311, + 59.48296112040725, + 58.270913422399076 + ], + [ + 2493.4529175264906, + 58.674929321735135, + 59.28095317073928, + 58.06890547273099 + ], + [ + 2497.1761413323275, + 58.674929321735135, + 59.28095317073928, + 58.06890547273099 + ], + [ + 2500.8993651381634, + 58.47292137206705, + 59.078945221071194, + 57.8668975230629 + ], + [ + 2504.622588944, + 58.270913422399076, + 58.87693727140311, + 57.66488957339493 + ], + [ + 2508.345812749836, + 58.06890547273099, + 58.674929321735135, + 57.462881623726844 + ], + [ + 2512.069036555672, + 58.06890547273099, + 58.674929321735135, + 57.462881623726844 + ], + [ + 2515.792260361509, + 57.8668975230629, + 58.47292137206705, + 57.26087367405887 + ], + [ + 2519.5154841673448, + 57.66488957339493, + 58.270913422399076, + 57.058865724390785 + ], + [ + 2523.2387079731816, + 57.462881623726844, + 58.06890547273099, + 56.8568577747227 + ], + [ + 2526.9619317790175, + 57.462881623726844, + 58.06890547273099, + 56.8568577747227 + ], + [ + 2530.6851555848543, + 57.26087367405887, + 57.8668975230629, + 56.654849825054725 + ], + [ + 2534.4083793906902, + 57.058865724390785, + 57.66488957339493, + 56.45284187538664 + ], + [ + 2538.131603196527, + 56.95786174955674, + 57.462881623726844, + 56.45284187538664 + ], + [ + 2541.854827002363, + 56.8568577747227, + 57.462881623726844, + 56.25083392571855 + ], + [ + 2545.578050808199, + 56.654849825054725, + 57.26087367405887, + 56.04882597605058 + ], + [ + 2549.3012746140357, + 56.45284187538664, + 57.058865724390785, + 55.84681802638249 + ], + [ + 2553.0244984198716, + 56.351837900552596, + 56.8568577747227, + 55.84681802638249 + ], + [ + 2556.7477222257085, + 56.25083392571855, + 56.8568577747227, + 55.64481007671452 + ], + [ + 2560.4709460315444, + 56.04882597605058, + 56.654849825054725, + 55.442802127046434 + ], + [ + 2564.194169837381, + 55.94782200121654, + 56.45284187538664, + 55.442802127046434 + ], + [ + 2567.917393643217, + 55.84681802638249, + 56.45284187538664, + 55.24079417737835 + ], + [ + 2571.640617449054, + 55.64481007671452, + 56.25083392571855, + 55.038786227710375 + ], + [ + 2575.36384125489, + 55.442802127046434, + 56.04882597605058, + 54.83677827804229 + ], + [ + 2579.0870650607267, + 55.34179815221239, + 55.84681802638249, + 54.83677827804229 + ], + [ + 2582.8102888665626, + 55.24079417737835, + 55.84681802638249, + 54.6347703283742 + ], + [ + 2586.5335126723985, + 55.038786227710375, + 55.64481007671452, + 54.43276237870623 + ], + [ + 2590.2567364782353, + 54.93778225287633, + 55.442802127046434, + 54.43276237870623 + ], + [ + 2593.9799602840712, + 54.83677827804229, + 55.442802127046434, + 54.23075442903814 + ], + [ + 2597.703184089908, + 54.6347703283742, + 55.24079417737835, + 54.02874647937017 + ], + [ + 2601.426407895744, + 54.53376635354027, + 55.038786227710375, + 54.02874647937017 + ], + [ + 2605.149631701581, + 54.43276237870623, + 55.038786227710375, + 53.826738529702084 + ], + [ + 2608.8728555074167, + 54.23075442903814, + 54.83677827804229, + 53.624730580034 + ], + [ + 2612.5960793132535, + 54.02874647937017, + 54.6347703283742, + 53.422722630366025 + ], + [ + 2616.3193031190895, + 54.02874647937017, + 54.6347703283742, + 53.422722630366025 + ], + [ + 2620.0425269249263, + 53.826738529702084, + 54.43276237870623, + 53.22071468069794 + ], + [ + 2623.765750730762, + 53.624730580034, + 54.23075442903814, + 53.018706731029965 + ], + [ + 2627.488974536598, + 53.52372660520007, + 54.02874647937017, + 53.018706731029965 + ], + [ + 2631.212198342435, + 53.422722630366025, + 54.02874647937017, + 52.81669878136188 + ], + [ + 2634.935422148271, + 53.22071468069794, + 53.826738529702084, + 52.61469083169379 + ], + [ + 2638.6586459541077, + 53.119710705863895, + 53.624730580034, + 52.61469083169379 + ], + [ + 2642.3818697599436, + 53.018706731029965, + 53.624730580034, + 52.41268288202582 + ], + [ + 2646.1050935657804, + 52.81669878136188, + 53.422722630366025, + 52.21067493235773 + ], + [ + 2649.8283173716163, + 52.715694806527836, + 53.22071468069794, + 52.21067493235773 + ], + [ + 2653.551541177453, + 52.61469083169379, + 53.22071468069794, + 52.00866698268965 + ], + [ + 2657.274764983289, + 52.51368685685986, + 53.018706731029965, + 52.00866698268965 + ], + [ + 2660.997988789125, + 52.41268288202582, + 53.018706731029965, + 51.806659033021674 + ], + [ + 2664.721212594962, + 52.21067493235773, + 52.81669878136188, + 51.60465108335359 + ], + [ + 2668.4444364007977, + 52.10967095752369, + 52.61469083169379, + 51.60465108335359 + ], + [ + 2672.1676602066345, + 52.00866698268965, + 52.61469083169379, + 51.402643133685615 + ], + [ + 2675.8908840124705, + 51.806659033021674, + 52.41268288202582, + 51.20063518401753 + ], + [ + 2679.6141078183073, + 51.70565505818763, + 52.21067493235773, + 51.20063518401753 + ], + [ + 2683.337331624143, + 51.60465108335359, + 52.21067493235773, + 50.99862723434944 + ], + [ + 2687.06055542998, + 51.402643133685615, + 52.00866698268965, + 50.79661928468147 + ], + [ + 2690.783779235816, + 51.30163915885157, + 51.806659033021674, + 50.79661928468147 + ], + [ + 2694.5070030416528, + 51.20063518401753, + 51.806659033021674, + 50.59461133501338 + ], + [ + 2698.2302268474887, + 51.099631209183485, + 51.60465108335359, + 50.59461133501338 + ], + [ + 2701.9534506533246, + 50.89762325951551, + 51.402643133685615, + 50.39260338534541 + ], + [ + 2705.6766744591614, + 50.79661928468147, + 51.402643133685615, + 50.190595435677324 + ], + [ + 2709.3998982649973, + 50.695615309847426, + 51.20063518401753, + 50.190595435677324 + ], + [ + 2713.123122070834, + 50.59461133501338, + 51.20063518401753, + 49.98858748600924 + ], + [ + 2716.84634587667, + 50.39260338534541, + 50.99862723434944, + 49.786579536341264 + ], + [ + 2720.569569682507, + 50.29159941051137, + 50.79661928468147, + 49.786579536341264 + ], + [ + 2724.292793488343, + 50.190595435677324, + 50.79661928468147, + 49.58457158667318 + ], + [ + 2728.0160172941796, + 50.08959146084328, + 50.59461133501338, + 49.58457158667318 + ], + [ + 2731.7392411000155, + 49.887583511175194, + 50.39260338534541, + 49.38256363700509 + ], + [ + 2735.4624649058524, + 49.786579536341264, + 50.39260338534541, + 49.18055568733712 + ], + [ + 2739.1856887116883, + 49.68557556150722, + 50.190595435677324, + 49.18055568733712 + ], + [ + 2742.908912517524, + 49.58457158667318, + 50.190595435677324, + 48.97854773766903 + ], + [ + 2746.632136323361, + 49.483567611839135, + 49.98858748600924, + 48.97854773766903 + ], + [ + 2750.355360129197, + 49.28155966217116, + 49.786579536341264, + 48.77653978800106 + ], + [ + 2754.0785839350337, + 49.18055568733712, + 49.786579536341264, + 48.57453183833297 + ], + [ + 2757.8018077408697, + 49.079551712503076, + 49.58457158667318, + 48.57453183833297 + ], + [ + 2761.5250315467065, + 48.97854773766903, + 49.58457158667318, + 48.37252388866489 + ], + [ + 2765.2482553525424, + 48.87754376283499, + 49.38256363700509, + 48.37252388866489 + ], + [ + 2768.971479158379, + 48.77653978800106, + 49.38256363700509, + 48.170515938996914 + ], + [ + 2772.694702964215, + 48.57453183833297, + 49.18055568733712, + 47.96850798932883 + ], + [ + 2776.417926770051, + 48.47352786349893, + 48.97854773766903, + 47.96850798932883 + ], + [ + 2780.141150575888, + 48.37252388866489, + 48.97854773766903, + 47.766500039660855 + ], + [ + 2783.864374381724, + 48.27151991383096, + 48.77653978800106, + 47.766500039660855 + ], + [ + 2787.5875981875606, + 48.170515938996914, + 48.77653978800106, + 47.56449208999277 + ], + [ + 2791.3108219933965, + 48.06951196416287, + 48.57453183833297, + 47.56449208999277 + ], + [ + 2795.0340457992334, + 47.867504014494784, + 48.37252388866489, + 47.36248414032468 + ], + [ + 2798.7572696050693, + 47.867504014494784, + 48.37252388866489, + 47.36248414032468 + ], + [ + 2802.480493410906, + 47.66549606482681, + 48.170515938996914, + 47.16047619065671 + ], + [ + 2806.203717216742, + 47.56449208999277, + 48.170515938996914, + 46.95846824098862 + ], + [ + 2809.926941022579, + 47.463488115158725, + 47.96850798932883, + 46.95846824098862 + ], + [ + 2813.6501648284147, + 47.36248414032468, + 47.96850798932883, + 46.756460291320536 + ], + [ + 2817.3733886342507, + 47.26148016549064, + 47.766500039660855, + 46.756460291320536 + ], + [ + 2821.0966124400875, + 47.16047619065671, + 47.766500039660855, + 46.55445234165256 + ], + [ + 2824.8198362459234, + 47.059472215822666, + 47.56449208999277, + 46.55445234165256 + ], + [ + 2828.54306005176, + 46.85746426615458, + 47.36248414032468, + 46.35244439198448 + ], + [ + 2832.266283857596, + 46.85746426615458, + 47.36248414032468, + 46.35244439198448 + ], + [ + 2835.989507663433, + 46.65545631648661, + 47.16047619065671, + 46.150436442316504 + ], + [ + 2839.712731469269, + 46.55445234165256, + 47.16047619065671, + 45.94842849264842 + ], + [ + 2843.4359552751057, + 46.45344836681852, + 46.95846824098862, + 45.94842849264842 + ], + [ + 2847.1591790809416, + 46.35244439198448, + 46.95846824098862, + 45.74642054298033 + ], + [ + 2850.8824028867775, + 46.251440417150434, + 46.756460291320536, + 45.74642054298033 + ], + [ + 2854.6056266926144, + 46.150436442316504, + 46.756460291320536, + 45.54441259331236 + ], + [ + 2858.3288504984503, + 46.04943246748246, + 46.55445234165256, + 45.54441259331236 + ], + [ + 2862.052074304287, + 45.94842849264842, + 46.55445234165256, + 45.34240464364427 + ], + [ + 2865.775298110123, + 45.847424517814375, + 46.35244439198448, + 45.34240464364427 + ], + [ + 2869.49852191596, + 45.74642054298033, + 46.35244439198448, + 45.140396693976186 + ], + [ + 2873.2217457217957, + 45.6454165681464, + 46.150436442316504, + 45.140396693976186 + ], + [ + 2876.9449695276326, + 45.54441259331236, + 46.150436442316504, + 44.93838874430821 + ], + [ + 2880.6681933334685, + 45.443408618478315, + 45.94842849264842, + 44.93838874430821 + ], + [ + 2884.3914171393053, + 45.34240464364427, + 45.94842849264842, + 44.73638079464013 + ], + [ + 2888.114640945141, + 45.24140066881023, + 45.74642054298033, + 44.73638079464013 + ], + [ + 2891.837864750977, + 45.140396693976186, + 45.74642054298033, + 44.534372844972154 + ], + [ + 2895.561088556814, + 45.039392719142256, + 45.54441259331236, + 44.534372844972154 + ], + [ + 2899.28431236265, + 44.93838874430821, + 45.54441259331236, + 44.33236489530407 + ], + [ + 2903.0075361684867, + 44.83738476947417, + 45.34240464364427, + 44.33236489530407 + ], + [ + 2906.7307599743226, + 44.73638079464013, + 45.34240464364427, + 44.13035694563598 + ], + [ + 2910.4539837801594, + 44.63537681980608, + 45.140396693976186, + 44.13035694563598 + ], + [ + 2914.1772075859953, + 44.534372844972154, + 45.140396693976186, + 43.92834899596801 + ], + [ + 2917.900431391832, + 44.43336887013811, + 44.93838874430821, + 43.92834899596801 + ], + [ + 2921.623655197668, + 44.33236489530407, + 44.93838874430821, + 43.72634104629992 + ], + [ + 2925.346879003505, + 44.231360920470024, + 44.73638079464013, + 43.72634104629992 + ], + [ + 2929.070102809341, + 44.13035694563598, + 44.73638079464013, + 43.52433309663195 + ], + [ + 2932.7933266151767, + 44.02935297080205, + 44.534372844972154, + 43.52433309663195 + ], + [ + 2936.5165504210136, + 43.92834899596801, + 44.534372844972154, + 43.32232514696386 + ], + [ + 2940.2397742268495, + 43.827345021133965, + 44.33236489530407, + 43.32232514696386 + ], + [ + 2943.9629980326863, + 43.827345021133965, + 44.33236489530407, + 43.32232514696386 + ], + [ + 2947.686221838522, + 43.62533707146588, + 44.13035694563598, + 43.120317197295776 + ], + [ + 2951.409445644359, + 43.62533707146588, + 44.13035694563598, + 43.120317197295776 + ], + [ + 2955.132669450195, + 43.423329121797906, + 43.92834899596801, + 42.9183092476278 + ], + [ + 2958.855893256032, + 43.423329121797906, + 43.92834899596801, + 42.9183092476278 + ], + [ + 2962.5791170618677, + 43.22132117212982, + 43.72634104629992, + 42.71630129795972 + ], + [ + 2966.3023408677036, + 43.22132117212982, + 43.72634104629992, + 42.71630129795972 + ], + [ + 2970.0255646735404, + 43.01931322246185, + 43.52433309663195, + 42.51429334829163 + ], + [ + 2973.7487884793763, + 43.01931322246185, + 43.52433309663195, + 42.51429334829163 + ], + [ + 2977.472012285213, + 42.9183092476278, + 43.52433309663195, + 42.31228539862366 + ], + [ + 2981.195236091049, + 42.81730527279376, + 43.32232514696386, + 42.31228539862366 + ], + [ + 2984.918459896886, + 42.81730527279376, + 43.32232514696386, + 42.31228539862366 + ], + [ + 2988.641683702722, + 42.615297323125674, + 43.120317197295776, + 42.11027744895557 + ], + [ + 2992.3649075085586, + 42.615297323125674, + 43.120317197295776, + 42.11027744895557 + ], + [ + 2996.0881313143946, + 42.4132893734577, + 42.9183092476278, + 41.9082694992876 + ], + [ + 2999.8113551202314, + 42.4132893734577, + 42.9183092476278, + 41.9082694992876 + ], + [ + 3003.5345789260673, + 42.211281423789615, + 42.71630129795972, + 41.70626154961951 + ], + [ + 3007.257802731903, + 42.211281423789615, + 42.71630129795972, + 41.70626154961951 + ], + [ + 3010.98102653774, + 42.211281423789615, + 42.71630129795972, + 41.70626154961951 + ], + [ + 3014.704250343576, + 42.00927347412153, + 42.51429334829163, + 41.504253599951426 + ], + [ + 3018.427474149413, + 42.00927347412153, + 42.51429334829163, + 41.504253599951426 + ], + [ + 3022.1506979552487, + 41.807265524453555, + 42.31228539862366, + 41.30224565028345 + ], + [ + 3025.8739217610855, + 41.807265524453555, + 42.31228539862366, + 41.30224565028345 + ], + [ + 3029.5971455669214, + 41.60525757478547, + 42.11027744895557, + 41.10023770061537 + ], + [ + 3033.3203693727583, + 41.60525757478547, + 42.11027744895557, + 41.10023770061537 + ], + [ + 3037.043593178594, + 41.60525757478547, + 42.11027744895557, + 41.10023770061537 + ], + [ + 3040.766816984431, + 41.403249625117496, + 41.9082694992876, + 40.898229750947394 + ], + [ + 3044.490040790267, + 41.403249625117496, + 41.9082694992876, + 40.898229750947394 + ], + [ + 3048.213264596103, + 41.20124167544941, + 41.70626154961951, + 40.69622180127931 + ], + [ + 3051.9364884019396, + 41.20124167544941, + 41.70626154961951, + 40.69622180127931 + ], + [ + 3055.6597122077756, + 41.20124167544941, + 41.70626154961951, + 40.69622180127931 + ], + [ + 3059.3829360136124, + 40.99923372578132, + 41.504253599951426, + 40.49421385161122 + ], + [ + 3063.1061598194483, + 40.99923372578132, + 41.504253599951426, + 40.49421385161122 + ], + [ + 3066.829383625285, + 40.898229750947394, + 41.30224565028345, + 40.49421385161122 + ], + [ + 3070.552607431121, + 40.79722577611335, + 41.30224565028345, + 40.29220590194325 + ], + [ + 3074.275831236958, + 40.79722577611335, + 41.30224565028345, + 40.29220590194325 + ], + [ + 3077.9990550427938, + 40.595217826445264, + 41.10023770061537, + 40.09019795227516 + ], + [ + 3081.7222788486297, + 40.595217826445264, + 41.10023770061537, + 40.09019795227516 + ], + [ + 3085.4455026544665, + 40.595217826445264, + 41.10023770061537, + 40.09019795227516 + ], + [ + 3089.1687264603024, + 40.39320987677718, + 40.898229750947394, + 39.888190002607075 + ], + [ + 3092.8919502661392, + 40.39320987677718, + 40.898229750947394, + 39.888190002607075 + ], + [ + 3096.615174071975, + 40.29220590194325, + 40.69622180127931, + 39.888190002607075 + ], + [ + 3100.338397877812, + 40.191201927109205, + 40.69622180127931, + 39.6861820529391 + ], + [ + 3104.061621683648, + 40.191201927109205, + 40.69622180127931, + 39.6861820529391 + ], + [ + 3107.7848454894847, + 39.98919397744112, + 40.49421385161122, + 39.484174103271016 + ], + [ + 3111.5080692953206, + 39.98919397744112, + 40.49421385161122, + 39.484174103271016 + ], + [ + 3115.2312931011575, + 39.98919397744112, + 40.49421385161122, + 39.484174103271016 + ], + [ + 3118.9545169069934, + 39.787186027773146, + 40.29220590194325, + 39.28216615360304 + ], + [ + 3122.6777407128293, + 39.787186027773146, + 40.29220590194325, + 39.28216615360304 + ], + [ + 3126.400964518666, + 39.787186027773146, + 40.29220590194325, + 39.28216615360304 + ], + [ + 3130.124188324502, + 39.58517807810506, + 40.09019795227516, + 39.08015820393496 + ], + [ + 3133.847412130339, + 39.58517807810506, + 40.09019795227516, + 39.08015820393496 + ], + [ + 3137.5706359361748, + 39.58517807810506, + 40.09019795227516, + 39.08015820393496 + ], + [ + 3141.2938597420116, + 39.38317012843697, + 39.888190002607075, + 38.87815025426687 + ], + [ + 3145.0170835478475, + 39.38317012843697, + 39.888190002607075, + 38.87815025426687 + ], + [ + 3148.7403073536843, + 39.38317012843697, + 39.888190002607075, + 38.87815025426687 + ], + [ + 3152.4635311595202, + 39.181162178769, + 39.6861820529391, + 38.6761423045989 + ], + [ + 3156.186754965356, + 39.181162178769, + 39.6861820529391, + 38.6761423045989 + ], + [ + 3159.909978771193, + 38.979154229100914, + 39.484174103271016, + 38.47413435493081 + ], + [ + 3163.633202577029, + 38.979154229100914, + 39.484174103271016, + 38.47413435493081 + ], + [ + 3167.3564263828657, + 38.979154229100914, + 39.484174103271016, + 38.47413435493081 + ], + [ + 3171.0796501887016, + 38.77714627943294, + 39.28216615360304, + 38.27212640526284 + ], + [ + 3174.8028739945385, + 38.77714627943294, + 39.28216615360304, + 38.27212640526284 + ], + [ + 3178.5260978003744, + 38.575138329764854, + 39.08015820393496, + 38.07011845559475 + ], + [ + 3182.249321606211, + 38.575138329764854, + 39.08015820393496, + 38.07011845559475 + ], + [ + 3185.972545412047, + 38.575138329764854, + 39.08015820393496, + 38.07011845559475 + ], + [ + 3189.695769217884, + 38.37313038009677, + 38.87815025426687, + 37.868110505926666 + ], + [ + 3193.41899302372, + 38.37313038009677, + 38.87815025426687, + 37.868110505926666 + ], + [ + 3197.1422168295558, + 38.27212640526284, + 38.6761423045989, + 37.868110505926666 + ], + [ + 3200.8654406353926, + 38.171122430428795, + 38.6761423045989, + 37.66610255625869 + ], + [ + 3204.5886644412285, + 38.171122430428795, + 38.6761423045989, + 37.66610255625869 + ], + [ + 3208.3118882470653, + 37.96911448076071, + 38.47413435493081, + 37.464094606590606 + ], + [ + 3212.0351120529012, + 37.96911448076071, + 38.47413435493081, + 37.464094606590606 + ], + [ + 3215.758335858738, + 37.96911448076071, + 38.47413435493081, + 37.464094606590606 + ], + [ + 3219.481559664574, + 37.76710653109262, + 38.27212640526284, + 37.26208665692252 + ], + [ + 3223.204783470411, + 37.76710653109262, + 38.27212640526284, + 37.26208665692252 + ], + [ + 3226.9280072762467, + 37.66610255625869, + 38.07011845559475, + 37.26208665692252 + ], + [ + 3230.6512310820835, + 37.56509858142465, + 38.07011845559475, + 37.06007870725455 + ], + [ + 3234.3744548879195, + 37.56509858142465, + 38.07011845559475, + 37.06007870725455 + ], + [ + 3238.0976786937554, + 37.464094606590606, + 37.868110505926666, + 37.06007870725455 + ], + [ + 3241.820902499592, + 37.36309063175656, + 37.868110505926666, + 36.85807075758646 + ], + [ + 3245.544126305428, + 37.36309063175656, + 37.868110505926666, + 36.85807075758646 + ], + [ + 3249.267350111265, + 37.16108268208859, + 37.66610255625869, + 36.65606280791849 + ], + [ + 3252.990573917101, + 37.16108268208859, + 37.66610255625869, + 36.65606280791849 + ], + [ + 3256.7137977229377, + 37.16108268208859, + 37.66610255625869, + 36.65606280791849 + ], + [ + 3260.4370215287736, + 36.959074732420504, + 37.464094606590606, + 36.4540548582504 + ], + [ + 3264.1602453346104, + 36.959074732420504, + 37.464094606590606, + 36.4540548582504 + ], + [ + 3267.8834691404463, + 36.959074732420504, + 37.464094606590606, + 36.4540548582504 + ], + [ + 3271.6066929462822, + 36.75706678275242, + 37.26208665692252, + 36.252046908582315 + ], + [ + 3275.329916752119, + 36.75706678275242, + 37.26208665692252, + 36.252046908582315 + ], + [ + 3279.053140557955, + 36.75706678275242, + 37.26208665692252, + 36.252046908582315 + ], + [ + 3282.776364363792, + 36.555058833084445, + 37.06007870725455, + 36.05003895891434 + ], + [ + 3286.4995881696277, + 36.555058833084445, + 37.06007870725455, + 36.05003895891434 + ], + [ + 3290.2228119754645, + 36.555058833084445, + 37.06007870725455, + 36.05003895891434 + ], + [ + 3293.9460357813005, + 36.35305088341636, + 36.85807075758646, + 35.848031009246256 + ], + [ + 3297.6692595871373, + 36.35305088341636, + 36.85807075758646, + 35.848031009246256 + ], + [ + 3301.392483392973, + 36.35305088341636, + 36.85807075758646, + 35.848031009246256 + ], + [ + 3305.11570719881, + 36.151042933748386, + 36.65606280791849, + 35.64602305957817 + ], + [ + 3308.838931004646, + 36.151042933748386, + 36.65606280791849, + 35.64602305957817 + ], + [ + 3312.562154810482, + 36.151042933748386, + 36.65606280791849, + 35.64602305957817 + ], + [ + 3316.2853786163187, + 35.9490349840803, + 36.4540548582504, + 35.4440151099102 + ], + [ + 3320.0086024221546, + 35.9490349840803, + 36.4540548582504, + 35.4440151099102 + ], + [ + 3323.7318262279914, + 35.9490349840803, + 36.4540548582504, + 35.4440151099102 + ], + [ + 3327.4550500338273, + 35.848031009246256, + 36.252046908582315, + 35.4440151099102 + ], + [ + 3331.178273839664, + 35.74702703441221, + 36.252046908582315, + 35.24200716024211 + ], + [ + 3334.9014976455, + 35.74702703441221, + 36.252046908582315, + 35.24200716024211 + ], + [ + 3338.624721451337, + 35.64602305957817, + 36.05003895891434, + 35.24200716024211 + ], + [ + 3342.347945257173, + 35.54501908474424, + 36.05003895891434, + 35.03999921057414 + ], + [ + 3346.0711690630087, + 35.54501908474424, + 36.05003895891434, + 35.03999921057414 + ], + [ + 3349.7943928688455, + 35.4440151099102, + 35.848031009246256, + 35.03999921057414 + ], + [ + 3353.5176166746814, + 35.34301113507615, + 35.848031009246256, + 34.83799126090605 + ], + [ + 3357.2408404805183, + 35.34301113507615, + 35.848031009246256, + 34.83799126090605 + ], + [ + 3360.964064286354, + 35.34301113507615, + 35.848031009246256, + 34.83799126090605 + ], + [ + 3364.687288092191, + 35.14100318540807, + 35.64602305957817, + 34.635983311237965 + ], + [ + 3368.410511898027, + 35.14100318540807, + 35.64602305957817, + 34.635983311237965 + ], + [ + 3372.1337357038637, + 35.14100318540807, + 35.64602305957817, + 34.635983311237965 + ], + [ + 3375.8569595096997, + 35.03999921057414, + 35.4440151099102, + 34.635983311237965 + ], + [ + 3379.5801833155365, + 34.938995235740094, + 35.4440151099102, + 34.43397536156999 + ], + [ + 3383.3034071213724, + 34.938995235740094, + 35.4440151099102, + 34.43397536156999 + ], + [ + 3387.0266309272083, + 34.83799126090605, + 35.24200716024211, + 34.43397536156999 + ], + [ + 3390.749854733045, + 34.73698728607201, + 35.24200716024211, + 34.231967411901906 + ], + [ + 3394.473078538881, + 34.73698728607201, + 35.24200716024211, + 34.231967411901906 + ], + [ + 3398.196302344718, + 34.73698728607201, + 35.24200716024211, + 34.231967411901906 + ], + [ + 3401.919526150554, + 34.635983311237965, + 35.03999921057414, + 34.231967411901906 + ], + [ + 3405.6427499563906, + 34.534979336404035, + 35.03999921057414, + 34.02995946223393 + ], + [ + 3409.3659737622265, + 34.534979336404035, + 35.03999921057414, + 34.02995946223393 + ], + [ + 3413.0891975680634, + 34.43397536156999, + 34.83799126090605, + 34.02995946223393 + ], + [ + 3416.8124213738993, + 34.33297138673595, + 34.83799126090605, + 33.827951512565846 + ], + [ + 3420.535645179736, + 34.33297138673595, + 34.83799126090605, + 33.827951512565846 + ], + [ + 3424.258868985572, + 34.33297138673595, + 34.83799126090605, + 33.827951512565846 + ], + [ + 3427.982092791408, + 34.231967411901906, + 34.635983311237965, + 33.827951512565846 + ], + [ + 3431.7053165972447, + 34.13096343706786, + 34.635983311237965, + 33.62594356289776 + ], + [ + 3435.4285404030807, + 34.13096343706786, + 34.635983311237965, + 33.62594356289776 + ], + [ + 3439.1517642089175, + 34.02995946223393, + 34.43397536156999, + 33.62594356289776 + ], + [ + 3442.8749880147534, + 33.92895548739989, + 34.43397536156999, + 33.42393561322979 + ], + [ + 3446.59821182059, + 33.92895548739989, + 34.43397536156999, + 33.42393561322979 + ], + [ + 3450.321435626426, + 33.92895548739989, + 34.43397536156999, + 33.42393561322979 + ], + [ + 3454.044659432263, + 33.827951512565846, + 34.231967411901906, + 33.42393561322979 + ], + [ + 3457.767883238099, + 33.7269475377318, + 34.231967411901906, + 33.2219276635617 + ], + [ + 3461.491107043935, + 33.7269475377318, + 34.231967411901906, + 33.2219276635617 + ], + [ + 3465.2143308497716, + 33.7269475377318, + 34.231967411901906, + 33.2219276635617 + ], + [ + 3468.9375546556075, + 33.62594356289776, + 34.02995946223393, + 33.2219276635617 + ], + [ + 3472.6607784614444, + 33.52493958806383, + 34.02995946223393, + 33.019919713893614 + ], + [ + 3476.3840022672803, + 33.52493958806383, + 34.02995946223393, + 33.019919713893614 + ], + [ + 3480.107226073117, + 33.42393561322979, + 33.827951512565846, + 33.019919713893614 + ], + [ + 3483.830449878953, + 33.42393561322979, + 33.827951512565846, + 33.019919713893614 + ], + [ + 3487.55367368479, + 33.322931638395744, + 33.827951512565846, + 32.81791176422564 + ], + [ + 3491.2768974906257, + 33.322931638395744, + 33.827951512565846, + 32.81791176422564 + ], + [ + 3495.0001212964626, + 33.2219276635617, + 33.62594356289776, + 32.81791176422564 + ], + [ + 3498.7233451022985, + 33.2219276635617, + 33.62594356289776, + 32.81791176422564 + ], + [ + 3502.4465689081344, + 33.12092368872766, + 33.62594356289776, + 32.615903814557555 + ], + [ + 3506.169792713971, + 33.12092368872766, + 33.62594356289776, + 32.615903814557555 + ], + [ + 3509.893016519807, + 33.019919713893614, + 33.42393561322979, + 32.615903814557555 + ], + [ + 3513.616240325644, + 33.019919713893614, + 33.42393561322979, + 32.615903814557555 + ], + [ + 3517.33946413148, + 32.918915739059685, + 33.42393561322979, + 32.41389586488958 + ], + [ + 3521.0626879373167, + 32.918915739059685, + 33.42393561322979, + 32.41389586488958 + ], + [ + 3524.7859117431526, + 32.81791176422564, + 33.2219276635617, + 32.41389586488958 + ], + [ + 3528.5091355489894, + 32.81791176422564, + 33.2219276635617, + 32.41389586488958 + ], + [ + 3532.2323593548253, + 32.7169077893916, + 33.2219276635617, + 32.211887915221496 + ], + [ + 3535.955583160662, + 32.7169077893916, + 33.2219276635617, + 32.211887915221496 + ], + [ + 3539.678806966498, + 32.615903814557555, + 33.019919713893614, + 32.211887915221496 + ], + [ + 3543.402030772334, + 32.615903814557555, + 33.019919713893614, + 32.211887915221496 + ], + [ + 3547.125254578171, + 32.51489983972351, + 33.019919713893614, + 32.00987996555341 + ], + [ + 3550.8484783840067, + 32.51489983972351, + 33.019919713893614, + 32.00987996555341 + ], + [ + 3554.5717021898436, + 32.41389586488958, + 32.81791176422564, + 32.00987996555341 + ], + [ + 3558.2949259956795, + 32.41389586488958, + 32.81791176422564, + 32.00987996555341 + ], + [ + 3562.0181498015163, + 32.31289189005554, + 32.81791176422564, + 31.807872015885437 + ], + [ + 3565.741373607352, + 32.31289189005554, + 32.81791176422564, + 31.807872015885437 + ], + [ + 3569.464597413189, + 32.31289189005554, + 32.81791176422564, + 31.807872015885437 + ], + [ + 3573.187821219025, + 32.211887915221496, + 32.615903814557555, + 31.807872015885437 + ], + [ + 3576.911045024861, + 32.11088394038745, + 32.615903814557555, + 31.60586406621735 + ], + [ + 3580.6342688306977, + 32.11088394038745, + 32.615903814557555, + 31.60586406621735 + ], + [ + 3584.3574926365336, + 32.11088394038745, + 32.615903814557555, + 31.60586406621735 + ], + [ + 3588.0807164423704, + 32.00987996555341, + 32.41389586488958, + 31.60586406621735 + ], + [ + 3591.8039402482063, + 32.00987996555341, + 32.41389586488958, + 31.60586406621735 + ], + [ + 3595.527164054043, + 31.90887599071948, + 32.41389586488958, + 31.403856116549377 + ], + [ + 3599.250387859879, + 31.90887599071948, + 32.41389586488958, + 31.403856116549377 + ], + [ + 3602.973611665716, + 31.807872015885437, + 32.211887915221496, + 31.403856116549377 + ], + [ + 3606.696835471552, + 31.807872015885437, + 32.211887915221496, + 31.403856116549377 + ], + [ + 3610.4200592773886, + 31.706868041051393, + 32.211887915221496, + 31.20184816688129 + ], + [ + 3614.1432830832246, + 31.706868041051393, + 32.211887915221496, + 31.20184816688129 + ], + [ + 3617.8665068890605, + 31.706868041051393, + 32.211887915221496, + 31.20184816688129 + ], + [ + 3621.5897306948973, + 31.60586406621735, + 32.00987996555341, + 31.20184816688129 + ], + [ + 3625.312954500733, + 31.60586406621735, + 32.00987996555341, + 31.20184816688129 + ], + [ + 3629.03617830657, + 31.504860091383307, + 32.00987996555341, + 30.999840217213205 + ], + [ + 3632.759402112406, + 31.504860091383307, + 32.00987996555341, + 30.999840217213205 + ], + [ + 3636.482625918243, + 31.403856116549377, + 31.807872015885437, + 30.999840217213205 + ], + [ + 3640.2058497240787, + 31.403856116549377, + 31.807872015885437, + 30.999840217213205 + ], + [ + 3643.9290735299155, + 31.302852141715334, + 31.807872015885437, + 30.797832267545232 + ], + [ + 3647.6522973357514, + 31.302852141715334, + 31.807872015885437, + 30.797832267545232 + ], + [ + 3651.3755211415873, + 31.302852141715334, + 31.807872015885437, + 30.797832267545232 + ], + [ + 3655.098744947424, + 31.20184816688129, + 31.60586406621735, + 30.797832267545232 + ], + [ + 3658.82196875326, + 31.20184816688129, + 31.60586406621735, + 30.797832267545232 + ], + [ + 3662.545192559097, + 31.100844192047248, + 31.60586406621735, + 30.595824317877145 + ], + [ + 3666.268416364933, + 31.100844192047248, + 31.60586406621735, + 30.595824317877145 + ], + [ + 3669.9916401707696, + 31.100844192047248, + 31.60586406621735, + 30.595824317877145 + ], + [ + 3673.7148639766056, + 30.999840217213205, + 31.403856116549377, + 30.595824317877145 + ], + [ + 3677.4380877824424, + 30.999840217213205, + 31.403856116549377, + 30.595824317877145 + ], + [ + 3681.1613115882783, + 30.89883624237916, + 31.403856116549377, + 30.39381636820906 + ], + [ + 3684.884535394115, + 30.89883624237916, + 31.403856116549377, + 30.39381636820906 + ], + [ + 3688.607759199951, + 30.89883624237916, + 31.403856116549377, + 30.39381636820906 + ], + [ + 3692.330983005787, + 30.797832267545232, + 31.20184816688129, + 30.39381636820906 + ], + [ + 3696.0542068116238, + 30.797832267545232, + 31.20184816688129, + 30.39381636820906 + ], + [ + 3699.7774306174597, + 30.69682829271119, + 31.20184816688129, + 30.191808418541086 + ], + [ + 3703.5006544232965, + 30.69682829271119, + 31.20184816688129, + 30.191808418541086 + ], + [ + 3707.2238782291324, + 30.69682829271119, + 31.20184816688129, + 30.191808418541086 + ], + [ + 3710.9471020349692, + 30.595824317877145, + 30.999840217213205, + 30.191808418541086 + ], + [ + 3714.670325840805, + 30.595824317877145, + 30.999840217213205, + 30.191808418541086 + ], + [ + 3718.393549646642, + 30.494820343043102, + 30.999840217213205, + 29.989800468873 + ], + [ + 3722.116773452478, + 30.494820343043102, + 30.999840217213205, + 29.989800468873 + ], + [ + 3725.8399972583147, + 30.494820343043102, + 30.999840217213205, + 29.989800468873 + ], + [ + 3729.5632210641506, + 30.39381636820906, + 30.797832267545232, + 29.989800468873 + ], + [ + 3733.2864448699866, + 30.39381636820906, + 30.797832267545232, + 29.989800468873 + ], + [ + 3737.0096686758234, + 30.29281239337513, + 30.797832267545232, + 29.787792519205027 + ], + [ + 3740.7328924816593, + 30.29281239337513, + 30.797832267545232, + 29.787792519205027 + ], + [ + 3744.456116287496, + 30.29281239337513, + 30.797832267545232, + 29.787792519205027 + ], + [ + 3748.179340093332, + 30.191808418541086, + 30.595824317877145, + 29.787792519205027 + ], + [ + 3751.902563899169, + 30.191808418541086, + 30.595824317877145, + 29.787792519205027 + ], + [ + 3755.6257877050048, + 30.191808418541086, + 30.595824317877145, + 29.787792519205027 + ], + [ + 3759.3490115108416, + 30.090804443707043, + 30.595824317877145, + 29.58578456953694 + ], + [ + 3763.0722353166775, + 30.090804443707043, + 30.595824317877145, + 29.58578456953694 + ], + [ + 3766.7954591225134, + 29.989800468873, + 30.39381636820906, + 29.58578456953694 + ], + [ + 3770.5186829283502, + 29.989800468873, + 30.39381636820906, + 29.58578456953694 + ], + [ + 3774.241906734186, + 29.989800468873, + 30.39381636820906, + 29.58578456953694 + ], + [ + 3777.965130540023, + 29.888796494038957, + 30.39381636820906, + 29.383776619868854 + ], + [ + 3781.688354345859, + 29.888796494038957, + 30.39381636820906, + 29.383776619868854 + ], + [ + 3785.4115781516957, + 29.888796494038957, + 30.39381636820906, + 29.383776619868854 + ], + [ + 3789.1348019575316, + 29.787792519205027, + 30.191808418541086, + 29.383776619868854 + ], + [ + 3792.8580257633685, + 29.787792519205027, + 30.191808418541086, + 29.383776619868854 + ], + [ + 3796.5812495692044, + 29.787792519205027, + 30.191808418541086, + 29.383776619868854 + ], + [ + 3800.304473375041, + 29.686788544370984, + 30.191808418541086, + 29.18176867020088 + ], + [ + 3804.027697180877, + 29.686788544370984, + 30.191808418541086, + 29.18176867020088 + ], + [ + 3807.750920986713, + 29.686788544370984, + 30.191808418541086, + 29.18176867020088 + ], + [ + 3811.47414479255, + 29.58578456953694, + 29.989800468873, + 29.18176867020088 + ], + [ + 3815.1973685983858, + 29.58578456953694, + 29.989800468873, + 29.18176867020088 + ], + [ + 3818.9205924042226, + 29.58578456953694, + 29.989800468873, + 29.18176867020088 + ], + [ + 3822.6438162100585, + 29.484780594702897, + 29.989800468873, + 28.979760720532795 + ], + [ + 3826.3670400158953, + 29.484780594702897, + 29.989800468873, + 28.979760720532795 + ], + [ + 3830.0902638217312, + 29.484780594702897, + 29.989800468873, + 28.979760720532795 + ], + [ + 3833.813487627568, + 29.383776619868854, + 29.787792519205027, + 28.979760720532795 + ], + [ + 3837.536711433404, + 29.383776619868854, + 29.787792519205027, + 28.979760720532795 + ], + [ + 3841.259935239241, + 29.383776619868854, + 29.787792519205027, + 28.979760720532795 + ], + [ + 3844.9831590450767, + 29.282772645034925, + 29.787792519205027, + 28.777752770864822 + ], + [ + 3848.7063828509126, + 29.282772645034925, + 29.787792519205027, + 28.777752770864822 + ], + [ + 3852.4296066567495, + 29.282772645034925, + 29.787792519205027, + 28.777752770864822 + ], + [ + 3856.1528304625854, + 29.18176867020088, + 29.58578456953694, + 28.777752770864822 + ], + [ + 3859.876054268422, + 29.18176867020088, + 29.58578456953694, + 28.777752770864822 + ], + [ + 3863.599278074258, + 29.18176867020088, + 29.58578456953694, + 28.777752770864822 + ], + [ + 3867.322501880095, + 29.080764695366838, + 29.58578456953694, + 28.575744821196736 + ], + [ + 3871.045725685931, + 29.080764695366838, + 29.58578456953694, + 28.575744821196736 + ], + [ + 3874.7689494917677, + 29.080764695366838, + 29.58578456953694, + 28.575744821196736 + ], + [ + 3878.4921732976036, + 28.979760720532795, + 29.383776619868854, + 28.575744821196736 + ], + [ + 3882.2153971034395, + 28.979760720532795, + 29.383776619868854, + 28.575744821196736 + ], + [ + 3885.9386209092763, + 28.979760720532795, + 29.383776619868854, + 28.575744821196736 + ], + [ + 3889.6618447151122, + 28.87875674569875, + 29.383776619868854, + 28.37373687152865 + ], + [ + 3893.385068520949, + 28.87875674569875, + 29.383776619868854, + 28.37373687152865 + ], + [ + 3897.108292326785, + 28.87875674569875, + 29.383776619868854, + 28.37373687152865 + ], + [ + 3900.831516132622, + 28.777752770864822, + 29.18176867020088, + 28.37373687152865 + ], + [ + 3904.5547399384577, + 28.777752770864822, + 29.18176867020088, + 28.37373687152865 + ], + [ + 3908.2779637442945, + 28.777752770864822, + 29.18176867020088, + 28.37373687152865 + ], + [ + 3912.0011875501305, + 28.777752770864822, + 29.18176867020088, + 28.37373687152865 + ], + [ + 3915.7244113559673, + 28.67674879603078, + 29.18176867020088, + 28.171728921860677 + ], + [ + 3919.447635161803, + 28.67674879603078, + 29.18176867020088, + 28.171728921860677 + ], + [ + 3923.170858967639, + 28.67674879603078, + 29.18176867020088, + 28.171728921860677 + ], + [ + 3926.894082773476, + 28.575744821196736, + 28.979760720532795, + 28.171728921860677 + ], + [ + 3930.617306579312, + 28.575744821196736, + 28.979760720532795, + 28.171728921860677 + ], + [ + 3934.3405303851487, + 28.575744821196736, + 28.979760720532795, + 28.171728921860677 + ], + [ + 3938.0637541909846, + 28.575744821196736, + 28.979760720532795, + 28.171728921860677 + ], + [ + 3941.7869779968214, + 28.474740846362693, + 28.979760720532795, + 27.96972097219259 + ], + [ + 3945.5102018026573, + 28.474740846362693, + 28.979760720532795, + 27.96972097219259 + ], + [ + 3949.233425608494, + 28.474740846362693, + 28.979760720532795, + 27.96972097219259 + ], + [ + 3952.95664941433, + 28.37373687152865, + 28.777752770864822, + 27.96972097219259 + ], + [ + 3956.679873220166, + 28.37373687152865, + 28.777752770864822, + 27.96972097219259 + ], + [ + 3960.403097026003, + 28.37373687152865, + 28.777752770864822, + 27.96972097219259 + ], + [ + 3964.1263208318387, + 28.37373687152865, + 28.777752770864822, + 27.96972097219259 + ], + [ + 3967.8495446376755, + 28.272732896694606, + 28.777752770864822, + 27.767713022524504 + ], + [ + 3971.5727684435114, + 28.272732896694606, + 28.777752770864822, + 27.767713022524504 + ], + [ + 3975.2959922493483, + 28.272732896694606, + 28.777752770864822, + 27.767713022524504 + ], + [ + 3979.019216055184, + 28.171728921860677, + 28.575744821196736, + 27.767713022524504 + ], + [ + 3982.742439861021, + 28.171728921860677, + 28.575744821196736, + 27.767713022524504 + ], + [ + 3986.465663666857, + 28.171728921860677, + 28.575744821196736, + 27.767713022524504 + ], + [ + 3990.1888874726938, + 28.171728921860677, + 28.575744821196736, + 27.767713022524504 + ], + [ + 3993.9121112785297, + 28.070724947026633, + 28.575744821196736, + 27.56570507285653 + ], + [ + 3997.6353350843656, + 28.070724947026633, + 28.575744821196736, + 27.56570507285653 + ], + [ + 4001.3585588902024, + 28.070724947026633, + 28.575744821196736, + 27.56570507285653 + ], + [ + 4005.0817826960383, + 28.070724947026633, + 28.575744821196736, + 27.56570507285653 + ], + [ + 4008.805006501875, + 27.96972097219259, + 28.37373687152865, + 27.56570507285653 + ], + [ + 4012.528230307711, + 27.96972097219259, + 28.37373687152865, + 27.56570507285653 + ], + [ + 4016.251454113548, + 27.96972097219259, + 28.37373687152865, + 27.56570507285653 + ], + [ + 4019.974677919384, + 27.96972097219259, + 28.37373687152865, + 27.56570507285653 + ], + [ + 4023.6979017252206, + 27.868716997358547, + 28.37373687152865, + 27.363697123188444 + ], + [ + 4027.4211255310565, + 27.868716997358547, + 28.37373687152865, + 27.363697123188444 + ], + [ + 4031.1443493368934, + 27.868716997358547, + 28.37373687152865, + 27.363697123188444 + ], + [ + 4034.8675731427293, + 27.868716997358547, + 28.37373687152865, + 27.363697123188444 + ], + [ + 4038.590796948565, + 27.767713022524504, + 28.171728921860677, + 27.363697123188444 + ], + [ + 4042.314020754402, + 27.767713022524504, + 28.171728921860677, + 27.363697123188444 + ], + [ + 4046.037244560238, + 27.767713022524504, + 28.171728921860677, + 27.363697123188444 + ], + [ + 4049.7604683660747, + 27.767713022524504, + 28.171728921860677, + 27.363697123188444 + ], + [ + 4053.4836921719107, + 27.767713022524504, + 28.171728921860677, + 27.363697123188444 + ], + [ + 4057.2069159777475, + 27.666709047690574, + 28.171728921860677, + 27.16168917352047 + ], + [ + 4060.9301397835834, + 27.666709047690574, + 28.171728921860677, + 27.16168917352047 + ], + [ + 4064.65336358942, + 27.666709047690574, + 28.171728921860677, + 27.16168917352047 + ], + [ + 4068.376587395256, + 27.56570507285653, + 27.96972097219259, + 27.16168917352047 + ], + [ + 4072.099811201092, + 27.56570507285653, + 27.96972097219259, + 27.16168917352047 + ], + [ + 4075.823035006929, + 27.56570507285653, + 27.96972097219259, + 27.16168917352047 + ], + [ + 4079.546258812765, + 27.56570507285653, + 27.96972097219259, + 27.16168917352047 + ], + [ + 4083.2694826186016, + 27.56570507285653, + 27.96972097219259, + 27.16168917352047 + ], + [ + 4086.9927064244375, + 27.464701098022488, + 27.96972097219259, + 26.959681223852385 + ], + [ + 4090.7159302302744, + 27.464701098022488, + 27.96972097219259, + 26.959681223852385 + ], + [ + 4094.4391540361103, + 27.464701098022488, + 27.96972097219259, + 26.959681223852385 + ], + [ + 4098.162377841947, + 27.464701098022488, + 27.96972097219259, + 26.959681223852385 + ], + [ + 4101.885601647783, + 27.363697123188444, + 27.767713022524504, + 26.959681223852385 + ], + [ + 4105.60882545362, + 27.363697123188444, + 27.767713022524504, + 26.959681223852385 + ], + [ + 4109.332049259456, + 27.363697123188444, + 27.767713022524504, + 26.959681223852385 + ], + [ + 4113.055273065292, + 27.363697123188444, + 27.767713022524504, + 26.959681223852385 + ], + [ + 4116.7784968711285, + 27.363697123188444, + 27.767713022524504, + 26.959681223852385 + ], + [ + 4120.501720676964, + 27.363697123188444, + 27.767713022524504, + 26.959681223852385 + ], + [ + 4124.224944482801, + 27.2626931483544, + 27.767713022524504, + 26.7576732741843 + ], + [ + 4127.948168288637, + 27.2626931483544, + 27.767713022524504, + 26.7576732741843 + ], + [ + 4131.671392094474, + 27.2626931483544, + 27.767713022524504, + 26.7576732741843 + ], + [ + 4135.39461590031, + 27.2626931483544, + 27.767713022524504, + 26.7576732741843 + ], + [ + 4139.117839706147, + 27.16168917352047, + 27.56570507285653, + 26.7576732741843 + ], + [ + 4142.841063511983, + 27.16168917352047, + 27.56570507285653, + 26.7576732741843 + ], + [ + 4146.5642873178185, + 27.16168917352047, + 27.56570507285653, + 26.7576732741843 + ], + [ + 4150.287511123655, + 27.16168917352047, + 27.56570507285653, + 26.7576732741843 + ], + [ + 4154.010734929491, + 27.16168917352047, + 27.56570507285653, + 26.7576732741843 + ], + [ + 4157.733958735328, + 27.16168917352047, + 27.56570507285653, + 26.7576732741843 + ], + [ + 4161.457182541164, + 27.06068519868643, + 27.56570507285653, + 26.555665324516326 + ], + [ + 4165.180406347001, + 27.06068519868643, + 27.56570507285653, + 26.555665324516326 + ], + [ + 4168.903630152837, + 27.06068519868643, + 27.56570507285653, + 26.555665324516326 + ], + [ + 4172.626853958674, + 27.06068519868643, + 27.56570507285653, + 26.555665324516326 + ], + [ + 4176.3500777645095, + 26.959681223852385, + 27.363697123188444, + 26.555665324516326 + ], + [ + 4180.073301570346, + 26.959681223852385, + 27.363697123188444, + 26.555665324516326 + ], + [ + 4183.796525376182, + 26.959681223852385, + 27.363697123188444, + 26.555665324516326 + ], + [ + 4187.519749182018, + 26.959681223852385, + 27.363697123188444, + 26.555665324516326 + ], + [ + 4191.242972987855, + 26.959681223852385, + 27.363697123188444, + 26.555665324516326 + ], + [ + 4194.966196793691, + 26.959681223852385, + 27.363697123188444, + 26.555665324516326 + ], + [ + 4198.689420599528, + 26.959681223852385, + 27.363697123188444, + 26.555665324516326 + ], + [ + 4202.412644405364, + 26.858677249018342, + 27.363697123188444, + 26.35365737484824 + ], + [ + 4206.1358682112, + 26.858677249018342, + 27.363697123188444, + 26.35365737484824 + ], + [ + 4209.859092017036, + 26.858677249018342, + 27.363697123188444, + 26.35365737484824 + ], + [ + 4213.582315822873, + 26.858677249018342, + 27.363697123188444, + 26.35365737484824 + ], + [ + 4217.305539628709, + 26.7576732741843, + 27.16168917352047, + 26.35365737484824 + ], + [ + 4221.028763434546, + 26.7576732741843, + 27.16168917352047, + 26.35365737484824 + ], + [ + 4224.751987240382, + 26.7576732741843, + 27.16168917352047, + 26.35365737484824 + ], + [ + 4228.475211046218, + 26.7576732741843, + 27.16168917352047, + 26.35365737484824 + ], + [ + 4232.198434852055, + 26.7576732741843, + 27.16168917352047, + 26.35365737484824 + ], + [ + 4235.9216586578905, + 26.7576732741843, + 27.16168917352047, + 26.35365737484824 + ], + [ + 4239.644882463727, + 26.7576732741843, + 27.16168917352047, + 26.35365737484824 + ], + [ + 4243.368106269563, + 26.65666929935037, + 27.16168917352047, + 26.151649425180153 + ], + [ + 4247.0913300754, + 26.65666929935037, + 27.16168917352047, + 26.151649425180153 + ], + [ + 4250.814553881236, + 26.65666929935037, + 27.16168917352047, + 26.151649425180153 + ], + [ + 4254.537777687073, + 26.65666929935037, + 27.16168917352047, + 26.151649425180153 + ], + [ + 4258.261001492909, + 26.65666929935037, + 27.16168917352047, + 26.151649425180153 + ], + [ + 4261.984225298745, + 26.65666929935037, + 27.16168917352047, + 26.151649425180153 + ], + [ + 4265.707449104581, + 26.555665324516326, + 26.959681223852385, + 26.151649425180153 + ], + [ + 4269.430672910417, + 26.555665324516326, + 26.959681223852385, + 26.151649425180153 + ], + [ + 4273.153896716254, + 26.555665324516326, + 26.959681223852385, + 26.151649425180153 + ], + [ + 4276.87712052209, + 26.555665324516326, + 26.959681223852385, + 26.151649425180153 + ], + [ + 4280.600344327927, + 26.555665324516326, + 26.959681223852385, + 26.151649425180153 + ], + [ + 4284.323568133763, + 26.555665324516326, + 26.959681223852385, + 26.151649425180153 + ], + [ + 4288.0467919396, + 26.555665324516326, + 26.959681223852385, + 26.151649425180153 + ], + [ + 4291.770015745436, + 26.555665324516326, + 26.959681223852385, + 26.151649425180153 + ], + [ + 4295.493239551272, + 26.454661349682283, + 26.959681223852385, + 25.94964147551218 + ], + [ + 4299.216463357108, + 26.454661349682283, + 26.959681223852385, + 25.94964147551218 + ], + [ + 4302.939687162944, + 26.454661349682283, + 26.959681223852385, + 25.94964147551218 + ], + [ + 4306.662910968781, + 26.454661349682283, + 26.959681223852385, + 25.94964147551218 + ], + [ + 4310.386134774617, + 26.454661349682283, + 26.959681223852385, + 25.94964147551218 + ], + [ + 4314.109358580454, + 26.35365737484824, + 26.7576732741843, + 25.94964147551218 + ], + [ + 4317.83258238629, + 26.35365737484824, + 26.7576732741843, + 25.94964147551218 + ], + [ + 4321.5558061921265, + 26.35365737484824, + 26.7576732741843, + 25.94964147551218 + ], + [ + 4325.279029997962, + 26.35365737484824, + 26.7576732741843, + 25.94964147551218 + ], + [ + 4329.002253803799, + 26.35365737484824, + 26.7576732741843, + 25.94964147551218 + ], + [ + 4332.725477609635, + 26.35365737484824, + 26.7576732741843, + 25.94964147551218 + ], + [ + 4336.448701415472, + 26.35365737484824, + 26.7576732741843, + 25.94964147551218 + ], + [ + 4340.171925221308, + 26.35365737484824, + 26.7576732741843, + 25.94964147551218 + ], + [ + 4343.895149027144, + 26.35365737484824, + 26.7576732741843, + 25.94964147551218 + ], + [ + 4347.618372832981, + 26.35365737484824, + 26.7576732741843, + 25.94964147551218 + ], + [ + 4351.341596638817, + 26.252653400014196, + 26.7576732741843, + 25.747633525844094 + ], + [ + 4355.064820444653, + 26.252653400014196, + 26.7576732741843, + 25.747633525844094 + ], + [ + 4358.788044250489, + 26.252653400014196, + 26.7576732741843, + 25.747633525844094 + ], + [ + 4362.511268056326, + 26.252653400014196, + 26.7576732741843, + 25.747633525844094 + ], + [ + 4366.234491862162, + 26.252653400014196, + 26.7576732741843, + 25.747633525844094 + ], + [ + 4369.957715667999, + 26.252653400014196, + 26.7576732741843, + 25.747633525844094 + ], + [ + 4373.680939473835, + 26.252653400014196, + 26.7576732741843, + 25.747633525844094 + ], + [ + 4377.404163279671, + 26.151649425180153, + 26.555665324516326, + 25.747633525844094 + ], + [ + 4381.1273870855075, + 26.151649425180153, + 26.555665324516326, + 25.747633525844094 + ], + [ + 4384.850610891343, + 26.151649425180153, + 26.555665324516326, + 25.747633525844094 + ], + [ + 4388.57383469718, + 26.151649425180153, + 26.555665324516326, + 25.747633525844094 + ], + [ + 4392.297058503016, + 26.151649425180153, + 26.555665324516326, + 25.747633525844094 + ], + [ + 4396.020282308853, + 26.151649425180153, + 26.555665324516326, + 25.747633525844094 + ], + [ + 4399.743506114689, + 26.151649425180153, + 26.555665324516326, + 25.747633525844094 + ], + [ + 4403.466729920526, + 26.151649425180153, + 26.555665324516326, + 25.747633525844094 + ], + [ + 4407.189953726362, + 26.151649425180153, + 26.555665324516326, + 25.747633525844094 + ], + [ + 4410.9131775321985, + 26.151649425180153, + 26.555665324516326, + 25.747633525844094 + ], + [ + 4414.636401338034, + 26.151649425180153, + 26.555665324516326, + 25.747633525844094 + ], + [ + 4418.35962514387, + 26.151649425180153, + 26.555665324516326, + 25.747633525844094 + ], + [ + 4422.082848949707, + 26.151649425180153, + 26.555665324516326, + 25.747633525844094 + ], + [ + 4425.806072755543, + 26.050645450346224, + 26.555665324516326, + 25.54562557617612 + ], + [ + 4429.52929656138, + 26.050645450346224, + 26.555665324516326, + 25.54562557617612 + ], + [ + 4433.252520367216, + 26.050645450346224, + 26.555665324516326, + 25.54562557617612 + ], + [ + 4436.975744173053, + 26.050645450346224, + 26.555665324516326, + 25.54562557617612 + ], + [ + 4440.6989679788885, + 26.050645450346224, + 26.555665324516326, + 25.54562557617612 + ], + [ + 4444.422191784725, + 26.050645450346224, + 26.555665324516326, + 25.54562557617612 + ], + [ + 4448.145415590561, + 26.050645450346224, + 26.555665324516326, + 25.54562557617612 + ], + [ + 4451.868639396397, + 26.050645450346224, + 26.555665324516326, + 25.54562557617612 + ], + [ + 4455.591863202234, + 25.94964147551218, + 26.35365737484824, + 25.54562557617612 + ], + [ + 4459.31508700807, + 25.94964147551218, + 26.35365737484824, + 25.54562557617612 + ], + [ + 4463.038310813907, + 25.94964147551218, + 26.35365737484824, + 25.54562557617612 + ], + [ + 4466.761534619743, + 25.94964147551218, + 26.35365737484824, + 25.54562557617612 + ], + [ + 4470.4847584255795, + 25.94964147551218, + 26.35365737484824, + 25.54562557617612 + ], + [ + 4474.207982231415, + 25.94964147551218, + 26.35365737484824, + 25.54562557617612 + ], + [ + 4477.931206037252, + 25.94964147551218, + 26.35365737484824, + 25.54562557617612 + ], + [ + 4481.654429843088, + 25.94964147551218, + 26.35365737484824, + 25.54562557617612 + ], + [ + 4485.377653648925, + 25.94964147551218, + 26.35365737484824, + 25.54562557617612 + ], + [ + 4489.100877454761, + 25.94964147551218, + 26.35365737484824, + 25.54562557617612 + ], + [ + 4492.824101260597, + 25.94964147551218, + 26.35365737484824, + 25.54562557617612 + ], + [ + 4496.547325066434, + 25.94964147551218, + 26.35365737484824, + 25.54562557617612 + ], + [ + 4500.2705488722695, + 25.94964147551218, + 26.35365737484824, + 25.54562557617612 + ], + [ + 4503.993772678106, + 25.94964147551218, + 26.35365737484824, + 25.54562557617612 + ], + [ + 4507.716996483942, + 25.94964147551218, + 26.35365737484824, + 25.54562557617612 + ], + [ + 4511.440220289779, + 25.94964147551218, + 26.35365737484824, + 25.54562557617612 + ], + [ + 4515.163444095615, + 25.94964147551218, + 26.35365737484824, + 25.54562557617612 + ], + [ + 4518.886667901452, + 25.94964147551218, + 26.35365737484824, + 25.54562557617612 + ], + [ + 4522.609891707288, + 25.94964147551218, + 26.35365737484824, + 25.54562557617612 + ], + [ + 4526.3331155131245, + 25.94964147551218, + 26.35365737484824, + 25.54562557617612 + ], + [ + 4530.05633931896, + 25.848637500678137, + 26.35365737484824, + 25.343617626508035 + ], + [ + 4533.779563124796, + 25.848637500678137, + 26.35365737484824, + 25.343617626508035 + ], + [ + 4537.502786930633, + 25.848637500678137, + 26.35365737484824, + 25.343617626508035 + ], + [ + 4541.226010736469, + 25.848637500678137, + 26.35365737484824, + 25.343617626508035 + ], + [ + 4544.949234542306, + 25.848637500678137, + 26.35365737484824, + 25.343617626508035 + ], + [ + 4548.672458348142, + 25.848637500678137, + 26.35365737484824, + 25.343617626508035 + ], + [ + 4552.395682153979, + 25.848637500678137, + 26.35365737484824, + 25.343617626508035 + ], + [ + 4556.118905959815, + 25.848637500678137, + 26.35365737484824, + 25.343617626508035 + ], + [ + 4559.842129765651, + 25.848637500678137, + 26.35365737484824, + 25.343617626508035 + ], + [ + 4563.565353571487, + 25.848637500678137, + 26.35365737484824, + 25.343617626508035 + ], + [ + 4567.288577377323, + 25.848637500678137, + 26.35365737484824, + 25.343617626508035 + ], + [ + 4571.01180118316, + 25.848637500678137, + 26.35365737484824, + 25.343617626508035 + ], + [ + 4574.735024988996, + 25.848637500678137, + 26.35365737484824, + 25.343617626508035 + ], + [ + 4578.458248794833, + 25.848637500678137, + 26.35365737484824, + 25.343617626508035 + ], + [ + 4582.181472600669, + 25.848637500678137, + 26.35365737484824, + 25.343617626508035 + ], + [ + 4585.9046964065055, + 25.848637500678137, + 26.35365737484824, + 25.343617626508035 + ], + [ + 4589.627920212341, + 25.747633525844094, + 26.151649425180153, + 25.343617626508035 + ], + [ + 4593.351144018178, + 25.747633525844094, + 26.151649425180153, + 25.343617626508035 + ], + [ + 4597.074367824014, + 25.747633525844094, + 26.151649425180153, + 25.343617626508035 + ], + [ + 4600.797591629851, + 25.747633525844094, + 26.151649425180153, + 25.343617626508035 + ], + [ + 4604.520815435687, + 25.747633525844094, + 26.151649425180153, + 25.343617626508035 + ], + [ + 4608.244039241523, + 25.747633525844094, + 26.151649425180153, + 25.343617626508035 + ], + [ + 4611.96726304736, + 25.747633525844094, + 26.151649425180153, + 25.343617626508035 + ], + [ + 4615.690486853196, + 25.747633525844094, + 26.151649425180153, + 25.343617626508035 + ], + [ + 4619.413710659032, + 25.747633525844094, + 26.151649425180153, + 25.343617626508035 + ], + [ + 4623.136934464868, + 25.747633525844094, + 26.151649425180153, + 25.343617626508035 + ], + [ + 4626.860158270705, + 25.747633525844094, + 26.151649425180153, + 25.343617626508035 + ], + [ + 4630.583382076541, + 25.747633525844094, + 26.151649425180153, + 25.343617626508035 + ], + [ + 4634.306605882378, + 25.747633525844094, + 26.151649425180153, + 25.343617626508035 + ], + [ + 4638.029829688214, + 25.747633525844094, + 26.151649425180153, + 25.343617626508035 + ], + [ + 4641.753053494051, + 25.747633525844094, + 26.151649425180153, + 25.343617626508035 + ], + [ + 4645.4762772998865, + 25.747633525844094, + 26.151649425180153, + 25.343617626508035 + ], + [ + 4649.199501105722, + 25.747633525844094, + 26.151649425180153, + 25.343617626508035 + ], + [ + 4652.922724911559, + 25.747633525844094, + 26.151649425180153, + 25.343617626508035 + ], + [ + 4656.645948717395, + 25.747633525844094, + 26.151649425180153, + 25.343617626508035 + ], + [ + 4660.369172523232, + 25.747633525844094, + 26.151649425180153, + 25.343617626508035 + ], + [ + 4664.092396329068, + 25.747633525844094, + 26.151649425180153, + 25.343617626508035 + ], + [ + 4667.815620134905, + 25.747633525844094, + 26.151649425180153, + 25.343617626508035 + ], + [ + 4671.538843940741, + 25.747633525844094, + 26.151649425180153, + 25.343617626508035 + ], + [ + 4675.2620677465775, + 25.747633525844094, + 26.151649425180153, + 25.343617626508035 + ] + ] + }, + "samples": { + "Tj": 1168, + "Tc": 1247, + "Tr": 1175 + } + }, + "curve4_1L_glycerol_Tr_mode_emergency_A": { + "page_png": "outputs/expansion_batch04/t1_thermal/mt_rc1mxhfcal/source_cache/img/rc1e_curves_300dpi-52.png", + "page_png_sha256": "9bff26b19a060483d13138d52543bb1a618916724a05d8604c8f365f07b8db08", + "calibration": { + "y_ticks_px": [ + 1149.5, + 1248.5, + 1347.5, + 1446.5, + 1545.5, + 1644.5, + 1743.5, + 1842.0, + 1941.5, + 2040.5, + 2139.5, + 2238.5 + ], + "x_ticks_px": [ + 703.5, + 1023.0, + 1346.5, + 1668.5, + 1989.5 + ], + "T_per_px": -0.2020308726067203, + "s_per_px": 3.7295922911326884, + "T_fit_residual_K": 0.09101290117996541, + "t_fit_residual_s": 5.404228494085601 + }, + "columns": [ + "t_s", + "T_median_C", + "T_min_C", + "T_max_C" + ], + "series": { + "Tj": [ + [ + 53.34053041931156, + 26.148769915185653, + 26.55283166039908, + 25.744708169972228 + ], + [ + 57.07012271044414, + 26.148769915185653, + 26.55283166039908, + 25.744708169972228 + ], + [ + 60.79971500157717, + 26.148769915185653, + 26.55283166039908, + 25.744708169972228 + ], + [ + 64.52930729270975, + 26.148769915185653, + 26.55283166039908, + 25.744708169972228 + ], + [ + 68.25889958384232, + 26.148769915185653, + 26.55283166039908, + 25.744708169972228 + ], + [ + 71.9884918749749, + 26.148769915185653, + 26.55283166039908, + 25.744708169972228 + ], + [ + 75.71808416610793, + 26.148769915185653, + 26.55283166039908, + 25.744708169972228 + ], + [ + 79.4476764572405, + 26.148769915185653, + 26.55283166039908, + 25.744708169972228 + ], + [ + 83.17726874837308, + 26.148769915185653, + 26.55283166039908, + 25.744708169972228 + ], + [ + 86.90686103950566, + 26.148769915185653, + 26.55283166039908, + 25.744708169972228 + ], + [ + 90.63645333063869, + 26.148769915185653, + 26.55283166039908, + 25.744708169972228 + ], + [ + 94.36604562177126, + 26.148769915185653, + 26.55283166039908, + 25.744708169972228 + ], + [ + 98.09563791290384, + 26.148769915185653, + 26.55283166039908, + 25.744708169972228 + ], + [ + 101.82523020403642, + 26.148769915185653, + 26.55283166039908, + 25.744708169972228 + ], + [ + 105.55482249516945, + 26.148769915185653, + 26.55283166039908, + 25.744708169972228 + ], + [ + 109.28441478630202, + 26.148769915185653, + 26.55283166039908, + 25.744708169972228 + ], + [ + 113.0140070774346, + 26.148769915185653, + 26.55283166039908, + 25.744708169972228 + ], + [ + 116.74359936856717, + 26.148769915185653, + 26.55283166039908, + 25.744708169972228 + ], + [ + 120.4731916597002, + 26.148769915185653, + 26.55283166039908, + 25.744708169972228 + ], + [ + 124.20278395083278, + 26.148769915185653, + 26.55283166039908, + 25.744708169972228 + ], + [ + 127.93237624196536, + 26.148769915185653, + 26.55283166039908, + 25.744708169972228 + ], + [ + 131.66196853309793, + 26.148769915185653, + 26.55283166039908, + 25.744708169972228 + ], + [ + 135.39156082423096, + 26.148769915185653, + 26.55283166039908, + 25.744708169972228 + ], + [ + 139.12115311536354, + 26.148769915185653, + 26.55283166039908, + 25.744708169972228 + ], + [ + 142.85074540649612, + 26.148769915185653, + 26.55283166039908, + 25.744708169972228 + ], + [ + 146.5803376976287, + 26.148769915185653, + 26.55283166039908, + 25.744708169972228 + ], + [ + 150.30992998876172, + 26.148769915185653, + 26.55283166039908, + 25.744708169972228 + ], + [ + 154.0395222798943, + 26.148769915185653, + 26.55283166039908, + 25.744708169972228 + ], + [ + 157.76911457102688, + 26.148769915185653, + 26.55283166039908, + 25.744708169972228 + ], + [ + 161.49870686215945, + 26.148769915185653, + 26.55283166039908, + 25.744708169972228 + ], + [ + 165.22829915329248, + 26.148769915185653, + 26.55283166039908, + 25.744708169972228 + ], + [ + 168.95789144442506, + 26.148769915185653, + 26.55283166039908, + 25.744708169972228 + ], + [ + 172.68748373555763, + 26.148769915185653, + 26.55283166039908, + 25.744708169972228 + ], + [ + 176.4170760266902, + 26.249785351489038, + 26.75486253300579, + 25.744708169972228 + ], + [ + 180.14666831782324, + 26.249785351489038, + 26.75486253300579, + 25.744708169972228 + ], + [ + 183.87626060895582, + 26.249785351489038, + 26.75486253300579, + 25.744708169972228 + ], + [ + 187.6058529000884, + 26.249785351489038, + 26.75486253300579, + 25.744708169972228 + ], + [ + 191.33544519122097, + 26.249785351489038, + 26.75486253300579, + 25.744708169972228 + ], + [ + 195.065037482354, + 26.249785351489038, + 26.75486253300579, + 25.744708169972228 + ], + [ + 198.79462977348658, + 26.249785351489038, + 26.75486253300579, + 25.744708169972228 + ], + [ + 202.52422206461915, + 26.249785351489038, + 26.75486253300579, + 25.744708169972228 + ], + [ + 206.25381435575173, + 26.249785351489038, + 26.75486253300579, + 25.744708169972228 + ], + [ + 209.98340664688476, + 26.249785351489038, + 26.75486253300579, + 25.744708169972228 + ], + [ + 213.71299893801734, + 26.249785351489038, + 26.75486253300579, + 25.744708169972228 + ], + [ + 217.4425912291499, + 26.249785351489038, + 26.75486253300579, + 25.744708169972228 + ], + [ + 221.1721835202825, + 26.249785351489038, + 26.75486253300579, + 25.744708169972228 + ], + [ + 224.90177581141552, + 26.249785351489038, + 26.75486253300579, + 25.744708169972228 + ], + [ + 228.6313681025481, + 26.249785351489038, + 26.75486253300579, + 25.744708169972228 + ], + [ + 232.36096039368067, + 26.653847096702464, + 27.5629860234327, + 25.744708169972228 + ], + [ + 236.09055268481325, + 27.158924278219274, + 28.57314038646632, + 25.744708169972228 + ], + [ + 239.82014497594628, + 27.5629860234327, + 29.381263876893172, + 25.744708169972228 + ], + [ + 243.54973726707885, + 28.06806320494951, + 30.391418239926793, + 25.744708169972228 + ], + [ + 247.27932955821143, + 28.67415582276965, + 31.199541730353644, + 26.148769915185653 + ], + [ + 251.008921849344, + 29.583294749499885, + 32.00766522078055, + 27.158924278219274 + ], + [ + 254.73851414047658, + 30.49243367623012, + 32.815788711207404, + 28.16907864125284 + ], + [ + 258.4681064316096, + 31.30055716665703, + 33.62391220163431, + 28.977202131679746 + ], + [ + 262.1976987227422, + 32.10868065708388, + 34.43203569206116, + 29.785325622106598 + ], + [ + 265.92729101387476, + 33.017819583814116, + 35.24015918248807, + 30.79547998514022 + ], + [ + 269.65688330500734, + 33.825943074241025, + 36.04828267291492, + 31.603603475567127 + ], + [ + 273.3864755961404, + 34.634066564667876, + 36.85640616334183, + 32.41172696599398 + ], + [ + 277.11606788727295, + 35.3411746187914, + 37.46249878116197, + 33.219850456420886 + ], + [ + 280.8456601784055, + 36.14929810921831, + 38.27062227158888, + 34.02797394684774 + ], + [ + 284.5752524695381, + 36.957421599645215, + 39.07874576201573, + 34.836097437274645 + ], + [ + 288.30484476067113, + 37.66452965376868, + 39.684838379835924, + 35.6442209277015 + ], + [ + 292.0344370518037, + 38.47265314419559, + 40.492961870262775, + 36.452344418128405 + ], + [ + 295.7640293429363, + 39.17976119831911, + 41.30108536068968, + 37.05843703594854 + ], + [ + 299.49362163406886, + 39.88686925244264, + 41.90717797850982, + 37.86656052637545 + ], + [ + 303.2232139252019, + 40.69499274286949, + 42.71530146893673, + 38.6746840168023 + ], + [ + 306.95280621633447, + 41.30108536068968, + 43.32139408675687, + 39.2807766346225 + ], + [ + 310.68239850746704, + 42.008193414813206, + 43.92748670457706, + 40.08890012504935 + ], + [ + 314.4119907985996, + 42.81631690524006, + 44.735610195003915, + 40.89702361547626 + ], + [ + 318.14158308973265, + 43.42240952306025, + 45.34170281282405, + 41.503116233296396 + ], + [ + 321.8711753808652, + 44.230533013487104, + 46.14982630325096, + 42.311239723723304 + ], + [ + 325.6007676719978, + 44.8366256313073, + 46.7559189210711, + 42.91733234154344 + ], + [ + 329.3303599631304, + 45.44271824912744, + 47.362011538891295, + 43.52342495936358 + ], + [ + 333.0599522542634, + 46.250841739554346, + 48.170135029318146, + 44.33154844979049 + ], + [ + 336.789544545396, + 46.856934357374485, + 48.77622764713834, + 44.93764106761063 + ], + [ + 340.51913683652856, + 47.56404241149801, + 49.38232026495848, + 45.745764558037536 + ], + [ + 344.24872912766114, + 48.170135029318146, + 49.988412882778675, + 46.351857175857674 + ], + [ + 347.97832141879417, + 48.77622764713834, + 50.594505500598814, + 46.95794979367787 + ], + [ + 351.70791370992674, + 49.58435113756519, + 51.402628991025665, + 47.76607328410472 + ], + [ + 355.4375060010593, + 50.19044375538539, + 52.00872160884586, + 48.37216590192486 + ], + [ + 359.1670982921919, + 50.79653637320553, + 52.614814226666, + 48.978258519745054 + ], + [ + 362.8966905833249, + 51.402628991025665, + 53.220906844486194, + 49.58435113756519 + ], + [ + 366.6262828744575, + 52.00872160884586, + 53.82699946230633, + 50.19044375538539 + ], + [ + 370.3558751655901, + 52.715829662969384, + 54.43309208012647, + 50.99856724581224 + ], + [ + 374.08546745672265, + 53.32192228078952, + 55.039184697946666, + 51.604659863632435 + ], + [ + 377.8150597478557, + 53.92801489860972, + 55.645277315766805, + 52.21075248145257 + ], + [ + 381.54465203898826, + 54.534107516429856, + 56.251369933587, + 52.81684509927271 + ], + [ + 385.27424433012084, + 55.140200134249994, + 56.85746255140714, + 53.42293771709291 + ], + [ + 389.0038366212534, + 55.74629275207019, + 57.46355516922728, + 54.029030334913045 + ], + [ + 392.73342891238644, + 56.35238536989033, + 58.06964778704747, + 54.63512295273324 + ], + [ + 396.463021203519, + 56.95847798771052, + 58.67574040486761, + 55.24121557055338 + ], + [ + 400.1926134946516, + 57.56457060553066, + 59.281833022687806, + 55.84730818837352 + ], + [ + 403.9222057857842, + 58.1706632233508, + 59.887925640507945, + 56.45340080619371 + ], + [ + 407.6517980769172, + 58.776755841170996, + 60.49401825832808, + 57.05949342401385 + ], + [ + 411.3813903680498, + 59.382848458991134, + 61.10011087614828, + 57.66558604183405 + ], + [ + 415.11098265918235, + 59.98894107681133, + 61.70620349396842, + 58.271678659654185 + ], + [ + 418.84057495031493, + 60.49401825832808, + 62.11026523918184, + 58.877771277474324 + ], + [ + 422.57016724144796, + 61.10011087614828, + 62.71635785700204, + 59.48386389529452 + ], + [ + 426.29975953258054, + 61.70620349396842, + 63.322450474822176, + 60.08995651311466 + ], + [ + 430.0293518237131, + 62.31229611178861, + 63.92854309264237, + 60.69604913093485 + ], + [ + 433.7589441148457, + 62.91838872960875, + 64.53463571046251, + 61.30214174875499 + ], + [ + 437.4885364059787, + 63.42346591112556, + 64.93869745567594, + 61.90823436657513 + ], + [ + 441.2181286971113, + 63.92854309264237, + 65.54479007349613, + 62.31229611178861 + ], + [ + 444.9477209882439, + 64.53463571046251, + 66.15088269131627, + 62.91838872960875 + ], + [ + 448.67731327937645, + 65.14072832828265, + 66.75697530913641, + 63.52448134742889 + ], + [ + 452.4069055705095, + 65.64580550979946, + 67.16103705434989, + 64.13057396524908 + ], + [ + 456.13649786164206, + 66.25189812761965, + 67.76712967217003, + 64.73666658306922 + ], + [ + 459.86609015277463, + 66.75697530913641, + 68.37322228999022, + 65.14072832828265 + ], + [ + 463.5956824439072, + 67.3630679269566, + 68.97931490781036, + 65.74682094610284 + ], + [ + 467.32527473504024, + 67.86814510847341, + 69.38337665302379, + 66.35291356392298 + ], + [ + 471.0548670261728, + 68.47423772629355, + 69.98946927084398, + 66.95900618174318 + ], + [ + 474.7844593173054, + 68.97931490781036, + 70.59556188866412, + 67.3630679269566 + ], + [ + 478.51405160843797, + 69.48439208932717, + 70.99962363387755, + 67.96916054477674 + ], + [ + 482.243643899571, + 70.09048470714731, + 71.60571625169774, + 68.57525316259694 + ], + [ + 485.9732361907036, + 70.49454645236074, + 72.00977799691117, + 68.97931490781036 + ], + [ + 489.70282848183615, + 71.10063907018093, + 72.6158706147313, + 69.5854075256305 + ], + [ + 493.4324207729687, + 71.70673168800107, + 73.2219632325515, + 70.1915001434507 + ], + [ + 497.16201306410176, + 72.1107934332145, + 73.62602497776493, + 70.59556188866412 + ], + [ + 500.89160535523433, + 72.71688605103469, + 74.23211759558507, + 71.20165450648426 + ], + [ + 504.6211976463669, + 73.2219632325515, + 74.63617934079855, + 71.80774712430446 + ], + [ + 508.3507899374995, + 73.72704041406831, + 75.24227195861869, + 72.21180886951788 + ], + [ + 512.0803822286325, + 74.23211759558507, + 75.64633370383211, + 72.81790148733802 + ], + [ + 515.8099745197651, + 74.73719477710188, + 76.25242632165231, + 73.2219632325515 + ], + [ + 519.5395668108977, + 75.24227195861869, + 76.65648806686573, + 73.82805585037164 + ], + [ + 523.2691591020302, + 75.84836457643883, + 77.26258068468587, + 74.43414846819178 + ], + [ + 526.9987513931633, + 76.25242632165231, + 77.66664242989935, + 74.83821021340526 + ], + [ + 530.7283436842959, + 76.85851893947245, + 78.2727350477195, + 75.4443028312254 + ], + [ + 534.4579359754284, + 77.26258068468587, + 78.67679679293292, + 75.84836457643883 + ], + [ + 538.187528266561, + 77.86867330250607, + 79.28288941075311, + 76.45445719425902 + ], + [ + 541.917120557694, + 78.2727350477195, + 79.68695115596654, + 76.85851893947245 + ], + [ + 545.6467128488266, + 78.87882766553963, + 80.29304377378668, + 77.46461155729259 + ], + [ + 549.3763051399592, + 79.28288941075311, + 80.69710551900016, + 77.86867330250607 + ], + [ + 553.1058974310918, + 79.88898202857325, + 81.3031981368203, + 78.4747659203262 + ], + [ + 556.8354897222248, + 80.29304377378668, + 81.70725988203372, + 78.87882766553963 + ], + [ + 560.5650820133574, + 80.89913639160687, + 82.31335249985392, + 79.48492028335983 + ], + [ + 564.29467430449, + 81.3031981368203, + 82.71741424506735, + 79.88898202857325 + ], + [ + 568.0242665956225, + 81.80827531833711, + 83.12147599028077, + 80.49507464639339 + ], + [ + 571.7538588867551, + 82.31335249985392, + 83.72756860810097, + 80.89913639160687 + ], + [ + 575.4834511778881, + 82.71741424506735, + 84.13163035331439, + 81.3031981368203 + ], + [ + 579.2130434690207, + 83.22249142658416, + 84.53569209852782, + 81.90929075464044 + ], + [ + 582.9426357601533, + 83.72756860810097, + 85.14178471634796, + 82.31335249985392 + ], + [ + 586.6722280512859, + 84.23264578961772, + 85.54584646156144, + 82.91944511767406 + ], + [ + 590.4018203424189, + 84.6367075348312, + 85.94990820677486, + 83.32350686288748 + ], + [ + 594.1314126335515, + 85.14178471634796, + 86.556000824595, + 83.72756860810097 + ], + [ + 597.861004924684, + 85.64686189786477, + 86.96006256980849, + 84.3336612259211 + ], + [ + 601.5905972158166, + 86.05092364307825, + 87.36412431502191, + 84.73772297113453 + ], + [ + 605.3201895069496, + 86.556000824595, + 87.97021693284205, + 85.14178471634796 + ], + [ + 609.0497817980822, + 87.06107800611181, + 88.37427867805553, + 85.74787733416815 + ], + [ + 612.7793740892148, + 87.46513975132524, + 88.77834042326896, + 86.15193907938158 + ], + [ + 616.5089663803474, + 87.97021693284205, + 89.3844330410891, + 86.556000824595 + ], + [ + 620.2385586714804, + 88.47529411435886, + 89.78849478630252, + 87.1620934424152 + ], + [ + 623.968150962613, + 88.87935585957229, + 90.192556531516, + 87.56615518762862 + ], + [ + 627.6977432537456, + 89.28341760478577, + 90.59661827672943, + 87.97021693284205 + ], + [ + 631.4273355448781, + 89.8895102226059, + 91.20271089454957, + 88.57630955066224 + ], + [ + 635.1569278360112, + 90.29357196781933, + 91.60677263976305, + 88.98037129587567 + ], + [ + 638.8865201271437, + 90.69763371303281, + 92.01083438497648, + 89.3844330410891 + ], + [ + 642.6161124182763, + 91.20271089454957, + 92.4148961301899, + 89.99052565890929 + ], + [ + 646.3457047094089, + 91.70778807606638, + 93.0209887480101, + 90.39458740412272 + ], + [ + 650.0752970005419, + 92.11184982127986, + 93.42505049322352, + 90.79864914933614 + ], + [ + 653.8048892916745, + 92.51591156649329, + 93.82911223843695, + 91.20271089454957 + ], + [ + 657.5344815828071, + 93.0209887480101, + 94.23317398365037, + 91.80880351236976 + ], + [ + 661.2640738739397, + 93.42505049322352, + 94.63723572886386, + 92.21286525758319 + ], + [ + 664.9936661650727, + 93.93012767474033, + 95.243328346684, + 92.61692700279661 + ], + [ + 668.7232584562053, + 94.33418941995376, + 95.64739009189742, + 93.0209887480101 + ], + [ + 672.4528507473378, + 94.73825116516718, + 96.0514518371109, + 93.42505049322352 + ], + [ + 676.1824430384704, + 95.243328346684, + 96.45551358232433, + 94.03114311104366 + ], + [ + 679.9120353296034, + 95.64739009189742, + 96.85957532753775, + 94.43520485625714 + ], + [ + 683.641627620736, + 96.0514518371109, + 97.26363707275118, + 94.83926660147057 + ], + [ + 687.3712199118686, + 96.55652901862766, + 97.86972969057138, + 95.243328346684 + ], + [ + 691.1008122030012, + 96.96059076384114, + 98.2737914357848, + 95.64739009189742 + ], + [ + 694.8304044941342, + 97.4656679453579, + 98.67785318099823, + 96.25348270971762 + ], + [ + 698.5599967852668, + 97.86972969057138, + 99.08191492621171, + 96.65754445493104 + ], + [ + 702.2895890763994, + 98.2737914357848, + 99.48597667142514, + 97.06160620014447 + ], + [ + 706.0191813675319, + 98.67785318099823, + 99.89003841663856, + 97.4656679453579 + ], + [ + 709.748773658665, + 99.08191492621171, + 100.29410016185199, + 97.86972969057138 + ], + [ + 713.4783659497975, + 99.48597667142514, + 100.69816190706547, + 98.2737914357848 + ], + [ + 717.2079582409301, + 99.99105385294195, + 101.30425452488561, + 98.67785318099823 + ], + [ + 720.9375505320627, + 100.4961310344587, + 101.70831627009903, + 99.28394579881842 + ], + [ + 724.6671428231957, + 100.90019277967218, + 102.11237801531252, + 99.68800754403185 + ], + [ + 728.3967351143283, + 101.30425452488561, + 102.51643976052594, + 100.09206928924527 + ], + [ + 732.1263274054609, + 101.70831627009903, + 102.92050150573937, + 100.4961310344587 + ], + [ + 735.8559196965934, + 102.11237801531252, + 103.32456325095279, + 100.90019277967218 + ], + [ + 739.5855119877265, + 102.51643976052594, + 103.72862499616627, + 101.30425452488561 + ], + [ + 743.315104278859, + 102.92050150573937, + 104.1326867413797, + 101.70831627009903 + ], + [ + 747.0446965699916, + 103.32456325095279, + 104.53674848659313, + 102.11237801531252 + ], + [ + 750.7742888611242, + 103.72862499616627, + 104.94081023180655, + 102.51643976052594 + ], + [ + 754.5038811522572, + 104.1326867413797, + 105.34487197702003, + 102.92050150573937 + ], + [ + 758.2334734433898, + 104.53674848659313, + 105.74893372223346, + 103.32456325095279 + ], + [ + 761.9630657345224, + 104.94081023180655, + 106.15299546744689, + 103.72862499616627 + ], + [ + 765.692658025655, + 105.44588741332336, + 106.55705721266031, + 104.33471761398641 + ], + [ + 769.422250316788, + 105.84994915853679, + 106.9611189578738, + 104.73877935919984 + ], + [ + 773.1518426079206, + 106.25401090375027, + 107.36518070308722, + 105.14284110441332 + ], + [ + 776.8814348990531, + 106.6580726489637, + 107.76924244830064, + 105.54690284962675 + ], + [ + 780.6110271901857, + 107.06213439417712, + 108.17330419351407, + 105.95096459484017 + ], + [ + 784.3406194813188, + 107.4661961393906, + 108.57736593872755, + 106.3550263400536 + ], + [ + 788.0702117724513, + 107.87025788460403, + 108.98142768394098, + 106.75908808526708 + ], + [ + 791.7998040635839, + 108.27431962981746, + 109.3854894291544, + 107.1631498304805 + ], + [ + 795.5293963547165, + 108.67838137503088, + 109.78955117436789, + 107.56721157569393 + ], + [ + 799.2589886458495, + 109.08244312024436, + 110.19361291958131, + 107.97127332090736 + ], + [ + 802.9885809369821, + 109.48650486545779, + 110.59767466479474, + 108.37533506612084 + ], + [ + 806.7181732281147, + 109.89056661067121, + 111.00173641000816, + 108.77939681133427 + ], + [ + 810.4477655192472, + 110.29462835588464, + 111.40579815522165, + 109.18345855654769 + ], + [ + 814.1773578103803, + 110.69869010109812, + 111.80985990043507, + 109.58752030176112 + ], + [ + 817.9069501015128, + 111.10275184631155, + 112.2139216456485, + 109.9915820469746 + ], + [ + 821.6365423926454, + 111.40579815522165, + 112.61798339086192, + 110.19361291958131 + ], + [ + 825.366134683778, + 111.80985990043507, + 113.0220451360754, + 110.59767466479474 + ], + [ + 829.095726974911, + 112.2139216456485, + 113.42610688128883, + 111.00173641000816 + ], + [ + 832.8253192660436, + 112.61798339086192, + 113.83016862650226, + 111.40579815522165 + ], + [ + 836.5549115571762, + 112.92102969977202, + 114.03219949910897, + 111.80985990043507 + ], + [ + 840.2845038483088, + 113.32509144498545, + 114.43626124432245, + 112.2139216456485 + ], + [ + 844.0140961394418, + 113.72915319019893, + 114.84032298953588, + 112.61798339086192 + ], + [ + 847.7436884305744, + 114.13321493541235, + 115.2443847347493, + 113.0220451360754 + ], + [ + 851.4732807217069, + 114.53727668062578, + 115.64844647996273, + 113.42610688128883 + ], + [ + 855.2028730128395, + 114.9413384258392, + 116.05250822517621, + 113.83016862650226 + ], + [ + 858.9324653039725, + 115.34540017105269, + 116.45656997038964, + 114.23423037171568 + ], + [ + 862.6620575951051, + 115.74946191626611, + 116.86063171560306, + 114.63829211692916 + ], + [ + 866.3916498862377, + 116.15352366147954, + 117.26469346081649, + 115.04235386214259 + ], + [ + 870.1212421773703, + 116.35555453408625, + 117.46672433342326, + 115.2443847347493 + ], + [ + 873.8508344685033, + 116.75961627929973, + 117.87078607863668, + 115.64844647996273 + ], + [ + 877.5804267596359, + 117.16367802451316, + 118.27484782385011, + 116.05250822517621 + ], + [ + 881.3100190507685, + 117.56773976972659, + 118.67890956906353, + 116.45656997038964 + ], + [ + 885.039611341901, + 117.97180151494001, + 119.08297131427702, + 116.86063171560306 + ], + [ + 888.7692036330336, + 118.3758632601535, + 119.48703305949044, + 117.26469346081649 + ], + [ + 892.4987959241666, + 118.67890956906353, + 119.68906393209716, + 117.66875520602997 + ], + [ + 896.2283882152992, + 119.08297131427702, + 120.09312567731058, + 118.0728169512434 + ], + [ + 899.9579805064318, + 119.38601762318706, + 120.49718742252406, + 118.27484782385011 + ], + [ + 903.6875727975644, + 119.79007936840054, + 120.90124916773749, + 118.67890956906353 + ], + [ + 907.4171650886974, + 120.19414111361397, + 121.30531091295092, + 119.08297131427702 + ], + [ + 911.14675737983, + 120.59820285882739, + 121.70937265816434, + 119.48703305949044 + ], + [ + 914.8763496709626, + 120.90124916773749, + 121.91140353077105, + 119.89109480470387 + ], + [ + 918.6059419620951, + 121.30531091295092, + 122.31546527598454, + 120.2951565499173 + ], + [ + 922.3355342532282, + 121.60835722186101, + 122.71952702119796, + 120.49718742252406 + ], + [ + 926.0651265443607, + 122.01241896707444, + 123.12358876641139, + 120.90124916773749 + ], + [ + 929.7947188354933, + 122.41648071228786, + 123.52765051162487, + 121.30531091295092 + ], + [ + 933.5243111266259, + 122.71952702119796, + 123.72968138423158, + 121.70937265816434 + ], + [ + 937.2539034177589, + 123.12358876641139, + 124.13374312944501, + 122.11343440337782 + ], + [ + 940.9834957088915, + 123.42663507532149, + 124.53780487465843, + 122.31546527598454 + ], + [ + 944.7130880000241, + 123.83069682053491, + 124.94186661987186, + 122.71952702119796 + ], + [ + 948.4426802911566, + 124.13374312944501, + 125.14389749247863, + 123.12358876641139 + ], + [ + 952.1722725822897, + 124.53780487465843, + 125.54795923769206, + 123.52765051162487 + ], + [ + 955.9018648734223, + 124.94186661987186, + 125.95202098290548, + 123.9317122568383 + ], + [ + 959.6314571645548, + 125.24491292878196, + 126.3560827281189, + 124.13374312944501 + ], + [ + 963.3610494556874, + 125.54795923769206, + 126.55811360072562, + 124.53780487465843 + ], + [ + 967.0906417468204, + 125.95202098290548, + 126.9621753459391, + 124.94186661987186 + ], + [ + 970.820234037953, + 126.3560827281189, + 127.36623709115253, + 125.34592836508534 + ], + [ + 974.5498263290856, + 126.659129037029, + 127.77029883636595, + 125.54795923769206 + ], + [ + 978.2794186202182, + 126.9621753459391, + 127.97232970897267, + 125.95202098290548 + ], + [ + 982.0090109113512, + 127.36623709115253, + 128.37639145418615, + 126.3560827281189 + ], + [ + 985.7386032024838, + 127.77029883636595, + 128.78045319939957, + 126.76014447333239 + ], + [ + 989.4681954936163, + 128.07334514527605, + 129.184514944613, + 126.9621753459391 + ], + [ + 993.1977877847489, + 128.37639145418615, + 129.3865458172197, + 127.36623709115253 + ], + [ + 996.927380075882, + 128.78045319939957, + 129.7906075624332, + 127.77029883636595 + ], + [ + 1000.6569723670145, + 129.184514944613, + 130.19466930764662, + 128.17436058157944 + ], + [ + 1004.3865646581471, + 129.3865458172197, + 130.39670018025333, + 128.37639145418615 + ], + [ + 1008.1161569492797, + 129.7906075624332, + 130.80076192546676, + 128.78045319939957 + ], + [ + 1011.8457492404127, + 130.19466930764662, + 131.20482367068024, + 129.184514944613 + ], + [ + 1015.5753415315453, + 130.49771561655672, + 131.60888541589367, + 129.3865458172197 + ], + [ + 1019.3049338226779, + 130.80076192546676, + 131.81091628850038, + 129.7906075624332 + ], + [ + 1023.0345261138104, + 131.20482367068024, + 132.2149780337138, + 130.19466930764662 + ], + [ + 1026.7641184049435, + 131.50786997959028, + 132.61903977892723, + 130.39670018025333 + ], + [ + 1030.493710696076, + 131.81091628850038, + 132.821070651534, + 130.80076192546676 + ], + [ + 1034.2233029872086, + 132.2149780337138, + 133.22513239674743, + 131.20482367068024 + ], + [ + 1037.9528952783412, + 132.61903977892723, + 133.62919414196085, + 131.60888541589367 + ], + [ + 1041.6824875694742, + 132.821070651534, + 133.83122501456756, + 131.81091628850038 + ], + [ + 1045.4120798606068, + 133.22513239674743, + 134.235286759781, + 132.2149780337138 + ], + [ + 1049.1416721517394, + 133.62919414196085, + 134.63934850499447, + 132.61903977892723 + ], + [ + 1052.871264442872, + 133.83122501456756, + 134.84137937760119, + 132.821070651534 + ], + [ + 1056.600856734005, + 134.13427132347766, + 135.0434102502079, + 133.22513239674743 + ], + [ + 1060.3304490251376, + 134.33630219608438, + 135.0434102502079, + 133.62919414196085 + ], + [ + 1064.0600413162701, + 134.43731763238776, + 135.0434102502079, + 133.83122501456756 + ], + [ + 1067.7896336074027, + 134.63934850499447, + 135.0434102502079, + 134.235286759781 + ], + [ + 1071.5192258985358, + 134.84137937760119, + 135.0434102502079, + 134.63934850499447 + ], + [ + 1075.2488181896683, + 134.9423948139045, + 135.0434102502079, + 134.84137937760119 + ], + [ + 1108.8151488098624, + 138.8819968297356, + 139.89215119276918, + 137.871842466702 + ], + [ + 1112.544741100995, + 139.08402770234233, + 140.0941820653759, + 138.0738733393087 + ], + [ + 1116.274333392128, + 139.48808944755575, + 140.49824381058937, + 138.47793508452213 + ], + [ + 1120.0039256832606, + 139.79113575646585, + 140.70027468319608, + 138.8819968297356 + ], + [ + 1123.7335179743932, + 140.0941820653759, + 141.1043364284095, + 139.08402770234233 + ], + [ + 1127.4631102655258, + 140.397228374286, + 141.30636730101622, + 139.48808944755575 + ], + [ + 1131.1927025566588, + 140.70027468319608, + 141.71042904622965, + 139.69012032016246 + ], + [ + 1134.9222948477914, + 141.1043364284095, + 142.11449079144313, + 140.0941820653759 + ], + [ + 1138.651887138924, + 141.4073827373196, + 142.31652166404984, + 140.49824381058937 + ], + [ + 1142.3814794300565, + 141.71042904622965, + 142.72058340926327, + 140.70027468319608 + ], + [ + 1146.1110717211895, + 142.01347535513975, + 142.92261428186998, + 141.1043364284095 + ], + [ + 1149.8406640123221, + 142.31652166404984, + 143.3266760270834, + 141.30636730101622 + ], + [ + 1153.5702563034547, + 142.61956797295989, + 143.52870689969018, + 141.71042904622965 + ], + [ + 1157.2998485945873, + 142.92261428186998, + 143.9327686449036, + 141.91245991883642 + ], + [ + 1161.0294408857203, + 143.22566059078008, + 144.13479951751032, + 142.31652166404984 + ], + [ + 1164.7590331768529, + 143.6297223359935, + 144.53886126272374, + 142.72058340926327 + ], + [ + 1168.4886254679855, + 143.9327686449036, + 144.94292300793717, + 142.92261428186998 + ], + [ + 1172.218217759118, + 144.2358149538137, + 145.14495388054394, + 143.3266760270834 + ], + [ + 1175.947810050251, + 144.53886126272374, + 145.54901562575736, + 143.52870689969018 + ], + [ + 1179.6774023413836, + 144.84190757163384, + 145.75104649836408, + 143.9327686449036 + ], + [ + 1183.4069946325162, + 145.14495388054394, + 146.1551082435775, + 144.13479951751032 + ], + [ + 1187.1365869236488, + 145.44800018945398, + 146.35713911618421, + 144.53886126272374 + ], + [ + 1190.8661792147818, + 145.75104649836408, + 146.7612008613977, + 144.74089213533045 + ], + [ + 1194.5957715059144, + 146.05409280727417, + 146.9632317340044, + 145.14495388054394 + ], + [ + 1198.325363797047, + 146.35713911618421, + 147.36729347921784, + 145.34698475315065 + ], + [ + 1202.0549560881796, + 146.6601854250943, + 147.56932435182455, + 145.75104649836408 + ], + [ + 1205.7845483793121, + 146.9632317340044, + 147.97338609703797, + 145.9530773709708 + ], + [ + 1209.5141406704452, + 147.26627804291445, + 148.17541696964474, + 146.35713911618421 + ], + [ + 1213.2437329615777, + 147.56932435182455, + 148.57947871485817, + 146.55916998879098 + ], + [ + 1216.9733252527103, + 147.87237066073465, + 148.78150958746488, + 146.9632317340044 + ], + [ + 1220.702917543843, + 148.17541696964474, + 149.1855713326783, + 147.16526260661112 + ], + [ + 1224.432509834976, + 148.47846327855478, + 149.38760220528502, + 147.56932435182455 + ], + [ + 1228.1621021261085, + 148.78150958746488, + 149.7916639504985, + 147.77135522443126 + ], + [ + 1231.891694417241, + 149.08455589637498, + 149.99369482310522, + 148.17541696964474 + ], + [ + 1235.6212867083736, + 149.38760220528502, + 150.39775656831864, + 148.37744784225146 + ], + [ + 1239.3508789995067, + 149.69064851419512, + 150.59978744092535, + 148.78150958746488 + ], + [ + 1243.0804712906393, + 149.99369482310522, + 151.00384918613878, + 148.9835404600716 + ], + [ + 1246.8100635817718, + 150.29674113201526, + 151.20588005874555, + 149.38760220528502 + ], + [ + 1250.5396558729044, + 150.59978744092535, + 151.60994180395898, + 149.5896330778918 + ], + [ + 1254.2692481640374, + 150.90283374983545, + 151.8119726765657, + 149.99369482310522 + ], + [ + 1257.99884045517, + 151.10486462244216, + 152.0140035491724, + 150.19572569571193 + ], + [ + 1261.7284327463026, + 151.5089263676556, + 152.41806529438583, + 150.59978744092535 + ], + [ + 1265.4580250374352, + 151.7109572402623, + 152.62009616699254, + 150.80181831353207 + ], + [ + 1269.1876173285682, + 152.11501898547579, + 153.02415791220602, + 151.20588005874555 + ], + [ + 1272.9172096197008, + 152.3170498580825, + 153.22618878481273, + 151.40791093135226 + ], + [ + 1276.6468019108333, + 152.72111160329592, + 153.63025053002616, + 151.8119726765657 + ], + [ + 1280.376394201966, + 152.92314247590264, + 153.83228140263287, + 152.0140035491724 + ], + [ + 1284.105986493099, + 153.32720422111606, + 154.23634314784636, + 152.41806529438583 + ], + [ + 1287.8355787842315, + 153.52923509372283, + 154.43837402045307, + 152.62009616699254 + ], + [ + 1291.565171075364, + 153.93329683893626, + 154.8424357656665, + 153.02415791220602 + ], + [ + 1295.2947633664967, + 154.13532771154297, + 155.0444666382732, + 153.22618878481273 + ], + [ + 1299.0243556576297, + 154.33735858414968, + 155.24649751087992, + 153.42821965741945 + ], + [ + 1302.7539479487623, + 154.7414203293631, + 155.65055925609335, + 153.83228140263287 + ], + [ + 1306.4835402398949, + 154.94345120196988, + 155.85259012870011, + 154.03431227523959 + ], + [ + 1310.2131325310274, + 155.3475129471833, + 156.25665187391354, + 154.43837402045307 + ], + [ + 1313.9427248221605, + 155.54954381979002, + 156.45868274652025, + 154.64040489305978 + ], + [ + 1317.672317113293, + 155.85259012870011, + 156.66071361912697, + 155.0444666382732 + ], + [ + 1321.4019094044256, + 156.15563643761016, + 157.0647753643404, + 155.24649751087992 + ], + [ + 1325.1315016955582, + 156.35766731021687, + 157.26680623694716, + 155.44852838348663 + ], + [ + 1328.8610939866912, + 156.76172905543035, + 157.6708679821606, + 155.85259012870011 + ], + [ + 1332.5906862778238, + 156.96375992803706, + 157.8728988547673, + 156.05462100130683 + ], + [ + 1336.3202785689564, + 157.26680623694716, + 158.074929727374, + 156.45868274652025 + ], + [ + 1340.049870860089, + 157.5698525458572, + 158.47899147258744, + 156.66071361912697 + ], + [ + 1343.779463151222, + 157.77188341846391, + 158.68102234519415, + 156.86274449173368 + ], + [ + 1347.5090554423546, + 158.1759451636774, + 159.08508409040763, + 157.26680623694716 + ], + [ + 1351.2386477334871, + 158.3779760362841, + 159.28711496301435, + 157.46883710955387 + ], + [ + 1354.9682400246197, + 158.68102234519415, + 159.48914583562106, + 157.8728988547673 + ], + [ + 1358.6978323157527, + 158.98406865410425, + 159.89320758083448, + 158.074929727374 + ], + [ + 1362.4274246068853, + 159.18609952671096, + 160.0952384534412, + 158.27696059998073 + ], + [ + 1366.157016898018, + 159.59016127192444, + 160.49930019865468, + 158.68102234519415 + ], + [ + 1369.8866091891505, + 159.79219214453116, + 160.7013310712614, + 158.88305321780092 + ], + [ + 1373.6162014802835, + 160.0952384534412, + 160.9033619438681, + 159.28711496301435 + ], + [ + 1377.345793771416, + 160.3982847623513, + 161.30742368908153, + 159.48914583562106 + ], + [ + 1381.0753860625487, + 160.600315634958, + 161.50945456168824, + 159.69117670822777 + ], + [ + 1384.8049783536812, + 160.9033619438681, + 161.71148543429496, + 160.0952384534412 + ], + [ + 1388.5345706448143, + 161.2064082527782, + 162.11554717950844, + 160.2972693260479 + ], + [ + 1392.2641629359468, + 161.40843912538492, + 162.31757805211515, + 160.49930019865468 + ], + [ + 1395.9937552270794, + 161.71148543429496, + 162.51960892472187, + 160.9033619438681 + ], + [ + 1399.723347518212, + 162.01453174320505, + 162.9236706699353, + 161.10539281647482 + ], + [ + 1403.452939809345, + 162.31757805211515, + 163.125701542542, + 161.50945456168824 + ], + [ + 1407.1825321004776, + 162.62062436102525, + 163.5297632877555, + 161.71148543429496 + ], + [ + 1410.9121243916102, + 162.82265523363196, + 163.7317941603622, + 161.91351630690173 + ], + [ + 1414.6417166827428, + 163.125701542542, + 163.9338250329689, + 162.31757805211515 + ], + [ + 1418.3713089738758, + 163.4287478514521, + 164.33788677818234, + 162.51960892472187 + ], + [ + 1422.1009012650084, + 163.6307787240588, + 164.53991765078905, + 162.72163979732858 + ], + [ + 1425.830493556141, + 163.9338250329689, + 164.74194852339576, + 163.125701542542 + ], + [ + 1429.5600858472735, + 164.236871341879, + 165.14601026860925, + 163.32773241514872 + ], + [ + 1433.2896781384065, + 164.43890221448572, + 165.34804114121596, + 163.5297632877555 + ], + [ + 1437.0192704295391, + 164.74194852339576, + 165.55007201382267, + 163.9338250329689 + ], + [ + 1440.7488627206717, + 164.94397939600253, + 165.75210288642938, + 164.13585590557562 + ], + [ + 1444.4784550118043, + 165.24702570491257, + 166.1561646316428, + 164.33788677818234 + ], + [ + 1448.2080473029373, + 165.55007201382267, + 166.35819550424952, + 164.74194852339576 + ], + [ + 1451.9376395940699, + 165.75210288642938, + 166.5602263768563, + 164.94397939600253 + ], + [ + 1455.6672318852025, + 166.05514919533948, + 166.96428812206972, + 165.14601026860925 + ], + [ + 1459.396824176335, + 166.35819550424952, + 167.16631899467643, + 165.55007201382267 + ], + [ + 1463.126416467468, + 166.5602263768563, + 167.36834986728314, + 165.75210288642938 + ], + [ + 1466.8560087586006, + 166.86327268576633, + 167.77241161249657, + 165.9541337590361 + ], + [ + 1470.5856010497332, + 167.16631899467643, + 167.97444248510334, + 166.35819550424952 + ], + [ + 1474.3151933408658, + 167.36834986728314, + 168.17647335771005, + 166.5602263768563 + ], + [ + 1478.0447856319988, + 167.67139617619324, + 168.58053510292348, + 166.762257249463 + ], + [ + 1481.7743779231314, + 167.87342704879995, + 168.7825659755302, + 166.96428812206972 + ], + [ + 1485.503970214264, + 168.17647335771005, + 168.9845968481369, + 167.36834986728314 + ], + [ + 1489.2335625053965, + 168.37850423031676, + 169.18662772074362, + 167.57038073988986 + ], + [ + 1492.9631547965291, + 168.6815505392268, + 169.5906894659571, + 167.77241161249657 + ], + [ + 1496.6927470876617, + 168.9845968481369, + 169.7927203385638, + 168.17647335771005 + ], + [ + 1500.4223393787952, + 169.18662772074362, + 169.99475121117052, + 168.37850423031676 + ], + [ + 1504.1519316699278, + 169.4896740296537, + 170.39881295638395, + 168.58053510292348 + ], + [ + 1507.8815239610603, + 169.7927203385638, + 170.60084382899066, + 168.9845968481369 + ], + [ + 1511.611116252193, + 169.99475121117052, + 170.80287470159737, + 169.18662772074362 + ], + [ + 1515.3407085433255, + 170.19678208377724, + 171.0049055742041, + 169.38865859335033 + ], + [ + 1519.070300834458, + 170.49982839268733, + 171.40896731941757, + 169.5906894659571 + ], + [ + 1522.7998931255906, + 170.80287470159737, + 171.61099819202428, + 169.99475121117052 + ], + [ + 1526.5294854167232, + 171.0049055742041, + 171.813029064631, + 170.19678208377724 + ], + [ + 1530.2590777078558, + 171.20693644681086, + 172.0150599372377, + 170.39881295638395 + ], + [ + 1533.9886699989893, + 171.5099827557209, + 172.41912168245113, + 170.60084382899066 + ], + [ + 1537.7182622901219, + 171.813029064631, + 172.6211525550579, + 171.0049055742041 + ], + [ + 1541.4478545812544, + 172.0150599372377, + 172.82318342766462, + 171.20693644681086 + ], + [ + 1545.177446872387, + 172.21709080984442, + 173.02521430027133, + 171.40896731941757 + ], + [ + 1548.9070391635196, + 172.52013711875452, + 173.42927604548476, + 171.61099819202428 + ], + [ + 1552.6366314546522, + 172.82318342766462, + 173.63130691809147, + 172.0150599372377 + ], + [ + 1556.3662237457847, + 173.02521430027133, + 173.83333779069818, + 172.21709080984442 + ], + [ + 1560.0958160369173, + 173.22724517287804, + 174.0353686633049, + 172.41912168245113 + ], + [ + 1563.8254083280508, + 173.53029148178814, + 174.43943040851838, + 172.6211525550579 + ], + [ + 1567.5550006191834, + 173.83333779069818, + 174.6414612811251, + 173.02521430027133 + ], + [ + 1571.284592910316, + 174.0353686633049, + 174.8434921537318, + 173.22724517287804 + ], + [ + 1575.0141852014485, + 174.23739953591166, + 175.04552302633851, + 173.42927604548476 + ], + [ + 1578.743777492581, + 174.5404458448217, + 175.44958477155194, + 173.63130691809147 + ], + [ + 1582.4733697837137, + 174.8434921537318, + 175.6516156441587, + 174.0353686633049 + ], + [ + 1586.2029620748463, + 175.04552302633851, + 175.85364651676542, + 174.23739953591166 + ], + [ + 1589.9325543659788, + 175.24755389894523, + 176.05567738937214, + 174.43943040851838 + ], + [ + 1593.6621466571123, + 175.44958477155194, + 176.25770826197885, + 174.6414612811251 + ], + [ + 1597.391738948245, + 175.85364651676542, + 176.66177000719227, + 175.04552302633851 + ], + [ + 1601.1213312393775, + 176.05567738937214, + 176.863800879799, + 175.24755389894523 + ], + [ + 1604.85092353051, + 176.25770826197885, + 177.0658317524057, + 175.44958477155194 + ], + [ + 1608.5805158216426, + 176.45973913458556, + 177.26786262501247, + 175.6516156441587 + ], + [ + 1612.3101081127752, + 176.863800879799, + 177.6719243702259, + 176.05567738937214 + ], + [ + 1616.0397004039078, + 177.0658317524057, + 177.8739552428326, + 176.25770826197885 + ], + [ + 1619.7692926950403, + 177.26786262501247, + 178.07598611543932, + 176.45973913458556 + ], + [ + 1623.4988849861738, + 177.46989349761918, + 178.27801698804603, + 176.66177000719227 + ], + [ + 1627.2284772773064, + 177.6719243702259, + 178.48004786065275, + 176.863800879799 + ], + [ + 1630.958069568439, + 178.07598611543932, + 178.88410960586623, + 177.26786262501247 + ], + [ + 1634.6876618595716, + 178.27801698804603, + 179.08614047847294, + 177.46989349761918 + ], + [ + 1638.4172541507041, + 178.48004786065275, + 179.28817135107965, + 177.6719243702259 + ], + [ + 1642.1468464418367, + 178.68207873325946, + 179.49020222368637, + 177.8739552428326 + ], + [ + 1645.8764387329693, + 178.88410960586623, + 179.69223309629308, + 178.07598611543932 + ], + [ + 1649.6060310241019, + 179.28817135107965, + 180.0962948415065, + 178.48004786065275 + ], + [ + 1653.3356233152354, + 179.49020222368637, + 180.29832571411328, + 178.68207873325946 + ], + [ + 1657.065215606368, + 179.69223309629308, + 180.50035658672, + 178.88410960586623 + ], + [ + 1660.7948078975005, + 179.8942639688998, + 180.7023874593267, + 179.08614047847294 + ], + [ + 1664.524400188633, + 180.0962948415065, + 180.9044183319334, + 179.28817135107965 + ], + [ + 1668.2539924797657, + 180.29832571411328, + 181.10644920454013, + 179.49020222368637 + ], + [ + 1671.9835847708982, + 180.7023874593267, + 181.51051094975355, + 179.8942639688998 + ], + [ + 1675.7131770620308, + 180.9044183319334, + 181.71254182236027, + 180.0962948415065 + ], + [ + 1679.4427693531634, + 181.10644920454013, + 181.91457269496703, + 180.29832571411328 + ], + [ + 1683.1723616442969, + 181.30848007714684, + 182.11660356757375, + 180.50035658672 + ], + [ + 1686.9019539354294, + 181.51051094975355, + 182.31863444018046, + 180.7023874593267 + ], + [ + 1690.631546226562, + 181.81355725866365, + 182.52066531278717, + 181.10644920454013 + ], + [ + 1694.3611385176946, + 182.11660356757375, + 182.9247270580006, + 181.30848007714684 + ], + [ + 1698.0907308088272, + 182.31863444018046, + 183.1267579306073, + 181.51051094975355 + ], + [ + 1701.8203230999598, + 182.52066531278717, + 183.32878880321408, + 181.71254182236027 + ], + [ + 1705.5499153910923, + 182.7226961853939, + 183.5308196758208, + 181.91457269496703 + ], + [ + 1709.279507682225, + 182.9247270580006, + 183.7328505484275, + 182.11660356757375 + ], + [ + 1713.0090999733584, + 183.2277733669107, + 183.93488142103422, + 182.52066531278717 + ], + [ + 1716.738692264491, + 183.4298042395174, + 184.13691229364093, + 182.7226961853939 + ], + [ + 1720.4682845556235, + 183.7328505484275, + 184.54097403885436, + 182.9247270580006 + ], + [ + 1724.1978768467561, + 183.93488142103422, + 184.74300491146107, + 183.1267579306073 + ], + [ + 1727.9274691378887, + 184.13691229364093, + 184.94503578406784, + 183.32878880321408 + ], + [ + 1731.6570614290213, + 184.33894316624765, + 185.14706665667455, + 183.5308196758208 + ], + [ + 1735.3866537201538, + 184.54097403885436, + 185.34909752928127, + 183.7328505484275 + ], + [ + 1739.1162460112864, + 184.84402034776446, + 185.55112840188798, + 184.13691229364093 + ], + [ + 1742.84583830242, + 185.04605122037117, + 185.7531592744947, + 184.33894316624765 + ], + [ + 1746.5754305935525, + 185.34909752928127, + 186.15722101970812, + 184.54097403885436 + ], + [ + 1750.305022884685, + 185.55112840188798, + 186.3592518923149, + 184.74300491146107 + ], + [ + 1754.0346151758176, + 185.7531592744947, + 186.5612827649216, + 184.94503578406784 + ], + [ + 1757.7642074669502, + 185.9551901471014, + 186.7633136375283, + 185.14706665667455 + ], + [ + 1761.4937997580828, + 186.15722101970812, + 186.96534451013503, + 185.34909752928127 + ], + [ + 1765.2233920492154, + 186.46026732861822, + 187.16737538274174, + 185.7531592744947 + ], + [ + 1768.952984340348, + 186.66229820122493, + 187.36940625534845, + 185.9551901471014 + ], + [ + 1772.6825766314814, + 186.86432907383164, + 187.57143712795516, + 186.15722101970812 + ], + [ + 1776.412168922614, + 187.16737538274174, + 187.97549887316865, + 186.3592518923149 + ], + [ + 1780.1417612137466, + 187.36940625534845, + 188.17752974577536, + 186.5612827649216 + ], + [ + 1783.8713535048792, + 187.57143712795516, + 188.37956061838207, + 186.7633136375283 + ], + [ + 1787.6009457960117, + 187.77346800056188, + 188.58159149098879, + 186.96534451013503 + ], + [ + 1791.3305380871443, + 187.97549887316865, + 188.7836223635955, + 187.16737538274174 + ], + [ + 1795.0601303782769, + 188.17752974577536, + 188.9856532362022, + 187.36940625534845 + ], + [ + 1798.7897226694095, + 188.4805760546854, + 189.18768410880892, + 187.77346800056188 + ], + [ + 1802.519314960543, + 188.68260692729217, + 189.38971498141564, + 187.97549887316865 + ], + [ + 1806.2489072516755, + 188.88463779989888, + 189.5917458540224, + 188.17752974577536 + ], + [ + 1809.978499542808, + 189.0866686725056, + 189.79377672662912, + 188.37956061838207 + ], + [ + 1813.7080918339407, + 189.38971498141564, + 190.19783847184254, + 188.58159149098879 + ], + [ + 1817.4376841250732, + 189.5917458540224, + 190.39986934444926, + 188.7836223635955 + ], + [ + 1821.1672764162058, + 189.79377672662912, + 190.60190021705597, + 188.9856532362022 + ], + [ + 1824.8968687073384, + 189.99580759923583, + 190.80393108966268, + 189.18768410880892 + ], + [ + 1828.626460998471, + 190.19783847184254, + 191.00596196226945, + 189.38971498141564 + ], + [ + 1832.3560532896045, + 190.39986934444926, + 191.20799283487617, + 189.5917458540224 + ], + [ + 1836.085645580737, + 190.70291565335936, + 191.41002370748288, + 189.99580759923583 + ], + [ + 1839.8152378718696, + 190.90494652596607, + 191.6120545800896, + 190.19783847184254 + ], + [ + 1843.5448301630022, + 191.10697739857278, + 191.8140854526963, + 190.39986934444926 + ], + [ + 1847.2744224541348, + 191.3090082711795, + 192.01611632530302, + 190.60190021705597 + ], + [ + 1851.0040147452673, + 191.5110391437862, + 192.21814719790973, + 190.80393108966268 + ], + [ + 1854.7336070364, + 191.71307001639292, + 192.42017807051644, + 191.00596196226945 + ], + [ + 1858.4631993275325, + 192.01611632530302, + 192.82423981572992, + 191.20799283487617 + ], + [ + 1862.192791618665, + 192.21814719790973, + 193.02627068833664, + 191.41002370748288 + ], + [ + 1865.9223839097986, + 192.42017807051644, + 193.22830156094335, + 191.6120545800896 + ], + [ + 1869.6519762009311, + 192.6222089431232, + 193.43033243355006, + 191.8140854526963 + ], + [ + 1873.3815684920637, + 192.82423981572992, + 193.63236330615678, + 192.01611632530302 + ], + [ + 1877.1111607831963, + 193.02627068833664, + 193.8343941787635, + 192.21814719790973 + ], + [ + 1880.8407530743289, + 193.22830156094335, + 194.03642505137026, + 192.42017807051644 + ], + [ + 1884.5703453654614, + 193.53134786985345, + 194.23845592397697, + 192.82423981572992 + ], + [ + 1888.299937656594, + 193.73337874246016, + 194.44048679658368, + 193.02627068833664 + ], + [ + 1892.0295299477266, + 193.93540961506687, + 194.6425176691904, + 193.22830156094335 + ], + [ + 1895.75912223886, + 194.1374404876736, + 194.8445485417971, + 193.43033243355006 + ], + [ + 1899.4887145299926, + 194.3394713602803, + 195.04657941440382, + 193.63236330615678 + ], + [ + 1903.2183068211252, + 194.541502232887, + 195.24861028701054, + 193.8343941787635 + ], + [ + 1906.9478991122578, + 194.74353310549373, + 195.45064115961725, + 194.03642505137026 + ], + [ + 1910.6774914033904, + 194.9455639781005, + 195.65267203222402, + 194.23845592397697 + ], + [ + 1914.407083694523, + 195.1475948507072, + 195.85470290483073, + 194.44048679658368 + ], + [ + 1918.1366759856555, + 195.34962572331392, + 196.05673377743744, + 194.6425176691904 + ], + [ + 1921.866268276788, + 195.55165659592063, + 196.25876465004416, + 194.8445485417971 + ], + [ + 1925.5958605679216, + 195.75368746852735, + 196.46079552265087, + 195.04657941440382 + ], + [ + 1929.3254528590542, + 196.05673377743744, + 196.86485726786432, + 195.24861028701054 + ], + [ + 1933.0550451501867, + 196.25876465004416, + 197.06688814047104, + 195.45064115961725 + ], + [ + 1936.7846374413193, + 196.46079552265087, + 197.26891901307775, + 195.65267203222402 + ], + [ + 1940.514229732452, + 196.66282639525758, + 197.4709498856845, + 195.85470290483073 + ], + [ + 1944.2438220235845, + 196.86485726786432, + 197.6729807582912, + 196.05673377743744 + ], + [ + 1947.973414314717, + 197.06688814047104, + 197.87501163089792, + 196.25876465004416 + ], + [ + 1951.7030066058496, + 197.26891901307775, + 198.07704250350463, + 196.46079552265087 + ], + [ + 1955.432598896983, + 197.4709498856845, + 198.27907337611137, + 196.66282639525758 + ], + [ + 1959.1621911881157, + 197.6729807582912, + 198.48110424871808, + 196.86485726786432 + ], + [ + 1962.8917834792483, + 197.87501163089792, + 198.6831351213248, + 197.06688814047104 + ], + [ + 1966.6213757703808, + 198.07704250350463, + 198.8851659939315, + 197.26891901307775 + ], + [ + 1970.3509680615134, + 198.27907337611137, + 199.08719686653825, + 197.4709498856845 + ], + [ + 1974.080560352646, + 198.48110424871808, + 199.28922773914496, + 197.6729807582912 + ], + [ + 1977.8101526437786, + 198.78415055762815, + 199.49125861175168, + 198.07704250350463 + ], + [ + 1981.5397449349111, + 198.98618143023486, + 199.6932894843584, + 198.27907337611137 + ], + [ + 1985.2693372260446, + 199.1882123028416, + 199.89532035696513, + 198.48110424871808 + ], + [ + 1988.9989295171772, + 199.39024317544832, + 200.09735122957184, + 198.6831351213248 + ], + [ + 1992.7285218083098, + 199.59227404805503, + 200.29938210217855, + 198.8851659939315 + ], + [ + 1996.4581140994424, + 199.79430492066177, + 200.50141297478527, + 199.08719686653825 + ], + [ + 2000.187706390575, + 199.99633579326849, + 200.703443847392, + 199.28922773914496 + ], + [ + 2003.9172986817075, + 200.1983666658752, + 200.90547471999872, + 199.49125861175168 + ], + [ + 2007.64689097284, + 200.4003975384819, + 201.10750559260543, + 199.6932894843584 + ], + [ + 2011.3764832639727, + 200.60242841108865, + 201.30953646521218, + 199.89532035696513 + ], + [ + 2015.1060755551061, + 200.80445928369537, + 201.5115673378189, + 200.09735122957184 + ], + [ + 2018.8356678462387, + 201.00649015630208, + 201.7135982104256, + 200.29938210217855 + ], + [ + 2022.5652601373713, + 201.2085210289088, + 201.91562908303231, + 200.50141297478527 + ], + [ + 2026.2948524285039, + 201.41055190151553, + 202.11765995563906, + 200.703443847392 + ], + [ + 2030.0244447196364, + 201.61258277412225, + 202.31969082824577, + 200.90547471999872 + ], + [ + 2033.754037010769, + 201.81461364672896, + 202.52172170085248, + 201.10750559260543 + ], + [ + 2037.4836293019016, + 202.01664451933567, + 202.7237525734592, + 201.30953646521218 + ], + [ + 2041.2132215930342, + 202.2186753919424, + 202.92578344606594, + 201.5115673378189 + ], + [ + 2044.9428138841677, + 202.42070626454912, + 203.12781431867265, + 201.7135982104256 + ], + [ + 2048.6724061753002, + 202.52172170085248, + 203.32984519127936, + 201.7135982104256 + ], + [ + 2052.401998466433, + 202.7237525734592, + 203.53187606388607, + 201.91562908303231 + ], + [ + 2056.1315907575654, + 202.92578344606594, + 203.73390693649282, + 202.11765995563906 + ], + [ + 2059.861183048698, + 203.12781431867265, + 203.93593780909953, + 202.31969082824577 + ], + [ + 2063.5907753398305, + 203.32984519127936, + 204.13796868170624, + 202.52172170085248 + ], + [ + 2067.320367630963, + 203.53187606388607, + 204.33999955431295, + 202.7237525734592 + ], + [ + 2071.0499599220957, + 203.63289150018946, + 204.33999955431295, + 202.92578344606594 + ], + [ + 2074.779552213229, + 203.83492237279617, + 204.5420304269197, + 203.12781431867265 + ], + [ + 2078.5091445043618, + 204.03695324540288, + 204.7440612995264, + 203.32984519127936 + ], + [ + 2082.2387367954943, + 204.2389841180096, + 204.94609217213312, + 203.53187606388607 + ], + [ + 2085.968329086627, + 204.44101499061634, + 205.14812304473986, + 203.73390693649282 + ], + [ + 2089.6979213777595, + 204.64304586322305, + 205.35015391734657, + 203.93593780909953 + ], + [ + 2093.427513668892, + 204.84507673582976, + 205.5521847899533, + 204.13796868170624 + ], + [ + 2097.1571059600246, + 205.04710760843648, + 205.75421566256, + 204.33999955431295 + ], + [ + 2100.886698251157, + 205.24913848104322, + 205.95624653516674, + 204.5420304269197 + ], + [ + 2104.6162905422907, + 205.45116935364993, + 206.15827740777345, + 204.7440612995264 + ], + [ + 2108.3458828334233, + 205.65320022625664, + 206.36030828038017, + 204.94609217213312 + ], + [ + 2112.075475124556, + 205.85523109886336, + 206.56233915298688, + 205.14812304473986 + ], + [ + 2115.8050674156884, + 206.0572619714701, + 206.76437002559362, + 205.35015391734657 + ], + [ + 2119.534659706821, + 206.2592928440768, + 206.96640089820033, + 205.5521847899533 + ], + [ + 2123.2642519979536, + 206.46132371668352, + 207.16843177080705, + 205.75421566256 + ], + [ + 2126.993844289086, + 206.66335458929026, + 207.37046264341376, + 205.95624653516674 + ], + [ + 2130.7234365802187, + 206.86538546189698, + 207.5724935160205, + 206.15827740777345 + ], + [ + 2134.453028871352, + 207.0674163345037, + 207.7745243886272, + 206.36030828038017 + ], + [ + 2138.182621162485, + 207.2694472071104, + 207.97655526123393, + 206.56233915298688 + ], + [ + 2141.9122134536174, + 207.47147807971714, + 208.17858613384064, + 206.76437002559362 + ], + [ + 2145.64180574475, + 207.47147807971714, + 208.17858613384064, + 206.76437002559362 + ], + [ + 2149.3713980358825, + 207.67350895232386, + 208.38061700644738, + 206.96640089820033 + ], + [ + 2153.100990327015, + 207.87553982493057, + 208.5826478790541, + 207.16843177080705 + ], + [ + 2156.8305826181477, + 208.07757069753728, + 208.7846787516608, + 207.37046264341376 + ], + [ + 2160.5601749092802, + 208.27960157014402, + 208.98670962426755, + 207.5724935160205 + ], + [ + 2164.289767200413, + 208.48163244275074, + 209.18874049687426, + 207.7745243886272 + ], + [ + 2168.0193594915463, + 208.68366331535745, + 209.39077136948097, + 207.97655526123393 + ], + [ + 2171.748951782679, + 208.88569418796416, + 209.59280224208769, + 208.17858613384064 + ], + [ + 2175.4785440738115, + 209.0877250605709, + 209.79483311469443, + 208.38061700644738 + ], + [ + 2179.208136364944, + 209.28975593317762, + 209.99686398730114, + 208.5826478790541 + ], + [ + 2182.9377286560766, + 209.49178680578433, + 210.19889485990785, + 208.7846787516608 + ], + [ + 2186.667320947209, + 209.69381767839104, + 210.40092573251457, + 208.98670962426755 + ], + [ + 2190.3969132383418, + 209.89584855099778, + 210.6029566051213, + 209.18874049687426 + ], + [ + 2194.1265055294743, + 209.99686398730114, + 210.6029566051213, + 209.39077136948097 + ], + [ + 2197.856097820608, + 210.0978794236045, + 210.80498747772802, + 209.39077136948097 + ], + [ + 2201.5856901117404, + 210.2999102962112, + 211.00701835033473, + 209.59280224208769 + ], + [ + 2205.315282402873, + 210.50194116881795, + 211.20904922294145, + 209.79483311469443 + ], + [ + 2209.0448746940056, + 210.70397204142466, + 211.4110800955482, + 209.99686398730114 + ], + [ + 2212.774466985138, + 210.90600291403138, + 211.6131109681549, + 210.19889485990785 + ], + [ + 2216.5040592762707, + 211.1080337866381, + 211.8151418407616, + 210.40092573251457 + ], + [ + 2220.2336515674033, + 211.31006465924483, + 212.01717271336832, + 210.6029566051213 + ], + [ + 2223.963243858536, + 211.51209553185154, + 212.21920358597507, + 210.80498747772802 + ], + [ + 2227.6928361496693, + 211.71412640445826, + 212.42123445858178, + 211.00701835033473 + ], + [ + 2231.422428440802, + 211.8151418407616, + 212.42123445858178, + 211.20904922294145 + ], + [ + 2235.1520207319345, + 212.01717271336832, + 212.6232653311885, + 211.4110800955482 + ], + [ + 2238.881613023067, + 212.1181881496717, + 212.82529620379523, + 211.4110800955482 + ], + [ + 2242.6112053141997, + 212.32021902227842, + 213.02732707640195, + 211.6131109681549 + ], + [ + 2246.340797605332, + 212.52224989488514, + 213.22935794900866, + 211.8151418407616 + ], + [ + 2250.070389896465, + 212.72428076749185, + 213.43138882161537, + 212.01717271336832 + ], + [ + 2253.7999821875974, + 212.9263116400986, + 213.6334196942221, + 212.21920358597507 + ], + [ + 2257.529574478731, + 213.1283425127053, + 213.83545056682883, + 212.42123445858178 + ], + [ + 2261.2591667698634, + 213.33037338531201, + 214.03748143943554, + 212.6232653311885 + ], + [ + 2264.988759060996, + 213.43138882161537, + 214.03748143943554, + 212.82529620379523 + ], + [ + 2268.7183513521286, + 213.6334196942221, + 214.23951231204225, + 213.02732707640195 + ], + [ + 2272.447943643261, + 213.73443513052547, + 214.441543184649, + 213.02732707640195 + ], + [ + 2276.1775359343937, + 213.93646600313218, + 214.6435740572557, + 213.22935794900866 + ], + [ + 2279.9071282255263, + 214.1384968757389, + 214.84560492986242, + 213.43138882161537 + ], + [ + 2283.636720516659, + 214.34052774834564, + 215.04763580246913, + 213.6334196942221 + ], + [ + 2287.3663128077924, + 214.54255862095235, + 215.24966667507587, + 213.83545056682883 + ], + [ + 2291.095905098925, + 214.74458949355906, + 215.45169754768258, + 214.03748143943554 + ], + [ + 2294.8254973900575, + 214.84560492986242, + 215.45169754768258, + 214.23951231204225 + ], + [ + 2298.55508968119, + 215.04763580246913, + 215.6537284202893, + 214.441543184649 + ], + [ + 2302.2846819723227, + 215.24966667507587, + 215.85575929289604, + 214.6435740572557 + ], + [ + 2306.0142742634553, + 215.35068211137923, + 216.05779016550275, + 214.6435740572557 + ], + [ + 2309.743866554588, + 215.55271298398594, + 216.25982103810946, + 214.84560492986242 + ], + [ + 2313.4734588457204, + 215.75474385659265, + 216.46185191071618, + 215.04763580246913 + ], + [ + 2317.203051136854, + 215.9567747291994, + 216.66388278332292, + 215.24966667507587 + ], + [ + 2320.9326434279865, + 216.1588056018061, + 216.86591365592963, + 215.45169754768258 + ], + [ + 2324.662235719119, + 216.25982103810946, + 216.86591365592963, + 215.6537284202893 + ], + [ + 2328.3918280102516, + 216.46185191071618, + 217.06794452853634, + 215.85575929289604 + ], + [ + 2332.121420301384, + 216.56286734701953, + 217.26997540114306, + 215.85575929289604 + ], + [ + 2335.851012592517, + 216.76489821962628, + 217.4720062737498, + 216.05779016550275 + ], + [ + 2339.5806048836494, + 216.966929092233, + 217.6740371463565, + 216.25982103810946 + ], + [ + 2343.310197174782, + 217.1689599648397, + 217.87606801896322, + 216.46185191071618 + ], + [ + 2347.0397894659154, + 217.26997540114306, + 217.87606801896322, + 216.66388278332292 + ], + [ + 2350.769381757048, + 217.4720062737498, + 218.07809889156994, + 216.86591365592963 + ], + [ + 2354.4989740481806, + 217.6740371463565, + 218.28012976417668, + 217.06794452853634 + ], + [ + 2358.228566339313, + 217.77505258265987, + 218.4821606367834, + 217.06794452853634 + ], + [ + 2361.9581586304457, + 217.97708345526658, + 218.6841915093901, + 217.26997540114306 + ], + [ + 2365.6877509215783, + 218.17911432787332, + 218.88622238199682, + 217.4720062737498 + ], + [ + 2369.417343212711, + 218.38114520048003, + 219.08825325460356, + 217.6740371463565 + ], + [ + 2373.1469355038435, + 218.4821606367834, + 219.08825325460356, + 217.87606801896322 + ], + [ + 2376.876527794977, + 218.6841915093901, + 219.29028412721027, + 218.07809889156994 + ], + [ + 2380.6061200861095, + 218.88622238199682, + 219.49231499981698, + 218.28012976417668 + ], + [ + 2384.335712377242, + 218.9872378183002, + 219.69434587242372, + 218.28012976417668 + ], + [ + 2388.0653046683747, + 219.1892686909069, + 219.89637674503044, + 218.4821606367834 + ], + [ + 2391.7948969595072, + 219.39129956351363, + 220.09840761763715, + 218.6841915093901 + ], + [ + 2395.52448925064, + 219.49231499981698, + 220.09840761763715, + 218.88622238199682 + ], + [ + 2399.2540815417724, + 219.69434587242372, + 220.30043849024386, + 219.08825325460356 + ], + [ + 2402.983673832905, + 219.89637674503044, + 220.5024693628506, + 219.29028412721027 + ], + [ + 2406.7132661240385, + 219.9973921813338, + 220.70450023545732, + 219.29028412721027 + ], + [ + 2410.442858415171, + 220.1994230539405, + 220.90653110806403, + 219.49231499981698 + ], + [ + 2414.1724507063036, + 220.40145392654722, + 221.10856198067074, + 219.69434587242372 + ], + [ + 2417.902042997436, + 220.5024693628506, + 221.10856198067074, + 219.89637674503044 + ], + [ + 2421.6316352885688, + 220.60348479915396, + 221.10856198067074, + 220.09840761763715 + ], + [ + 2425.3612275797013, + 220.60348479915396, + 221.10856198067074, + 220.09840761763715 + ], + [ + 2429.090819870834, + 220.60348479915396, + 221.10856198067074, + 220.09840761763715 + ], + [ + 2432.8204121619665, + 220.40145392654722, + 221.10856198067074, + 219.69434587242372 + ], + [ + 2436.5500044531, + 219.89637674503044, + 220.90653110806403, + 218.88622238199682 + ], + [ + 2440.2795967442325, + 219.49231499981698, + 220.90653110806403, + 218.07809889156994 + ], + [ + 2444.009189035365, + 218.6841915093901, + 220.70450023545732, + 216.66388278332292 + ], + [ + 2447.7387813264977, + 215.85575929289604, + 220.30043849024386, + 204.5420304269197 + ], + [ + 2451.4683736176303, + 211.4110800955482, + 219.89637674503044, + 202.92578344606594 + ], + [ + 2455.197965908763, + 210.6029566051213, + 219.29028412721027, + 201.91562908303231 + ], + [ + 2458.9275581998954, + 209.89584855099778, + 218.6841915093901, + 201.10750559260543 + ], + [ + 2462.657150491028, + 208.98670962426755, + 217.4720062737498, + 200.50141297478527 + ], + [ + 2466.3867427821615, + 207.5724935160205, + 215.24966667507587, + 199.89532035696513 + ], + [ + 2470.116335073294, + 201.2085210289088, + 203.32984519127936, + 199.08719686653825 + ], + [ + 2473.8459273644266, + 200.4003975384819, + 202.31969082824577, + 198.48110424871808 + ], + [ + 2477.575519655559, + 199.6932894843584, + 201.5115673378189, + 197.87501163089792 + ], + [ + 2481.305111946692, + 199.1882123028416, + 200.90547471999872, + 197.4709498856845 + ], + [ + 2485.0347042378244, + 198.6831351213248, + 200.29938210217855, + 197.06688814047104 + ], + [ + 2488.764296528957, + 198.17805793980799, + 199.49125861175168, + 196.86485726786432 + ], + [ + 2492.4938888200895, + 197.77399619459456, + 198.8851659939315, + 196.66282639525758 + ], + [ + 2496.223481111222, + 197.3699344493811, + 198.27907337611137, + 196.46079552265087 + ], + [ + 2499.9530734023556, + 197.06688814047104, + 197.87501163089792, + 196.25876465004416 + ], + [ + 2503.682665693488, + 196.86485726786432, + 197.4709498856845, + 196.25876465004416 + ], + [ + 2507.4122579846207, + 196.76384183156097, + 197.26891901307775, + 196.25876465004416 + ], + [ + 2511.1418502757533, + 196.96587270416768, + 197.6729807582912, + 196.25876465004416 + ], + [ + 2514.871442566886, + 197.1679035767744, + 197.87501163089792, + 196.46079552265087 + ], + [ + 2518.6010348580185, + 197.3699344493811, + 198.27907337611137, + 196.46079552265087 + ], + [ + 2522.330627149151, + 197.6729807582912, + 198.6831351213248, + 196.66282639525758 + ], + [ + 2526.0602194402836, + 198.07704250350463, + 199.28922773914496, + 196.86485726786432 + ], + [ + 2529.789811731417, + 198.48110424871808, + 199.6932894843584, + 197.26891901307775 + ], + [ + 2533.5194040225497, + 198.98618143023486, + 200.29938210217855, + 197.6729807582912 + ], + [ + 2537.2489963136823, + 199.49125861175168, + 200.90547471999872, + 198.07704250350463 + ], + [ + 2540.978588604815, + 199.99633579326849, + 201.5115673378189, + 198.48110424871808 + ], + [ + 2544.7081808959474, + 200.60242841108865, + 202.31969082824577, + 198.8851659939315 + ], + [ + 2548.43777318708, + 201.30953646521218, + 203.12781431867265, + 199.49125861175168 + ], + [ + 2552.1673654782126, + 201.91562908303231, + 203.93593780909953, + 199.89532035696513 + ], + [ + 2555.896957769345, + 202.52172170085248, + 204.5420304269197, + 200.50141297478527 + ], + [ + 2559.6265500604786, + 203.0267988823693, + 204.94609217213312, + 201.10750559260543 + ], + [ + 2563.356142351611, + 203.63289150018946, + 205.35015391734657, + 201.91562908303231 + ], + [ + 2567.085734642744, + 204.03695324540288, + 205.35015391734657, + 202.7237525734592 + ], + [ + 2570.8153269338763, + 204.44101499061634, + 205.5521847899533, + 203.32984519127936 + ], + [ + 2574.544919225009, + 204.94609217213312, + 205.75421566256, + 204.13796868170624 + ], + [ + 2578.2745115161415, + 205.24913848104322, + 205.95624653516674, + 204.5420304269197 + ], + [ + 2582.004103807274, + 205.35015391734657, + 205.95624653516674, + 204.7440612995264 + ], + [ + 2585.7336960984067, + 205.45116935364993, + 205.95624653516674, + 204.94609217213312 + ], + [ + 2589.46328838954, + 205.35015391734657, + 205.75421566256, + 204.94609217213312 + ], + [ + 2593.1928806806727, + 205.35015391734657, + 205.75421566256, + 204.94609217213312 + ], + [ + 2596.9224729718053, + 205.24913848104322, + 205.75421566256, + 204.7440612995264 + ], + [ + 2600.652065262938, + 205.24913848104322, + 205.75421566256, + 204.7440612995264 + ], + [ + 2604.3816575540704, + 205.04710760843648, + 205.5521847899533, + 204.5420304269197 + ], + [ + 2608.111249845203, + 204.94609217213312, + 205.5521847899533, + 204.33999955431295 + ], + [ + 2611.8408421363356, + 204.7440612995264, + 205.35015391734657, + 204.13796868170624 + ], + [ + 2615.570434427468, + 204.7440612995264, + 205.35015391734657, + 204.13796868170624 + ], + [ + 2619.3000267186017, + 204.5420304269197, + 205.14812304473986, + 203.93593780909953 + ], + [ + 2623.0296190097342, + 204.33999955431295, + 204.94609217213312, + 203.73390693649282 + ], + [ + 2626.759211300867, + 204.2389841180096, + 204.94609217213312, + 203.53187606388607 + ], + [ + 2630.4888035919994, + 204.03695324540288, + 204.7440612995264, + 203.32984519127936 + ], + [ + 2634.218395883132, + 203.83492237279617, + 204.5420304269197, + 203.12781431867265 + ], + [ + 2637.9479881742645, + 203.73390693649282, + 204.33999955431295, + 203.12781431867265 + ], + [ + 2641.677580465397, + 203.53187606388607, + 204.13796868170624, + 202.92578344606594 + ], + [ + 2645.4071727565297, + 203.32984519127936, + 203.93593780909953, + 202.7237525734592 + ], + [ + 2649.136765047663, + 203.32984519127936, + 203.93593780909953, + 202.7237525734592 + ], + [ + 2652.8663573387958, + 203.12781431867265, + 203.73390693649282, + 202.52172170085248 + ], + [ + 2656.5959496299283, + 203.0267988823693, + 203.53187606388607, + 202.52172170085248 + ], + [ + 2660.325541921061, + 203.0267988823693, + 203.53187606388607, + 202.52172170085248 + ], + [ + 2664.0551342121935, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2667.784726503326, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2671.5143187944586, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2675.243911085591, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2678.9735033767247, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2682.7030956678573, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2686.43268795899, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2690.1622802501224, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2693.891872541255, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2697.6214648323876, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2701.35105712352, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2705.0806494146527, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2708.810241705786, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2712.539833996919, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2716.2694262880514, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2719.999018579184, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2723.7286108703165, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2727.458203161449, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2731.1877954525817, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2734.9173877437142, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2738.6469800348477, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2742.3765723259803, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2746.106164617113, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2749.8357569082455, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2753.565349199378, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2757.2949414905106, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2761.024533781643, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2764.7541260727758, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2768.4837183639092, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2772.213310655042, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2775.9429029461744, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2779.672495237307, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2783.4020875284396, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2787.131679819572, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2790.8612721107047, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2794.5908644018373, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2798.32045669297, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2802.0500489841033, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2805.779641275236, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2809.5092335663685, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2813.238825857501, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2816.9684181486336, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2820.698010439766, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2824.427602730899, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2828.1571950220314, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2831.886787313165, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2835.6163796042974, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2839.34597189543, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2843.0755641865626, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2846.805156477695, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2850.5347487688277, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2854.2643410599603, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2857.993933351093, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2861.7235256422264, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2865.453117933359, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2869.1827102244915, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2872.912302515624, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2876.6418948067567, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2880.3714870978893, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2884.101079389022, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2887.8306716801544, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2891.560263971288, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2895.2898562624205, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2899.019448553553, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2902.7490408446856, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2906.478633135818, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2910.208225426951, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2913.9378177180834, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2917.667410009216, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2921.3970023003494, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2925.126594591482, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2928.8561868826146, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2932.585779173747, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2936.3153714648797, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2940.0449637560123, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2943.774556047145, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2947.5041483382774, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2951.233740629411, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2954.9633329205435, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2958.692925211676, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2962.4225175028087, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2966.1521097939412, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2969.881702085074, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2973.6112943762064, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2977.340886667339, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2981.0704789584724, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2984.800071249605, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2988.5296635407376, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2992.25925583187, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2995.9888481230028, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 2999.7184404141353, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 3003.448032705268, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 3007.1776249964005, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 3010.907217287534, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 3014.6368095786665, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 3018.366401869799, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 3022.0959941609317, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 3025.8255864520643, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 3029.555178743197, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 3033.2847710343294, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 3037.014363325462, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 3040.7439556165955, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 3044.473547907728, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 3048.2031401988606, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 3051.932732489993, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 3055.662324781126, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 3059.3919170722584, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 3063.121509363391, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 3066.8511016545235, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 3070.580693945657, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 3074.3102862367896, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 3078.039878527922, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 3081.7694708190547, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 3085.4990631101873, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 3089.22865540132, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 3092.9582476924525, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 3096.687839983585, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 3100.4174322747185, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 3104.147024565851, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 3107.8766168569837, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 3111.6062091481162, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 3115.335801439249, + 202.92578344606594, + 203.32984519127936, + 202.52172170085248 + ], + [ + 3119.0653937303814, + 201.61258277412225, + 203.32984519127936, + 199.89532035696513 + ], + [ + 3122.794986021514, + 198.07704250350463, + 203.32984519127936, + 192.82423981572992 + ], + [ + 3126.5245783126466, + 194.541502232887, + 203.32984519127936, + 185.7531592744947 + ], + [ + 3130.254170603779, + 190.90494652596607, + 203.32984519127936, + 178.48004786065275 + ], + [ + 3133.9837628949126, + 187.36940625534845, + 203.32984519127936, + 171.40896731941757 + ], + [ + 3137.713355186045, + 183.2277733669107, + 202.31969082824577, + 164.13585590557562 + ], + [ + 3141.4429474771778, + 176.15669282567546, + 195.24861028701054, + 157.0647753643404 + ], + [ + 3145.1725397683103, + 169.0856122844403, + 188.17752974577536, + 149.99369482310522 + ], + [ + 3148.902132059443, + 161.81250087059834, + 180.9044183319334, + 142.72058340926327 + ], + [ + 3152.6317243505755, + 154.7414203293631, + 173.83333779069818, + 135.64950286802804 + ], + [ + 3156.361316641708, + 147.46830891552122, + 166.5602263768563, + 128.37639145418615 + ], + [ + 3160.0909089328406, + 140.397228374286, + 159.48914583562106, + 121.30531091295092 + ], + [ + 3163.820501223974, + 133.22513239674743, + 152.2160344217791, + 114.23423037171568 + ], + [ + 3167.5500935151067, + 126.05303641920887, + 145.14495388054394, + 106.9611189578738 + ], + [ + 3171.2796858062393, + 119.38601762318706, + 138.0738733393087, + 100.69816190706547 + ], + [ + 3175.009278097372, + 114.03219949910897, + 130.80076192546676, + 97.26363707275118 + ], + [ + 3178.7388703885044, + 109.18345855654769, + 123.72968138423158, + 94.63723572886386 + ], + [ + 3182.468462679637, + 104.33471761398641, + 116.45656997038964, + 92.21286525758319 + ], + [ + 3186.1980549707696, + 99.68800754403185, + 109.3854894291544, + 89.99052565890929 + ], + [ + 3189.927647261902, + 95.243328346684, + 102.31440888791923, + 88.17224780544876 + ], + [ + 3193.6572395530357, + 92.31388069388657, + 98.2737914357848, + 86.35396995198829 + ], + [ + 3197.3868318441682, + 89.99052565890929, + 95.44535921929071, + 84.53569209852782 + ], + [ + 3201.116424135301, + 87.97021693284205, + 93.0209887480101, + 82.91944511767406 + ], + [ + 3204.8460164264334, + 86.15193907938158, + 90.79864914933614, + 81.50522900942701 + ], + [ + 3208.575608717566, + 84.43467666222443, + 88.77834042326896, + 80.09101290117997 + ], + [ + 3212.3052010086985, + 82.81842968137067, + 86.96006256980849, + 78.67679679293292 + ], + [ + 3216.034793299831, + 81.20218270051691, + 85.14178471634796, + 77.26258068468587 + ], + [ + 3219.7643855909637, + 79.78796659226987, + 83.5255377354942, + 76.0503954490456 + ], + [ + 3223.493977882097, + 78.4747659203262, + 82.11132162724715, + 74.83821021340526 + ], + [ + 3227.2235701732297, + 77.16156524838254, + 80.69710551900016, + 73.62602497776493 + ], + [ + 3230.9531624643623, + 75.94938001274221, + 79.28288941075311, + 72.6158706147313 + ], + [ + 3234.682754755495, + 74.63617934079855, + 77.86867330250607, + 71.40368537909097 + ], + [ + 3238.4123470466275, + 73.52500954146154, + 76.65648806686573, + 70.39353101605741 + ], + [ + 3242.14193933776, + 72.4138397421246, + 75.4443028312254, + 69.38337665302379 + ], + [ + 3245.8715316288926, + 71.30266994278765, + 74.23211759558507, + 68.37322228999022 + ], + [ + 3249.601123920025, + 70.1915001434507, + 73.01993235994479, + 67.3630679269566 + ], + [ + 3253.3307162111587, + 69.28236121672046, + 72.00977799691117, + 66.5549444365297 + ], + [ + 3257.0603085022913, + 68.17119141738345, + 70.79759276127083, + 65.54479007349613 + ], + [ + 3260.789900793424, + 67.26205249065322, + 69.78743839823721, + 64.73666658306922 + ], + [ + 3264.5194930845564, + 66.35291356392298, + 68.77728403520365, + 63.92854309264237 + ], + [ + 3268.249085375689, + 65.54479007349613, + 67.96916054477674, + 63.12041960221546 + ], + [ + 3271.9786776668216, + 64.6356511467659, + 66.95900618174318, + 62.31229611178861 + ], + [ + 3275.708269957954, + 63.7265122200356, + 65.94885181870956, + 61.504172621361704 + ], + [ + 3279.4378622490867, + 62.91838872960875, + 65.14072832828265, + 60.69604913093485 + ], + [ + 3283.16745454022, + 62.11026523918184, + 64.3326048378558, + 59.887925640507945 + ], + [ + 3286.897046831353, + 61.30214174875499, + 63.52448134742889, + 59.079802150081036 + ], + [ + 3290.6266391224854, + 60.59503369463147, + 62.71635785700204, + 58.4737095322609 + ], + [ + 3294.356231413618, + 59.78691020420456, + 61.90823436657513, + 57.66558604183405 + ], + [ + 3298.0858237047505, + 59.079802150081036, + 61.10011087614828, + 57.05949342401385 + ], + [ + 3301.815415995883, + 58.271678659654185, + 60.29198738572137, + 56.251369933587 + ], + [ + 3305.5450082870157, + 57.56457060553066, + 59.48386389529452, + 55.645277315766805 + ], + [ + 3309.2746005781482, + 56.95847798771052, + 58.877771277474324, + 55.039184697946666 + ], + [ + 3313.0041928692817, + 56.251369933587, + 58.06964778704747, + 54.43309208012647 + ], + [ + 3316.7337851604143, + 55.645277315766805, + 57.46355516922728, + 53.82699946230633 + ], + [ + 3320.463377451547, + 54.93816926164328, + 56.655431678800426, + 53.220906844486194 + ], + [ + 3324.1929697426795, + 54.33207664382314, + 56.04933906098023, + 52.614814226666 + ], + [ + 3327.922562033812, + 53.72598402600295, + 55.44324644316009, + 52.00872160884586 + ], + [ + 3331.6521543249446, + 53.11989140818281, + 54.83715382533995, + 51.402628991025665 + ], + [ + 3335.381746616077, + 52.614814226666, + 54.23106120751976, + 50.99856724581224 + ], + [ + 3339.1113389072098, + 52.00872160884586, + 53.62496858969962, + 50.3924746279921 + ], + [ + 3342.8409311983432, + 51.402628991025665, + 53.018875971879424, + 49.786382010171906 + ], + [ + 3346.570523489476, + 50.89755180950891, + 52.412783354059286, + 49.38232026495848 + ], + [ + 3350.3001157806084, + 50.291459191688716, + 51.80669073623915, + 48.77622764713834 + ], + [ + 3354.029708071741, + 49.786382010171906, + 51.20059811841895, + 48.37216590192486 + ], + [ + 3357.7593003628735, + 49.28130482865515, + 50.79653637320553, + 47.76607328410472 + ], + [ + 3361.488892654006, + 48.77622764713834, + 50.19044375538539, + 47.362011538891295 + ], + [ + 3365.2184849451387, + 48.170135029318146, + 49.58435113756519, + 46.7559189210711 + ], + [ + 3368.9480772362713, + 47.76607328410472, + 49.18028939235177, + 46.351857175857674 + ], + [ + 3372.6776695274048, + 47.26099610258791, + 48.57419677453163, + 45.94779543064425 + ], + [ + 3376.4072618185373, + 46.856934357374485, + 48.170135029318146, + 45.54373368543082 + ], + [ + 3380.13685410967, + 46.351857175857674, + 47.56404241149801, + 45.13967194021734 + ], + [ + 3383.8664464008025, + 45.846779994340864, + 47.15998066628458, + 44.5335793223972 + ], + [ + 3387.596038691935, + 45.44271824912744, + 46.7559189210711, + 44.129517577183776 + ], + [ + 3391.3256309830676, + 45.03865650391401, + 46.351857175857674, + 43.725455831970294 + ], + [ + 3395.0552232742, + 44.5335793223972, + 45.745764558037536, + 43.32139408675687 + ], + [ + 3398.784815565333, + 44.129517577183776, + 45.34170281282405, + 42.91733234154344 + ], + [ + 3402.5144078564663, + 43.725455831970294, + 44.93764106761063, + 42.51327059633002 + ], + [ + 3406.244000147599, + 43.42240952306025, + 44.5335793223972, + 42.311239723723304 + ], + [ + 3409.9735924387314, + 43.01834777784677, + 44.129517577183776, + 41.90717797850982 + ], + [ + 3413.703184729864, + 42.614286032633345, + 43.725455831970294, + 41.503116233296396 + ], + [ + 3417.4327770209966, + 42.21022428741992, + 43.32139408675687, + 41.09905448808297 + ], + [ + 3421.162369312129, + 41.80616254220649, + 42.91733234154344, + 40.69499274286949 + ], + [ + 3424.8919616032617, + 41.503116233296396, + 42.51327059633002, + 40.492961870262775 + ], + [ + 3428.6215538943943, + 41.09905448808297, + 42.109208851116534, + 40.08890012504935 + ], + [ + 3432.351146185527, + 40.69499274286949, + 41.70514710590311, + 39.684838379835924 + ], + [ + 3436.0807384766604, + 40.492961870262775, + 41.503116233296396, + 39.48280750722921 + ], + [ + 3439.810330767793, + 40.08890012504935, + 41.09905448808297, + 39.07874576201573 + ], + [ + 3443.5399230589255, + 39.684838379835924, + 40.69499274286949, + 38.6746840168023 + ], + [ + 3447.269515350058, + 39.48280750722921, + 40.492961870262775, + 38.47265314419559 + ], + [ + 3450.9991076411907, + 39.07874576201573, + 40.08890012504935, + 38.068591398982164 + ], + [ + 3454.7286999323233, + 38.77569945310569, + 39.684838379835924, + 37.86656052637545 + ], + [ + 3458.458292223456, + 38.47265314419559, + 39.48280750722921, + 37.46249878116197 + ], + [ + 3462.1878845145884, + 38.16960683528549, + 39.07874576201573, + 37.260467908555256 + ], + [ + 3465.917476805722, + 37.96757596267878, + 38.876714889409016, + 37.05843703594854 + ], + [ + 3469.6470690968545, + 37.563514217465354, + 38.47265314419559, + 36.65437529073512 + ], + [ + 3473.376661387987, + 37.36148334485864, + 38.27062227158888, + 36.452344418128405 + ], + [ + 3477.1062536791196, + 37.05843703594854, + 37.86656052637545, + 36.25031354552169 + ], + [ + 3480.835845970252, + 36.755390727038446, + 37.66452965376868, + 35.84625180030821 + ], + [ + 3484.5654382613848, + 36.452344418128405, + 37.260467908555256, + 35.6442209277015 + ], + [ + 3488.2950305525173, + 36.25031354552169, + 37.05843703594854, + 35.442190055094784 + ], + [ + 3492.02462284365, + 36.04828267291492, + 36.85640616334183, + 35.24015918248807 + ], + [ + 3495.7542151347834, + 35.6442209277015, + 36.452344418128405, + 34.836097437274645 + ], + [ + 3499.483807425916, + 35.442190055094784, + 36.25031354552169, + 34.634066564667876 + ], + [ + 3503.2133997170486, + 35.24015918248807, + 36.04828267291492, + 34.43203569206116 + ], + [ + 3506.942992008181, + 35.03812830988136, + 35.84625180030821, + 34.23000481945445 + ], + [ + 3510.6725842993137, + 34.836097437274645, + 35.6442209277015, + 34.02797394684774 + ], + [ + 3514.4021765904463, + 34.53305112836455, + 35.24015918248807, + 33.825943074241025 + ], + [ + 3518.131768881579, + 34.331020255757835, + 35.03812830988136, + 33.62391220163431 + ], + [ + 3521.8613611727114, + 34.12898938315112, + 34.836097437274645, + 33.4218813290276 + ], + [ + 3525.590953463845, + 33.92695851054441, + 34.634066564667876, + 33.219850456420886 + ], + [ + 3529.3205457549775, + 33.72492763793764, + 34.43203569206116, + 33.017819583814116 + ], + [ + 3533.05013804611, + 33.52289676533093, + 34.23000481945445, + 32.815788711207404 + ], + [ + 3536.7797303372427, + 33.320865892724214, + 34.02797394684774, + 32.61375783860069 + ], + [ + 3540.5093226283752, + 33.1188350201175, + 33.825943074241025, + 32.41172696599398 + ], + [ + 3544.238914919508, + 32.91680414751079, + 33.62391220163431, + 32.209696093387265 + ], + [ + 3547.9685072106404, + 32.714773274904076, + 33.4218813290276, + 32.00766522078055 + ], + [ + 3551.698099501773, + 32.51274240229736, + 33.219850456420886, + 31.80563434817384 + ], + [ + 3555.4276917929064, + 32.31071152969059, + 33.017819583814116, + 31.603603475567127 + ], + [ + 3559.157284084039, + 32.10868065708388, + 32.815788711207404, + 31.401572602960357 + ], + [ + 3562.8868763751716, + 32.00766522078055, + 32.61375783860069, + 31.401572602960357 + ], + [ + 3566.616468666304, + 31.80563434817384, + 32.41172696599398, + 31.199541730353644 + ], + [ + 3570.3460609574367, + 31.603603475567127, + 32.209696093387265, + 30.99751085774693 + ], + [ + 3574.0756532485693, + 31.502588039263742, + 32.209696093387265, + 30.79547998514022 + ], + [ + 3577.805245539702, + 31.401572602960357, + 32.00766522078055, + 30.79547998514022 + ], + [ + 3581.5348378308345, + 31.199541730353644, + 31.80563434817384, + 30.593449112533506 + ], + [ + 3585.264430121968, + 30.99751085774693, + 31.603603475567127, + 30.391418239926793 + ], + [ + 3588.9940224131005, + 30.99751085774693, + 31.603603475567127, + 30.391418239926793 + ], + [ + 3592.723614704233, + 30.79547998514022, + 31.401572602960357, + 30.18938736732008 + ], + [ + 3596.4532069953657, + 30.593449112533506, + 31.199541730353644, + 29.98735649471331 + ], + [ + 3600.1827992864983, + 30.49243367623012, + 30.99751085774693, + 29.98735649471331 + ], + [ + 3603.912391577631, + 30.391418239926793, + 30.99751085774693, + 29.785325622106598 + ], + [ + 3607.6419838687634, + 30.18938736732008, + 30.79547998514022, + 29.583294749499885 + ], + [ + 3611.371576159896, + 30.088371931016695, + 30.593449112533506, + 29.583294749499885 + ], + [ + 3615.1011684510295, + 29.98735649471331, + 30.593449112533506, + 29.381263876893172 + ], + [ + 3618.830760742162, + 29.886341058409982, + 30.391418239926793, + 29.381263876893172 + ], + [ + 3622.5603530332946, + 29.785325622106598, + 30.391418239926793, + 29.17923300428646 + ], + [ + 3626.289945324427, + 29.68431018580327, + 30.18938736732008, + 29.17923300428646 + ], + [ + 3630.01953761556, + 29.482279313196557, + 29.98735649471331, + 28.977202131679746 + ], + [ + 3633.7491299066924, + 29.482279313196557, + 29.98735649471331, + 28.977202131679746 + ], + [ + 3637.478722197825, + 29.280248440589844, + 29.785325622106598, + 28.775171259073034 + ], + [ + 3641.2083144889575, + 29.280248440589844, + 29.785325622106598, + 28.775171259073034 + ], + [ + 3644.937906780091, + 29.078217567983074, + 29.583294749499885, + 28.57314038646632 + ], + [ + 3648.6674990712236, + 28.977202131679746, + 29.583294749499885, + 28.37110951385955 + ], + [ + 3652.397091362356, + 28.87618669537636, + 29.381263876893172, + 28.37110951385955 + ], + [ + 3656.1266836534887, + 28.775171259073034, + 29.381263876893172, + 28.16907864125284 + ], + [ + 3659.8562759446213, + 28.67415582276965, + 29.17923300428646, + 28.16907864125284 + ], + [ + 3663.585868235754, + 28.57314038646632, + 29.17923300428646, + 27.967047768646125 + ], + [ + 3667.3154605268865, + 28.37110951385955, + 28.977202131679746, + 27.765016896039413 + ], + [ + 3671.045052818019, + 28.270094077556223, + 28.775171259073034, + 27.765016896039413 + ], + [ + 3674.7746451091525, + 28.16907864125284, + 28.775171259073034, + 27.5629860234327 + ], + [ + 3678.504237400285, + 28.06806320494951, + 28.57314038646632, + 27.5629860234327 + ], + [ + 3682.2338296914177, + 27.967047768646125, + 28.57314038646632, + 27.360955150825987 + ], + [ + 3685.9634219825502, + 27.866032332342797, + 28.37110951385955, + 27.360955150825987 + ], + [ + 3689.693014273683, + 27.765016896039413, + 28.37110951385955, + 27.158924278219274 + ], + [ + 3693.4226065648154, + 27.664001459736028, + 28.16907864125284, + 27.158924278219274 + ], + [ + 3697.152198855948, + 27.5629860234327, + 28.16907864125284, + 26.956893405612504 + ], + [ + 3700.8817911470805, + 27.461970587129315, + 27.967047768646125, + 26.956893405612504 + ], + [ + 3704.611383438214, + 27.360955150825987, + 27.967047768646125, + 26.75486253300579 + ], + [ + 3708.3409757293466, + 27.259939714522602, + 27.765016896039413, + 26.75486253300579 + ], + [ + 3712.070568020479, + 27.259939714522602, + 27.765016896039413, + 26.75486253300579 + ], + [ + 3715.8001603116118, + 27.05790884191589, + 27.5629860234327, + 26.55283166039908 + ], + [ + 3719.5297526027443, + 27.05790884191589, + 27.5629860234327, + 26.55283166039908 + ], + [ + 3723.259344893877, + 26.855877969309176, + 27.360955150825987, + 26.350800787792366 + ], + [ + 3726.9889371850095, + 26.855877969309176, + 27.360955150825987, + 26.350800787792366 + ], + [ + 3730.718529476142, + 26.75486253300579, + 27.360955150825987, + 26.148769915185653 + ], + [ + 3734.4481217672756, + 26.653847096702464, + 27.158924278219274, + 26.148769915185653 + ], + [ + 3738.177714058408, + 26.653847096702464, + 27.158924278219274, + 26.148769915185653 + ], + [ + 3741.9073063495407, + 26.45181622409575, + 26.956893405612504, + 25.94673904257894 + ], + [ + 3745.6368986406733, + 26.45181622409575, + 26.956893405612504, + 25.94673904257894 + ], + [ + 3749.366490931806, + 26.249785351489038, + 26.75486253300579, + 25.744708169972228 + ], + [ + 3753.0960832229384, + 26.249785351489038, + 26.75486253300579, + 25.744708169972228 + ], + [ + 3756.825675514071, + 26.249785351489038, + 26.75486253300579, + 25.744708169972228 + ], + [ + 3760.5552678052036, + 26.04775447888227, + 26.55283166039908, + 25.542677297365515 + ], + [ + 3764.284860096336, + 26.04775447888227, + 26.55283166039908, + 25.542677297365515 + ], + [ + 3768.0144523874696, + 25.845723606275556, + 26.350800787792366, + 25.340646424758745 + ], + [ + 3771.744044678602, + 25.845723606275556, + 26.350800787792366, + 25.340646424758745 + ], + [ + 3775.473636969735, + 25.845723606275556, + 26.350800787792366, + 25.340646424758745 + ], + [ + 3779.2032292608674, + 25.643692733668843, + 26.148769915185653, + 25.138615552152032 + ], + [ + 3782.932821552, + 25.643692733668843, + 26.148769915185653, + 25.138615552152032 + ], + [ + 3786.6624138431325, + 25.542677297365515, + 26.148769915185653, + 24.93658467954532 + ], + [ + 3790.392006134265, + 25.44166186106213, + 25.94673904257894, + 24.93658467954532 + ], + [ + 3794.1215984253977, + 25.44166186106213, + 25.94673904257894, + 24.93658467954532 + ], + [ + 3797.851190716531, + 25.239630988455417, + 25.744708169972228, + 24.734553806938607 + ], + [ + 3801.5807830076637, + 25.239630988455417, + 25.744708169972228, + 24.734553806938607 + ], + [ + 3805.3103752987963, + 25.239630988455417, + 25.744708169972228, + 24.734553806938607 + ], + [ + 3809.039967589929, + 25.037600115848704, + 25.542677297365515, + 24.532522934331894 + ], + [ + 3812.7695598810615, + 25.037600115848704, + 25.542677297365515, + 24.532522934331894 + ], + [ + 3816.499152172194, + 25.037600115848704, + 25.542677297365515, + 24.532522934331894 + ], + [ + 3820.2287444633266, + 24.83556924324199, + 25.340646424758745, + 24.33049206172518 + ], + [ + 3823.958336754459, + 24.83556924324199, + 25.340646424758745, + 24.33049206172518 + ], + [ + 3827.6879290455927, + 24.83556924324199, + 25.340646424758745, + 24.33049206172518 + ], + [ + 3831.4175213367253, + 24.633538370635222, + 25.138615552152032, + 24.128461189118468 + ], + [ + 3835.147113627858, + 24.633538370635222, + 25.138615552152032, + 24.128461189118468 + ], + [ + 3838.8767059189904, + 24.633538370635222, + 25.138615552152032, + 24.128461189118468 + ], + [ + 3842.606298210123, + 24.43150749802851, + 24.93658467954532, + 23.926430316511755 + ], + [ + 3846.3358905012556, + 24.43150749802851, + 24.93658467954532, + 23.926430316511755 + ], + [ + 3850.065482792388, + 24.43150749802851, + 24.93658467954532, + 23.926430316511755 + ], + [ + 3853.7950750835207, + 24.33049206172518, + 24.734553806938607, + 23.926430316511755 + ], + [ + 3857.524667374654, + 24.229476625421796, + 24.734553806938607, + 23.724399443904986 + ], + [ + 3861.254259665787, + 24.229476625421796, + 24.734553806938607, + 23.724399443904986 + ], + [ + 3864.9838519569194, + 24.229476625421796, + 24.734553806938607, + 23.724399443904986 + ], + [ + 3868.713444248052, + 24.027445752815083, + 24.532522934331894, + 23.522368571298273 + ], + [ + 3872.4430365391845, + 24.027445752815083, + 24.532522934331894, + 23.522368571298273 + ], + [ + 3876.172628830317, + 24.027445752815083, + 24.532522934331894, + 23.522368571298273 + ], + [ + 3879.9022211214497, + 23.926430316511755, + 24.33049206172518, + 23.522368571298273 + ], + [ + 3883.6318134125822, + 23.82541488020837, + 24.33049206172518, + 23.32033769869156 + ], + [ + 3887.3614057037157, + 23.82541488020837, + 24.33049206172518, + 23.32033769869156 + ], + [ + 3891.0909979948483, + 23.82541488020837, + 24.33049206172518, + 23.32033769869156 + ], + [ + 3894.820590285981, + 23.623384007601658, + 24.128461189118468, + 23.118306826084847 + ], + [ + 3898.5501825771134, + 23.623384007601658, + 24.128461189118468, + 23.118306826084847 + ], + [ + 3902.279774868246, + 23.623384007601658, + 24.128461189118468, + 23.118306826084847 + ], + [ + 3906.0093671593786, + 23.522368571298273, + 23.926430316511755, + 23.118306826084847 + ], + [ + 3909.738959450511, + 23.421353134994945, + 23.926430316511755, + 22.916275953478134 + ], + [ + 3913.4685517416438, + 23.421353134994945, + 23.926430316511755, + 22.916275953478134 + ], + [ + 3917.1981440327772, + 23.421353134994945, + 23.926430316511755, + 22.916275953478134 + ], + [ + 3920.92773632391, + 23.32033769869156, + 23.724399443904986, + 22.916275953478134 + ], + [ + 3924.6573286150424, + 23.219322262388232, + 23.724399443904986, + 22.71424508087142 + ], + [ + 3928.386920906175, + 23.219322262388232, + 23.724399443904986, + 22.71424508087142 + ], + [ + 3932.1165131973075, + 23.219322262388232, + 23.724399443904986, + 22.71424508087142 + ], + [ + 3935.84610548844, + 23.118306826084847, + 23.522368571298273, + 22.71424508087142 + ], + [ + 3939.5756977795727, + 23.017291389781462, + 23.522368571298273, + 22.51221420826471 + ], + [ + 3943.3052900707053, + 23.017291389781462, + 23.522368571298273, + 22.51221420826471 + ], + [ + 3947.0348823618388, + 23.017291389781462, + 23.522368571298273, + 22.51221420826471 + ], + [ + 3950.7644746529713, + 22.916275953478134, + 23.32033769869156, + 22.51221420826471 + ], + [ + 3954.494066944104, + 22.81526051717475, + 23.32033769869156, + 22.31018333565794 + ], + [ + 3958.2236592352365, + 22.81526051717475, + 23.32033769869156, + 22.31018333565794 + ], + [ + 3961.953251526369, + 22.81526051717475, + 23.32033769869156, + 22.31018333565794 + ], + [ + 3965.6828438175016, + 22.71424508087142, + 23.118306826084847, + 22.31018333565794 + ], + [ + 3969.412436108634, + 22.613229644568037, + 23.118306826084847, + 22.108152463051226 + ], + [ + 3973.142028399767, + 22.613229644568037, + 23.118306826084847, + 22.108152463051226 + ], + [ + 3976.8716206909003, + 22.613229644568037, + 23.118306826084847, + 22.108152463051226 + ], + [ + 3980.601212982033, + 22.613229644568037, + 23.118306826084847, + 22.108152463051226 + ], + [ + 3984.3308052731654, + 22.51221420826471, + 22.916275953478134, + 22.108152463051226 + ], + [ + 3988.060397564298, + 22.411198771961324, + 22.916275953478134, + 21.906121590444513 + ], + [ + 3991.7899898554306, + 22.411198771961324, + 22.916275953478134, + 21.906121590444513 + ], + [ + 3995.519582146563, + 22.411198771961324, + 22.916275953478134, + 21.906121590444513 + ], + [ + 3999.2491744376957, + 22.31018333565794, + 22.71424508087142, + 21.906121590444513 + ], + [ + 4002.9787667288283, + 22.31018333565794, + 22.71424508087142, + 21.906121590444513 + ], + [ + 4006.708359019962, + 22.20916789935461, + 22.71424508087142, + 21.7040907178378 + ], + [ + 4010.4379513110944, + 22.20916789935461, + 22.71424508087142, + 21.7040907178378 + ], + [ + 4014.167543602227, + 22.20916789935461, + 22.71424508087142, + 21.7040907178378 + ], + [ + 4017.8971358933595, + 22.108152463051226, + 22.51221420826471, + 21.7040907178378 + ], + [ + 4021.626728184492, + 22.108152463051226, + 22.51221420826471, + 21.7040907178378 + ], + [ + 4025.3563204756247, + 22.0071370267479, + 22.51221420826471, + 21.502059845231088 + ], + [ + 4029.0859127667572, + 22.0071370267479, + 22.51221420826471, + 21.502059845231088 + ], + [ + 4032.81550505789, + 22.0071370267479, + 22.51221420826471, + 21.502059845231088 + ], + [ + 4036.5450973490233, + 21.906121590444513, + 22.31018333565794, + 21.502059845231088 + ], + [ + 4040.274689640156, + 21.906121590444513, + 22.31018333565794, + 21.502059845231088 + ], + [ + 4044.0042819312885, + 21.805106154141185, + 22.31018333565794, + 21.300028972624375 + ], + [ + 4047.733874222421, + 21.805106154141185, + 22.31018333565794, + 21.300028972624375 + ], + [ + 4051.4634665135536, + 21.805106154141185, + 22.31018333565794, + 21.300028972624375 + ], + [ + 4055.193058804686, + 21.7040907178378, + 22.108152463051226, + 21.300028972624375 + ], + [ + 4058.9226510958188, + 21.7040907178378, + 22.108152463051226, + 21.300028972624375 + ], + [ + 4062.6522433869513, + 21.603075281534416, + 22.108152463051226, + 21.097998100017662 + ], + [ + 4066.381835678084, + 21.603075281534416, + 22.108152463051226, + 21.097998100017662 + ], + [ + 4070.1114279692174, + 21.603075281534416, + 22.108152463051226, + 21.097998100017662 + ], + [ + 4073.84102026035, + 21.603075281534416, + 22.108152463051226, + 21.097998100017662 + ], + [ + 4077.5706125514826, + 21.502059845231088, + 21.906121590444513, + 21.097998100017662 + ], + [ + 4081.300204842615, + 21.502059845231088, + 21.906121590444513, + 21.097998100017662 + ], + [ + 4085.0297971337477, + 21.401044408927703, + 21.906121590444513, + 20.89596722741095 + ], + [ + 4088.7593894248803, + 21.401044408927703, + 21.906121590444513, + 20.89596722741095 + ], + [ + 4092.488981716013, + 21.401044408927703, + 21.906121590444513, + 20.89596722741095 + ], + [ + 4096.218574007145, + 21.300028972624375, + 21.7040907178378, + 20.89596722741095 + ], + [ + 4099.948166298279, + 21.300028972624375, + 21.7040907178378, + 20.89596722741095 + ], + [ + 4103.6777585894115, + 21.300028972624375, + 21.7040907178378, + 20.89596722741095 + ], + [ + 4107.407350880544, + 21.19901353632099, + 21.7040907178378, + 20.69393635480418 + ], + [ + 4111.136943171677, + 21.19901353632099, + 21.7040907178378, + 20.69393635480418 + ], + [ + 4114.866535462809, + 21.19901353632099, + 21.7040907178378, + 20.69393635480418 + ], + [ + 4118.596127753942, + 21.19901353632099, + 21.7040907178378, + 20.69393635480418 + ], + [ + 4122.325720045074, + 21.097998100017662, + 21.502059845231088, + 20.69393635480418 + ], + [ + 4126.055312336207, + 21.097998100017662, + 21.502059845231088, + 20.69393635480418 + ], + [ + 4129.78490462734, + 20.996982663714277, + 21.502059845231088, + 20.491905482197467 + ], + [ + 4133.514496918473, + 20.996982663714277, + 21.502059845231088, + 20.491905482197467 + ], + [ + 4137.244089209606, + 20.996982663714277, + 21.502059845231088, + 20.491905482197467 + ], + [ + 4140.973681500738, + 20.996982663714277, + 21.502059845231088, + 20.491905482197467 + ], + [ + 4144.703273791871, + 20.89596722741095, + 21.300028972624375, + 20.491905482197467 + ], + [ + 4148.432866083003, + 20.89596722741095, + 21.300028972624375, + 20.491905482197467 + ], + [ + 4152.162458374136, + 20.89596722741095, + 21.300028972624375, + 20.491905482197467 + ], + [ + 4155.8920506652685, + 20.794951791107565, + 21.300028972624375, + 20.289874609590754 + ], + [ + 4159.621642956402, + 20.794951791107565, + 21.300028972624375, + 20.289874609590754 + ], + [ + 4163.3512352475345, + 20.794951791107565, + 21.300028972624375, + 20.289874609590754 + ], + [ + 4167.080827538667, + 20.794951791107565, + 21.300028972624375, + 20.289874609590754 + ], + [ + 4170.8104198298, + 20.69393635480418, + 21.097998100017662, + 20.289874609590754 + ], + [ + 4174.540012120932, + 20.69393635480418, + 21.097998100017662, + 20.289874609590754 + ], + [ + 4178.269604412065, + 20.69393635480418, + 21.097998100017662, + 20.289874609590754 + ], + [ + 4181.999196703197, + 20.69393635480418, + 21.097998100017662, + 20.289874609590754 + ], + [ + 4185.72878899433, + 20.59292091850085, + 21.097998100017662, + 20.08784373698404 + ], + [ + 4189.4583812854635, + 20.59292091850085, + 21.097998100017662, + 20.08784373698404 + ], + [ + 4193.187973576596, + 20.59292091850085, + 21.097998100017662, + 20.08784373698404 + ], + [ + 4196.917565867729, + 20.59292091850085, + 21.097998100017662, + 20.08784373698404 + ], + [ + 4200.647158158861, + 20.491905482197467, + 20.89596722741095, + 20.08784373698404 + ], + [ + 4204.376750449994, + 20.491905482197467, + 20.89596722741095, + 20.08784373698404 + ], + [ + 4208.106342741126, + 20.491905482197467, + 20.89596722741095, + 20.08784373698404 + ], + [ + 4211.835935032259, + 20.491905482197467, + 20.89596722741095, + 20.08784373698404 + ], + [ + 4215.5655273233915, + 20.39089004589414, + 20.89596722741095, + 19.88581286437733 + ], + [ + 4219.295119614525, + 20.39089004589414, + 20.89596722741095, + 19.88581286437733 + ], + [ + 4223.024711905658, + 20.39089004589414, + 20.89596722741095, + 19.88581286437733 + ], + [ + 4226.75430419679, + 20.39089004589414, + 20.89596722741095, + 19.88581286437733 + ], + [ + 4230.483896487923, + 20.289874609590754, + 20.69393635480418, + 19.88581286437733 + ], + [ + 4234.213488779055, + 20.289874609590754, + 20.69393635480418, + 19.88581286437733 + ], + [ + 4237.943081070188, + 20.289874609590754, + 20.69393635480418, + 19.88581286437733 + ], + [ + 4241.67267336132, + 20.289874609590754, + 20.69393635480418, + 19.88581286437733 + ], + [ + 4245.402265652453, + 20.289874609590754, + 20.69393635480418, + 19.88581286437733 + ], + [ + 4249.1318579435865, + 20.188859173287426, + 20.69393635480418, + 19.683781991770616 + ], + [ + 4252.861450234719, + 20.188859173287426, + 20.69393635480418, + 19.683781991770616 + ], + [ + 4256.591042525852, + 20.188859173287426, + 20.69393635480418, + 19.683781991770616 + ], + [ + 4260.320634816984, + 20.188859173287426, + 20.69393635480418, + 19.683781991770616 + ], + [ + 4264.050227108117, + 20.08784373698404, + 20.491905482197467, + 19.683781991770616 + ], + [ + 4267.779819399249, + 20.08784373698404, + 20.491905482197467, + 19.683781991770616 + ], + [ + 4271.509411690382, + 20.08784373698404, + 20.491905482197467, + 19.683781991770616 + ], + [ + 4275.2390039815145, + 20.08784373698404, + 20.491905482197467, + 19.683781991770616 + ], + [ + 4278.968596272648, + 20.08784373698404, + 20.491905482197467, + 19.683781991770616 + ], + [ + 4282.698188563781, + 20.08784373698404, + 20.491905482197467, + 19.683781991770616 + ], + [ + 4286.427780854913, + 19.986828300680656, + 20.491905482197467, + 19.481751119163903 + ], + [ + 4290.157373146046, + 19.986828300680656, + 20.491905482197467, + 19.481751119163903 + ], + [ + 4293.886965437178, + 19.986828300680656, + 20.491905482197467, + 19.481751119163903 + ], + [ + 4297.616557728311, + 19.986828300680656, + 20.491905482197467, + 19.481751119163903 + ], + [ + 4301.3461500194435, + 19.88581286437733, + 20.289874609590754, + 19.481751119163903 + ], + [ + 4305.075742310576, + 19.88581286437733, + 20.289874609590754, + 19.481751119163903 + ], + [ + 4308.80533460171, + 19.88581286437733, + 20.289874609590754, + 19.481751119163903 + ], + [ + 4312.534926892842, + 19.88581286437733, + 20.289874609590754, + 19.481751119163903 + ], + [ + 4316.264519183975, + 19.88581286437733, + 20.289874609590754, + 19.481751119163903 + ], + [ + 4319.994111475107, + 19.88581286437733, + 20.289874609590754, + 19.481751119163903 + ], + [ + 4323.72370376624, + 19.88581286437733, + 20.289874609590754, + 19.481751119163903 + ], + [ + 4327.453296057372, + 19.784797428073944, + 20.289874609590754, + 19.279720246557133 + ], + [ + 4331.182888348505, + 19.784797428073944, + 20.289874609590754, + 19.279720246557133 + ], + [ + 4334.912480639638, + 19.784797428073944, + 20.289874609590754, + 19.279720246557133 + ], + [ + 4338.642072930771, + 19.784797428073944, + 20.289874609590754, + 19.279720246557133 + ], + [ + 4342.371665221904, + 19.784797428073944, + 20.289874609590754, + 19.279720246557133 + ], + [ + 4346.101257513036, + 19.784797428073944, + 20.289874609590754, + 19.279720246557133 + ], + [ + 4349.830849804169, + 19.683781991770616, + 20.08784373698404, + 19.279720246557133 + ], + [ + 4353.560442095301, + 19.683781991770616, + 20.08784373698404, + 19.279720246557133 + ], + [ + 4357.290034386434, + 19.683781991770616, + 20.08784373698404, + 19.279720246557133 + ], + [ + 4361.0196266775665, + 19.683781991770616, + 20.08784373698404, + 19.279720246557133 + ], + [ + 4364.749218968699, + 19.683781991770616, + 20.08784373698404, + 19.279720246557133 + ], + [ + 4368.478811259833, + 19.683781991770616, + 20.08784373698404, + 19.279720246557133 + ], + [ + 4372.208403550965, + 19.683781991770616, + 20.08784373698404, + 19.279720246557133 + ], + [ + 4375.937995842098, + 19.683781991770616, + 20.08784373698404, + 19.279720246557133 + ], + [ + 4379.66758813323, + 19.58276655546723, + 20.08784373698404, + 19.07768937395042 + ], + [ + 4383.397180424363, + 19.58276655546723, + 20.08784373698404, + 19.07768937395042 + ], + [ + 4387.1267727154955, + 19.58276655546723, + 20.08784373698404, + 19.07768937395042 + ], + [ + 4390.856365006628, + 19.58276655546723, + 20.08784373698404, + 19.07768937395042 + ], + [ + 4394.585957297761, + 19.58276655546723, + 20.08784373698404, + 19.07768937395042 + ], + [ + 4398.315549588893, + 19.58276655546723, + 20.08784373698404, + 19.07768937395042 + ], + [ + 4402.045141880027, + 19.481751119163903, + 19.88581286437733, + 19.07768937395042 + ], + [ + 4405.774734171159, + 19.481751119163903, + 19.88581286437733, + 19.07768937395042 + ], + [ + 4409.504326462292, + 19.481751119163903, + 19.88581286437733, + 19.07768937395042 + ], + [ + 4413.233918753424, + 19.481751119163903, + 19.88581286437733, + 19.07768937395042 + ], + [ + 4416.963511044557, + 19.481751119163903, + 19.88581286437733, + 19.07768937395042 + ], + [ + 4420.69310333569, + 19.481751119163903, + 19.88581286437733, + 19.07768937395042 + ], + [ + 4424.422695626822, + 19.481751119163903, + 19.88581286437733, + 19.07768937395042 + ], + [ + 4428.152287917955, + 19.481751119163903, + 19.88581286437733, + 19.07768937395042 + ], + [ + 4431.881880209088, + 19.481751119163903, + 19.88581286437733, + 19.07768937395042 + ], + [ + 4435.611472500221, + 19.481751119163903, + 19.88581286437733, + 19.07768937395042 + ], + [ + 4439.341064791353, + 19.481751119163903, + 19.88581286437733, + 19.07768937395042 + ], + [ + 4443.070657082486, + 19.481751119163903, + 19.88581286437733, + 19.07768937395042 + ], + [ + 4446.8002493736185, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 4450.529841664751, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 4454.259433955884, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 4457.989026247016, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 4461.71861853815, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 4465.448210829282, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 4469.177803120415, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 4472.907395411547, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 4476.63698770268, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4480.366579993813, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4484.096172284945, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4487.825764576078, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4491.555356867211, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4495.284949158344, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4499.014541449476, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4502.744133740609, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4506.4737260317415, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4510.203318322874, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4513.932910614007, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4517.662502905139, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4521.392095196273, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4525.121687487405, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4528.851279778538, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4532.5808720696705, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4536.310464360803, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4540.040056651936, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4543.769648943068, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4547.499241234201, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4551.228833525334, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4554.958425816467, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4558.688018107599, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4562.417610398732, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4566.147202689865, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 4569.876794980997, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 4573.60638727213, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 4577.335979563262, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 4581.065571854396, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 4584.795164145528, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 4588.524756436661, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 4592.2543487277935, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 4595.983941018926, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 4599.713533310059, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 4603.443125601191, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 4607.172717892324, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 4610.902310183457, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 4614.63190247459, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 4618.3614947657225, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 4622.091087056855, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 4625.820679347988, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 4629.55027163912, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 4633.279863930253, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 4637.009456221385, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 4640.739048512519, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 4644.468640803651, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 4648.198233094784, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 4651.927825385917, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 4655.657417677049, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 4659.387009968182, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 4663.116602259314, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 4666.846194550447, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 4670.57578684158, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 4674.305379132713, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 4678.0349714238455, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 4681.764563714978, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 4685.494156006111, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 4689.223748297243, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 4692.953340588376, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 4696.682932879508, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 4700.412525170641, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 4704.142117461774, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 4707.871709752907, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4711.60130204404, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4715.330894335172, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4719.060486626305, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4722.790078917437, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4726.51967120857, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4730.2492634997025, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4733.978855790836, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4737.7084480819685, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4741.438040373101, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4745.167632664234, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4748.897224955366, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4752.626817246499, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4756.356409537631, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4760.086001828764, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4763.8155941198975, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4767.54518641103, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4771.274778702163, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4775.004370993295, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4778.733963284428, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4782.46355557556, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4786.193147866693, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4789.9227401578255, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4793.652332448959, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4797.381924740092, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 4801.111517031224, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 4804.841109322357, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 4808.570701613489, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 4812.300293904622, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 4816.029886195754, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 4819.759478486887, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 4823.4890707780205, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 4827.218663069153, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 4830.948255360286, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 4834.677847651418, + 19.481751119163903, + 19.88581286437733, + 19.07768937395042 + ], + [ + 4838.407439942551, + 19.481751119163903, + 19.88581286437733, + 19.07768937395042 + ] + ], + "Tc": [ + [ + 53.34053041931156, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 57.07012271044414, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 60.79971500157717, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 64.52930729270975, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 68.25889958384232, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 71.9884918749749, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 75.71808416610793, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 79.4476764572405, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 83.17726874837308, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 86.90686103950566, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 90.63645333063869, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 94.36604562177126, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 98.09563791290384, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 101.82523020403642, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 105.55482249516945, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 109.28441478630202, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 113.0140070774346, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 116.74359936856717, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 120.4731916597002, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 124.20278395083278, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 127.93237624196536, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 131.66196853309793, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 135.39156082423096, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 139.12115311536354, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 142.85074540649612, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 146.5803376976287, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 150.30992998876172, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 154.0395222798943, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 157.76911457102688, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 161.49870686215945, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 165.22829915329248, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 168.95789144442506, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 172.68748373555763, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 176.4170760266902, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 180.14666831782324, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 183.87626060895582, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 187.6058529000884, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 191.33544519122097, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 195.065037482354, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 198.79462977348658, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 202.52422206461915, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 206.25381435575173, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 209.98340664688476, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 213.71299893801734, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 217.4425912291499, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 221.1721835202825, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 224.90177581141552, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 228.6313681025481, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 232.36096039368067, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 236.09055268481325, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 239.82014497594628, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 243.54973726707885, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 247.27932955821143, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 251.008921849344, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 254.73851414047658, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 258.4681064316096, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 262.1976987227422, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 265.92729101387476, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 269.65688330500734, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 273.3864755961404, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 277.11606788727295, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 280.8456601784055, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 284.5752524695381, + 18.471596756130282, + 19.07768937395042, + 17.865504138310143 + ], + [ + 288.30484476067113, + 18.471596756130282, + 19.07768937395042, + 17.865504138310143 + ], + [ + 292.0344370518037, + 18.26956588352357, + 18.875658501343707, + 17.663473265703374 + ], + [ + 295.7640293429363, + 18.168550447220184, + 18.673627628736995, + 17.663473265703374 + ], + [ + 299.49362163406886, + 18.168550447220184, + 18.673627628736995, + 17.663473265703374 + ], + [ + 303.2232139252019, + 17.96651957461347, + 18.471596756130282, + 17.46144239309666 + ], + [ + 306.95280621633447, + 17.96651957461347, + 18.471596756130282, + 17.46144239309666 + ], + [ + 310.68239850746704, + 17.96651957461347, + 18.471596756130282, + 17.46144239309666 + ], + [ + 314.4119907985996, + 17.96651957461347, + 18.471596756130282, + 17.46144239309666 + ], + [ + 318.14158308973265, + 17.76448870200676, + 18.26956588352357, + 17.259411520489948 + ], + [ + 321.8711753808652, + 17.76448870200676, + 18.26956588352357, + 17.259411520489948 + ], + [ + 325.6007676719978, + 17.76448870200676, + 18.26956588352357, + 17.259411520489948 + ], + [ + 329.3303599631304, + 17.76448870200676, + 18.26956588352357, + 17.259411520489948 + ], + [ + 333.0599522542634, + 17.76448870200676, + 18.26956588352357, + 17.259411520489948 + ], + [ + 336.789544545396, + 17.76448870200676, + 18.26956588352357, + 17.259411520489948 + ], + [ + 340.51913683652856, + 17.663473265703374, + 18.067535010916856, + 17.259411520489948 + ], + [ + 344.24872912766114, + 17.562457829400046, + 18.067535010916856, + 17.057380647883235 + ], + [ + 347.97832141879417, + 17.562457829400046, + 18.067535010916856, + 17.057380647883235 + ], + [ + 351.70791370992674, + 17.562457829400046, + 18.067535010916856, + 17.057380647883235 + ], + [ + 355.4375060010593, + 17.562457829400046, + 18.067535010916856, + 17.057380647883235 + ], + [ + 359.1670982921919, + 17.562457829400046, + 18.067535010916856, + 17.057380647883235 + ], + [ + 362.8966905833249, + 17.562457829400046, + 18.067535010916856, + 17.057380647883235 + ], + [ + 366.6262828744575, + 17.562457829400046, + 18.067535010916856, + 17.057380647883235 + ], + [ + 370.3558751655901, + 17.562457829400046, + 18.067535010916856, + 17.057380647883235 + ], + [ + 374.08546745672265, + 17.562457829400046, + 18.067535010916856, + 17.057380647883235 + ], + [ + 377.8150597478557, + 17.46144239309666, + 17.865504138310143, + 17.057380647883235 + ], + [ + 381.54465203898826, + 17.46144239309666, + 17.865504138310143, + 17.057380647883235 + ], + [ + 385.27424433012084, + 17.46144239309666, + 17.865504138310143, + 17.057380647883235 + ], + [ + 389.0038366212534, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 392.73342891238644, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 396.463021203519, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 400.1926134946516, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 403.9222057857842, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 407.6517980769172, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 411.3813903680498, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 415.11098265918235, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 418.84057495031493, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 422.57016724144796, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 426.29975953258054, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 430.0293518237131, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 433.7589441148457, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 437.4885364059787, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 441.2181286971113, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 444.9477209882439, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 448.67731327937645, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 452.4069055705095, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 456.13649786164206, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 459.86609015277463, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 463.5956824439072, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 467.32527473504024, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 471.0548670261728, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 474.7844593173054, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 478.51405160843797, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 482.243643899571, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 485.9732361907036, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 489.70282848183615, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 493.4324207729687, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 497.16201306410176, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 500.89160535523433, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 504.6211976463669, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 508.3507899374995, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 512.0803822286325, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 515.8099745197651, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 519.5395668108977, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 523.2691591020302, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 526.9987513931633, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 530.7283436842959, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 534.4579359754284, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 538.187528266561, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 541.917120557694, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 545.6467128488266, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 549.3763051399592, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 553.1058974310918, + 17.46144239309666, + 17.865504138310143, + 17.057380647883235 + ], + [ + 556.8354897222248, + 17.562457829400046, + 18.067535010916856, + 17.057380647883235 + ], + [ + 560.5650820133574, + 17.562457829400046, + 18.067535010916856, + 17.057380647883235 + ], + [ + 564.29467430449, + 17.562457829400046, + 18.067535010916856, + 17.057380647883235 + ], + [ + 568.0242665956225, + 17.562457829400046, + 18.067535010916856, + 17.057380647883235 + ], + [ + 571.7538588867551, + 17.562457829400046, + 18.067535010916856, + 17.057380647883235 + ], + [ + 575.4834511778881, + 17.76448870200676, + 18.26956588352357, + 17.259411520489948 + ], + [ + 579.2130434690207, + 17.76448870200676, + 18.26956588352357, + 17.259411520489948 + ], + [ + 582.9426357601533, + 17.76448870200676, + 18.26956588352357, + 17.259411520489948 + ], + [ + 586.6722280512859, + 17.76448870200676, + 18.26956588352357, + 17.259411520489948 + ], + [ + 590.4018203424189, + 17.76448870200676, + 18.26956588352357, + 17.259411520489948 + ], + [ + 594.1314126335515, + 17.96651957461347, + 18.471596756130282, + 17.46144239309666 + ], + [ + 597.861004924684, + 17.96651957461347, + 18.471596756130282, + 17.46144239309666 + ], + [ + 601.5905972158166, + 17.96651957461347, + 18.471596756130282, + 17.46144239309666 + ], + [ + 605.3201895069496, + 17.96651957461347, + 18.471596756130282, + 17.46144239309666 + ], + [ + 609.0497817980822, + 17.96651957461347, + 18.471596756130282, + 17.46144239309666 + ], + [ + 612.7793740892148, + 18.168550447220184, + 18.673627628736995, + 17.663473265703374 + ], + [ + 616.5089663803474, + 18.168550447220184, + 18.673627628736995, + 17.663473265703374 + ], + [ + 620.2385586714804, + 18.168550447220184, + 18.673627628736995, + 17.663473265703374 + ], + [ + 623.968150962613, + 18.168550447220184, + 18.673627628736995, + 17.663473265703374 + ], + [ + 627.6977432537456, + 18.168550447220184, + 18.673627628736995, + 17.663473265703374 + ], + [ + 631.4273355448781, + 18.168550447220184, + 18.673627628736995, + 17.663473265703374 + ], + [ + 635.1569278360112, + 18.168550447220184, + 18.673627628736995, + 17.663473265703374 + ], + [ + 638.8865201271437, + 18.168550447220184, + 18.673627628736995, + 17.663473265703374 + ], + [ + 642.6161124182763, + 18.168550447220184, + 18.673627628736995, + 17.663473265703374 + ], + [ + 646.3457047094089, + 18.168550447220184, + 18.673627628736995, + 17.663473265703374 + ], + [ + 650.0752970005419, + 18.168550447220184, + 18.673627628736995, + 17.663473265703374 + ], + [ + 653.8048892916745, + 18.168550447220184, + 18.673627628736995, + 17.663473265703374 + ], + [ + 657.5344815828071, + 18.168550447220184, + 18.673627628736995, + 17.663473265703374 + ], + [ + 661.2640738739397, + 18.168550447220184, + 18.673627628736995, + 17.663473265703374 + ], + [ + 664.9936661650727, + 18.168550447220184, + 18.673627628736995, + 17.663473265703374 + ], + [ + 668.7232584562053, + 18.168550447220184, + 18.673627628736995, + 17.663473265703374 + ], + [ + 672.4528507473378, + 18.168550447220184, + 18.673627628736995, + 17.663473265703374 + ], + [ + 676.1824430384704, + 18.168550447220184, + 18.673627628736995, + 17.663473265703374 + ], + [ + 679.9120353296034, + 18.168550447220184, + 18.673627628736995, + 17.663473265703374 + ], + [ + 683.641627620736, + 18.168550447220184, + 18.673627628736995, + 17.663473265703374 + ], + [ + 687.3712199118686, + 18.168550447220184, + 18.673627628736995, + 17.663473265703374 + ], + [ + 691.1008122030012, + 18.168550447220184, + 18.673627628736995, + 17.663473265703374 + ], + [ + 694.8304044941342, + 18.26956588352357, + 18.673627628736995, + 17.865504138310143 + ], + [ + 698.5599967852668, + 18.26956588352357, + 18.673627628736995, + 17.865504138310143 + ], + [ + 702.2895890763994, + 18.26956588352357, + 18.673627628736995, + 17.865504138310143 + ], + [ + 706.0191813675319, + 18.26956588352357, + 18.673627628736995, + 17.865504138310143 + ], + [ + 709.748773658665, + 18.26956588352357, + 18.673627628736995, + 17.865504138310143 + ], + [ + 713.4783659497975, + 18.26956588352357, + 18.673627628736995, + 17.865504138310143 + ], + [ + 717.2079582409301, + 18.26956588352357, + 18.673627628736995, + 17.865504138310143 + ], + [ + 720.9375505320627, + 18.26956588352357, + 18.673627628736995, + 17.865504138310143 + ], + [ + 724.6671428231957, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 728.3967351143283, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 732.1263274054609, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 735.8559196965934, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 739.5855119877265, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 743.315104278859, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 747.0446965699916, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 750.7742888611242, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 754.5038811522572, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 758.2334734433898, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 761.9630657345224, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 765.692658025655, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 769.422250316788, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 773.1518426079206, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 776.8814348990531, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 780.6110271901857, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 784.3406194813188, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 788.0702117724513, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 791.7998040635839, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 795.5293963547165, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 799.2589886458495, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 802.9885809369821, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 806.7181732281147, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 810.4477655192472, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 814.1773578103803, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 817.9069501015128, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 821.6365423926454, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 825.366134683778, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 829.095726974911, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 832.8253192660436, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 836.5549115571762, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 840.2845038483088, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 844.0140961394418, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 847.7436884305744, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 851.4732807217069, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 855.2028730128395, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 858.9324653039725, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 862.6620575951051, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 866.3916498862377, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 870.1212421773703, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 873.8508344685033, + 18.471596756130282, + 18.875658501343707, + 18.067535010916856 + ], + [ + 877.5804267596359, + 18.471596756130282, + 18.875658501343707, + 18.067535010916856 + ], + [ + 881.3100190507685, + 18.471596756130282, + 18.875658501343707, + 18.067535010916856 + ], + [ + 885.039611341901, + 18.471596756130282, + 18.875658501343707, + 18.067535010916856 + ], + [ + 888.7692036330336, + 18.471596756130282, + 18.875658501343707, + 18.067535010916856 + ], + [ + 892.4987959241666, + 18.471596756130282, + 18.875658501343707, + 18.067535010916856 + ], + [ + 896.2283882152992, + 18.471596756130282, + 18.875658501343707, + 18.067535010916856 + ], + [ + 899.9579805064318, + 18.471596756130282, + 18.875658501343707, + 18.067535010916856 + ], + [ + 903.6875727975644, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 907.4171650886974, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 911.14675737983, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 914.8763496709626, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 918.6059419620951, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 922.3355342532282, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 926.0651265443607, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 929.7947188354933, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 933.5243111266259, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 937.2539034177589, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 940.9834957088915, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 944.7130880000241, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 948.4426802911566, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 952.1722725822897, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 955.9018648734223, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 959.6314571645548, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 963.3610494556874, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 967.0906417468204, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 970.820234037953, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 974.5498263290856, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 978.2794186202182, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 982.0090109113512, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 985.7386032024838, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 989.4681954936163, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 993.1977877847489, + 18.471596756130282, + 19.07768937395042, + 17.865504138310143 + ], + [ + 996.927380075882, + 18.26956588352357, + 19.07768937395042, + 17.46144239309666 + ], + [ + 1000.6569723670145, + 18.168550447220184, + 19.07768937395042, + 17.259411520489948 + ], + [ + 1004.3865646581471, + 17.96651957461347, + 18.875658501343707, + 17.057380647883235 + ], + [ + 1008.1161569492797, + 17.562457829400046, + 18.471596756130282, + 16.65331890266981 + ], + [ + 1011.8457492404127, + 17.360426956793333, + 18.26956588352357, + 16.451288030063097 + ], + [ + 1015.5753415315453, + 17.15839608418662, + 18.067535010916856, + 16.249257157456327 + ], + [ + 1019.3049338226779, + 16.855349775276522, + 17.865504138310143, + 15.845195412242902 + ], + [ + 1023.0345261138104, + 16.95636521157985, + 18.26956588352357, + 15.643164539636189 + ], + [ + 1026.7641184049435, + 17.259411520489948, + 19.07768937395042, + 15.441133667029476 + ], + [ + 1030.493710696076, + 17.46144239309666, + 19.07768937395042, + 15.845195412242902 + ], + [ + 1034.2233029872086, + 17.76448870200676, + 19.07768937395042, + 16.451288030063097 + ], + [ + 1037.9528952783412, + 18.067535010916856, + 19.07768937395042, + 17.057380647883235 + ], + [ + 1041.6824875694742, + 18.471596756130282, + 19.07768937395042, + 17.865504138310143 + ], + [ + 1045.4120798606068, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1049.1416721517394, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1052.871264442872, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1056.600856734005, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1060.3304490251376, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1064.0600413162701, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1067.7896336074027, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1071.5192258985358, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1075.2488181896683, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1078.978410480801, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1082.7080027719335, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1086.4375950630665, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1090.167187354199, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1093.8967796453317, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1097.6263719364642, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1101.3559642275973, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1105.0855565187298, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1108.8151488098624, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1112.544741100995, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1116.274333392128, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1120.0039256832606, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1123.7335179743932, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1127.4631102655258, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1131.1927025566588, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1134.9222948477914, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1138.651887138924, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1142.3814794300565, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1146.1110717211895, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1149.8406640123221, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1153.5702563034547, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1157.2998485945873, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1161.0294408857203, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1164.7590331768529, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1168.4886254679855, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1172.218217759118, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1175.947810050251, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1179.6774023413836, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1183.4069946325162, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1187.1365869236488, + 18.370581319826897, + 18.673627628736995, + 18.067535010916856 + ], + [ + 1190.8661792147818, + 18.370581319826897, + 18.673627628736995, + 18.067535010916856 + ], + [ + 1194.5957715059144, + 18.471596756130282, + 18.875658501343707, + 18.067535010916856 + ], + [ + 1198.325363797047, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1202.0549560881796, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1205.7845483793121, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1209.5141406704452, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1213.2437329615777, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1216.9733252527103, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1220.702917543843, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1224.432509834976, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1228.1621021261085, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1231.891694417241, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1235.6212867083736, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1239.3508789995067, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1243.0804712906393, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1246.8100635817718, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1250.5396558729044, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1254.2692481640374, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1257.99884045517, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1261.7284327463026, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1265.4580250374352, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1269.1876173285682, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1272.9172096197008, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1276.6468019108333, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1280.376394201966, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1284.105986493099, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1287.8355787842315, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1291.565171075364, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1295.2947633664967, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1299.0243556576297, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1302.7539479487623, + 18.471596756130282, + 18.875658501343707, + 18.067535010916856 + ], + [ + 1306.4835402398949, + 18.471596756130282, + 18.875658501343707, + 18.067535010916856 + ], + [ + 1310.2131325310274, + 18.471596756130282, + 18.875658501343707, + 18.067535010916856 + ], + [ + 1313.9427248221605, + 18.471596756130282, + 18.875658501343707, + 18.067535010916856 + ], + [ + 1317.672317113293, + 18.471596756130282, + 18.875658501343707, + 18.067535010916856 + ], + [ + 1321.4019094044256, + 18.471596756130282, + 18.875658501343707, + 18.067535010916856 + ], + [ + 1325.1315016955582, + 18.471596756130282, + 18.875658501343707, + 18.067535010916856 + ], + [ + 1328.8610939866912, + 18.471596756130282, + 18.875658501343707, + 18.067535010916856 + ], + [ + 1332.5906862778238, + 18.471596756130282, + 18.875658501343707, + 18.067535010916856 + ], + [ + 1336.3202785689564, + 18.471596756130282, + 18.875658501343707, + 18.067535010916856 + ], + [ + 1340.049870860089, + 18.471596756130282, + 18.875658501343707, + 18.067535010916856 + ], + [ + 1343.779463151222, + 18.471596756130282, + 18.875658501343707, + 18.067535010916856 + ], + [ + 1347.5090554423546, + 18.471596756130282, + 18.875658501343707, + 18.067535010916856 + ], + [ + 1351.2386477334871, + 18.471596756130282, + 18.875658501343707, + 18.067535010916856 + ], + [ + 1354.9682400246197, + 18.471596756130282, + 18.875658501343707, + 18.067535010916856 + ], + [ + 1358.6978323157527, + 18.471596756130282, + 18.875658501343707, + 18.067535010916856 + ], + [ + 1362.4274246068853, + 18.471596756130282, + 18.875658501343707, + 18.067535010916856 + ], + [ + 1366.157016898018, + 18.471596756130282, + 18.875658501343707, + 18.067535010916856 + ], + [ + 1369.8866091891505, + 18.471596756130282, + 18.875658501343707, + 18.067535010916856 + ], + [ + 1373.6162014802835, + 18.471596756130282, + 18.875658501343707, + 18.067535010916856 + ], + [ + 1377.345793771416, + 18.471596756130282, + 18.875658501343707, + 18.067535010916856 + ], + [ + 1381.0753860625487, + 18.471596756130282, + 18.875658501343707, + 18.067535010916856 + ], + [ + 1384.8049783536812, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 1388.5345706448143, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 1392.2641629359468, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 1395.9937552270794, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 1399.723347518212, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 1403.452939809345, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 1407.1825321004776, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 1410.9121243916102, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 1414.6417166827428, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 1418.3713089738758, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 1422.1009012650084, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 1425.830493556141, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 1429.5600858472735, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 1433.2896781384065, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 1437.0192704295391, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 1440.7488627206717, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 1444.4784550118043, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 1448.2080473029373, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 1451.9376395940699, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 1455.6672318852025, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 1459.396824176335, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 1463.126416467468, + 18.471596756130282, + 19.07768937395042, + 17.865504138310143 + ], + [ + 1466.8560087586006, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1470.5856010497332, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1474.3151933408658, + 18.673627628736995, + 19.279720246557133, + 18.067535010916856 + ], + [ + 1478.0447856319988, + 18.875658501343707, + 19.481751119163903, + 18.26956588352357 + ], + [ + 1481.7743779231314, + 18.875658501343707, + 19.481751119163903, + 18.26956588352357 + ], + [ + 1485.503970214264, + 19.07768937395042, + 19.683781991770616, + 18.471596756130282 + ], + [ + 1489.2335625053965, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 1492.9631547965291, + 19.279720246557133, + 19.88581286437733, + 18.673627628736995 + ], + [ + 1496.6927470876617, + 19.07768937395042, + 19.88581286437733, + 18.26956588352357 + ], + [ + 1500.4223393787952, + 18.875658501343707, + 20.08784373698404, + 17.663473265703374 + ], + [ + 1504.1519316699278, + 18.572612192433667, + 20.08784373698404, + 17.057380647883235 + ], + [ + 1507.8815239610603, + 18.067535010916856, + 19.683781991770616, + 16.451288030063097 + ], + [ + 1511.611116252193, + 17.562457829400046, + 19.279720246557133, + 15.845195412242902 + ], + [ + 1515.3407085433255, + 17.562457829400046, + 19.07768937395042, + 16.047226284849614 + ], + [ + 1519.070300834458, + 17.865504138310143, + 19.07768937395042, + 16.65331890266981 + ], + [ + 1522.7998931255906, + 18.067535010916856, + 19.07768937395042, + 17.057380647883235 + ], + [ + 1526.5294854167232, + 18.370581319826897, + 19.07768937395042, + 17.663473265703374 + ], + [ + 1530.2590777078558, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1533.9886699989893, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1537.7182622901219, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1541.4478545812544, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1545.177446872387, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1548.9070391635196, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1552.6366314546522, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1556.3662237457847, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1560.0958160369173, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1563.8254083280508, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1567.5550006191834, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1571.284592910316, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1575.0141852014485, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1578.743777492581, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1582.4733697837137, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1586.2029620748463, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1589.9325543659788, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1593.6621466571123, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1597.391738948245, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1601.1213312393775, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1604.85092353051, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1608.5805158216426, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1612.3101081127752, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1616.0397004039078, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1619.7692926950403, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1623.4988849861738, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1627.2284772773064, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1630.958069568439, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1634.6876618595716, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1638.4172541507041, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1642.1468464418367, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1645.8764387329693, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1649.6060310241019, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1653.3356233152354, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1657.065215606368, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1660.7948078975005, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1664.524400188633, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1668.2539924797657, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1671.9835847708982, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1675.7131770620308, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1679.4427693531634, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1683.1723616442969, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1686.9019539354294, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1690.631546226562, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1694.3611385176946, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1698.0907308088272, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1701.8203230999598, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1705.5499153910923, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1709.279507682225, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1713.0090999733584, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1716.738692264491, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1720.4682845556235, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1724.1978768467561, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1727.9274691378887, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1731.6570614290213, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1735.3866537201538, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1739.1162460112864, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1742.84583830242, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1746.5754305935525, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1750.305022884685, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1754.0346151758176, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1757.7642074669502, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1761.4937997580828, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1765.2233920492154, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1768.952984340348, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1772.6825766314814, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1776.412168922614, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1780.1417612137466, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1783.8713535048792, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1787.6009457960117, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1791.3305380871443, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1795.0601303782769, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1798.7897226694095, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1802.519314960543, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1806.2489072516755, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1809.978499542808, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1813.7080918339407, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1817.4376841250732, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1821.1672764162058, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1824.8968687073384, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1828.626460998471, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1832.3560532896045, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1836.085645580737, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1839.8152378718696, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1843.5448301630022, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1847.2744224541348, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1851.0040147452673, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1854.7336070364, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1858.4631993275325, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1862.192791618665, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1865.9223839097986, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1869.6519762009311, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1873.3815684920637, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1877.1111607831963, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1880.8407530743289, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1884.5703453654614, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1888.299937656594, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1892.0295299477266, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1895.75912223886, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1899.4887145299926, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1903.2183068211252, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1906.9478991122578, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1910.6774914033904, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1914.407083694523, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1918.1366759856555, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1921.866268276788, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1925.5958605679216, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1929.3254528590542, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1933.0550451501867, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1936.7846374413193, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1940.514229732452, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1944.2438220235845, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1947.973414314717, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1951.7030066058496, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1955.432598896983, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1959.1621911881157, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1962.8917834792483, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1966.6213757703808, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1970.3509680615134, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1974.080560352646, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1977.8101526437786, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1981.5397449349111, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1985.2693372260446, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1988.9989295171772, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1992.7285218083098, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 1996.4581140994424, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2000.187706390575, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2003.9172986817075, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2007.64689097284, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2011.3764832639727, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2015.1060755551061, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2018.8356678462387, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2022.5652601373713, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2026.2948524285039, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2030.0244447196364, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2033.754037010769, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2037.4836293019016, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2041.2132215930342, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2044.9428138841677, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2048.6724061753002, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2052.401998466433, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2056.1315907575654, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2059.861183048698, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2063.5907753398305, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2067.320367630963, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2071.0499599220957, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2074.779552213229, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2078.5091445043618, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2082.2387367954943, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2085.968329086627, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2089.6979213777595, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2093.427513668892, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2097.1571059600246, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2100.886698251157, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2104.6162905422907, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2108.3458828334233, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2112.075475124556, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2115.8050674156884, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2119.534659706821, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2123.2642519979536, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2126.993844289086, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2130.7234365802187, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2134.453028871352, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2138.182621162485, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2141.9122134536174, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2145.64180574475, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2149.3713980358825, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2153.100990327015, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2156.8305826181477, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2160.5601749092802, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2164.289767200413, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2168.0193594915463, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2171.748951782679, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2175.4785440738115, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2179.208136364944, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2182.9377286560766, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2186.667320947209, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2190.3969132383418, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2194.1265055294743, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2197.856097820608, + 18.673627628736995, + 19.279720246557133, + 18.067535010916856 + ], + [ + 2201.5856901117404, + 18.77464306504038, + 19.279720246557133, + 18.26956588352357 + ], + [ + 2205.315282402873, + 18.77464306504038, + 19.279720246557133, + 18.26956588352357 + ], + [ + 2209.0448746940056, + 18.875658501343707, + 19.481751119163903, + 18.26956588352357 + ], + [ + 2212.774466985138, + 18.976673937647092, + 19.481751119163903, + 18.471596756130282 + ], + [ + 2216.5040592762707, + 19.07768937395042, + 19.683781991770616, + 18.471596756130282 + ], + [ + 2220.2336515674033, + 18.976673937647092, + 19.683781991770616, + 18.26956588352357 + ], + [ + 2223.963243858536, + 18.77464306504038, + 19.683781991770616, + 17.865504138310143 + ], + [ + 2227.6928361496693, + 18.673627628736995, + 19.683781991770616, + 17.663473265703374 + ], + [ + 2231.422428440802, + 18.26956588352357, + 19.279720246557133, + 17.259411520489948 + ], + [ + 2235.1520207319345, + 18.168550447220184, + 19.07768937395042, + 17.259411520489948 + ], + [ + 2238.881613023067, + 18.067535010916856, + 18.673627628736995, + 17.46144239309666 + ], + [ + 2242.6112053141997, + 18.067535010916856, + 18.673627628736995, + 17.46144239309666 + ], + [ + 2246.340797605332, + 18.168550447220184, + 18.673627628736995, + 17.663473265703374 + ], + [ + 2250.070389896465, + 18.26956588352357, + 18.875658501343707, + 17.663473265703374 + ], + [ + 2253.7999821875974, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 2257.529574478731, + 18.471596756130282, + 19.07768937395042, + 17.865504138310143 + ], + [ + 2261.2591667698634, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2264.988759060996, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2268.7183513521286, + 18.673627628736995, + 19.279720246557133, + 18.067535010916856 + ], + [ + 2272.447943643261, + 18.77464306504038, + 19.279720246557133, + 18.26956588352357 + ], + [ + 2276.1775359343937, + 18.77464306504038, + 19.279720246557133, + 18.26956588352357 + ], + [ + 2279.9071282255263, + 18.77464306504038, + 19.279720246557133, + 18.26956588352357 + ], + [ + 2283.636720516659, + 18.77464306504038, + 19.279720246557133, + 18.26956588352357 + ], + [ + 2287.3663128077924, + 18.77464306504038, + 19.279720246557133, + 18.26956588352357 + ], + [ + 2291.095905098925, + 18.77464306504038, + 19.279720246557133, + 18.26956588352357 + ], + [ + 2294.8254973900575, + 18.77464306504038, + 19.279720246557133, + 18.26956588352357 + ], + [ + 2298.55508968119, + 18.77464306504038, + 19.279720246557133, + 18.26956588352357 + ], + [ + 2302.2846819723227, + 18.77464306504038, + 19.279720246557133, + 18.26956588352357 + ], + [ + 2306.0142742634553, + 18.77464306504038, + 19.279720246557133, + 18.26956588352357 + ], + [ + 2309.743866554588, + 18.77464306504038, + 19.279720246557133, + 18.26956588352357 + ], + [ + 2313.4734588457204, + 18.77464306504038, + 19.279720246557133, + 18.26956588352357 + ], + [ + 2317.203051136854, + 18.77464306504038, + 19.279720246557133, + 18.26956588352357 + ], + [ + 2320.9326434279865, + 18.77464306504038, + 19.279720246557133, + 18.26956588352357 + ], + [ + 2324.662235719119, + 18.77464306504038, + 19.279720246557133, + 18.26956588352357 + ], + [ + 2328.3918280102516, + 18.77464306504038, + 19.279720246557133, + 18.26956588352357 + ], + [ + 2332.121420301384, + 18.77464306504038, + 19.279720246557133, + 18.26956588352357 + ], + [ + 2335.851012592517, + 18.77464306504038, + 19.279720246557133, + 18.26956588352357 + ], + [ + 2339.5806048836494, + 18.77464306504038, + 19.279720246557133, + 18.26956588352357 + ], + [ + 2343.310197174782, + 18.77464306504038, + 19.279720246557133, + 18.26956588352357 + ], + [ + 2347.0397894659154, + 18.673627628736995, + 19.07768937395042, + 18.26956588352357 + ], + [ + 2350.769381757048, + 18.673627628736995, + 19.07768937395042, + 18.26956588352357 + ], + [ + 2354.4989740481806, + 18.673627628736995, + 19.07768937395042, + 18.26956588352357 + ], + [ + 2358.228566339313, + 18.673627628736995, + 19.07768937395042, + 18.26956588352357 + ], + [ + 2361.9581586304457, + 18.673627628736995, + 19.07768937395042, + 18.26956588352357 + ], + [ + 2365.6877509215783, + 18.673627628736995, + 19.07768937395042, + 18.26956588352357 + ], + [ + 2369.417343212711, + 18.673627628736995, + 19.07768937395042, + 18.26956588352357 + ], + [ + 2373.1469355038435, + 18.673627628736995, + 19.07768937395042, + 18.26956588352357 + ], + [ + 2376.876527794977, + 18.673627628736995, + 19.07768937395042, + 18.26956588352357 + ], + [ + 2380.6061200861095, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2384.335712377242, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2388.0653046683747, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2391.7948969595072, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2395.52448925064, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2399.2540815417724, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2402.983673832905, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2406.7132661240385, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2410.442858415171, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2414.1724507063036, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2417.902042997436, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2421.6316352885688, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2425.3612275797013, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2429.090819870834, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2432.8204121619665, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2436.5500044531, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 2440.2795967442325, + 18.976673937647092, + 19.88581286437733, + 18.067535010916856 + ], + [ + 2444.009189035365, + 19.279720246557133, + 20.491905482197467, + 18.067535010916856 + ], + [ + 2447.7387813264977, + 19.683781991770616, + 21.300028972624375, + 18.067535010916856 + ], + [ + 2451.4683736176303, + 19.986828300680656, + 21.906121590444513, + 18.067535010916856 + ], + [ + 2455.197965908763, + 20.289874609590754, + 22.31018333565794, + 18.26956588352357 + ], + [ + 2458.9275581998954, + 21.097998100017662, + 22.916275953478134, + 19.279720246557133 + ], + [ + 2462.657150491028, + 21.7040907178378, + 23.32033769869156, + 20.08784373698404 + ], + [ + 2466.3867427821615, + 22.20916789935461, + 23.724399443904986, + 20.69393635480418 + ], + [ + 2470.116335073294, + 22.71424508087142, + 24.128461189118468, + 21.300028972624375 + ], + [ + 2473.8459273644266, + 23.118306826084847, + 24.33049206172518, + 21.906121590444513 + ], + [ + 2477.575519655559, + 23.522368571298273, + 24.532522934331894, + 22.51221420826471 + ], + [ + 2481.305111946692, + 23.82541488020837, + 24.734553806938607, + 22.916275953478134 + ], + [ + 2485.0347042378244, + 24.128461189118468, + 24.93658467954532, + 23.32033769869156 + ], + [ + 2488.764296528957, + 24.229476625421796, + 24.93658467954532, + 23.522368571298273 + ], + [ + 2492.4938888200895, + 24.532522934331894, + 25.138615552152032, + 23.926430316511755 + ], + [ + 2496.223481111222, + 24.532522934331894, + 25.138615552152032, + 23.926430316511755 + ], + [ + 2499.9530734023556, + 24.633538370635222, + 25.138615552152032, + 24.128461189118468 + ], + [ + 2503.682665693488, + 24.43150749802851, + 24.93658467954532, + 23.926430316511755 + ], + [ + 2507.4122579846207, + 24.43150749802851, + 24.93658467954532, + 23.926430316511755 + ], + [ + 2511.1418502757533, + 24.33049206172518, + 24.93658467954532, + 23.724399443904986 + ], + [ + 2514.871442566886, + 24.128461189118468, + 24.734553806938607, + 23.522368571298273 + ], + [ + 2518.6010348580185, + 24.027445752815083, + 24.734553806938607, + 23.32033769869156 + ], + [ + 2522.330627149151, + 23.82541488020837, + 24.532522934331894, + 23.118306826084847 + ], + [ + 2526.0602194402836, + 23.623384007601658, + 24.33049206172518, + 22.916275953478134 + ], + [ + 2529.789811731417, + 23.421353134994945, + 24.128461189118468, + 22.71424508087142 + ], + [ + 2533.5194040225497, + 23.219322262388232, + 23.926430316511755, + 22.51221420826471 + ], + [ + 2537.2489963136823, + 23.017291389781462, + 23.724399443904986, + 22.31018333565794 + ], + [ + 2540.978588604815, + 22.81526051717475, + 23.522368571298273, + 22.108152463051226 + ], + [ + 2544.7081808959474, + 22.51221420826471, + 23.32033769869156, + 21.7040907178378 + ], + [ + 2548.43777318708, + 22.31018333565794, + 23.118306826084847, + 21.502059845231088 + ], + [ + 2552.1673654782126, + 22.108152463051226, + 22.916275953478134, + 21.300028972624375 + ], + [ + 2555.896957769345, + 21.906121590444513, + 22.71424508087142, + 21.097998100017662 + ], + [ + 2559.6265500604786, + 21.7040907178378, + 22.51221420826471, + 20.89596722741095 + ], + [ + 2563.356142351611, + 21.502059845231088, + 22.31018333565794, + 20.69393635480418 + ], + [ + 2567.085734642744, + 21.300028972624375, + 22.108152463051226, + 20.491905482197467 + ], + [ + 2570.8153269338763, + 20.996982663714277, + 21.7040907178378, + 20.289874609590754 + ], + [ + 2574.544919225009, + 20.794951791107565, + 21.502059845231088, + 20.08784373698404 + ], + [ + 2578.2745115161415, + 20.69393635480418, + 21.300028972624375, + 20.08784373698404 + ], + [ + 2582.004103807274, + 20.59292091850085, + 21.300028972624375, + 19.88581286437733 + ], + [ + 2585.7336960984067, + 20.39089004589414, + 21.097998100017662, + 19.683781991770616 + ], + [ + 2589.46328838954, + 20.289874609590754, + 20.89596722741095, + 19.683781991770616 + ], + [ + 2593.1928806806727, + 20.08784373698404, + 20.69393635480418, + 19.481751119163903 + ], + [ + 2596.9224729718053, + 19.986828300680656, + 20.491905482197467, + 19.481751119163903 + ], + [ + 2600.652065262938, + 19.88581286437733, + 20.491905482197467, + 19.279720246557133 + ], + [ + 2604.3816575540704, + 19.784797428073944, + 20.289874609590754, + 19.279720246557133 + ], + [ + 2608.111249845203, + 19.683781991770616, + 20.289874609590754, + 19.07768937395042 + ], + [ + 2611.8408421363356, + 19.58276655546723, + 20.08784373698404, + 19.07768937395042 + ], + [ + 2615.570434427468, + 19.58276655546723, + 20.08784373698404, + 19.07768937395042 + ], + [ + 2619.3000267186017, + 19.58276655546723, + 20.08784373698404, + 19.07768937395042 + ], + [ + 2623.0296190097342, + 19.58276655546723, + 20.08784373698404, + 19.07768937395042 + ], + [ + 2626.759211300867, + 19.58276655546723, + 20.08784373698404, + 19.07768937395042 + ], + [ + 2630.4888035919994, + 19.58276655546723, + 20.08784373698404, + 19.07768937395042 + ], + [ + 2634.218395883132, + 19.58276655546723, + 20.08784373698404, + 19.07768937395042 + ], + [ + 2637.9479881742645, + 19.58276655546723, + 20.08784373698404, + 19.07768937395042 + ], + [ + 2641.677580465397, + 19.58276655546723, + 20.08784373698404, + 19.07768937395042 + ], + [ + 2645.4071727565297, + 19.58276655546723, + 20.08784373698404, + 19.07768937395042 + ], + [ + 2649.136765047663, + 19.58276655546723, + 20.08784373698404, + 19.07768937395042 + ], + [ + 2652.8663573387958, + 19.58276655546723, + 20.08784373698404, + 19.07768937395042 + ], + [ + 2656.5959496299283, + 19.58276655546723, + 20.08784373698404, + 19.07768937395042 + ], + [ + 2660.325541921061, + 19.58276655546723, + 20.08784373698404, + 19.07768937395042 + ], + [ + 2664.0551342121935, + 19.481751119163903, + 19.88581286437733, + 19.07768937395042 + ], + [ + 2667.784726503326, + 19.481751119163903, + 19.88581286437733, + 19.07768937395042 + ], + [ + 2671.5143187944586, + 19.481751119163903, + 19.88581286437733, + 19.07768937395042 + ], + [ + 2675.243911085591, + 19.481751119163903, + 19.88581286437733, + 19.07768937395042 + ], + [ + 2678.9735033767247, + 19.481751119163903, + 19.88581286437733, + 19.07768937395042 + ], + [ + 2682.7030956678573, + 19.481751119163903, + 19.88581286437733, + 19.07768937395042 + ], + [ + 2686.43268795899, + 19.481751119163903, + 19.88581286437733, + 19.07768937395042 + ], + [ + 2690.1622802501224, + 19.481751119163903, + 19.88581286437733, + 19.07768937395042 + ], + [ + 2693.891872541255, + 19.481751119163903, + 19.88581286437733, + 19.07768937395042 + ], + [ + 2697.6214648323876, + 19.481751119163903, + 19.88581286437733, + 19.07768937395042 + ], + [ + 2701.35105712352, + 19.481751119163903, + 19.88581286437733, + 19.07768937395042 + ], + [ + 2705.0806494146527, + 19.481751119163903, + 19.88581286437733, + 19.07768937395042 + ], + [ + 2708.810241705786, + 19.481751119163903, + 19.88581286437733, + 19.07768937395042 + ], + [ + 2712.539833996919, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2716.2694262880514, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2719.999018579184, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2723.7286108703165, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2727.458203161449, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2731.1877954525817, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2734.9173877437142, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2738.6469800348477, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2742.3765723259803, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2746.106164617113, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2749.8357569082455, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2753.565349199378, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2757.2949414905106, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2761.024533781643, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2764.7541260727758, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2768.4837183639092, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2772.213310655042, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2775.9429029461744, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2779.672495237307, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2783.4020875284396, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2787.131679819572, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2790.8612721107047, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2794.5908644018373, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2798.32045669297, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2802.0500489841033, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2805.779641275236, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2809.5092335663685, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2813.238825857501, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2816.9684181486336, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2820.698010439766, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2824.427602730899, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2828.1571950220314, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2831.886787313165, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2835.6163796042974, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2839.34597189543, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2843.0755641865626, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2846.805156477695, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2850.5347487688277, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2854.2643410599603, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2857.993933351093, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2861.7235256422264, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2865.453117933359, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2869.1827102244915, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2872.912302515624, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2876.6418948067567, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2880.3714870978893, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2884.101079389022, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2887.8306716801544, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2891.560263971288, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2895.2898562624205, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2899.019448553553, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2902.7490408446856, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2906.478633135818, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2910.208225426951, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2913.9378177180834, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2917.667410009216, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2921.3970023003494, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2925.126594591482, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2928.8561868826146, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2932.585779173747, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2936.3153714648797, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2940.0449637560123, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2943.774556047145, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2947.5041483382774, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2951.233740629411, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2954.9633329205435, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2958.692925211676, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2962.4225175028087, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2966.1521097939412, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2969.881702085074, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2973.6112943762064, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2977.340886667339, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2981.0704789584724, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2984.800071249605, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2988.5296635407376, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2992.25925583187, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2995.9888481230028, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 2999.7184404141353, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 3003.448032705268, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 3007.1776249964005, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 3010.907217287534, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 3014.6368095786665, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 3018.366401869799, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 3022.0959941609317, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 3025.8255864520643, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 3029.555178743197, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 3033.2847710343294, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 3037.014363325462, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 3040.7439556165955, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 3044.473547907728, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 3048.2031401988606, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 3051.932732489993, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 3055.662324781126, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 3059.3919170722584, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 3063.121509363391, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 3066.8511016545235, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 3070.580693945657, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 3074.3102862367896, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 3078.039878527922, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 3081.7694708190547, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 3085.4990631101873, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 3089.22865540132, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 3092.9582476924525, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 3096.687839983585, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 3100.4174322747185, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 3104.147024565851, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 3107.8766168569837, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 3111.6062091481162, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 3115.335801439249, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 3119.0653937303814, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 3122.794986021514, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 3126.5245783126466, + 19.481751119163903, + 20.08784373698404, + 18.875658501343707 + ], + [ + 3130.254170603779, + 19.683781991770616, + 20.491905482197467, + 18.875658501343707 + ], + [ + 3133.9837628949126, + 19.986828300680656, + 21.097998100017662, + 18.875658501343707 + ], + [ + 3137.713355186045, + 20.289874609590754, + 21.7040907178378, + 18.875658501343707 + ], + [ + 3141.4429474771778, + 20.89596722741095, + 22.71424508087142, + 19.07768937395042 + ], + [ + 3145.1725397683103, + 21.603075281534416, + 23.724399443904986, + 19.481751119163903 + ], + [ + 3148.902132059443, + 23.017291389781462, + 25.94673904257894, + 20.08784373698404 + ], + [ + 3152.6317243505755, + 27.05790884191589, + 33.62391220163431, + 20.491905482197467 + ], + [ + 3156.361316641708, + 28.977202131679746, + 36.85640616334183, + 21.097998100017662 + ], + [ + 3160.0909089328406, + 30.391418239926793, + 38.876714889409016, + 21.906121590444513 + ], + [ + 3163.820501223974, + 31.80563434817384, + 40.69499274286949, + 22.916275953478134 + ], + [ + 3167.5500935151067, + 33.017819583814116, + 41.90717797850982, + 24.128461189118468 + ], + [ + 3171.2796858062393, + 36.04828267291492, + 43.119363214150155, + 28.977202131679746 + ], + [ + 3175.009278097372, + 39.17976119831911, + 43.92748670457706, + 34.43203569206116 + ], + [ + 3178.7388703885044, + 41.09905448808297, + 44.735610195003915, + 37.46249878116197 + ], + [ + 3182.468462679637, + 42.41225516002663, + 45.34170281282405, + 39.48280750722921 + ], + [ + 3186.1980549707696, + 43.52342495936358, + 45.94779543064425, + 41.09905448808297 + ], + [ + 3189.927647261902, + 44.33154844979049, + 46.351857175857674, + 42.311239723723304 + ], + [ + 3193.6572395530357, + 45.03865650391401, + 46.7559189210711, + 43.32139408675687 + ], + [ + 3197.3868318441682, + 45.54373368543082, + 46.95794979367787, + 44.129517577183776 + ], + [ + 3201.116424135301, + 46.048810866947576, + 47.15998066628458, + 44.93764106761063 + ], + [ + 3204.8460164264334, + 46.45287261216106, + 47.362011538891295, + 45.54373368543082 + ], + [ + 3208.575608717566, + 46.7559189210711, + 47.56404241149801, + 45.94779543064425 + ], + [ + 3212.3052010086985, + 46.856934357374485, + 47.56404241149801, + 46.14982630325096 + ], + [ + 3216.034793299831, + 47.0589652299812, + 47.56404241149801, + 46.55388804846439 + ], + [ + 3219.7643855909637, + 47.15998066628458, + 47.76607328410472, + 46.55388804846439 + ], + [ + 3223.493977882097, + 47.15998066628458, + 47.76607328410472, + 46.55388804846439 + ], + [ + 3227.2235701732297, + 46.856934357374485, + 47.56404241149801, + 46.14982630325096 + ], + [ + 3230.9531624643623, + 46.55388804846439, + 47.56404241149801, + 45.54373368543082 + ], + [ + 3234.682754755495, + 46.250841739554346, + 47.56404241149801, + 44.93764106761063 + ], + [ + 3238.4123470466275, + 45.94779543064425, + 47.56404241149801, + 44.33154844979049 + ], + [ + 3242.14193933776, + 45.44271824912744, + 47.15998066628458, + 43.725455831970294 + ], + [ + 3245.8715316288926, + 44.93764106761063, + 46.55388804846439, + 43.32139408675687 + ], + [ + 3249.601123920025, + 44.33154844979049, + 45.94779543064425, + 42.71530146893673 + ], + [ + 3253.3307162111587, + 43.725455831970294, + 45.34170281282405, + 42.109208851116534 + ], + [ + 3257.0603085022913, + 43.22037865045354, + 44.735610195003915, + 41.70514710590311 + ], + [ + 3260.789900793424, + 42.71530146893673, + 44.129517577183776, + 41.30108536068968 + ], + [ + 3264.5194930845564, + 42.21022428741992, + 43.725455831970294, + 40.69499274286949 + ], + [ + 3268.249085375689, + 41.70514710590311, + 43.119363214150155, + 40.29093099765606 + ], + [ + 3271.9786776668216, + 41.30108536068968, + 42.71530146893673, + 39.88686925244264 + ], + [ + 3275.708269957954, + 40.79600817917287, + 42.109208851116534, + 39.48280750722921 + ], + [ + 3279.4378622490867, + 40.29093099765606, + 41.70514710590311, + 38.876714889409016 + ], + [ + 3283.16745454022, + 39.78585381613925, + 41.09905448808297, + 38.47265314419559 + ], + [ + 3286.897046831353, + 39.381792070925826, + 40.69499274286949, + 38.068591398982164 + ], + [ + 3290.6266391224854, + 38.9777303257124, + 40.29093099765606, + 37.66452965376868 + ], + [ + 3294.356231413618, + 38.573668580498975, + 39.88686925244264, + 37.260467908555256 + ], + [ + 3298.0858237047505, + 38.068591398982164, + 39.2807766346225, + 36.85640616334183 + ], + [ + 3301.815415995883, + 37.76554509007207, + 38.876714889409016, + 36.65437529073512 + ], + [ + 3305.5450082870157, + 37.36148334485864, + 38.47265314419559, + 36.25031354552169 + ], + [ + 3309.2746005781482, + 36.957421599645215, + 38.068591398982164, + 35.84625180030821 + ], + [ + 3313.0041928692817, + 36.55335985443173, + 37.66452965376868, + 35.442190055094784 + ], + [ + 3316.7337851604143, + 36.14929810921831, + 37.260467908555256, + 35.03812830988136 + ], + [ + 3320.463377451547, + 35.947267236611594, + 37.05843703594854, + 34.836097437274645 + ], + [ + 3324.1929697426795, + 35.54320549139817, + 36.65437529073512, + 34.43203569206116 + ], + [ + 3327.922562033812, + 35.139143746184686, + 36.25031354552169, + 34.02797394684774 + ], + [ + 3331.6521543249446, + 34.836097437274645, + 35.84625180030821, + 33.825943074241025 + ], + [ + 3335.381746616077, + 34.43203569206116, + 35.442190055094784, + 33.4218813290276 + ], + [ + 3339.1113389072098, + 34.23000481945445, + 35.24015918248807, + 33.219850456420886 + ], + [ + 3342.8409311983432, + 33.825943074241025, + 34.836097437274645, + 32.815788711207404 + ], + [ + 3346.570523489476, + 33.62391220163431, + 34.634066564667876, + 32.61375783860069 + ], + [ + 3350.3001157806084, + 33.219850456420886, + 34.23000481945445, + 32.209696093387265 + ], + [ + 3354.029708071741, + 32.91680414751079, + 33.825943074241025, + 32.00766522078055 + ], + [ + 3357.7593003628735, + 32.61375783860069, + 33.62391220163431, + 31.603603475567127 + ], + [ + 3361.488892654006, + 32.31071152969059, + 33.219850456420886, + 31.401572602960357 + ], + [ + 3365.2184849451387, + 32.00766522078055, + 33.017819583814116, + 30.99751085774693 + ], + [ + 3368.9480772362713, + 31.704618911870455, + 32.61375783860069, + 30.79547998514022 + ], + [ + 3372.6776695274048, + 31.502588039263742, + 32.41172696599398, + 30.593449112533506 + ], + [ + 3376.4072618185373, + 31.199541730353644, + 32.00766522078055, + 30.391418239926793 + ], + [ + 3380.13685410967, + 30.896495421443603, + 31.80563434817384, + 29.98735649471331 + ], + [ + 3383.8664464008025, + 30.694464548836834, + 31.603603475567127, + 29.785325622106598 + ], + [ + 3387.596038691935, + 30.391418239926793, + 31.199541730353644, + 29.583294749499885 + ], + [ + 3391.3256309830676, + 30.18938736732008, + 30.99751085774693, + 29.381263876893172 + ], + [ + 3395.0552232742, + 29.886341058409982, + 30.79547998514022, + 28.977202131679746 + ], + [ + 3398.784815565333, + 29.583294749499885, + 30.391418239926793, + 28.775171259073034 + ], + [ + 3402.5144078564663, + 29.381263876893172, + 30.18938736732008, + 28.57314038646632 + ], + [ + 3406.244000147599, + 29.17923300428646, + 29.98735649471331, + 28.37110951385955 + ], + [ + 3409.9735924387314, + 28.977202131679746, + 29.785325622106598, + 28.16907864125284 + ], + [ + 3413.703184729864, + 28.775171259073034, + 29.583294749499885, + 27.967047768646125 + ], + [ + 3417.4327770209966, + 28.472124950162936, + 29.17923300428646, + 27.765016896039413 + ], + [ + 3421.162369312129, + 28.270094077556223, + 28.977202131679746, + 27.5629860234327 + ], + [ + 3424.8919616032617, + 28.06806320494951, + 28.775171259073034, + 27.360955150825987 + ], + [ + 3428.6215538943943, + 27.866032332342797, + 28.57314038646632, + 27.158924278219274 + ], + [ + 3432.351146185527, + 27.664001459736028, + 28.37110951385955, + 26.956893405612504 + ], + [ + 3436.0807384766604, + 27.461970587129315, + 28.16907864125284, + 26.75486253300579 + ], + [ + 3439.810330767793, + 27.259939714522602, + 27.967047768646125, + 26.55283166039908 + ], + [ + 3443.5399230589255, + 27.05790884191589, + 27.765016896039413, + 26.350800787792366 + ], + [ + 3447.269515350058, + 26.855877969309176, + 27.5629860234327, + 26.148769915185653 + ], + [ + 3450.9991076411907, + 26.653847096702464, + 27.360955150825987, + 25.94673904257894 + ], + [ + 3454.7286999323233, + 26.45181622409575, + 27.158924278219274, + 25.744708169972228 + ], + [ + 3458.458292223456, + 26.249785351489038, + 26.956893405612504, + 25.542677297365515 + ], + [ + 3462.1878845145884, + 26.04775447888227, + 26.75486253300579, + 25.340646424758745 + ], + [ + 3465.917476805722, + 25.845723606275556, + 26.55283166039908, + 25.138615552152032 + ], + [ + 3469.6470690968545, + 25.643692733668843, + 26.350800787792366, + 24.93658467954532 + ], + [ + 3473.376661387987, + 25.542677297365515, + 26.148769915185653, + 24.93658467954532 + ], + [ + 3477.1062536791196, + 25.44166186106213, + 26.148769915185653, + 24.734553806938607 + ], + [ + 3480.835845970252, + 25.239630988455417, + 25.94673904257894, + 24.532522934331894 + ], + [ + 3484.5654382613848, + 25.037600115848704, + 25.744708169972228, + 24.33049206172518 + ], + [ + 3488.2950305525173, + 24.93658467954532, + 25.542677297365515, + 24.33049206172518 + ], + [ + 3492.02462284365, + 24.734553806938607, + 25.340646424758745, + 24.128461189118468 + ], + [ + 3495.7542151347834, + 24.532522934331894, + 25.138615552152032, + 23.926430316511755 + ], + [ + 3499.483807425916, + 24.43150749802851, + 25.138615552152032, + 23.724399443904986 + ], + [ + 3503.2133997170486, + 24.33049206172518, + 24.93658467954532, + 23.724399443904986 + ], + [ + 3506.942992008181, + 24.128461189118468, + 24.734553806938607, + 23.522368571298273 + ], + [ + 3510.6725842993137, + 23.926430316511755, + 24.532522934331894, + 23.32033769869156 + ], + [ + 3514.4021765904463, + 23.926430316511755, + 24.532522934331894, + 23.32033769869156 + ], + [ + 3518.131768881579, + 23.724399443904986, + 24.33049206172518, + 23.118306826084847 + ], + [ + 3521.8613611727114, + 23.522368571298273, + 24.128461189118468, + 22.916275953478134 + ], + [ + 3525.590953463845, + 23.522368571298273, + 24.128461189118468, + 22.916275953478134 + ], + [ + 3529.3205457549775, + 23.32033769869156, + 23.926430316511755, + 22.71424508087142 + ], + [ + 3533.05013804611, + 23.219322262388232, + 23.724399443904986, + 22.71424508087142 + ], + [ + 3536.7797303372427, + 23.118306826084847, + 23.724399443904986, + 22.51221420826471 + ], + [ + 3540.5093226283752, + 22.916275953478134, + 23.522368571298273, + 22.31018333565794 + ], + [ + 3544.238914919508, + 22.916275953478134, + 23.522368571298273, + 22.31018333565794 + ], + [ + 3547.9685072106404, + 22.71424508087142, + 23.32033769869156, + 22.108152463051226 + ], + [ + 3551.698099501773, + 22.613229644568037, + 23.118306826084847, + 22.108152463051226 + ], + [ + 3555.4276917929064, + 22.51221420826471, + 23.118306826084847, + 21.906121590444513 + ], + [ + 3559.157284084039, + 22.411198771961324, + 22.916275953478134, + 21.906121590444513 + ], + [ + 3562.8868763751716, + 22.31018333565794, + 22.916275953478134, + 21.7040907178378 + ], + [ + 3566.616468666304, + 22.20916789935461, + 22.71424508087142, + 21.7040907178378 + ], + [ + 3570.3460609574367, + 22.108152463051226, + 22.71424508087142, + 21.502059845231088 + ], + [ + 3574.0756532485693, + 22.0071370267479, + 22.51221420826471, + 21.502059845231088 + ], + [ + 3577.805245539702, + 21.906121590444513, + 22.51221420826471, + 21.300028972624375 + ], + [ + 3581.5348378308345, + 21.805106154141185, + 22.31018333565794, + 21.300028972624375 + ], + [ + 3585.264430121968, + 21.7040907178378, + 22.31018333565794, + 21.097998100017662 + ], + [ + 3588.9940224131005, + 21.603075281534416, + 22.108152463051226, + 21.097998100017662 + ], + [ + 3592.723614704233, + 21.603075281534416, + 22.108152463051226, + 21.097998100017662 + ], + [ + 3596.4532069953657, + 21.502059845231088, + 22.108152463051226, + 20.89596722741095 + ], + [ + 3600.1827992864983, + 21.401044408927703, + 21.906121590444513, + 20.89596722741095 + ], + [ + 3603.912391577631, + 21.300028972624375, + 21.906121590444513, + 20.69393635480418 + ], + [ + 3607.6419838687634, + 21.19901353632099, + 21.7040907178378, + 20.69393635480418 + ], + [ + 3611.371576159896, + 21.19901353632099, + 21.7040907178378, + 20.69393635480418 + ], + [ + 3615.1011684510295, + 21.097998100017662, + 21.7040907178378, + 20.491905482197467 + ], + [ + 3618.830760742162, + 20.996982663714277, + 21.502059845231088, + 20.491905482197467 + ], + [ + 3622.5603530332946, + 20.996982663714277, + 21.502059845231088, + 20.491905482197467 + ], + [ + 3626.289945324427, + 20.89596722741095, + 21.502059845231088, + 20.289874609590754 + ], + [ + 3630.01953761556, + 20.794951791107565, + 21.300028972624375, + 20.289874609590754 + ], + [ + 3633.7491299066924, + 20.794951791107565, + 21.300028972624375, + 20.289874609590754 + ], + [ + 3637.478722197825, + 20.794951791107565, + 21.300028972624375, + 20.289874609590754 + ], + [ + 3641.2083144889575, + 20.59292091850085, + 21.097998100017662, + 20.08784373698404 + ], + [ + 3644.937906780091, + 20.59292091850085, + 21.097998100017662, + 20.08784373698404 + ], + [ + 3648.6674990712236, + 20.59292091850085, + 21.097998100017662, + 20.08784373698404 + ], + [ + 3652.397091362356, + 20.59292091850085, + 21.097998100017662, + 20.08784373698404 + ], + [ + 3656.1266836534887, + 20.39089004589414, + 20.89596722741095, + 19.88581286437733 + ], + [ + 3659.8562759446213, + 20.39089004589414, + 20.89596722741095, + 19.88581286437733 + ], + [ + 3663.585868235754, + 20.39089004589414, + 20.89596722741095, + 19.88581286437733 + ], + [ + 3667.3154605268865, + 20.39089004589414, + 20.89596722741095, + 19.88581286437733 + ], + [ + 3671.045052818019, + 20.188859173287426, + 20.69393635480418, + 19.683781991770616 + ], + [ + 3674.7746451091525, + 20.188859173287426, + 20.69393635480418, + 19.683781991770616 + ], + [ + 3678.504237400285, + 20.188859173287426, + 20.69393635480418, + 19.683781991770616 + ], + [ + 3682.2338296914177, + 20.188859173287426, + 20.69393635480418, + 19.683781991770616 + ], + [ + 3685.9634219825502, + 20.188859173287426, + 20.69393635480418, + 19.683781991770616 + ], + [ + 3689.693014273683, + 20.188859173287426, + 20.69393635480418, + 19.683781991770616 + ], + [ + 3693.4226065648154, + 19.986828300680656, + 20.491905482197467, + 19.481751119163903 + ], + [ + 3697.152198855948, + 19.986828300680656, + 20.491905482197467, + 19.481751119163903 + ], + [ + 3700.8817911470805, + 19.986828300680656, + 20.491905482197467, + 19.481751119163903 + ], + [ + 3704.611383438214, + 19.986828300680656, + 20.491905482197467, + 19.481751119163903 + ], + [ + 3708.3409757293466, + 19.986828300680656, + 20.491905482197467, + 19.481751119163903 + ], + [ + 3712.070568020479, + 19.986828300680656, + 20.491905482197467, + 19.481751119163903 + ], + [ + 3715.8001603116118, + 19.986828300680656, + 20.491905482197467, + 19.481751119163903 + ], + [ + 3719.5297526027443, + 19.986828300680656, + 20.491905482197467, + 19.481751119163903 + ], + [ + 3723.259344893877, + 19.88581286437733, + 20.289874609590754, + 19.481751119163903 + ], + [ + 3726.9889371850095, + 19.88581286437733, + 20.289874609590754, + 19.481751119163903 + ], + [ + 3730.718529476142, + 19.88581286437733, + 20.289874609590754, + 19.481751119163903 + ], + [ + 3734.4481217672756, + 19.784797428073944, + 20.289874609590754, + 19.279720246557133 + ], + [ + 3738.177714058408, + 19.784797428073944, + 20.289874609590754, + 19.279720246557133 + ], + [ + 3741.9073063495407, + 19.784797428073944, + 20.289874609590754, + 19.279720246557133 + ], + [ + 3745.6368986406733, + 19.784797428073944, + 20.289874609590754, + 19.279720246557133 + ], + [ + 3749.366490931806, + 19.784797428073944, + 20.289874609590754, + 19.279720246557133 + ], + [ + 3753.0960832229384, + 19.784797428073944, + 20.289874609590754, + 19.279720246557133 + ], + [ + 3756.825675514071, + 19.784797428073944, + 20.289874609590754, + 19.279720246557133 + ], + [ + 3760.5552678052036, + 19.784797428073944, + 20.289874609590754, + 19.279720246557133 + ], + [ + 3764.284860096336, + 19.784797428073944, + 20.289874609590754, + 19.279720246557133 + ], + [ + 3768.0144523874696, + 19.784797428073944, + 20.289874609590754, + 19.279720246557133 + ], + [ + 3771.744044678602, + 19.784797428073944, + 20.289874609590754, + 19.279720246557133 + ], + [ + 3775.473636969735, + 19.784797428073944, + 20.289874609590754, + 19.279720246557133 + ], + [ + 3779.2032292608674, + 19.784797428073944, + 20.289874609590754, + 19.279720246557133 + ], + [ + 3782.932821552, + 19.784797428073944, + 20.289874609590754, + 19.279720246557133 + ], + [ + 3786.6624138431325, + 19.683781991770616, + 20.08784373698404, + 19.279720246557133 + ], + [ + 3790.392006134265, + 19.683781991770616, + 20.08784373698404, + 19.279720246557133 + ], + [ + 3794.1215984253977, + 19.58276655546723, + 20.08784373698404, + 19.07768937395042 + ], + [ + 3797.851190716531, + 19.58276655546723, + 20.08784373698404, + 19.07768937395042 + ], + [ + 3801.5807830076637, + 19.58276655546723, + 20.08784373698404, + 19.07768937395042 + ], + [ + 3805.3103752987963, + 19.58276655546723, + 20.08784373698404, + 19.07768937395042 + ], + [ + 3809.039967589929, + 19.58276655546723, + 20.08784373698404, + 19.07768937395042 + ], + [ + 3812.7695598810615, + 19.58276655546723, + 20.08784373698404, + 19.07768937395042 + ], + [ + 3816.499152172194, + 19.58276655546723, + 20.08784373698404, + 19.07768937395042 + ], + [ + 3820.2287444633266, + 19.58276655546723, + 20.08784373698404, + 19.07768937395042 + ], + [ + 3823.958336754459, + 19.58276655546723, + 20.08784373698404, + 19.07768937395042 + ], + [ + 3827.6879290455927, + 19.58276655546723, + 20.08784373698404, + 19.07768937395042 + ], + [ + 3831.4175213367253, + 19.58276655546723, + 20.08784373698404, + 19.07768937395042 + ], + [ + 3835.147113627858, + 19.481751119163903, + 19.88581286437733, + 19.07768937395042 + ], + [ + 3838.8767059189904, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 3842.606298210123, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 3846.3358905012556, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 3850.065482792388, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 3853.7950750835207, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 3857.524667374654, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 3861.254259665787, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 3864.9838519569194, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 3868.713444248052, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 3872.4430365391845, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 3876.172628830317, + 19.380735682860518, + 19.88581286437733, + 18.875658501343707 + ], + [ + 3879.9022211214497, + 19.279720246557133, + 19.683781991770616, + 18.875658501343707 + ], + [ + 3883.6318134125822, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 3887.3614057037157, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 3891.0909979948483, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 3894.820590285981, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 3898.5501825771134, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 3902.279774868246, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 3906.0093671593786, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 3909.738959450511, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 3913.4685517416438, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 3917.1981440327772, + 19.178704810253805, + 19.683781991770616, + 18.673627628736995 + ], + [ + 3920.92773632391, + 19.07768937395042, + 19.481751119163903, + 18.673627628736995 + ], + [ + 3924.6573286150424, + 19.07768937395042, + 19.481751119163903, + 18.673627628736995 + ], + [ + 3928.386920906175, + 18.976673937647092, + 19.481751119163903, + 18.471596756130282 + ], + [ + 3932.1165131973075, + 18.976673937647092, + 19.481751119163903, + 18.471596756130282 + ], + [ + 3935.84610548844, + 18.976673937647092, + 19.481751119163903, + 18.471596756130282 + ], + [ + 3939.5756977795727, + 18.976673937647092, + 19.481751119163903, + 18.471596756130282 + ], + [ + 3943.3052900707053, + 18.976673937647092, + 19.481751119163903, + 18.471596756130282 + ], + [ + 3947.0348823618388, + 18.976673937647092, + 19.481751119163903, + 18.471596756130282 + ], + [ + 3950.7644746529713, + 18.976673937647092, + 19.481751119163903, + 18.471596756130282 + ], + [ + 3954.494066944104, + 18.976673937647092, + 19.481751119163903, + 18.471596756130282 + ], + [ + 3958.2236592352365, + 18.976673937647092, + 19.481751119163903, + 18.471596756130282 + ], + [ + 3961.953251526369, + 18.976673937647092, + 19.481751119163903, + 18.471596756130282 + ], + [ + 3965.6828438175016, + 18.976673937647092, + 19.481751119163903, + 18.471596756130282 + ], + [ + 3969.412436108634, + 18.875658501343707, + 19.279720246557133, + 18.471596756130282 + ], + [ + 3973.142028399767, + 18.875658501343707, + 19.279720246557133, + 18.471596756130282 + ], + [ + 3976.8716206909003, + 18.77464306504038, + 19.279720246557133, + 18.26956588352357 + ], + [ + 3980.601212982033, + 18.77464306504038, + 19.279720246557133, + 18.26956588352357 + ], + [ + 3984.3308052731654, + 18.77464306504038, + 19.279720246557133, + 18.26956588352357 + ], + [ + 3988.060397564298, + 18.77464306504038, + 19.279720246557133, + 18.26956588352357 + ], + [ + 3991.7899898554306, + 18.77464306504038, + 19.279720246557133, + 18.26956588352357 + ], + [ + 3995.519582146563, + 18.77464306504038, + 19.279720246557133, + 18.26956588352357 + ], + [ + 3999.2491744376957, + 18.77464306504038, + 19.279720246557133, + 18.26956588352357 + ], + [ + 4002.9787667288283, + 18.77464306504038, + 19.279720246557133, + 18.26956588352357 + ], + [ + 4006.708359019962, + 18.77464306504038, + 19.279720246557133, + 18.26956588352357 + ], + [ + 4010.4379513110944, + 18.77464306504038, + 19.279720246557133, + 18.26956588352357 + ], + [ + 4014.167543602227, + 18.77464306504038, + 19.279720246557133, + 18.26956588352357 + ], + [ + 4017.8971358933595, + 18.673627628736995, + 19.07768937395042, + 18.26956588352357 + ], + [ + 4021.626728184492, + 18.673627628736995, + 19.07768937395042, + 18.26956588352357 + ], + [ + 4025.3563204756247, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 4029.0859127667572, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 4032.81550505789, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 4036.5450973490233, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 4040.274689640156, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 4044.0042819312885, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 4047.733874222421, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 4051.4634665135536, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 4055.193058804686, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 4058.9226510958188, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 4062.6522433869513, + 18.572612192433667, + 19.07768937395042, + 18.067535010916856 + ], + [ + 4066.381835678084, + 18.471596756130282, + 18.875658501343707, + 18.067535010916856 + ], + [ + 4070.1114279692174, + 18.471596756130282, + 18.875658501343707, + 18.067535010916856 + ], + [ + 4073.84102026035, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 4077.5706125514826, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 4081.300204842615, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 4085.0297971337477, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 4088.7593894248803, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 4092.488981716013, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 4096.218574007145, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 4099.948166298279, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 4103.6777585894115, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 4107.407350880544, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 4111.136943171677, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 4114.866535462809, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 4118.596127753942, + 18.370581319826897, + 18.875658501343707, + 17.865504138310143 + ], + [ + 4122.325720045074, + 18.26956588352357, + 18.673627628736995, + 17.865504138310143 + ], + [ + 4126.055312336207, + 18.26956588352357, + 18.673627628736995, + 17.865504138310143 + ], + [ + 4129.78490462734, + 18.26956588352357, + 18.673627628736995, + 17.865504138310143 + ], + [ + 4133.514496918473, + 18.168550447220184, + 18.673627628736995, + 17.663473265703374 + ], + [ + 4137.244089209606, + 18.168550447220184, + 18.673627628736995, + 17.663473265703374 + ], + [ + 4140.973681500738, + 18.168550447220184, + 18.673627628736995, + 17.663473265703374 + ], + [ + 4144.703273791871, + 18.168550447220184, + 18.673627628736995, + 17.663473265703374 + ], + [ + 4148.432866083003, + 18.168550447220184, + 18.673627628736995, + 17.663473265703374 + ], + [ + 4152.162458374136, + 18.168550447220184, + 18.673627628736995, + 17.663473265703374 + ], + [ + 4155.8920506652685, + 18.168550447220184, + 18.673627628736995, + 17.663473265703374 + ], + [ + 4159.621642956402, + 18.168550447220184, + 18.673627628736995, + 17.663473265703374 + ], + [ + 4163.3512352475345, + 18.168550447220184, + 18.673627628736995, + 17.663473265703374 + ], + [ + 4167.080827538667, + 18.168550447220184, + 18.673627628736995, + 17.663473265703374 + ], + [ + 4170.8104198298, + 18.168550447220184, + 18.673627628736995, + 17.663473265703374 + ], + [ + 4174.540012120932, + 18.168550447220184, + 18.673627628736995, + 17.663473265703374 + ], + [ + 4178.269604412065, + 18.168550447220184, + 18.673627628736995, + 17.663473265703374 + ], + [ + 4181.999196703197, + 18.168550447220184, + 18.673627628736995, + 17.663473265703374 + ], + [ + 4185.72878899433, + 18.067535010916856, + 18.471596756130282, + 17.663473265703374 + ], + [ + 4189.4583812854635, + 18.067535010916856, + 18.471596756130282, + 17.663473265703374 + ], + [ + 4193.187973576596, + 17.96651957461347, + 18.471596756130282, + 17.46144239309666 + ], + [ + 4196.917565867729, + 17.96651957461347, + 18.471596756130282, + 17.46144239309666 + ], + [ + 4200.647158158861, + 17.96651957461347, + 18.471596756130282, + 17.46144239309666 + ], + [ + 4204.376750449994, + 17.96651957461347, + 18.471596756130282, + 17.46144239309666 + ], + [ + 4208.106342741126, + 17.96651957461347, + 18.471596756130282, + 17.46144239309666 + ], + [ + 4211.835935032259, + 17.96651957461347, + 18.471596756130282, + 17.46144239309666 + ], + [ + 4215.5655273233915, + 17.96651957461347, + 18.471596756130282, + 17.46144239309666 + ], + [ + 4219.295119614525, + 17.96651957461347, + 18.471596756130282, + 17.46144239309666 + ], + [ + 4223.024711905658, + 17.96651957461347, + 18.471596756130282, + 17.46144239309666 + ], + [ + 4226.75430419679, + 17.96651957461347, + 18.471596756130282, + 17.46144239309666 + ], + [ + 4230.483896487923, + 17.96651957461347, + 18.471596756130282, + 17.46144239309666 + ], + [ + 4234.213488779055, + 17.96651957461347, + 18.471596756130282, + 17.46144239309666 + ], + [ + 4237.943081070188, + 17.96651957461347, + 18.471596756130282, + 17.46144239309666 + ], + [ + 4241.67267336132, + 17.96651957461347, + 18.471596756130282, + 17.46144239309666 + ], + [ + 4245.402265652453, + 17.96651957461347, + 18.471596756130282, + 17.46144239309666 + ], + [ + 4249.1318579435865, + 17.96651957461347, + 18.471596756130282, + 17.46144239309666 + ], + [ + 4252.861450234719, + 17.865504138310143, + 18.26956588352357, + 17.46144239309666 + ], + [ + 4256.591042525852, + 17.865504138310143, + 18.26956588352357, + 17.46144239309666 + ], + [ + 4260.320634816984, + 17.865504138310143, + 18.26956588352357, + 17.46144239309666 + ], + [ + 4264.050227108117, + 17.865504138310143, + 18.26956588352357, + 17.46144239309666 + ], + [ + 4267.779819399249, + 17.76448870200676, + 18.26956588352357, + 17.259411520489948 + ], + [ + 4271.509411690382, + 17.76448870200676, + 18.26956588352357, + 17.259411520489948 + ], + [ + 4275.2390039815145, + 17.76448870200676, + 18.26956588352357, + 17.259411520489948 + ], + [ + 4278.968596272648, + 17.76448870200676, + 18.26956588352357, + 17.259411520489948 + ], + [ + 4282.698188563781, + 17.76448870200676, + 18.26956588352357, + 17.259411520489948 + ], + [ + 4286.427780854913, + 17.76448870200676, + 18.26956588352357, + 17.259411520489948 + ], + [ + 4290.157373146046, + 17.76448870200676, + 18.26956588352357, + 17.259411520489948 + ], + [ + 4293.886965437178, + 17.76448870200676, + 18.26956588352357, + 17.259411520489948 + ], + [ + 4297.616557728311, + 17.76448870200676, + 18.26956588352357, + 17.259411520489948 + ], + [ + 4301.3461500194435, + 17.76448870200676, + 18.26956588352357, + 17.259411520489948 + ], + [ + 4305.075742310576, + 17.76448870200676, + 18.26956588352357, + 17.259411520489948 + ], + [ + 4308.80533460171, + 17.76448870200676, + 18.26956588352357, + 17.259411520489948 + ], + [ + 4312.534926892842, + 17.76448870200676, + 18.26956588352357, + 17.259411520489948 + ], + [ + 4316.264519183975, + 17.76448870200676, + 18.26956588352357, + 17.259411520489948 + ], + [ + 4319.994111475107, + 17.76448870200676, + 18.26956588352357, + 17.259411520489948 + ], + [ + 4323.72370376624, + 17.76448870200676, + 18.26956588352357, + 17.259411520489948 + ], + [ + 4327.453296057372, + 17.76448870200676, + 18.26956588352357, + 17.259411520489948 + ], + [ + 4331.182888348505, + 17.76448870200676, + 18.26956588352357, + 17.259411520489948 + ], + [ + 4334.912480639638, + 17.76448870200676, + 18.26956588352357, + 17.259411520489948 + ], + [ + 4338.642072930771, + 17.663473265703374, + 18.067535010916856, + 17.259411520489948 + ], + [ + 4342.371665221904, + 17.663473265703374, + 18.067535010916856, + 17.259411520489948 + ], + [ + 4346.101257513036, + 17.663473265703374, + 18.067535010916856, + 17.259411520489948 + ], + [ + 4349.830849804169, + 17.663473265703374, + 18.067535010916856, + 17.259411520489948 + ], + [ + 4353.560442095301, + 17.562457829400046, + 18.067535010916856, + 17.057380647883235 + ], + [ + 4357.290034386434, + 17.562457829400046, + 18.067535010916856, + 17.057380647883235 + ], + [ + 4361.0196266775665, + 17.562457829400046, + 18.067535010916856, + 17.057380647883235 + ], + [ + 4364.749218968699, + 17.562457829400046, + 18.067535010916856, + 17.057380647883235 + ], + [ + 4368.478811259833, + 17.562457829400046, + 18.067535010916856, + 17.057380647883235 + ], + [ + 4372.208403550965, + 17.562457829400046, + 18.067535010916856, + 17.057380647883235 + ], + [ + 4375.937995842098, + 17.562457829400046, + 18.067535010916856, + 17.057380647883235 + ], + [ + 4379.66758813323, + 17.562457829400046, + 18.067535010916856, + 17.057380647883235 + ], + [ + 4383.397180424363, + 17.562457829400046, + 18.067535010916856, + 17.057380647883235 + ], + [ + 4387.1267727154955, + 17.562457829400046, + 18.067535010916856, + 17.057380647883235 + ], + [ + 4390.856365006628, + 17.562457829400046, + 18.067535010916856, + 17.057380647883235 + ], + [ + 4394.585957297761, + 17.562457829400046, + 18.067535010916856, + 17.057380647883235 + ], + [ + 4398.315549588893, + 17.562457829400046, + 18.067535010916856, + 17.057380647883235 + ], + [ + 4402.045141880027, + 17.562457829400046, + 18.067535010916856, + 17.057380647883235 + ], + [ + 4405.774734171159, + 17.562457829400046, + 18.067535010916856, + 17.057380647883235 + ], + [ + 4409.504326462292, + 17.562457829400046, + 18.067535010916856, + 17.057380647883235 + ], + [ + 4413.233918753424, + 17.562457829400046, + 18.067535010916856, + 17.057380647883235 + ], + [ + 4416.963511044557, + 17.562457829400046, + 18.067535010916856, + 17.057380647883235 + ], + [ + 4420.69310333569, + 17.562457829400046, + 18.067535010916856, + 17.057380647883235 + ], + [ + 4424.422695626822, + 17.562457829400046, + 18.067535010916856, + 17.057380647883235 + ], + [ + 4428.152287917955, + 17.562457829400046, + 18.067535010916856, + 17.057380647883235 + ], + [ + 4431.881880209088, + 17.562457829400046, + 18.067535010916856, + 17.057380647883235 + ], + [ + 4435.611472500221, + 17.562457829400046, + 18.067535010916856, + 17.057380647883235 + ], + [ + 4439.341064791353, + 17.562457829400046, + 18.067535010916856, + 17.057380647883235 + ], + [ + 4443.070657082486, + 17.562457829400046, + 18.067535010916856, + 17.057380647883235 + ], + [ + 4446.8002493736185, + 17.46144239309666, + 17.865504138310143, + 17.057380647883235 + ], + [ + 4450.529841664751, + 17.46144239309666, + 17.865504138310143, + 17.057380647883235 + ], + [ + 4454.259433955884, + 17.46144239309666, + 17.865504138310143, + 17.057380647883235 + ], + [ + 4457.989026247016, + 17.46144239309666, + 17.865504138310143, + 17.057380647883235 + ], + [ + 4461.71861853815, + 17.46144239309666, + 17.865504138310143, + 17.057380647883235 + ], + [ + 4465.448210829282, + 17.46144239309666, + 17.865504138310143, + 17.057380647883235 + ], + [ + 4469.177803120415, + 17.46144239309666, + 17.865504138310143, + 17.057380647883235 + ], + [ + 4472.907395411547, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4476.63698770268, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4480.366579993813, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4484.096172284945, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4487.825764576078, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4491.555356867211, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4495.284949158344, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4499.014541449476, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4502.744133740609, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4506.4737260317415, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4510.203318322874, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4513.932910614007, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4517.662502905139, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4521.392095196273, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4525.121687487405, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4528.851279778538, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4532.5808720696705, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4536.310464360803, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4540.040056651936, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4543.769648943068, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4547.499241234201, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4551.228833525334, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4554.958425816467, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4558.688018107599, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4562.417610398732, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4566.147202689865, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4569.876794980997, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4573.60638727213, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4577.335979563262, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4581.065571854396, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4584.795164145528, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4588.524756436661, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4592.2543487277935, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4595.983941018926, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4599.713533310059, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4603.443125601191, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4607.172717892324, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4610.902310183457, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4614.63190247459, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4618.3614947657225, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4622.091087056855, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4625.820679347988, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4629.55027163912, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4633.279863930253, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4637.009456221385, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4640.739048512519, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4644.468640803651, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4648.198233094784, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4651.927825385917, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4655.657417677049, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4659.387009968182, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4663.116602259314, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4666.846194550447, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4670.57578684158, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4674.305379132713, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4678.0349714238455, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4681.764563714978, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4685.494156006111, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4689.223748297243, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4692.953340588376, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4696.682932879508, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4700.412525170641, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4704.142117461774, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4707.871709752907, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4711.60130204404, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4715.330894335172, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4719.060486626305, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4722.790078917437, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4726.51967120857, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4730.2492634997025, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4733.978855790836, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4737.7084480819685, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4741.438040373101, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4745.167632664234, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4748.897224955366, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4752.626817246499, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4756.356409537631, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4760.086001828764, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4763.8155941198975, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4767.54518641103, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4771.274778702163, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4775.004370993295, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4778.733963284428, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4782.46355557556, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4786.193147866693, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4789.9227401578255, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4793.652332448959, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4797.381924740092, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4801.111517031224, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4804.841109322357, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4808.570701613489, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4812.300293904622, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4816.029886195754, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4819.759478486887, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4823.4890707780205, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4827.218663069153, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4830.948255360286, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ], + [ + 4834.677847651418, + 17.360426956793333, + 17.865504138310143, + 16.855349775276522 + ] + ], + "Tr": [ + [ + 251.008921849344, + 26.148769915185653, + 26.55283166039908, + 25.744708169972228 + ], + [ + 254.73851414047658, + 26.148769915185653, + 26.55283166039908, + 25.744708169972228 + ], + [ + 258.4681064316096, + 26.148769915185653, + 26.55283166039908, + 25.744708169972228 + ], + [ + 262.1976987227422, + 26.148769915185653, + 26.55283166039908, + 25.744708169972228 + ], + [ + 265.92729101387476, + 26.148769915185653, + 26.55283166039908, + 25.744708169972228 + ], + [ + 269.65688330500734, + 26.148769915185653, + 26.55283166039908, + 25.744708169972228 + ], + [ + 273.3864755961404, + 26.148769915185653, + 26.55283166039908, + 25.744708169972228 + ], + [ + 277.11606788727295, + 26.249785351489038, + 26.75486253300579, + 25.744708169972228 + ], + [ + 280.8456601784055, + 26.249785351489038, + 26.75486253300579, + 25.744708169972228 + ], + [ + 284.5752524695381, + 26.249785351489038, + 26.75486253300579, + 25.744708169972228 + ], + [ + 288.30484476067113, + 26.45181622409575, + 26.956893405612504, + 25.94673904257894 + ], + [ + 292.0344370518037, + 26.55283166039908, + 27.158924278219274, + 25.94673904257894 + ], + [ + 295.7640293429363, + 26.653847096702464, + 27.158924278219274, + 26.148769915185653 + ], + [ + 299.49362163406886, + 26.75486253300579, + 27.360955150825987, + 26.148769915185653 + ], + [ + 303.2232139252019, + 26.855877969309176, + 27.360955150825987, + 26.350800787792366 + ], + [ + 306.95280621633447, + 26.956893405612504, + 27.5629860234327, + 26.350800787792366 + ], + [ + 310.68239850746704, + 27.158924278219274, + 27.765016896039413, + 26.55283166039908 + ], + [ + 314.4119907985996, + 27.259939714522602, + 27.765016896039413, + 26.75486253300579 + ], + [ + 318.14158308973265, + 27.360955150825987, + 27.967047768646125, + 26.75486253300579 + ], + [ + 321.8711753808652, + 27.5629860234327, + 28.16907864125284, + 26.956893405612504 + ], + [ + 325.6007676719978, + 27.664001459736028, + 28.16907864125284, + 27.158924278219274 + ], + [ + 329.3303599631304, + 27.765016896039413, + 28.37110951385955, + 27.158924278219274 + ], + [ + 333.0599522542634, + 27.967047768646125, + 28.57314038646632, + 27.360955150825987 + ], + [ + 336.789544545396, + 28.16907864125284, + 28.775171259073034, + 27.5629860234327 + ], + [ + 340.51913683652856, + 28.16907864125284, + 28.775171259073034, + 27.5629860234327 + ], + [ + 344.24872912766114, + 28.37110951385955, + 28.977202131679746, + 27.765016896039413 + ], + [ + 347.97832141879417, + 28.57314038646632, + 29.17923300428646, + 27.967047768646125 + ], + [ + 351.70791370992674, + 28.775171259073034, + 29.381263876893172, + 28.16907864125284 + ], + [ + 355.4375060010593, + 28.977202131679746, + 29.583294749499885, + 28.37110951385955 + ], + [ + 359.1670982921919, + 29.078217567983074, + 29.785325622106598, + 28.37110951385955 + ], + [ + 362.8966905833249, + 29.17923300428646, + 29.785325622106598, + 28.57314038646632 + ], + [ + 366.6262828744575, + 29.381263876893172, + 29.98735649471331, + 28.775171259073034 + ], + [ + 370.3558751655901, + 29.583294749499885, + 30.18938736732008, + 28.977202131679746 + ], + [ + 374.08546745672265, + 29.785325622106598, + 30.391418239926793, + 29.17923300428646 + ], + [ + 377.8150597478557, + 29.98735649471331, + 30.593449112533506, + 29.381263876893172 + ], + [ + 381.54465203898826, + 30.18938736732008, + 30.79547998514022, + 29.583294749499885 + ], + [ + 385.27424433012084, + 30.290402803623408, + 30.99751085774693, + 29.583294749499885 + ], + [ + 389.0038366212534, + 30.49243367623012, + 31.199541730353644, + 29.785325622106598 + ], + [ + 392.73342891238644, + 30.694464548836834, + 31.401572602960357, + 29.98735649471331 + ], + [ + 396.463021203519, + 30.896495421443603, + 31.603603475567127, + 30.18938736732008 + ], + [ + 400.1926134946516, + 31.098526294050316, + 31.80563434817384, + 30.391418239926793 + ], + [ + 403.9222057857842, + 31.30055716665703, + 32.00766522078055, + 30.593449112533506 + ], + [ + 407.6517980769172, + 31.502588039263742, + 32.209696093387265, + 30.79547998514022 + ], + [ + 411.3813903680498, + 31.704618911870455, + 32.41172696599398, + 30.99751085774693 + ], + [ + 415.11098265918235, + 31.906649784477167, + 32.61375783860069, + 31.199541730353644 + ], + [ + 418.84057495031493, + 32.10868065708388, + 32.815788711207404, + 31.401572602960357 + ], + [ + 422.57016724144796, + 32.31071152969059, + 33.017819583814116, + 31.603603475567127 + ], + [ + 426.29975953258054, + 32.51274240229736, + 33.219850456420886, + 31.80563434817384 + ], + [ + 430.0293518237131, + 32.714773274904076, + 33.4218813290276, + 32.00766522078055 + ], + [ + 433.7589441148457, + 32.91680414751079, + 33.62391220163431, + 32.209696093387265 + ], + [ + 437.4885364059787, + 33.1188350201175, + 33.825943074241025, + 32.41172696599398 + ], + [ + 441.2181286971113, + 33.4218813290276, + 34.23000481945445, + 32.61375783860069 + ], + [ + 444.9477209882439, + 33.62391220163431, + 34.43203569206116, + 32.815788711207404 + ], + [ + 448.67731327937645, + 33.92695851054441, + 34.634066564667876, + 33.219850456420886 + ], + [ + 452.4069055705095, + 34.12898938315112, + 34.836097437274645, + 33.4218813290276 + ], + [ + 456.13649786164206, + 34.331020255757835, + 35.03812830988136, + 33.62391220163431 + ], + [ + 459.86609015277463, + 34.53305112836455, + 35.24015918248807, + 33.825943074241025 + ], + [ + 463.5956824439072, + 34.836097437274645, + 35.6442209277015, + 34.02797394684774 + ], + [ + 467.32527473504024, + 35.03812830988136, + 35.84625180030821, + 34.23000481945445 + ], + [ + 471.0548670261728, + 35.24015918248807, + 36.04828267291492, + 34.43203569206116 + ], + [ + 474.7844593173054, + 35.54320549139817, + 36.25031354552169, + 34.836097437274645 + ], + [ + 478.51405160843797, + 35.74523636400488, + 36.452344418128405, + 35.03812830988136 + ], + [ + 482.243643899571, + 36.04828267291492, + 36.85640616334183, + 35.24015918248807 + ], + [ + 485.9732361907036, + 36.25031354552169, + 37.05843703594854, + 35.442190055094784 + ], + [ + 489.70282848183615, + 36.452344418128405, + 37.260467908555256, + 35.6442209277015 + ], + [ + 493.4324207729687, + 36.755390727038446, + 37.46249878116197, + 36.04828267291492 + ], + [ + 497.16201306410176, + 37.05843703594854, + 37.86656052637545, + 36.25031354552169 + ], + [ + 500.89160535523433, + 37.260467908555256, + 38.068591398982164, + 36.452344418128405 + ], + [ + 504.6211976463669, + 37.46249878116197, + 38.27062227158888, + 36.65437529073512 + ], + [ + 508.3507899374995, + 37.86656052637545, + 38.6746840168023, + 37.05843703594854 + ], + [ + 512.0803822286325, + 38.068591398982164, + 38.876714889409016, + 37.260467908555256 + ], + [ + 515.8099745197651, + 38.27062227158888, + 39.07874576201573, + 37.46249878116197 + ], + [ + 519.5395668108977, + 38.573668580498975, + 39.48280750722921, + 37.66452965376868 + ], + [ + 523.2691591020302, + 38.876714889409016, + 39.684838379835924, + 38.068591398982164 + ], + [ + 526.9987513931633, + 39.07874576201573, + 39.88686925244264, + 38.27062227158888 + ], + [ + 530.7283436842959, + 39.381792070925826, + 40.29093099765606, + 38.47265314419559 + ], + [ + 534.4579359754284, + 39.684838379835924, + 40.492961870262775, + 38.876714889409016 + ], + [ + 538.187528266561, + 39.987884688745964, + 40.89702361547626, + 39.07874576201573 + ], + [ + 541.917120557694, + 40.189915561352734, + 41.09905448808297, + 39.2807766346225 + ], + [ + 545.6467128488266, + 40.492961870262775, + 41.30108536068968, + 39.684838379835924 + ], + [ + 549.3763051399592, + 40.79600817917287, + 41.70514710590311, + 39.88686925244264 + ], + [ + 553.1058974310918, + 41.09905448808297, + 41.90717797850982, + 40.29093099765606 + ], + [ + 556.8354897222248, + 41.40210079699301, + 42.311239723723304, + 40.492961870262775 + ], + [ + 560.5650820133574, + 41.60413166959978, + 42.51327059633002, + 40.69499274286949 + ], + [ + 564.29467430449, + 42.008193414813206, + 42.91733234154344, + 41.09905448808297 + ], + [ + 568.0242665956225, + 42.21022428741992, + 43.119363214150155, + 41.30108536068968 + ], + [ + 571.7538588867551, + 42.614286032633345, + 43.52342495936358, + 41.70514710590311 + ], + [ + 575.4834511778881, + 42.81631690524006, + 43.725455831970294, + 41.90717797850982 + ], + [ + 579.2130434690207, + 43.22037865045354, + 44.129517577183776, + 42.311239723723304 + ], + [ + 582.9426357601533, + 43.42240952306025, + 44.33154844979049, + 42.51327059633002 + ], + [ + 586.6722280512859, + 43.82647126827368, + 44.735610195003915, + 42.91733234154344 + ], + [ + 590.4018203424189, + 44.02850214088039, + 44.93764106761063, + 43.119363214150155 + ], + [ + 594.1314126335515, + 44.43256388609382, + 45.34170281282405, + 43.52342495936358 + ], + [ + 597.861004924684, + 44.63459475870059, + 45.54373368543082, + 43.725455831970294 + ], + [ + 601.5905972158166, + 45.03865650391401, + 45.94779543064425, + 44.129517577183776 + ], + [ + 605.3201895069496, + 45.240687376520725, + 46.14982630325096, + 44.33154844979049 + ], + [ + 609.0497817980822, + 45.64474912173415, + 46.55388804846439, + 44.735610195003915 + ], + [ + 612.7793740892148, + 45.94779543064425, + 46.95794979367787, + 44.93764106761063 + ], + [ + 616.5089663803474, + 46.250841739554346, + 47.15998066628458, + 45.34170281282405 + ], + [ + 620.2385586714804, + 46.55388804846439, + 47.56404241149801, + 45.54373368543082 + ], + [ + 623.968150962613, + 46.856934357374485, + 47.76607328410472, + 45.94779543064425 + ], + [ + 627.6977432537456, + 47.26099610258791, + 48.170135029318146, + 46.351857175857674 + ], + [ + 631.4273355448781, + 47.56404241149801, + 48.57419677453163, + 46.55388804846439 + ], + [ + 635.1569278360112, + 47.867088720408105, + 48.77622764713834, + 46.95794979367787 + ], + [ + 638.8865201271437, + 48.170135029318146, + 49.18028939235177, + 47.15998066628458 + ], + [ + 642.6161124182763, + 48.57419677453163, + 49.58435113756519, + 47.56404241149801 + ], + [ + 646.3457047094089, + 48.87724308344167, + 49.786382010171906, + 47.96810415671143 + ], + [ + 650.0752970005419, + 49.18028939235177, + 50.19044375538539, + 48.170135029318146 + ], + [ + 653.8048892916745, + 49.58435113756519, + 50.594505500598814, + 48.57419677453163 + ], + [ + 657.5344815828071, + 49.988412882778675, + 50.99856724581224, + 48.978258519745054 + ], + [ + 661.2640738739397, + 50.19044375538539, + 51.20059811841895, + 49.18028939235177 + ], + [ + 664.9936661650727, + 50.594505500598814, + 51.604659863632435, + 49.58435113756519 + ], + [ + 668.7232584562053, + 50.99856724581224, + 52.00872160884586, + 49.988412882778675 + ], + [ + 672.4528507473378, + 51.30161355472234, + 52.412783354059286, + 50.19044375538539 + ], + [ + 676.1824430384704, + 51.604659863632435, + 52.614814226666, + 50.594505500598814 + ], + [ + 679.9120353296034, + 52.00872160884586, + 53.018875971879424, + 50.99856724581224 + ], + [ + 683.641627620736, + 52.412783354059286, + 53.42293771709291, + 51.402628991025665 + ], + [ + 687.3712199118686, + 52.715829662969384, + 53.82699946230633, + 51.604659863632435 + ], + [ + 691.1008122030012, + 53.11989140818281, + 54.23106120751976, + 52.00872160884586 + ], + [ + 694.8304044941342, + 53.42293771709291, + 54.43309208012647, + 52.412783354059286 + ], + [ + 698.5599967852668, + 53.82699946230633, + 54.83715382533995, + 52.81684509927271 + ], + [ + 702.2895890763994, + 54.13004577121643, + 55.24121557055338, + 53.018875971879424 + ], + [ + 706.0191813675319, + 54.534107516429856, + 55.645277315766805, + 53.42293771709291 + ], + [ + 709.748773658665, + 54.93816926164328, + 56.04933906098023, + 53.82699946230633 + ], + [ + 713.4783659497975, + 55.342231006856764, + 56.45340080619371, + 54.23106120751976 + ], + [ + 717.2079582409301, + 55.645277315766805, + 56.655431678800426, + 54.63512295273324 + ], + [ + 720.9375505320627, + 55.9483236246769, + 57.05949342401385, + 54.83715382533995 + ], + [ + 724.6671428231957, + 56.35238536989033, + 57.46355516922728, + 55.24121557055338 + ], + [ + 728.3967351143283, + 56.756447115103754, + 57.86761691444076, + 55.645277315766805 + ], + [ + 732.1263274054609, + 57.160508860317236, + 58.271678659654185, + 56.04933906098023 + ], + [ + 735.8559196965934, + 57.56457060553066, + 58.67574040486761, + 56.45340080619371 + ], + [ + 739.5855119877265, + 57.96863235074409, + 59.079802150081036, + 56.85746255140714 + ], + [ + 743.315104278859, + 58.37269409595751, + 59.48386389529452, + 57.261524296620564 + ], + [ + 747.0446965699916, + 58.776755841170996, + 59.887925640507945, + 57.66558604183405 + ], + [ + 750.7742888611242, + 59.18081758638442, + 60.29198738572137, + 58.06964778704747 + ], + [ + 754.5038811522572, + 59.48386389529452, + 60.69604913093485, + 58.271678659654185 + ], + [ + 758.2334734433898, + 59.887925640507945, + 61.10011087614828, + 58.67574040486761 + ], + [ + 761.9630657345224, + 60.29198738572137, + 61.504172621361704, + 59.079802150081036 + ], + [ + 765.692658025655, + 60.69604913093485, + 61.90823436657513, + 59.48386389529452 + ], + [ + 769.422250316788, + 61.10011087614828, + 62.31229611178861, + 59.887925640507945 + ], + [ + 773.1518426079206, + 61.504172621361704, + 62.71635785700204, + 60.29198738572137 + ], + [ + 776.8814348990531, + 61.90823436657513, + 63.12041960221546, + 60.69604913093485 + ], + [ + 780.6110271901857, + 62.31229611178861, + 63.52448134742889, + 61.10011087614828 + ], + [ + 784.3406194813188, + 62.71635785700204, + 63.92854309264237, + 61.504172621361704 + ], + [ + 788.0702117724513, + 63.12041960221546, + 64.3326048378558, + 61.90823436657513 + ], + [ + 791.7998040635839, + 63.52448134742889, + 64.73666658306922, + 62.31229611178861 + ], + [ + 795.5293963547165, + 63.92854309264237, + 65.14072832828265, + 62.71635785700204 + ], + [ + 799.2589886458495, + 64.3326048378558, + 65.54479007349613, + 63.12041960221546 + ], + [ + 802.9885809369821, + 64.73666658306922, + 65.94885181870956, + 63.52448134742889 + ], + [ + 806.7181732281147, + 65.24174376458603, + 66.35291356392298, + 64.13057396524908 + ], + [ + 810.4477655192472, + 65.64580550979946, + 66.75697530913641, + 64.53463571046251 + ], + [ + 814.1773578103803, + 66.15088269131627, + 67.3630679269566, + 64.93869745567594 + ], + [ + 817.9069501015128, + 66.5549444365297, + 67.76712967217003, + 65.34275920088942 + ], + [ + 821.6365423926454, + 66.95900618174318, + 68.17119141738345, + 65.74682094610284 + ], + [ + 825.366134683778, + 67.3630679269566, + 68.57525316259694, + 66.15088269131627 + ], + [ + 829.095726974911, + 67.76712967217003, + 68.97931490781036, + 66.5549444365297 + ], + [ + 832.8253192660436, + 68.17119141738345, + 69.38337665302379, + 66.95900618174318 + ], + [ + 836.5549115571762, + 68.57525316259694, + 69.78743839823721, + 67.3630679269566 + ], + [ + 840.2845038483088, + 68.97931490781036, + 70.1915001434507, + 67.76712967217003 + ], + [ + 844.0140961394418, + 69.38337665302379, + 70.59556188866412, + 68.17119141738345 + ], + [ + 847.7436884305744, + 69.78743839823721, + 70.99962363387755, + 68.57525316259694 + ], + [ + 851.4732807217069, + 70.1915001434507, + 71.40368537909097, + 68.97931490781036 + ], + [ + 855.2028730128395, + 70.59556188866412, + 71.80774712430446, + 69.38337665302379 + ], + [ + 858.9324653039725, + 70.99962363387755, + 72.21180886951788, + 69.78743839823721 + ], + [ + 862.6620575951051, + 71.40368537909097, + 72.6158706147313, + 70.1915001434507 + ], + [ + 866.3916498862377, + 71.80774712430446, + 73.01993235994479, + 70.59556188866412 + ], + [ + 870.1212421773703, + 72.21180886951788, + 73.42399410515822, + 70.99962363387755 + ], + [ + 873.8508344685033, + 72.71688605103469, + 73.82805585037164, + 71.60571625169774 + ], + [ + 877.5804267596359, + 73.12094779624812, + 74.23211759558507, + 72.00977799691117 + ], + [ + 881.3100190507685, + 73.52500954146154, + 74.63617934079855, + 72.4138397421246 + ], + [ + 885.039611341901, + 73.92907128667503, + 75.04024108601197, + 72.81790148733802 + ], + [ + 888.7692036330336, + 74.33313303188845, + 75.4443028312254, + 73.2219632325515 + ], + [ + 892.4987959241666, + 74.73719477710188, + 75.84836457643883, + 73.62602497776493 + ], + [ + 896.2283882152992, + 75.1412565223153, + 76.25242632165231, + 74.03008672297835 + ], + [ + 899.9579805064318, + 75.54531826752878, + 76.65648806686573, + 74.43414846819178 + ], + [ + 903.6875727975644, + 75.94938001274221, + 77.06054981207916, + 74.83821021340526 + ], + [ + 907.4171650886974, + 76.35344175795564, + 77.46461155729259, + 75.24227195861869 + ], + [ + 911.14675737983, + 76.75750350316906, + 77.86867330250607, + 75.64633370383211 + ], + [ + 914.8763496709626, + 77.16156524838254, + 78.2727350477195, + 76.0503954490456 + ], + [ + 918.6059419620951, + 77.56562699359597, + 78.67679679293292, + 76.45445719425902 + ], + [ + 922.3355342532282, + 77.9696887388094, + 79.08085853814634, + 76.85851893947245 + ], + [ + 926.0651265443607, + 78.37375048402288, + 79.48492028335983, + 77.26258068468587 + ], + [ + 929.7947188354933, + 78.7778122292363, + 79.88898202857325, + 77.66664242989935 + ], + [ + 933.5243111266259, + 79.18187397444973, + 80.29304377378668, + 78.07070417511278 + ], + [ + 937.2539034177589, + 79.58593571966315, + 80.69710551900016, + 78.4747659203262 + ], + [ + 940.9834957088915, + 79.98999746487664, + 81.10116726421359, + 78.87882766553963 + ], + [ + 944.7130880000241, + 80.39405921009006, + 81.50522900942701, + 79.28288941075311 + ], + [ + 948.4426802911566, + 80.79812095530349, + 81.90929075464044, + 79.68695115596654 + ], + [ + 952.1722725822897, + 81.20218270051691, + 82.31335249985392, + 80.09101290117997 + ], + [ + 955.9018648734223, + 81.6062444457304, + 82.71741424506735, + 80.49507464639339 + ], + [ + 959.6314571645548, + 82.01030619094382, + 83.12147599028077, + 80.89913639160687 + ], + [ + 963.3610494556874, + 82.41436793615725, + 83.5255377354942, + 81.3031981368203 + ], + [ + 967.0906417468204, + 82.71741424506735, + 83.92959948070768, + 81.50522900942701 + ], + [ + 970.820234037953, + 83.12147599028077, + 84.3336612259211, + 81.90929075464044 + ], + [ + 974.5498263290856, + 83.5255377354942, + 84.73772297113453, + 82.31335249985392 + ], + [ + 978.2794186202182, + 83.92959948070768, + 85.14178471634796, + 82.71741424506735 + ], + [ + 982.0090109113512, + 84.3336612259211, + 85.54584646156144, + 83.12147599028077 + ], + [ + 985.7386032024838, + 84.6367075348312, + 85.74787733416815, + 83.5255377354942 + ], + [ + 989.4681954936163, + 85.04076928004463, + 86.15193907938158, + 83.92959948070768 + ], + [ + 993.1977877847489, + 85.44483102525805, + 86.556000824595, + 84.3336612259211 + ], + [ + 996.927380075882, + 85.84889277047148, + 86.96006256980849, + 84.73772297113453 + ], + [ + 1000.6569723670145, + 86.25295451568496, + 87.36412431502191, + 85.14178471634796 + ], + [ + 1004.3865646581471, + 86.65701626089839, + 87.76818606023534, + 85.54584646156144 + ], + [ + 1008.1161569492797, + 87.06107800611181, + 88.17224780544876, + 85.94990820677486 + ], + [ + 1011.8457492404127, + 87.46513975132524, + 88.57630955066224, + 86.35396995198829 + ], + [ + 1015.5753415315453, + 87.86920149653872, + 88.98037129587567, + 86.75803169720177 + ], + [ + 1019.3049338226779, + 88.27326324175215, + 89.3844330410891, + 87.1620934424152 + ], + [ + 1023.0345261138104, + 88.67732498696557, + 89.78849478630252, + 87.56615518762862 + ], + [ + 1026.7641184049435, + 89.08138673217906, + 90.192556531516, + 87.97021693284205 + ], + [ + 1030.493710696076, + 89.3844330410891, + 90.59661827672943, + 88.17224780544876 + ], + [ + 1034.2233029872086, + 89.6874793499992, + 90.79864914933614, + 88.57630955066224 + ], + [ + 1037.9528952783412, + 90.09154109521262, + 91.20271089454957, + 88.98037129587567 + ], + [ + 1041.6824875694742, + 90.49560284042605, + 91.60677263976305, + 89.3844330410891 + ], + [ + 1045.4120798606068, + 90.89966458563953, + 92.01083438497648, + 89.78849478630252 + ], + [ + 1049.1416721517394, + 91.30372633085295, + 92.4148961301899, + 90.192556531516 + ], + [ + 1052.871264442872, + 91.70778807606638, + 92.81895787540333, + 90.59661827672943 + ], + [ + 1056.600856734005, + 92.11184982127986, + 93.22301962061681, + 91.00068002194286 + ], + [ + 1060.3304490251376, + 92.51591156649329, + 93.62708136583024, + 91.40474176715634 + ], + [ + 1064.0600413162701, + 92.91997331170671, + 94.03114311104366, + 91.80880351236976 + ], + [ + 1067.7896336074027, + 93.12200418431343, + 94.23317398365037, + 92.01083438497648 + ], + [ + 1071.5192258985358, + 93.52606592952685, + 94.63723572886386, + 92.4148961301899 + ], + [ + 1075.2488181896683, + 93.93012767474033, + 95.04129747407728, + 92.81895787540333 + ], + [ + 1078.978410480801, + 94.33418941995376, + 95.44535921929071, + 93.22301962061681 + ], + [ + 1082.7080027719335, + 94.73825116516718, + 95.84942096450413, + 93.62708136583024 + ], + [ + 1086.4375950630665, + 95.14231291038061, + 96.25348270971762, + 94.03114311104366 + ], + [ + 1090.167187354199, + 95.5463746555941, + 96.65754445493104, + 94.43520485625714 + ], + [ + 1093.8967796453317, + 95.84942096450413, + 96.85957532753775, + 94.83926660147057 + ], + [ + 1097.6263719364642, + 96.15246727341423, + 97.26363707275118, + 95.04129747407728 + ], + [ + 1101.3559642275973, + 96.55652901862766, + 97.66769881796466, + 95.44535921929071 + ], + [ + 1105.0855565187298, + 96.96059076384114, + 98.07176056317809, + 95.84942096450413 + ], + [ + 1108.8151488098624, + 97.36465250905457, + 98.47582230839151, + 96.25348270971762 + ], + [ + 1112.544741100995, + 97.76871425426799, + 98.87988405360494, + 96.65754445493104 + ], + [ + 1116.274333392128, + 98.17277599948142, + 99.28394579881842, + 97.06160620014447 + ], + [ + 1120.0039256832606, + 98.47582230839151, + 99.48597667142514, + 97.4656679453579 + ], + [ + 1123.7335179743932, + 98.77886861730161, + 99.89003841663856, + 97.66769881796466 + ], + [ + 1127.4631102655258, + 99.18293036251504, + 100.29410016185199, + 98.07176056317809 + ], + [ + 1131.1927025566588, + 99.58699210772846, + 100.69816190706547, + 98.47582230839151 + ], + [ + 1134.9222948477914, + 99.99105385294195, + 101.1022236522789, + 98.87988405360494 + ], + [ + 1138.651887138924, + 100.39511559815537, + 101.50628539749232, + 99.28394579881842 + ], + [ + 1142.3814794300565, + 100.69816190706547, + 101.70831627009903, + 99.68800754403185 + ], + [ + 1146.1110717211895, + 101.1022236522789, + 102.11237801531252, + 100.09206928924527 + ], + [ + 1149.8406640123221, + 101.40526996118899, + 102.51643976052594, + 100.29410016185199 + ], + [ + 1153.5702563034547, + 101.80933170640242, + 102.92050150573937, + 100.69816190706547 + ], + [ + 1157.2998485945873, + 102.21339345161584, + 103.32456325095279, + 101.1022236522789 + ], + [ + 1161.0294408857203, + 102.51643976052594, + 103.5265941235595, + 101.50628539749232 + ], + [ + 1164.7590331768529, + 102.92050150573937, + 103.93065586877299, + 101.91034714270575 + ], + [ + 1168.4886254679855, + 103.22354781464946, + 104.33471761398641, + 102.11237801531252 + ], + [ + 1172.218217759118, + 103.62760955986289, + 104.73877935919984, + 102.51643976052594 + ], + [ + 1175.947810050251, + 104.03167130507632, + 105.14284110441332, + 102.92050150573937 + ], + [ + 1179.6774023413836, + 104.33471761398641, + 105.34487197702003, + 103.32456325095279 + ], + [ + 1183.4069946325162, + 104.73877935919984, + 105.74893372223346, + 103.72862499616627 + ], + [ + 1187.1365869236488, + 104.94081023180655, + 106.15299546744689, + 18.875658501343707 + ], + [ + 1190.8661792147818, + 105.14284110441332, + 106.55705721266031, + 18.875658501343707 + ], + [ + 1194.5957715059144, + 105.54690284962675, + 106.9611189578738, + 19.279720246557133 + ], + [ + 1198.325363797047, + 105.84994915853679, + 107.1631498304805, + 19.481751119163903 + ], + [ + 1202.0549560881796, + 106.25401090375027, + 107.56721157569393, + 19.683781991770616 + ], + [ + 1205.7845483793121, + 106.6580726489637, + 107.97127332090736, + 20.08784373698404 + ], + [ + 1209.5141406704452, + 106.9611189578738, + 108.37533506612084, + 20.289874609590754 + ], + [ + 1213.2437329615777, + 107.26416526678383, + 108.57736593872755, + 20.491905482197467 + ], + [ + 1216.9733252527103, + 107.66822701199732, + 108.98142768394098, + 20.89596722741095 + ], + [ + 1220.702917543843, + 108.07228875721074, + 109.3854894291544, + 21.097998100017662 + ], + [ + 1224.432509834976, + 108.37533506612084, + 109.78955117436789, + 21.300028972624375 + ], + [ + 1228.1621021261085, + 108.8804122476376, + 110.19361291958131, + 21.7040907178378 + ], + [ + 1231.891694417241, + 109.28447399285108, + 110.39564379218803, + 21.906121590444513 + ], + [ + 1235.6212867083736, + 109.78955117436789, + 110.79970553740145, + 108.77939681133427 + ], + [ + 1239.3508789995067, + 110.19361291958131, + 111.20376728261488, + 109.18345855654769 + ], + [ + 1243.0804712906393, + 110.49665922849135, + 111.60782902782836, + 109.3854894291544 + ], + [ + 1246.8100635817718, + 110.79970553740145, + 111.80985990043507, + 109.78955117436789 + ], + [ + 1250.5396558729044, + 111.20376728261488, + 112.2139216456485, + 110.19361291958131 + ], + [ + 1254.2692481640374, + 111.60782902782836, + 112.61798339086192, + 110.59767466479474 + ], + [ + 1347.5090554423546, + 121.20429547664753, + 121.30531091295092, + 121.1032800403442 + ], + [ + 1351.2386477334871, + 121.30531091295092, + 121.50734178555763, + 121.1032800403442 + ], + [ + 1354.9682400246197, + 121.50734178555763, + 121.91140353077105, + 121.1032800403442 + ], + [ + 1358.6978323157527, + 121.70937265816434, + 122.31546527598454, + 121.1032800403442 + ], + [ + 1362.4274246068853, + 121.81038809446773, + 122.51749614859125, + 121.1032800403442 + ], + [ + 1366.157016898018, + 122.01241896707444, + 122.92155789380467, + 121.1032800403442 + ], + [ + 1369.8866091891505, + 122.31546527598454, + 123.3256196390181, + 121.30531091295092 + ], + [ + 1373.6162014802835, + 122.61851158489458, + 123.52765051162487, + 121.70937265816434 + ], + [ + 1377.345793771416, + 122.92155789380467, + 123.9317122568383, + 121.91140353077105 + ], + [ + 1381.0753860625487, + 123.3256196390181, + 124.33577400205172, + 122.31546527598454 + ], + [ + 1384.8049783536812, + 123.6286659479282, + 124.53780487465843, + 122.71952702119796 + ], + [ + 1388.5345706448143, + 123.9317122568383, + 124.94186661987186, + 122.92155789380467 + ], + [ + 1392.2641629359468, + 124.33577400205172, + 125.34592836508534, + 123.3256196390181 + ], + [ + 1395.9937552270794, + 124.63882031096182, + 125.54795923769206, + 123.72968138423158 + ], + [ + 1399.723347518212, + 124.94186661987186, + 125.95202098290548, + 123.9317122568383 + ], + [ + 1403.452939809345, + 125.34592836508534, + 126.3560827281189, + 124.33577400205172 + ], + [ + 1407.1825321004776, + 125.64897467399538, + 126.55811360072562, + 124.73983574726515 + ], + [ + 1410.9121243916102, + 125.95202098290548, + 126.9621753459391, + 124.94186661987186 + ], + [ + 1414.6417166827428, + 126.3560827281189, + 127.36623709115253, + 125.34592836508534 + ], + [ + 1418.3713089738758, + 126.659129037029, + 127.56826796375924, + 125.74999011029877 + ], + [ + 1422.1009012650084, + 126.9621753459391, + 127.97232970897267, + 125.95202098290548 + ], + [ + 1425.830493556141, + 127.26522165484914, + 128.17436058157944, + 126.3560827281189 + ], + [ + 1429.5600858472735, + 127.56826796375924, + 128.57842232679286, + 126.55811360072562 + ], + [ + 1433.2896781384065, + 127.97232970897267, + 128.9824840720063, + 126.9621753459391 + ], + [ + 1437.0192704295391, + 128.27537601788276, + 129.184514944613, + 127.36623709115253 + ], + [ + 1440.7488627206717, + 128.57842232679286, + 129.58857668982643, + 127.56826796375924 + ], + [ + 1444.4784550118043, + 128.9824840720063, + 129.9926384350399, + 127.97232970897267 + ], + [ + 1448.2080473029373, + 129.28553038091638, + 130.19466930764662, + 128.37639145418615 + ], + [ + 1451.9376395940699, + 129.58857668982643, + 130.59873105286005, + 128.57842232679286 + ], + [ + 1455.6672318852025, + 129.89162299873652, + 130.80076192546676, + 128.9824840720063 + ], + [ + 1459.396824176335, + 130.19466930764662, + 131.20482367068024, + 129.184514944613 + ], + [ + 1463.126416467468, + 130.59873105286005, + 131.60888541589367, + 129.58857668982643 + ], + [ + 1466.8560087586006, + 130.90177736177014, + 131.81091628850038, + 129.9926384350399 + ], + [ + 1470.5856010497332, + 131.20482367068024, + 132.2149780337138, + 130.19466930764662 + ], + [ + 1474.3151933408658, + 131.50786997959028, + 132.41700890632052, + 130.59873105286005 + ], + [ + 1478.0447856319988, + 131.9119317248037, + 132.821070651534, + 131.00279279807347 + ], + [ + 1481.7743779231314, + 132.2149780337138, + 133.22513239674743, + 131.20482367068024 + ], + [ + 1485.503970214264, + 132.5180243426239, + 133.42716326935414, + 131.60888541589367 + ], + [ + 1489.2335625053965, + 132.821070651534, + 133.83122501456756, + 131.81091628850038 + ], + [ + 1492.9631547965291, + 133.12411696044404, + 134.03325588717428, + 132.2149780337138 + ], + [ + 1496.6927470876617, + 133.52817870565752, + 134.43731763238776, + 132.61903977892723 + ], + [ + 1500.4223393787952, + 133.83122501456756, + 134.84137937760119, + 132.821070651534 + ], + [ + 1504.1519316699278, + 134.13427132347766, + 135.0434102502079, + 133.22513239674743 + ], + [ + 1507.8815239610603, + 134.43731763238776, + 135.44747199542132, + 133.42716326935414 + ], + [ + 1511.611116252193, + 134.7403639412978, + 135.64950286802804, + 133.83122501456756 + ], + [ + 1515.3407085433255, + 135.14442568651128, + 136.05356461324152, + 134.235286759781 + ], + [ + 1519.070300834458, + 135.44747199542132, + 136.45762635845495, + 134.43731763238776 + ], + [ + 1522.7998931255906, + 135.75051830433142, + 136.65965723106166, + 134.84137937760119 + ], + [ + 1526.5294854167232, + 136.05356461324152, + 137.06371897627508, + 135.0434102502079 + ], + [ + 1530.2590777078558, + 136.35661092215156, + 137.2657498488818, + 135.44747199542132 + ], + [ + 1533.9886699989893, + 136.65965723106166, + 137.66981159409528, + 135.64950286802804 + ], + [ + 1537.7182622901219, + 136.96270353997176, + 137.871842466702, + 136.05356461324152 + ], + [ + 1541.4478545812544, + 137.36676528518518, + 138.27590421191542, + 136.45762635845495 + ], + [ + 1545.177446872387, + 137.5687961577919, + 138.47793508452213, + 136.65965723106166 + ], + [ + 1548.9070391635196, + 137.97285790300532, + 138.8819968297356, + 137.06371897627508 + ], + [ + 1552.6366314546522, + 138.27590421191542, + 139.28605857494904, + 137.2657498488818 + ], + [ + 1556.3662237457847, + 138.57895052082552, + 139.48808944755575, + 137.66981159409528 + ], + [ + 1560.0958160369173, + 138.8819968297356, + 139.89215119276918, + 137.871842466702 + ], + [ + 1563.8254083280508, + 139.18504313864565, + 140.0941820653759, + 138.27590421191542 + ], + [ + 1567.5550006191834, + 139.58910488385908, + 140.49824381058937, + 138.67996595712884 + ], + [ + 1571.284592910316, + 139.79113575646585, + 140.70027468319608, + 138.8819968297356 + ], + [ + 1575.0141852014485, + 140.19519750167927, + 141.1043364284095, + 139.28605857494904 + ], + [ + 1578.743777492581, + 140.397228374286, + 141.30636730101622, + 139.48808944755575 + ], + [ + 1582.4733697837137, + 140.8012901194994, + 141.71042904622965, + 139.89215119276918 + ], + [ + 1586.2029620748463, + 141.00332099210613, + 141.91245991883642, + 140.0941820653759 + ], + [ + 1589.9325543659788, + 141.4073827373196, + 142.31652166404984, + 140.49824381058937 + ], + [ + 1593.6621466571123, + 141.60941360992632, + 142.51855253665656, + 140.70027468319608 + ], + [ + 1597.391738948245, + 142.01347535513975, + 142.92261428186998, + 141.1043364284095 + ], + [ + 1601.1213312393775, + 142.31652166404984, + 143.3266760270834, + 141.30636730101622 + ], + [ + 1604.85092353051, + 142.61956797295989, + 143.52870689969018, + 141.71042904622965 + ], + [ + 1608.5805158216426, + 142.92261428186998, + 143.9327686449036, + 141.91245991883642 + ], + [ + 1612.3101081127752, + 143.22566059078008, + 144.13479951751032, + 142.31652166404984 + ], + [ + 1616.0397004039078, + 143.52870689969018, + 144.53886126272374, + 142.51855253665656 + ], + [ + 1619.7692926950403, + 143.83175320860022, + 144.74089213533045, + 142.92261428186998 + ], + [ + 1623.4988849861738, + 144.2358149538137, + 145.14495388054394, + 143.3266760270834 + ], + [ + 1627.2284772773064, + 144.4378458264204, + 145.34698475315065, + 143.52870689969018 + ], + [ + 1630.958069568439, + 144.84190757163384, + 145.75104649836408, + 143.9327686449036 + ], + [ + 1634.6876618595716, + 145.04393844424055, + 145.9530773709708, + 144.13479951751032 + ], + [ + 1638.4172541507041, + 145.44800018945398, + 146.35713911618421, + 144.53886126272374 + ], + [ + 1642.1468464418367, + 145.6500310620607, + 146.55916998879098, + 144.74089213533045 + ], + [ + 1645.8764387329693, + 146.05409280727417, + 146.9632317340044, + 145.14495388054394 + ], + [ + 1649.6060310241019, + 146.2561236798809, + 147.16526260661112, + 145.34698475315065 + ], + [ + 1653.3356233152354, + 146.6601854250943, + 147.56932435182455, + 145.75104649836408 + ], + [ + 1657.065215606368, + 146.86221629770102, + 147.77135522443126, + 145.9530773709708 + ], + [ + 1660.7948078975005, + 147.26627804291445, + 148.17541696964474, + 146.35713911618421 + ], + [ + 1664.524400188633, + 147.46830891552122, + 148.37744784225146, + 146.55916998879098 + ], + [ + 1668.2539924797657, + 147.77135522443126, + 148.57947871485817, + 146.9632317340044 + ], + [ + 1671.9835847708982, + 148.07440153334136, + 148.9835404600716, + 147.16526260661112 + ], + [ + 1675.7131770620308, + 148.37744784225146, + 149.1855713326783, + 147.56932435182455 + ], + [ + 1679.4427693531634, + 148.6804941511615, + 149.5896330778918, + 147.77135522443126 + ], + [ + 1683.1723616442969, + 148.88252502376827, + 149.7916639504985, + 147.97338609703797 + ], + [ + 1686.9019539354294, + 149.2865867689817, + 150.19572569571193, + 148.37744784225146 + ], + [ + 1690.631546226562, + 149.4886176415884, + 150.39775656831864, + 148.57947871485817 + ], + [ + 1694.3611385176946, + 149.89267938680183, + 150.80181831353207, + 148.9835404600716 + ], + [ + 1698.0907308088272, + 150.09471025940854, + 151.00384918613878, + 149.1855713326783 + ], + [ + 1701.8203230999598, + 150.49877200462203, + 151.40791093135226, + 149.5896330778918 + ], + [ + 1705.5499153910923, + 150.70080287722874, + 151.60994180395898, + 149.7916639504985 + ], + [ + 1709.279507682225, + 151.10486462244216, + 152.0140035491724, + 150.19572569571193 + ], + [ + 1713.0090999733584, + 151.30689549504888, + 152.2160344217791, + 150.39775656831864 + ], + [ + 1716.738692264491, + 151.60994180395898, + 152.41806529438583, + 150.80181831353207 + ], + [ + 1720.4682845556235, + 151.91298811286907, + 152.8221270395993, + 151.00384918613878 + ], + [ + 1724.1978768467561, + 152.2160344217791, + 153.02415791220602, + 151.40791093135226 + ], + [ + 1727.9274691378887, + 152.5190807306892, + 153.42821965741945, + 151.60994180395898 + ], + [ + 1731.6570614290213, + 152.72111160329592, + 153.63025053002616, + 151.8119726765657 + ], + [ + 1735.3866537201538, + 153.12517334850935, + 154.03431227523959, + 152.2160344217791 + ], + [ + 1739.1162460112864, + 153.32720422111606, + 154.23634314784636, + 152.41806529438583 + ], + [ + 1742.84583830242, + 153.73126596632954, + 154.64040489305978, + 152.8221270395993 + ], + [ + 1746.5754305935525, + 153.93329683893626, + 154.8424357656665, + 153.02415791220602 + ], + [ + 1750.305022884685, + 154.23634314784636, + 155.0444666382732, + 153.42821965741945 + ], + [ + 1754.0346151758176, + 154.5393894567564, + 155.44852838348663, + 153.63025053002616 + ], + [ + 1757.7642074669502, + 154.8424357656665, + 155.65055925609335, + 154.03431227523959 + ], + [ + 1761.4937997580828, + 155.1454820745766, + 156.05462100130683, + 154.23634314784636 + ], + [ + 1765.2233920492154, + 155.3475129471833, + 156.25665187391354, + 154.43837402045307 + ], + [ + 1768.952984340348, + 155.65055925609335, + 156.45868274652025, + 154.8424357656665 + ], + [ + 1772.6825766314814, + 155.95360556500344, + 156.86274449173368, + 155.0444666382732 + ], + [ + 1776.412168922614, + 156.25665187391354, + 157.0647753643404, + 155.44852838348663 + ], + [ + 1780.1417612137466, + 156.55969818282364, + 157.46883710955387, + 155.65055925609335 + ], + [ + 1783.8713535048792, + 156.76172905543035, + 157.6708679821606, + 155.85259012870011 + ], + [ + 1787.6009457960117, + 157.0647753643404, + 157.8728988547673, + 156.25665187391354 + ], + [ + 1791.3305380871443, + 157.3678216732505, + 158.27696059998073, + 156.45868274652025 + ], + [ + 1795.0601303782769, + 157.6708679821606, + 158.47899147258744, + 156.86274449173368 + ], + [ + 1798.7897226694095, + 157.97391429107063, + 158.88305321780092, + 157.0647753643404 + ], + [ + 1802.519314960543, + 158.27696059998073, + 159.08508409040763, + 157.46883710955387 + ], + [ + 1806.2489072516755, + 158.47899147258744, + 159.28711496301435, + 157.6708679821606 + ], + [ + 1809.978499542808, + 158.78203778149754, + 159.69117670822777, + 157.8728988547673 + ], + [ + 1813.7080918339407, + 159.08508409040763, + 159.89320758083448, + 158.27696059998073 + ], + [ + 1817.4376841250732, + 159.38813039931767, + 160.2972693260479, + 158.47899147258744 + ], + [ + 1821.1672764162058, + 159.69117670822777, + 160.49930019865468, + 158.88305321780092 + ], + [ + 1824.8968687073384, + 159.89320758083448, + 160.7013310712614, + 159.08508409040763 + ], + [ + 1828.626460998471, + 160.19625388974458, + 161.10539281647482, + 159.28711496301435 + ], + [ + 1832.3560532896045, + 160.49930019865468, + 161.30742368908153, + 159.69117670822777 + ], + [ + 1836.085645580737, + 160.7013310712614, + 161.50945456168824, + 159.89320758083448 + ], + [ + 1839.8152378718696, + 161.00437738017143, + 161.91351630690173, + 160.0952384534412 + ], + [ + 1843.5448301630022, + 161.30742368908153, + 162.11554717950844, + 160.49930019865468 + ], + [ + 1847.2744224541348, + 161.61046999799163, + 162.51960892472187, + 160.7013310712614 + ], + [ + 1851.0040147452673, + 161.91351630690173, + 162.72163979732858, + 161.10539281647482 + ], + [ + 1854.7336070364, + 162.11554717950844, + 162.9236706699353, + 161.30742368908153 + ], + [ + 1858.4631993275325, + 162.41859348841848, + 163.32773241514872, + 161.50945456168824 + ], + [ + 1862.192791618665, + 162.72163979732858, + 163.5297632877555, + 161.91351630690173 + ], + [ + 1865.9223839097986, + 162.9236706699353, + 163.7317941603622, + 162.11554717950844 + ], + [ + 1869.6519762009311, + 163.2267169788454, + 164.13585590557562, + 162.31757805211515 + ], + [ + 1873.3815684920637, + 163.5297632877555, + 164.33788677818234, + 162.72163979732858 + ], + [ + 1877.1111607831963, + 163.7317941603622, + 164.53991765078905, + 162.9236706699353 + ], + [ + 1880.8407530743289, + 164.03484046927224, + 164.94397939600253, + 163.125701542542 + ], + [ + 1884.5703453654614, + 164.33788677818234, + 165.14601026860925, + 163.5297632877555 + ], + [ + 1888.299937656594, + 164.53991765078905, + 165.34804114121596, + 163.7317941603622 + ], + [ + 1892.0295299477266, + 164.84296395969915, + 165.75210288642938, + 163.9338250329689 + ], + [ + 1895.75912223886, + 165.14601026860925, + 165.9541337590361, + 164.33788677818234 + ], + [ + 1899.4887145299926, + 165.34804114121596, + 166.1561646316428, + 164.53991765078905 + ], + [ + 1903.2183068211252, + 165.75210288642938, + 166.5602263768563, + 164.94397939600253 + ], + [ + 1906.9478991122578, + 165.9541337590361, + 166.762257249463, + 165.14601026860925 + ], + [ + 1910.6774914033904, + 166.1561646316428, + 166.96428812206972, + 165.34804114121596 + ], + [ + 1914.407083694523, + 166.5602263768563, + 167.36834986728314, + 165.75210288642938 + ], + [ + 1918.1366759856555, + 166.762257249463, + 167.57038073988986, + 165.9541337590361 + ], + [ + 1921.866268276788, + 166.96428812206972, + 167.77241161249657, + 166.1561646316428 + ], + [ + 1925.5958605679216, + 167.26733443097982, + 168.17647335771005, + 166.35819550424952 + ], + [ + 1929.3254528590542, + 167.57038073988986, + 168.37850423031676, + 166.762257249463 + ], + [ + 1933.0550451501867, + 167.77241161249657, + 168.58053510292348, + 166.96428812206972 + ], + [ + 1936.7846374413193, + 168.07545792140667, + 168.9845968481369, + 167.16631899467643 + ], + [ + 1940.514229732452, + 168.37850423031676, + 169.18662772074362, + 167.57038073988986 + ], + [ + 1944.2438220235845, + 168.58053510292348, + 169.38865859335033, + 167.77241161249657 + ], + [ + 1947.973414314717, + 168.7825659755302, + 169.5906894659571, + 167.97444248510334 + ], + [ + 1951.7030066058496, + 169.18662772074362, + 169.99475121117052, + 168.37850423031676 + ], + [ + 1955.432598896983, + 169.38865859335033, + 170.19678208377724, + 168.58053510292348 + ], + [ + 1959.1621911881157, + 169.5906894659571, + 170.39881295638395, + 168.7825659755302 + ], + [ + 1962.8917834792483, + 169.99475121117052, + 170.80287470159737, + 169.18662772074362 + ], + [ + 1966.6213757703808, + 170.19678208377724, + 171.0049055742041, + 169.38865859335033 + ], + [ + 1970.3509680615134, + 170.39881295638395, + 171.20693644681086, + 169.5906894659571 + ], + [ + 1974.080560352646, + 170.60084382899066, + 171.40896731941757, + 169.7927203385638 + ], + [ + 1977.8101526437786, + 171.0049055742041, + 171.813029064631, + 170.19678208377724 + ], + [ + 1981.5397449349111, + 171.20693644681086, + 172.0150599372377, + 170.39881295638395 + ], + [ + 1985.2693372260446, + 171.40896731941757, + 172.21709080984442, + 170.60084382899066 + ], + [ + 1988.9989295171772, + 171.813029064631, + 172.6211525550579, + 171.0049055742041 + ], + [ + 1992.7285218083098, + 172.0150599372377, + 172.82318342766462, + 171.20693644681086 + ], + [ + 1996.4581140994424, + 172.21709080984442, + 173.02521430027133, + 171.40896731941757 + ], + [ + 2000.187706390575, + 172.41912168245113, + 173.22724517287804, + 171.61099819202428 + ], + [ + 2003.9172986817075, + 172.82318342766462, + 173.63130691809147, + 172.0150599372377 + ], + [ + 2007.64689097284, + 173.02521430027133, + 173.83333779069818, + 172.21709080984442 + ], + [ + 2011.3764832639727, + 173.22724517287804, + 174.0353686633049, + 172.41912168245113 + ], + [ + 2015.1060755551061, + 173.53029148178814, + 174.23739953591166, + 172.82318342766462 + ], + [ + 2018.8356678462387, + 173.83333779069818, + 174.6414612811251, + 173.02521430027133 + ], + [ + 2022.5652601373713, + 174.0353686633049, + 174.8434921537318, + 173.22724517287804 + ], + [ + 2026.2948524285039, + 174.23739953591166, + 175.04552302633851, + 173.42927604548476 + ], + [ + 2030.0244447196364, + 174.5404458448217, + 175.24755389894523, + 173.83333779069818 + ], + [ + 2033.754037010769, + 174.8434921537318, + 175.6516156441587, + 174.0353686633049 + ], + [ + 2037.4836293019016, + 175.04552302633851, + 175.85364651676542, + 174.23739953591166 + ], + [ + 2041.2132215930342, + 175.24755389894523, + 176.05567738937214, + 174.43943040851838 + ], + [ + 2044.9428138841677, + 175.55060020785533, + 176.25770826197885, + 174.8434921537318 + ], + [ + 2048.6724061753002, + 175.85364651676542, + 176.66177000719227, + 175.04552302633851 + ], + [ + 2052.401998466433, + 176.05567738937214, + 176.863800879799, + 175.24755389894523 + ], + [ + 2056.1315907575654, + 176.25770826197885, + 177.0658317524057, + 175.44958477155194 + ], + [ + 2059.861183048698, + 176.56075457088895, + 177.26786262501247, + 175.85364651676542 + ], + [ + 2063.5907753398305, + 176.863800879799, + 177.6719243702259, + 176.05567738937214 + ], + [ + 2067.320367630963, + 177.0658317524057, + 177.8739552428326, + 176.25770826197885 + ], + [ + 2071.0499599220957, + 177.26786262501247, + 178.07598611543932, + 176.45973913458556 + ], + [ + 2074.779552213229, + 177.46989349761918, + 178.27801698804603, + 176.66177000719227 + ], + [ + 2078.5091445043618, + 177.77293980652922, + 178.48004786065275, + 177.0658317524057 + ], + [ + 2082.2387367954943, + 178.07598611543932, + 178.88410960586623, + 177.26786262501247 + ], + [ + 2085.968329086627, + 178.27801698804603, + 179.08614047847294, + 177.46989349761918 + ], + [ + 2089.6979213777595, + 178.48004786065275, + 179.28817135107965, + 177.6719243702259 + ], + [ + 2093.427513668892, + 178.78309416956284, + 179.49020222368637, + 178.07598611543932 + ], + [ + 2097.1571059600246, + 178.98512504216956, + 179.69223309629308, + 178.27801698804603 + ], + [ + 2100.886698251157, + 179.28817135107965, + 180.0962948415065, + 178.48004786065275 + ], + [ + 2104.6162905422907, + 179.49020222368637, + 180.29832571411328, + 178.68207873325946 + ], + [ + 2108.3458828334233, + 179.69223309629308, + 180.50035658672, + 178.88410960586623 + ], + [ + 2112.075475124556, + 179.99527940520318, + 180.7023874593267, + 179.28817135107965 + ], + [ + 2115.8050674156884, + 180.1973102778099, + 180.9044183319334, + 179.49020222368637 + ], + [ + 2119.534659706821, + 180.50035658672, + 181.30848007714684, + 179.69223309629308 + ], + [ + 2123.2642519979536, + 180.7023874593267, + 181.51051094975355, + 179.8942639688998 + ], + [ + 2126.993844289086, + 180.9044183319334, + 181.71254182236027, + 180.0962948415065 + ], + [ + 2130.7234365802187, + 181.2074646408435, + 181.91457269496703, + 180.50035658672 + ], + [ + 2134.453028871352, + 181.40949551345022, + 182.11660356757375, + 180.7023874593267 + ], + [ + 2138.182621162485, + 181.61152638605694, + 182.31863444018046, + 180.9044183319334 + ], + [ + 2141.9122134536174, + 181.91457269496703, + 182.7226961853939, + 181.10644920454013 + ], + [ + 2145.64180574475, + 182.11660356757375, + 182.9247270580006, + 181.30848007714684 + ], + [ + 2149.3713980358825, + 182.4196498764838, + 183.1267579306073, + 181.71254182236027 + ], + [ + 2153.100990327015, + 182.62168074909056, + 183.32878880321408, + 181.91457269496703 + ], + [ + 2156.8305826181477, + 182.82371162169727, + 183.5308196758208, + 182.11660356757375 + ], + [ + 2160.5601749092802, + 183.02574249430398, + 183.7328505484275, + 182.31863444018046 + ], + [ + 2164.289767200413, + 183.32878880321408, + 184.13691229364093, + 182.52066531278717 + ], + [ + 2168.0193594915463, + 183.5308196758208, + 184.33894316624765, + 182.7226961853939 + ], + [ + 2171.748951782679, + 183.83386598473083, + 184.54097403885436, + 183.1267579306073 + ], + [ + 2175.4785440738115, + 184.03589685733755, + 184.74300491146107, + 183.32878880321408 + ], + [ + 2179.208136364944, + 184.23792772994432, + 184.94503578406784, + 183.5308196758208 + ], + [ + 2182.9377286560766, + 184.43995860255103, + 185.14706665667455, + 183.7328505484275 + ], + [ + 2186.667320947209, + 184.74300491146107, + 185.55112840188798, + 183.93488142103422 + ], + [ + 2190.3969132383418, + 184.94503578406784, + 185.7531592744947, + 184.13691229364093 + ], + [ + 2194.1265055294743, + 185.14706665667455, + 185.9551901471014, + 184.33894316624765 + ], + [ + 2197.856097820608, + 185.4501129655846, + 186.15722101970812, + 184.74300491146107 + ], + [ + 2201.5856901117404, + 185.65214383819136, + 186.3592518923149, + 184.94503578406784 + ], + [ + 2205.315282402873, + 185.85417471079808, + 186.5612827649216, + 185.14706665667455 + ], + [ + 2209.0448746940056, + 186.0562055834048, + 186.7633136375283, + 185.34909752928127 + ], + [ + 2212.774466985138, + 186.2582364560115, + 186.96534451013503, + 185.55112840188798 + ], + [ + 2216.5040592762707, + 186.5612827649216, + 187.36940625534845, + 185.7531592744947 + ], + [ + 2220.2336515674033, + 186.7633136375283, + 187.57143712795516, + 185.9551901471014 + ], + [ + 2223.963243858536, + 187.06635994643835, + 187.77346800056188, + 186.3592518923149 + ], + [ + 2227.6928361496693, + 187.26839081904512, + 187.97549887316865, + 186.5612827649216 + ], + [ + 2231.422428440802, + 187.47042169165184, + 188.17752974577536, + 186.7633136375283 + ], + [ + 2235.1520207319345, + 187.67245256425855, + 188.37956061838207, + 186.96534451013503 + ], + [ + 2238.881613023067, + 187.87448343686526, + 188.58159149098879, + 187.16737538274174 + ], + [ + 2242.6112053141997, + 188.07651430947197, + 188.7836223635955, + 187.36940625534845 + ], + [ + 2246.340797605332, + 188.37956061838207, + 189.18768410880892, + 187.57143712795516 + ], + [ + 2250.070389896465, + 188.58159149098879, + 189.38971498141564, + 187.77346800056188 + ], + [ + 2253.7999821875974, + 188.88463779989888, + 189.5917458540224, + 188.17752974577536 + ], + [ + 2257.529574478731, + 189.0866686725056, + 189.79377672662912, + 188.37956061838207 + ], + [ + 2261.2591667698634, + 189.2886995451123, + 189.99580759923583, + 188.58159149098879 + ], + [ + 2264.988759060996, + 189.49073041771902, + 190.19783847184254, + 188.7836223635955 + ], + [ + 2268.7183513521286, + 189.69276129032573, + 190.39986934444926, + 188.9856532362022 + ], + [ + 2272.447943643261, + 189.89479216293245, + 190.60190021705597, + 189.18768410880892 + ], + [ + 2276.1775359343937, + 190.09682303553916, + 190.80393108966268, + 189.38971498141564 + ], + [ + 2279.9071282255263, + 190.29885390814593, + 191.00596196226945, + 189.5917458540224 + ], + [ + 2283.636720516659, + 190.50088478075264, + 191.20799283487617, + 189.79377672662912 + ], + [ + 2287.3663128077924, + 190.80393108966268, + 191.6120545800896, + 189.99580759923583 + ], + [ + 2291.095905098925, + 191.00596196226945, + 191.8140854526963, + 190.19783847184254 + ], + [ + 2294.8254973900575, + 191.3090082711795, + 192.01611632530302, + 190.60190021705597 + ], + [ + 2298.55508968119, + 191.5110391437862, + 192.21814719790973, + 190.80393108966268 + ], + [ + 2302.2846819723227, + 191.71307001639292, + 192.42017807051644, + 191.00596196226945 + ], + [ + 2306.0142742634553, + 191.9151008889997, + 192.6222089431232, + 191.20799283487617 + ], + [ + 2309.743866554588, + 192.1171317616064, + 192.82423981572992, + 191.41002370748288 + ], + [ + 2313.4734588457204, + 192.31916263421311, + 193.02627068833664, + 191.6120545800896 + ], + [ + 2317.203051136854, + 192.52119350681983, + 193.22830156094335, + 191.8140854526963 + ], + [ + 2320.9326434279865, + 192.72322437942654, + 193.43033243355006, + 192.01611632530302 + ], + [ + 2324.662235719119, + 192.92525525203325, + 193.63236330615678, + 192.21814719790973 + ], + [ + 2328.3918280102516, + 193.12728612463997, + 193.8343941787635, + 192.42017807051644 + ], + [ + 2332.121420301384, + 193.32931699724674, + 194.03642505137026, + 192.6222089431232 + ], + [ + 2335.851012592517, + 193.53134786985345, + 194.23845592397697, + 192.82423981572992 + ], + [ + 2339.5806048836494, + 193.73337874246016, + 194.44048679658368, + 193.02627068833664 + ], + [ + 2343.310197174782, + 193.93540961506687, + 194.6425176691904, + 193.22830156094335 + ], + [ + 2347.0397894659154, + 194.1374404876736, + 194.8445485417971, + 193.43033243355006 + ], + [ + 2350.769381757048, + 194.44048679658368, + 195.04657941440382, + 193.8343941787635 + ], + [ + 2354.4989740481806, + 194.6425176691904, + 195.24861028701054, + 194.03642505137026 + ], + [ + 2358.228566339313, + 194.9455639781005, + 195.65267203222402, + 194.23845592397697 + ], + [ + 2361.9581586304457, + 195.1475948507072, + 195.85470290483073, + 194.44048679658368 + ], + [ + 2365.6877509215783, + 195.34962572331392, + 196.05673377743744, + 194.6425176691904 + ], + [ + 2369.417343212711, + 195.55165659592063, + 196.25876465004416, + 194.8445485417971 + ], + [ + 2373.1469355038435, + 195.75368746852735, + 196.46079552265087, + 195.04657941440382 + ], + [ + 2376.876527794977, + 195.95571834113406, + 196.66282639525758, + 195.24861028701054 + ], + [ + 2380.6061200861095, + 196.15774921374077, + 196.86485726786432, + 195.45064115961725 + ], + [ + 2384.335712377242, + 196.3597800863475, + 197.06688814047104, + 195.65267203222402 + ], + [ + 2388.0653046683747, + 196.56181095895423, + 197.26891901307775, + 195.85470290483073 + ], + [ + 2391.7948969595072, + 196.76384183156097, + 197.4709498856845, + 196.05673377743744 + ], + [ + 2395.52448925064, + 196.96587270416768, + 197.6729807582912, + 196.25876465004416 + ], + [ + 2399.2540815417724, + 197.1679035767744, + 197.87501163089792, + 196.46079552265087 + ], + [ + 2402.983673832905, + 197.3699344493811, + 198.07704250350463, + 196.66282639525758 + ], + [ + 2406.7132661240385, + 197.57196532198785, + 198.27907337611137, + 196.86485726786432 + ], + [ + 2410.442858415171, + 197.77399619459456, + 198.48110424871808, + 197.06688814047104 + ], + [ + 2414.1724507063036, + 197.97602706720127, + 198.6831351213248, + 197.26891901307775 + ], + [ + 2417.902042997436, + 198.17805793980799, + 198.8851659939315, + 197.4709498856845 + ], + [ + 2421.6316352885688, + 198.38008881241473, + 199.08719686653825, + 197.6729807582912 + ], + [ + 2425.3612275797013, + 198.58211968502144, + 199.28922773914496, + 197.87501163089792 + ], + [ + 2429.090819870834, + 198.78415055762815, + 199.49125861175168, + 198.07704250350463 + ], + [ + 2432.8204121619665, + 198.98618143023486, + 199.6932894843584, + 198.27907337611137 + ], + [ + 2436.5500044531, + 199.1882123028416, + 199.89532035696513, + 198.48110424871808 + ], + [ + 2440.2795967442325, + 199.39024317544832, + 200.09735122957184, + 198.6831351213248 + ], + [ + 2444.009189035365, + 199.59227404805503, + 200.29938210217855, + 198.8851659939315 + ], + [ + 2447.7387813264977, + 199.79430492066177, + 200.50141297478527, + 199.08719686653825 + ], + [ + 2451.4683736176303, + 199.89532035696513, + 200.50141297478527, + 199.28922773914496 + ], + [ + 2455.197965908763, + 200.09735122957184, + 200.703443847392, + 199.49125861175168 + ], + [ + 2458.9275581998954, + 200.1983666658752, + 200.703443847392, + 199.6932894843584 + ], + [ + 2462.657150491028, + 199.99633579326849, + 200.09735122957184, + 199.89532035696513 + ], + [ + 2485.0347042378244, + 201.00649015630208, + 201.30953646521218, + 200.703443847392 + ], + [ + 2488.764296528957, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2492.4938888200895, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2496.223481111222, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2499.9530734023556, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2503.682665693488, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2507.4122579846207, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2511.1418502757533, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2514.871442566886, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2518.6010348580185, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2522.330627149151, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2526.0602194402836, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2529.789811731417, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2533.5194040225497, + 201.00649015630208, + 201.30953646521218, + 200.703443847392 + ], + [ + 2559.6265500604786, + 200.60242841108865, + 200.703443847392, + 200.50141297478527 + ], + [ + 2563.356142351611, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2567.085734642744, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2570.8153269338763, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2574.544919225009, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2578.2745115161415, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2582.004103807274, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2585.7336960984067, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2589.46328838954, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2593.1928806806727, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2596.9224729718053, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2600.652065262938, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2604.3816575540704, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2608.111249845203, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2611.8408421363356, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2615.570434427468, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2619.3000267186017, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2623.0296190097342, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2626.759211300867, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2630.4888035919994, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2634.218395883132, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2637.9479881742645, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2641.677580465397, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2645.4071727565297, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2649.136765047663, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2652.8663573387958, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2656.5959496299283, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2660.325541921061, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2664.0551342121935, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2667.784726503326, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2671.5143187944586, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2675.243911085591, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2678.9735033767247, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2682.7030956678573, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2686.43268795899, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2690.1622802501224, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2693.891872541255, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2697.6214648323876, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2701.35105712352, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2705.0806494146527, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2708.810241705786, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2712.539833996919, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2716.2694262880514, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2719.999018579184, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2723.7286108703165, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2727.458203161449, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2731.1877954525817, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2734.9173877437142, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2738.6469800348477, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2742.3765723259803, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2746.106164617113, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2749.8357569082455, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2753.565349199378, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2757.2949414905106, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2761.024533781643, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2764.7541260727758, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2768.4837183639092, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2772.213310655042, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2775.9429029461744, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2779.672495237307, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2783.4020875284396, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2787.131679819572, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2790.8612721107047, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2794.5908644018373, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2798.32045669297, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2802.0500489841033, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2805.779641275236, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2809.5092335663685, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2813.238825857501, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2816.9684181486336, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2820.698010439766, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2824.427602730899, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2828.1571950220314, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2831.886787313165, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2835.6163796042974, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2839.34597189543, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2843.0755641865626, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2846.805156477695, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2850.5347487688277, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2854.2643410599603, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2857.993933351093, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2861.7235256422264, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2865.453117933359, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2869.1827102244915, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2872.912302515624, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2876.6418948067567, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2880.3714870978893, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2884.101079389022, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2887.8306716801544, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2891.560263971288, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2895.2898562624205, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2899.019448553553, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2902.7490408446856, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2906.478633135818, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2910.208225426951, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2913.9378177180834, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2917.667410009216, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2921.3970023003494, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2925.126594591482, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2928.8561868826146, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2932.585779173747, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2936.3153714648797, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2940.0449637560123, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2943.774556047145, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2947.5041483382774, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2951.233740629411, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2954.9633329205435, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2958.692925211676, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2962.4225175028087, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2966.1521097939412, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2969.881702085074, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2973.6112943762064, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2977.340886667339, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2981.0704789584724, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2984.800071249605, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2988.5296635407376, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2992.25925583187, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2995.9888481230028, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 2999.7184404141353, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 3003.448032705268, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 3007.1776249964005, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 3010.907217287534, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 3014.6368095786665, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 3018.366401869799, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 3022.0959941609317, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 3025.8255864520643, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 3029.555178743197, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 3033.2847710343294, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 3037.014363325462, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 3040.7439556165955, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 3044.473547907728, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 3048.2031401988606, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 3051.932732489993, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 3055.662324781126, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 3059.3919170722584, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 3063.121509363391, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 3066.8511016545235, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 3070.580693945657, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 3074.3102862367896, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 3078.039878527922, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 3081.7694708190547, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 3085.4990631101873, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 3089.22865540132, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 3092.9582476924525, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 3096.687839983585, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 3100.4174322747185, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 3104.147024565851, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 3107.8766168569837, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 3111.6062091481162, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 3115.335801439249, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 3141.4429474771778, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 3145.1725397683103, + 200.90547471999872, + 201.30953646521218, + 200.50141297478527 + ], + [ + 3148.902132059443, + 200.80445928369537, + 201.30953646521218, + 200.29938210217855 + ], + [ + 3152.6317243505755, + 200.1983666658752, + 201.30953646521218, + 199.08719686653825 + ], + [ + 3156.361316641708, + 199.6932894843584, + 201.30953646521218, + 198.07704250350463 + ], + [ + 3160.0909089328406, + 199.1882123028416, + 201.30953646521218, + 197.06688814047104 + ], + [ + 3163.820501223974, + 198.6831351213248, + 201.30953646521218, + 196.05673377743744 + ], + [ + 3167.5500935151067, + 197.87501163089792, + 200.50141297478527, + 195.24861028701054 + ], + [ + 3171.2796858062393, + 196.86485726786432, + 199.49125861175168, + 194.23845592397697 + ], + [ + 3175.009278097372, + 195.85470290483073, + 198.48110424871808, + 193.22830156094335 + ], + [ + 3178.7388703885044, + 194.8445485417971, + 197.4709498856845, + 192.21814719790973 + ], + [ + 3182.468462679637, + 193.8343941787635, + 196.46079552265087, + 191.20799283487617 + ], + [ + 3186.1980549707696, + 192.82423981572992, + 195.45064115961725, + 190.19783847184254 + ], + [ + 3189.927647261902, + 191.8140854526963, + 194.44048679658368, + 189.18768410880892 + ], + [ + 3193.6572395530357, + 190.90494652596607, + 193.43033243355006, + 188.37956061838207 + ], + [ + 3197.3868318441682, + 189.99580759923583, + 192.6222089431232, + 187.36940625534845 + ], + [ + 3201.116424135301, + 188.9856532362022, + 191.6120545800896, + 186.3592518923149 + ], + [ + 3204.8460164264334, + 188.07651430947197, + 190.60190021705597, + 185.55112840188798 + ], + [ + 3208.575608717566, + 187.06635994643835, + 189.5917458540224, + 184.54097403885436 + ], + [ + 3212.3052010086985, + 186.0562055834048, + 188.58159149098879, + 183.5308196758208 + ], + [ + 3216.034793299831, + 185.24808209297788, + 187.77346800056188, + 182.7226961853939 + ], + [ + 3219.7643855909637, + 184.23792772994432, + 186.7633136375283, + 181.71254182236027 + ], + [ + 3223.493977882097, + 183.2277733669107, + 185.7531592744947, + 180.7023874593267 + ], + [ + 3227.2235701732297, + 182.4196498764838, + 184.94503578406784, + 179.8942639688998 + ], + [ + 3230.9531624643623, + 181.40949551345022, + 183.93488142103422, + 178.88410960586623 + ], + [ + 3234.682754755495, + 180.50035658672, + 182.9247270580006, + 178.07598611543932 + ], + [ + 3238.4123470466275, + 179.59121765998975, + 182.11660356757375, + 177.0658317524057 + ], + [ + 3242.14193933776, + 178.68207873325946, + 181.10644920454013, + 176.25770826197885 + ], + [ + 3245.8715316288926, + 177.6719243702259, + 180.0962948415065, + 175.24755389894523 + ], + [ + 3249.601123920025, + 176.863800879799, + 179.28817135107965, + 174.43943040851838 + ], + [ + 3253.3307162111587, + 175.85364651676542, + 178.27801698804603, + 173.42927604548476 + ], + [ + 3257.0603085022913, + 175.04552302633851, + 177.46989349761918, + 172.6211525550579 + ], + [ + 3260.789900793424, + 174.0353686633049, + 176.45973913458556, + 171.61099819202428 + ], + [ + 3264.5194930845564, + 173.22724517287804, + 175.6516156441587, + 170.80287470159737 + ], + [ + 3268.249085375689, + 172.3181062461478, + 174.6414612811251, + 169.99475121117052 + ], + [ + 3271.9786776668216, + 171.40896731941757, + 173.83333779069818, + 168.9845968481369 + ], + [ + 3275.708269957954, + 170.49982839268733, + 172.82318342766462, + 168.17647335771005 + ], + [ + 3279.4378622490867, + 169.69170490226043, + 172.0150599372377, + 167.36834986728314 + ], + [ + 3283.16745454022, + 168.7825659755302, + 171.20693644681086, + 166.35819550424952 + ], + [ + 3286.897046831353, + 167.87342704879995, + 170.19678208377724, + 165.55007201382267 + ], + [ + 3290.6266391224854, + 167.06530355837305, + 169.38865859335033, + 164.74194852339576 + ], + [ + 3294.356231413618, + 166.1561646316428, + 168.58053510292348, + 163.7317941603622 + ], + [ + 3298.0858237047505, + 165.24702570491257, + 167.57038073988986, + 162.9236706699353 + ], + [ + 3301.815415995883, + 164.43890221448572, + 166.762257249463, + 162.11554717950844 + ], + [ + 3305.5450082870157, + 163.6307787240588, + 165.9541337590361, + 161.30742368908153 + ], + [ + 3309.2746005781482, + 162.62062436102525, + 164.94397939600253, + 160.2972693260479 + ], + [ + 3313.0041928692817, + 161.81250087059834, + 164.13585590557562, + 159.48914583562106 + ], + [ + 3316.7337851604143, + 161.00437738017143, + 163.32773241514872, + 158.68102234519415 + ], + [ + 3320.463377451547, + 160.19625388974458, + 162.51960892472187, + 157.8728988547673 + ], + [ + 3324.1929697426795, + 159.28711496301435, + 161.50945456168824, + 157.0647753643404 + ], + [ + 3327.922562033812, + 158.47899147258744, + 160.7013310712614, + 156.25665187391354 + ], + [ + 3331.6521543249446, + 157.6708679821606, + 159.89320758083448, + 155.44852838348663 + ], + [ + 3335.381746616077, + 156.76172905543035, + 159.08508409040763, + 154.43837402045307 + ], + [ + 3339.1113389072098, + 155.95360556500344, + 158.27696059998073, + 153.63025053002616 + ], + [ + 3342.8409311983432, + 155.0444666382732, + 157.26680623694716, + 152.8221270395993 + ], + [ + 3346.570523489476, + 154.23634314784636, + 156.45868274652025, + 152.0140035491724 + ], + [ + 3350.3001157806084, + 153.42821965741945, + 155.65055925609335, + 151.20588005874555 + ], + [ + 3354.029708071741, + 152.62009616699254, + 154.8424357656665, + 150.39775656831864 + ], + [ + 3357.7593003628735, + 151.8119726765657, + 154.03431227523959, + 149.5896330778918 + ], + [ + 3361.488892654006, + 151.00384918613878, + 153.22618878481273, + 148.78150958746488 + ], + [ + 3365.2184849451387, + 150.19572569571193, + 152.41806529438583, + 147.97338609703797 + ], + [ + 3368.9480772362713, + 149.38760220528502, + 151.60994180395898, + 147.16526260661112 + ], + [ + 3372.6776695274048, + 148.57947871485817, + 150.80181831353207, + 146.35713911618421 + ], + [ + 3376.4072618185373, + 147.77135522443126, + 149.99369482310522, + 145.54901562575736 + ], + [ + 3380.13685410967, + 146.9632317340044, + 149.1855713326783, + 144.74089213533045 + ], + [ + 3383.8664464008025, + 146.1551082435775, + 148.37744784225146, + 143.9327686449036 + ], + [ + 3387.596038691935, + 145.44800018945398, + 147.56932435182455, + 143.3266760270834 + ], + [ + 3391.3256309830676, + 144.63987669902713, + 146.7612008613977, + 142.51855253665656 + ], + [ + 3395.0552232742, + 143.83175320860022, + 145.9530773709708, + 141.71042904622965 + ], + [ + 3398.784815565333, + 143.02362971817337, + 145.14495388054394, + 140.9023055558028 + ], + [ + 3402.5144078564663, + 142.21550622774646, + 144.33683039011703, + 140.0941820653759 + ], + [ + 3406.244000147599, + 141.4073827373196, + 143.52870689969018, + 139.28605857494904 + ], + [ + 3409.9735924387314, + 140.70027468319608, + 142.72058340926327, + 138.67996595712884 + ], + [ + 3413.703184729864, + 139.89215119276918, + 141.91245991883642, + 137.871842466702 + ], + [ + 3417.4327770209966, + 139.08402770234233, + 141.1043364284095, + 137.06371897627508 + ], + [ + 3421.162369312129, + 138.3769196482188, + 140.49824381058937, + 136.25559548584823 + ], + [ + 3424.8919616032617, + 137.5687961577919, + 139.69012032016246, + 135.44747199542132 + ], + [ + 3428.6215538943943, + 136.86168810366837, + 138.8819968297356, + 134.84137937760119 + ], + [ + 3432.351146185527, + 136.05356461324152, + 138.0738733393087, + 134.03325588717428 + ], + [ + 3436.0807384766604, + 135.2454411228146, + 137.2657498488818, + 133.22513239674743 + ], + [ + 3439.810330767793, + 134.63934850499447, + 136.65965723106166, + 132.61903977892723 + ], + [ + 3443.5399230589255, + 133.83122501456756, + 135.8515337406348, + 131.81091628850038 + ], + [ + 3447.269515350058, + 133.0231015241407, + 135.0434102502079, + 131.00279279807347 + ], + [ + 3450.9991076411907, + 132.3159934700172, + 134.235286759781, + 130.39670018025333 + ], + [ + 3454.7286999323233, + 131.60888541589367, + 133.62919414196085, + 129.58857668982643 + ], + [ + 3458.458292223456, + 130.80076192546676, + 132.821070651534, + 128.78045319939957 + ], + [ + 3462.1878845145884, + 130.09365387134324, + 132.0129471611071, + 128.17436058157944 + ], + [ + 3465.917476805722, + 129.3865458172197, + 131.40685454328695, + 127.36623709115253 + ], + [ + 3469.6470690968545, + 128.6794377630962, + 130.59873105286005, + 126.76014447333239 + ], + [ + 3473.376661387987, + 127.87131427266934, + 129.7906075624332, + 125.95202098290548 + ], + [ + 3477.1062536791196, + 127.26522165484914, + 129.184514944613, + 125.34592836508534 + ], + [ + 3480.835845970252, + 126.45709816442229, + 128.37639145418615, + 124.53780487465843 + ], + [ + 3484.5654382613848, + 125.74999011029877, + 127.77029883636595, + 123.72968138423158 + ], + [ + 3488.2950305525173, + 125.04288205617524, + 126.9621753459391, + 123.12358876641139 + ], + [ + 3492.02462284365, + 124.4367894383551, + 126.3560827281189, + 122.51749614859125 + ], + [ + 3495.7542151347834, + 123.6286659479282, + 125.54795923769206, + 121.70937265816434 + ], + [ + 3499.483807425916, + 122.92155789380467, + 124.73983574726515, + 121.1032800403442 + ], + [ + 3503.2133997170486, + 122.21444983968115, + 124.13374312944501, + 120.2951565499173 + ], + [ + 3506.942992008181, + 121.50734178555763, + 123.3256196390181, + 119.68906393209716 + ], + [ + 3510.6725842993137, + 120.8002337314341, + 122.71952702119796, + 118.88094044167025 + ], + [ + 3514.4021765904463, + 120.19414111361397, + 122.11343440337782, + 118.27484782385011 + ], + [ + 3518.131768881579, + 119.48703305949044, + 121.30531091295092, + 117.66875520602997 + ], + [ + 3521.8613611727114, + 118.77992500536692, + 120.69921829513078, + 116.86063171560306 + ], + [ + 3525.590953463845, + 118.0728169512434, + 119.89109480470387, + 116.25453909778292 + ], + [ + 3529.3205457549775, + 117.46672433342326, + 119.28500218688373, + 115.64844647996273 + ], + [ + 3533.05013804611, + 116.65860084299635, + 118.47687869645682, + 114.84032298953588 + ], + [ + 3536.7797303372427, + 116.05250822517621, + 117.87078607863668, + 114.23423037171568 + ], + [ + 3540.5093226283752, + 115.44641560735602, + 117.26469346081649, + 113.62813775389554 + ], + [ + 3544.238914919508, + 114.63829211692916, + 116.45656997038964, + 112.82001426346869 + ], + [ + 3547.9685072106404, + 114.03219949910897, + 115.85047735256944, + 112.2139216456485 + ], + [ + 3551.698099501773, + 113.42610688128883, + 115.2443847347493, + 111.60782902782836 + ], + [ + 3555.4276917929064, + 112.71899882716531, + 114.43626124432245, + 111.00173641000816 + ], + [ + 3559.157284084039, + 112.01189077304178, + 113.83016862650226, + 110.19361291958131 + ], + [ + 3562.8868763751716, + 111.40579815522165, + 113.22407600868212, + 109.58752030176112 + ], + [ + 3566.616468666304, + 110.79970553740145, + 112.61798339086192, + 108.98142768394098 + ], + [ + 3570.3460609574367, + 110.09259748327793, + 111.80985990043507, + 108.37533506612084 + ], + [ + 3574.0756532485693, + 109.48650486545779, + 111.20376728261488, + 107.76924244830064 + ], + [ + 3577.805245539702, + 108.8804122476376, + 110.59767466479474, + 107.1631498304805 + ], + [ + 3581.5348378308345, + 108.17330419351407, + 109.9915820469746, + 106.3550263400536 + ], + [ + 3585.264430121968, + 107.56721157569393, + 109.3854894291544, + 105.74893372223346 + ], + [ + 3588.9940224131005, + 106.86010352157041, + 108.57736593872755, + 105.14284110441332 + ], + [ + 3592.723614704233, + 106.25401090375027, + 107.97127332090736, + 104.53674848659313 + ], + [ + 3596.4532069953657, + 105.64791828593007, + 107.36518070308722, + 103.93065586877299 + ], + [ + 3600.1827992864983, + 105.04182566810994, + 106.75908808526708, + 103.32456325095279 + ], + [ + 3603.912391577631, + 104.4357330502898, + 106.15299546744689, + 102.71847063313265 + ], + [ + 3607.6419838687634, + 103.8296404324696, + 105.54690284962675, + 102.11237801531252 + ], + [ + 3611.371576159896, + 103.22354781464946, + 104.94081023180655, + 101.50628539749232 + ], + [ + 3615.1011684510295, + 102.61745519682927, + 104.33471761398641, + 100.90019277967218 + ], + [ + 3618.830760742162, + 102.01136257900913, + 103.72862499616627, + 100.29410016185199 + ], + [ + 3622.5603530332946, + 101.40526996118899, + 103.12253237834608, + 99.68800754403185 + ], + [ + 3626.289945324427, + 100.7991773433688, + 102.51643976052594, + 99.08191492621171 + ], + [ + 3630.01953761556, + 100.19308472554866, + 101.91034714270575, + 98.47582230839151 + ], + [ + 3633.7491299066924, + 99.58699210772846, + 101.30425452488561, + 97.86972969057138 + ], + [ + 3637.478722197825, + 99.08191492621171, + 100.69816190706547, + 97.4656679453579 + ], + [ + 3641.2083144889575, + 98.47582230839151, + 100.09206928924527, + 96.85957532753775 + ], + [ + 3644.937906780091, + 97.86972969057138, + 99.48597667142514, + 96.25348270971762 + ], + [ + 3648.6674990712236, + 97.26363707275118, + 98.87988405360494, + 95.64739009189742 + ], + [ + 3652.397091362356, + 96.65754445493104, + 98.2737914357848, + 95.04129747407728 + ], + [ + 3656.1266836534887, + 96.0514518371109, + 97.66769881796466, + 94.43520485625714 + ], + [ + 3659.8562759446213, + 95.5463746555941, + 97.06160620014447, + 94.03114311104366 + ], + [ + 3663.585868235754, + 94.9402820377739, + 96.45551358232433, + 93.42505049322352 + ], + [ + 3667.3154605268865, + 94.33418941995376, + 95.84942096450413, + 92.81895787540333 + ], + [ + 3671.045052818019, + 93.82911223843695, + 95.44535921929071, + 92.21286525758319 + ], + [ + 3674.7746451091525, + 93.32403505692014, + 94.83926660147057, + 91.80880351236976 + ], + [ + 3678.504237400285, + 92.7179424391, + 94.23317398365037, + 91.20271089454957 + ], + [ + 3682.2338296914177, + 92.11184982127986, + 93.62708136583024, + 90.59661827672943 + ], + [ + 3685.9634219825502, + 91.70778807606638, + 93.22301962061681, + 90.192556531516 + ], + [ + 3689.693014273683, + 91.10169545824624, + 92.61692700279661, + 89.58646391369581 + ], + [ + 3693.4226065648154, + 90.49560284042605, + 92.01083438497648, + 88.98037129587567 + ], + [ + 3697.152198855948, + 89.99052565890929, + 91.40474176715634, + 88.57630955066224 + ], + [ + 3700.8817911470805, + 89.48544847739248, + 91.00068002194286, + 87.97021693284205 + ], + [ + 3704.611383438214, + 88.87935585957229, + 90.39458740412272, + 87.36412431502191 + ], + [ + 3708.3409757293466, + 88.37427867805553, + 89.78849478630252, + 86.96006256980849 + ], + [ + 3712.070568020479, + 87.86920149653872, + 89.3844330410891, + 86.35396995198829 + ], + [ + 3715.8001603116118, + 87.36412431502191, + 88.77834042326896, + 85.94990820677486 + ], + [ + 3719.5297526027443, + 86.8590471335051, + 88.37427867805553, + 85.34381558895473 + ], + [ + 3723.259344893877, + 86.35396995198829, + 87.76818606023534, + 84.93975384374124 + ], + [ + 3726.9889371850095, + 85.74787733416815, + 87.1620934424152, + 84.3336612259211 + ], + [ + 3730.718529476142, + 85.34381558895473, + 86.75803169720177, + 83.92959948070768 + ], + [ + 3734.4481217672756, + 84.73772297113453, + 86.15193907938158, + 83.32350686288748 + ], + [ + 3738.177714058408, + 84.3336612259211, + 85.74787733416815, + 82.91944511767406 + ], + [ + 3741.9073063495407, + 83.8285840444043, + 85.14178471634796, + 82.51538337246063 + ], + [ + 3745.6368986406733, + 83.32350686288748, + 84.73772297113453, + 81.90929075464044 + ], + [ + 3749.366490931806, + 82.81842968137067, + 84.13163035331439, + 81.50522900942701 + ], + [ + 3753.0960832229384, + 82.31335249985392, + 83.72756860810097, + 80.89913639160687 + ], + [ + 3756.825675514071, + 81.80827531833711, + 83.12147599028077, + 80.49507464639339 + ], + [ + 3760.5552678052036, + 81.40421357312368, + 82.71741424506735, + 80.09101290117997 + ], + [ + 3764.284860096336, + 80.89913639160687, + 82.31335249985392, + 79.48492028335983 + ], + [ + 3768.0144523874696, + 80.39405921009006, + 81.70725988203372, + 79.08085853814634 + ], + [ + 3771.744044678602, + 79.98999746487664, + 81.3031981368203, + 78.67679679293292 + ], + [ + 3775.473636969735, + 79.58593571966315, + 80.89913639160687, + 78.2727350477195 + ], + [ + 3779.2032292608674, + 79.08085853814634, + 80.29304377378668, + 77.86867330250607 + ], + [ + 3782.932821552, + 78.67679679293292, + 79.88898202857325, + 77.46461155729259 + ], + [ + 3786.6624138431325, + 78.2727350477195, + 79.48492028335983, + 77.06054981207916 + ], + [ + 3790.392006134265, + 77.86867330250607, + 79.08085853814634, + 76.65648806686573 + ], + [ + 3794.1215984253977, + 77.36359612098926, + 78.4747659203262, + 76.25242632165231 + ], + [ + 3797.851190716531, + 77.06054981207916, + 78.07070417511278, + 76.0503954490456 + ], + [ + 3801.5807830076637, + 76.65648806686573, + 77.66664242989935, + 75.64633370383211 + ], + [ + 3805.3103752987963, + 76.35344175795564, + 77.46461155729259, + 75.24227195861869 + ], + [ + 3809.039967589929, + 75.94938001274221, + 77.06054981207916, + 74.83821021340526 + ], + [ + 3812.7695598810615, + 75.54531826752878, + 76.65648806686573, + 74.43414846819178 + ], + [ + 3816.499152172194, + 75.24227195861869, + 76.25242632165231, + 74.23211759558507 + ], + [ + 3820.2287444633266, + 74.83821021340526, + 75.84836457643883, + 73.82805585037164 + ], + [ + 3823.958336754459, + 74.43414846819178, + 75.4443028312254, + 73.42399410515822 + ], + [ + 3827.6879290455927, + 74.23211759558507, + 75.24227195861869, + 73.2219632325515 + ], + [ + 3831.4175213367253, + 73.82805585037164, + 74.83821021340526, + 72.81790148733802 + ], + [ + 3835.147113627858, + 73.42399410515822, + 74.43414846819178, + 72.4138397421246 + ], + [ + 3838.8767059189904, + 73.2219632325515, + 74.23211759558507, + 72.21180886951788 + ], + [ + 3842.606298210123, + 72.81790148733802, + 73.82805585037164, + 71.80774712430446 + ], + [ + 3846.3358905012556, + 72.4138397421246, + 73.42399410515822, + 71.40368537909097 + ], + [ + 3850.065482792388, + 72.1107934332145, + 73.01993235994479, + 71.20165450648426 + ], + [ + 3853.7950750835207, + 71.80774712430446, + 72.81790148733802, + 70.79759276127083 + ], + [ + 3857.524667374654, + 71.50470081539436, + 72.4138397421246, + 70.59556188866412 + ], + [ + 3861.254259665787, + 71.20165450648426, + 72.21180886951788, + 70.1915001434507 + ], + [ + 3864.9838519569194, + 70.89860819757422, + 71.80774712430446, + 69.98946927084398 + ], + [ + 3868.713444248052, + 70.49454645236074, + 71.40368537909097, + 69.5854075256305 + ], + [ + 3872.4430365391845, + 70.1915001434507, + 71.20165450648426, + 69.18134578041708 + ], + [ + 3876.172628830317, + 69.8884538345406, + 70.79759276127083, + 68.97931490781036 + ], + [ + 3879.9022211214497, + 69.5854075256305, + 70.59556188866412, + 68.57525316259694 + ], + [ + 3883.6318134125822, + 69.28236121672046, + 70.1915001434507, + 68.37322228999022 + ], + [ + 3887.3614057037157, + 68.87829947150698, + 69.78743839823721, + 67.96916054477674 + ], + [ + 3891.0909979948483, + 68.67626859890026, + 69.5854075256305, + 67.76712967217003 + ], + [ + 3894.820590285981, + 68.27220685368684, + 69.18134578041708, + 67.3630679269566 + ], + [ + 3898.5501825771134, + 68.07017598108013, + 68.97931490781036, + 67.16103705434989 + ], + [ + 3902.279774868246, + 67.6661142358667, + 68.57525316259694, + 66.75697530913641 + ], + [ + 3906.0093671593786, + 67.46408336325993, + 68.37322228999022, + 66.5549444365297 + ], + [ + 3909.738959450511, + 67.16103705434989, + 67.96916054477674, + 66.35291356392298 + ], + [ + 3913.4685517416438, + 66.85799074543979, + 67.76712967217003, + 65.94885181870956 + ], + [ + 3917.1981440327772, + 66.5549444365297, + 67.3630679269566, + 65.74682094610284 + ], + [ + 3920.92773632391, + 66.25189812761965, + 67.16103705434989, + 65.34275920088942 + ], + [ + 3924.6573286150424, + 65.94885181870956, + 66.75697530913641, + 65.14072832828265 + ], + [ + 3928.386920906175, + 65.64580550979946, + 66.5549444365297, + 64.73666658306922 + ], + [ + 3932.1165131973075, + 65.44377463719275, + 66.35291356392298, + 64.53463571046251 + ], + [ + 3935.84610548844, + 65.14072832828265, + 65.94885181870956, + 64.3326048378558 + ], + [ + 3939.5756977795727, + 64.83768201937261, + 65.74682094610284, + 63.92854309264237 + ], + [ + 3943.3052900707053, + 64.53463571046251, + 65.34275920088942, + 63.7265122200356 + ], + [ + 3947.0348823618388, + 64.23158940155241, + 65.14072832828265, + 63.322450474822176 + ], + [ + 3950.7644746529713, + 64.0295585289457, + 64.93869745567594, + 63.12041960221546 + ], + [ + 3954.494066944104, + 63.7265122200356, + 64.53463571046251, + 62.91838872960875 + ], + [ + 3958.2236592352365, + 63.42346591112556, + 64.3326048378558, + 62.514326984395325 + ], + [ + 3961.953251526369, + 63.12041960221546, + 63.92854309264237, + 62.31229611178861 + ], + [ + 3965.6828438175016, + 62.91838872960875, + 63.7265122200356, + 62.11026523918184 + ], + [ + 3969.412436108634, + 62.61534242069865, + 63.52448134742889, + 61.70620349396842 + ], + [ + 3973.142028399767, + 62.31229611178861, + 63.12041960221546, + 61.504172621361704 + ], + [ + 3976.8716206909003, + 62.11026523918184, + 62.91838872960875, + 61.30214174875499 + ], + [ + 3980.601212982033, + 61.8072189302718, + 62.71635785700204, + 60.898080003541565 + ], + [ + 3984.3308052731654, + 61.504172621361704, + 62.31229611178861, + 60.69604913093485 + ], + [ + 3988.060397564298, + 61.30214174875499, + 62.11026523918184, + 60.49401825832808 + ], + [ + 3991.7899898554306, + 61.10011087614828, + 61.90823436657513, + 60.29198738572137 + ], + [ + 3995.519582146563, + 60.69604913093485, + 61.504172621361704, + 59.887925640507945 + ], + [ + 3999.2491744376957, + 60.49401825832808, + 61.30214174875499, + 59.68589476790123 + ], + [ + 4002.9787667288283, + 60.29198738572137, + 61.10011087614828, + 59.48386389529452 + ], + [ + 4006.708359019962, + 59.98894107681133, + 60.69604913093485, + 59.281833022687806 + ], + [ + 4010.4379513110944, + 59.68589476790123, + 60.49401825832808, + 58.877771277474324 + ], + [ + 4014.167543602227, + 59.48386389529452, + 60.29198738572137, + 58.67574040486761 + ], + [ + 4017.8971358933595, + 59.281833022687806, + 60.08995651311466, + 58.4737095322609 + ], + [ + 4021.626728184492, + 58.97878671377771, + 59.68589476790123, + 58.271678659654185 + ], + [ + 4025.3563204756247, + 58.67574040486761, + 59.48386389529452, + 57.86761691444076 + ], + [ + 4029.0859127667572, + 58.4737095322609, + 59.281833022687806, + 57.66558604183405 + ], + [ + 4032.81550505789, + 58.271678659654185, + 59.079802150081036, + 57.46355516922728 + ], + [ + 4036.5450973490233, + 57.96863235074409, + 58.67574040486761, + 57.261524296620564 + ], + [ + 4040.274689640156, + 57.766601478137375, + 58.4737095322609, + 57.05949342401385 + ], + [ + 4044.0042819312885, + 57.46355516922728, + 58.271678659654185, + 56.655431678800426 + ], + [ + 4047.733874222421, + 57.261524296620564, + 58.06964778704747, + 56.45340080619371 + ], + [ + 4051.4634665135536, + 57.05949342401385, + 57.86761691444076, + 56.251369933587 + ], + [ + 4055.193058804686, + 56.756447115103754, + 57.46355516922728, + 56.04933906098023 + ], + [ + 4058.9226510958188, + 56.55441624249704, + 57.261524296620564, + 55.84730818837352 + ], + [ + 4062.6522433869513, + 56.251369933587, + 57.05949342401385, + 55.44324644316009 + ], + [ + 4066.381835678084, + 56.04933906098023, + 56.85746255140714, + 55.24121557055338 + ], + [ + 4070.1114279692174, + 55.84730818837352, + 56.655431678800426, + 55.039184697946666 + ], + [ + 4073.84102026035, + 55.54426187946348, + 56.251369933587, + 54.83715382533995 + ], + [ + 4077.5706125514826, + 55.342231006856764, + 56.04933906098023, + 54.63512295273324 + ], + [ + 4081.300204842615, + 55.140200134249994, + 55.84730818837352, + 54.43309208012647 + ], + [ + 4085.0297971337477, + 54.93816926164328, + 55.645277315766805, + 54.23106120751976 + ], + [ + 4088.7593894248803, + 54.73613838903657, + 55.44324644316009, + 54.029030334913045 + ], + [ + 4092.488981716013, + 54.43309208012647, + 55.24121557055338, + 53.62496858969962 + ], + [ + 4096.218574007145, + 54.23106120751976, + 55.039184697946666, + 53.42293771709291 + ], + [ + 4099.948166298279, + 53.92801489860972, + 54.63512295273324, + 53.220906844486194 + ], + [ + 4103.6777585894115, + 53.72598402600295, + 54.43309208012647, + 53.018875971879424 + ], + [ + 4107.407350880544, + 53.523953153396235, + 54.23106120751976, + 52.81684509927271 + ], + [ + 4111.136943171677, + 53.32192228078952, + 54.029030334913045, + 52.614814226666 + ], + [ + 4114.866535462809, + 53.11989140818281, + 53.82699946230633, + 52.412783354059286 + ], + [ + 4118.596127753942, + 52.9178605355761, + 53.62496858969962, + 52.21075248145257 + ], + [ + 4122.325720045074, + 52.715829662969384, + 53.42293771709291, + 52.00872160884586 + ], + [ + 4126.055312336207, + 52.51379879036267, + 53.220906844486194, + 51.80669073623915 + ], + [ + 4129.78490462734, + 52.31176791775596, + 53.018875971879424, + 51.604659863632435 + ], + [ + 4133.514496918473, + 52.10973704514919, + 52.81684509927271, + 51.402628991025665 + ], + [ + 4137.244089209606, + 51.80669073623915, + 52.412783354059286, + 51.20059811841895 + ], + [ + 4140.973681500738, + 51.50364442732905, + 52.21075248145257, + 50.79653637320553 + ], + [ + 4144.703273791871, + 51.30161355472234, + 52.00872160884586, + 50.594505500598814 + ], + [ + 4148.432866083003, + 51.099582682115624, + 51.80669073623915, + 50.3924746279921 + ], + [ + 4152.162458374136, + 50.89755180950891, + 51.604659863632435, + 50.19044375538539 + ], + [ + 4155.8920506652685, + 50.69552093690214, + 51.402628991025665, + 49.988412882778675 + ], + [ + 4159.621642956402, + 50.49349006429543, + 51.20059811841895, + 49.786382010171906 + ], + [ + 4163.3512352475345, + 50.291459191688716, + 50.99856724581224, + 49.58435113756519 + ], + [ + 4167.080827538667, + 50.089428319082, + 50.79653637320553, + 49.38232026495848 + ], + [ + 4170.8104198298, + 49.88739744647529, + 50.594505500598814, + 49.18028939235177 + ], + [ + 4174.540012120932, + 49.68536657386858, + 50.3924746279921, + 48.978258519745054 + ], + [ + 4178.269604412065, + 49.483335701261865, + 50.19044375538539, + 48.77622764713834 + ], + [ + 4181.999196703197, + 49.28130482865515, + 49.988412882778675, + 48.57419677453163 + ], + [ + 4185.72878899433, + 49.18028939235177, + 49.786382010171906, + 48.57419677453163 + ], + [ + 4189.4583812854635, + 48.978258519745054, + 49.58435113756519, + 48.37216590192486 + ], + [ + 4193.187973576596, + 48.77622764713834, + 49.38232026495848, + 48.170135029318146 + ], + [ + 4196.917565867729, + 48.57419677453163, + 49.18028939235177, + 47.96810415671143 + ], + [ + 4200.647158158861, + 48.37216590192486, + 48.978258519745054, + 47.76607328410472 + ], + [ + 4204.376750449994, + 48.170135029318146, + 48.77622764713834, + 47.56404241149801 + ], + [ + 4208.106342741126, + 47.96810415671143, + 48.57419677453163, + 47.362011538891295 + ], + [ + 4211.835935032259, + 47.76607328410472, + 48.37216590192486, + 47.15998066628458 + ], + [ + 4215.5655273233915, + 47.56404241149801, + 48.170135029318146, + 46.95794979367787 + ], + [ + 4219.295119614525, + 47.46302697519462, + 48.170135029318146, + 46.7559189210711 + ], + [ + 4223.024711905658, + 47.26099610258791, + 47.96810415671143, + 46.55388804846439 + ], + [ + 4226.75430419679, + 47.0589652299812, + 47.76607328410472, + 46.351857175857674 + ], + [ + 4230.483896487923, + 46.856934357374485, + 47.56404241149801, + 46.14982630325096 + ], + [ + 4234.213488779055, + 46.65490348476777, + 47.362011538891295, + 45.94779543064425 + ], + [ + 4237.943081070188, + 46.55388804846439, + 47.15998066628458, + 45.94779543064425 + ], + [ + 4241.67267336132, + 46.351857175857674, + 46.95794979367787, + 45.745764558037536 + ], + [ + 4245.402265652453, + 46.14982630325096, + 46.7559189210711, + 45.54373368543082 + ], + [ + 4249.1318579435865, + 45.94779543064425, + 46.55388804846439, + 45.34170281282405 + ], + [ + 4252.861450234719, + 45.745764558037536, + 46.351857175857674, + 45.13967194021734 + ], + [ + 4256.591042525852, + 45.54373368543082, + 46.14982630325096, + 44.93764106761063 + ], + [ + 4260.320634816984, + 45.44271824912744, + 46.14982630325096, + 44.735610195003915 + ], + [ + 4264.050227108117, + 45.240687376520725, + 45.94779543064425, + 44.5335793223972 + ], + [ + 4267.779819399249, + 45.13967194021734, + 45.745764558037536, + 44.5335793223972 + ], + [ + 4271.509411690382, + 44.93764106761063, + 45.54373368543082, + 44.33154844979049 + ], + [ + 4275.2390039815145, + 44.735610195003915, + 45.34170281282405, + 44.129517577183776 + ], + [ + 4278.968596272648, + 44.5335793223972, + 45.13967194021734, + 43.92748670457706 + ], + [ + 4282.698188563781, + 44.33154844979049, + 44.93764106761063, + 43.725455831970294 + ], + [ + 4286.427780854913, + 44.230533013487104, + 44.93764106761063, + 43.52342495936358 + ], + [ + 4290.157373146046, + 44.129517577183776, + 44.735610195003915, + 43.52342495936358 + ], + [ + 4293.886965437178, + 43.92748670457706, + 44.5335793223972, + 43.32139408675687 + ], + [ + 4297.616557728311, + 43.725455831970294, + 44.33154844979049, + 43.119363214150155 + ], + [ + 4301.3461500194435, + 43.52342495936358, + 44.129517577183776, + 42.91733234154344 + ], + [ + 4305.075742310576, + 43.42240952306025, + 44.129517577183776, + 42.71530146893673 + ], + [ + 4308.80533460171, + 43.32139408675687, + 43.92748670457706, + 42.71530146893673 + ], + [ + 4312.534926892842, + 43.119363214150155, + 43.725455831970294, + 42.51327059633002 + ], + [ + 4316.264519183975, + 42.91733234154344, + 43.52342495936358, + 42.311239723723304 + ], + [ + 4319.994111475107, + 42.71530146893673, + 43.32139408675687, + 42.109208851116534 + ], + [ + 4323.72370376624, + 42.71530146893673, + 43.32139408675687, + 42.109208851116534 + ], + [ + 4327.453296057372, + 42.51327059633002, + 43.119363214150155, + 41.90717797850982 + ], + [ + 4331.182888348505, + 42.311239723723304, + 42.91733234154344, + 41.70514710590311 + ], + [ + 4334.912480639638, + 42.109208851116534, + 42.71530146893673, + 41.503116233296396 + ], + [ + 4338.642072930771, + 42.109208851116534, + 42.71530146893673, + 41.503116233296396 + ], + [ + 4342.371665221904, + 41.90717797850982, + 42.51327059633002, + 41.30108536068968 + ], + [ + 4346.101257513036, + 41.70514710590311, + 42.311239723723304, + 41.09905448808297 + ], + [ + 4349.830849804169, + 41.503116233296396, + 42.109208851116534, + 40.89702361547626 + ], + [ + 4353.560442095301, + 41.503116233296396, + 42.109208851116534, + 40.89702361547626 + ], + [ + 4357.290034386434, + 41.30108536068968, + 41.90717797850982, + 40.69499274286949 + ], + [ + 4361.0196266775665, + 41.09905448808297, + 41.70514710590311, + 40.492961870262775 + ], + [ + 4364.749218968699, + 40.998039051779585, + 41.503116233296396, + 40.492961870262775 + ], + [ + 4368.478811259833, + 40.89702361547626, + 41.503116233296396, + 40.29093099765606 + ], + [ + 4372.208403550965, + 40.69499274286949, + 41.30108536068968, + 40.08890012504935 + ], + [ + 4375.937995842098, + 40.492961870262775, + 41.09905448808297, + 39.88686925244264 + ], + [ + 4379.66758813323, + 40.39194643395945, + 40.89702361547626, + 39.88686925244264 + ], + [ + 4383.397180424363, + 40.29093099765606, + 40.89702361547626, + 39.684838379835924 + ], + [ + 4387.1267727154955, + 40.08890012504935, + 40.69499274286949, + 39.48280750722921 + ], + [ + 4390.856365006628, + 39.987884688745964, + 40.492961870262775, + 39.48280750722921 + ], + [ + 4394.585957297761, + 39.88686925244264, + 40.492961870262775, + 39.2807766346225 + ], + [ + 4398.315549588893, + 39.684838379835924, + 40.29093099765606, + 39.07874576201573 + ], + [ + 4402.045141880027, + 39.58382294353254, + 40.08890012504935, + 39.07874576201573 + ], + [ + 4405.774734171159, + 39.48280750722921, + 40.08890012504935, + 38.876714889409016 + ], + [ + 4409.504326462292, + 39.2807766346225, + 39.88686925244264, + 38.6746840168023 + ], + [ + 4413.233918753424, + 39.17976119831911, + 39.684838379835924, + 38.6746840168023 + ], + [ + 4416.963511044557, + 39.07874576201573, + 39.684838379835924, + 38.47265314419559 + ], + [ + 4420.69310333569, + 38.9777303257124, + 39.48280750722921, + 38.47265314419559 + ], + [ + 4424.422695626822, + 38.77569945310569, + 39.2807766346225, + 38.27062227158888 + ], + [ + 4428.152287917955, + 38.6746840168023, + 39.2807766346225, + 38.068591398982164 + ], + [ + 4431.881880209088, + 38.573668580498975, + 39.07874576201573, + 38.068591398982164 + ], + [ + 4435.611472500221, + 38.47265314419559, + 39.07874576201573, + 37.86656052637545 + ], + [ + 4439.341064791353, + 38.27062227158888, + 38.876714889409016, + 37.66452965376868 + ], + [ + 4443.070657082486, + 38.16960683528549, + 38.6746840168023, + 37.66452965376868 + ], + [ + 4446.8002493736185, + 38.068591398982164, + 38.6746840168023, + 37.46249878116197 + ], + [ + 4450.529841664751, + 37.96757596267878, + 38.47265314419559, + 37.46249878116197 + ], + [ + 4454.259433955884, + 37.86656052637545, + 38.47265314419559, + 37.260467908555256 + ], + [ + 4457.989026247016, + 37.76554509007207, + 38.27062227158888, + 37.260467908555256 + ], + [ + 4461.71861853815, + 37.563514217465354, + 38.068591398982164, + 37.05843703594854 + ], + [ + 4465.448210829282, + 37.46249878116197, + 38.068591398982164, + 36.85640616334183 + ], + [ + 4469.177803120415, + 37.36148334485864, + 37.86656052637545, + 36.85640616334183 + ], + [ + 4472.907395411547, + 37.260467908555256, + 37.86656052637545, + 36.65437529073512 + ], + [ + 4476.63698770268, + 37.15945247225193, + 37.66452965376868, + 36.65437529073512 + ], + [ + 4480.366579993813, + 37.05843703594854, + 37.66452965376868, + 36.452344418128405 + ], + [ + 4484.096172284945, + 36.957421599645215, + 37.46249878116197, + 36.452344418128405 + ], + [ + 4487.825764576078, + 36.755390727038446, + 37.260467908555256, + 36.25031354552169 + ], + [ + 4491.555356867211, + 36.755390727038446, + 37.260467908555256, + 36.25031354552169 + ], + [ + 4495.284949158344, + 36.55335985443173, + 37.05843703594854, + 36.04828267291492 + ], + [ + 4499.014541449476, + 36.55335985443173, + 37.05843703594854, + 36.04828267291492 + ], + [ + 4502.744133740609, + 36.35132898182502, + 36.85640616334183, + 35.84625180030821 + ], + [ + 4506.4737260317415, + 36.25031354552169, + 36.85640616334183, + 35.6442209277015 + ], + [ + 4510.203318322874, + 36.14929810921831, + 36.65437529073512, + 35.6442209277015 + ], + [ + 4513.932910614007, + 36.04828267291492, + 36.65437529073512, + 35.442190055094784 + ], + [ + 4517.662502905139, + 35.947267236611594, + 36.452344418128405, + 35.442190055094784 + ], + [ + 4521.392095196273, + 35.947267236611594, + 36.452344418128405, + 35.442190055094784 + ], + [ + 4525.121687487405, + 35.74523636400488, + 36.25031354552169, + 35.24015918248807 + ], + [ + 4528.851279778538, + 35.74523636400488, + 36.25031354552169, + 35.24015918248807 + ], + [ + 4532.5808720696705, + 35.54320549139817, + 36.04828267291492, + 35.03812830988136 + ], + [ + 4536.310464360803, + 35.54320549139817, + 36.04828267291492, + 35.03812830988136 + ], + [ + 4540.040056651936, + 35.3411746187914, + 35.84625180030821, + 34.836097437274645 + ], + [ + 4543.769648943068, + 35.3411746187914, + 35.84625180030821, + 34.836097437274645 + ], + [ + 4547.499241234201, + 35.139143746184686, + 35.6442209277015, + 34.634066564667876 + ], + [ + 4551.228833525334, + 35.139143746184686, + 35.6442209277015, + 34.634066564667876 + ], + [ + 4554.958425816467, + 34.93711287357797, + 35.442190055094784, + 34.43203569206116 + ], + [ + 4558.688018107599, + 34.93711287357797, + 35.442190055094784, + 34.43203569206116 + ], + [ + 4562.417610398732, + 34.836097437274645, + 35.442190055094784, + 34.23000481945445 + ], + [ + 4566.147202689865, + 34.73508200097126, + 35.24015918248807, + 34.23000481945445 + ], + [ + 4569.876794980997, + 34.73508200097126, + 35.24015918248807, + 34.23000481945445 + ], + [ + 4573.60638727213, + 34.53305112836455, + 35.03812830988136, + 34.02797394684774 + ], + [ + 4577.335979563262, + 34.53305112836455, + 35.03812830988136, + 34.02797394684774 + ], + [ + 4581.065571854396, + 34.331020255757835, + 34.836097437274645, + 33.825943074241025 + ], + [ + 4584.795164145528, + 34.331020255757835, + 34.836097437274645, + 33.825943074241025 + ], + [ + 4588.524756436661, + 34.331020255757835, + 34.836097437274645, + 33.825943074241025 + ], + [ + 4592.2543487277935, + 34.12898938315112, + 34.634066564667876, + 33.62391220163431 + ], + [ + 4595.983941018926, + 34.12898938315112, + 34.634066564667876, + 33.62391220163431 + ], + [ + 4599.713533310059, + 33.92695851054441, + 34.43203569206116, + 33.4218813290276 + ], + [ + 4603.443125601191, + 33.92695851054441, + 34.43203569206116, + 33.4218813290276 + ], + [ + 4607.172717892324, + 33.92695851054441, + 34.43203569206116, + 33.4218813290276 + ], + [ + 4610.902310183457, + 33.72492763793764, + 34.23000481945445, + 33.219850456420886 + ], + [ + 4614.63190247459, + 33.72492763793764, + 34.23000481945445, + 33.219850456420886 + ], + [ + 4618.3614947657225, + 33.72492763793764, + 34.23000481945445, + 33.219850456420886 + ], + [ + 4622.091087056855, + 33.52289676533093, + 34.02797394684774, + 33.017819583814116 + ], + [ + 4625.820679347988, + 33.52289676533093, + 34.02797394684774, + 33.017819583814116 + ], + [ + 4629.55027163912, + 33.4218813290276, + 33.825943074241025, + 33.017819583814116 + ], + [ + 4633.279863930253, + 33.320865892724214, + 33.825943074241025, + 32.815788711207404 + ], + [ + 4637.009456221385, + 33.320865892724214, + 33.825943074241025, + 32.815788711207404 + ], + [ + 4640.739048512519, + 33.219850456420886, + 33.62391220163431, + 32.815788711207404 + ], + [ + 4644.468640803651, + 33.1188350201175, + 33.62391220163431, + 32.61375783860069 + ], + [ + 4648.198233094784, + 33.1188350201175, + 33.62391220163431, + 32.61375783860069 + ], + [ + 4651.927825385917, + 33.017819583814116, + 33.4218813290276, + 32.61375783860069 + ], + [ + 4655.657417677049, + 32.91680414751079, + 33.4218813290276, + 32.41172696599398 + ], + [ + 4659.387009968182, + 32.91680414751079, + 33.4218813290276, + 32.41172696599398 + ], + [ + 4663.116602259314, + 32.91680414751079, + 33.4218813290276, + 32.41172696599398 + ], + [ + 4666.846194550447, + 32.815788711207404, + 33.219850456420886, + 32.41172696599398 + ], + [ + 4670.57578684158, + 32.714773274904076, + 33.219850456420886, + 32.209696093387265 + ], + [ + 4674.305379132713, + 32.714773274904076, + 33.219850456420886, + 32.209696093387265 + ], + [ + 4678.0349714238455, + 32.61375783860069, + 33.017819583814116, + 32.209696093387265 + ], + [ + 4681.764563714978, + 32.51274240229736, + 33.017819583814116, + 32.00766522078055 + ], + [ + 4685.494156006111, + 32.51274240229736, + 33.017819583814116, + 32.00766522078055 + ], + [ + 4689.223748297243, + 32.51274240229736, + 33.017819583814116, + 32.00766522078055 + ], + [ + 4692.953340588376, + 32.41172696599398, + 32.815788711207404, + 32.00766522078055 + ], + [ + 4696.682932879508, + 32.31071152969059, + 32.815788711207404, + 31.80563434817384 + ], + [ + 4700.412525170641, + 32.31071152969059, + 32.815788711207404, + 31.80563434817384 + ], + [ + 4704.142117461774, + 32.31071152969059, + 32.815788711207404, + 31.80563434817384 + ], + [ + 4707.871709752907, + 32.209696093387265, + 32.61375783860069, + 31.80563434817384 + ], + [ + 4711.60130204404, + 32.10868065708388, + 32.61375783860069, + 31.603603475567127 + ], + [ + 4715.330894335172, + 32.10868065708388, + 32.61375783860069, + 31.603603475567127 + ], + [ + 4719.060486626305, + 32.10868065708388, + 32.61375783860069, + 31.603603475567127 + ], + [ + 4722.790078917437, + 32.00766522078055, + 32.41172696599398, + 31.603603475567127 + ], + [ + 4726.51967120857, + 32.00766522078055, + 32.41172696599398, + 31.603603475567127 + ], + [ + 4730.2492634997025, + 31.906649784477167, + 32.41172696599398, + 31.401572602960357 + ], + [ + 4733.978855790836, + 31.906649784477167, + 32.41172696599398, + 31.401572602960357 + ], + [ + 4737.7084480819685, + 31.906649784477167, + 32.41172696599398, + 31.401572602960357 + ], + [ + 4741.438040373101, + 31.80563434817384, + 32.209696093387265, + 31.401572602960357 + ], + [ + 4745.167632664234, + 31.80563434817384, + 32.209696093387265, + 31.401572602960357 + ], + [ + 4748.897224955366, + 31.704618911870455, + 32.209696093387265, + 31.199541730353644 + ], + [ + 4752.626817246499, + 31.704618911870455, + 32.209696093387265, + 31.199541730353644 + ], + [ + 4756.356409537631, + 31.704618911870455, + 32.209696093387265, + 31.199541730353644 + ], + [ + 4760.086001828764, + 31.603603475567127, + 32.00766522078055, + 31.199541730353644 + ], + [ + 4763.8155941198975, + 31.603603475567127, + 32.00766522078055, + 31.199541730353644 + ], + [ + 4767.54518641103, + 31.603603475567127, + 32.00766522078055, + 31.199541730353644 + ], + [ + 4771.274778702163, + 31.603603475567127, + 32.00766522078055, + 31.199541730353644 + ], + [ + 4775.004370993295, + 31.502588039263742, + 32.00766522078055, + 30.99751085774693 + ], + [ + 4778.733963284428, + 31.502588039263742, + 32.00766522078055, + 30.99751085774693 + ], + [ + 4782.46355557556, + 31.502588039263742, + 32.00766522078055, + 30.99751085774693 + ], + [ + 4786.193147866693, + 31.401572602960357, + 31.80563434817384, + 30.99751085774693 + ], + [ + 4789.9227401578255, + 31.401572602960357, + 31.80563434817384, + 30.99751085774693 + ], + [ + 4793.652332448959, + 31.401572602960357, + 31.80563434817384, + 30.99751085774693 + ], + [ + 4797.381924740092, + 31.401572602960357, + 31.80563434817384, + 30.99751085774693 + ], + [ + 4801.111517031224, + 31.401572602960357, + 31.80563434817384, + 30.99751085774693 + ], + [ + 4804.841109322357, + 31.401572602960357, + 31.80563434817384, + 30.99751085774693 + ], + [ + 4808.570701613489, + 31.30055716665703, + 31.80563434817384, + 30.79547998514022 + ], + [ + 4812.300293904622, + 31.30055716665703, + 31.80563434817384, + 30.79547998514022 + ], + [ + 4816.029886195754, + 31.30055716665703, + 31.80563434817384, + 30.79547998514022 + ], + [ + 4819.759478486887, + 31.30055716665703, + 31.80563434817384, + 30.79547998514022 + ], + [ + 4823.4890707780205, + 31.199541730353644, + 31.603603475567127, + 30.79547998514022 + ], + [ + 4827.218663069153, + 31.199541730353644, + 31.603603475567127, + 30.79547998514022 + ], + [ + 4830.948255360286, + 31.199541730353644, + 31.603603475567127, + 30.79547998514022 + ] + ] + }, + "samples": { + "Tj": 1276, + "Tc": 1283, + "Tr": 1188 + } + } + } +} diff --git a/outputs/expansion_batch04/t1_thermal/mt_rc1mxhfcal/template_validation.json b/outputs/expansion_batch04/t1_thermal/mt_rc1mxhfcal/template_validation.json new file mode 100644 index 0000000000000000000000000000000000000000..824cc01aa319302914b50522a34a9fc0f9623143 --- /dev/null +++ b/outputs/expansion_batch04/t1_thermal/mt_rc1mxhfcal/template_validation.json @@ -0,0 +1,6794 @@ +{ + "catalog_id": "CHEM-149", + "asset_type_id": "instrument.mt_rc1mxhfcal", + "checked_at": "2026-09-25T12:25:28.404477+00:00", + "status": "passed", + "library": "assets/expansion_batch04/t1_thermal/mt_rc1mxhfcal/reaction_mass_library.json", + "library_sha256": "8d94814c1042719e5f8c658ee4b5494aeb2d0ce0a36bb5156e3cbe3d11821189", + "substances": 71, + "distinct_cas_with_cp_and_density": 71, + "reactions": 6, + "checks": [ + { + "id": "library_identity", + "status": "passed", + "detail": null + }, + { + "id": "at_least_50_distinct_substances_with_cp_and_density", + "status": "passed", + "detail": 71 + }, + { + "id": "no_synthetic_records", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_water", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_water", + "status": "passed", + "detail": null + }, + { + "id": "cp_shomate_recomputed_water", + "status": "passed", + "detail": { + "page": 75.37492869068852, + "lib": 75.37492869068849 + } + }, + { + "id": "cp_range_water", + "status": "passed", + "detail": 4184.009363901665 + }, + { + "id": "cp_conflict_screen_water", + "status": "passed", + "detail": { + "chosen": 75.37492869068849, + "median_10K": 75.37492869068849 + } + }, + { + "id": "dfh_entries_on_page_water", + "status": "passed", + "detail": [ + -285.83 + ] + }, + { + "id": "dfh_median_rule_water", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_water", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_water", + "status": "passed", + "detail": "0.9950 g/cu cm at 25 °C" + }, + { + "id": "density_number_matches_text_water", + "status": "passed", + "detail": { + "rho": 995.0, + "raw": "0.9950 g/cu cm at 25 °C" + } + }, + { + "id": "density_range_water", + "status": "passed", + "detail": { + "rho": 995.0, + "T": 298.15 + } + }, + { + "id": "density_consistent_with_record_median_water", + "status": "passed", + "detail": { + "rho": 995.0, + "median_of_record_numbers": 0.999868, + "numbers": 5 + } + }, + { + "id": "liquid_at_298K_water", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_methanol", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_methanol", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_methanol", + "status": "passed", + "detail": [ + 79.5, + 81.11, + 80.24, + 80.35, + 81.0, + 81.32, + 80.28, + 81.56, + 80.22, + 81.47, + 81.92, + 81.13, + 83.7, + 85.8, + 83.3 + ] + }, + { + "id": "cp_median_rule_methanol", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_methanol", + "status": "passed", + "detail": 2531.9892640908806 + }, + { + "id": "cp_conflict_screen_methanol", + "status": "passed", + "detail": { + "chosen": 81.13, + "median_10K": 81.055 + } + }, + { + "id": "dfh_entries_on_page_methanol", + "status": "passed", + "detail": [ + -239.5, + -238.9, + -251.3 + ] + }, + { + "id": "dfh_median_rule_methanol", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_methanol", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_methanol", + "status": "passed", + "detail": "0.8100 at 0 °C/4 °C; 0.7866 at 25 °C/4 °C" + }, + { + "id": "density_number_matches_text_methanol", + "status": "passed", + "detail": { + "rho": 786.6, + "raw": "0.8100 at 0 °C/4 °C; 0.7866 at 25 °C/4 °C" + } + }, + { + "id": "density_range_methanol", + "status": "passed", + "detail": { + "rho": 786.6, + "T": 298.15 + } + }, + { + "id": "density_consistent_with_record_median_methanol", + "status": "passed", + "detail": { + "rho": 786.6, + "median_of_record_numbers": 0.79, + "numbers": 7 + } + }, + { + "id": "liquid_at_298K_methanol", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_ethanol", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_ethanol", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_ethanol", + "status": "passed", + "detail": [ + 112.4, + 111.53, + 112.36, + 112.68, + 110.51, + 115.9, + 112.67, + 113.75, + 112.15, + 112.3, + 112.5, + 112.3, + 112.33, + 112.094, + 111.81, + 112.26, + 111.96, + 114.7, + 111.7, + 103.3, + 160.7, + 113.4, + 112.1 + ] + }, + { + "id": "cp_median_rule_ethanol", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_ethanol", + "status": "passed", + "detail": 2437.594964184936 + }, + { + "id": "cp_conflict_screen_ethanol", + "status": "passed", + "detail": { + "chosen": 112.3, + "median_10K": 112.3 + } + }, + { + "id": "dfh_entries_on_page_ethanol", + "status": "passed", + "detail": [ + -276.0 + ] + }, + { + "id": "dfh_median_rule_ethanol", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_ethanol", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_ethanol", + "status": "passed", + "detail": "0.7893 g/cu cm at 20 °C" + }, + { + "id": "density_number_matches_text_ethanol", + "status": "passed", + "detail": { + "rho": 789.3, + "raw": "0.7893 g/cu cm at 20 °C" + } + }, + { + "id": "density_range_ethanol", + "status": "passed", + "detail": { + "rho": 789.3, + "T": 293.15 + } + }, + { + "id": "density_consistent_with_record_median_ethanol", + "status": "passed", + "detail": { + "rho": 789.3, + "median_of_record_numbers": 0.79, + "numbers": 6 + } + }, + { + "id": "liquid_at_298K_ethanol", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_propan_1_ol", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_propan_1_ol", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_propan_1_ol", + "status": "passed", + "detail": [ + 144.6, + 143.96, + 144.44, + 146.88, + 146.34, + 143.77, + 149.0, + 143.78, + 143.87, + 144.062, + 143.8, + 146.1, + 145.6, + 192.9, + 144.8 + ] + }, + { + "id": "cp_median_rule_propan_1_ol", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_propan_1_ol", + "status": "passed", + "detail": 2405.990016638935 + }, + { + "id": "cp_conflict_screen_propan_1_ol", + "status": "passed", + "detail": { + "chosen": 144.6, + "median_10K": 144.51999999999998 + } + }, + { + "id": "dfh_entries_on_page_propan_1_ol", + "status": "passed", + "detail": [ + -302.54, + -303.0, + -304.6, + -302.5, + -306.3 + ] + }, + { + "id": "dfh_median_rule_propan_1_ol", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_propan_1_ol", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_propan_1_ol", + "status": "passed", + "detail": "0.8044 @25 °C" + }, + { + "id": "density_number_matches_text_propan_1_ol", + "status": "passed", + "detail": { + "rho": 804.4, + "raw": "0.8044 @25 °C" + } + }, + { + "id": "density_range_propan_1_ol", + "status": "passed", + "detail": { + "rho": 804.4, + "T": 298.15 + } + }, + { + "id": "density_consistent_with_record_median_propan_1_ol", + "status": "passed", + "detail": { + "rho": 804.4, + "median_of_record_numbers": 0.80515, + "numbers": 12 + } + }, + { + "id": "liquid_at_298K_propan_1_ol", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_propan_2_ol", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_propan_2_ol", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_propan_2_ol", + "status": "passed", + "detail": [ + 161.2, + 154.75, + 154.43, + 162.8, + 154.0, + 159.99, + 163.6, + 180.3 + ] + }, + { + "id": "cp_median_rule_propan_2_ol", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_propan_2_ol", + "status": "passed", + "detail": 2672.1297836938434 + }, + { + "id": "cp_conflict_screen_propan_2_ol", + "status": "passed", + "detail": { + "chosen": 160.595, + "median_10K": 159.99 + } + }, + { + "id": "dfh_entries_on_page_propan_2_ol", + "status": "passed", + "detail": [ + -317.0, + -318.2 + ] + }, + { + "id": "dfh_median_rule_propan_2_ol", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_propan_2_ol", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_propan_2_ol", + "status": "passed", + "detail": "0.78509 at 25 °C" + }, + { + "id": "density_number_matches_text_propan_2_ol", + "status": "passed", + "detail": { + "rho": 785.09, + "raw": "0.78509 at 25 °C" + } + }, + { + "id": "density_range_propan_2_ol", + "status": "passed", + "detail": { + "rho": 785.09, + "T": 298.15 + } + }, + { + "id": "density_consistent_with_record_median_propan_2_ol", + "status": "passed", + "detail": { + "rho": 785.09, + "median_of_record_numbers": 0.79, + "numbers": 12 + } + }, + { + "id": "liquid_at_298K_propan_2_ol", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_butan_1_ol", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_butan_1_ol", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_butan_1_ol", + "status": "passed", + "detail": [ + 176.86, + 176.67, + 177.7, + 177.18, + 175.97, + 176.69, + 177.08, + 177.03, + 183.3, + 174.5 + ] + }, + { + "id": "cp_median_rule_butan_1_ol", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_butan_1_ol", + "status": "passed", + "detail": 2387.2773880194277 + }, + { + "id": "cp_conflict_screen_butan_1_ol", + "status": "passed", + "detail": { + "chosen": 176.945, + "median_10K": 177.055 + } + }, + { + "id": "dfh_entries_on_page_butan_1_ol", + "status": "passed", + "detail": [ + -328.0 + ] + }, + { + "id": "dfh_median_rule_butan_1_ol", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_butan_1_ol", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_butan_1_ol", + "status": "passed", + "detail": "0.8098 at 20 °C/4 °C" + }, + { + "id": "density_number_matches_text_butan_1_ol", + "status": "passed", + "detail": { + "rho": 809.8, + "raw": "0.8098 at 20 °C/4 °C" + } + }, + { + "id": "density_range_butan_1_ol", + "status": "passed", + "detail": { + "rho": 809.8, + "T": 293.15 + } + }, + { + "id": "density_consistent_with_record_median_butan_1_ol", + "status": "passed", + "detail": { + "rho": 809.8, + "median_of_record_numbers": 0.81, + "numbers": 12 + } + }, + { + "id": "liquid_at_298K_butan_1_ol", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_isobutanol", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_isobutanol", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_isobutanol", + "status": "passed", + "detail": [ + 181.05, + 182.01, + 181.0, + 184.1 + ] + }, + { + "id": "cp_median_rule_isobutanol", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_isobutanol", + "status": "passed", + "detail": 2449.136535348084 + }, + { + "id": "cp_conflict_screen_isobutanol", + "status": "passed", + "detail": { + "chosen": 181.53, + "median_10K": 184.1 + } + }, + { + "id": "dfh_entries_on_page_isobutanol", + "status": "passed", + "detail": [ + -334.6, + -333.6, + -334.7 + ] + }, + { + "id": "dfh_median_rule_isobutanol", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_isobutanol", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_isobutanol", + "status": "passed", + "detail": "0.8018 g/cu cm at 24 °C" + }, + { + "id": "density_number_matches_text_isobutanol", + "status": "passed", + "detail": { + "rho": 801.8, + "raw": "0.8018 g/cu cm at 24 °C" + } + }, + { + "id": "density_range_isobutanol", + "status": "passed", + "detail": { + "rho": 801.8, + "T": 297.15 + } + }, + { + "id": "density_consistent_with_record_median_isobutanol", + "status": "passed", + "detail": { + "rho": 801.8, + "median_of_record_numbers": 0.8005, + "numbers": 10 + } + }, + { + "id": "liquid_at_298K_isobutanol", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_pentan_1_ol", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_pentan_1_ol", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_pentan_1_ol", + "status": "passed", + "detail": [ + 207.45, + 207.45, + 208.19, + 208.98, + 207.4, + 208.4, + 208.3, + 209.12, + 183.3 + ] + }, + { + "id": "cp_median_rule_pentan_1_ol", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_pentan_1_ol", + "status": "passed", + "detail": 2361.769710720363 + }, + { + "id": "cp_conflict_screen_pentan_1_ol", + "status": "passed", + "detail": { + "chosen": 208.19, + "median_10K": 207.82 + } + }, + { + "id": "dfh_entries_on_page_pentan_1_ol", + "status": "passed", + "detail": [ + -351.62, + -352.6, + -352.57, + -357.9, + -358.4 + ] + }, + { + "id": "dfh_median_rule_pentan_1_ol", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_pentan_1_ol", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_pentan_1_ol", + "status": "passed", + "detail": "0.8146 @ 20 °C/4 °C" + }, + { + "id": "density_number_matches_text_pentan_1_ol", + "status": "passed", + "detail": { + "rho": 814.6, + "raw": "0.8146 @ 20 °C/4 °C" + } + }, + { + "id": "density_range_pentan_1_ol", + "status": "passed", + "detail": { + "rho": 814.6, + "T": 293.15 + } + }, + { + "id": "density_consistent_with_record_median_pentan_1_ol", + "status": "passed", + "detail": { + "rho": 814.6, + "median_of_record_numbers": 0.8146, + "numbers": 5 + } + }, + { + "id": "liquid_at_298K_pentan_1_ol", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_hexan_1_ol", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_hexan_1_ol", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_hexan_1_ol", + "status": "passed", + "detail": [ + 243.2, + 242.5, + 241.32, + 237.85, + 240.57, + 239.68, + 239.62, + 241.32, + 240.65, + 244.8 + ] + }, + { + "id": "cp_median_rule_hexan_1_ol", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_hexan_1_ol", + "status": "passed", + "detail": 2358.6669276695707 + }, + { + "id": "cp_conflict_screen_hexan_1_ol", + "status": "passed", + "detail": { + "chosen": 240.985, + "median_10K": 240.65 + } + }, + { + "id": "dfh_entries_on_page_hexan_1_ol", + "status": "passed", + "detail": [ + -377.5, + -379.4, + -383.9 + ] + }, + { + "id": "dfh_median_rule_hexan_1_ol", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_hexan_1_ol", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_hexan_1_ol", + "status": "passed", + "detail": "0.8153 at 25 °C/4 °C; 0.8082 at 35 °C/4 °C" + }, + { + "id": "density_number_matches_text_hexan_1_ol", + "status": "passed", + "detail": { + "rho": 815.3, + "raw": "0.8153 at 25 °C/4 °C; 0.8082 at 35 °C/4 °C" + } + }, + { + "id": "density_range_hexan_1_ol", + "status": "passed", + "detail": { + "rho": 815.3, + "T": 298.15 + } + }, + { + "id": "density_consistent_with_record_median_hexan_1_ol", + "status": "passed", + "detail": { + "rho": 815.3, + "median_of_record_numbers": 0.82, + "numbers": 7 + } + }, + { + "id": "liquid_at_298K_hexan_1_ol", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_octan_1_ol", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_octan_1_ol", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_octan_1_ol", + "status": "passed", + "detail": [ + 304.0, + 305.55, + 312.1, + 324.3 + ] + }, + { + "id": "cp_median_rule_octan_1_ol", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_octan_1_ol", + "status": "passed", + "detail": 2371.3814021346852 + }, + { + "id": "cp_conflict_screen_octan_1_ol", + "status": "passed", + "detail": { + "chosen": 308.82500000000005, + "median_10K": 312.1 + } + }, + { + "id": "dfh_entries_on_page_octan_1_ol", + "status": "passed", + "detail": [ + -426.6, + -428.0, + -425.2, + -435.0 + ] + }, + { + "id": "dfh_median_rule_octan_1_ol", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_octan_1_ol", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_octan_1_ol", + "status": "passed", + "detail": "0.8262 g/cu cm at 25 °C" + }, + { + "id": "density_number_matches_text_octan_1_ol", + "status": "passed", + "detail": { + "rho": 826.2, + "raw": "0.8262 g/cu cm at 25 °C" + } + }, + { + "id": "density_range_octan_1_ol", + "status": "passed", + "detail": { + "rho": 826.2, + "T": 298.15 + } + }, + { + "id": "density_consistent_with_record_median_octan_1_ol", + "status": "passed", + "detail": { + "rho": 826.2, + "median_of_record_numbers": 0.8294999999999999, + "numbers": 6 + } + }, + { + "id": "liquid_at_298K_octan_1_ol", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_cyclohexanol", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_cyclohexanol", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_cyclohexanol", + "status": "passed", + "detail": [ + 214.06, + 209.99, + 220.1, + 212.0, + 209.03 + ] + }, + { + "id": "cp_median_rule_cyclohexanol", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_cyclohexanol", + "status": "passed", + "detail": 2116.6134185303513 + }, + { + "id": "cp_conflict_screen_cyclohexanol", + "status": "passed", + "detail": { + "chosen": 212.0, + "median_10K": 210.995 + } + }, + { + "id": "dfh_entries_on_page_cyclohexanol", + "status": "passed", + "detail": [ + -352.0, + -350.0, + -347.4, + -349.2 + ] + }, + { + "id": "dfh_median_rule_cyclohexanol", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_cyclohexanol", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_cyclohexanol", + "status": "passed", + "detail": "0.9624 at 20 °C/4 °C" + }, + { + "id": "density_number_matches_text_cyclohexanol", + "status": "passed", + "detail": { + "rho": 962.4, + "raw": "0.9624 at 20 °C/4 °C" + } + }, + { + "id": "density_range_cyclohexanol", + "status": "passed", + "detail": { + "rho": 962.4, + "T": 293.15 + } + }, + { + "id": "density_consistent_with_record_median_cyclohexanol", + "status": "passed", + "detail": { + "rho": 962.4, + "median_of_record_numbers": 0.96, + "numbers": 7 + } + }, + { + "id": "liquid_at_298K_cyclohexanol", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_benzyl_alcohol", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_benzyl_alcohol", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_benzyl_alcohol", + "status": "passed", + "detail": [ + 215.94, + 217.86, + 215.9, + 220.5 + ] + }, + { + "id": "cp_median_rule_benzyl_alcohol", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_benzyl_alcohol", + "status": "passed", + "detail": 2005.7333086739413 + }, + { + "id": "cp_conflict_screen_benzyl_alcohol", + "status": "passed", + "detail": { + "chosen": 216.9, + "median_10K": 217.86 + } + }, + { + "id": "dfh_entries_on_page_benzyl_alcohol", + "status": "passed", + "detail": [ + -154.9, + -161.0 + ] + }, + { + "id": "dfh_median_rule_benzyl_alcohol", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_benzyl_alcohol", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_benzyl_alcohol", + "status": "passed", + "detail": "1.0419 g/cu cm at 24 °C" + }, + { + "id": "density_number_matches_text_benzyl_alcohol", + "status": "passed", + "detail": { + "rho": 1041.9, + "raw": "1.0419 g/cu cm at 24 °C" + } + }, + { + "id": "density_range_benzyl_alcohol", + "status": "passed", + "detail": { + "rho": 1041.9, + "T": 297.15 + } + }, + { + "id": "density_consistent_with_record_median_benzyl_alcohol", + "status": "passed", + "detail": { + "rho": 1041.9, + "median_of_record_numbers": 1.0419, + "numbers": 10 + } + }, + { + "id": "liquid_at_298K_benzyl_alcohol", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_ethylene_glycol", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_ethylene_glycol", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_ethylene_glycol", + "status": "passed", + "detail": [ + 149.8, + 149.3, + 149.6, + 150.33, + 147.3, + 148.87 + ] + }, + { + "id": "cp_median_rule_ethylene_glycol", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_ethylene_glycol", + "status": "passed", + "detail": 2407.7654261317866 + }, + { + "id": "cp_conflict_screen_ethylene_glycol", + "status": "passed", + "detail": { + "chosen": 149.45, + "median_10K": 149.35000000000002 + } + }, + { + "id": "dfh_entries_on_page_ethylene_glycol", + "status": "passed", + "detail": [ + -460.0, + -455.6, + -454.9, + -453.1 + ] + }, + { + "id": "dfh_median_rule_ethylene_glycol", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_ethylene_glycol", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_ethylene_glycol", + "status": "passed", + "detail": "1.1135 g/cu cm AT 20 °C" + }, + { + "id": "density_number_matches_text_ethylene_glycol", + "status": "passed", + "detail": { + "rho": 1113.5, + "raw": "1.1135 g/cu cm AT 20 °C" + } + }, + { + "id": "density_range_ethylene_glycol", + "status": "passed", + "detail": { + "rho": 1113.5, + "T": 293.15 + } + }, + { + "id": "density_consistent_with_record_median_ethylene_glycol", + "status": "passed", + "detail": { + "rho": 1113.5, + "median_of_record_numbers": 1.11175, + "numbers": 6 + } + }, + { + "id": "liquid_at_298K_ethylene_glycol", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_glycerol", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_glycerol", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_glycerol", + "status": "passed", + "detail": [ + 218.9, + 221.9, + 218.5, + 213.8, + 207.9 + ] + }, + { + "id": "cp_median_rule_glycerol", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_glycerol", + "status": "passed", + "detail": 2372.6789010750354 + }, + { + "id": "cp_conflict_screen_glycerol", + "status": "passed", + "detail": { + "chosen": 218.5, + "median_10K": 220.19 + } + }, + { + "id": "dfh_entries_on_page_glycerol", + "status": "passed", + "detail": [ + -669.6, + -668.6 + ] + }, + { + "id": "dfh_median_rule_glycerol", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_glycerol", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_glycerol", + "status": "passed", + "detail": "1.2613 g/cu cm at 20 °C" + }, + { + "id": "density_number_matches_text_glycerol", + "status": "passed", + "detail": { + "rho": 1261.3, + "raw": "1.2613 g/cu cm at 20 °C" + } + }, + { + "id": "density_range_glycerol", + "status": "passed", + "detail": { + "rho": 1261.3, + "T": 293.15 + } + }, + { + "id": "density_consistent_with_record_median_glycerol", + "status": "passed", + "detail": { + "rho": 1261.3, + "median_of_record_numbers": 1.26115, + "numbers": 8 + } + }, + { + "id": "liquid_at_298K_glycerol", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_formic_acid", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_formic_acid", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_formic_acid", + "status": "passed", + "detail": [ + 99.04, + 98.1, + 95.4 + ] + }, + { + "id": "cp_median_rule_formic_acid", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_formic_acid", + "status": "passed", + "detail": 2131.450298750679 + }, + { + "id": "cp_conflict_screen_formic_acid", + "status": "passed", + "detail": { + "chosen": 98.1, + "median_10K": 98.3 + } + }, + { + "id": "dfh_entries_on_page_formic_acid", + "status": "passed", + "detail": [ + -425.5, + -424.8 + ] + }, + { + "id": "dfh_median_rule_formic_acid", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_formic_acid", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_formic_acid", + "status": "passed", + "detail": "1.220 at 20 °C/4 °C" + }, + { + "id": "density_number_matches_text_formic_acid", + "status": "passed", + "detail": { + "rho": 1220.0, + "raw": "1.220 at 20 °C/4 °C" + } + }, + { + "id": "density_range_formic_acid", + "status": "passed", + "detail": { + "rho": 1220.0, + "T": 293.15 + } + }, + { + "id": "density_consistent_with_record_median_formic_acid", + "status": "passed", + "detail": { + "rho": 1220.0, + "median_of_record_numbers": 1.22, + "numbers": 8 + } + }, + { + "id": "liquid_at_298K_formic_acid", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_acetic_acid", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_acetic_acid", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_acetic_acid", + "status": "passed", + "detail": [ + 123.1, + 120.5, + 159.8, + 123.5 + ] + }, + { + "id": "cp_median_rule_acetic_acid", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_acetic_acid", + "status": "passed", + "detail": 2053.2889258950872 + }, + { + "id": "cp_conflict_screen_acetic_acid", + "status": "passed", + "detail": { + "chosen": 123.3, + "median_10K": 123.25 + } + }, + { + "id": "dfh_entries_on_page_acetic_acid", + "status": "passed", + "detail": [ + -483.52, + -484.5, + -484.1 + ] + }, + { + "id": "dfh_median_rule_acetic_acid", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_acetic_acid", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_acetic_acid", + "status": "passed", + "detail": "1.0446 g/cu cm at 25 °C" + }, + { + "id": "density_number_matches_text_acetic_acid", + "status": "passed", + "detail": { + "rho": 1044.6, + "raw": "1.0446 g/cu cm at 25 °C" + } + }, + { + "id": "density_range_acetic_acid", + "status": "passed", + "detail": { + "rho": 1044.6, + "T": 298.15 + } + }, + { + "id": "density_consistent_with_record_median_acetic_acid", + "status": "passed", + "detail": { + "rho": 1044.6, + "median_of_record_numbers": 1.05, + "numbers": 9 + } + }, + { + "id": "liquid_at_298K_acetic_acid", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_propanoic_acid", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_propanoic_acid", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_propanoic_acid", + "status": "passed", + "detail": [ + 158.6, + 152.8, + 151.0 + ] + }, + { + "id": "cp_median_rule_propanoic_acid", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_propanoic_acid", + "status": "passed", + "detail": 2062.6349892008643 + }, + { + "id": "cp_conflict_screen_propanoic_acid", + "status": "passed", + "detail": { + "chosen": 152.8, + "median_10K": 155.7 + } + }, + { + "id": "dfh_entries_on_page_propanoic_acid", + "status": "passed", + "detail": [ + -510.8, + -510.0 + ] + }, + { + "id": "dfh_median_rule_propanoic_acid", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_propanoic_acid", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_propanoic_acid", + "status": "passed", + "detail": "0.99815 @25 °C" + }, + { + "id": "density_number_matches_text_propanoic_acid", + "status": "passed", + "detail": { + "rho": 998.15, + "raw": "0.99815 @25 °C" + } + }, + { + "id": "density_range_propanoic_acid", + "status": "passed", + "detail": { + "rho": 998.15, + "T": 298.15 + } + }, + { + "id": "density_consistent_with_record_median_propanoic_acid", + "status": "passed", + "detail": { + "rho": 998.15, + "median_of_record_numbers": 0.993, + "numbers": 9 + } + }, + { + "id": "liquid_at_298K_propanoic_acid", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_butanoic_acid", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_butanoic_acid", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_butanoic_acid", + "status": "passed", + "detail": [ + 177.7, + 178.0, + 176.1 + ] + }, + { + "id": "cp_median_rule_butanoic_acid", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_butanoic_acid", + "status": "passed", + "detail": 2016.7971853365111 + }, + { + "id": "cp_conflict_screen_butanoic_acid", + "status": "passed", + "detail": { + "chosen": 177.7, + "median_10K": 176.89999999999998 + } + }, + { + "id": "dfh_entries_on_page_butanoic_acid", + "status": "passed", + "detail": [ + -533.92 + ] + }, + { + "id": "dfh_median_rule_butanoic_acid", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_butanoic_acid", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_butanoic_acid", + "status": "passed", + "detail": "0.959 @25 °C" + }, + { + "id": "density_number_matches_text_butanoic_acid", + "status": "passed", + "detail": { + "rho": 959.0, + "raw": "0.959 @25 °C" + } + }, + { + "id": "density_range_butanoic_acid", + "status": "passed", + "detail": { + "rho": 959.0, + "T": 298.15 + } + }, + { + "id": "density_consistent_with_record_median_butanoic_acid", + "status": "passed", + "detail": { + "rho": 959.0, + "median_of_record_numbers": 0.9584999999999999, + "numbers": 6 + } + }, + { + "id": "liquid_at_298K_butanoic_acid", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_hexanoic_acid", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_hexanoic_acid", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_hexanoic_acid", + "status": "passed", + "detail": [ + 225.1 + ] + }, + { + "id": "cp_median_rule_hexanoic_acid", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_hexanoic_acid", + "status": "passed", + "detail": 1937.84435261708 + }, + { + "id": "cp_conflict_screen_hexanoic_acid", + "status": "passed", + "detail": { + "chosen": 225.1, + "median_10K": 225.1 + } + }, + { + "id": "dfh_entries_on_page_hexanoic_acid", + "status": "passed", + "detail": [ + -581.8, + -583.58, + -585.68 + ] + }, + { + "id": "dfh_median_rule_hexanoic_acid", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_hexanoic_acid", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_hexanoic_acid", + "status": "passed", + "detail": "0.9295 @25 °C" + }, + { + "id": "density_number_matches_text_hexanoic_acid", + "status": "passed", + "detail": { + "rho": 929.5, + "raw": "0.9295 @25 °C" + } + }, + { + "id": "density_range_hexanoic_acid", + "status": "passed", + "detail": { + "rho": 929.5, + "T": 298.15 + } + }, + { + "id": "density_consistent_with_record_median_hexanoic_acid", + "status": "passed", + "detail": { + "rho": 929.5, + "median_of_record_numbers": 0.9285000000000001, + "numbers": 6 + } + }, + { + "id": "liquid_at_298K_hexanoic_acid", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_acetic_anhydride", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_acetic_anhydride", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_acetic_anhydride", + "status": "passed", + "detail": [ + 168.2 + ] + }, + { + "id": "cp_range_acetic_anhydride", + "status": "passed", + "detail": 1647.5658732490938 + }, + { + "id": "cp_conflict_screen_acetic_anhydride", + "status": "passed", + "detail": { + "chosen": 168.2, + "median_10K": 168.2 + } + }, + { + "id": "dfh_entries_on_page_acetic_anhydride", + "status": "passed", + "detail": [ + -625.0 + ] + }, + { + "id": "dfh_median_rule_acetic_anhydride", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_acetic_anhydride", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_acetic_anhydride", + "status": "passed", + "detail": "1.082 g/cu cm at 20 °C" + }, + { + "id": "density_number_matches_text_acetic_anhydride", + "status": "passed", + "detail": { + "rho": 1082.0, + "raw": "1.082 g/cu cm at 20 °C" + } + }, + { + "id": "density_range_acetic_anhydride", + "status": "passed", + "detail": { + "rho": 1082.0, + "T": 293.15 + } + }, + { + "id": "density_consistent_with_record_median_acetic_anhydride", + "status": "passed", + "detail": { + "rho": 1082.0, + "median_of_record_numbers": 1.08, + "numbers": 6 + } + }, + { + "id": "liquid_at_298K_acetic_anhydride", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_methyl_formate", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_methyl_formate", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_methyl_formate", + "status": "passed", + "detail": [ + 119.7, + 130.0 + ] + }, + { + "id": "cp_median_rule_methyl_formate", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_methyl_formate", + "status": "passed", + "detail": 2079.1007493755205 + }, + { + "id": "cp_conflict_screen_methyl_formate", + "status": "passed", + "detail": { + "chosen": 124.85, + "median_10K": 120.13499999999999 + } + }, + { + "id": "dfh_entries_on_page_methyl_formate", + "status": "passed", + "detail": [ + -365.9, + -378.0, + -391.0, + -386.1 + ] + }, + { + "id": "dfh_median_rule_methyl_formate", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_methyl_formate", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_methyl_formate", + "status": "passed", + "detail": "0.977 at 68 °F (USCG, 1999) - Less dense than water; will fl" + }, + { + "id": "density_number_matches_text_methyl_formate", + "status": "passed", + "detail": { + "rho": 977.0, + "raw": "0.977 at 68 °F (USCG, 1999) - Less dense than water; will fl" + } + }, + { + "id": "density_range_methyl_formate", + "status": "passed", + "detail": { + "rho": 977.0, + "T": 293.15 + } + }, + { + "id": "density_consistent_with_record_median_methyl_formate", + "status": "passed", + "detail": { + "rho": 977.0, + "median_of_record_numbers": 0.98, + "numbers": 7 + } + }, + { + "id": "liquid_at_298K_methyl_formate", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_ethyl_formate", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_ethyl_formate", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_ethyl_formate", + "status": "passed", + "detail": [ + 144.3 + ] + }, + { + "id": "cp_median_rule_ethyl_formate", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_ethyl_formate", + "status": "passed", + "detail": 1947.894168466523 + }, + { + "id": "cp_conflict_screen_ethyl_formate", + "status": "passed", + "detail": { + "chosen": 144.3, + "median_10K": 148.1 + } + }, + { + "id": "dfh_entries_on_page_ethyl_formate", + "status": "passed", + "detail": [ + -394.2 + ] + }, + { + "id": "dfh_median_rule_ethyl_formate", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_ethyl_formate", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_ethyl_formate", + "status": "passed", + "detail": "0.9168 @ 20 °C" + }, + { + "id": "density_number_matches_text_ethyl_formate", + "status": "passed", + "detail": { + "rho": 916.8, + "raw": "0.9168 @ 20 °C" + } + }, + { + "id": "density_range_ethyl_formate", + "status": "passed", + "detail": { + "rho": 916.8, + "T": 293.15 + } + }, + { + "id": "density_consistent_with_record_median_ethyl_formate", + "status": "passed", + "detail": { + "rho": 916.8, + "median_of_record_numbers": 0.92, + "numbers": 9 + } + }, + { + "id": "liquid_at_298K_ethyl_formate", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_methyl_acetate", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_methyl_acetate", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_methyl_acetate", + "status": "passed", + "detail": [ + 141.34, + 140.6, + 140.56 + ] + }, + { + "id": "cp_median_rule_methyl_acetate", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_methyl_acetate", + "status": "passed", + "detail": 1897.9481641468683 + }, + { + "id": "cp_conflict_screen_methyl_acetate", + "status": "passed", + "detail": { + "chosen": 140.6, + "median_10K": 140.56 + } + }, + { + "id": "dfh_entries_on_page_methyl_acetate", + "status": "passed", + "detail": [ + -445.89 + ] + }, + { + "id": "dfh_median_rule_methyl_acetate", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_methyl_acetate", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_methyl_acetate", + "status": "passed", + "detail": "0.92438 @25 °C" + }, + { + "id": "density_number_matches_text_methyl_acetate", + "status": "passed", + "detail": { + "rho": 924.38, + "raw": "0.92438 @25 °C" + } + }, + { + "id": "density_range_methyl_acetate", + "status": "passed", + "detail": { + "rho": 924.38, + "T": 298.15 + } + }, + { + "id": "density_consistent_with_record_median_methyl_acetate", + "status": "passed", + "detail": { + "rho": 924.38, + "median_of_record_numbers": 0.93, + "numbers": 8 + } + }, + { + "id": "liquid_at_298K_methyl_acetate", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_ethyl_acetate", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_ethyl_acetate", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_ethyl_acetate", + "status": "passed", + "detail": [ + 168.94, + 170.59, + 169.3, + 169.06, + 169.6, + 169.6, + 167.4, + 169.5 + ] + }, + { + "id": "cp_median_rule_ethyl_acetate", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_ethyl_acetate", + "status": "passed", + "detail": 1922.5967540574284 + }, + { + "id": "cp_conflict_screen_ethyl_acetate", + "status": "passed", + "detail": { + "chosen": 169.4, + "median_10K": 169.2 + } + }, + { + "id": "dfh_entries_on_page_ethyl_acetate", + "status": "passed", + "detail": [ + -480.57, + -479.86, + -478.82, + -482.0 + ] + }, + { + "id": "dfh_median_rule_ethyl_acetate", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_ethyl_acetate", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_ethyl_acetate", + "status": "passed", + "detail": "0.9003 g/cu cm at 20 °C" + }, + { + "id": "density_number_matches_text_ethyl_acetate", + "status": "passed", + "detail": { + "rho": 900.3, + "raw": "0.9003 g/cu cm at 20 °C" + } + }, + { + "id": "density_range_ethyl_acetate", + "status": "passed", + "detail": { + "rho": 900.3, + "T": 293.15 + } + }, + { + "id": "density_consistent_with_record_median_ethyl_acetate", + "status": "passed", + "detail": { + "rho": 900.3, + "median_of_record_numbers": 0.9, + "numbers": 9 + } + }, + { + "id": "liquid_at_298K_ethyl_acetate", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_propyl_acetate", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_propyl_acetate", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_propyl_acetate", + "status": "passed", + "detail": [ + 196.07, + 194.1 + ] + }, + { + "id": "cp_median_rule_propyl_acetate", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_propyl_acetate", + "status": "passed", + "detail": 1910.1635170860666 + }, + { + "id": "cp_conflict_screen_propyl_acetate", + "status": "passed", + "detail": { + "chosen": 195.08499999999998, + "median_10K": 195.08499999999998 + } + }, + { + "id": "pubchem_bytes_propyl_acetate", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_propyl_acetate", + "status": "passed", + "detail": "0.8820 g/cu cm at 25 °C" + }, + { + "id": "density_number_matches_text_propyl_acetate", + "status": "passed", + "detail": { + "rho": 882.0, + "raw": "0.8820 g/cu cm at 25 °C" + } + }, + { + "id": "density_range_propyl_acetate", + "status": "passed", + "detail": { + "rho": 882.0, + "T": 298.15 + } + }, + { + "id": "density_consistent_with_record_median_propyl_acetate", + "status": "passed", + "detail": { + "rho": 882.0, + "median_of_record_numbers": 0.881, + "numbers": 8 + } + }, + { + "id": "liquid_at_298K_propyl_acetate", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_butyl_acetate", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_butyl_acetate", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_butyl_acetate", + "status": "passed", + "detail": [ + 228.11, + 225.11, + 228.4 + ] + }, + { + "id": "cp_median_rule_butyl_acetate", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_butyl_acetate", + "status": "passed", + "detail": 1963.7568870523417 + }, + { + "id": "cp_conflict_screen_butyl_acetate", + "status": "passed", + "detail": { + "chosen": 228.11, + "median_10K": 228.4 + } + }, + { + "id": "dfh_entries_on_page_butyl_acetate", + "status": "passed", + "detail": [ + -609.6 + ] + }, + { + "id": "dfh_median_rule_butyl_acetate", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_butyl_acetate", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_butyl_acetate", + "status": "passed", + "detail": "0.8825 g/cu cm at 20 °C" + }, + { + "id": "density_number_matches_text_butyl_acetate", + "status": "passed", + "detail": { + "rho": 882.5, + "raw": "0.8825 g/cu cm at 20 °C" + } + }, + { + "id": "density_range_butyl_acetate", + "status": "passed", + "detail": { + "rho": 882.5, + "T": 293.15 + } + }, + { + "id": "density_consistent_with_record_median_butyl_acetate", + "status": "passed", + "detail": { + "rho": 882.5, + "median_of_record_numbers": 0.88, + "numbers": 8 + } + }, + { + "id": "liquid_at_298K_butyl_acetate", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_benzyl_acetate", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_benzyl_acetate", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_benzyl_acetate", + "status": "passed", + "detail": [ + 148.5 + ] + }, + { + "id": "cp_median_rule_benzyl_acetate", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_benzyl_acetate", + "status": "passed", + "detail": 988.8792701604848 + }, + { + "id": "cp_conflict_screen_benzyl_acetate", + "status": "passed", + "detail": { + "chosen": 148.5, + "median_10K": 202.1 + } + }, + { + "id": "pubchem_bytes_benzyl_acetate", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_benzyl_acetate", + "status": "passed", + "detail": "1.050 @ 25 °C/4 °C" + }, + { + "id": "density_number_matches_text_benzyl_acetate", + "status": "passed", + "detail": { + "rho": 1050.0, + "raw": "1.050 @ 25 °C/4 °C" + } + }, + { + "id": "density_range_benzyl_acetate", + "status": "passed", + "detail": { + "rho": 1050.0, + "T": 298.15 + } + }, + { + "id": "density_consistent_with_record_median_benzyl_acetate", + "status": "passed", + "detail": { + "rho": 1050.0, + "median_of_record_numbers": 1.05, + "numbers": 7 + } + }, + { + "id": "liquid_at_298K_benzyl_acetate", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_ethyl_propanoate", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_ethyl_propanoate", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_ethyl_propanoate", + "status": "passed", + "detail": [ + 199.58, + 200.9 + ] + }, + { + "id": "cp_median_rule_ethyl_propanoate", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_ethyl_propanoate", + "status": "passed", + "detail": 1960.6384020366202 + }, + { + "id": "cp_conflict_screen_ethyl_propanoate", + "status": "passed", + "detail": { + "chosen": 200.24, + "median_10K": 200.24 + } + }, + { + "id": "dfh_entries_on_page_ethyl_propanoate", + "status": "passed", + "detail": [ + -505.59, + -502.7 + ] + }, + { + "id": "dfh_median_rule_ethyl_propanoate", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_ethyl_propanoate", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_ethyl_propanoate", + "status": "passed", + "detail": "0.8917 @ 20 °C/4 °C" + }, + { + "id": "density_number_matches_text_ethyl_propanoate", + "status": "passed", + "detail": { + "rho": 891.7, + "raw": "0.8917 @ 20 °C/4 °C" + } + }, + { + "id": "density_range_ethyl_propanoate", + "status": "passed", + "detail": { + "rho": 891.7, + "T": 293.15 + } + }, + { + "id": "density_consistent_with_record_median_ethyl_propanoate", + "status": "passed", + "detail": { + "rho": 891.7, + "median_of_record_numbers": 0.891, + "numbers": 5 + } + }, + { + "id": "liquid_at_298K_ethyl_propanoate", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_ethyl_butanoate", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_ethyl_butanoate", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_ethyl_butanoate", + "status": "passed", + "detail": [ + 228.0 + ] + }, + { + "id": "cp_median_rule_ethyl_butanoate", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_ethyl_butanoate", + "status": "passed", + "detail": 1962.809917355372 + }, + { + "id": "cp_conflict_screen_ethyl_butanoate", + "status": "passed", + "detail": { + "chosen": 228.0, + "median_10K": 224.05 + } + }, + { + "id": "dfh_entries_on_page_ethyl_butanoate", + "status": "passed", + "detail": [ + -528.4 + ] + }, + { + "id": "dfh_median_rule_ethyl_butanoate", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_ethyl_butanoate", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_ethyl_butanoate", + "status": "passed", + "detail": "0.8735 g/cu cm at 25 °C" + }, + { + "id": "density_number_matches_text_ethyl_butanoate", + "status": "passed", + "detail": { + "rho": 873.5, + "raw": "0.8735 g/cu cm at 25 °C" + } + }, + { + "id": "density_range_ethyl_butanoate", + "status": "passed", + "detail": { + "rho": 873.5, + "T": 298.15 + } + }, + { + "id": "density_consistent_with_record_median_ethyl_butanoate", + "status": "passed", + "detail": { + "rho": 873.5, + "median_of_record_numbers": 0.877, + "numbers": 5 + } + }, + { + "id": "liquid_at_298K_ethyl_butanoate", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_methyl_benzoate", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_methyl_benzoate", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_methyl_benzoate", + "status": "passed", + "detail": [ + 221.3 + ] + }, + { + "id": "cp_median_rule_methyl_benzoate", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_methyl_benzoate", + "status": "passed", + "detail": 1625.4131472640472 + }, + { + "id": "cp_conflict_screen_methyl_benzoate", + "status": "passed", + "detail": { + "chosen": 221.3, + "median_10K": 218.9 + } + }, + { + "id": "dfh_entries_on_page_methyl_benzoate", + "status": "passed", + "detail": [ + -324.3 + ] + }, + { + "id": "dfh_median_rule_methyl_benzoate", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_methyl_benzoate", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_methyl_benzoate", + "status": "passed", + "detail": "1.0837 g/cu cm at 25 °C" + }, + { + "id": "density_number_matches_text_methyl_benzoate", + "status": "passed", + "detail": { + "rho": 1083.7, + "raw": "1.0837 g/cu cm at 25 °C" + } + }, + { + "id": "density_range_methyl_benzoate", + "status": "passed", + "detail": { + "rho": 1083.7, + "T": 298.15 + } + }, + { + "id": "density_consistent_with_record_median_methyl_benzoate", + "status": "passed", + "detail": { + "rho": 1083.7, + "median_of_record_numbers": 1.0862500000000002, + "numbers": 6 + } + }, + { + "id": "liquid_at_298K_methyl_benzoate", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_ethyl_benzoate", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_ethyl_benzoate", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_ethyl_benzoate", + "status": "passed", + "detail": [ + 246.0 + ] + }, + { + "id": "cp_median_rule_ethyl_benzoate", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_ethyl_benzoate", + "status": "passed", + "detail": 1638.1434374375708 + }, + { + "id": "cp_conflict_screen_ethyl_benzoate", + "status": "passed", + "detail": { + "chosen": 246.0, + "median_10K": 243.9 + } + }, + { + "id": "pubchem_bytes_ethyl_benzoate", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_ethyl_benzoate", + "status": "passed", + "detail": "1.048 @ 20°C" + }, + { + "id": "density_number_matches_text_ethyl_benzoate", + "status": "passed", + "detail": { + "rho": 1048.0, + "raw": "1.048 @ 20°C" + } + }, + { + "id": "density_range_ethyl_benzoate", + "status": "passed", + "detail": { + "rho": 1048.0, + "T": 293.15 + } + }, + { + "id": "density_consistent_with_record_median_ethyl_benzoate", + "status": "passed", + "detail": { + "rho": 1048.0, + "median_of_record_numbers": 1.048, + "numbers": 3 + } + }, + { + "id": "liquid_at_298K_ethyl_benzoate", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_methyl_methacrylate", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_methyl_methacrylate", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_methyl_methacrylate", + "status": "passed", + "detail": [ + 191.09, + 215.3, + 215.3, + 210.55 + ] + }, + { + "id": "cp_median_rule_methyl_methacrylate", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_methyl_methacrylate", + "status": "passed", + "detail": 2126.697962445066 + }, + { + "id": "cp_conflict_screen_methyl_methacrylate", + "status": "passed", + "detail": { + "chosen": 212.925, + "median_10K": 201.47500000000002 + } + }, + { + "id": "dfh_entries_on_page_methyl_methacrylate", + "status": "passed", + "detail": [ + -388.8 + ] + }, + { + "id": "dfh_median_rule_methyl_methacrylate", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_methyl_methacrylate", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_methyl_methacrylate", + "status": "passed", + "detail": "0.9337 g/cu cm at 25 °C" + }, + { + "id": "density_number_matches_text_methyl_methacrylate", + "status": "passed", + "detail": { + "rho": 933.7, + "raw": "0.9337 g/cu cm at 25 °C" + } + }, + { + "id": "density_range_methyl_methacrylate", + "status": "passed", + "detail": { + "rho": 933.7, + "T": 298.15 + } + }, + { + "id": "density_consistent_with_record_median_methyl_methacrylate", + "status": "passed", + "detail": { + "rho": 933.7, + "median_of_record_numbers": 0.94, + "numbers": 9 + } + }, + { + "id": "liquid_at_298K_methyl_methacrylate", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_propanal", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_propanal", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_propanal", + "status": "passed", + "detail": [ + 159.1, + 134.7 + ] + }, + { + "id": "cp_median_rule_propanal", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_propanal", + "status": "passed", + "detail": 2529.26997245179 + }, + { + "id": "cp_conflict_screen_propanal", + "status": "passed", + "detail": { + "chosen": 146.89999999999998, + "median_10K": 146.89999999999998 + } + }, + { + "id": "dfh_entries_on_page_propanal", + "status": "passed", + "detail": [ + -218.3, + -215.7, + -220.2, + -221.5 + ] + }, + { + "id": "dfh_median_rule_propanal", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_propanal", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_propanal", + "status": "passed", + "detail": "0.805 at 68 °F (USCG, 1999) - Less dense than water; will fl" + }, + { + "id": "density_number_matches_text_propanal", + "status": "passed", + "detail": { + "rho": 805.0, + "raw": "0.805 at 68 °F (USCG, 1999) - Less dense than water; will fl" + } + }, + { + "id": "density_range_propanal", + "status": "passed", + "detail": { + "rho": 805.0, + "T": 293.15 + } + }, + { + "id": "density_consistent_with_record_median_propanal", + "status": "passed", + "detail": { + "rho": 805.0, + "median_of_record_numbers": 0.805, + "numbers": 7 + } + }, + { + "id": "liquid_at_298K_propanal", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_hexanal", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_hexanal", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_hexanal", + "status": "passed", + "detail": [ + 210.4 + ] + }, + { + "id": "cp_median_rule_hexanal", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_hexanal", + "status": "passed", + "detail": 2100.638977635783 + }, + { + "id": "cp_conflict_screen_hexanal", + "status": "passed", + "detail": { + "chosen": 210.4, + "median_10K": 210.4 + } + }, + { + "id": "pubchem_bytes_hexanal", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_hexanal", + "status": "passed", + "detail": "0.8335 g/cu cm at 20 °C" + }, + { + "id": "density_number_matches_text_hexanal", + "status": "passed", + "detail": { + "rho": 833.5, + "raw": "0.8335 g/cu cm at 20 °C" + } + }, + { + "id": "density_range_hexanal", + "status": "passed", + "detail": { + "rho": 833.5, + "T": 293.15 + } + }, + { + "id": "density_consistent_with_record_median_hexanal", + "status": "passed", + "detail": { + "rho": 833.5, + "median_of_record_numbers": 0.83, + "numbers": 5 + } + }, + { + "id": "liquid_at_298K_hexanal", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_benzaldehyde", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_benzaldehyde", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_benzaldehyde", + "status": "passed", + "detail": [ + 172.0 + ] + }, + { + "id": "cp_median_rule_benzaldehyde", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_benzaldehyde", + "status": "passed", + "detail": 1620.806633999246 + }, + { + "id": "cp_conflict_screen_benzaldehyde", + "status": "passed", + "detail": { + "chosen": 172.0, + "median_10K": 171.1 + } + }, + { + "id": "dfh_entries_on_page_benzaldehyde", + "status": "passed", + "detail": [ + -87.1, + -83.05 + ] + }, + { + "id": "dfh_median_rule_benzaldehyde", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_benzaldehyde", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_benzaldehyde", + "status": "passed", + "detail": "1.041 @25 °C" + }, + { + "id": "density_number_matches_text_benzaldehyde", + "status": "passed", + "detail": { + "rho": 1041.0, + "raw": "1.041 @25 °C" + } + }, + { + "id": "density_range_benzaldehyde", + "status": "passed", + "detail": { + "rho": 1041.0, + "T": 298.15 + } + }, + { + "id": "density_consistent_with_record_median_benzaldehyde", + "status": "passed", + "detail": { + "rho": 1041.0, + "median_of_record_numbers": 1.0465, + "numbers": 6 + } + }, + { + "id": "liquid_at_298K_benzaldehyde", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_acetone", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_acetone", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_acetone", + "status": "passed", + "detail": [ + 125.45, + 123.8, + 126.6, + 126.6, + 123.8, + 123.8, + 125.9, + 129.7, + 125.56, + 128.24, + 124.7, + 124.7, + 123.8, + 133.9 + ] + }, + { + "id": "cp_median_rule_acetone", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_acetone", + "status": "passed", + "detail": 2160.8987603305786 + }, + { + "id": "cp_conflict_screen_acetone", + "status": "passed", + "detail": { + "chosen": 125.505, + "median_10K": 125.56 + } + }, + { + "id": "dfh_entries_on_page_acetone", + "status": "passed", + "detail": [ + -249.4 + ] + }, + { + "id": "dfh_median_rule_acetone", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_acetone", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_acetone", + "status": "passed", + "detail": "0.7845 g/cu cm at 20 °C" + }, + { + "id": "density_number_matches_text_acetone", + "status": "passed", + "detail": { + "rho": 784.5, + "raw": "0.7845 g/cu cm at 20 °C" + } + }, + { + "id": "density_range_acetone", + "status": "passed", + "detail": { + "rho": 784.5, + "T": 293.15 + } + }, + { + "id": "density_consistent_with_record_median_acetone", + "status": "passed", + "detail": { + "rho": 784.5, + "median_of_record_numbers": 0.791, + "numbers": 8 + } + }, + { + "id": "liquid_at_298K_acetone", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_butanone", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_butanone", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_butanone", + "status": "passed", + "detail": [ + 159.0, + 158.4, + 158.4, + 157.91, + 158.4, + 159.2, + 158.7, + 158.91, + 158.41 + ] + }, + { + "id": "cp_median_rule_butanone", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_butanone", + "status": "passed", + "detail": 2196.782693107752 + }, + { + "id": "cp_conflict_screen_butanone", + "status": "passed", + "detail": { + "chosen": 158.41, + "median_10K": 158.7 + } + }, + { + "id": "dfh_entries_on_page_butanone", + "status": "passed", + "detail": [ + -273.3 + ] + }, + { + "id": "dfh_median_rule_butanone", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_butanone", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_butanone", + "status": "passed", + "detail": "0.805 at 20 °C/4 °C; 0.7997 at 25 °C/4 °C; 0.8255 at 0 °C/4 " + }, + { + "id": "density_number_matches_text_butanone", + "status": "passed", + "detail": { + "rho": 799.7, + "raw": "0.805 at 20 °C/4 °C; 0.7997 at 25 °C/4 °C; 0.8255 at 0 °C/4 " + } + }, + { + "id": "density_range_butanone", + "status": "passed", + "detail": { + "rho": 799.7, + "T": 298.15 + } + }, + { + "id": "density_consistent_with_record_median_butanone", + "status": "passed", + "detail": { + "rho": 799.7, + "median_of_record_numbers": 0.804, + "numbers": 10 + } + }, + { + "id": "liquid_at_298K_butanone", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_cyclohexanone", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_cyclohexanone", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_cyclohexanone", + "status": "passed", + "detail": [ + 177.2 + ] + }, + { + "id": "cp_median_rule_cyclohexanone", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_cyclohexanone", + "status": "passed", + "detail": 1805.5838597921336 + }, + { + "id": "cp_conflict_screen_cyclohexanone", + "status": "passed", + "detail": { + "chosen": 177.2, + "median_10K": 177.8 + } + }, + { + "id": "dfh_entries_on_page_cyclohexanone", + "status": "passed", + "detail": [ + -276.1, + -272.6, + -254.0 + ] + }, + { + "id": "dfh_median_rule_cyclohexanone", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_cyclohexanone", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_cyclohexanone", + "status": "passed", + "detail": "0.9421 @ 25 °C/4 °C; 0.9478 @ 20 °C/4 °C" + }, + { + "id": "density_number_matches_text_cyclohexanone", + "status": "passed", + "detail": { + "rho": 942.1, + "raw": "0.9421 @ 25 °C/4 °C; 0.9478 @ 20 °C/4 °C" + } + }, + { + "id": "density_range_cyclohexanone", + "status": "passed", + "detail": { + "rho": 942.1, + "T": 298.15 + } + }, + { + "id": "density_consistent_with_record_median_cyclohexanone", + "status": "passed", + "detail": { + "rho": 942.1, + "median_of_record_numbers": 0.9478, + "numbers": 9 + } + }, + { + "id": "liquid_at_298K_cyclohexanone", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_acetophenone", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_acetophenone", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_acetophenone", + "status": "passed", + "detail": [ + 227.6 + ] + }, + { + "id": "cp_range_acetophenone", + "status": "passed", + "detail": 1894.2987931751975 + }, + { + "id": "cp_conflict_screen_acetophenone", + "status": "passed", + "detail": { + "chosen": 227.6, + "median_10K": 227.6 + } + }, + { + "id": "dfh_entries_on_page_acetophenone", + "status": "passed", + "detail": [ + -142.5 + ] + }, + { + "id": "dfh_median_rule_acetophenone", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_acetophenone", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_acetophenone", + "status": "passed", + "detail": "1.0281 g/cu cm at 20 °C" + }, + { + "id": "density_number_matches_text_acetophenone", + "status": "passed", + "detail": { + "rho": 1028.1, + "raw": "1.0281 g/cu cm at 20 °C" + } + }, + { + "id": "density_range_acetophenone", + "status": "passed", + "detail": { + "rho": 1028.1, + "T": 293.15 + } + }, + { + "id": "density_consistent_with_record_median_acetophenone", + "status": "passed", + "detail": { + "rho": 1028.1, + "median_of_record_numbers": 1.028, + "numbers": 8 + } + }, + { + "id": "liquid_at_298K_acetophenone", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_benzene", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_benzene", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_benzene", + "status": "passed", + "detail": [ + 135.69, + 135.9, + 135.62, + 134.63, + 135.75, + 135.707, + 136.06, + 135.718, + 136.24, + 135.7, + 135.74, + 135.6, + 135.9, + 135.61, + 135.9, + 135.6, + 135.76, + 135.76, + 135.7, + 134.3, + 135.9, + 135.9, + 135.4, + 130.0, + 134.98, + 135.23, + 136.06, + 133.5, + 136.0, + 135.44, + 131.4, + 135.1, + 132.2, + 137.2, + 133.5 + ] + }, + { + "id": "cp_median_rule_benzene", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_benzene", + "status": "passed", + "detail": 1737.2935603635897 + }, + { + "id": "cp_conflict_screen_benzene", + "status": "passed", + "detail": { + "chosen": 135.7, + "median_10K": 135.61 + } + }, + { + "id": "dfh_entries_on_page_benzene", + "status": "passed", + "detail": [ + 49.0, + 48.95, + 49.04 + ] + }, + { + "id": "dfh_median_rule_benzene", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_benzene", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_benzene", + "status": "passed", + "detail": "0.8756 g/cu cm at 20 °C" + }, + { + "id": "density_number_matches_text_benzene", + "status": "passed", + "detail": { + "rho": 875.6, + "raw": "0.8756 g/cu cm at 20 °C" + } + }, + { + "id": "density_range_benzene", + "status": "passed", + "detail": { + "rho": 875.6, + "T": 293.15 + } + }, + { + "id": "density_consistent_with_record_median_benzene", + "status": "passed", + "detail": { + "rho": 875.6, + "median_of_record_numbers": 0.88, + "numbers": 7 + } + }, + { + "id": "liquid_at_298K_benzene", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_toluene", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_toluene", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_toluene", + "status": "passed", + "detail": [ + 157.09, + 155.96, + 157.08, + 158.7, + 158.7, + 157.0, + 157.15, + 157.057, + 157.081, + 156.94, + 157.026, + 156.99, + 158.4, + 156.8, + 156.5, + 157.23, + 158.6, + 156.9, + 157.07, + 156.5, + 156.5, + 161.9, + 158.2 + ] + }, + { + "id": "cp_median_rule_toluene", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_toluene", + "status": "passed", + "detail": 1704.68851747341 + }, + { + "id": "cp_conflict_screen_toluene", + "status": "passed", + "detail": { + "chosen": 157.07, + "median_10K": 157.057 + } + }, + { + "id": "dfh_entries_on_page_toluene", + "status": "passed", + "detail": [ + 12.0, + 12.0 + ] + }, + { + "id": "dfh_median_rule_toluene", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_toluene", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_toluene", + "status": "passed", + "detail": "0.8623 @25 °C" + }, + { + "id": "density_number_matches_text_toluene", + "status": "passed", + "detail": { + "rho": 862.3, + "raw": "0.8623 @25 °C" + } + }, + { + "id": "density_range_toluene", + "status": "passed", + "detail": { + "rho": 862.3, + "T": 298.15 + } + }, + { + "id": "density_consistent_with_record_median_toluene", + "status": "passed", + "detail": { + "rho": 862.3, + "median_of_record_numbers": 0.8685, + "numbers": 6 + } + }, + { + "id": "liquid_at_298K_toluene", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_ethylbenzene", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_ethylbenzene", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_ethylbenzene", + "status": "passed", + "detail": [ + 185.572, + 185.559, + 185.78, + 185.8, + 186.04, + 185.81, + 186.6, + 183.7, + 184.5 + ] + }, + { + "id": "cp_median_rule_ethylbenzene", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_ethylbenzene", + "status": "passed", + "detail": 1750.0000000000002 + }, + { + "id": "cp_conflict_screen_ethylbenzene", + "status": "passed", + "detail": { + "chosen": 185.78, + "median_10K": 184.8 + } + }, + { + "id": "dfh_entries_on_page_ethylbenzene", + "status": "passed", + "detail": [ + -12.5, + 6.8 + ] + }, + { + "id": "dfh_median_rule_ethylbenzene", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_ethylbenzene", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_ethylbenzene", + "status": "passed", + "detail": "0.8626 g/cu cm at 25 °C" + }, + { + "id": "density_number_matches_text_ethylbenzene", + "status": "passed", + "detail": { + "rho": 862.6, + "raw": "0.8626 g/cu cm at 25 °C" + } + }, + { + "id": "density_range_ethylbenzene", + "status": "passed", + "detail": { + "rho": 862.6, + "T": 298.15 + } + }, + { + "id": "density_consistent_with_record_median_ethylbenzene", + "status": "passed", + "detail": { + "rho": 862.6, + "median_of_record_numbers": 0.87, + "numbers": 7 + } + }, + { + "id": "liquid_at_298K_ethylbenzene", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_o_xylene", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_o_xylene", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_o_xylene", + "status": "passed", + "detail": [ + 187.653, + 187.584, + 187.0, + 187.82, + 183.89 + ] + }, + { + "id": "cp_median_rule_o_xylene", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_o_xylene", + "status": "passed", + "detail": 1766.9932177844764 + }, + { + "id": "cp_conflict_screen_o_xylene", + "status": "passed", + "detail": { + "chosen": 187.584, + "median_10K": 187.292 + } + }, + { + "id": "dfh_entries_on_page_o_xylene", + "status": "passed", + "detail": [ + -24.4 + ] + }, + { + "id": "dfh_median_rule_o_xylene", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_o_xylene", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_o_xylene", + "status": "passed", + "detail": "0.8801 at 20 °C/4 °C" + }, + { + "id": "density_number_matches_text_o_xylene", + "status": "passed", + "detail": { + "rho": 880.1, + "raw": "0.8801 at 20 °C/4 °C" + } + }, + { + "id": "density_range_o_xylene", + "status": "passed", + "detail": { + "rho": 880.1, + "T": 293.15 + } + }, + { + "id": "density_consistent_with_record_median_o_xylene", + "status": "passed", + "detail": { + "rho": 880.1, + "median_of_record_numbers": 0.88, + "numbers": 4 + } + }, + { + "id": "liquid_at_298K_o_xylene", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_m_xylene", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_m_xylene", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_m_xylene", + "status": "passed", + "detail": [ + 184.63, + 181.55, + 181.482, + 184.5, + 183.18 + ] + }, + { + "id": "cp_median_rule_m_xylene", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_m_xylene", + "status": "passed", + "detail": 1725.5086661642806 + }, + { + "id": "cp_conflict_screen_m_xylene", + "status": "passed", + "detail": { + "chosen": 183.18, + "median_10K": 182.365 + } + }, + { + "id": "dfh_entries_on_page_m_xylene", + "status": "passed", + "detail": [ + -25.4 + ] + }, + { + "id": "dfh_median_rule_m_xylene", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_m_xylene", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_m_xylene", + "status": "passed", + "detail": "0.8698 g/cu cm at 25 °C" + }, + { + "id": "density_number_matches_text_m_xylene", + "status": "passed", + "detail": { + "rho": 869.8, + "raw": "0.8698 g/cu cm at 25 °C" + } + }, + { + "id": "density_range_m_xylene", + "status": "passed", + "detail": { + "rho": 869.8, + "T": 298.15 + } + }, + { + "id": "density_consistent_with_record_median_m_xylene", + "status": "passed", + "detail": { + "rho": 869.8, + "median_of_record_numbers": 0.86, + "numbers": 5 + } + }, + { + "id": "liquid_at_298K_m_xylene", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_p_xylene", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_p_xylene", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_p_xylene", + "status": "passed", + "detail": [ + 182.219, + 183.65, + 181.937, + 181.9, + 181.794, + 181.55, + 181.7, + 181.6, + 184.9, + 183.76 + ] + }, + { + "id": "cp_median_rule_p_xylene", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_p_xylene", + "status": "passed", + "detail": 1713.625659382065 + }, + { + "id": "cp_conflict_screen_p_xylene", + "status": "passed", + "detail": { + "chosen": 181.9185, + "median_10K": 181.847 + } + }, + { + "id": "dfh_entries_on_page_p_xylene", + "status": "passed", + "detail": [ + -24.4 + ] + }, + { + "id": "dfh_median_rule_p_xylene", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_p_xylene", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_p_xylene", + "status": "passed", + "detail": "0.86104 at 20 °C/4 °C" + }, + { + "id": "density_number_matches_text_p_xylene", + "status": "passed", + "detail": { + "rho": 861.04, + "raw": "0.86104 at 20 °C/4 °C" + } + }, + { + "id": "density_range_p_xylene", + "status": "passed", + "detail": { + "rho": 861.04, + "T": 293.15 + } + }, + { + "id": "density_consistent_with_record_median_p_xylene", + "status": "passed", + "detail": { + "rho": 861.04, + "median_of_record_numbers": 0.8605, + "numbers": 4 + } + }, + { + "id": "liquid_at_298K_p_xylene", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_styrene", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_styrene", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_styrene", + "status": "passed", + "detail": [ + 183.2, + 182.6, + 235.6, + 182.84, + 179.9 + ] + }, + { + "id": "cp_median_rule_styrene", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_styrene", + "status": "passed", + "detail": 1755.544887181949 + }, + { + "id": "cp_conflict_screen_styrene", + "status": "passed", + "detail": { + "chosen": 182.84, + "median_10K": 182.84 + } + }, + { + "id": "dfh_entries_on_page_styrene", + "status": "passed", + "detail": [ + 103.4, + 87.6 + ] + }, + { + "id": "dfh_median_rule_styrene", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_styrene", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_styrene", + "status": "passed", + "detail": "0.9016 g/cu cm at 25 °C" + }, + { + "id": "density_number_matches_text_styrene", + "status": "passed", + "detail": { + "rho": 901.6, + "raw": "0.9016 g/cu cm at 25 °C" + } + }, + { + "id": "density_range_styrene", + "status": "passed", + "detail": { + "rho": 901.6, + "T": 298.15 + } + }, + { + "id": "density_consistent_with_record_median_styrene", + "status": "passed", + "detail": { + "rho": 901.6, + "median_of_record_numbers": 0.908, + "numbers": 8 + } + }, + { + "id": "liquid_at_298K_styrene", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_anisole", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_anisole", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_anisole", + "status": "passed", + "detail": [ + 199.0 + ] + }, + { + "id": "cp_median_rule_anisole", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_anisole", + "status": "passed", + "detail": 1840.2071388940262 + }, + { + "id": "cp_conflict_screen_anisole", + "status": "passed", + "detail": { + "chosen": 199.0, + "median_10K": 199.0 + } + }, + { + "id": "dfh_entries_on_page_anisole", + "status": "passed", + "detail": [ + -114.8, + -120.0 + ] + }, + { + "id": "dfh_median_rule_anisole", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_anisole", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_anisole", + "status": "passed", + "detail": "0.9956 AT 18 °C/4 °C" + }, + { + "id": "density_number_matches_text_anisole", + "status": "passed", + "detail": { + "rho": 995.6, + "raw": "0.9956 AT 18 °C/4 °C" + } + }, + { + "id": "density_range_anisole", + "status": "passed", + "detail": { + "rho": 995.6, + "T": 291.15 + } + }, + { + "id": "density_consistent_with_record_median_anisole", + "status": "passed", + "detail": { + "rho": 995.6, + "median_of_record_numbers": 0.9943, + "numbers": 6 + } + }, + { + "id": "liquid_at_298K_anisole", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_aniline", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_aniline", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_aniline", + "status": "passed", + "detail": [ + 194.1, + 191.01, + 193.7, + 192.05, + 178.8, + 190.92, + 193.38, + 192.5 + ] + }, + { + "id": "cp_median_rule_aniline", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_aniline", + "status": "passed", + "detail": 2064.5871362611406 + }, + { + "id": "cp_conflict_screen_aniline", + "status": "passed", + "detail": { + "chosen": 192.275, + "median_10K": 192.05 + } + }, + { + "id": "dfh_entries_on_page_aniline", + "status": "passed", + "detail": [ + 31.3 + ] + }, + { + "id": "dfh_median_rule_aniline", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_aniline", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_aniline", + "status": "passed", + "detail": "1.0217 at 20 °C/20 °C" + }, + { + "id": "density_number_matches_text_aniline", + "status": "passed", + "detail": { + "rho": 1021.7, + "raw": "1.0217 at 20 °C/20 °C" + } + }, + { + "id": "density_range_aniline", + "status": "passed", + "detail": { + "rho": 1021.7, + "T": 293.15 + } + }, + { + "id": "density_consistent_with_record_median_aniline", + "status": "passed", + "detail": { + "rho": 1021.7, + "median_of_record_numbers": 1.02085, + "numbers": 6 + } + }, + { + "id": "liquid_at_298K_aniline", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_nitrobenzene", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_nitrobenzene", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_nitrobenzene", + "status": "passed", + "detail": [ + 181.13, + 186.69, + 186.73, + 177.8 + ] + }, + { + "id": "cp_median_rule_nitrobenzene", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_nitrobenzene", + "status": "passed", + "detail": 1493.8672731703355 + }, + { + "id": "cp_conflict_screen_nitrobenzene", + "status": "passed", + "detail": { + "chosen": 183.91, + "median_10K": 179.925 + } + }, + { + "id": "dfh_entries_on_page_nitrobenzene", + "status": "passed", + "detail": [ + 12.5 + ] + }, + { + "id": "dfh_median_rule_nitrobenzene", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_nitrobenzene", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_nitrobenzene", + "status": "passed", + "detail": "Density: 1.199 g/cu cm at 25 °C/4 °C; Specific heat: 1.509 J" + }, + { + "id": "density_number_matches_text_nitrobenzene", + "status": "passed", + "detail": { + "rho": 1199.0, + "raw": "Density: 1.199 g/cu cm at 25 °C/4 °C; Specific heat: 1.509 J" + } + }, + { + "id": "density_range_nitrobenzene", + "status": "passed", + "detail": { + "rho": 1199.0, + "T": 298.15 + } + }, + { + "id": "density_consistent_with_record_median_nitrobenzene", + "status": "passed", + "detail": { + "rho": 1199.0, + "median_of_record_numbers": 1.2018499999999999, + "numbers": 8 + } + }, + { + "id": "liquid_at_298K_nitrobenzene", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_chlorobenzene", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_chlorobenzene", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_chlorobenzene", + "status": "passed", + "detail": [ + 152.1, + 153.78, + 150.787, + 147.7, + 150.08, + 141.0 + ] + }, + { + "id": "cp_median_rule_chlorobenzene", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_chlorobenzene", + "status": "passed", + "detail": 1336.592625499778 + }, + { + "id": "cp_conflict_screen_chlorobenzene", + "status": "passed", + "detail": { + "chosen": 150.4335, + "median_10K": 150.6 + } + }, + { + "id": "dfh_entries_on_page_chlorobenzene", + "status": "passed", + "detail": [ + 11.5, + 10.7 + ] + }, + { + "id": "dfh_median_rule_chlorobenzene", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_chlorobenzene", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_chlorobenzene", + "status": "passed", + "detail": "1.1058 g/cu cm at 20 °C" + }, + { + "id": "density_number_matches_text_chlorobenzene", + "status": "passed", + "detail": { + "rho": 1105.8, + "raw": "1.1058 g/cu cm at 20 °C" + } + }, + { + "id": "density_range_chlorobenzene", + "status": "passed", + "detail": { + "rho": 1105.8, + "T": 293.15 + } + }, + { + "id": "density_consistent_with_record_median_chlorobenzene", + "status": "passed", + "detail": { + "rho": 1105.8, + "median_of_record_numbers": 1.11, + "numbers": 9 + } + }, + { + "id": "liquid_at_298K_chlorobenzene", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_pyridine", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_pyridine", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_pyridine", + "status": "passed", + "detail": [ + 133.0, + 132.72, + 134.93, + 133.3 + ] + }, + { + "id": "cp_median_rule_pyridine", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_pyridine", + "status": "passed", + "detail": 1683.312262958281 + }, + { + "id": "cp_conflict_screen_pyridine", + "status": "passed", + "detail": { + "chosen": 133.15, + "median_10K": 133.15 + } + }, + { + "id": "dfh_entries_on_page_pyridine", + "status": "passed", + "detail": [ + 99.96, + 100.2 + ] + }, + { + "id": "dfh_median_rule_pyridine", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_pyridine", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_pyridine", + "status": "passed", + "detail": "0.98272 @ 20 °C/4 °C" + }, + { + "id": "density_number_matches_text_pyridine", + "status": "passed", + "detail": { + "rho": 982.72, + "raw": "0.98272 @ 20 °C/4 °C" + } + }, + { + "id": "density_range_pyridine", + "status": "passed", + "detail": { + "rho": 982.72, + "T": 293.15 + } + }, + { + "id": "density_consistent_with_record_median_pyridine", + "status": "passed", + "detail": { + "rho": 982.72, + "median_of_record_numbers": 0.98271, + "numbers": 6 + } + }, + { + "id": "liquid_at_298K_pyridine", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_diethyl_ether", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_diethyl_ether", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_diethyl_ether", + "status": "passed", + "detail": [ + 172.5 + ] + }, + { + "id": "cp_median_rule_diethyl_ether", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_diethyl_ether", + "status": "passed", + "detail": 2327.3070696168375 + }, + { + "id": "cp_conflict_screen_diethyl_ether", + "status": "passed", + "detail": { + "chosen": 172.5, + "median_10K": 171.94 + } + }, + { + "id": "dfh_entries_on_page_diethyl_ether", + "status": "passed", + "detail": [ + -271.2 + ] + }, + { + "id": "dfh_median_rule_diethyl_ether", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_diethyl_ether", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_diethyl_ether", + "status": "passed", + "detail": "0.7134 at 20 °C/4 °C" + }, + { + "id": "density_number_matches_text_diethyl_ether", + "status": "passed", + "detail": { + "rho": 713.4, + "raw": "0.7134 at 20 °C/4 °C" + } + }, + { + "id": "density_range_diethyl_ether", + "status": "passed", + "detail": { + "rho": 713.4, + "T": 293.15 + } + }, + { + "id": "density_consistent_with_record_median_diethyl_ether", + "status": "passed", + "detail": { + "rho": 713.4, + "median_of_record_numbers": 0.7134, + "numbers": 7 + } + }, + { + "id": "liquid_at_298K_diethyl_ether", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_tetrahydrofuran", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_tetrahydrofuran", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_tetrahydrofuran", + "status": "passed", + "detail": [ + 124.1, + 124.1, + 122.92, + 123.56, + 123.9, + 123.9, + 120.0, + 120.5 + ] + }, + { + "id": "cp_median_rule_tetrahydrofuran", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_tetrahydrofuran", + "status": "passed", + "detail": 1715.85078352517 + }, + { + "id": "cp_conflict_screen_tetrahydrofuran", + "status": "passed", + "detail": { + "chosen": 123.73, + "median_10K": 123.73 + } + }, + { + "id": "pubchem_bytes_tetrahydrofuran", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_tetrahydrofuran", + "status": "passed", + "detail": "0.8833 g/cu cm at 25 °C" + }, + { + "id": "density_number_matches_text_tetrahydrofuran", + "status": "passed", + "detail": { + "rho": 883.3, + "raw": "0.8833 g/cu cm at 25 °C" + } + }, + { + "id": "density_range_tetrahydrofuran", + "status": "passed", + "detail": { + "rho": 883.3, + "T": 298.15 + } + }, + { + "id": "density_consistent_with_record_median_tetrahydrofuran", + "status": "passed", + "detail": { + "rho": 883.3, + "median_of_record_numbers": 0.889, + "numbers": 6 + } + }, + { + "id": "liquid_at_298K_tetrahydrofuran", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_dioxane_1_4", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_dioxane_1_4", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_dioxane_1_4", + "status": "passed", + "detail": [ + 149.65, + 150.57, + 149.489, + 150.65, + 150.77, + 149.73, + 149.0, + 149.0, + 140.2, + 155.6, + 147.9, + 147.9, + 152.97 + ] + }, + { + "id": "cp_median_rule_dioxane_1_4", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_dioxane_1_4", + "status": "passed", + "detail": 1698.4451254114176 + }, + { + "id": "cp_conflict_screen_dioxane_1_4", + "status": "passed", + "detail": { + "chosen": 149.65, + "median_10K": 149.65 + } + }, + { + "id": "dfh_entries_on_page_dioxane_1_4", + "status": "passed", + "detail": [ + -355.13, + -353.5 + ] + }, + { + "id": "dfh_median_rule_dioxane_1_4", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_dioxane_1_4", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_dioxane_1_4", + "status": "passed", + "detail": "1.0337 g/cu cm at 20 °C" + }, + { + "id": "density_number_matches_text_dioxane_1_4", + "status": "passed", + "detail": { + "rho": 1033.7, + "raw": "1.0337 g/cu cm at 20 °C" + } + }, + { + "id": "density_range_dioxane_1_4", + "status": "passed", + "detail": { + "rho": 1033.7, + "T": 293.15 + } + }, + { + "id": "density_consistent_with_record_median_dioxane_1_4", + "status": "passed", + "detail": { + "rho": 1033.7, + "median_of_record_numbers": 1.03185, + "numbers": 6 + } + }, + { + "id": "liquid_at_298K_dioxane_1_4", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_dichloromethane", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_dichloromethane", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_dichloromethane", + "status": "passed", + "detail": [ + 102.3, + 129.3, + 100.0, + 100.0 + ] + }, + { + "id": "cp_median_rule_dichloromethane", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_dichloromethane", + "status": "passed", + "detail": 1190.980807724008 + }, + { + "id": "cp_conflict_screen_dichloromethane", + "status": "passed", + "detail": { + "chosen": 101.15, + "median_10K": 100.8 + } + }, + { + "id": "dfh_entries_on_page_dichloromethane", + "status": "passed", + "detail": [ + -124.1 + ] + }, + { + "id": "dfh_median_rule_dichloromethane", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_dichloromethane", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_dichloromethane", + "status": "passed", + "detail": "1.3266 @ 20°C" + }, + { + "id": "density_number_matches_text_dichloromethane", + "status": "passed", + "detail": { + "rho": 1326.6, + "raw": "1.3266 @ 20°C" + } + }, + { + "id": "density_range_dichloromethane", + "status": "passed", + "detail": { + "rho": 1326.6, + "T": 293.15 + } + }, + { + "id": "density_consistent_with_record_median_dichloromethane", + "status": "passed", + "detail": { + "rho": 1326.6, + "median_of_record_numbers": 1.32605, + "numbers": 6 + } + }, + { + "id": "liquid_at_298K_dichloromethane", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_chloroform", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_chloroform", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_chloroform", + "status": "passed", + "detail": [ + 114.25, + 113.2, + 114.32, + 114.35, + 115.5, + 113.85, + 115.5, + 113.73, + 114.26, + 114.18, + 117.1, + 113.0 + ] + }, + { + "id": "cp_median_rule_chloroform", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_chloroform", + "status": "passed", + "detail": 957.150037697914 + }, + { + "id": "cp_conflict_screen_chloroform", + "status": "passed", + "detail": { + "chosen": 114.255, + "median_10K": 114.28999999999999 + } + }, + { + "id": "dfh_entries_on_page_chloroform", + "status": "passed", + "detail": [ + -134.1 + ] + }, + { + "id": "dfh_median_rule_chloroform", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_chloroform", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_chloroform", + "status": "passed", + "detail": "1.4788 g/cu cm at 25 °C" + }, + { + "id": "density_number_matches_text_chloroform", + "status": "passed", + "detail": { + "rho": 1478.8, + "raw": "1.4788 g/cu cm at 25 °C" + } + }, + { + "id": "density_range_chloroform", + "status": "passed", + "detail": { + "rho": 1478.8, + "T": 298.15 + } + }, + { + "id": "density_consistent_with_record_median_chloroform", + "status": "passed", + "detail": { + "rho": 1478.8, + "median_of_record_numbers": 1.48, + "numbers": 9 + } + }, + { + "id": "liquid_at_298K_chloroform", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_carbon_tetrachloride", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_carbon_tetrachloride", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_carbon_tetrachloride", + "status": "passed", + "detail": [ + 131.3, + 133.35, + 133.0, + 132.9, + 131.34, + 131.6, + 131.4, + 131.36, + 131.57, + 131.4, + 131.36, + 131.401, + 131.9, + 130.8, + 131.0, + 132.59, + 128.8, + 131.67, + 132.2, + 132.63, + 133.1, + 133.0, + 130.5 + ] + }, + { + "id": "cp_median_rule_carbon_tetrachloride", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_carbon_tetrachloride", + "status": "passed", + "detail": 855.4616384915473 + }, + { + "id": "cp_conflict_screen_carbon_tetrachloride", + "status": "passed", + "detail": { + "chosen": 131.57, + "median_10K": 131.40050000000002 + } + }, + { + "id": "dfh_entries_on_page_carbon_tetrachloride", + "status": "passed", + "detail": [ + -128.1 + ] + }, + { + "id": "dfh_median_rule_carbon_tetrachloride", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_carbon_tetrachloride", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_carbon_tetrachloride", + "status": "passed", + "detail": "1.5940 g/cu cm at 20 °C" + }, + { + "id": "density_number_matches_text_carbon_tetrachloride", + "status": "passed", + "detail": { + "rho": 1594.0, + "raw": "1.5940 g/cu cm at 20 °C" + } + }, + { + "id": "density_range_carbon_tetrachloride", + "status": "passed", + "detail": { + "rho": 1594.0, + "T": 293.15 + } + }, + { + "id": "density_consistent_with_record_median_carbon_tetrachloride", + "status": "passed", + "detail": { + "rho": 1594.0, + "median_of_record_numbers": 1.59, + "numbers": 9 + } + }, + { + "id": "liquid_at_298K_carbon_tetrachloride", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_dichloroethane_1_2", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_dichloroethane_1_2", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_dichloroethane_1_2", + "status": "passed", + "detail": [ + 129.4, + 128.81, + 128.99, + 129.0, + 128.99, + 128.6, + 129.54, + 129.7, + 123.0, + 128.9, + 122.2 + ] + }, + { + "id": "cp_median_rule_dichloroethane_1_2", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_dichloroethane_1_2", + "status": "passed", + "detail": 1303.4559417946648 + }, + { + "id": "cp_conflict_screen_dichloroethane_1_2", + "status": "passed", + "detail": { + "chosen": 128.99, + "median_10K": 128.99 + } + }, + { + "id": "dfh_entries_on_page_dichloroethane_1_2", + "status": "passed", + "detail": [ + -167.2 + ] + }, + { + "id": "dfh_median_rule_dichloroethane_1_2", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_dichloroethane_1_2", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_dichloroethane_1_2", + "status": "passed", + "detail": "1.2454 at 25 °C" + }, + { + "id": "density_number_matches_text_dichloroethane_1_2", + "status": "passed", + "detail": { + "rho": 1245.4, + "raw": "1.2454 at 25 °C" + } + }, + { + "id": "density_range_dichloroethane_1_2", + "status": "passed", + "detail": { + "rho": 1245.4, + "T": 298.15 + } + }, + { + "id": "density_consistent_with_record_median_dichloroethane_1_2", + "status": "passed", + "detail": { + "rho": 1245.4, + "median_of_record_numbers": 1.2427000000000001, + "numbers": 6 + } + }, + { + "id": "liquid_at_298K_dichloroethane_1_2", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_acetonitrile", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_acetonitrile", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_acetonitrile", + "status": "passed", + "detail": [ + 91.69, + 77.4, + 91.7, + 91.7, + 91.7, + 91.46 + ] + }, + { + "id": "cp_median_rule_acetonitrile", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_acetonitrile", + "status": "passed", + "detail": 2233.73934226553 + }, + { + "id": "cp_conflict_screen_acetonitrile", + "status": "passed", + "detail": { + "chosen": 91.695, + "median_10K": 91.57499999999999 + } + }, + { + "id": "dfh_entries_on_page_acetonitrile", + "status": "passed", + "detail": [ + 40.56 + ] + }, + { + "id": "dfh_median_rule_acetonitrile", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_acetonitrile", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_acetonitrile", + "status": "passed", + "detail": "0.787 at 68 °F (USCG, 1999) - Less dense than water; will fl" + }, + { + "id": "density_number_matches_text_acetonitrile", + "status": "passed", + "detail": { + "rho": 787.0, + "raw": "0.787 at 68 °F (USCG, 1999) - Less dense than water; will fl" + } + }, + { + "id": "density_range_acetonitrile", + "status": "passed", + "detail": { + "rho": 787.0, + "T": 293.15 + } + }, + { + "id": "density_consistent_with_record_median_acetonitrile", + "status": "passed", + "detail": { + "rho": 787.0, + "median_of_record_numbers": 0.787, + "numbers": 9 + } + }, + { + "id": "liquid_at_298K_acetonitrile", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_dmso", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_dmso", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_dmso", + "status": "passed", + "detail": [ + 149.39, + 148.28, + 153.6, + 153.2, + 155.9, + 155.9, + 153.18, + 149.0 + ] + }, + { + "id": "cp_median_rule_dmso", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_dmso", + "status": "passed", + "detail": 1960.4555925262348 + }, + { + "id": "cp_conflict_screen_dmso", + "status": "passed", + "detail": { + "chosen": 153.19, + "median_10K": 153.19 + } + }, + { + "id": "dfh_entries_on_page_dmso", + "status": "passed", + "detail": [ + -203.4 + ] + }, + { + "id": "dfh_median_rule_dmso", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_dmso", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_dmso", + "status": "passed", + "detail": "1.101 @25 °C" + }, + { + "id": "density_number_matches_text_dmso", + "status": "passed", + "detail": { + "rho": 1101.0, + "raw": "1.101 @25 °C" + } + }, + { + "id": "density_range_dmso", + "status": "passed", + "detail": { + "rho": 1101.0, + "T": 298.15 + } + }, + { + "id": "density_consistent_with_record_median_dmso", + "status": "passed", + "detail": { + "rho": 1101.0, + "median_of_record_numbers": 1.1, + "numbers": 6 + } + }, + { + "id": "liquid_at_298K_dmso", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_dmf", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_dmf", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_dmf", + "status": "passed", + "detail": [ + 146.05, + 148.16, + 150.0, + 148.36, + 150.5, + 150.8, + 120.5, + 148.0, + 148.0, + 150.8, + 146.0, + 152.0, + 156.69 + ] + }, + { + "id": "cp_median_rule_dmf", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_dmf", + "status": "passed", + "detail": 2029.8262416199207 + }, + { + "id": "cp_conflict_screen_dmf", + "status": "passed", + "detail": { + "chosen": 148.36, + "median_10K": 148.82 + } + }, + { + "id": "dfh_entries_on_page_dmf", + "status": "passed", + "detail": [ + -239.4 + ] + }, + { + "id": "dfh_median_rule_dmf", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_dmf", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_dmf", + "status": "passed", + "detail": "0.9445 at 25 °C/4 °C" + }, + { + "id": "density_number_matches_text_dmf", + "status": "passed", + "detail": { + "rho": 944.5, + "raw": "0.9445 at 25 °C/4 °C" + } + }, + { + "id": "density_range_dmf", + "status": "passed", + "detail": { + "rho": 944.5, + "T": 298.15 + } + }, + { + "id": "density_consistent_with_record_median_dmf", + "status": "passed", + "detail": { + "rho": 944.5, + "median_of_record_numbers": 0.95, + "numbers": 6 + } + }, + { + "id": "liquid_at_298K_dmf", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_pentane", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_pentane", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_pentane", + "status": "passed", + "detail": [ + 168.6, + 167.19 + ] + }, + { + "id": "cp_median_rule_pentane", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_pentane", + "status": "passed", + "detail": 2327.0270270270266 + }, + { + "id": "cp_conflict_screen_pentane", + "status": "passed", + "detail": { + "chosen": 167.89499999999998, + "median_10K": 167.59 + } + }, + { + "id": "dfh_entries_on_page_pentane", + "status": "passed", + "detail": [ + -173.5, + -173.1 + ] + }, + { + "id": "dfh_median_rule_pentane", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_pentane", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_pentane", + "status": "passed", + "detail": "0.6262 g/cu cm at 20 °C" + }, + { + "id": "density_number_matches_text_pentane", + "status": "passed", + "detail": { + "rho": 626.2, + "raw": "0.6262 g/cu cm at 20 °C" + } + }, + { + "id": "density_range_pentane", + "status": "passed", + "detail": { + "rho": 626.2, + "T": 293.15 + } + }, + { + "id": "density_consistent_with_record_median_pentane", + "status": "passed", + "detail": { + "rho": 626.2, + "median_of_record_numbers": 0.6281, + "numbers": 6 + } + }, + { + "id": "liquid_at_298K_pentane", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_hexane", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_hexane", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_hexane", + "status": "passed", + "detail": [ + 265.2, + 195.52, + 197.66, + 197.66, + 195.64, + 195.84, + 197.66, + 194.96, + 195.8, + 195.33, + 195.8, + 195.8, + 195.33, + 195.1, + 195.76, + 196.2, + 198.5, + 194.97, + 189.1, + 194.1 + ] + }, + { + "id": "cp_median_rule_hexane", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_hexane", + "status": "passed", + "detail": 2271.7567881178925 + }, + { + "id": "cp_conflict_screen_hexane", + "status": "passed", + "detail": { + "chosen": 195.78, + "median_10K": 195.64 + } + }, + { + "id": "dfh_entries_on_page_hexane", + "status": "passed", + "detail": [ + -198.7, + -198.8 + ] + }, + { + "id": "dfh_median_rule_hexane", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_hexane", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_hexane", + "status": "passed", + "detail": "0.6606 g/cu cm at 25 °C" + }, + { + "id": "density_number_matches_text_hexane", + "status": "passed", + "detail": { + "rho": 660.6, + "raw": "0.6606 g/cu cm at 25 °C" + } + }, + { + "id": "density_range_hexane", + "status": "passed", + "detail": { + "rho": 660.6, + "T": 298.15 + } + }, + { + "id": "density_consistent_with_record_median_hexane", + "status": "passed", + "detail": { + "rho": 660.6, + "median_of_record_numbers": 0.6603, + "numbers": 6 + } + }, + { + "id": "liquid_at_298K_hexane", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_heptane", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_heptane", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_heptane", + "status": "passed", + "detail": [ + 224.64, + 224.72, + 224.73, + 224.721, + 224.71, + 224.781, + 224.781, + 224.731, + 224.71, + 224.78, + 224.764, + 224.8, + 224.0, + 224.69, + 224.62, + 224.66, + 224.6, + 255.0, + 224.707, + 223.4, + 224.19, + 225.3, + 226.53, + 328.61, + 224.93, + 224.93, + 224.74, + 224.74, + 224.85, + 211.3, + 223.0, + 224.3 + ] + }, + { + "id": "cp_median_rule_heptane", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_heptane", + "status": "passed", + "detail": 2242.7694610778444 + }, + { + "id": "cp_conflict_screen_heptane", + "status": "passed", + "detail": { + "chosen": 224.7255, + "median_10K": 224.7255 + } + }, + { + "id": "dfh_entries_on_page_heptane", + "status": "passed", + "detail": [ + -224.4, + -225.9 + ] + }, + { + "id": "dfh_median_rule_heptane", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_heptane", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_heptane", + "status": "passed", + "detail": "0.6795 g/cu cm at 25 °C" + }, + { + "id": "density_number_matches_text_heptane", + "status": "passed", + "detail": { + "rho": 679.5, + "raw": "0.6795 g/cu cm at 25 °C" + } + }, + { + "id": "density_range_heptane", + "status": "passed", + "detail": { + "rho": 679.5, + "T": 298.15 + } + }, + { + "id": "density_consistent_with_record_median_heptane", + "status": "passed", + "detail": { + "rho": 679.5, + "median_of_record_numbers": 0.68, + "numbers": 7 + } + }, + { + "id": "liquid_at_298K_heptane", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_octane", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_octane", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_octane", + "status": "passed", + "detail": [ + 255.68, + 255.68, + 255.68, + 254.11, + 255.68, + 254.18, + 253.72, + 254.02, + 252.4, + 254.07, + 252.92, + 253.2, + 254.14, + 253.89, + 251.5 + ] + }, + { + "id": "cp_median_rule_octane", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_octane", + "status": "passed", + "detail": 2224.19679593802 + }, + { + "id": "cp_conflict_screen_octane", + "status": "passed", + "detail": { + "chosen": 254.07, + "median_10K": 254.02 + } + }, + { + "id": "dfh_entries_on_page_octane", + "status": "passed", + "detail": [ + -250.3, + -250.0 + ] + }, + { + "id": "dfh_median_rule_octane", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_octane", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_octane", + "status": "passed", + "detail": "0.6986 g/cu cm at 25 °C" + }, + { + "id": "density_number_matches_text_octane", + "status": "passed", + "detail": { + "rho": 698.6, + "raw": "0.6986 g/cu cm at 25 °C" + } + }, + { + "id": "density_range_octane", + "status": "passed", + "detail": { + "rho": 698.6, + "T": 298.15 + } + }, + { + "id": "density_consistent_with_record_median_octane", + "status": "passed", + "detail": { + "rho": 698.6, + "median_of_record_numbers": 0.7, + "numbers": 6 + } + }, + { + "id": "liquid_at_298K_octane", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_nonane", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_nonane", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_nonane", + "status": "passed", + "detail": [ + 284.34, + 284.76, + 283.8, + 284.0, + 284.39, + 284.01, + 280.7 + ] + }, + { + "id": "cp_median_rule_nonane", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_nonane", + "status": "passed", + "detail": 2214.502923976608 + }, + { + "id": "cp_conflict_screen_nonane", + "status": "passed", + "detail": { + "chosen": 284.01, + "median_10K": 284.005 + } + }, + { + "id": "dfh_entries_on_page_nonane", + "status": "passed", + "detail": [ + -274.7 + ] + }, + { + "id": "dfh_median_rule_nonane", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_nonane", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_nonane", + "status": "passed", + "detail": "0.7176 g/cu cm at 20 °C" + }, + { + "id": "density_number_matches_text_nonane", + "status": "passed", + "detail": { + "rho": 717.6, + "raw": "0.7176 g/cu cm at 20 °C" + } + }, + { + "id": "density_range_nonane", + "status": "passed", + "detail": { + "rho": 717.6, + "T": 293.15 + } + }, + { + "id": "density_consistent_with_record_median_nonane", + "status": "passed", + "detail": { + "rho": 717.6, + "median_of_record_numbers": 0.718, + "numbers": 6 + } + }, + { + "id": "liquid_at_298K_nonane", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_decane", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_decane", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_decane", + "status": "passed", + "detail": [ + 315.46, + 315.46, + 315.32, + 315.0, + 313.46, + 313.13, + 315.46, + 313.56, + 315.46, + 313.24, + 314.82, + 312.99, + 313.09, + 313.09, + 313.93, + 314.21, + 312.5, + 312.8, + 313.3, + 311.7, + 314.47, + 313.97, + 311.3 + ] + }, + { + "id": "cp_median_rule_decane", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_decane", + "status": "passed", + "detail": 2203.823446724768 + }, + { + "id": "cp_conflict_screen_decane", + "status": "passed", + "detail": { + "chosen": 313.56, + "median_10K": 313.46 + } + }, + { + "id": "dfh_entries_on_page_decane", + "status": "passed", + "detail": [ + -301.0 + ] + }, + { + "id": "dfh_median_rule_decane", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_decane", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_decane", + "status": "passed", + "detail": "0.7255 g/cu cm at 25 °C" + }, + { + "id": "density_number_matches_text_decane", + "status": "passed", + "detail": { + "rho": 725.5, + "raw": "0.7255 g/cu cm at 25 °C" + } + }, + { + "id": "density_range_decane", + "status": "passed", + "detail": { + "rho": 725.5, + "T": 298.15 + } + }, + { + "id": "density_consistent_with_record_median_decane", + "status": "passed", + "detail": { + "rho": 725.5, + "median_of_record_numbers": 0.7260500000000001, + "numbers": 4 + } + }, + { + "id": "liquid_at_298K_decane", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_dodecane", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_dodecane", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_dodecane", + "status": "passed", + "detail": [ + 376.0, + 372.12, + 376.46, + 376.09, + 376.0, + 375.37, + 376.0, + 373.3, + 376.91, + 373.3, + 375.26, + 375.3, + 374.93, + 374.5, + 374.82, + 370.72, + 375.93, + 371.1 + ] + }, + { + "id": "cp_median_rule_dodecane", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_dodecane", + "status": "passed", + "detail": 2203.2525098338515 + }, + { + "id": "cp_conflict_screen_dodecane", + "status": "passed", + "detail": { + "chosen": 375.28, + "median_10K": 375.28 + } + }, + { + "id": "dfh_entries_on_page_dodecane", + "status": "passed", + "detail": [ + -352.1, + -349.3 + ] + }, + { + "id": "dfh_median_rule_dodecane", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_dodecane", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_dodecane", + "status": "passed", + "detail": "0.7487 at 68 °F (NTP, 1992) - Less dense than water; will fl" + }, + { + "id": "density_number_matches_text_dodecane", + "status": "passed", + "detail": { + "rho": 748.7, + "raw": "0.7487 at 68 °F (NTP, 1992) - Less dense than water; will fl" + } + }, + { + "id": "density_range_dodecane", + "status": "passed", + "detail": { + "rho": 748.7, + "T": 293.15 + } + }, + { + "id": "density_consistent_with_record_median_dodecane", + "status": "passed", + "detail": { + "rho": 748.7, + "median_of_record_numbers": 0.749, + "numbers": 3 + } + }, + { + "id": "liquid_at_298K_dodecane", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_cyclohexane", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_cyclohexane", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_cyclohexane", + "status": "passed", + "detail": [ + 156.0, + 156.9, + 155.96, + 154.32, + 157.06, + 155.85, + 156.5, + 155.96, + 156.4, + 156.0, + 156.149, + 156.12, + 156.4, + 156.35, + 156.7, + 156.12, + 156.07, + 156.07, + 156.2, + 159.6, + 155.2, + 155.5, + 152.93, + 155.31, + 156.31, + 176.1 + ] + }, + { + "id": "cp_median_rule_cyclohexane", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_cyclohexane", + "status": "passed", + "detail": 1855.0380228136883 + }, + { + "id": "cp_conflict_screen_cyclohexane", + "status": "passed", + "detail": { + "chosen": 156.12, + "median_10K": 156.0 + } + }, + { + "id": "dfh_entries_on_page_cyclohexane", + "status": "passed", + "detail": [ + -157.7, + -156.2, + -156.4 + ] + }, + { + "id": "dfh_median_rule_cyclohexane", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_cyclohexane", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_cyclohexane", + "status": "passed", + "detail": "0.7739 @25 °C" + }, + { + "id": "density_number_matches_text_cyclohexane", + "status": "passed", + "detail": { + "rho": 773.9, + "raw": "0.7739 @25 °C" + } + }, + { + "id": "density_range_cyclohexane", + "status": "passed", + "detail": { + "rho": 773.9, + "T": 298.15 + } + }, + { + "id": "density_consistent_with_record_median_cyclohexane", + "status": "passed", + "detail": { + "rho": 773.9, + "median_of_record_numbers": 0.78, + "numbers": 7 + } + }, + { + "id": "liquid_at_298K_cyclohexane", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_cyclohexene", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_cyclohexene", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_cyclohexene", + "status": "passed", + "detail": [ + 148.8, + 152.9, + 148.35, + 149.16 + ] + }, + { + "id": "cp_median_rule_cyclohexene", + "status": "passed", + "detail": null + }, + { + "id": "cp_range_cyclohexene", + "status": "passed", + "detail": 1813.7326515704895 + }, + { + "id": "cp_conflict_screen_cyclohexene", + "status": "passed", + "detail": { + "chosen": 148.98000000000002, + "median_10K": 148.8 + } + }, + { + "id": "dfh_entries_on_page_cyclohexene", + "status": "passed", + "detail": [ + -37.8, + -38.2, + -38.8, + -40.6 + ] + }, + { + "id": "dfh_median_rule_cyclohexene", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_bytes_cyclohexene", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_cyclohexene", + "status": "passed", + "detail": "0.8102 @25 °C" + }, + { + "id": "density_number_matches_text_cyclohexene", + "status": "passed", + "detail": { + "rho": 810.2, + "raw": "0.8102 @25 °C" + } + }, + { + "id": "density_range_cyclohexene", + "status": "passed", + "detail": { + "rho": 810.2, + "T": 298.15 + } + }, + { + "id": "density_consistent_with_record_median_cyclohexene", + "status": "passed", + "detail": { + "rho": 810.2, + "median_of_record_numbers": 0.81, + "numbers": 6 + } + }, + { + "id": "liquid_at_298K_cyclohexene", + "status": "passed", + "detail": null + }, + { + "id": "nist_bytes_limonene", + "status": "passed", + "detail": null + }, + { + "id": "cp_mass_basis_limonene", + "status": "passed", + "detail": null + }, + { + "id": "cp_entries_on_page_limonene", + "status": "passed", + "detail": [ + 249.4 + ] + }, + { + "id": "cp_range_limonene", + "status": "passed", + "detail": 1830.7274462306395 + }, + { + "id": "cp_conflict_screen_limonene", + "status": "passed", + "detail": { + "chosen": 249.4, + "median_10K": 249.4 + } + }, + { + "id": "pubchem_bytes_limonene", + "status": "passed", + "detail": null + }, + { + "id": "density_text_in_record_limonene", + "status": "passed", + "detail": "0.842 at 69.8 °F (USCG, 1999) - Less dense than water; will " + }, + { + "id": "density_number_matches_text_limonene", + "status": "passed", + "detail": { + "rho": 842.0, + "raw": "0.842 at 69.8 °F (USCG, 1999) - Less dense than water; will " + } + }, + { + "id": "density_range_limonene", + "status": "passed", + "detail": { + "rho": 842.0, + "T": 294.15 + } + }, + { + "id": "density_consistent_with_record_median_limonene", + "status": "passed", + "detail": { + "rho": 842.0, + "median_of_record_numbers": 0.842, + "numbers": 3 + } + }, + { + "id": "liquid_at_298K_limonene", + "status": "passed", + "detail": null + }, + { + "id": "reaction_enthalpy_recomputed_acetic_anhydride_hydrolysis", + "status": "passed", + "detail": { + "own": -57370.0, + "lib": -57370.0 + } + }, + { + "id": "reaction_species_in_library_acetic_anhydride_hydrolysis", + "status": "passed", + "detail": null + }, + { + "id": "reaction_enthalpy_recomputed_methanol_acetylation", + "status": "passed", + "detail": { + "own": -65490.0, + "lib": -65490.0 + } + }, + { + "id": "reaction_species_in_library_methanol_acetylation", + "status": "passed", + "detail": null + }, + { + "id": "reaction_enthalpy_recomputed_ethanol_acetylation", + "status": "passed", + "detail": { + "own": -63315.0, + "lib": -63315.0 + } + }, + { + "id": "reaction_species_in_library_ethanol_acetylation", + "status": "passed", + "detail": null + }, + { + "id": "reaction_enthalpy_recomputed_butanol_acetylation", + "status": "passed", + "detail": { + "own": -140700.0, + "lib": -140700.0 + } + }, + { + "id": "reaction_species_in_library_butanol_acetylation", + "status": "passed", + "detail": null + }, + { + "id": "reaction_enthalpy_recomputed_methyl_acetate_esterification", + "status": "passed", + "detail": { + "own": -8120.0, + "lib": -8120.0 + } + }, + { + "id": "reaction_species_in_library_methyl_acetate_esterification", + "status": "passed", + "detail": null + }, + { + "id": "reaction_enthalpy_recomputed_ethyl_acetate_esterification", + "status": "passed", + "detail": { + "own": -5945.0, + "lib": -5945.0 + } + }, + { + "id": "reaction_species_in_library_ethyl_acetate_esterification", + "status": "passed", + "detail": null + }, + { + "id": "family_screen_acetic_anhydride_hydrolysis", + "status": "passed", + "detail": { + "dh": -57370.0, + "median": -57370.0 + } + }, + { + "id": "family_screen_methanol_acetylation", + "status": "passed", + "detail": { + "dh": -65490.0, + "median": -65490.0 + } + }, + { + "id": "family_screen_ethanol_acetylation", + "status": "passed", + "detail": { + "dh": -63315.0, + "median": -65490.0 + } + }, + { + "id": "family_screen_butanol_acetylation", + "status": "passed", + "detail": { + "dh": -140700.0, + "median": -65490.0 + } + }, + { + "id": "family_screen_methyl_acetate_esterification", + "status": "passed", + "detail": { + "dh": -8120.0, + "median": -7032.5 + } + }, + { + "id": "family_screen_ethyl_acetate_esterification", + "status": "passed", + "detail": { + "dh": -5945.0, + "median": -7032.5 + } + }, + { + "id": "acetic_anhydride_hydrolysis_exothermic_order", + "status": "passed", + "detail": -57370.0 + } + ], + "failed": [], + "method": "independent text scan of the cached NIST (Mask=2) pages and PubChem Density records; recomputation of mass-basis heat capacities, medians, Shomate values and reaction enthalpies; homologous-series screen reproduced" +} diff --git a/outputs/expansion_batch04/t1_thermal/mt_rc1mxhfcal/thermal_calibration.json b/outputs/expansion_batch04/t1_thermal/mt_rc1mxhfcal/thermal_calibration.json new file mode 100644 index 0000000000000000000000000000000000000000..983c2bf8cb667ad412684745e57d50d58a37667d --- /dev/null +++ b/outputs/expansion_batch04/t1_thermal/mt_rc1mxhfcal/thermal_calibration.json @@ -0,0 +1,213 @@ +{ + "catalog_id": "CHEM-149", + "asset_type_id": "instrument.mt_rc1mxhfcal", + "fitted_at": "2026-09-25T14:06:15.065137+00:00", + "source": { + "digitised": "outputs/expansion_batch04/t1_thermal/mt_rc1mxhfcal/source_cache/rc1e_curves_digitized.json", + "digitised_sha256": "a304be87363253febbb6ab66f9555e95fd46053115a98886ccfc9e3a745677cd", + "document": "RC1e High Performance Thermostat operating instructions 9.6 (curves 1-4)" + }, + "documented_inputs": { + "heater_w": 2000.0, + "stationary_cooling_w": 100.0, + "coolant": "water approx. 16 C, approx. 10 L/min", + "stirrer": "glass anchor, 200 rpm", + "tr_controller": "P 9, P-only (RC1e software presets the reset time to 999999 s)", + "tdiff_max_k": 50.0 + }, + "fixed_engineering": { + "ambient_k": 295.15, + "coolant_k": 289.15, + "coolant_flow_m3_s": 0.00016666666666666666, + "phi_wall_w_m2k": 239.4957983193277, + "kp_tj_w_k": 1000.0, + "ti_tj_s": 60.0, + "l_cold_w_k": 3.0, + "ua_empty_w_k": 1.0, + "glycerol_viscosity_pa_s_for_stirrer_power": 1.4, + "c_ins_j_k": 150.0, + "trouton_j_mol_k": 88.0 + }, + "switch_times_s": { + "curve1_empty_Tj_mode": { + "setpoint_up": 247.34104929811565, + "setpoint_down_or_emergency": 1803.763799892292 + }, + "curve2_1L_water_Tr_mode": { + "setpoint_up": 303.9352502954275, + "setpoint_down_or_emergency": 1679.600074502595 + }, + "curve3_2L_water_Tr_mode": { + "setpoint_up": 303.92054350056833, + "setpoint_down_or_emergency": 1770.9332896409342 + }, + "curve4_1L_glycerol_Tr_mode_emergency_A": { + "setpoint_up": 228.36096039368067, + "setpoint_down_or_emergency": 3122.5245783126466 + } + }, + "fitted": { + "C_J": 9041.874300591024, + "L_J": 6.7099936470968515, + "G_VALVE": 57.1017655334523, + "G_SAFETY": 55.897521747119924, + "C_C": 31966.789471394164, + "UA_COIL": 289.93684619975585, + "P_COLD": 494.44818543289637, + "L_R": 0.005165576774617651, + "K_EV": 6.787810436983388e-06, + "U_W200": 181.31071468466538, + "U_GLY": 166.91544060181752 + }, + "derived": { + "h_ref_water_200rpm_w_m2k": 746.2935798099212, + "ua_1l_water_w_k": 7.644651508488009, + "ua_2l_water_w_k": 13.688341997976853, + "ua_1l_glycerol_w_k": 7.037699768631188, + "wetted_area_1l_m2": 0.04216326388533378, + "wetted_area_2l_m2": 0.0754965972186671, + "coolant_conductance_w_k": 237.17088334134425 + }, + "optimizer": { + "method": "scipy.optimize.least_squares (trf, log-parameters)", + "status": 3, + "nfev": 17, + "cost": 21.279577517951356 + }, + "residuals": { + "curve1_empty_Tj_mode": { + "Tj": { + "rmse_k": 1.3685188670811057, + "max_abs_k": 9.034401696985583, + "samples": 236 + }, + "Tc": { + "rmse_k": 1.315883339302206, + "max_abs_k": 5.394606689113402, + "samples": 240 + } + }, + "curve2_1L_water_Tr_mode": { + "Tj": { + "rmse_k": 2.343716793338593, + "max_abs_k": 16.442772339834505, + "samples": 297 + }, + "Tr": { + "rmse_k": 1.525721450893809, + "max_abs_k": 4.375378325358099, + "samples": 293 + }, + "Tc": { + "rmse_k": 1.7309738168401383, + "max_abs_k": 3.9576460621627234, + "samples": 279 + } + }, + "curve3_2L_water_Tr_mode": { + "Tj": { + "rmse_k": 4.202860151557892, + "max_abs_k": 25.254772971253885, + "samples": 389 + }, + "Tr": { + "rmse_k": 2.4323095647355304, + "max_abs_k": 4.029789042212428, + "samples": 392 + }, + "Tc": { + "rmse_k": 1.37081467259648, + "max_abs_k": 4.399073530940598, + "samples": 415 + } + }, + "curve4_1L_glycerol_Tr_mode_emergency_A": { + "Tj": { + "rmse_k": 2.0647076842739014, + "max_abs_k": 11.314607273654246, + "samples": 425 + }, + "Tr": { + "rmse_k": 1.6655092865916512, + "max_abs_k": 4.382584347553177, + "samples": 396 + }, + "Tc": { + "rmse_k": 1.5448449369561523, + "max_abs_k": 7.53264744696628, + "samples": 427 + } + } + }, + "rate_check": { + "curve1_empty_Tj_mode_heating": { + "trace": "Tj", + "from_c": 60.0, + "to_c": 180.0, + "manufacturer_s": 948.0368792588029, + "model_s": 924.0, + "model_over_manufacturer": 0.9746456284721798 + }, + "curve1_empty_Tj_mode_cooling": { + "trace": "Tj", + "from_c": 180.0, + "to_c": 60.0, + "manufacturer_s": 216.4808621929551, + "model_s": 234.0, + "model_over_manufacturer": 1.0809269587601218 + }, + "curve2_1L_water_Tr_mode_heating": { + "trace": "Tr", + "from_c": 40.0, + "to_c": 90.0, + "manufacturer_s": 559.1747968911573, + "model_s": 604.0, + "model_over_manufacturer": 1.0801631320976148 + }, + "curve2_1L_water_Tr_mode_cooling": { + "trace": "Tr", + "from_c": 90.0, + "to_c": 40.0, + "manufacturer_s": 816.3952034610902, + "model_s": 882.0, + "model_over_manufacturer": 1.0803591156106498 + }, + "curve3_2L_water_Tr_mode_heating": { + "trace": "Tr", + "from_c": 40.0, + "to_c": 90.0, + "manufacturer_s": 726.0286421380833, + "model_s": 706.0, + "model_over_manufacturer": 0.972413426997727 + }, + "curve3_2L_water_Tr_mode_cooling": { + "trace": "Tr", + "from_c": 90.0, + "to_c": 40.0, + "manufacturer_s": 1195.1548416734604, + "model_s": 1042.0, + "model_over_manufacturer": 0.8718535571014276 + }, + "curve4_1L_glycerol_Tr_mode_emergency_A_heating": { + "trace": "Tr", + "from_c": 40.0, + "to_c": 180.0, + "manufacturer_s": 1573.8879468579944, + "model_s": 1612.0, + "model_over_manufacturer": 1.0242152265147528 + }, + "curve4_1L_glycerol_Tr_mode_emergency_A_cooling": { + "trace": "Tr", + "from_c": 180.0, + "to_c": 60.0, + "manufacturer_s": 768.2960119733343, + "model_s": 734.0, + "model_over_manufacturer": 0.9553609397434636 + } + }, + "limitations_zh": [ + "拟合对象是前代RC1e与AP01-2的厂家“典型曲线”(仅作示意),RC1mx厂家未给同类曲线;拟合常数是集总工程值,不是部件实测。", + "室温22°C、Tj PI增益、壁+油膜导热phi与冷回路室温得热为固定工程值;曲线的设定值切换时刻由数字化曲线读出。", + "甘油曲线的U_GLY只用于该曲线(黏度随温度大幅变化,本模型的液膜系数不含温度依赖)。" + ] +} diff --git a/outputs/expansion_batch04/t1_thermal/netzsch_mmc315/interface_definition.py b/outputs/expansion_batch04/t1_thermal/netzsch_mmc315/interface_definition.py new file mode 100644 index 0000000000000000000000000000000000000000..56b4f5e9dc91b6321493d882f9823f30d6163ebe --- /dev/null +++ b/outputs/expansion_batch04/t1_thermal/netzsch_mmc315/interface_definition.py @@ -0,0 +1,92 @@ +"""CHEM-148 NETZSCH MMC 315 Nexus + ARC module: single source of the interface numbers shared by geometry, runtime tests, +Matterix metadata and the scene (SI, +Z up, +Y back, origin at the footprint centre, floor Z=0). + +No manufacturer body dimensions or masses are public (workbook: "未取得本体外形或质量"): every dimension below is an +engineering value read from the proportions of the two manufacturer photographs (2026 overview p.24 MMC 315 Nexus; MMC 274 +Nexus brochure p.2), except the sample container: its 10.028 g mass is the titanium sphere of the manufacturer's DTBP example and its inner +volume is assumed at the documented 8.5 ml maximum (the example gives no volume).""" +import math + +SLUG = 'netzsch_mmc315' +FOOT_H = 0.022 +# ---- base unit (white): left curved electronics housing + right module bay plinth + rear docking tower +HOUSING_X = (-0.310, -0.040) +BODY_Y = (-0.280, 0.300) +HOUSING_FRONT_H = 0.240 # vertical front face height before the curved top +HOUSING_TOP_Z = 0.480 +HOUSING_ARC_R = 0.240 +PLINTH_X = (-0.040, 0.310) +PLINTH_TOP_Z = 0.110 +DOCK_Y = (0.200, 0.300) +DOCK_TOP_Z = 0.300 +# ---- pull-out slide tray carrying the module +TRAY_X = (0.000, 0.280) +TRAY_Y = (-0.250, 0.170) +TRAY_Z = (0.122, 0.132) # plate; telescopic rails below it 0.110-0.122 +TRAY_TRAVEL_M = 0.250 # prismatic -Y (towards the operator) +HANDLE_Y = -0.268 +# ---- ARC module (child of the tray) in tray-plate coordinates (origin = tray plate top centre) +TRAY_TOP_CENTER = ((TRAY_X[0] + TRAY_X[1]) / 2, (TRAY_Y[0] + TRAY_Y[1]) / 2 - 0.010, TRAY_Z[1]) +MODULE_R = 0.110 +MODULE_BODY_Z = (0.050, 0.350) # above the tray plate +RING_Z = 0.300 +LID_H = 0.050 +LID_HINGE = (0.0, MODULE_R - 0.004, MODULE_BODY_Z[1]) # rear top edge, axis -X (front edge lifts) +LID_OPEN_RAD = 1.90 +CAVITY_R = 0.050 +CAVITY_DEPTH = 0.120 +# ---- sample container: titanium sphere, 10.028 g documented, 8.5 ml assumed (documented maximum); outer radius derived (Ti 4.51 g/cm3) +CONTAINER_VOLUME_M3 = 8.5e-6 +CONTAINER_MASS_KG = 10.028e-3 +TI_DENSITY = 4510.0 +R_INNER = (3 * CONTAINER_VOLUME_M3 / (4 * math.pi)) ** (1 / 3) +R_OUTER = (R_INNER ** 3 + 3 * CONTAINER_MASS_KG / TI_DENSITY / (4 * math.pi)) ** (1 / 3) +BOMB_CENTER_Z = MODULE_BODY_Z[1] - 0.060 # sphere centre below the lid plane, in module coordinates +# ---- controls and readouts (status panel on the housing front) +STATUS_PANEL = dict(center_x=-0.175, z=(0.080, 0.230), width=0.120) +POWER_SWITCH = (-0.250, 0.300, 0.090) # rear panel rocker (x, y, z) +POWER_SWITCH_ON_RAD = 0.30 +READOUT_NOTE_ZH = ('MMC 315 Nexus主机正面只有状态指示区,测量由Proteus软件完成;状态面板上的两行七段读数(样品温度°C、压力bar)是本资产的仿真叠加显示,' + '不是原厂界面;两个状态灯=通电、测试进行中(工程灯语)。') +LED_BG = (0.012, 0.02, 0.03) +READOUTS = [dict(name='sample_temperature_sim', part='temperature_digits', face='-Y', digits=5, decimals=1, unit='C', on=(0.98, 0.55, 0.12), off=LED_BG, + blank_channel=None, source={'bridge': ['sample.indicated_k'], 'offset': -273.15}), + dict(name='pressure_sim', part='pressure_digits', face='-Y', digits=5, decimals=2, unit='bar', on=(0.98, 0.55, 0.12), off=LED_BG, + blank_channel=None, source={'bridge': ['pressure.indicated_pa'], 'scale': 1e-5})] +LAMPS = [dict(name='power_status', part='lamp_power', face='-Y', digits=0, decimals=0, unit='1', on=(0.20, 0.95, 0.25), off=(0.02, 0.05, 0.03), + source={'lamp': {'bridge': 'power.enabled'}}), + dict(name='run_status', part='lamp_run', face='-Y', digits=0, decimals=0, unit='1', on=(0.25, 0.55, 1.00), off=(0.02, 0.03, 0.06), + source={'lamp': {'bridge': 'test.running'}})] +# (part, state_id, capability, blender attribute, unit, upper) : process-authoritative mirrors +MOTION = [('tray', 'tray.position_m', 'tray.move', 'location', 'm', TRAY_TRAVEL_M), + ('lid', 'lid.angle_rad', 'lid.set', 'rotation', 'rad', LID_OPEN_RAD), + ('power_switch', 'power.angle_rad', 'power.set', 'rotation', 'rad', POWER_SWITCH_ON_RAD)] +PASSIVE_JOINTS = [] +KEYS = [] +KEY_COMMANDS = {} +_MX, _MY, _MZ = TRAY_TOP_CENTER +PORTS = [('bomb_seat', 'sample_container', 'mechanical', 'bidirectional'), ('tray_handle', 'tray_handle', 'mechanical', 'bidirectional'), + ('lid_grip', 'lid', 'mechanical', 'bidirectional'), ('pressure_feedthrough', 'pressure_line', 'gas', 'out'), ('thermocouple_clip', 'sample_thermocouple', 'electrical', 'out'), + ('module_dock', 'dock_socket', 'electrical', 'bidirectional'), ('line_power', 'power_entry', 'electrical', 'in'), ('usb', 'usb_port', 'data', 'bidirectional'), + ('ethernet', 'ethernet_port', 'data', 'bidirectional'), ('cooling_air', 'cooling_fan', 'gas', 'out')] +PORT_MEANING = { + 'bomb_seat': '量热腔内样品容器位(顶盖打开后放入/取出装样钛球并接取压管与热电偶)', 'tray_handle': '托盘前把手(拉出/推回模块托盘)', + 'lid_grip': '模块顶盖前缘把手(开/合量热腔)', 'pressure_feedthrough': '取压管后侧穿舱接头(样品容器→压力传感器)', 'thermocouple_clip': '样品热电偶在钛球赤道的夹持点', + 'module_dock': '对接塔插座(加热器、热电偶、压力信号)', 'line_power': '电源输入(额定值厂家未公开)', 'usb': 'USB(连接Proteus电脑;接口类型为工程假设)', + 'ethernet': '以太网(工程假设)', 'cooling_air': '冷却风扇排风口(冷却阶段)'} +_NOTE = '接口位置由本资产照片比例几何推得(工程估计);捕获半径为工程几何,真实接头规格/pinout/机器人接触未验证。' +PORT_GEOMETRY = { + 'bomb_seat': dict(pos=[_MX, _MY, _MZ + BOMB_CENTER_Z + R_OUTER], insert_axis=[0, 0, 1], radius=R_OUTER, capture=0.02, access=['lid_joint']), + 'tray_handle': dict(pos=[_MX, HANDLE_Y - 0.006, TRAY_Z[1] + 0.018], insert_axis=[0, -1, 0], radius=0.006, capture=0.03, access=[]), + 'lid_grip': dict(pos=[_MX, _MY + LID_HINGE[1] - LID_HINGE[1] - MODULE_R + 0.020, _MZ + MODULE_BODY_Z[1] + LID_H + 0.018], insert_axis=[0, 0, 1], radius=0.012, capture=0.03, + access=[]), + 'pressure_feedthrough': dict(pos=[_MX, _MY + MODULE_R + 0.010, _MZ + MODULE_BODY_Z[1] - 0.006], insert_axis=[0, 1, 0], radius=0.004, capture=0.01, access=[]), + 'thermocouple_clip': dict(pos=[_MX + R_OUTER, _MY, _MZ + BOMB_CENTER_Z], insert_axis=[0, 0, 1], radius=0.0008, capture=0.005, access=['lid_joint']), + 'module_dock': dict(pos=[0.20, DOCK_Y[0] - 0.020, PLINTH_TOP_Z + 0.060], insert_axis=[0, -1, 0], radius=0.02, capture=0.02, access=[]), + 'line_power': dict(pos=[-0.270, BODY_Y[1] + 0.012, 0.090], insert_axis=[0, 1, 0], radius=0.012, capture=0.015, access=[]), + 'usb': dict(pos=[-0.150, BODY_Y[1] + 0.008, 0.090], insert_axis=[0, 1, 0], radius=0.006, capture=0.01, access=[]), + 'ethernet': dict(pos=[-0.110, BODY_Y[1] + 0.008, 0.090], insert_axis=[0, 1, 0], radius=0.007, capture=0.01, access=[]), + 'cooling_air': dict(pos=[-0.175, BODY_Y[1] + 0.012, 0.340], insert_axis=[0, 1, 0], radius=0.040, capture=0.04, access=[]), +} +for _v in PORT_GEOMETRY.values(): + _v.update(position_evidence='geometry_derived_simulation_assumption', capture_evidence='simulation_assumption', note=_NOTE) diff --git a/outputs/expansion_batch04/t1_thermal/netzsch_mmc315/template_validation.json b/outputs/expansion_batch04/t1_thermal/netzsch_mmc315/template_validation.json new file mode 100644 index 0000000000000000000000000000000000000000..b6ded380de6fbb13b11f8343b8e78875de7c5956 --- /dev/null +++ b/outputs/expansion_batch04/t1_thermal/netzsch_mmc315/template_validation.json @@ -0,0 +1,3201 @@ +{ + "catalog_id": "CHEM-148", + "status": "passed", + "checked_at": "2026-09-24T22:01:07.419189+00:00", + "library_sha256": "656294b299473c6192d21d94e2c61129e6299439aed71f856a0aac930e0e1783", + "distinct_substances": 51, + "max_half_life_deviation_K": 1.062, + "method": "re-extract each cited pdftotext line from the hashed cache and match printed A, Ea and half-life temperatures; verbatim DTBP ARC values; PubChem/NIST rows", + "checks": [ + { + "id": "sha256_SICA_en_web.pdf", + "status": "passed", + "detail": null + }, + { + "id": "sha256_MMC_274_Nexus_en_web.pdf", + "status": "passed", + "detail": null + }, + { + "id": "sha256_nouryon_brochure-initiators-for-thermoplastics-en_us.pdf", + "status": "passed", + "detail": null + }, + { + "id": "sha256_nouryon_brochure-initiators-for-acrylics-manufacturing-en_us.pdf", + "status": "passed", + "detail": null + }, + { + "id": "sha256_nouryon_brochure-crosslinking-peroxides-emeia-booklet-en_us.pdf", + "status": "passed", + "detail": null + }, + { + "id": "sha256_arkema_luperox_brochure.pdf", + "status": "passed", + "detail": null + }, + { + "id": "sha256_acc_safety_handling_organic_peroxides.pdf", + "status": "passed", + "detail": null + }, + { + "id": "sha256_nist_toluene_phase.html", + "status": "passed", + "detail": null + }, + { + "id": "sha256_pubchem_cas_verification.json", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_diisobutyryl_peroxide", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_diisobutyryl_peroxide", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_diisobutyryl_peroxide", + "status": "passed", + "detail": null + }, + { + "id": "line_values_diisobutyryl_peroxide_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf", + "line": 521, + "text": "Diisobutyryl peroxide [3437-84-1] 174.2 9.18 ", + "A": "3.37E+14", + "Ea": 109.06, + "temps_C": [ + 57, + 39, + 23 + ] + } + }, + { + "id": "name_block_diisobutyryl_peroxide_0", + "status": "passed", + "detail": { + "cas": "3437-84-1" + } + }, + { + "id": "half_life_consistency_diisobutyryl_peroxide_0", + "status": "passed", + "detail": 0.22 + }, + { + "id": "primary_kinetics_is_a_measurement_diisobutyryl_peroxide", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_diisobutyryl_peroxide", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_cumyl_peroxyneodecanoate", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_cumyl_peroxyneodecanoate", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_cumyl_peroxyneodecanoate", + "status": "passed", + "detail": null + }, + { + "id": "line_values_cumyl_peroxyneodecanoate_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf", + "line": 531, + "text": "Cumyl peroxyneodecanoate [26748-47-0] 306.4 5.22 ", + "A": "3.12E+14", + "Ea": 114.59, + "temps_C": [ + 75, + 56, + 38 + ] + } + }, + { + "id": "name_block_cumyl_peroxyneodecanoate_0", + "status": "passed", + "detail": { + "cas": "26748-47-0" + } + }, + { + "id": "half_life_consistency_cumyl_peroxyneodecanoate_0", + "status": "passed", + "detail": 0.453 + }, + { + "id": "primary_kinetics_is_a_measurement_cumyl_peroxyneodecanoate", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_cumyl_peroxyneodecanoate", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_1_1_3_3_tetramethylbutyl_peroxyneodecanoate", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_1_1_3_3_tetramethylbutyl_peroxyneodecanoate", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_1_1_3_3_tetramethylbutyl_peroxyneodecanoate", + "status": "passed", + "detail": null + }, + { + "id": "line_values_1_1_3_3_tetramethylbutyl_peroxyneodecanoate_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf", + "line": 540, + "text": "1,1,3,3-Tetramethylbutyl peroxyneodecanoate [51240-95-0] 300.5 5.32 ", + "A": "3.98E+14", + "Ea": 115.79, + "temps_C": [ + 76, + 57, + 40 + ] + } + }, + { + "id": "name_block_1_1_3_3_tetramethylbutyl_peroxyneodecanoate_0", + "status": "passed", + "detail": { + "cas": "51240-95-0" + } + }, + { + "id": "half_life_consistency_1_1_3_3_tetramethylbutyl_peroxyneodecanoate_0", + "status": "passed", + "detail": 0.453 + }, + { + "id": "primary_kinetics_is_a_measurement_1_1_3_3_tetramethylbutyl_peroxyneodecanoate", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_1_1_3_3_tetramethylbutyl_peroxyneodecanoate", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_tamyl_peroxyneodecanoate", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_tamyl_peroxyneodecanoate", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_tamyl_peroxyneodecanoate", + "status": "passed", + "detail": null + }, + { + "id": "line_values_tamyl_peroxyneodecanoate_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf", + "line": 549, + "text": "tert-Amyl peroxyneodecanoate [68299-16-1] 258.4 6.19 ", + "A": "1.47E+14", + "Ea": 114.38, + "temps_C": [ + 81, + 61, + 43 + ] + } + }, + { + "id": "name_block_tamyl_peroxyneodecanoate_0", + "status": "passed", + "detail": { + "cas": "68299-16-1" + } + }, + { + "id": "half_life_consistency_tamyl_peroxyneodecanoate_0", + "status": "passed", + "detail": 0.453 + }, + { + "id": "primary_kinetics_is_a_measurement_tamyl_peroxyneodecanoate", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_tamyl_peroxyneodecanoate", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_di_sec_butyl_peroxydicarbonate", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_di_sec_butyl_peroxydicarbonate", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_di_sec_butyl_peroxydicarbonate", + "status": "passed", + "detail": null + }, + { + "id": "line_values_di_sec_butyl_peroxydicarbonate_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf", + "line": 558, + "text": "Di-sec-butyl peroxydicarbonate [19910-65-7] 234.2 6.83 ", + "A": "3.19E+15", + "Ea": 123.85, + "temps_C": [ + 82, + 63, + 47 + ] + } + }, + { + "id": "name_block_di_sec_butyl_peroxydicarbonate_0", + "status": "passed", + "detail": { + "cas": "19910-65-7" + } + }, + { + "id": "half_life_consistency_di_sec_butyl_peroxydicarbonate_0", + "status": "passed", + "detail": 0.453 + }, + { + "id": "primary_kinetics_is_a_measurement_di_sec_butyl_peroxydicarbonate", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_di_sec_butyl_peroxydicarbonate", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_diisopropyl_peroxydicarbonate", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_diisopropyl_peroxydicarbonate", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_diisopropyl_peroxydicarbonate", + "status": "passed", + "detail": null + }, + { + "id": "line_values_diisopropyl_peroxydicarbonate_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-acrylics-manufacturing-en_us.pdf", + "line": 442, + "text": "Diisopropyl peroxydicarbonate [105-64-6] 206.2 7.76 ", + "A": "3.35E+15", + "Ea": 124.01, + "temps_C": [ + 82, + 64, + 47 + ] + } + }, + { + "id": "name_block_diisopropyl_peroxydicarbonate_0", + "status": "passed", + "detail": { + "cas": "105-64-6" + } + }, + { + "id": "half_life_consistency_diisopropyl_peroxydicarbonate_0", + "status": "passed", + "detail": 0.491 + }, + { + "id": "primary_kinetics_is_a_measurement_diisopropyl_peroxydicarbonate", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_diisopropyl_peroxydicarbonate", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_tbutyl_peroxyneodecanoate", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_tbutyl_peroxyneodecanoate", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_tbutyl_peroxyneodecanoate", + "status": "passed", + "detail": null + }, + { + "id": "line_values_tbutyl_peroxyneodecanoate_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf", + "line": 601, + "text": "tert-Butyl peroxyneodecanoate [26748-41-4] 244.4 6.55 ", + "A": "1.52E+14", + "Ea": 115.47, + "temps_C": [ + 84, + 64, + 46 + ] + } + }, + { + "id": "name_block_tbutyl_peroxyneodecanoate_0", + "status": "passed", + "detail": { + "cas": "26748-41-4" + } + }, + { + "id": "half_life_consistency_tbutyl_peroxyneodecanoate_0", + "status": "passed", + "detail": 0.491 + }, + { + "id": "primary_kinetics_is_a_measurement_tbutyl_peroxyneodecanoate", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_tbutyl_peroxyneodecanoate", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_di_2_ethylhexyl_peroxydicarbonate", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_di_2_ethylhexyl_peroxydicarbonate", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_di_2_ethylhexyl_peroxydicarbonate", + "status": "passed", + "detail": null + }, + { + "id": "line_values_di_2_ethylhexyl_peroxydicarbonate_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf", + "line": 591, + "text": "Di(2-ethylhexyl) peroxydicarbonate [16111-62-9] 346.5 4.62 ", + "A": "1.83E+15", + "Ea": 122.45, + "temps_C": [ + 83, + 64, + 47 + ] + } + }, + { + "id": "name_block_di_2_ethylhexyl_peroxydicarbonate_0", + "status": "passed", + "detail": { + "cas": "16111-62-9" + } + }, + { + "id": "half_life_consistency_di_2_ethylhexyl_peroxydicarbonate_0", + "status": "passed", + "detail": 0.491 + }, + { + "id": "line_values_di_2_ethylhexyl_peroxydicarbonate_1", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-acrylics-manufacturing-en_us.pdf", + "line": 449, + "text": "Di(2-ethylhexyl) peroxydicarbonate [16111-62-9]] 346.5 4.62 ", + "A": "1.52E+14", + "Ea": 115.47, + "temps_C": [ + 84, + 64, + 46 + ] + } + }, + { + "id": "name_block_di_2_ethylhexyl_peroxydicarbonate_1", + "status": "passed", + "detail": { + "cas": "16111-62-9" + } + }, + { + "id": "half_life_consistency_di_2_ethylhexyl_peroxydicarbonate_1", + "status": "passed", + "detail": 0.491 + }, + { + "id": "primary_kinetics_is_a_measurement_di_2_ethylhexyl_peroxydicarbonate", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_di_2_ethylhexyl_peroxydicarbonate", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_di_4_tbutylcyclohexyl_peroxydicarbonate", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_di_4_tbutylcyclohexyl_peroxydicarbonate", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_di_4_tbutylcyclohexyl_peroxydicarbonate", + "status": "passed", + "detail": null + }, + { + "id": "line_values_di_4_tbutylcyclohexyl_peroxydicarbonate_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf", + "line": 567, + "text": "Di(4-tert-butylcyclohexyl) peroxydicarbonate [15520-11-3] 398.5 4.01 ", + "A": "7.44E+15", + "Ea": 126.39, + "temps_C": [ + 82, + 64, + 48 + ] + } + }, + { + "id": "name_block_di_4_tbutylcyclohexyl_peroxydicarbonate_0", + "status": "passed", + "detail": { + "cas": "15520-11-3" + } + }, + { + "id": "half_life_consistency_di_4_tbutylcyclohexyl_peroxydicarbonate_0", + "status": "passed", + "detail": 0.491 + }, + { + "id": "primary_kinetics_is_a_measurement_di_4_tbutylcyclohexyl_peroxydicarbonate", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_di_4_tbutylcyclohexyl_peroxydicarbonate", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_dimyristyl_peroxydicarbonate", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_dimyristyl_peroxydicarbonate", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_dimyristyl_peroxydicarbonate", + "status": "passed", + "detail": null + }, + { + "id": "line_values_dimyristyl_peroxydicarbonate_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf", + "line": 619, + "text": "Dimyristyl peroxydicarbonate [53220-22-7] 514.8 3.11 ", + "A": "2.82E+15", + "Ea": 124.1, + "temps_C": [ + 84, + 65, + 48 + ] + } + }, + { + "id": "name_block_dimyristyl_peroxydicarbonate_0", + "status": "passed", + "detail": { + "cas": "53220-22-7" + } + }, + { + "id": "half_life_consistency_dimyristyl_peroxydicarbonate_0", + "status": "passed", + "detail": 0.491 + }, + { + "id": "primary_kinetics_is_a_measurement_dimyristyl_peroxydicarbonate", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_dimyristyl_peroxydicarbonate", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_dicetyl_peroxydicarbonate", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_dicetyl_peroxydicarbonate", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_dicetyl_peroxydicarbonate", + "status": "passed", + "detail": null + }, + { + "id": "line_values_dicetyl_peroxydicarbonate_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf", + "line": 609, + "text": "Dicetyl peroxydicarbonate [26322-14-5] 570.9 2.80 ", + "A": "3.02E+15", + "Ea": 124.3, + "temps_C": [ + 84, + 65, + 48 + ] + } + }, + { + "id": "name_block_dicetyl_peroxydicarbonate_0", + "status": "passed", + "detail": { + "cas": "26322-14-5" + } + }, + { + "id": "half_life_consistency_dicetyl_peroxydicarbonate_0", + "status": "passed", + "detail": 0.491 + }, + { + "id": "primary_kinetics_is_a_measurement_dicetyl_peroxydicarbonate", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_dicetyl_peroxydicarbonate", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_1_1_3_3_tetramethylbutyl_peroxypivalate", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_1_1_3_3_tetramethylbutyl_peroxypivalate", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_1_1_3_3_tetramethylbutyl_peroxypivalate", + "status": "passed", + "detail": null + }, + { + "id": "line_values_1_1_3_3_tetramethylbutyl_peroxypivalate_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf", + "line": 629, + "text": "1,1,3,3-Tetramethylbutyl peroxypivalate [22288-41-1] 230.3 6.95 ", + "A": "2.47E+14", + "Ea": 117.5, + "temps_C": [ + 86, + 66, + 48 + ] + } + }, + { + "id": "name_block_1_1_3_3_tetramethylbutyl_peroxypivalate_0", + "status": "passed", + "detail": { + "cas": "22288-41-1" + } + }, + { + "id": "half_life_consistency_1_1_3_3_tetramethylbutyl_peroxypivalate_0", + "status": "passed", + "detail": 0.491 + }, + { + "id": "primary_kinetics_is_a_measurement_1_1_3_3_tetramethylbutyl_peroxypivalate", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_1_1_3_3_tetramethylbutyl_peroxypivalate", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_di_2_4_dichlorobenzoyl_peroxide", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_di_2_4_dichlorobenzoyl_peroxide", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_di_2_4_dichlorobenzoyl_peroxide", + "status": "passed", + "detail": null + }, + { + "id": "line_values_di_2_4_dichlorobenzoyl_peroxide_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-crosslinking-peroxides-emeia-booklet-en_us.pdf", + "line": 831, + "text": "PERKADOX PD Di(2,4-dichlorobenzoyl) peroxide VMQ 89 68 49 112.4 3.21E+13", + "A": "3.21E+13", + "Ea": 112.4, + "temps_C": [ + 89, + 68, + 49 + ] + } + }, + { + "id": "name_block_di_2_4_dichlorobenzoyl_peroxide_0", + "status": "passed", + "detail": { + "cas": "133-14-2" + } + }, + { + "id": "half_life_consistency_di_2_4_dichlorobenzoyl_peroxide_0", + "status": "passed", + "detail": 0.491 + }, + { + "id": "primary_kinetics_is_a_measurement_di_2_4_dichlorobenzoyl_peroxide", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_di_2_4_dichlorobenzoyl_peroxide", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_tamyl_peroxypivalate", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_tamyl_peroxypivalate", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_tamyl_peroxypivalate", + "status": "passed", + "detail": null + }, + { + "id": "line_values_tamyl_peroxypivalate_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf", + "line": 638, + "text": "tert-Amyl peroxypivalate [29240-17-3] 188.3 8.50 ", + "A": "4.12E+15", + "Ea": 127.76, + "temps_C": [ + 91, + 72, + 55 + ] + } + }, + { + "id": "name_block_tamyl_peroxypivalate_0", + "status": "passed", + "detail": { + "cas": "29240-17-3" + } + }, + { + "id": "half_life_consistency_tamyl_peroxypivalate_0", + "status": "passed", + "detail": 0.491 + }, + { + "id": "primary_kinetics_is_a_measurement_tamyl_peroxypivalate", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_tamyl_peroxypivalate", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_tbutyl_peroxypivalate", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_tbutyl_peroxypivalate", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_tbutyl_peroxypivalate", + "status": "passed", + "detail": null + }, + { + "id": "line_values_tbutyl_peroxypivalate_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf", + "line": 662, + "text": "tert-Butyl peroxypivalate [927-07-1] 174.2 9.18 ", + "A": "7.09E+14", + "Ea": 123.59, + "temps_C": [ + 94, + 75, + 57 + ] + } + }, + { + "id": "name_block_tbutyl_peroxypivalate_0", + "status": "passed", + "detail": { + "cas": "927-07-1" + } + }, + { + "id": "half_life_consistency_tbutyl_peroxypivalate_0", + "status": "passed", + "detail": 0.491 + }, + { + "id": "primary_kinetics_is_a_measurement_tbutyl_peroxypivalate", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_tbutyl_peroxypivalate", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_di_3_5_5_trimethylhexanoyl_peroxide", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_di_3_5_5_trimethylhexanoyl_peroxide", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_di_3_5_5_trimethylhexanoyl_peroxide", + "status": "passed", + "detail": null + }, + { + "id": "line_values_di_3_5_5_trimethylhexanoyl_peroxide_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf", + "line": 672, + "text": "Di(3,5,5-trimethylhexanoyl) peroxide [3851-87-4] 314.5 5.09 ", + "A": "2.84E+15", + "Ea": 128.34, + "temps_C": [ + 96, + 77, + 59 + ] + } + }, + { + "id": "name_block_di_3_5_5_trimethylhexanoyl_peroxide_0", + "status": "passed", + "detail": { + "cas": "3851-87-4" + } + }, + { + "id": "half_life_consistency_di_3_5_5_trimethylhexanoyl_peroxide_0", + "status": "passed", + "detail": 0.491 + }, + { + "id": "primary_kinetics_is_a_measurement_di_3_5_5_trimethylhexanoyl_peroxide", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_di_3_5_5_trimethylhexanoyl_peroxide", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_dilauroyl_peroxide", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_dilauroyl_peroxide", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_dilauroyl_peroxide", + "status": "passed", + "detail": null + }, + { + "id": "line_values_dilauroyl_peroxide_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf", + "line": 684, + "text": "Dilauroyl peroxide [105-74-8] 398.6 4.01 ", + "A": "3.92E+14", + "Ea": 123.37, + "temps_C": [ + 99, + 79, + 61 + ] + } + }, + { + "id": "name_block_dilauroyl_peroxide_0", + "status": "passed", + "detail": { + "cas": "105-74-8" + } + }, + { + "id": "half_life_consistency_dilauroyl_peroxide_0", + "status": "passed", + "detail": 0.491 + }, + { + "id": "primary_kinetics_is_a_measurement_dilauroyl_peroxide", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_dilauroyl_peroxide", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_2_2_azodi_isobutyronitrile", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_2_2_azodi_isobutyronitrile", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_2_2_azodi_isobutyronitrile", + "status": "passed", + "detail": null + }, + { + "id": "line_values_2_2_azodi_isobutyronitrile_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf", + "line": 693, + "text": "2,2’-Azodi(isobutyronitrile) [78-67-1] 164.2 ", + "A": "2.89E+15", + "Ea": 130.23, + "temps_C": [ + 101, + 82, + 64 + ] + } + }, + { + "id": "name_block_2_2_azodi_isobutyronitrile_0", + "status": "passed", + "detail": { + "cas": "78-67-1" + } + }, + { + "id": "half_life_consistency_2_2_azodi_isobutyronitrile_0", + "status": "passed", + "detail": 0.491 + }, + { + "id": "primary_kinetics_is_a_measurement_2_2_azodi_isobutyronitrile", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_2_2_azodi_isobutyronitrile", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_di_4_methylbenzoyl_peroxide", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_di_4_methylbenzoyl_peroxide", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_di_4_methylbenzoyl_peroxide", + "status": "passed", + "detail": null + }, + { + "id": "line_values_di_4_methylbenzoyl_peroxide_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-crosslinking-peroxides-emeia-booklet-en_us.pdf", + "line": 829, + "text": "PERKADOX PM Di(4-methylbenzoyl) peroxide VMQ 106 84 64 115.6 1.69E+13", + "A": "1.69E+13", + "Ea": 115.6, + "temps_C": [ + 106, + 84, + 64 + ] + } + }, + { + "id": "name_block_di_4_methylbenzoyl_peroxide_0", + "status": "passed", + "detail": { + "cas": "895-85-2" + } + }, + { + "id": "half_life_consistency_di_4_methylbenzoyl_peroxide_0", + "status": "passed", + "detail": 0.774 + }, + { + "id": "primary_kinetics_is_a_measurement_di_4_methylbenzoyl_peroxide", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_di_4_methylbenzoyl_peroxide", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_2_2_azodi_2_methylbutyronitrile", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_2_2_azodi_2_methylbutyronitrile", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_2_2_azodi_2_methylbutyronitrile", + "status": "passed", + "detail": null + }, + { + "id": "line_values_2_2_azodi_2_methylbutyronitrile_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf", + "line": 702, + "text": "2,2’-Azodi(2-methylbutyronitrile) [13472-08-7] 192.3 ", + "A": "1.38E+15", + "Ea": 128.93, + "temps_C": [ + 104, + 84, + 66 + ] + } + }, + { + "id": "name_block_2_2_azodi_2_methylbutyronitrile_0", + "status": "passed", + "detail": { + "cas": "13472-08-7" + } + }, + { + "id": "half_life_consistency_2_2_azodi_2_methylbutyronitrile_0", + "status": "passed", + "detail": 0.774 + }, + { + "id": "primary_kinetics_is_a_measurement_2_2_azodi_2_methylbutyronitrile", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_2_2_azodi_2_methylbutyronitrile", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_2_5_dimethyl_2_5_di_2_ethylhexanoylperoxy_hexane", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_2_5_dimethyl_2_5_di_2_ethylhexanoylperoxy_hexane", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_2_5_dimethyl_2_5_di_2_ethylhexanoylperoxy_hexane", + "status": "passed", + "detail": null + }, + { + "id": "line_values_2_5_dimethyl_2_5_di_2_ethylhexanoylperoxy_hexane_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf", + "line": 711, + "text": "2,5-Dimethyl-2,5-di(2-ethylhexanoylperoxy)hexane [13052-09-0] 430.6 7.43 ", + "A": "2.19E+15", + "Ea": 130.88, + "temps_C": [ + 105, + 86, + 68 + ] + } + }, + { + "id": "name_block_2_5_dimethyl_2_5_di_2_ethylhexanoylperoxy_hexane_0", + "status": "passed", + "detail": { + "cas": "13052-09-0" + } + }, + { + "id": "half_life_consistency_2_5_dimethyl_2_5_di_2_ethylhexanoylperoxy_hexane_0", + "status": "passed", + "detail": 0.774 + }, + { + "id": "primary_kinetics_is_a_measurement_2_5_dimethyl_2_5_di_2_ethylhexanoylperoxy_hexane", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_2_5_dimethyl_2_5_di_2_ethylhexanoylperoxy_hexane", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_1_1_3_3_tetramethylbutyl_peroxy_2_ethylhexanoate", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_1_1_3_3_tetramethylbutyl_peroxy_2_ethylhexanoate", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_1_1_3_3_tetramethylbutyl_peroxy_2_ethylhexanoate", + "status": "passed", + "detail": null + }, + { + "id": "line_values_1_1_3_3_tetramethylbutyl_peroxy_2_ethylhexanoate_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf", + "line": 742, + "text": "1,1,3,3-Tetramethylbutyl peroxy-2-ethylhexanoate [22288-43-3] 272.4 5.87 109 88 ", + "A": "1.62E+14", + "Ea": 123.8, + "temps_C": [ + 109, + 88, + 69 + ] + } + }, + { + "id": "name_block_1_1_3_3_tetramethylbutyl_peroxy_2_ethylhexanoate_0", + "status": "passed", + "detail": { + "cas": "22288-43-3" + } + }, + { + "id": "half_life_consistency_1_1_3_3_tetramethylbutyl_peroxy_2_ethylhexanoate_0", + "status": "passed", + "detail": 0.774 + }, + { + "id": "primary_kinetics_is_a_measurement_1_1_3_3_tetramethylbutyl_peroxy_2_ethylhexanoate", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_1_1_3_3_tetramethylbutyl_peroxy_2_ethylhexanoate", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_tamyl_peroxy_2_ethylhexanoate", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_tamyl_peroxy_2_ethylhexanoate", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_tamyl_peroxy_2_ethylhexanoate", + "status": "passed", + "detail": null + }, + { + "id": "line_values_tamyl_peroxy_2_ethylhexanoate_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf", + "line": 752, + "text": "tert-Amyl peroxy-2-ethylhexanoate [686-31-7] 230.3 6.95 111 91 ", + "A": "1.77E+15", + "Ea": 132.11, + "temps_C": [ + 111, + 91, + 73 + ] + } + }, + { + "id": "name_block_tamyl_peroxy_2_ethylhexanoate_0", + "status": "passed", + "detail": { + "cas": "686-31-7" + } + }, + { + "id": "half_life_consistency_tamyl_peroxy_2_ethylhexanoate_0", + "status": "passed", + "detail": 0.774 + }, + { + "id": "primary_kinetics_is_a_measurement_tamyl_peroxy_2_ethylhexanoate", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_tamyl_peroxy_2_ethylhexanoate", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_dibenzoyl_peroxide", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_dibenzoyl_peroxide", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_dibenzoyl_peroxide", + "status": "passed", + "detail": null + }, + { + "id": "line_values_dibenzoyl_peroxide_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf", + "line": 762, + "text": "Dibenzoyl peroxide [94-36-0] 242.2 6.61 113 91 ", + "A": "6.94E+13", + "Ea": 122.35, + "temps_C": [ + 113, + 91, + 71 + ] + } + }, + { + "id": "name_block_dibenzoyl_peroxide_0", + "status": "passed", + "detail": { + "cas": "94-36-0" + } + }, + { + "id": "half_life_consistency_dibenzoyl_peroxide_0", + "status": "passed", + "detail": 0.774 + }, + { + "id": "line_values_dibenzoyl_peroxide_1", + "status": "passed", + "detail": { + "file": "nouryon_brochure-crosslinking-peroxides-emeia-booklet-en_us.pdf", + "line": 830, + "text": "PERKADOX L Dibenzoyl peroxide VMQ 106 83 63 112.5 5.97E+12", + "A": "5.97E+12", + "Ea": 112.5, + "temps_C": [ + 106, + 83, + 63 + ] + } + }, + { + "id": "name_block_dibenzoyl_peroxide_1", + "status": "passed", + "detail": { + "cas": "94-36-0" + } + }, + { + "id": "half_life_consistency_dibenzoyl_peroxide_1", + "status": "passed", + "detail": 0.774 + }, + { + "id": "primary_kinetics_is_a_measurement_dibenzoyl_peroxide", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_dibenzoyl_peroxide", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_tbutyl_peroxy_2_ethylhexanoate", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_tbutyl_peroxy_2_ethylhexanoate", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_tbutyl_peroxy_2_ethylhexanoate", + "status": "passed", + "detail": null + }, + { + "id": "line_values_tbutyl_peroxy_2_ethylhexanoate_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf", + "line": 772, + "text": "tert-Butyl peroxy-2-ethylhexanoate [3006-82-4] 216.3 7.40 113 91 ", + "A": "1.54E+14", + "Ea": 124.9, + "temps_C": [ + 113, + 91, + 72 + ] + } + }, + { + "id": "name_block_tbutyl_peroxy_2_ethylhexanoate_0", + "status": "passed", + "detail": { + "cas": "3006-82-4" + } + }, + { + "id": "half_life_consistency_tbutyl_peroxy_2_ethylhexanoate_0", + "status": "passed", + "detail": 0.774 + }, + { + "id": "primary_kinetics_is_a_measurement_tbutyl_peroxy_2_ethylhexanoate", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_tbutyl_peroxy_2_ethylhexanoate", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_tbutyl_peroxydiethylacetate", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_tbutyl_peroxydiethylacetate", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_tbutyl_peroxydiethylacetate", + "status": "passed", + "detail": null + }, + { + "id": "line_values_tbutyl_peroxydiethylacetate_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-acrylics-manufacturing-en_us.pdf", + "line": 556, + "text": "tert-Butyl peroxydiethylacetate [2550-33-6] 188.3 8.50 113 93 ", + "A": "2.45E+15", + "Ea": 134.0, + "temps_C": [ + 113, + 93, + 75 + ] + } + }, + { + "id": "name_block_tbutyl_peroxydiethylacetate_0", + "status": "passed", + "detail": { + "cas": "2550-33-6" + } + }, + { + "id": "half_life_consistency_tbutyl_peroxydiethylacetate_0", + "status": "passed", + "detail": 0.774 + }, + { + "id": "primary_kinetics_is_a_measurement_tbutyl_peroxydiethylacetate", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_tbutyl_peroxydiethylacetate", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_tbutyl_peroxyisobutyrate", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_tbutyl_peroxyisobutyrate", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_tbutyl_peroxyisobutyrate", + "status": "passed", + "detail": null + }, + { + "id": "line_values_tbutyl_peroxyisobutyrate_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf", + "line": 782, + "text": "tert-Butyl peroxyisobutyrate [109-13-7] 160.2 9.99 118 98 ", + "A": "2.07E+15", + "Ea": 135.16, + "temps_C": [ + 118, + 98, + 79 + ] + } + }, + { + "id": "name_block_tbutyl_peroxyisobutyrate_0", + "status": "passed", + "detail": { + "cas": "109-13-7" + } + }, + { + "id": "half_life_consistency_tbutyl_peroxyisobutyrate_0", + "status": "passed", + "detail": 0.774 + }, + { + "id": "primary_kinetics_is_a_measurement_tbutyl_peroxyisobutyrate", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_tbutyl_peroxyisobutyrate", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_1_1_azodi_hexahydrobenzonitrile", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_1_1_azodi_hexahydrobenzonitrile", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_1_1_azodi_hexahydrobenzonitrile", + "status": "passed", + "detail": null + }, + { + "id": "line_values_1_1_azodi_hexahydrobenzonitrile_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf", + "line": 806, + "text": "1,1’-Azodi(hexahydrobenzonitrile) [2094-98-6] 244.3 ", + "A": "1.10E+16", + "Ea": 142.19, + "temps_C": [ + 123, + 103, + 85 + ] + } + }, + { + "id": "name_block_1_1_azodi_hexahydrobenzonitrile_0", + "status": "passed", + "detail": { + "cas": "2094-98-6" + } + }, + { + "id": "half_life_consistency_1_1_azodi_hexahydrobenzonitrile_0", + "status": "passed", + "detail": 0.774 + }, + { + "id": "line_values_1_1_azodi_hexahydrobenzonitrile_1", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-acrylics-manufacturing-en_us.pdf", + "line": 579, + "text": "1,1’-Azodi(hexahydrobenzonitrile) [2094-98-6] 244.3 ", + "A": "1.10E+16", + "Ea": 142.0, + "temps_C": [ + 123, + 103, + 85 + ] + } + }, + { + "id": "name_block_1_1_azodi_hexahydrobenzonitrile_1", + "status": "passed", + "detail": { + "cas": "2094-98-6" + } + }, + { + "id": "half_life_consistency_1_1_azodi_hexahydrobenzonitrile_1", + "status": "passed", + "detail": 0.814 + }, + { + "id": "primary_kinetics_is_a_measurement_1_1_azodi_hexahydrobenzonitrile", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_1_1_azodi_hexahydrobenzonitrile", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_1_1_di_tbutylperoxy_3_3_5_trimethylcyclohexane", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_1_1_di_tbutylperoxy_3_3_5_trimethylcyclohexane", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_1_1_di_tbutylperoxy_3_3_5_trimethylcyclohexane", + "status": "passed", + "detail": null + }, + { + "id": "line_values_1_1_di_tbutylperoxy_3_3_5_trimethylcyclohexane_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf", + "line": 825, + "text": "1,1-Di(tert-butylperoxy)-3,3,5-trimethylcyclohexane [6731-36-8] 302.5 10.58 ", + "A": "7.59E+13", + "Ea": 127.52, + "temps_C": [ + 128, + 105, + 85 + ] + } + }, + { + "id": "name_block_1_1_di_tbutylperoxy_3_3_5_trimethylcyclohexane_0", + "status": "passed", + "detail": { + "cas": "6731-36-8" + } + }, + { + "id": "half_life_consistency_1_1_di_tbutylperoxy_3_3_5_trimethylcyclohexane_0", + "status": "passed", + "detail": 0.814 + }, + { + "id": "line_values_1_1_di_tbutylperoxy_3_3_5_trimethylcyclohexane_1", + "status": "passed", + "detail": { + "file": "nouryon_brochure-crosslinking-peroxides-emeia-booklet-en_us.pdf", + "line": 827, + "text": "TRIGONOX 29 1,1-Di(tert-butylperoxy)-3,3,5-trimethylcyclohexane EPDM 135 111 89 124.5 1.69E+13", + "A": "1.69E+13", + "Ea": 124.5, + "temps_C": [ + 135, + 111, + 89 + ] + } + }, + { + "id": "name_block_1_1_di_tbutylperoxy_3_3_5_trimethylcyclohexane_1", + "status": "passed", + "detail": { + "cas": "6731-36-8" + } + }, + { + "id": "half_life_consistency_1_1_di_tbutylperoxy_3_3_5_trimethylcyclohexane_1", + "status": "passed", + "detail": 0.814 + }, + { + "id": "primary_kinetics_is_a_measurement_1_1_di_tbutylperoxy_3_3_5_trimethylcyclohexane", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_1_1_di_tbutylperoxy_3_3_5_trimethylcyclohexane", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_1_1_di_tamylperoxy_cyclohexane", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_1_1_di_tamylperoxy_cyclohexane", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_1_1_di_tamylperoxy_cyclohexane", + "status": "passed", + "detail": null + }, + { + "id": "line_values_1_1_di_tamylperoxy_cyclohexane_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf", + "line": 814, + "text": "1,1-Di(tert-amylperoxy)cyclohexane [15667-10-4] 288.4 11.09 ", + "A": "3.29E+15", + "Ea": 139.46, + "temps_C": [ + 126, + 106, + 87 + ] + } + }, + { + "id": "name_block_1_1_di_tamylperoxy_cyclohexane_0", + "status": "passed", + "detail": { + "cas": "15667-10-4" + } + }, + { + "id": "half_life_consistency_1_1_di_tamylperoxy_cyclohexane_0", + "status": "passed", + "detail": 0.814 + }, + { + "id": "primary_kinetics_is_a_measurement_1_1_di_tamylperoxy_cyclohexane", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_1_1_di_tamylperoxy_cyclohexane", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_1_1_di_tbutylperoxy_cyclohexane", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_1_1_di_tbutylperoxy_cyclohexane", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_1_1_di_tbutylperoxy_cyclohexane", + "status": "passed", + "detail": null + }, + { + "id": "line_values_1_1_di_tbutylperoxy_cyclohexane_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf", + "line": 839, + "text": "1,1-Di(tert-butylperoxy)cyclohexane [3006-86-8] 260.4 12.29 ", + "A": "3.47E+15", + "Ea": 142.4, + "temps_C": [ + 134, + 113, + 94 + ] + } + }, + { + "id": "name_block_1_1_di_tbutylperoxy_cyclohexane_0", + "status": "passed", + "detail": { + "cas": "3006-86-8" + } + }, + { + "id": "half_life_consistency_1_1_di_tbutylperoxy_cyclohexane_0", + "status": "passed", + "detail": 0.814 + }, + { + "id": "primary_kinetics_is_a_measurement_1_1_di_tbutylperoxy_cyclohexane", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_1_1_di_tbutylperoxy_cyclohexane", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_tamylperoxy_2_ethylhexyl_carbonate", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_tamylperoxy_2_ethylhexyl_carbonate", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_tamylperoxy_2_ethylhexyl_carbonate", + "status": "passed", + "detail": null + }, + { + "id": "line_values_tamylperoxy_2_ethylhexyl_carbonate_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf", + "line": 850, + "text": "tert-Amylperoxy 2-ethylhexyl carbonate [70833-40-8] 260.4 6.14 ", + "A": "2.22E+16", + "Ea": 148.41, + "temps_C": [ + 134, + 113, + 95 + ] + } + }, + { + "id": "name_block_tamylperoxy_2_ethylhexyl_carbonate_0", + "status": "passed", + "detail": { + "cas": "70833-40-8" + } + }, + { + "id": "half_life_consistency_tamylperoxy_2_ethylhexyl_carbonate_0", + "status": "passed", + "detail": 0.814 + }, + { + "id": "line_values_tamylperoxy_2_ethylhexyl_carbonate_1", + "status": "passed", + "detail": { + "file": "nouryon_brochure-crosslinking-peroxides-emeia-booklet-en_us.pdf", + "line": 828, + "text": "TRIGONOX 131 tert-amylperoxy 2-ethylhexyl carbonate EVA 129 103 80 112.1 7.29E+11", + "A": "7.29E+11", + "Ea": 112.1, + "temps_C": [ + 129, + 103, + 80 + ] + } + }, + { + "id": "name_block_tamylperoxy_2_ethylhexyl_carbonate_1", + "status": "passed", + "detail": { + "cas": "70833-40-8" + } + }, + { + "id": "half_life_consistency_tamylperoxy_2_ethylhexyl_carbonate_1", + "status": "passed", + "detail": 0.814 + }, + { + "id": "primary_kinetics_is_a_measurement_tamylperoxy_2_ethylhexyl_carbonate", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_tamylperoxy_2_ethylhexyl_carbonate", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_tbutyl_peroxy_3_5_5_trimethylhexanoate", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_tbutyl_peroxy_3_5_5_trimethylhexanoate", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_tbutyl_peroxy_3_5_5_trimethylhexanoate", + "status": "passed", + "detail": null + }, + { + "id": "line_values_tbutyl_peroxy_3_5_5_trimethylhexanoate_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf", + "line": 860, + "text": "tert-Butyl peroxy-3,5,5-trimethylhexanoate [13122-18-4] 230.3 6.95 ", + "A": "1.94E+15", + "Ea": 140.78, + "temps_C": [ + 135, + 114, + 94 + ] + } + }, + { + "id": "name_block_tbutyl_peroxy_3_5_5_trimethylhexanoate_0", + "status": "passed", + "detail": { + "cas": "13122-18-4" + } + }, + { + "id": "half_life_consistency_tbutyl_peroxy_3_5_5_trimethylhexanoate_0", + "status": "passed", + "detail": 0.814 + }, + { + "id": "primary_kinetics_is_a_measurement_tbutyl_peroxy_3_5_5_trimethylhexanoate", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_tbutyl_peroxy_3_5_5_trimethylhexanoate", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_tamyl_peroxyacetate", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_tamyl_peroxyacetate", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_tamyl_peroxyacetate", + "status": "passed", + "detail": null + }, + { + "id": "line_values_tamyl_peroxyacetate_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-acrylics-manufacturing-en_us.pdf", + "line": 634, + "text": "tert-Amyl peroxyacetate [690-83-5] 146.2 10.94 ", + "A": "6.59E+16", + "Ea": 152.16, + "temps_C": [ + 134, + 114, + 96 + ] + } + }, + { + "id": "name_block_tamyl_peroxyacetate_0", + "status": "passed", + "detail": { + "cas": "690-83-5" + } + }, + { + "id": "half_life_consistency_tamyl_peroxyacetate_0", + "status": "passed", + "detail": 0.814 + }, + { + "id": "primary_kinetics_is_a_measurement_tamyl_peroxyacetate", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_tamyl_peroxyacetate", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_2_2_di_tbutylperoxy_butane", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_2_2_di_tbutylperoxy_butane", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_2_2_di_tbutylperoxy_butane", + "status": "passed", + "detail": null + }, + { + "id": "line_values_2_2_di_tbutylperoxy_butane_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf", + "line": 884, + "text": "2,2-Di(tert-butylperoxy)butane [2167-23-9] 234.3 13.66 136 ", + "A": "9.30E+16", + "Ea": 154.08, + "temps_C": [ + 136, + 116, + 98 + ] + } + }, + { + "id": "name_block_2_2_di_tbutylperoxy_butane_0", + "status": "passed", + "detail": { + "cas": "2167-23-9" + } + }, + { + "id": "half_life_consistency_2_2_di_tbutylperoxy_butane_0", + "status": "passed", + "detail": 0.814 + }, + { + "id": "primary_kinetics_is_a_measurement_2_2_di_tbutylperoxy_butane", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_2_2_di_tbutylperoxy_butane", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_tbutylperoxy_2_ethylhexyl_carbonate", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_tbutylperoxy_2_ethylhexyl_carbonate", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_tbutylperoxy_2_ethylhexyl_carbonate", + "status": "passed", + "detail": null + }, + { + "id": "line_values_tbutylperoxy_2_ethylhexyl_carbonate_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf", + "line": 904, + "text": "tert-Butylperoxy 2-ethylhexyl carbonate [34443-12-4] 246.3 6.49 137 ", + "A": "4.07E+16", + "Ea": 151.72, + "temps_C": [ + 137, + 117, + 98 + ] + } + }, + { + "id": "name_block_tbutylperoxy_2_ethylhexyl_carbonate_0", + "status": "passed", + "detail": { + "cas": "34443-12-4" + } + }, + { + "id": "half_life_consistency_tbutylperoxy_2_ethylhexyl_carbonate_0", + "status": "passed", + "detail": 0.814 + }, + { + "id": "line_values_tbutylperoxy_2_ethylhexyl_carbonate_1", + "status": "passed", + "detail": { + "file": "nouryon_brochure-crosslinking-peroxides-emeia-booklet-en_us.pdf", + "line": 826, + "text": "TRIGONOX 117 tert-Butylperoxy 2-ethylhexyl carbonate EVA 139 114 92 124.0 1.04E+13", + "A": "1.04E+13", + "Ea": 124.0, + "temps_C": [ + 139, + 114, + 92 + ] + } + }, + { + "id": "name_block_tbutylperoxy_2_ethylhexyl_carbonate_1", + "status": "passed", + "detail": { + "cas": "34443-12-4" + } + }, + { + "id": "half_life_consistency_tbutylperoxy_2_ethylhexyl_carbonate_1", + "status": "passed", + "detail": 0.814 + }, + { + "id": "primary_kinetics_is_a_measurement_tbutylperoxy_2_ethylhexyl_carbonate", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_tbutylperoxy_2_ethylhexyl_carbonate", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_tbutylperoxy_isopropyl_carbonate", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_tbutylperoxy_isopropyl_carbonate", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_tbutylperoxy_isopropyl_carbonate", + "status": "passed", + "detail": null + }, + { + "id": "line_values_tbutylperoxy_isopropyl_carbonate_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf", + "line": 894, + "text": "tert-Butylperoxy isopropyl carbonate [2372-21-6] 176.2 9.08 137 ", + "A": "2.49E+16", + "Ea": 150.15, + "temps_C": [ + 137, + 117, + 98 + ] + } + }, + { + "id": "name_block_tbutylperoxy_isopropyl_carbonate_0", + "status": "passed", + "detail": { + "cas": "2372-21-6" + } + }, + { + "id": "half_life_consistency_tbutylperoxy_isopropyl_carbonate_0", + "status": "passed", + "detail": 0.814 + }, + { + "id": "primary_kinetics_is_a_measurement_tbutylperoxy_isopropyl_carbonate", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_tbutylperoxy_isopropyl_carbonate", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_tamyl_peroxybenzoate", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_tamyl_peroxybenzoate", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_tamyl_peroxybenzoate", + "status": "passed", + "detail": null + }, + { + "id": "line_values_tamyl_peroxybenzoate_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf", + "line": 914, + "text": "tert-Amyl peroxybenzoate [4511-39-1] 208.3 7.68 139 ", + "A": "8.38E+15", + "Ea": 147.02, + "temps_C": [ + 139, + 118, + 99 + ] + } + }, + { + "id": "name_block_tamyl_peroxybenzoate_0", + "status": "passed", + "detail": { + "cas": "4511-39-1" + } + }, + { + "id": "half_life_consistency_tamyl_peroxybenzoate_0", + "status": "passed", + "detail": 0.814 + }, + { + "id": "primary_kinetics_is_a_measurement_tamyl_peroxybenzoate", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_tamyl_peroxybenzoate", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_tbutyl_peroxyacetate", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_tbutyl_peroxyacetate", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_tbutyl_peroxyacetate", + "status": "passed", + "detail": null + }, + { + "id": "line_values_tbutyl_peroxyacetate_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf", + "line": 924, + "text": "tert-Butyl peroxyacetate [107-71-1] 132.2 12.11 139 ", + "A": "1.57E+16", + "Ea": 149.36, + "temps_C": [ + 139, + 119, + 100 + ] + } + }, + { + "id": "name_block_tbutyl_peroxyacetate_0", + "status": "passed", + "detail": { + "cas": "107-71-1" + } + }, + { + "id": "half_life_consistency_tbutyl_peroxyacetate_0", + "status": "passed", + "detail": 0.814 + }, + { + "id": "primary_kinetics_is_a_measurement_tbutyl_peroxyacetate", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_tbutyl_peroxyacetate", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_tbutyl_peroxybenzoate", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_tbutyl_peroxybenzoate", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_tbutyl_peroxybenzoate", + "status": "passed", + "detail": null + }, + { + "id": "line_values_tbutyl_peroxybenzoate_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf", + "line": 934, + "text": "tert-Butyl peroxybenzoate [614-45-9] 194.2 8.24 142 ", + "A": "2.23E+16", + "Ea": 151.59, + "temps_C": [ + 142, + 122, + 103 + ] + } + }, + { + "id": "name_block_tbutyl_peroxybenzoate_0", + "status": "passed", + "detail": { + "cas": "614-45-9" + } + }, + { + "id": "half_life_consistency_tbutyl_peroxybenzoate_0", + "status": "passed", + "detail": 0.814 + }, + { + "id": "primary_kinetics_is_a_measurement_tbutyl_peroxybenzoate", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_tbutyl_peroxybenzoate", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_butyl_4_4_di_tbutylperoxy_valerate", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_butyl_4_4_di_tbutylperoxy_valerate", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_butyl_4_4_di_tbutylperoxy_valerate", + "status": "passed", + "detail": null + }, + { + "id": "line_values_butyl_4_4_di_tbutylperoxy_valerate_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-crosslinking-peroxides-emeia-booklet-en_us.pdf", + "line": 825, + "text": "TRIGONOX 17 Butyl 4,4-di(tert-butylperoxy)valerate EPDM 149 125 103 134.2 8.23E+13", + "A": "8.23E+13", + "Ea": 134.2, + "temps_C": [ + 149, + 125, + 103 + ] + } + }, + { + "id": "name_block_butyl_4_4_di_tbutylperoxy_valerate_0", + "status": "passed", + "detail": { + "cas": "995-33-5" + } + }, + { + "id": "half_life_consistency_butyl_4_4_di_tbutylperoxy_valerate_0", + "status": "passed", + "detail": 0.814 + }, + { + "id": "primary_kinetics_is_a_measurement_butyl_4_4_di_tbutylperoxy_valerate", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_butyl_4_4_di_tbutylperoxy_valerate", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_dicumyl_peroxide", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_dicumyl_peroxide", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_dicumyl_peroxide", + "status": "passed", + "detail": null + }, + { + "id": "line_values_dicumyl_peroxide_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf", + "line": 958, + "text": "Dicumyl peroxide [80-43-3] 270.4 5.92 154 13", + "A": "9.24E+15", + "Ea": 152.67, + "temps_C": [ + 154, + 132, + 112 + ] + } + }, + { + "id": "name_block_dicumyl_peroxide_0", + "status": "passed", + "detail": { + "cas": "80-43-3" + } + }, + { + "id": "half_life_consistency_dicumyl_peroxide_0", + "status": "passed", + "detail": 0.814 + }, + { + "id": "line_values_dicumyl_peroxide_1", + "status": "passed", + "detail": { + "file": "nouryon_brochure-crosslinking-peroxides-emeia-booklet-en_us.pdf", + "line": 824, + "text": "PERKADOX BC Dicumyl peroxide EPDM 158 134 112 137.8 9.77E+13", + "A": "9.77E+13", + "Ea": 137.8, + "temps_C": [ + 158, + 134, + 112 + ] + } + }, + { + "id": "name_block_dicumyl_peroxide_1", + "status": "passed", + "detail": { + "cas": "80-43-3" + } + }, + { + "id": "half_life_consistency_dicumyl_peroxide_1", + "status": "passed", + "detail": 0.814 + }, + { + "id": "primary_kinetics_is_a_measurement_dicumyl_peroxide", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_dicumyl_peroxide", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_di_tbutylperoxyisopropyl_benzene", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_di_tbutylperoxyisopropyl_benzene", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_di_tbutylperoxyisopropyl_benzene", + "status": "passed", + "detail": null + }, + { + "id": "line_values_di_tbutylperoxyisopropyl_benzene_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf", + "line": 968, + "text": "Di(tert-butylperoxyisopropyl)benzene [25155-25-3] 338.5 9.45 156 13", + "A": "7.65E+15", + "Ea": 152.69, + "temps_C": [ + 156, + 134, + 114 + ] + } + }, + { + "id": "name_block_di_tbutylperoxyisopropyl_benzene_0", + "status": "passed", + "detail": { + "cas": "25155-25-3" + } + }, + { + "id": "half_life_consistency_di_tbutylperoxyisopropyl_benzene_0", + "status": "passed", + "detail": 0.814 + }, + { + "id": "line_values_di_tbutylperoxyisopropyl_benzene_1", + "status": "passed", + "detail": { + "file": "nouryon_brochure-crosslinking-peroxides-emeia-booklet-en_us.pdf", + "line": 823, + "text": "PERKADOX 14 Di-tert-butylperoxyisopropyl)benzene EPDM 164 140 118 143.5 2.68E+14", + "A": "2.68E+14", + "Ea": 143.5, + "temps_C": [ + 164, + 140, + 118 + ] + } + }, + { + "id": "name_block_di_tbutylperoxyisopropyl_benzene_1", + "status": "passed", + "detail": { + "cas": "25155-25-3" + } + }, + { + "id": "half_life_consistency_di_tbutylperoxyisopropyl_benzene_1", + "status": "passed", + "detail": 0.814 + }, + { + "id": "primary_kinetics_is_a_measurement_di_tbutylperoxyisopropyl_benzene", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_di_tbutylperoxyisopropyl_benzene", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_2_5_dimethyl_2_5_di_tbutylperoxy_hexane", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_2_5_dimethyl_2_5_di_tbutylperoxy_hexane", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_2_5_dimethyl_2_5_di_tbutylperoxy_hexane", + "status": "passed", + "detail": null + }, + { + "id": "line_values_2_5_dimethyl_2_5_di_tbutylperoxy_hexane_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf", + "line": 978, + "text": "2,5-Dimethyl-2,5-di(tert-butylperoxy)hexane [78-63-7] 290.4 11.02 156 13", + "A": "1.68E+16", + "Ea": 155.49, + "temps_C": [ + 156, + 134, + 115 + ] + } + }, + { + "id": "name_block_2_5_dimethyl_2_5_di_tbutylperoxy_hexane_0", + "status": "passed", + "detail": { + "cas": "78-63-7" + } + }, + { + "id": "half_life_consistency_2_5_dimethyl_2_5_di_tbutylperoxy_hexane_0", + "status": "passed", + "detail": 0.814 + }, + { + "id": "line_values_2_5_dimethyl_2_5_di_tbutylperoxy_hexane_1", + "status": "passed", + "detail": { + "file": "nouryon_brochure-crosslinking-peroxides-emeia-booklet-en_us.pdf", + "line": 820, + "text": "TRIGONOX 101 2,5-Dimethyl-2,5-di(tert-butylperoxy)hexane EPDM 166 143 121 147.4 6.41E+14", + "A": "6.41E+14", + "Ea": 147.4, + "temps_C": [ + 166, + 143, + 121 + ] + } + }, + { + "id": "name_block_2_5_dimethyl_2_5_di_tbutylperoxy_hexane_1", + "status": "passed", + "detail": { + "cas": "78-63-7" + } + }, + { + "id": "half_life_consistency_2_5_dimethyl_2_5_di_tbutylperoxy_hexane_1", + "status": "passed", + "detail": 0.814 + }, + { + "id": "primary_kinetics_is_a_measurement_2_5_dimethyl_2_5_di_tbutylperoxy_hexane", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_2_5_dimethyl_2_5_di_tbutylperoxy_hexane", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_tbutyl_cumyl_peroxide", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_tbutyl_cumyl_peroxide", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_tbutyl_cumyl_peroxide", + "status": "passed", + "detail": null + }, + { + "id": "line_values_tbutyl_cumyl_peroxide_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-crosslinking-peroxides-emeia-booklet-en_us.pdf", + "line": 821, + "text": "TRIGONOX T tert-Butyl cumyl peroxide EPDM 164 140 118 142.9 2.30E+14", + "A": "2.30E+14", + "Ea": 142.9, + "temps_C": [ + 164, + 140, + 118 + ] + } + }, + { + "id": "name_block_tbutyl_cumyl_peroxide_0", + "status": "passed", + "detail": { + "cas": "3457-61-2" + } + }, + { + "id": "half_life_consistency_tbutyl_cumyl_peroxide_0", + "status": "passed", + "detail": 0.814 + }, + { + "id": "line_values_tbutyl_cumyl_peroxide_1", + "status": "passed", + "detail": { + "file": "nouryon_brochure-crosslinking-peroxides-emeia-booklet-en_us.pdf", + "line": 822, + "text": "TRIGONOX T tert-Butyl cumyl peroxide LDPE 172 146 123 138.9 3.55E+13", + "A": "3.55E+13", + "Ea": 138.9, + "temps_C": [ + 172, + 146, + 123 + ] + } + }, + { + "id": "name_block_tbutyl_cumyl_peroxide_1", + "status": "passed", + "detail": { + "cas": "3457-61-2" + } + }, + { + "id": "half_life_consistency_tbutyl_cumyl_peroxide_1", + "status": "passed", + "detail": 1.062 + }, + { + "id": "primary_kinetics_is_a_measurement_tbutyl_cumyl_peroxide", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_tbutyl_cumyl_peroxide", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_di_tbutyl_peroxide", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_di_tbutyl_peroxide", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_di_tbutyl_peroxide", + "status": "passed", + "detail": null + }, + { + "id": "line_values_di_tbutyl_peroxide_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf", + "line": 987, + "text": "Di-tert-butyl peroxide [110-05-4] 146.2 10.94 164 14", + "A": "4.20E+15", + "Ea": 153.46, + "temps_C": [ + 164, + 141, + 121 + ] + } + }, + { + "id": "name_block_di_tbutyl_peroxide_0", + "status": "passed", + "detail": { + "cas": "110-05-4" + } + }, + { + "id": "half_life_consistency_di_tbutyl_peroxide_0", + "status": "passed", + "detail": 1.062 + }, + { + "id": "line_values_di_tbutyl_peroxide_1", + "status": "passed", + "detail": { + "file": "nouryon_brochure-crosslinking-peroxides-emeia-booklet-en_us.pdf", + "line": 819, + "text": "TRIGONOX B 3 Di-tert-butyl peroxide HDPE 176 151 129 146.3 1.98E+14", + "A": "1.98E+14", + "Ea": 146.3, + "temps_C": [ + 176, + 151, + 129 + ] + } + }, + { + "id": "name_block_di_tbutyl_peroxide_1", + "status": "passed", + "detail": { + "cas": "110-05-4" + } + }, + { + "id": "half_life_consistency_di_tbutyl_peroxide_1", + "status": "passed", + "detail": 1.062 + }, + { + "id": "primary_kinetics_is_a_measurement_di_tbutyl_peroxide", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_di_tbutyl_peroxide", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_3_6_9_triethyl_3_6_9_trimethyl_1_4_7_triperoxonane", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_3_6_9_triethyl_3_6_9_trimethyl_1_4_7_triperoxonane", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_3_6_9_triethyl_3_6_9_trimethyl_1_4_7_triperoxonane", + "status": "passed", + "detail": null + }, + { + "id": "line_values_3_6_9_triethyl_3_6_9_trimethyl_1_4_7_triperoxonane_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf", + "line": 997, + "text": "3,6,9-Triethyl-3,6,9-trimethyl-1,4,7-triperoxonane [24748-23-0] 264.3 18.16 170 14", + "A": "1.02E+15", + "Ea": 150.23, + "temps_C": [ + 170, + 146, + 125 + ] + } + }, + { + "id": "name_block_3_6_9_triethyl_3_6_9_trimethyl_1_4_7_triperoxonane_0", + "status": "passed", + "detail": { + "cas": "24748-23-0" + } + }, + { + "id": "half_life_consistency_3_6_9_triethyl_3_6_9_trimethyl_1_4_7_triperoxonane_0", + "status": "passed", + "detail": 1.062 + }, + { + "id": "line_values_3_6_9_triethyl_3_6_9_trimethyl_1_4_7_triperoxonane_1", + "status": "passed", + "detail": { + "file": "nouryon_brochure-crosslinking-peroxides-emeia-booklet-en_us.pdf", + "line": 817, + "text": "TRIGONOX 301 3,6,9-Triethyl-3,6,9-trimethyl-1,4,7-triperoxonane HDPE 181 156 134 150.8 4.35E+14", + "A": "4.35E+14", + "Ea": 150.8, + "temps_C": [ + 181, + 156, + 134 + ] + } + }, + { + "id": "name_block_3_6_9_triethyl_3_6_9_trimethyl_1_4_7_triperoxonane_1", + "status": "passed", + "detail": { + "cas": "24748-23-0" + } + }, + { + "id": "half_life_consistency_3_6_9_triethyl_3_6_9_trimethyl_1_4_7_triperoxonane_1", + "status": "passed", + "detail": 1.062 + }, + { + "id": "primary_kinetics_is_a_measurement_3_6_9_triethyl_3_6_9_trimethyl_1_4_7_triperoxonane", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_3_6_9_triethyl_3_6_9_trimethyl_1_4_7_triperoxonane", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_2_5_dimethyl_2_5_di_tbutylperoxy_hexyne_3", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_2_5_dimethyl_2_5_di_tbutylperoxy_hexyne_3", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_2_5_dimethyl_2_5_di_tbutylperoxy_hexyne_3", + "status": "passed", + "detail": null + }, + { + "id": "line_values_2_5_dimethyl_2_5_di_tbutylperoxy_hexyne_3_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-crosslinking-peroxides-emeia-booklet-en_us.pdf", + "line": 818, + "text": "TRIGONOX 145 2,5-Dimethyl-2,5-di(tert-butylperoxy)hexyne-3 EPDM 177 152 130 148.7 3.49E+14", + "A": "3.49E+14", + "Ea": 148.7, + "temps_C": [ + 177, + 152, + 130 + ] + } + }, + { + "id": "name_block_2_5_dimethyl_2_5_di_tbutylperoxy_hexyne_3_0", + "status": "passed", + "detail": { + "cas": "1068-27-5" + } + }, + { + "id": "half_life_consistency_2_5_dimethyl_2_5_di_tbutylperoxy_hexyne_3_0", + "status": "passed", + "detail": 1.062 + }, + { + "id": "primary_kinetics_is_a_measurement_2_5_dimethyl_2_5_di_tbutylperoxy_hexyne_3", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_2_5_dimethyl_2_5_di_tbutylperoxy_hexyne_3", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_cumyl_hydroperoxide", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_cumyl_hydroperoxide", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_cumyl_hydroperoxide", + "status": "passed", + "detail": null + }, + { + "id": "line_values_cumyl_hydroperoxide_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf", + "line": 1041, + "text": "Cumyl hydroperoxide [80-15-9] 152.2 10.51 195 166 140 1.15E+12 13", + "A": "1.15E+12", + "Ea": 132.56, + "temps_C": [ + 195, + 166, + 140 + ] + } + }, + { + "id": "name_block_cumyl_hydroperoxide_0", + "status": "passed", + "detail": { + "cas": "80-15-9" + } + }, + { + "id": "half_life_consistency_cumyl_hydroperoxide_0", + "status": "passed", + "detail": 1.062 + }, + { + "id": "primary_kinetics_is_a_measurement_cumyl_hydroperoxide", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_cumyl_hydroperoxide", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_3_3_5_7_7_pentamethyl_1_2_4_trioxepane", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_3_3_5_7_7_pentamethyl_1_2_4_trioxepane", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_3_3_5_7_7_pentamethyl_1_2_4_trioxepane", + "status": "passed", + "detail": null + }, + { + "id": "line_values_3_3_5_7_7_pentamethyl_1_2_4_trioxepane_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-crosslinking-peroxides-emeia-booklet-en_us.pdf", + "line": 816, + "text": "TRIGONOX 311 3,3,5,7,7-Pentamethyl-1,2,4-trioxepane HDPE 213 184 158 144.6 6.58E+12", + "A": "6.58E+12", + "Ea": 144.6, + "temps_C": [ + 213, + 184, + 158 + ] + } + }, + { + "id": "name_block_3_3_5_7_7_pentamethyl_1_2_4_trioxepane_0", + "status": "passed", + "detail": { + "cas": "215877-64-8" + } + }, + { + "id": "half_life_consistency_3_3_5_7_7_pentamethyl_1_2_4_trioxepane_0", + "status": "passed", + "detail": 1.062 + }, + { + "id": "primary_kinetics_is_a_measurement_3_3_5_7_7_pentamethyl_1_2_4_trioxepane", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_3_3_5_7_7_pentamethyl_1_2_4_trioxepane", + "status": "passed", + "detail": null + }, + { + "id": "unique_id_tbutyl_hydroperoxide", + "status": "passed", + "detail": null + }, + { + "id": "unique_cas_tbutyl_hydroperoxide", + "status": "passed", + "detail": null + }, + { + "id": "cas_format_tbutyl_hydroperoxide", + "status": "passed", + "detail": null + }, + { + "id": "line_values_tbutyl_hydroperoxide_0", + "status": "passed", + "detail": { + "file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf", + "line": 1050, + "text": "tert-Butyl hydroperoxide [75-91-2] 90.1 17.75 207 185 164 3.18E+17 18", + "A": "3.18E+17", + "Ea": 186.01, + "temps_C": [ + 207, + 185, + 164 + ] + } + }, + { + "id": "name_block_tbutyl_hydroperoxide_0", + "status": "passed", + "detail": { + "cas": "75-91-2" + } + }, + { + "id": "half_life_consistency_tbutyl_hydroperoxide_0", + "status": "passed", + "detail": 1.062 + }, + { + "id": "primary_kinetics_is_a_measurement_tbutyl_hydroperoxide", + "status": "passed", + "detail": null + }, + { + "id": "no_invented_heat_tbutyl_hydroperoxide", + "status": "passed", + "detail": null + }, + { + "id": "at_least_50_distinct_substances", + "status": "passed", + "detail": 51 + }, + { + "id": "dtbp_text_5.74_g_of_20%_di-tert-butyl-pe", + "status": "passed", + "detail": null + }, + { + "id": "dtbp_text_mass_10.028_g", + "status": "passed", + "detail": null + }, + { + "id": "dtbp_text_exothermal_threshold", + "status": "passed", + "detail": null + }, + { + "id": "dtbp_text_1.480", + "status": "passed", + "detail": null + }, + { + "id": "dtbp_text_90.3_K", + "status": "passed", + "detail": null + }, + { + "id": "dtbp_text_133.7_K", + "status": "passed", + "detail": null + }, + { + "id": "dtbp_text_280.675_J/g", + "status": "passed", + "detail": null + }, + { + "id": "dtbp_text_1611.075_J", + "status": "passed", + "detail": null + }, + { + "id": "dtbp_text_15.152_log_(1/s)", + "status": "passed", + "detail": null + }, + { + "id": "dtbp_text_151.039_kJ/mol", + "status": "passed", + "detail": null + }, + { + "id": "dtbp_text_42.7_bar", + "status": "passed", + "detail": null + }, + { + "id": "dtbp_text_At_110°C", + "status": "passed", + "detail": null + }, + { + "id": "dtbp_phi_consistency", + "status": "passed", + "detail": 1.4806201550387597 + }, + { + "id": "dtbp_total_heat_consistency", + "status": "passed", + "detail": null + }, + { + "id": "pubchem_cas_all_confirmed", + "status": "passed", + "detail": null + }, + { + "id": "antoine_273.13", + "status": "passed", + "detail": null + }, + { + "id": "antoine_303.0", + "status": "passed", + "detail": null + }, + { + "id": "antoine_420.0", + "status": "passed", + "detail": null + }, + { + "id": "antoine_308.52", + "status": "passed", + "detail": null + }, + { + "id": "antoine_273.0", + "status": "passed", + "detail": null + } + ], + "failed": [] +} diff --git a/outputs/expansion_batch04/t1_thermal/zwick_mflow/interface_definition.py b/outputs/expansion_batch04/t1_thermal/zwick_mflow/interface_definition.py new file mode 100644 index 0000000000000000000000000000000000000000..0f6e5a4cfe884460305410a2ff8d5d9c6a7a2fee --- /dev/null +++ b/outputs/expansion_batch04/t1_thermal/zwick_mflow/interface_definition.py @@ -0,0 +1,142 @@ +"""CHEM-146 Mflow 1128610 shared interface geometry (SI, +Z up, +Y rear, origin = bench footprint centre). + +Single source for build_geometry.py, build_blender.py, verify_geometry.py and the Matterix scripts. The runtime +(scripts/asset_runtime/zwick_mflow.py) keeps its own copies of the physical constants and the tests compare them. + +Manufacturer facts (PI 434 725, item 1128610 column): body 479 x 524 x 548 mm (W x D x H), 55 kg without test weights, +7" capacitive touch display, displacement transducer and automatic extrudate cutter included, barrel 1128612 bore +9.55 mm, die 312342 2.095 mm x 8 mm, piston 1128614 = 0.325 kg test load. Every other number below is a photo / +engineering estimate from the manufacturer photographs (evidence = photo_estimate or engineering_assumption). +""" +import math + +# ---------------------------------------------------------------- envelope and barrel column +ENVELOPE_M = (0.479, 0.524, 0.548) +BARREL_XY = (-0.080, -0.125) # barrel / piston / die axis (photo estimate: ~65 % across the furnace cover) +BARREL_BORE_DIAMETER_M = 0.00955 # 1128612, documented +PISTON_HEAD_DIAMETER_M = 0.009474 # ISO 1133-1 piston head (engineering reference to the standard) +PISTON_HEAD_LENGTH_M = 0.00635 +DIE_DIAMETER_M = 0.002095 # 312342, documented +DIE_LENGTH_M = 0.008 # 312342, documented +DIE_EXIT_Z = 0.228 # die exit face (underside of the furnace die plate) +DIE_TOP_Z = DIE_EXIT_Z + DIE_LENGTH_M # 0.236: piston position 0 = piston bottom on the die top +BARREL_LENGTH_M = 0.180 +BARREL_TOP_Z = DIE_TOP_Z + BARREL_LENGTH_M # 0.416 +FURNACE_TOP_Z = 0.430 +PISTON_TRAVEL_M = BARREL_LENGTH_M # joint 0 .. 0.180 (withdrawn = piston bottom at the barrel top) +PISTON_SEAT_LOCAL_Z = 0.246 # weight seat above the piston bottom +WEIGHT_HEIGHT_M = 0.066 # standard 2.16 kg load stage weight (1.835 kg on top of the 0.325 kg piston) +PISTON_MASS_KG = 0.325 # documented: piston alone = 0.325 kg test load +STANDARD_WEIGHT_MASS_KG = 2.16 - 0.325 # documented load stage 2.16 kg minus the piston +assert abs(DIE_TOP_Z + PISTON_SEAT_LOCAL_Z + WEIGHT_HEIGHT_M - ENVELOPE_M[2]) < 1e-12 + +# ---------------------------------------------------------------- displacement transducer (rotary arm on a collar) +SENSOR_COLLAR_LOCAL_Z = 0.218 # top of the transducer collar on the piston stem +SENSOR_COLLAR_THICKNESS_M = 0.004 +SENSOR_COLLAR_RADIUS_M = 0.016 +SENSOR_ROLLER_RADIUS_M = 0.003 # two rollers, spring-loaded upward against the collar underside +SENSOR_ARM_LENGTH_M = 0.140 +SENSOR_PIVOT_XY = (BARREL_XY[0] - SENSOR_ARM_LENGTH_M / math.sqrt(2.0), BARREL_XY[1] + SENSOR_ARM_LENGTH_M / math.sqrt(2.0)) +SENSOR_ZERO_POSITION_M = 0.050 # arm horizontal when the piston bottom is 50 mm above the die (ISO start) +SENSOR_PIVOT_Z = DIE_TOP_Z + SENSOR_ZERO_POSITION_M + SENSOR_COLLAR_LOCAL_Z - SENSOR_COLLAR_THICKNESS_M - SENSOR_ROLLER_RADIUS_M +SENSOR_ARM_DIRECTION = (math.sqrt(0.5), -math.sqrt(0.5), 0.0) # horizontal, pivot -> piston axis +SENSOR_ARM_AXIS = (-math.sqrt(0.5), -math.sqrt(0.5), 0.0) # = direction x Z, positive angle lifts the tip +SENSOR_ELEVATION_MAX_RAD = 0.42 # upper stop of the arm (tip lifted) +SENSOR_REFERENCE_ELEVATION_RAD = math.asin(-SENSOR_ZERO_POSITION_M / SENSOR_ARM_LENGTH_M) # arm on the collar, piston on the die +SENSOR_ARM_LIMITS_RAD = (0.0, SENSOR_ELEVATION_MAX_RAD - SENSOR_REFERENCE_ELEVATION_RAD) # joint 0 = reference pose +SENSOR_CONTACT_RANGE_M = (0.0, SENSOR_ZERO_POSITION_M + SENSOR_ARM_LENGTH_M * math.sin(SENSOR_ELEVATION_MAX_RAD)) + + +def sensor_arm_angle(piston_position_m): + """Joint angle of the transducer arm for a piston position (0 = reference pose, piston on the die). + + The roller tops (on the arm centre line at 140 mm, radius 3 mm) press against the collar underside, so exactly + elevation = asin((position - 0.050) / 0.140). Beyond the reach (~107 mm) the arm rests on its upper stop below the + collar and has no contact (the encoder then reports out of range). + """ + s = (piston_position_m - SENSOR_ZERO_POSITION_M) / SENSOR_ARM_LENGTH_M + elevation = SENSOR_ELEVATION_MAX_RAD if s >= math.sin(SENSOR_ELEVATION_MAX_RAD) else math.asin(max(s, math.sin(SENSOR_REFERENCE_ELEVATION_RAD))) + return elevation - SENSOR_REFERENCE_ELEVATION_RAD + + +# ---------------------------------------------------------------- automatic extrudate cutter +CUTTER_PIVOT_XY = (BARREL_XY[0] - 0.040, BARREL_XY[1]) +CUTTER_BLADE_Z = (0.2244, 0.2254) # blade plane 2.6-3.6 mm below the die exit +CUTTER_LIMITS_RAD = (0.0, math.pi) # alternate half turns 0 -> pi -> 0; crossing pi/2 severs the strand + +# ---------------------------------------------------------------- tilted 7" touch display and illuminated keys +PANEL_TILT_RAD = math.radians(75.0) # face tilted 15 deg back from vertical +U = [1.0, 0.0, 0.0] +V = [0.0, math.cos(PANEL_TILT_RAD), math.sin(PANEL_TILT_RAD)] +N = [0.0, -math.sin(PANEL_TILT_RAD), math.cos(PANEL_TILT_RAD)] +PANEL_BOTTOM = (0.1145, -0.2046, 0.240) # centre of the lower face edge +PANEL_HEIGHT_M = 0.1915 +PANEL_WIDTH_M = 0.225 +PANEL_CENTER = [PANEL_BOTTOM[0], PANEL_BOTTOM[1] + V[1] * PANEL_HEIGHT_M / 2, PANEL_BOTTOM[2] + V[2] * PANEL_HEIGHT_M / 2] + + +def panel_point(u, v, n=0.0): + """Face-local (u right, v up the face, n outward) -> asset frame.""" + return [PANEL_CENTER[i] + u * U[i] + v * V[i] + n * N[i] for i in range(3)] + + +SCREEN_CENTER_UV = (0.0, 0.032) +SCREEN_SIZE_M = (0.158, 0.094) +BAND_CENTER_UV = (0.0, -0.034) +KEY_ROW_V = -0.066 +KEYS = [('button_up', -0.080, 'up'), ('button_down', -0.054, 'down'), ('button_cycle', -0.014, 'cycle'), + ('button_start', 0.030, 'start'), ('button_stop', 0.058, 'stop')] +KEY_COMMANDS = {'button_start': 'acquisition.start', 'button_stop': 'acquisition.stop', 'button_cycle': 'cutter.cut'} + +PORTS = [('sample_loading', 'barrel', 'mechanical'), ('die_outlet', 'die', 'liquid'), ('die_mount', 'die', 'mechanical'), + ('piston_coupling', 'piston', 'mechanical'), ('weight_stack', 'test_weight', 'mechanical'), ('thermal_boundary', 'heater', 'thermal'), + ('cut_collection', 'collection_tray', 'mechanical'), ('analytical_balance', 'balance_rs232', 'data'), ('raw_data', 'raw_rs232', 'data'), + ('ethernet_host', 'ethernet_host', 'data'), ('usb_1', 'usb_1', 'data'), ('usb_2', 'usb_2', 'data'), + ('line_power', 'line_power', 'electrical'), ('protective_ground', 'protective_ground', 'electrical')] +# (part, state_id, capability, blender attribute, unit, upper) ; joints are process authoritative mirrors +MOTION = [('piston', 'piston.position_m', 'piston.insert', 'location[2]', 'm', PISTON_TRAVEL_M), + ('sensor_arm', 'sensor_arm.angle_rad', 'piston.insert', 'rotation_axis_angle', 'rad', SENSOR_ARM_LIMITS_RAD[1]), + ('cutter', 'cutter.angle_rad', 'cutter.cut', 'rotation_euler[2]', 'rad', math.pi), + ('power_switch', 'power.angle_rad', 'power.set', 'rotation_euler[0]', 'rad', 0.28)] + +LED_BG = (0.018, 0.034, 0.044) +READOUTS = [dict(name='temperature_sim', part='temperature_digits', face='N', digits=5, decimals=1, unit='C', on=(0.95, 0.96, 0.97), off=LED_BG, + blank_channel=None, source={'bridge': ['thermal.indicated_k'], 'offset': -273.15}), + dict(name='piston_position_sim', part='position_digits', face='N', digits=6, decimals=3, unit='mm', on=(0.40, 0.84, 0.98), off=LED_BG, + blank_channel=None, source={'bridge': ['encoder.position_m'], 'scale': 1000.0}), + dict(name='live_mvr_sim', part='mvr_digits', face='N', digits=6, decimals=2, unit='cm3/10min', on=(0.55, 0.93, 0.55), off=LED_BG, + blank_channel=None, source={'bridge': ['measurement.live_mvr_m3_s'], 'scale': 6.0e8})] +READOUT_LINES_V = {'temperature_digits': 0.058, 'position_digits': 0.030, 'mvr_digits': 0.002} +READOUT_BASIS = {r['name']: dict(u=U, v=V, normal=N) for r in READOUTS} +READOUT_NOTE_ZH = ('厂家1128610确有7寸倾斜电容触屏(照片界面显示温度与活塞位置数值);本资产在屏上叠加三行工程七段读数:炉温°C(0.1 K显示)、' + '活塞底距口模上表面mm(0.003 mm量化)、实时MVR cm³/10min,均来自公开传感状态,不是原厂界面、字体或驱动。' + '面板基向量U=+X,V=[0,cos75°,sin75°],N=[0,-sin75°,cos75°]。未配气动升降/自动选重,上下箭头键保留为无指令弹簧键;' + '开始/停止/切刀键经宿主能力触发。称量只经外部天平RS232语义口,不造内置天平。挤出丝与末段切段为本任务场景适配器的可视缩放,不是CFD或接触求解。') + +REAR_Y = 0.256 +PORT_GEOMETRY = { + 'sample_loading': dict(pos=[BARREL_XY[0], BARREL_XY[1], FURNACE_TOP_Z + 0.006], insert_axis=[0, 0, 1], radius=BARREL_BORE_DIAMETER_M / 2, capture=0.002), + 'die_outlet': dict(pos=[BARREL_XY[0], BARREL_XY[1], DIE_EXIT_Z], insert_axis=[0, 0, -1], radius=DIE_DIAMETER_M / 2, capture=0.001), + 'die_mount': dict(pos=[BARREL_XY[0], BARREL_XY[1], DIE_EXIT_Z - 0.0005], insert_axis=[0, 0, -1], radius=0.009, capture=0.002), + 'piston_coupling': dict(pos=[BARREL_XY[0], BARREL_XY[1], DIE_TOP_Z + PISTON_SEAT_LOCAL_Z], insert_axis=[0, 0, 1], radius=0.007, capture=0.002), + 'weight_stack': dict(pos=[BARREL_XY[0], BARREL_XY[1], ENVELOPE_M[2]], insert_axis=[0, 0, 1], radius=0.037, capture=0.003), + 'thermal_boundary': dict(pos=[BARREL_XY[0], BARREL_XY[1], 0.330], insert_axis=[0, -1, 0], radius=0.030, capture=0.003), + 'cut_collection': dict(pos=[BARREL_XY[0], BARREL_XY[1] - 0.020, 0.0342], insert_axis=[0, 0, 1], radius=0.060, capture=0.01), +} +REAR_CONNECTORS = [('line_power', 0.190, 0.105), ('protective_ground', 0.150, 0.105), ('ethernet_host', 0.080, 0.110), ('usb_1', 0.040, 0.110), + ('usb_2', 0.040, 0.128), ('raw_rs232', -0.030, 0.110), ('balance_rs232', -0.100, 0.110)] +CONNECTOR_PORT = {part: port for port, part, medium in PORTS if medium in ('data', 'electrical')} +for _name, _x, _z in REAR_CONNECTORS: + PORT_GEOMETRY[CONNECTOR_PORT[_name]] = dict(pos=[_x, 0.262, _z], insert_axis=[0, 1, 0], radius=0.004, capture=0.002) +for _row in PORT_GEOMETRY.values(): + _row.update(position_evidence='geometry_derived_simulation_assumption', capture_evidence='simulation_assumption', + note='接口插入轴为向外预放置方向;局部接口布局和捕获半径为工程几何,物理pinout/机器人接触未验证。') + +EXTRUDATE_RADIUS_M = 0.00115 # die radius 1.0475 mm x assumed swell 1.10 (visual only) +EXTRUDATE_VISUAL_SPEC = dict( + reference_length_m=0.020, radius_m=EXTRUDATE_RADIUS_M, max_visual_length_m=0.150, + strand=dict(part='extrudate_strand', anchor=[BARREL_XY[0], BARREL_XY[1], DIE_EXIT_Z], axis=[0, 0, -1], state='extrudate.length_m'), + segment=dict(part='extrudate_segment', anchor=[BARREL_XY[0] - 0.010, BARREL_XY[1] - 0.040, 0.0342 + EXTRUDATE_RADIUS_M], axis=[1, 0, 0], + state='extrudate.last_cut_length_m'), + scope='asset-local visual vertex scaling and visibility only; strand clipped to 150 mm (drop height to the plate ~194 mm); ' + 'no CFD, die-swell measurement, coiling, contact or automatic transfer to the balance') diff --git a/outputs/expansion_batch04/t3_analytical/evident_bx53p/source_cache/cvrl_ciexyz31_1.csv b/outputs/expansion_batch04/t3_analytical/evident_bx53p/source_cache/cvrl_ciexyz31_1.csv new file mode 100644 index 0000000000000000000000000000000000000000..d685a50376ecceaa09db1f5c693f2299de4f884b --- /dev/null +++ b/outputs/expansion_batch04/t3_analytical/evident_bx53p/source_cache/cvrl_ciexyz31_1.csv @@ -0,0 +1,471 @@ +360,0.000129900000,0.000003917000,0.000606100000 +361,0.000145847000,0.000004393581,0.000680879200 +362,0.000163802100,0.000004929604,0.000765145600 +363,0.000184003700,0.000005532136,0.000860012400 +364,0.000206690200,0.000006208245,0.000966592800 +365,0.000232100000,0.000006965000,0.001086000000 +366,0.000260728000,0.000007813219,0.001220586000 +367,0.000293075000,0.000008767336,0.001372729000 +368,0.000329388000,0.000009839844,0.001543579000 +369,0.000369914000,0.000011043230,0.001734286000 +370,0.000414900000,0.000012390000,0.001946000000 +371,0.000464158700,0.000013886410,0.002177777000 +372,0.000518986000,0.000015557280,0.002435809000 +373,0.000581854000,0.000017442960,0.002731953000 +374,0.000655234700,0.000019583750,0.003078064000 +375,0.000741600000,0.000022020000,0.003486000000 +376,0.000845029600,0.000024839650,0.003975227000 +377,0.000964526800,0.000028041260,0.004540880000 +378,0.001094949000,0.000031531040,0.005158320000 +379,0.001231154000,0.000035215210,0.005802907000 +380,0.001368000000,0.000039000000,0.006450001000 +381,0.001502050000,0.000042826400,0.007083216000 +382,0.001642328000,0.000046914600,0.007745488000 +383,0.001802382000,0.000051589600,0.008501152000 +384,0.001995757000,0.000057176400,0.009414544000 +385,0.002236000000,0.000064000000,0.010549990000 +386,0.002535385000,0.000072344210,0.011965800000 +387,0.002892603000,0.000082212240,0.013655870000 +388,0.003300829000,0.000093508160,0.015588050000 +389,0.003753236000,0.000106136100,0.017730150000 +390,0.004243000000,0.000120000000,0.020050010000 +391,0.004762389000,0.000134984000,0.022511360000 +392,0.005330048000,0.000151492000,0.025202880000 +393,0.005978712000,0.000170208000,0.028279720000 +394,0.006741117000,0.000191816000,0.031897040000 +395,0.007650000000,0.000217000000,0.036210000000 +396,0.008751373000,0.000246906700,0.041437710000 +397,0.010028880000,0.000281240000,0.047503720000 +398,0.011421700000,0.000318520000,0.054119880000 +399,0.012869010000,0.000357266700,0.060998030000 +400,0.014310000000,0.000396000000,0.067850010000 +401,0.015704430000,0.000433714700,0.074486320000 +402,0.017147440000,0.000473024000,0.081361560000 +403,0.018781220000,0.000517876000,0.089153640000 +404,0.020748010000,0.000572218700,0.098540480000 +405,0.023190000000,0.000640000000,0.110200000000 +406,0.026207360000,0.000724560000,0.124613300000 +407,0.029782480000,0.000825500000,0.141701700000 +408,0.033880920000,0.000941160000,0.161303500000 +409,0.038468240000,0.001069880000,0.183256800000 +410,0.043510000000,0.001210000000,0.207400000000 +411,0.048995600000,0.001362091000,0.233692100000 +412,0.055022600000,0.001530752000,0.262611400000 +413,0.061718800000,0.001720368000,0.294774600000 +414,0.069212000000,0.001935323000,0.330798500000 +415,0.077630000000,0.002180000000,0.371300000000 +416,0.086958110000,0.002454800000,0.416209100000 +417,0.097176720000,0.002764000000,0.465464200000 +418,0.108406300000,0.003117800000,0.519694800000 +419,0.120767200000,0.003526400000,0.579530300000 +420,0.134380000000,0.004000000000,0.645600000000 +421,0.149358200000,0.004546240000,0.718483800000 +422,0.165395700000,0.005159320000,0.796713300000 +423,0.181983100000,0.005829280000,0.877845900000 +424,0.198611000000,0.006546160000,0.959439000000 +425,0.214770000000,0.007300000000,1.039050100000 +426,0.230186800000,0.008086507000,1.115367300000 +427,0.244879700000,0.008908720000,1.188497100000 +428,0.258777300000,0.009767680000,1.258123300000 +429,0.271807900000,0.010664430000,1.323929600000 +430,0.283900000000,0.011600000000,1.385600000000 +431,0.294943800000,0.012573170000,1.442635200000 +432,0.304896500000,0.013582720000,1.494803500000 +433,0.313787300000,0.014629680000,1.542190300000 +434,0.321645400000,0.015715090000,1.584880700000 +435,0.328500000000,0.016840000000,1.622960000000 +436,0.334351300000,0.018007360000,1.656404800000 +437,0.339210100000,0.019214480000,1.685295900000 +438,0.343121300000,0.020453920000,1.709874500000 +439,0.346129600000,0.021718240000,1.730382100000 +440,0.348280000000,0.023000000000,1.747060000000 +441,0.349599900000,0.024294610000,1.760044600000 +442,0.350147400000,0.025610240000,1.769623300000 +443,0.350013000000,0.026958570000,1.776263700000 +444,0.349287000000,0.028351250000,1.780433400000 +445,0.348060000000,0.029800000000,1.782600000000 +446,0.346373300000,0.031310830000,1.782968200000 +447,0.344262400000,0.032883680000,1.781699800000 +448,0.341808800000,0.034521120000,1.779198200000 +449,0.339094100000,0.036225710000,1.775867100000 +450,0.336200000000,0.038000000000,1.772110000000 +451,0.333197700000,0.039846670000,1.768258900000 +452,0.330041100000,0.041768000000,1.764039000000 +453,0.326635700000,0.043766000000,1.758943800000 +454,0.322886800000,0.045842670000,1.752466300000 +455,0.318700000000,0.048000000000,1.744100000000 +456,0.314025100000,0.050243680000,1.733559500000 +457,0.308884000000,0.052573040000,1.720858100000 +458,0.303290400000,0.054980560000,1.705936900000 +459,0.297257900000,0.057458720000,1.688737200000 +460,0.290800000000,0.060000000000,1.669200000000 +461,0.283970100000,0.062601970000,1.647528700000 +462,0.276721400000,0.065277520000,1.623412700000 +463,0.268917800000,0.068042080000,1.596022300000 +464,0.260422700000,0.070911090000,1.564528000000 +465,0.251100000000,0.073900000000,1.528100000000 +466,0.240847500000,0.077016000000,1.486111400000 +467,0.229851200000,0.080266400000,1.439521500000 +468,0.218407200000,0.083666800000,1.389879900000 +469,0.206811500000,0.087232800000,1.338736200000 +470,0.195360000000,0.090980000000,1.287640000000 +471,0.184213600000,0.094917550000,1.237422300000 +472,0.173327300000,0.099045840000,1.187824300000 +473,0.162688100000,0.103367400000,1.138761100000 +474,0.152283300000,0.107884600000,1.090148000000 +475,0.142100000000,0.112600000000,1.041900000000 +476,0.132178600000,0.117532000000,0.994197600000 +477,0.122569600000,0.122674400000,0.947347300000 +478,0.113275200000,0.127992800000,0.901453100000 +479,0.104297900000,0.133452800000,0.856619300000 +480,0.095640000000,0.139020000000,0.812950100000 +481,0.087299550000,0.144676400000,0.770517300000 +482,0.079308040000,0.150469300000,0.729444800000 +483,0.071717760000,0.156461900000,0.689913600000 +484,0.064580990000,0.162717700000,0.652104900000 +485,0.057950010000,0.169300000000,0.616200000000 +486,0.051862110000,0.176243100000,0.582328600000 +487,0.046281520000,0.183558100000,0.550416200000 +488,0.041150880000,0.191273500000,0.520337600000 +489,0.036412830000,0.199418000000,0.491967300000 +490,0.032010000000,0.208020000000,0.465180000000 +491,0.027917200000,0.217119900000,0.439924600000 +492,0.024144400000,0.226734500000,0.416183600000 +493,0.020687000000,0.236857100000,0.393882200000 +494,0.017540400000,0.247481200000,0.372945900000 +495,0.014700000000,0.258600000000,0.353300000000 +496,0.012161790000,0.270184900000,0.334857800000 +497,0.009919960000,0.282293900000,0.317552100000 +498,0.007967240000,0.295050500000,0.301337500000 +499,0.006296346000,0.308578000000,0.286168600000 +500,0.004900000000,0.323000000000,0.272000000000 +501,0.003777173000,0.338402100000,0.258817100000 +502,0.002945320000,0.354685800000,0.246483800000 +503,0.002424880000,0.371698600000,0.234771800000 +504,0.002236293000,0.389287500000,0.223453300000 +505,0.002400000000,0.407300000000,0.212300000000 +506,0.002925520000,0.425629900000,0.201169200000 +507,0.003836560000,0.444309600000,0.190119600000 +508,0.005174840000,0.463394400000,0.179225400000 +509,0.006982080000,0.482939500000,0.168560800000 +510,0.009300000000,0.503000000000,0.158200000000 +511,0.012149490000,0.523569300000,0.148138300000 +512,0.015535880000,0.544512000000,0.138375800000 +513,0.019477520000,0.565690000000,0.128994200000 +514,0.023992770000,0.586965300000,0.120075100000 +515,0.029100000000,0.608200000000,0.111700000000 +516,0.034814850000,0.629345600000,0.103904800000 +517,0.041120160000,0.650306800000,0.096667480000 +518,0.047985040000,0.670875200000,0.089982720000 +519,0.055378610000,0.690842400000,0.083845310000 +520,0.063270000000,0.710000000000,0.078249990000 +521,0.071635010000,0.728185200000,0.073208990000 +522,0.080462240000,0.745463600000,0.068678160000 +523,0.089739960000,0.761969400000,0.064567840000 +524,0.099456450000,0.777836800000,0.060788350000 +525,0.109600000000,0.793200000000,0.057250010000 +526,0.120167400000,0.808110400000,0.053904350000 +527,0.131114500000,0.822496200000,0.050746640000 +528,0.142367900000,0.836306800000,0.047752760000 +529,0.153854200000,0.849491600000,0.044898590000 +530,0.165500000000,0.862000000000,0.042160000000 +531,0.177257100000,0.873810800000,0.039507280000 +532,0.189140000000,0.884962400000,0.036935640000 +533,0.201169400000,0.895493600000,0.034458360000 +534,0.213365800000,0.905443200000,0.032088720000 +535,0.225749900000,0.914850100000,0.029840000000 +536,0.238320900000,0.923734800000,0.027711810000 +537,0.251066800000,0.932092400000,0.025694440000 +538,0.263992200000,0.939922600000,0.023787160000 +539,0.277101700000,0.947225200000,0.021989250000 +540,0.290400000000,0.954000000000,0.020300000000 +541,0.303891200000,0.960256100000,0.018718050000 +542,0.317572600000,0.966007400000,0.017240360000 +543,0.331438400000,0.971260600000,0.015863640000 +544,0.345482800000,0.976022500000,0.014584610000 +545,0.359700000000,0.980300000000,0.013400000000 +546,0.374083900000,0.984092400000,0.012307230000 +547,0.388639600000,0.987418200000,0.011301880000 +548,0.403378400000,0.990312800000,0.010377920000 +549,0.418311500000,0.992811600000,0.009529306000 +550,0.433449900000,0.994950100000,0.008749999000 +551,0.448795300000,0.996710800000,0.008035200000 +552,0.464336000000,0.998098300000,0.007381600000 +553,0.480064000000,0.999112000000,0.006785400000 +554,0.495971300000,0.999748200000,0.006242800000 +555,0.512050100000,1.000000000000,0.005749999000 +556,0.528295900000,0.999856700000,0.005303600000 +557,0.544691600000,0.999304600000,0.004899800000 +558,0.561209400000,0.998325500000,0.004534200000 +559,0.577821500000,0.996898700000,0.004202400000 +560,0.594500000000,0.995000000000,0.003900000000 +561,0.611220900000,0.992600500000,0.003623200000 +562,0.627975800000,0.989742600000,0.003370600000 +563,0.644760200000,0.986444400000,0.003141400000 +564,0.661569700000,0.982724100000,0.002934800000 +565,0.678400000000,0.978600000000,0.002749999000 +566,0.695239200000,0.974083700000,0.002585200000 +567,0.712058600000,0.969171200000,0.002438600000 +568,0.728828400000,0.963856800000,0.002309400000 +569,0.745518800000,0.958134900000,0.002196800000 +570,0.762100000000,0.952000000000,0.002100000000 +571,0.778543200000,0.945450400000,0.002017733000 +572,0.794825600000,0.938499200000,0.001948200000 +573,0.810926400000,0.931162800000,0.001889800000 +574,0.826824800000,0.923457600000,0.001840933000 +575,0.842500000000,0.915400000000,0.001800000000 +576,0.857932500000,0.907006400000,0.001766267000 +577,0.873081600000,0.898277200000,0.001737800000 +578,0.887894400000,0.889204800000,0.001711200000 +579,0.902318100000,0.879781600000,0.001683067000 +580,0.916300000000,0.870000000000,0.001650001000 +581,0.929799500000,0.859861300000,0.001610133000 +582,0.942798400000,0.849392000000,0.001564400000 +583,0.955277600000,0.838622000000,0.001513600000 +584,0.967217900000,0.827581300000,0.001458533000 +585,0.978600000000,0.816300000000,0.001400000000 +586,0.989385600000,0.804794700000,0.001336667000 +587,0.999548800000,0.793082000000,0.001270000000 +588,1.009089200000,0.781192000000,0.001205000000 +589,1.018006400000,0.769154700000,0.001146667000 +590,1.026300000000,0.757000000000,0.001100000000 +591,1.033982700000,0.744754100000,0.001068800000 +592,1.040986000000,0.732422400000,0.001049400000 +593,1.047188000000,0.720003600000,0.001035600000 +594,1.052466700000,0.707496500000,0.001021200000 +595,1.056700000000,0.694900000000,0.001000000000 +596,1.059794400000,0.682219200000,0.000968640000 +597,1.061799200000,0.669471600000,0.000929920000 +598,1.062806800000,0.656674400000,0.000886880000 +599,1.062909600000,0.643844800000,0.000842560000 +600,1.062200000000,0.631000000000,0.000800000000 +601,1.060735200000,0.618155500000,0.000760960000 +602,1.058443600000,0.605314400000,0.000723680000 +603,1.055224400000,0.592475600000,0.000685920000 +604,1.050976800000,0.579637900000,0.000645440000 +605,1.045600000000,0.566800000000,0.000600000000 +606,1.039036900000,0.553961100000,0.000547866700 +607,1.031360800000,0.541137200000,0.000491600000 +608,1.022666200000,0.528352800000,0.000435400000 +609,1.013047700000,0.515632300000,0.000383466700 +610,1.002600000000,0.503000000000,0.000340000000 +611,0.991367500000,0.490468800000,0.000307253300 +612,0.979331400000,0.478030400000,0.000283160000 +613,0.966491600000,0.465677600000,0.000265440000 +614,0.952847900000,0.453403200000,0.000251813300 +615,0.938400000000,0.441200000000,0.000240000000 +616,0.923194000000,0.429080000000,0.000229546700 +617,0.907244000000,0.417036000000,0.000220640000 +618,0.890502000000,0.405032000000,0.000211960000 +619,0.872920000000,0.393032000000,0.000202186700 +620,0.854449900000,0.381000000000,0.000190000000 +621,0.835084000000,0.368918400000,0.000174213300 +622,0.814946000000,0.356827200000,0.000155640000 +623,0.794186000000,0.344776800000,0.000135960000 +624,0.772954000000,0.332817600000,0.000116853300 +625,0.751400000000,0.321000000000,0.000100000000 +626,0.729583600000,0.309338100000,0.000086133330 +627,0.707588800000,0.297850400000,0.000074600000 +628,0.685602200000,0.286593600000,0.000065000000 +629,0.663810400000,0.275624500000,0.000056933330 +630,0.642400000000,0.265000000000,0.000049999990 +631,0.621514900000,0.254763200000,0.000044160000 +632,0.601113800000,0.244889600000,0.000039480000 +633,0.581105200000,0.235334400000,0.000035720000 +634,0.561397700000,0.226052800000,0.000032640000 +635,0.541900000000,0.217000000000,0.000030000000 +636,0.522599500000,0.208161600000,0.000027653330 +637,0.503546400000,0.199548800000,0.000025560000 +638,0.484743600000,0.191155200000,0.000023640000 +639,0.466193900000,0.182974400000,0.000021813330 +640,0.447900000000,0.175000000000,0.000020000000 +641,0.429861300000,0.167223500000,0.000018133330 +642,0.412098000000,0.159646400000,0.000016200000 +643,0.394644000000,0.152277600000,0.000014200000 +644,0.377533300000,0.145125900000,0.000012133330 +645,0.360800000000,0.138200000000,0.000010000000 +646,0.344456300000,0.131500300000,0.000007733333 +647,0.328516800000,0.125024800000,0.000005400000 +648,0.313019200000,0.118779200000,0.000003200000 +649,0.298001100000,0.112769100000,0.000001333333 +650,0.283500000000,0.107000000000,0.000000000000 +651,0.269544800000,0.101476200000,0.000000000000 +652,0.256118400000,0.096188640000,0.000000000000 +653,0.243189600000,0.091122960000,0.000000000000 +654,0.230727200000,0.086264850000,0.000000000000 +655,0.218700000000,0.081600000000,0.000000000000 +656,0.207097100000,0.077120640000,0.000000000000 +657,0.195923200000,0.072825520000,0.000000000000 +658,0.185170800000,0.068710080000,0.000000000000 +659,0.174832300000,0.064769760000,0.000000000000 +660,0.164900000000,0.061000000000,0.000000000000 +661,0.155366700000,0.057396210000,0.000000000000 +662,0.146230000000,0.053955040000,0.000000000000 +663,0.137490000000,0.050673760000,0.000000000000 +664,0.129146700000,0.047549650000,0.000000000000 +665,0.121200000000,0.044580000000,0.000000000000 +666,0.113639700000,0.041758720000,0.000000000000 +667,0.106465000000,0.039084960000,0.000000000000 +668,0.099690440000,0.036563840000,0.000000000000 +669,0.093330610000,0.034200480000,0.000000000000 +670,0.087400000000,0.032000000000,0.000000000000 +671,0.081900960000,0.029962610000,0.000000000000 +672,0.076804280000,0.028076640000,0.000000000000 +673,0.072077120000,0.026329360000,0.000000000000 +674,0.067686640000,0.024708050000,0.000000000000 +675,0.063600000000,0.023200000000,0.000000000000 +676,0.059806850000,0.021800770000,0.000000000000 +677,0.056282160000,0.020501120000,0.000000000000 +678,0.052971040000,0.019281080000,0.000000000000 +679,0.049818610000,0.018120690000,0.000000000000 +680,0.046770000000,0.017000000000,0.000000000000 +681,0.043784050000,0.015903790000,0.000000000000 +682,0.040875360000,0.014837180000,0.000000000000 +683,0.038072640000,0.013810680000,0.000000000000 +684,0.035404610000,0.012834780000,0.000000000000 +685,0.032900000000,0.011920000000,0.000000000000 +686,0.030564190000,0.011068310000,0.000000000000 +687,0.028380560000,0.010273390000,0.000000000000 +688,0.026344840000,0.009533311000,0.000000000000 +689,0.024452750000,0.008846157000,0.000000000000 +690,0.022700000000,0.008210000000,0.000000000000 +691,0.021084290000,0.007623781000,0.000000000000 +692,0.019599880000,0.007085424000,0.000000000000 +693,0.018237320000,0.006591476000,0.000000000000 +694,0.016987170000,0.006138485000,0.000000000000 +695,0.015840000000,0.005723000000,0.000000000000 +696,0.014790640000,0.005343059000,0.000000000000 +697,0.013831320000,0.004995796000,0.000000000000 +698,0.012948680000,0.004676404000,0.000000000000 +699,0.012129200000,0.004380075000,0.000000000000 +700,0.011359160000,0.004102000000,0.000000000000 +701,0.010629350000,0.003838453000,0.000000000000 +702,0.009938846000,0.003589099000,0.000000000000 +703,0.009288422000,0.003354219000,0.000000000000 +704,0.008678854000,0.003134093000,0.000000000000 +705,0.008110916000,0.002929000000,0.000000000000 +706,0.007582388000,0.002738139000,0.000000000000 +707,0.007088746000,0.002559876000,0.000000000000 +708,0.006627313000,0.002393244000,0.000000000000 +709,0.006195408000,0.002237275000,0.000000000000 +710,0.005790346000,0.002091000000,0.000000000000 +711,0.005409826000,0.001953587000,0.000000000000 +712,0.005052583000,0.001824580000,0.000000000000 +713,0.004717512000,0.001703580000,0.000000000000 +714,0.004403507000,0.001590187000,0.000000000000 +715,0.004109457000,0.001484000000,0.000000000000 +716,0.003833913000,0.001384496000,0.000000000000 +717,0.003575748000,0.001291268000,0.000000000000 +718,0.003334342000,0.001204092000,0.000000000000 +719,0.003109075000,0.001122744000,0.000000000000 +720,0.002899327000,0.001047000000,0.000000000000 +721,0.002704348000,0.000976589600,0.000000000000 +722,0.002523020000,0.000911108800,0.000000000000 +723,0.002354168000,0.000850133200,0.000000000000 +724,0.002196616000,0.000793238400,0.000000000000 +725,0.002049190000,0.000740000000,0.000000000000 +726,0.001910960000,0.000690082700,0.000000000000 +727,0.001781438000,0.000643310000,0.000000000000 +728,0.001660110000,0.000599496000,0.000000000000 +729,0.001546459000,0.000558454700,0.000000000000 +730,0.001439971000,0.000520000000,0.000000000000 +731,0.001340042000,0.000483913600,0.000000000000 +732,0.001246275000,0.000450052800,0.000000000000 +733,0.001158471000,0.000418345200,0.000000000000 +734,0.001076430000,0.000388718400,0.000000000000 +735,0.000999949300,0.000361100000,0.000000000000 +736,0.000928735800,0.000335383500,0.000000000000 +737,0.000862433200,0.000311440400,0.000000000000 +738,0.000800750300,0.000289165600,0.000000000000 +739,0.000743396000,0.000268453900,0.000000000000 +740,0.000690078600,0.000249200000,0.000000000000 +741,0.000640515600,0.000231301900,0.000000000000 +742,0.000594502100,0.000214685600,0.000000000000 +743,0.000551864600,0.000199288400,0.000000000000 +744,0.000512429000,0.000185047500,0.000000000000 +745,0.000476021300,0.000171900000,0.000000000000 +746,0.000442453600,0.000159778100,0.000000000000 +747,0.000411511700,0.000148604400,0.000000000000 +748,0.000382981400,0.000138301600,0.000000000000 +749,0.000356649100,0.000128792500,0.000000000000 +750,0.000332301100,0.000120000000,0.000000000000 +751,0.000309758600,0.000111859500,0.000000000000 +752,0.000288887100,0.000104322400,0.000000000000 +753,0.000269539400,0.000097335600,0.000000000000 +754,0.000251568200,0.000090845870,0.000000000000 +755,0.000234826100,0.000084800000,0.000000000000 +756,0.000219171000,0.000079146670,0.000000000000 +757,0.000204525800,0.000073858000,0.000000000000 +758,0.000190840500,0.000068916000,0.000000000000 +759,0.000178065400,0.000064302670,0.000000000000 +760,0.000166150500,0.000060000000,0.000000000000 +761,0.000155023600,0.000055981870,0.000000000000 +762,0.000144621900,0.000052225600,0.000000000000 +763,0.000134909800,0.000048718400,0.000000000000 +764,0.000125852000,0.000045447470,0.000000000000 +765,0.000117413000,0.000042400000,0.000000000000 +766,0.000109551500,0.000039561040,0.000000000000 +767,0.000102224500,0.000036915120,0.000000000000 +768,0.000095394450,0.000034448680,0.000000000000 +769,0.000089023900,0.000032148160,0.000000000000 +770,0.000083075270,0.000030000000,0.000000000000 +771,0.000077512690,0.000027991250,0.000000000000 +772,0.000072313040,0.000026113560,0.000000000000 +773,0.000067457780,0.000024360240,0.000000000000 +774,0.000062928440,0.000022724610,0.000000000000 +775,0.000058706520,0.000021200000,0.000000000000 +776,0.000054770280,0.000019778550,0.000000000000 +777,0.000051099180,0.000018452850,0.000000000000 +778,0.000047676540,0.000017216870,0.000000000000 +779,0.000044485670,0.000016064590,0.000000000000 +780,0.000041509940,0.000014990000,0.000000000000 +781,0.000038733240,0.000013987280,0.000000000000 +782,0.000036142030,0.000013051550,0.000000000000 +783,0.000033723520,0.000012178180,0.000000000000 +784,0.000031464870,0.000011362540,0.000000000000 +785,0.000029353260,0.000010600000,0.000000000000 +786,0.000027375730,0.000009885877,0.000000000000 +787,0.000025524330,0.000009217304,0.000000000000 +788,0.000023793760,0.000008592362,0.000000000000 +789,0.000022178700,0.000008009133,0.000000000000 +790,0.000020673830,0.000007465700,0.000000000000 +791,0.000019272260,0.000006959567,0.000000000000 +792,0.000017966400,0.000006487995,0.000000000000 +793,0.000016749910,0.000006048699,0.000000000000 +794,0.000015616480,0.000005639396,0.000000000000 +795,0.000014559770,0.000005257800,0.000000000000 +796,0.000013573870,0.000004901771,0.000000000000 +797,0.000012654360,0.000004569720,0.000000000000 +798,0.000011797230,0.000004260194,0.000000000000 +799,0.000010998440,0.000003971739,0.000000000000 +800,0.000010253980,0.000003702900,0.000000000000 +801,0.000009559646,0.000003452163,0.000000000000 +802,0.000008912044,0.000003218302,0.000000000000 +803,0.000008308358,0.000003000300,0.000000000000 +804,0.000007745769,0.000002797139,0.000000000000 +805,0.000007221456,0.000002607800,0.000000000000 +806,0.000006732475,0.000002431220,0.000000000000 +807,0.000006276423,0.000002266531,0.000000000000 +808,0.000005851304,0.000002113013,0.000000000000 +809,0.000005455118,0.000001969943,0.000000000000 +810,0.000005085868,0.000001836600,0.000000000000 +811,0.000004741466,0.000001712230,0.000000000000 +812,0.000004420236,0.000001596228,0.000000000000 +813,0.000004120783,0.000001488090,0.000000000000 +814,0.000003841716,0.000001387314,0.000000000000 +815,0.000003581652,0.000001293400,0.000000000000 +816,0.000003339127,0.000001205820,0.000000000000 +817,0.000003112949,0.000001124143,0.000000000000 +818,0.000002902121,0.000001048009,0.000000000000 +819,0.000002705645,0.000000977058,0.000000000000 +820,0.000002522525,0.000000910930,0.000000000000 +821,0.000002351726,0.000000849251,0.000000000000 +822,0.000002192415,0.000000791721,0.000000000000 +823,0.000002043902,0.000000738090,0.000000000000 +824,0.000001905497,0.000000688110,0.000000000000 +825,0.000001776509,0.000000641530,0.000000000000 +826,0.000001656215,0.000000598090,0.000000000000 +827,0.000001544022,0.000000557575,0.000000000000 +828,0.000001439440,0.000000519808,0.000000000000 +829,0.000001341977,0.000000484612,0.000000000000 +830,0.000001251141,0.000000451810,0.000000000000 \ No newline at end of file diff --git a/outputs/expansion_batch04/t3_analytical/jeol_jsmit200/optics_fit.json b/outputs/expansion_batch04/t3_analytical/jeol_jsmit200/optics_fit.json new file mode 100644 index 0000000000000000000000000000000000000000..f2af8204f0c7c2c0ce90a7bedfde724e5eb51ea1 --- /dev/null +++ b/outputs/expansion_batch04/t3_analytical/jeol_jsmit200/optics_fit.json @@ -0,0 +1,87 @@ +{ + "catalog_id": "CHEM-151", + "built_at": "2026-09-26T00:05:56.714310+00:00", + "script": "derive_optics_parameters.py", + "model": "d^2 = 4I/(pi^2 beta a^2) + (Cs a^3/2)^2 + (Cc a dE/E0)^2 + (1.22 lambda/a)^2 at the optimum a; quoted resolution = K_RES d", + "fixed": { + "beta_reduced_A_m2_sr_V": 33333.333333333336, + "energy_spread_eV": 1.5, + "test_probe_current_A": 3e-12, + "edge_resolution_factor": 0.6, + "lens_gap_m": 0.002 + }, + "fitted": { + "c_s": 0.9315669301523783, + "c_c": 0.1320663205093771, + "Cs_at_8mm_m": 0.009315669301523784, + "Cc_at_8mm_m": 0.001320663205093771, + "rms_log_error": 0.026419401556548577 + }, + "bed_lv_resolution_factor": 1.430569028448803, + "reproduced": [ + { + "kv": 30.0, + "wd_mm": 8.0, + "catalogue_nm": 3.0, + "model_nm": 3.0619849421713834, + "probe_nm": 5.103308236952305, + "alpha_mrad": 8.151742790420595, + "rel_error": 0.020661647390461058 + }, + { + "kv": 3.0, + "wd_mm": 6.0, + "catalogue_nm": 8.0, + "model_nm": 7.707058783048531, + "probe_nm": 12.845097971747553, + "alpha_mrad": 10.985859336200035, + "rel_error": -0.03661765211893364 + }, + { + "kv": 1.0, + "wd_mm": 6.0, + "catalogue_nm": 14.999999999999998, + "model_nm": 15.254949626593532, + "probe_nm": 25.424916044322558, + "alpha_mrad": 10.62139488762313, + "rel_error": 0.016996641772902388 + } + ], + "lv": { + "catalogue_nm": 4.0, + "wd_m": 0.005, + "pressure_pa": 10.0, + "hv_model_nm_at_that_wd": 2.7960901714314943 + }, + "caveat_zh": "β与Cs、ΔE与Cc互相替代,拟合不唯一;常数是能复现目录分辨率的等效模型,不是实测透镜数据。", + "environment": { + "python": "3.12.14", + "numpy": "2.3.1", + "platform": "Linux-x86_64" + }, + "checks": [ + { + "id": "fit_within_5_percent", + "ok": true, + "detail": [ + 0.0207, + -0.0366, + 0.017 + ] + }, + { + "id": "cs_cc_positive_and_finite", + "ok": true, + "detail": [ + 0.9315669301523783, + 0.1320663205093771 + ] + }, + { + "id": "bed_factor_above_one", + "ok": true, + "detail": 1.430569028448803 + } + ], + "status": "passed" +} diff --git a/scripts/asset_runtime/ametek_oxtran.py b/scripts/asset_runtime/ametek_oxtran.py new file mode 100644 index 0000000000000000000000000000000000000000..9822be9357fa6bac81a39239067150127b9f21df --- /dev/null +++ b/scripts/asset_runtime/ametek_oxtran.py @@ -0,0 +1,1753 @@ +"""CHEM-147 AMETEK MOCON OX-TRAN 2/22 L oxygen permeation analyzer runtime (ASTM D3985 coulometric method, SI units). + +Physics owned by the host clock (``step`` is the only entry that advances time): + * test-cell block: lumped heat node with a PI-controlled thermoelectric heater/cooler (10-40 degC documented, +/-0.2 K); + * RH generator: first-order approach of both gas streams to the RH setpoint (0 = dry, 5-90 % controlled range from the + task table) with a hidden static bias inside the documented +/-4 % RH accuracy band; + * each of the two cells: removable film cartridge in a drawer, pneumatic clamp, a 1-D Fickian film (implicit finite volume, + exactly conservative) between a test-gas chamber (O2 partial pressure y_O2 (P_baro - p_w)) and a swept carrier-gas + chamber (well-mixed, turnover F/V), temperature (Arrhenius) and water-activity (host coefficient) dependence of P and D, + test-gas edge leak and TruSeal-flushed ambient ingress into the carrier side, air-equilibrated film when mounted; + * one shared Coulox sensor (Faraday: I = 4 F eta n_O2, 1 cc/day = 0.000199 A, first-order response, 10 pA counts, noise) + multiplexed by the sequencer through cell exams and ReZero exams (carrier only, system baseline); + * reported OTR = (I_exam - I_rezero) / (4 F) / area x 760 mmHg / P_baro x 100 / permeant % (no user gain: the 2/22 has no documented + sensor adjustment; out-of-spec certified films mean service), + quantised to the documented resolution; conditioning, individual zero, standard / convergence / continuous test modes. +Permeation templates (P, D at 298 K) come from the asset's oxygen_permeation_library.json (polyVERSE experimental rows); +activation energies, humidity coefficients, chamber volumes, leaks, sensor lag/noise and the thermal plant are explicit host +priors (evidence = assumption). Observed results are computed only from the quantised sensor observations. +""" +from __future__ import annotations + +import copy +import json +import math +import random +import re +from pathlib import Path + +PROTOCOL_VERSION = '1.0.0' +SLUG = 'ametek_oxtran' +ASSET_TYPE_ID = 'instrument.' + SLUG +CATALOG_ID = 'CHEM-147' +ROOT = Path(__file__).resolve().parents[2] +ASSET = ROOT / 'assets/expansion_batch04/t1_thermal' / SLUG +LIBRARY_PATH = ASSET / 'oxygen_permeation_library.json' + +# ---------------------------------------------------------------- documented / physical constants +FARADAY = 96485.33212 +GAS_CONSTANT = 8.314462618 +V_STP_M3_MOL = 0.022414 # m3(STP)/mol, 0 degC 101.325 kPa (cc(STP) convention of OTR and Coulox) +STD_PRESSURE_PA = 101325.0 # 760 mmHg, barometric normalisation target (manual appendix D) +CC_DAY_PER_MOL_S = V_STP_M3_MOL * 1e6 * 86400.0 # 1 mol/s = 1.9366e9 cm3(STP)/day +AMP_PER_CC_DAY = 4 * FARADAY / CC_DAY_PER_MOL_S # 1.993e-4 A per cc/day (manual: 0.000199 A) +COUNT_A = 1e-11 # 1 raw count ~ 10 pA (related 2/28 manual) +AIR_O2_FRACTION = 0.2095 +TEMPERATURE_RANGE_K = (283.15, 313.15) # documented 10 .. 40 degC +TEMPERATURE_ACCURACY_K = 0.2 # documented +/-0.2 degC +RH_RANGE = (0.05, 0.90) # task table: controlled RH 5-90 % (+/-4 %); 0 = dry gas (certified-film method) +RH_ACCURACY = 0.04 +TEST_AREA_M2 = 50e-4 # documented standard film test area +MASK_AREA_RANGE_M2 = (5e-4, 50e-4) # foil masks down to 5 cm2 (product page "5.0 cm2 masked" range) +OTR_RANGE_CC_M2_DAY = (0.005, 200.0) # documented L model, 50 cm2 +OTR_RESOLUTION_CC_M2_DAY = 0.002 # task table (2020 brochure); 2025 brochure/product page list 0.0001 +REPEATABILITY_CC_M2_DAY = 0.002 # "0.002 or 1 %, whichever is greater" +REPEATABILITY_REL = 0.01 +PACKAGE_RANGE_CC_DAY = (0.000025, 1.0) # documented cc/(pkg day) range (L model) +SENSOR_RANGE_MOL_S = PACKAGE_RANGE_CC_DAY[1] / CC_DAY_PER_MOL_S # upper detection limit = 200 cc/(m2 day) x 50 cm2 = 1 cc/day +OVER_RANGE_FACTOR = 1.25 # sensor protection threshold relative to the upper range (engineering) +OVER_RANGE_CURRENT_A = OVER_RANGE_FACTOR * 4 * FARADAY * SENSOR_RANGE_MOL_S # acted on the measured sensor current +MAX_PROVENANCE = 1000 # provenance.read lists the most recent test operations +MAX_FILM_THICKNESS_M = 120 * 25.4e-6 # documented "up to 120 mil" +CARRIER_FLOW_SCCM = 10.0 # per cell, certified-film instruction "carrier gas flow is set to 10 sccm" +SUPPLY_GAUGE_PA = dict(carrier=(137.9e3, 193.1e3), test=(137.9e3, 220.6e3), nominal=172.4e3) # 20-28 / 20-32 psi, 25 psi nominal +TEMPERATURE_DISPLAY_RESOLUTION_K = 0.01 +RH_DISPLAY_RESOLUTION = 0.001 +BAROMETER_RESOLUTION_PA = 10.0 +DRAWER_TRAVEL_M = 0.190 +CLAMP_TRAVEL_M = 0.003 +POWER_SWITCH_ON_RAD = 0.30 +N_FILM_NODES = 32 +MAX_SUBSTEP_S = 10.0 +OPEN_WINDOW_MOL_S_PA = 1e-9 # empty cartridge: conductance of the open 50 cm2 window between the chambers (engineering) +MAX_READINGS = 5000 # readings per test record (schema maxItems) +CELLS = ('A', 'B') + + +class ActionRejected(ValueError): + pass + + +# ---------------------------------------------------------------- schema helpers +def number(unit='1', lo=None, hi=None): + s = {'type': 'number', 'x-unit': unit} + if lo is not None: + s['minimum'] = lo + if hi is not None: + s['maximum'] = hi + return s + + +def obj(properties): + return dict(type='object', properties=properties, required=list(properties), additionalProperties=False) + + +def nullable(s): + return {'anyOf': [s, {'type': 'null'}]} + + +def array(s, minimum=0, maximum=MAX_READINGS): + return dict(type='array', items=s, minItems=minimum, maxItems=maximum) + + +def enum(items): + return {'type': 'string', 'enum': list(items)} + + +BOOL = {'type': 'boolean'} +TEXT = {'type': 'string'} +INT = {'type': 'integer', 'x-unit': '1'} +CELL = enum(CELLS) +PHASE = enum(['idle', 'running', 'succeeded', 'cancelled', 'failed']) +CELL_PHASE = enum(['idle', 'zero_start', 'conditioning', 'testing', 'zero_end', 'succeeded', 'cancelled', 'failed']) + + +def validate(s, v): + if 'anyOf' in s: + for o in s['anyOf']: + try: + validate(o, v) + return + except ActionRejected: + pass + raise ActionRejected('INVALID_ARGUMENT') + k = s.get('type') + if k in ('number', 'integer'): + if isinstance(v, bool) or not isinstance(v, (int, float)) or not math.isfinite(v) or (k == 'integer' and type(v) is not int): + raise ActionRejected('INVALID_ARGUMENT') + if not s.get('minimum', -math.inf) <= v <= s.get('maximum', math.inf): + raise ActionRejected('INVALID_ARGUMENT') + elif k == 'object': + if not isinstance(v, dict) or set(v) != set(s['properties']): + raise ActionRejected('INVALID_ARGUMENT') + for key, value in v.items(): + validate(s['properties'][key], value) + elif k == 'array': + if not isinstance(v, list) or not s.get('minItems', 0) <= len(v) <= s.get('maxItems', math.inf): + raise ActionRejected('INVALID_ARGUMENT') + for x in v: + validate(s['items'], x) + elif k == 'boolean' and type(v) is not bool: + raise ActionRejected('INVALID_ARGUMENT') + elif k == 'string' and not isinstance(v, str): + raise ActionRejected('INVALID_ARGUMENT') + elif k == 'null' and v is not None: + raise ActionRejected('INVALID_ARGUMENT') + if 'enum' in s and v not in s['enum']: + raise ActionRejected('INVALID_ARGUMENT') + + +_LIBRARY = None + + +def library(): + global _LIBRARY + if _LIBRARY is None: + _LIBRARY = {r['id']: r for r in json.loads(LIBRARY_PATH.read_text())['templates']} + return _LIBRARY + + +def quantize(value, step): + return round(value / step) * step + + +def saturation_pressure_pa(T): + """Buck (1996) saturation vapour pressure of water over liquid water.""" + c = T - 273.15 + return 611.21 * math.exp((18.678 - c / 234.5) * (c / (257.14 + c))) + + +def molar_flow(sccm): + return sccm * 1e-6 / 60.0 / V_STP_M3_MOL + + +def cc_m2_day(mol_m2_s): + return None if mol_m2_s is None else mol_m2_s * CC_DAY_PER_MOL_S + + +# ---------------------------------------------------------------- inputs +PLANT_EXAMPLE = dict(ambient_k=296.15, ambient_rh=0.45, barometric_pa=101325.0, block_heat_capacity_j_k=4000.0, block_loss_w_k=1.5, tec_max_w=40.0, + controller_gain_w_k=25.0, controller_integral_s=600.0, temperature_sensor_bias_k=0.05, rh_time_constant_s=600.0, rh_bias=0.012, + test_chamber_volume_m3=4e-6, carrier_chamber_volume_m3=4e-6, test_gas_flow_sccm_per_cell=10.0, catalyst_removal_efficiency=0.999, + edge_leak_mol_s_pa=2.5e-20, ambient_ingress_mol_s_pa=1e-18, truseal_flush_efficiency=0.95, rezero_path_leak_mol_s=5e-16, + sensor_time_constant_s=45.0, sensor_efficiency=0.998, sensor_background_a=2e-11, sensor_noise_a=4e-10, sensor_relative_noise=0.003, + noise_seed=147, clamp_actuation_s=2.0, drawer_speed_m_s=0.10, carrier_total_flow_sccm=60.0, test_total_flow_sccm=20.0, accept_engineering=True) +PLANT = obj(dict(ambient_k=number('K', 283.15, 308.15), ambient_rh=number('1', 0.0, 0.95), barometric_pa=number('Pa', 53300.0, 113300.0), + block_heat_capacity_j_k=number('J/K', 200.0, 50000.0), block_loss_w_k=number('W/K', 0.05, 50.0), tec_max_w=number('W', 2.0, 400.0), + controller_gain_w_k=number('W/K', 0.1, 1000.0), controller_integral_s=number('s', 5.0, 20000.0), + temperature_sensor_bias_k=number('K', -TEMPERATURE_ACCURACY_K, TEMPERATURE_ACCURACY_K), + rh_time_constant_s=number('s', 5.0, 20000.0), rh_bias=number('1', -RH_ACCURACY, RH_ACCURACY), + test_chamber_volume_m3=number('m^3', 1e-7, 1e-4), carrier_chamber_volume_m3=number('m^3', 1e-7, 1e-4), + test_gas_flow_sccm_per_cell=number('cm^3/min', 1.0, 100.0), catalyst_removal_efficiency=number('1', 0.0, 1.0), + edge_leak_mol_s_pa=number('mol/(s*Pa)', 0.0, 1e-14), ambient_ingress_mol_s_pa=number('mol/(s*Pa)', 0.0, 1e-13), + truseal_flush_efficiency=number('1', 0.0, 1.0), rezero_path_leak_mol_s=number('mol/s', 0.0, 1e-10), + sensor_time_constant_s=number('s', 0.5, 1800.0), sensor_efficiency=number('1', 0.8, 1.05), sensor_background_a=number('A', 0.0, 1e-7), + sensor_noise_a=number('A', 0.0, 1e-7), sensor_relative_noise=number('1', 0.0, 0.1), noise_seed=INT, + clamp_actuation_s=number('s', 0.1, 60.0), drawer_speed_m_s=number('m/s', 0.005, 2.0), + carrier_total_flow_sccm=number('cm^3/min', 1.0, 500.0), test_total_flow_sccm=number('cm^3/min', 1.0, 500.0), accept_engineering=BOOL)) +GAS_EXAMPLE = dict(carrier_h2_fraction=0.02, carrier_o2_impurity_fraction=2e-6, carrier_supply_gauge_pa=172.4e3, test_o2_fraction=0.999, test_supply_gauge_pa=172.4e3, + accept_gas_supply=True) +GAS = obj(dict(carrier_h2_fraction=number('1', 0.0, 0.05), carrier_o2_impurity_fraction=number('1', 0.0, 1e-3), carrier_supply_gauge_pa=number('Pa', 0.0, 400e3), + test_o2_fraction=number('1', 0.01, 1.0), + test_supply_gauge_pa=number('Pa', 0.0, 400e3), accept_gas_supply=BOOL)) +MOUNT_EXAMPLE = dict(cell='A', template_id='poly_ethylene_terephthalate', thickness_m=100e-6, exposed_area_m2=TEST_AREA_M2, permeability_override_mol_m_per_m2_s_pa=None, + diffusivity_override_m2_s=None, permeability_activation_energy_j_mol=45000.0, diffusivity_activation_energy_j_mol=45000.0, + humidity_coefficient=None, accept_transport_assumptions=True) +MOUNT = obj(dict(cell=CELL, template_id=TEXT, thickness_m=number('m', 1e-6, MAX_FILM_THICKNESS_M), exposed_area_m2=number('m^2', *MASK_AREA_RANGE_M2), + permeability_override_mol_m_per_m2_s_pa=nullable(number('mol*m/(m^2*s*Pa)', 1e-22, 1e-10)), + diffusivity_override_m2_s=nullable(number('m^2/s', 1e-17, 1e-6)), + permeability_activation_energy_j_mol=number('J/mol', 0.0, 150000.0), diffusivity_activation_energy_j_mol=number('J/mol', 0.0, 150000.0), + humidity_coefficient=nullable(number('1', 0.0, 20.0)), accept_transport_assumptions=BOOL)) +TEST_CFG_EXAMPLE = dict(cell='A', test_mode='convergence', cycles=10, exam_minutes=30.0, conditioning_hours=0.5, individual_zero='end', convergence_percent=1.0, + convergence_count=3, max_cycles=60, report_basis='area', declared_area_m2=TEST_AREA_M2, declared_thickness_m=100e-6, temperature_tolerance_k=0.2) +TEST_CFG = obj(dict(cell=CELL, test_mode=enum(['continuous', 'standard', 'convergence']), cycles=number('1', 1, 1000), exam_minutes=number('min', 1.0, 600.0), + conditioning_hours=number('h', 0.0, 200.0), individual_zero=enum(['none', 'start', 'end', 'both']), convergence_percent=number('%', 0.1, 20.0), + convergence_count=number('1', 2, 20), max_cycles=number('1', 1, 2000), report_basis=enum(['area', 'package']), + declared_area_m2=number('m^2', *MASK_AREA_RANGE_M2), declared_thickness_m=nullable(number('m', 1e-6, MAX_FILM_THICKNESS_M)), + temperature_tolerance_k=number('K', 0.05, 5.0))) +TEST_CFG['properties']['cycles'] = INT | dict(minimum=1, maximum=1000) +TEST_CFG['properties']['convergence_count'] = INT | dict(minimum=2, maximum=20) +TEST_CFG['properties']['max_cycles'] = INT | dict(minimum=1, maximum=2000) +INSTRUMENT_EXAMPLE = dict(permeant_concentration_percent=100.0, rezero_enabled=True, rezero_frequency=2, rezero_exam_minutes=30.0, barometer_mode='auto', manual_barometer_pa=None) +INSTRUMENT = obj(dict(permeant_concentration_percent=number('%', 1.0, 100.0), rezero_enabled=BOOL, rezero_frequency=INT | dict(minimum=1, maximum=10), + rezero_exam_minutes=number('min', 1.0, 600.0), barometer_mode=enum(['auto', 'manual']), manual_barometer_pa=nullable(number('Pa', 53300.0, 113300.0)))) +READING = obj(dict(index=INT, kind=enum(['exam', 'individual_zero']), time_s=number('s'), sensor_counts=INT, otr_mol_m2_s=nullable(number('mol/(m^2*s)')), + otr_cc_m2_day=nullable(number('cm^3/(m^2*d)')), otr_mol_pkg_s=number('mol/s'), otr_cc_pkg_day=number('cm^3/d'), + temperature_k=nullable(number('K')), rh_fraction=number('1'), barometric_pa=number('Pa'))) +ZERO = obj(dict(time_s=number('s'), sensor_counts=INT, current_a=number('A'))) +RESULT = obj(dict(operation_id=nullable(TEXT), cell=CELL, phase=PHASE, cell_phase=CELL_PHASE, elapsed_s=number('s'), exam_count=INT, + readings=array(READING), rezero_readings=array(ZERO), individual_zero_mol_m2_s=nullable(number('mol/(m^2*s)')), + final_otr_mol_m2_s=nullable(number('mol/(m^2*s)')), final_otr_cc_m2_day=nullable(number('cm^3/(m^2*d)')), + final_otr_cc_pkg_day=nullable(number('cm^3/d')), converged=BOOL, repeatability_relative=nullable(number('1')), + within_repeatability_spec=nullable(BOOL), permeance_mol_m2_s_pa=nullable(number('mol/(m^2*s*Pa)')), + permeability_mol_m_per_m2_s_pa=nullable(number('mol*m/(m^2*s*Pa)')), permeability_barrer=nullable(number('Barrer')), + conditions=obj(dict(target_k=nullable(number('K')), target_rh=number('1'), permeant_concentration_percent=nullable(number('%')), + declared_area_m2=nullable(number('m^2')), declared_thickness_m=nullable(number('m')), report_basis=nullable(TEXT), + carrier_flow_sccm=number('cm^3/min'), exam_minutes=nullable(number('min')))), + validity=enum(['not_completed', 'valid', 'below_range', 'over_range', 'sensor_over_range', 'not_converged', 'temperature_out_of_tolerance', 'humidity_out_of_tolerance', 'cancelled']), + terminal_reason=nullable(TEXT), template_source=nullable(TEXT), evidence=TEXT)) +ANALYSIS = obj(dict(readings_mol_m2_s=array(number('mol/(m^2*s)', -1e-3, 1e-3), 1, MAX_READINGS), individual_zero_mol_m2_s=nullable(number('mol/(m^2*s)', -1e-3, 1e-3)), + window=INT | dict(minimum=1, maximum=100), driving_partial_pressure_pa=number('Pa', 1.0, 2e5), thickness_m=nullable(number('m', 1e-7, 0.01)), + convergence_percent=number('%', 0.01, 50.0))) +ANALYSIS_OUTPUT = obj(dict(steady_state_otr_mol_m2_s=number('mol/(m^2*s)'), steady_state_otr_cc_m2_day=number('cm^3/(m^2*d)'), repeatability_relative=nullable(number('1')), + converged=BOOL, permeance_mol_m2_s_pa=number('mol/(m^2*s*Pa)'), permeability_mol_m_per_m2_s_pa=nullable(number('mol*m/(m^2*s*Pa)')), + permeability_barrer=nullable(number('Barrer')), evidence=TEXT)) +LEDGER_KEYS = ['film_mounted_mol', 'film_unmounted_mol', 'film_air_exchange_mol', 'film_test_side_in_mol', 'film_to_carrier_mol', 'film_content_mol', 'film_residual_mol', + 'carrier_in_mol', 'edge_leak_mol', 'ambient_ingress_mol', 'carrier_o2_impurity_mol', 'open_cell_mol', 'to_sensor_mol', 'to_vent_mol', 'released_to_air_mol', + 'carrier_chamber_mol', 'carrier_residual_balance_mol', 'rezero_stream_mol', 'sensor_consumed_mol', 'sensor_passthrough_mol', 'sensor_input_mol', + 'sensor_in_transit_mol', 'sensor_discarded_mol', 'sensor_balance_residual_mol', 'carrier_gas_used_mol', 'test_gas_used_mol', 'tec_heat_j', 'ambient_exchange_j', 'block_thermal_j', 'energy_residual_j', + 'over_range_events'] +LEDGER = obj({k: number('1' if k == 'over_range_events' else 'J' if k.endswith('_j') else 'mol') for k in LEDGER_KEYS}) + +# ---------------------------------------------------------------- capabilities +CAPS = {} + + +def cap(k, s, o, e, c, meaning, visibility='agent', kind='device_command'): + CAPS[k] = dict(input_schema=s, output_schema=o, example_arguments=e, component_ids=list(c) if isinstance(c, (list, tuple)) else [c], function_zh=meaning, + visibility=visibility, kind=kind, effects=[]) + + +CONFIGURED = obj(dict(configured=BOOL)) +CELL_ARG = obj(dict(cell=CELL)) +cap('plant.configure', PLANT, CONFIGURED, PLANT_EXAMPLE, ['thermal_module', 'rh_generator', 'coulox_sensor'], + '宿主声明实验室环境、测试池热容/散热/热电上限与PI参数、湿度发生器时间常数与偏差、腔体体积、流量、泄漏、传感器响应/噪声等工程参数(须显式接受)', 'evaluator', 'configuration') +cap('gas.configure', GAS, CONFIGURED, GAS_EXAMPLE, ['carrier_gas_inlet', 'test_gas_inlet'], + '宿主声明外部气源:载气H₂份额(厂家98/2 N₂/H₂)、测试气氧份额(厂家≥99.9% O₂,也可接空气)与两路供气表压', 'evaluator', 'configuration') +cap('instrument.configure', INSTRUMENT, CONFIGURED, INSTRUMENT_EXAMPLE, 'controller_board', + '仪器级测试参数:渗透物浓度(%,用于归一到100% O₂)、ReZero开关/频率/检测时长、气压计自动或手动', 'agent', 'configuration') +cap('test.configure', TEST_CFG, CONFIGURED, TEST_CFG_EXAMPLE, 'controller_board', + '单池测试方法:模式(连续/标准N周期/收敛)、检测分钟、调理小时、单池零点(无/开始/结束/两者)、收敛判据、报告基准(面积/整包)、声明面积与厚度、温度容差', 'agent', 'configuration') +cap('power.set', obj(dict(enabled=BOOL)), obj(dict(enabled=BOOL)), dict(enabled=True), 'power_switch', + '开关整机电源;断电停止气流、温控与传感器、取消进行中的测试(已记录的读数保留),夹紧状态保持(工程假设)') +cap('thermal.set_temperature', obj(dict(target_k=number('K', *TEMPERATURE_RANGE_K))), obj(dict(target_k=number('K'))), dict(target_k=296.15), 'thermal_module', + '只写入测试池目标温度(10–40°C);实际温度由热电PI控温随宿主step演化') +cap('humidity.set', obj(dict(rh_fraction=number('1', 0.0, RH_RANGE[1]))), obj(dict(rh_fraction=number('1'))), dict(rh_fraction=0.0), 'rh_generator', + '只写入载气与测试气的相对湿度目标(0=干气,或5–90%受控范围);实际湿度按一阶响应趋近,含±4%内的静态偏差') +cap('drawer.move', obj(dict(cell=CELL, open=BOOL)), obj(dict(cell=CELL, target_m=number('m'))), dict(cell='A', open=True), ['drawer_a', 'drawer_b'], + '宿主(操作者/机器人代理)以有限速度拉开或推回测试池抽屉;须先松开夹紧', 'evaluator', 'robot_skill') +cap('sample.mount', MOUNT, obj(dict(cell=CELL, mounted=BOOL, film_o2_mol=number('mol'))), MOUNT_EXAMPLE, ['cartridge_a', 'cartridge_b', 'film_a', 'film_b'], + '宿主在台面把膜样(涂Apiezon脂)装入拉出的测试盒;绑定模板库记录(P、D)与显式活化能/湿度系数/覆盖面积(掩膜)先验;膜内初始为与空气平衡的溶解氧', 'evaluator', 'robot_skill') +cap('sample.unmount', CELL_ARG, obj(dict(cell=CELL, removed_film_o2_mol=number('mol'))), dict(cell='A'), ['cartridge_a', 'cartridge_b'], + '宿主从拉出的测试盒取下膜样(膜内溶解氧随膜离开)', 'evaluator', 'robot_skill') +cap('cell.load_unload', CELL_ARG, obj(dict(cell=CELL, clamping=BOOL)), dict(cell='A'), ['button_load_a', 'button_load_b', 'clamp_a', 'clamp_b'], + '面板装卸键:未夹紧时(抽屉须已推到底)气动夹紧测试盒,已夹紧时松开(该池测试须已结束);动作需要有限时间') +cap('test.start', CELL_ARG, obj(dict(operation_id=TEXT)), dict(cell='A'), ['controller_board', 'coulox_sensor'], + '开始单池测试:核对通电、配置、气源压力、夹紧;按方法依次单池零点→调理→检测周期→结束零点,结果由传感器量化观测计算') +cap('test.stop', CELL_ARG, obj(dict(cell=CELL, phase=PHASE, exam_count=INT)), dict(cell='A'), 'controller_board', + '停止该池检测序列:连续模式(已有检测)按操作者停止正常结束——设了结束零点则先测零点,再按已测读数给出结果;其他情况为终止(已记录读数保留)。膜仍在池内、测试气切回载气冲洗') +cap('test.result', CELL_ARG, RESULT, dict(cell='A'), 'controller_board', + '返回该池最近一次测试的读数序列、ReZero基线、最终OTR、重复性、名义渗透率与有效性;所有角色都隐去所选模板身份', 'agent', 'query') +cap('analysis.otr', ANALYSIS, ANALYSIS_OUTPUT, dict(readings_mol_m2_s=[3.02e-8, 3.03e-8, 3.03e-8], individual_zero_mol_m2_s=None, window=3, driving_partial_pressure_pa=101325.0, + thickness_m=25e-6, convergence_percent=1.0), 'controller_board', + '纯函数:由读数序列求稳态OTR(末窗口均值减单池零点)、相对重复性、渗透量与渗透率(名义驱动压差、厚度先验)', 'agent', 'analysis') +cap('ledger.read', obj({}), LEDGER, {}, 'controller_board', '受限O₂物质账(膜、载气腔、泄漏、传感器、排空)与测试池热量账', 'evaluator', 'query') +cap('provenance.read', obj({}), obj(dict(cell_a=nullable(TEXT), cell_b=nullable(TEXT), operations=array(obj(dict(operation_id=TEXT, source=nullable(TEXT))), 0, MAX_PROVENANCE))), {}, 'controller_board', + '受限:两池当前膜样与最近1000次测试所用模板记录的来源', 'evaluator', 'query') +cap('sim.step', obj(dict(dt_s=number('s', 0.0, 86400.0))), obj(dict(time_s=number('s'))), dict(dt_s=60.0), 'controller_board', '唯一宿主时间推进(纳秒整数时钟,余数累计)', 'evaluator', 'simulation') +UNSUPPORTED = { + 'hardware.connect': '无真实Ethernet/USB通信、WinPerm 2/PermWare或PERM-NET Lite连接', + 'robot.mount_film': '无机器人切膜、涂脂、装夹与抽屉操作验证(由宿主sample.mount/drawer.move代理)', + 'package.test': '未选整包/容器测试适配器(Package testing adapter)', + 'cartridge.reduced_area': '未选5.64cm²缩小面积测试盒(量程上限×9);仅支持箔掩膜覆盖面积', + 'cartridge.edge_effect': '未选边缘效应测试盒', + 'cartridge.blister': '未选泡罩测试盒', + 'test_mode.convergence_by_hours': '“按小时收敛”模式的判据未公开(帮助系统不可得),未实现', + 'test.qc_mode': 'QC通过/不通过模式未实现', + 'test.auto_method': '自动测试方法开发(Auto-Test)未实现', + 'test.sequencing': '多条件顺序测试(Sequential testing)未实现;可由宿主按条件重复test.configure/test.start', + 'report.export': '报告打印/USB导出未实现(结果经test.result返回)', + 'accuracy.certification': '无认证膜实测、NIST可溯源验证或厂家准确度实验', + 'sensor.adjust': '2/22认证膜说明:认证膜结果超出允差时“分析仪可能需要维修”(联系厂家服务),只有2/12R要求校准;产品页与规格书称Coulox为绝对传感器、无需校准。' + '“Permeant Sensor Adjustment”只见于同机身2/28手册附录F,2/22未公开该功能,故不提供用户增益调整', +} +for k, v in UNSUPPORTED.items(): + cap(k, obj({}), obj({}), {}, 'controller_board', v) + +# ---------------------------------------------------------------- state slots +SLOTS = {} + + +def slot(k, schema, unit, origin, component, meaning, visibility='agent', reference=None): + SLOTS[k] = dict(schema=schema, unit=unit, origin=origin, component=component, meaning=meaning, visibility=visibility, reference=reference) + + +OTR_REF = '按760mmHg与100%渗透物归一的单位面积氧透过率(cc指0°C、101.325kPa标准体积;×1.9366e9=cc/(m²·day))。' +slot('clock.time_s', number('s'), 's', 'derived', 'controller_board', '宿主时钟;read不推进') +for k, c, m in [('plant.configured', 'thermal_module', '工程过程参数已声明'), ('gas.configured', 'carrier_gas_inlet', '外部气源已声明'), + ('instrument.configured', 'controller_board', '仪器级测试参数已设定'), ('power.enabled', 'power_switch', '整机通电'), + ('gas.supply_ok', 'carrier_gas_inlet', '两路供气表压在厂家范围内(载气20–28psi、测试气20–32psi)'), + ('sensor.over_range', 'coulox_sensor', '传感器处于超量程保护(旁路)')]: + slot(k, BOOL, '1', 'derived', c, m) +slot('thermal.target_k', number('K'), 'K', 'setpoint', 'thermal_module', '测试池目标温度,只是目标') +slot('thermal.indicated_k', nullable(number('K')), 'K', 'sensor', 'thermal_module', '测试池温度显示(0.01K量化,含±0.2K内的静态偏差);断电为null') +slot('humidity.target_fraction', number('1'), '1', 'setpoint', 'rh_generator', '载气与测试气相对湿度目标,只是目标(0=干气)') +slot('humidity.indicated_fraction', nullable(number('1')), '1', 'sensor', 'rh_generator', '仪器显示的相对湿度(按其控制模型;不含静态偏差,0.001量化);断电为null') +slot('barometer.indicated_pa', nullable(number('Pa')), 'Pa', 'sensor', 'barometer', '内置气压计读数(10Pa量化);断电为null', reference='绝对大气压。') +slot('sensor.raw_counts', nullable(INT), '1', 'sensor', 'coulox_sensor', '传感器当前电流原始计数(1计数≈10pA,含与检测读数同源的相关测量噪声);断电为null') +slot('sensor.route', enum(['bypass', 'A', 'B', 'Z']), '1', 'derived', 'flow_controllers', '当前送往传感器的气流:旁路/A池/B池/ReZero') +slot('sequence.slot_remaining_s', nullable(number('s')), 's', 'derived', 'controller_board', '当前检测时段剩余时间;无序列为null') +for c in 'ab': + C_ = c.upper() + slot(f'drawer_{c}.position_m', number('m', 0.0, DRAWER_TRAVEL_M), 'm', 'scene', f'drawer_{c}', f'{C_}池抽屉拉出距离(0=推到底,0.190m=全开)', 'evaluator', + '资产坐标−Y方向(朝操作者)平移。') + slot(f'clamp_{c}.position_m', number('m', 0.0, CLAMP_TRAVEL_M), 'm', 'scene', f'clamp_{c}', f'{C_}池气动压板下压行程(0=松开,0.003m=夹紧)', 'evaluator', '资产坐标−Z方向平移。') + slot(f'cell_{c}.drawer_closed', BOOL, '1', 'derived', f'drawer_{c}', f'{C_}池抽屉已推到底且未在移动') + slot(f'cell_{c}.clamped', BOOL, '1', 'derived', f'clamp_{c}', f'{C_}池测试盒已气动夹紧(动作完成)') + slot(f'cell_{c}.clamp_moving', BOOL, '1', 'derived', f'clamp_{c}', f'{C_}池气动压板正在夹紧或松开行程中(此时装卸键被拒绝)') + slot(f'cell_{c}.method_configured', BOOL, '1', 'derived', 'controller_board', f'{C_}池已用test.configure设定测试方法') + slot(f'cell_{c}.indicator_on', BOOL, '1', 'derived', f'lamp_cell_{c}', f'{C_}池状态灯(本资产映射:已夹紧且通电=亮)') + slot(f'cell_{c}.film_mounted', BOOL, '1', 'derived', f'cartridge_{c}', f'{C_}池测试盒内装有膜样') + slot(f'cell_{c}.phase', CELL_PHASE, '1', 'derived', 'controller_board', f'{C_}池测试阶段(单池零点/调理/检测/结束零点/完成;前面板公开显示)') + slot(f'cell_{c}.exam_count', INT, '1', 'derived', 'controller_board', f'{C_}池本次测试已完成的检测次数(前面板公开显示)') + slot(f'cell_{c}.last_otr_mol_m2_s', nullable(number('mol/(m^2*s)')), 'mol/(m^2*s)', 'sensor', 'controller_board', + f'{C_}池最近一次检测报告的OTR(量化后;未检测为null;前面板公开显示)', reference=OTR_REF) + slot(f'cell_{c}.final_otr_mol_m2_s', nullable(number('mol/(m^2*s)')), 'mol/(m^2*s)', 'sensor', 'controller_board', f'{C_}池最近一次完成测试的最终OTR(扣除单池零点;前面板公开显示)', + reference=OTR_REF) + for k, u, m in [('flux_mol_s', 'mol/s', '膜向载气腔的真实O₂通量(膜出口面)'), ('film_o2_mol', 'mol', '膜内溶解氧总量'), + ('test_side_o2_pa', 'Pa', '测试气腔O₂分压'), ('carrier_side_o2_mol', 'mol', '载气腔内O₂量'), ('leak_mol_s', 'mol/s', '边缘泄漏与环境渗入之和')]: + slot(f'truth.cell_{c}.{k}', number(u), u, 'process_truth', f'cartridge_{c}' if k != 'test_side_o2_pa' else f'cell_head_{c}', f'{C_}池' + m, 'evaluator', + '测试气腔内O₂的绝对分压(全混体积)。' if k == 'test_side_o2_pa' else None) +for k, u, c, m in [('truth.block_temperature_k', 'K', 'thermal_module', '测试池块真实温度'), ('truth.rh_fraction', '1', 'rh_generator', '气流真实相对湿度(含静态偏差)'), + ('truth.sensor_current_a', 'A', 'coulox_sensor', '传感器真实电流(无量化与噪声)'), ('truth.sensor_input_mol_s', 'mol/s', 'coulox_sensor', '进入传感器的O₂摩尔流'), + ('truth.tec_power_w', 'W', 'thermal_module', '热电模块瞬时热功率(正=加热)')]: + slot(k, number(u), u, 'process_truth', c, m, 'evaluator') +slot('power.angle_rad', number('rad'), 'rad', 'scene', 'power_switch', '后置电源摇臂开关姿态:0关、0.30rad开', 'evaluator') + + +def analyze_otr(readings_mol_m2_s, individual_zero_mol_m2_s, window, driving_partial_pressure_pa, thickness_m, convergence_percent): + """Pure steady-state arithmetic on supplied observations (no process truth).""" + k = min(window, len(readings_mol_m2_s)) + last = readings_mol_m2_s[-k:] + mean = sum(last) / k + zero = individual_zero_mol_m2_s or 0.0 + ss = mean - zero + rep = None + if k >= 2 and abs(mean) > 0: + sd = math.sqrt(sum((x - mean) ** 2 for x in last) / (k - 1)) + rep = sd / abs(mean) + converged = k >= 2 and all(abs(last[i] - last[i - 1]) <= convergence_percent / 100.0 * max(abs(last[i]), 1e-30) for i in range(1, k)) + permeance = ss / driving_partial_pressure_pa + perm = None if thickness_m is None else permeance * thickness_m + return dict(steady_state_otr_mol_m2_s=ss, steady_state_otr_cc_m2_day=ss * CC_DAY_PER_MOL_S, repeatability_relative=rep, converged=converged, + permeance_mol_m2_s_pa=permeance, permeability_mol_m_per_m2_s_pa=perm, permeability_barrer=None if perm is None else perm / BARRER_SI, + evidence='mean of the last window readings minus the supplied individual zero; permeance = OTR / supplied driving partial pressure; ' + 'permeability = permeance x supplied thickness (Barrer = 3.3464e-16 mol m/(m2 s Pa))') + + +BARRER_SI = 1e-10 * (1e-6 / V_STP_M3_MOL) * 1e-2 / (1e-4 * 101325.0 / 76.0) + + +def is_stable(values, k, percent, floor): + """Convergence by cycles: over the last k intervals every step and the cumulative drift stay within max(percent of the value, floor).""" + if len(values) < k + 1: + return False + last = values[-(k + 1):] + allow = max(percent / 100.0 * abs(last[-1]), floor) + return all(abs(last[i] - last[i - 1]) <= allow for i in range(1, len(last))) and abs(last[-1] - last[0]) <= allow + + +# ---------------------------------------------------------------- film numerics +def film_chamber_step(c, dx, D, c_top, n_h, sigma, area, q_in, kh, dt): + """Backward-Euler film and well-mixed carrier chamber solved together (one tridiagonal system of n+1 unknowns). + + Unknowns: film cells x_i (mol/m3) and y = sigma n_h, the film-equivalent concentration of the chamber O2 (sigma = S R T / V_h). + Chamber: n_h' - n_h = dt (A J_bot' + q_in - kh n_h'). The matrix is a strictly diagonally dominant M-matrix, so the step is + unconditionally stable and non-negative for any film permeance and chamber volume, and exactly conservative: + sum((x' - x) dx) A + (n_h' - n_h) = dt (A J_top + q_in - kh n_h'). Returns (x', n_h', J_top_in, J_bot_out).""" + n = len(c) + r = D * dt / (dx * dx) + beta = 2.0 * dt * area * D * sigma / dx + N = n + 1 + a = [-r] * N + b = [1.0 + 2.0 * r] * N + e = [-r] * N + d = list(c) + [sigma * n_h + dt * sigma * q_in] + a[0] = 0.0 + b[0] += r + d[0] += 2.0 * r * c_top + b[n - 1] += r + e[n - 1] = -2.0 * r + a[n] = -beta + b[n] = 1.0 + beta + dt * kh + e[n] = 0.0 + cp = [0.0] * N + dp = [0.0] * N + cp[0] = e[0] / b[0] + dp[0] = d[0] / b[0] + for i in range(1, N): + m = b[i] - a[i] * cp[i - 1] + cp[i] = e[i] / m + dp[i] = (d[i] - a[i] * dp[i - 1]) / m + x = [0.0] * N + x[-1] = dp[-1] + for i in range(N - 2, -1, -1): + x[i] = dp[i] - cp[i] * x[i + 1] + y = x.pop() + return x, y / sigma, 2.0 * D * (c_top - x[0]) / dx, 2.0 * D * (x[-1] - y) / dx + + +def film_step(c, dx, D, c_top, c_bot, dt): + """Backward-Euler finite-volume diffusion step (Dirichlet faces at +/- dx/2); returns (new c, J_top_in, J_bot_out) in mol/(m2 s). + + Exactly conservative: sum((c_new - c_old) dx) = (J_top_in - J_bot_out) dt.""" + n = len(c) + r = D * dt / (dx * dx) + a = [-r] * n + b = [1.0 + 2.0 * r] * n + e = [-r] * n + d = list(c) + b[0] = 1.0 + 3.0 * r; d[0] += 2.0 * r * c_top; a[0] = 0.0 + b[-1] = 1.0 + 3.0 * r; d[-1] += 2.0 * r * c_bot; e[-1] = 0.0 + if n == 1: + b[0] = 1.0 + 4.0 * r + d[0] = c[0] + 2.0 * r * (c_top + c_bot) + cp = [0.0] * n + dp = [0.0] * n + cp[0] = e[0] / b[0] + dp[0] = d[0] / b[0] + for i in range(1, n): + m = b[i] - a[i] * cp[i - 1] + cp[i] = e[i] / m + dp[i] = (d[i] - a[i] * dp[i - 1]) / m + x = [0.0] * n + x[-1] = dp[-1] + for i in range(n - 2, -1, -1): + x[i] = dp[i] - cp[i] * x[i + 1] + j_top = 2.0 * D * (c_top - x[0]) / dx + j_bot = 2.0 * D * (x[-1] - c_bot) / dx + return x, j_top, j_bot + + +class AmetekOxtranRuntime: + """One OX-TRAN 2/22 L instance; the host clock is the only time source (``step``).""" + + def __init__(self, instance_id='oxtran_01'): + self.instance_id = instance_id + self.time_ns = 0 + self._clock_remainder_ns = 0.0 + self.revision = 0 + self.plant = None + self.gas = None + self.instrument = None + self.power = False + self.target_k = 296.15 + self.T = 296.15 + self.integral_w = 0.0 + self.tec_w = 0.0 + self.rh_target = 0.0 + self.rh_model = 0.0 + self.rng = random.Random(0) + self.cells = {c: dict(cfg=None, drawer=0.0, drawer_move=None, clamp=0.0, clamp_move=None, clamped=False, film=None, conc=None, + p_up=0.0, n_h=0.0, test=None, last_otr=None, final_otr=None, test_counter=0, exam_count=0, phase='idle', source=None, + flux=0.0, leak=0.0) for c in CELLS} + self.sensor_I = 0.0 # total sensor current = O2 part + background part (noise-free, evaluator truth) + self.sensor_I_o2 = 0.0 + self.sensor_I_bg = 0.0 + self.noise_abs = 0.0 # correlated measurement noise states (A, relative) + self.noise_rel = 0.0 + self.sensor_in = 0.0 + self.route = 'bypass' + self.over_range = False + self.seq = None # dict(kind, start_ns, end_ns) of the running slot + self.exams_since_zero = 0 + self.zero_current = None # measured baseline (A), None before the first ReZero + self.zero_list = [] + self.records = {} + self.operations = {} + self._principals = {} + self._requests = {} + self._owners = {} + self._cancel_operations = {} + self.book = {k: 0.0 for k in LEDGER_KEYS if k not in ('film_content_mol', 'film_residual_mol', 'carrier_chamber_mol', 'carrier_residual_balance_mol', + 'sensor_in_transit_mol', 'sensor_balance_residual_mol', 'block_thermal_j', 'energy_residual_j')} + self._comp = {k: 0.0 for k in self.book} # Neumaier compensation of every ledger sum + + # ------------------------------------------------------------ helpers + def _add(self, key, value): + """Compensated (Neumaier) accumulation of a ledger term.""" + s_ = self.book[key] + t_ = s_ + value + self._comp[key] += (s_ - t_) + value if abs(s_) >= abs(value) else (value - t_) + s_ + self.book[key] = t_ + + def _measured_current(self): + """Sensor current as the instrument measures it: truth plus correlated additive and proportional noise.""" + return self.sensor_I + self.noise_abs + self.noise_rel * max(self.sensor_I_o2, 0.0) + + @property + def time_s(self): + return self.time_ns / 1e9 + + def register_principal(self, name, visibility): + if not isinstance(name, str) or not name or visibility not in ('agent', 'evaluator', 'debug') or name in self._principals: + raise ActionRejected('INVALID_ARGUMENT') + self._principals[name] = visibility + + def session(self, name): + if not isinstance(name, str) or name not in self._principals: + raise ActionRejected('ACCESS_DENIED') + return AmetekOxtranSession(self, name) + + def _ambient(self): + return self.plant['ambient_k'] if self.plant else 296.15 + + def _baro(self): + return self.plant['barometric_pa'] if self.plant else STD_PRESSURE_PA + + def _air_o2_pa(self): + Ta = self._ambient() + pw = (self.plant['ambient_rh'] if self.plant else 0.0) * saturation_pressure_pa(Ta) + return AIR_O2_FRACTION * (self._baro() - pw) + + def _rh_true(self): + if self.rh_model <= 0.0: + return 0.0 + return min(1.0, max(0.0, self.rh_model + (self.plant['rh_bias'] if self.plant else 0.0))) + + def _carrier_residual_fraction(self): + """O2 left in the carrier after the H2/catalyst stage (manual: 1-3 % H2 needed for catalytic removal).""" + g = self.gas + if g is None: + return 0.0 + removal = self.plant['catalyst_removal_efficiency'] if g['carrier_h2_fraction'] >= 0.01 else 0.0 + return g['carrier_o2_impurity_fraction'] * (1.0 - removal) + + def _carrier_ok(self): + g = self.gas + return g is not None and SUPPLY_GAUGE_PA['carrier'][0] <= g['carrier_supply_gauge_pa'] <= SUPPLY_GAUGE_PA['carrier'][1] + + def _test_gas_ok(self): + g = self.gas + return g is not None and SUPPLY_GAUGE_PA['test'][0] <= g['test_supply_gauge_pa'] <= SUPPLY_GAUGE_PA['test'][1] + + def _supply_ok(self): + return self._carrier_ok() and self._test_gas_ok() + + def _transport(self, film, T, aw): + """Effective P, D (and S = P/D) of a mounted film at temperature T and water activity aw.""" + inv = 1.0 / T - 1.0 / film['T_ref'] + beta = film['beta'] * aw + P = film['P_ref'] * math.exp(-film['E_P'] / GAS_CONSTANT * inv + beta) + D = film['D_ref'] * math.exp(-film['E_D'] / GAS_CONSTANT * inv + beta) + return P, D, P / D + + def _cell_open(self, cell): + c = self.cells[cell] + return not c['clamped'] or c['clamp_move'] is not None + + def _test_active(self, cell): + t = self.cells[cell]['test'] + return t is not None and t['phase'] == 'running' + + def _indicated_T(self): + return quantize(self.T + self.plant['temperature_sensor_bias_k'], TEMPERATURE_DISPLAY_RESOLUTION_K) if (self.power and self.plant) else None + + def _film_content(self, cell): + c = self.cells[cell] + if c['film'] is None: + return 0.0 + return sum(c['conc']) * c['film']['dx'] * c['film']['area'] + + def read(self, visibility='agent'): + d = {'clock.time_s': self.time_s, 'plant.configured': self.plant is not None, 'gas.configured': self.gas is not None, + 'instrument.configured': self.instrument is not None, 'power.enabled': self.power, 'gas.supply_ok': self._supply_ok(), 'sensor.over_range': self.over_range, + 'thermal.target_k': self.target_k, 'thermal.indicated_k': self._indicated_T(), 'humidity.target_fraction': self.rh_target, + 'humidity.indicated_fraction': quantize(self.rh_model, RH_DISPLAY_RESOLUTION) if self.power else None, + 'barometer.indicated_pa': quantize(self._baro(), BAROMETER_RESOLUTION_PA) if self.power else None, + 'sensor.raw_counts': self._panel_counts(), 'sensor.route': self.route, + 'sequence.slot_remaining_s': None if self.seq is None else (self.seq['end_ns'] - self.time_ns) / 1e9, + 'truth.block_temperature_k': self.T, 'truth.rh_fraction': self._rh_true(), 'truth.sensor_current_a': self.sensor_I, + 'truth.sensor_input_mol_s': self.sensor_in, 'truth.tec_power_w': self.tec_w, 'power.angle_rad': POWER_SWITCH_ON_RAD if self.power else 0.0} + for cell in CELLS: + c = self.cells[cell] + k = cell.lower() + p = self.plant + d.update({f'drawer_{k}.position_m': c['drawer'], f'clamp_{k}.position_m': c['clamp'], + f'cell_{k}.drawer_closed': c['drawer'] == 0.0 and c['drawer_move'] is None, f'cell_{k}.clamped': c['clamped'] and c['clamp_move'] is None, f'cell_{k}.clamp_moving': c['clamp_move'] is not None, + f'cell_{k}.method_configured': c['cfg'] is not None, + f'cell_{k}.indicator_on': bool(self.power and c['clamped'] and c['clamp_move'] is None), f'cell_{k}.film_mounted': c['film'] is not None, + f'cell_{k}.phase': c['phase'], f'cell_{k}.exam_count': c['exam_count'], f'cell_{k}.last_otr_mol_m2_s': c['last_otr'], + f'cell_{k}.final_otr_mol_m2_s': c['final_otr'], + f'truth.cell_{k}.flux_mol_s': c['flux'], f'truth.cell_{k}.film_o2_mol': self._film_content(cell), f'truth.cell_{k}.test_side_o2_pa': c['p_up'], + f'truth.cell_{k}.carrier_side_o2_mol': c['n_h'], f'truth.cell_{k}.leak_mol_s': c['leak']}) + return {k: copy.deepcopy(v) for k, v in d.items() if visibility != 'agent' or SLOTS[k]['visibility'] == 'agent'} + + def _panel_counts(self): + if not self.power: + return None + I = self._measured_current() + return int(round(I / COUNT_A)) if math.isfinite(I) else None + + def ledger(self): + b = {k: v + self._comp[k] for k, v in self.book.items()} + content = sum(self._film_content(c) for c in CELLS) + chamber = sum(self.cells[c]['n_h'] for c in CELLS) + b['film_content_mol'] = content + b['carrier_chamber_mol'] = chamber + b['film_residual_mol'] = b['film_mounted_mol'] - b['film_unmounted_mol'] + b['film_air_exchange_mol'] + b['film_test_side_in_mol'] - b['film_to_carrier_mol'] - content + b['carrier_residual_balance_mol'] = b['carrier_in_mol'] - b['to_sensor_mol'] - b['to_vent_mol'] - b['released_to_air_mol'] - chamber + b['sensor_in_transit_mol'] = (self.plant['sensor_time_constant_s'] * self.sensor_I_o2 / (4.0 * FARADAY)) if self.plant else 0.0 + b['sensor_balance_residual_mol'] = (b['sensor_input_mol'] - b['sensor_consumed_mol'] - b['sensor_passthrough_mol'] - b['sensor_in_transit_mol'] + - b['sensor_discarded_mol']) + b['block_thermal_j'] = (self.plant['block_heat_capacity_j_k'] * (self.T - self._ambient())) if self.plant else 0.0 + b['energy_residual_j'] = b['tec_heat_j'] - b['ambient_exchange_j'] - b['block_thermal_j'] + return b + + # ------------------------------------------------------------ test bookkeeping + def _new_test(self, cell): + c = self.cells[cell] + c['test_counter'] += 1 + op = f'{self.instance_id}:test:{cell}:{c["test_counter"]}' + cfg = copy.deepcopy(c['cfg']) + inst = copy.deepcopy(self.instrument) + first = 'zero_start' if cfg['individual_zero'] in ('start', 'both') else ('conditioning' if cfg['conditioning_hours'] > 0 else 'testing') + t = dict(op=op, cell=cell, cfg=cfg, inst=inst, phase='running', cell_phase=first, start_ns=self.time_ns, end_ns=None, readings=[], zeros=[], + individual_zero=None, zero_run=[], zero_stable=None, conditioning_end_ns=None, converged=False, validity='not_completed', terminal_reason=None, final=None, + temperature_excursion=False, humidity_excursion=False, target_k=self.target_k, target_rh=self.rh_target, source=c['source']) + if first == 'conditioning': + t['conditioning_end_ns'] = self.time_ns + round(cfg['conditioning_hours'] * 3600e9) + c['test'] = t + c['phase'] = first + c['exam_count'] = 0 + c['last_otr'] = None + self.operations[op] = t + self.records[op] = self._result_of(t) + return op + + def _result_of(self, t): + cfg = t['cfg'] + fin = t['final'] + return dict(operation_id=t['op'], cell=t['cell'], phase=t['phase'], cell_phase=t['cell_phase'], + elapsed_s=((t['end_ns'] if t['end_ns'] is not None else self.time_ns) - t['start_ns']) / 1e9, exam_count=len([r for r in t['readings'] if r['kind'] == 'exam']), + readings=copy.deepcopy(t['readings']), rezero_readings=copy.deepcopy(t['zeros']), individual_zero_mol_m2_s=t['individual_zero'], + final_otr_mol_m2_s=None if fin is None else fin['otr'], final_otr_cc_m2_day=None if fin is None else fin['otr_cc'], + final_otr_cc_pkg_day=None if fin is None else fin['otr_pkg_cc'], converged=t['converged'], + repeatability_relative=None if fin is None else fin['rep'], within_repeatability_spec=None if fin is None else fin['rep_ok'], + permeance_mol_m2_s_pa=None if fin is None else fin['permeance'], permeability_mol_m_per_m2_s_pa=None if fin is None else fin['permeability'], + permeability_barrer=None if (fin is None or fin['permeability'] is None) else fin['permeability'] / BARRER_SI, + conditions=dict(target_k=t['target_k'], target_rh=t['target_rh'], permeant_concentration_percent=t['inst']['permeant_concentration_percent'], + declared_area_m2=cfg['declared_area_m2'], declared_thickness_m=cfg['declared_thickness_m'], report_basis=cfg['report_basis'], + carrier_flow_sccm=CARRIER_FLOW_SCCM, exam_minutes=cfg['exam_minutes']), + validity=t['validity'], terminal_reason=t['terminal_reason'], template_source=t['source'], + evidence='synthetic_forward_model; quantised Coulox sensor counts with ReZero baseline, barometric (760 mmHg) and permeant normalisation; ' + 'film transport from the selected experimental P/D template with explicit temperature/humidity/leak/sensor priors; not native OX-TRAN data') + + def _finish(self, cell, phase, reason): + c = self.cells[cell] + t = c['test'] + cfg = t['cfg'] + exams = [r for r in t['readings'] if r['kind'] == 'exam'] + fin = None + if exams: + k = cfg['convergence_count'] if cfg['test_mode'] == 'convergence' else 1 + window = [r['otr_mol_m2_s'] for r in exams[-k:]] + zero = t['individual_zero'] or 0.0 + otr = sum(window) / len(window) - zero + last3 = [r['otr_mol_m2_s'] for r in exams[-3:]] + rep = None + rep_ok = None + if len(last3) >= 2: + m = sum(last3) / len(last3) + sd = math.sqrt(sum((x - m) ** 2 for x in last3) / (len(last3) - 1)) + rep = sd / abs(m) if abs(m) > 0 else None + allow = max(REPEATABILITY_CC_M2_DAY / CC_DAY_PER_MOL_S * TEST_AREA_M2 / cfg['declared_area_m2'], REPEATABILITY_REL * abs(m)) + rep_ok = sd <= allow + permeance = otr / STD_PRESSURE_PA + fin = dict(otr=otr, otr_cc=otr * CC_DAY_PER_MOL_S, otr_pkg_cc=otr * cfg['declared_area_m2'] * CC_DAY_PER_MOL_S, rep=rep, rep_ok=rep_ok, + permeance=permeance, permeability=None if cfg['declared_thickness_m'] is None else permeance * cfg['declared_thickness_m']) + if phase == 'cancelled': + validity = 'cancelled' + elif reason == 'SENSOR_OVER_RANGE': + validity = 'sensor_over_range' + elif fin is None: + validity = 'not_completed' + elif t['temperature_excursion']: + validity = 'temperature_out_of_tolerance' + elif t['humidity_excursion']: + validity = 'humidity_out_of_tolerance' + elif (cfg['test_mode'] == 'convergence' and not t['converged']) or t['zero_stable'] is False: + validity = 'not_converged' + else: + lo, hi = OTR_RANGE_CC_M2_DAY + scale = TEST_AREA_M2 / cfg['declared_area_m2'] + validity = 'below_range' if fin['otr_cc'] < lo * scale else 'over_range' if fin['otr_cc'] > hi * scale else 'valid' + t.update(phase=phase, terminal_reason=reason, validity=validity, end_ns=self.time_ns, final=fin, cell_phase={'succeeded': 'succeeded', 'failed': 'failed'}.get(phase, 'cancelled')) + c['phase'] = t['cell_phase'] + c['final_otr'] = None if fin is None or validity != 'valid' else fin['otr'] + self.records[t['op']] = self._result_of(t) + + def _result(self, cell): + t = self.cells[cell]['test'] + if t is None: + return dict(operation_id=None, cell=cell, phase='idle', cell_phase='idle', elapsed_s=0.0, exam_count=0, readings=[], rezero_readings=[], + individual_zero_mol_m2_s=None, final_otr_mol_m2_s=None, final_otr_cc_m2_day=None, final_otr_cc_pkg_day=None, converged=False, + repeatability_relative=None, within_repeatability_spec=None, permeance_mol_m2_s_pa=None, permeability_mol_m_per_m2_s_pa=None, + permeability_barrer=None, conditions=dict(target_k=None, target_rh=self.rh_target, permeant_concentration_percent=None, declared_area_m2=None, + declared_thickness_m=None, report_basis=None, carrier_flow_sccm=CARRIER_FLOW_SCCM, exam_minutes=None), + validity='not_completed', terminal_reason=None, template_source=None, evidence='no_measurement') + if t['phase'] == 'running': + return self._result_of(t) + return copy.deepcopy(self.records[t['op']]) + + # ------------------------------------------------------------ sequencer + def _active_cells(self): + return [c for c in CELLS if self._test_active(c)] + + def _slot_minutes(self, kind): + if kind == 'Z': + return self.instrument['rezero_exam_minutes'] + cfg = self.cells[kind]['cfg'] + if self._test_active(kind): + return self.cells[kind]['test']['cfg']['exam_minutes'] + other = [self.cells[c]['test']['cfg']['exam_minutes'] for c in self._active_cells()] + return other[0] if other else (cfg['exam_minutes'] if cfg else 30.0) + + def _next_slot(self, previous): + inst = self.instrument + if inst['rezero_enabled'] and (self.zero_current is None or self.exams_since_zero >= inst['rezero_frequency']): # never an exam without a baseline + kind = 'Z' + elif previous in (None, 'Z'): + kind = self._last_cell_slot_next() + else: + kind = 'B' if previous == 'A' else 'A' + if kind == 'Z': + self.exams_since_zero = 0 + self.seq = dict(kind=kind, start_ns=self.time_ns, end_ns=self.time_ns + max(1, round(self._slot_minutes(kind) * 60e9))) + self._route() + + def _last_cell_slot_next(self): + last = getattr(self, '_last_cell_slot', None) + return 'A' if last in (None, 'B') else 'B' + + def _route(self): + """Valve routing for the current slot (sensor bypassed during conditioning, idle slots and over-range protection). + + ``routed_since_ns`` remembers when the sensor was switched onto the slot's stream: a slot whose stream was switched in + part-way (conditioning ended, a test started, over-range recovery) is not a complete exam and records nothing.""" + s = self.seq + route = 'bypass' + if s is not None and self.power and not self.over_range: + if s['kind'] == 'Z': + route = 'Z' + elif self._test_active(s['kind']) and self.cells[s['kind']]['phase'] in ('zero_start', 'testing', 'zero_end'): + route = s['kind'] + if s is not None: + if route == 'bypass': + s['routed_since_ns'] = None + elif route != self.route or s.get('routed_since_ns') is None: + s['routed_since_ns'] = self.time_ns + self.route = route + + def _measure_current(self): + return quantize(self._measured_current(), COUNT_A) + + def _complete_slot(self): + s = self.seq + kind = s['kind'] + now = self.time_s + full = self.route == kind and s.get('routed_since_ns') == s['start_ns'] + if kind == 'Z': + if full: + I = self._measure_current() + self.zero_current = I + z = dict(time_s=quantize(now, 1.0), sensor_counts=int(round(I / COUNT_A)), current_a=I) + self.zero_list.append(z) + for cell in self._active_cells(): + t = self.cells[cell]['test'] + if len(t['zeros']) < MAX_READINGS: + t['zeros'].append(dict(z, time_s=quantize(now - t['start_ns'] / 1e9, 1.0))) # same time base as the exams + else: + self._last_cell_slot = kind + self.exams_since_zero += 1 + c = self.cells[kind] + t = c['test'] + if t is not None and t['phase'] == 'running' and full: + self._record_exam(kind) + elif t is not None and t['phase'] == 'running' and c['phase'] == 'conditioning': + pass + self.seq = None + self.route = 'bypass' + if self._active_cells() and self.power: + self._next_slot(kind) + + def _record_exam(self, cell): + c = self.cells[cell] + t = c['test'] + cfg, inst = t['cfg'], t['inst'] + p = self.plant + I = self._measure_current() + base = self.zero_current if self.zero_current is not None else 0.0 + n_meas = (I - base) / (4.0 * FARADAY) + P_used = self._baro() if inst['barometer_mode'] == 'auto' else inst['manual_barometer_pa'] + pkg = n_meas * (STD_PRESSURE_PA / P_used) * (100.0 / inst['permeant_concentration_percent']) + pkg_cc = quantize(pkg * CC_DAY_PER_MOL_S, OTR_RESOLUTION_CC_M2_DAY * TEST_AREA_M2) + pkg = pkg_cc / CC_DAY_PER_MOL_S + otr = pkg / cfg['declared_area_m2'] + kind = 'individual_zero' if c['phase'] in ('zero_start', 'zero_end') else 'exam' + Ti = self._indicated_T() + row = dict(index=len(t['readings']), kind=kind, time_s=quantize(self.time_s - t['start_ns'] / 1e9, 1.0), sensor_counts=int(round(I / COUNT_A)), + otr_mol_m2_s=otr, otr_cc_m2_day=otr * CC_DAY_PER_MOL_S, otr_mol_pkg_s=pkg, otr_cc_pkg_day=pkg_cc, temperature_k=Ti, + rh_fraction=quantize(self.rh_model, RH_DISPLAY_RESOLUTION), barometric_pa=quantize(self._baro(), BAROMETER_RESOLUTION_PA)) + if len(t['readings']) >= MAX_READINGS: + self._finish(cell, 'failed', 'TOO_MANY_READINGS') + return + t['readings'].append(row) + floor = 2.0 * OTR_RESOLUTION_CC_M2_DAY / CC_DAY_PER_MOL_S * TEST_AREA_M2 / cfg['declared_area_m2'] + if kind == 'individual_zero': + # the zero is repeated until it is stable: after the test gas is removed the film keeps desorbing dissolved O2 + t['zero_run'].append(otr) + k = cfg['convergence_count'] + run = t['zero_run'] + stable = is_stable(run, k, cfg['convergence_percent'], floor) + if stable or len(run) >= cfg['max_cycles']: + t['individual_zero'] = otr + t['zero_stable'] = t['zero_stable'] and stable if t['zero_stable'] is not None else stable + t['zero_run'] = [] + if c['phase'] == 'zero_start': + nxt = 'conditioning' if cfg['conditioning_hours'] > 0 else 'testing' + c['phase'] = t['cell_phase'] = nxt + if nxt == 'conditioning': + t['conditioning_end_ns'] = self.time_ns + round(cfg['conditioning_hours'] * 3600e9) + else: + self._finish(cell, 'succeeded', 'TEST_COMPLETE') + return + c['exam_count'] += 1 + c['last_otr'] = otr + if Ti is not None and abs(Ti - t['target_k']) > cfg['temperature_tolerance_k'] + 1e-9: + t['temperature_excursion'] = True + if abs(self.rh_target - t['target_rh']) > 1e-12 or abs(self.rh_model - t['target_rh']) > RH_ACCURACY + 1e-9: + t['humidity_excursion'] = True + exams = [r['otr_mol_m2_s'] for r in t['readings'] if r['kind'] == 'exam'] + done = False + if cfg['test_mode'] == 'standard' and len(exams) >= cfg['cycles']: + done = True + elif cfg['test_mode'] == 'convergence': + t['converged'] = is_stable(exams, cfg['convergence_count'], cfg['convergence_percent'], floor) + done = t['converged'] or len(exams) >= cfg['max_cycles'] + if done: + if cfg['individual_zero'] in ('end', 'both'): + c['phase'] = t['cell_phase'] = 'zero_end' + else: + self._finish(cell, 'succeeded', 'TEST_COMPLETE') + + def _abort_test(self, cell): + """Cancellation of the asynchronous test operation: always an abort (readings kept), unlike the graceful continuous stop.""" + self._finish(cell, 'cancelled', 'USER_CANCEL') + self._route() + self.revision += 1 + + # ------------------------------------------------------------ commands + def invoke(self, capability_id, **arguments): + if capability_id not in CAPS: + raise ActionRejected('UNKNOWN_CAPABILITY') + validate(CAPS[capability_id]['input_schema'], arguments) + k = capability_id + a = copy.deepcopy(arguments) + if k in UNSUPPORTED: + raise ActionRejected('UNSUPPORTED') + if k == 'test.result': + return self._result(a['cell']) + if k == 'ledger.read': + return self.ledger() + if k == 'provenance.read': + return dict(cell_a=self.cells['A']['source'], cell_b=self.cells['B']['source'], + operations=[dict(operation_id=op, source=t['source']) for op, t in list(self.operations.items())[-MAX_PROVENANCE:]]) + if k == 'analysis.otr': + return analyze_otr(**a) + if k == 'sim.step': + self.step(a['dt_s']) + return dict(time_s=self.time_s) + if k == 'plant.configure': + if self.plant is not None: + raise ActionRejected('PLANT_ALREADY_CONFIGURED') + if not a['accept_engineering']: + raise ActionRejected('ENGINEERING_ACCEPTANCE_REQUIRED') + if a['block_heat_capacity_j_k'] / (a['controller_gain_w_k'] + a['block_loss_w_k']) < 5 * MAX_SUBSTEP_S: + raise ActionRejected('THERMAL_TIME_CONSTANT_OUTSIDE_NUMERICAL_DOMAIN') + self.plant = a + self.rng = random.Random(a['noise_seed']) + self.T = a['ambient_k'] + self.target_k = min(max(TEMPERATURE_RANGE_K[0], a['ambient_k']), TEMPERATURE_RANGE_K[1]) + out = dict(configured=True) + elif k == 'gas.configure': + if not a['accept_gas_supply']: + raise ActionRejected('ENGINEERING_ACCEPTANCE_REQUIRED') + if any(self._test_active(c) for c in CELLS): + raise ActionRejected('BUSY') + self.gas = a + self.zero_current = None # a new carrier/test supply invalidates the ReZero baseline + out = dict(configured=True) + elif k == 'instrument.configure': + if a['barometer_mode'] == 'manual' and a['manual_barometer_pa'] is None: + raise ActionRejected('MANUAL_BAROMETER_REQUIRED') + if any(self._test_active(c) for c in CELLS): + raise ActionRejected('BUSY') + self.instrument = a + out = dict(configured=True) + elif k == 'test.configure': + if self._test_active(a['cell']): + raise ActionRejected('BUSY') + if a['test_mode'] == 'convergence' and a['max_cycles'] < a['convergence_count'] + 1: + raise ActionRejected('INVALID_ARGUMENT') + cell = a.pop('cell') + self.cells[cell]['cfg'] = a + out = dict(configured=True) + elif k == 'power.set': + if self.plant is None: + raise ActionRejected('PLANT_REQUIRED') + if not a['enabled'] and self.power: + for c in CELLS: + if self._test_active(c): + self._finish(c, 'cancelled', 'POWER_OFF') + self.seq = None + self.route = 'bypass' + self.tec_w = 0.0 + self.integral_w = 0.0 + self.zero_current = None # the sensor baseline must be re-measured after a restart + self._add('sensor_discarded_mol', self.plant['sensor_time_constant_s'] * self.sensor_I_o2 / (4.0 * FARADAY)) + self.sensor_I = self.sensor_I_o2 = self.sensor_I_bg = 0.0 + self.noise_abs = self.noise_rel = 0.0 + for c in CELLS: + cc = self.cells[c] + if cc['clamp_move'] is not None: # a clamp stroke in progress stops where it is and the cell is not sealed + cc['clamp_move'] = None + if cc['clamped']: + self._open_cell(c) # release stroke interrupted: the seal is already broken + cc['clamped'] = False + if a['enabled'] and not self.power: + self.noise_abs = self.plant['sensor_noise_a'] * self.rng.gauss(0.0, 1.0) # stationary start of the noise process + self.noise_rel = self.plant['sensor_relative_noise'] * self.rng.gauss(0.0, 1.0) + self.power = a['enabled'] + out = dict(enabled=self.power) + elif k == 'thermal.set_temperature': + if self.plant is None: + raise ActionRejected('PLANT_REQUIRED') + self.target_k = a['target_k'] + out = dict(target_k=self.target_k) + elif k == 'humidity.set': + if self.plant is None: + raise ActionRejected('PLANT_REQUIRED') + if 0.0 < a['rh_fraction'] < RH_RANGE[0]: + raise ActionRejected('RH_OUTSIDE_CONTROLLED_RANGE') + self.rh_target = a['rh_fraction'] + out = dict(rh_fraction=self.rh_target) + elif k == 'drawer.move': + if self.plant is None: + raise ActionRejected('PLANT_REQUIRED') + c = self.cells[a['cell']] + if c['clamped'] or c['clamp_move'] is not None or c['clamp'] > 0.0: + raise ActionRejected('CARTRIDGE_CLAMPED') # the platen must be fully raised before the drawer slides + target = DRAWER_TRAVEL_M if a['open'] else 0.0 + c['drawer_move'] = None if c['drawer'] == target else dict(start_ns=self.time_ns, x0=c['drawer'], target=target) + out = dict(cell=a['cell'], target_m=target) + elif k == 'sample.mount': + out = self._mount(a) + elif k == 'sample.unmount': + c = self.cells[a['cell']] + if c['film'] is None: + raise ActionRejected('NO_FILM') + if not (c['drawer'] == DRAWER_TRAVEL_M and c['drawer_move'] is None) or c['clamped'] or c['clamp_move'] is not None: + raise ActionRejected('DRAWER_NOT_OPEN') + removed = self._film_content(a['cell']) + self._add('film_unmounted_mol', removed) + c['film'] = None + c['conc'] = None + c['source'] = None + out = dict(cell=a['cell'], removed_film_o2_mol=removed) + elif k == 'cell.load_unload': + if self.plant is None: + raise ActionRejected('PLANT_REQUIRED') + if not self.power: + raise ActionRejected('POWER_OFF') + cell = a['cell'] + c = self.cells[cell] + if c['clamp_move'] is not None: + raise ActionRejected('CLAMP_BUSY') + if c['clamped']: + if self._test_active(cell): + raise ActionRejected('TEST_ACTIVE') + c['clamp_move'] = dict(start_ns=self.time_ns, q0=c['clamp'], target=0.0) + out = dict(cell=cell, clamping=False) + else: + if not (c['drawer'] == 0.0 and c['drawer_move'] is None): + raise ActionRejected('DRAWER_NOT_CLOSED') + c['clamp_move'] = dict(start_ns=self.time_ns, q0=c['clamp'], target=CLAMP_TRAVEL_M) + out = dict(cell=cell, clamping=True) + elif k == 'test.start': + cell = a['cell'] + c = self.cells[cell] + if self.plant is None or self.gas is None: + raise ActionRejected('PLANT_REQUIRED') + if not self.power: + raise ActionRejected('POWER_OFF') + if self.instrument is None or c['cfg'] is None: + raise ActionRejected('METHOD_REQUIRED') + if not self._supply_ok(): + raise ActionRejected('GAS_SUPPLY_PRESSURE_OUT_OF_RANGE') + if not c['clamped'] or c['clamp_move'] is not None: + raise ActionRejected('CELL_NOT_CLAMPED') + if self._test_active(cell): + raise ActionRejected('BUSY') + op = self._new_test(cell) + if self.seq is None: + self._next_slot(None) + else: + self._route() + out = dict(operation_id=op) + elif k == 'test.stop': + cell = a['cell'] + if not self._test_active(cell): + raise ActionRejected('NOT_RUNNING') + c = self.cells[cell] + t = c['test'] + n_exam = len([r for r in t['readings'] if r['kind'] == 'exam']) + if t['cfg']['test_mode'] == 'continuous' and n_exam > 0 and c['phase'] == 'testing': + # a continuous test is ended by the operator: optional end zero, then an evaluated result (2/28 manual) + if t['cfg']['individual_zero'] in ('end', 'both'): + c['phase'] = t['cell_phase'] = 'zero_end' + if self.seq is not None and self.route == cell: + self.seq['routed_since_ns'] = self.time_ns # the running exam slot is not a complete zero + else: + self._finish(cell, 'succeeded', 'OPERATOR_STOP') + else: + self._finish(cell, 'cancelled', 'USER_CANCEL') + self._route() + out = dict(cell=cell, phase=t['phase'], exam_count=n_exam) + else: # pragma: no cover + raise ActionRejected('UNKNOWN_CAPABILITY') + self.revision += 1 + return copy.deepcopy(out) + + def _mount(self, a): + if self.plant is None: + raise ActionRejected('PLANT_REQUIRED') + c = self.cells[a['cell']] + if c['film'] is not None: + raise ActionRejected('FILM_ALREADY_MOUNTED') + if not (c['drawer'] == DRAWER_TRAVEL_M and c['drawer_move'] is None) or c['clamped'] or c['clamp_move'] is not None: + raise ActionRejected('DRAWER_NOT_OPEN') + if not a['accept_transport_assumptions']: + raise ActionRejected('ENGINEERING_ACCEPTANCE_REQUIRED') + rec = library().get(a['template_id']) + if rec is None: + raise ActionRejected('UNKNOWN_TEMPLATE') + P = a['permeability_override_mol_m_per_m2_s_pa'] or rec['oxygen_permeability_mol_m_per_m2_s_Pa'] + D = a['diffusivity_override_m2_s'] or rec['oxygen_diffusivity_m2_s'] + if D is None: + raise ActionRejected('DIFFUSIVITY_REQUIRED') + water = rec['humidity_class'] != 'negligible_assumed' + if not water and a['humidity_coefficient'] not in (None, 0.0): + raise ActionRejected('HUMIDITY_COEFFICIENT_NOT_APPLICABLE') + if water and a['humidity_coefficient'] is None: + raise ActionRejected('HUMIDITY_COEFFICIENT_REQUIRED') # host prior needed at mount time for every water-sensitive template + L = a['thickness_m'] + film = dict(template=rec['id'], T_ref=rec['reference_temperature_K'], P_ref=P, D_ref=D, E_P=a['permeability_activation_energy_j_mol'], + E_D=a['diffusivity_activation_energy_j_mol'], beta=a['humidity_coefficient'] or 0.0, beta_given=a['humidity_coefficient'] is not None, + water_sensitive=water, L=L, dx=L / N_FILM_NODES, area=a['exposed_area_m2'], + source=f"{LIBRARY_PATH.relative_to(ROOT)}#{rec['id']}", P_evidence='host_override' if a['permeability_override_mol_m_per_m2_s_pa'] else rec['evidence'], + D_evidence='host_override' if a['diffusivity_override_m2_s'] else rec['diffusivity_evidence']) + _, _, S = self._transport(film, self._ambient(), self.plant['ambient_rh']) + c0 = S * self._air_o2_pa() + c['film'] = film + c['conc'] = [c0] * N_FILM_NODES + c['source'] = film['source'] + content = self._film_content(a['cell']) + self._add('film_mounted_mol', content) + return dict(cell=a['cell'], mounted=True, film_o2_mol=content) + + # ------------------------------------------------------------ time integration + def _next_events(self, end): + ev = [end, self.time_ns + round(MAX_SUBSTEP_S * 1e9)] + p = self.plant + for c in CELLS: + cc = self.cells[c] + if cc['drawer_move'] is not None: + m = cc['drawer_move'] + ev.append(m['start_ns'] + max(1, math.ceil(abs(m['target'] - m['x0']) / p['drawer_speed_m_s'] * 1e9))) + if cc['clamp_move'] is not None: + m = cc['clamp_move'] + ev.append(m['start_ns'] + max(1, math.ceil(abs(m['target'] - m['q0']) / CLAMP_TRAVEL_M * p['clamp_actuation_s'] * 1e9))) + t = cc['test'] + if t is not None and t['phase'] == 'running' and cc['phase'] == 'conditioning' and t['conditioning_end_ns'] is not None: + ev.append(t['conditioning_end_ns']) + if self.seq is not None: + ev.append(self.seq['end_ns']) + return min(t for t in ev if t > self.time_ns) + + def _advance_mechanics(self, nxt): + p = self.plant + for cell in CELLS: + c = self.cells[cell] + if c['drawer_move'] is not None: + m = c['drawer_move'] + dist = abs(m['target'] - m['x0']) + s = (nxt - m['start_ns']) / 1e9 * p['drawer_speed_m_s'] + if s >= dist - 1e-15: + c['drawer'] = m['target'] + c['drawer_move'] = None + else: + c['drawer'] = m['x0'] + math.copysign(s, m['target'] - m['x0']) + if c['clamp_move'] is not None: + m = c['clamp_move'] + dist = abs(m['target'] - m['q0']) + s = (nxt - m['start_ns']) / 1e9 / p['clamp_actuation_s'] * CLAMP_TRAVEL_M + if s >= dist - 1e-15: + c['clamp'] = m['target'] + c['clamp_move'] = None + if m['target'] > 0: + self._seal_cell(cell) + else: + self._open_cell(cell) + else: + c['clamp'] = m['q0'] + math.copysign(s, m['target'] - m['q0']) + + def _seal_cell(self, cell): + """Clamp completed: both chambers start with trapped laboratory air.""" + c = self.cells[cell] + p = self.plant + c['clamped'] = True + self._add('released_to_air_mol', c['n_h']) # (always 0 for an open cell; keeps the chamber balance closed regardless) + c['p_up'] = self._air_o2_pa() + n_air = self._air_o2_pa() * p['carrier_chamber_volume_m3'] / (GAS_CONSTANT * self._ambient()) + c['n_h'] = n_air + self._add('carrier_in_mol', n_air) # trapped air counted as carrier-side input so the chamber balance stays closed + + def _open_cell(self, cell): + c = self.cells[cell] + c['clamped'] = False + self._add('released_to_air_mol', c['n_h']) + c['n_h'] = 0.0 + c['p_up'] = self._air_o2_pa() + + def _integrate(self, dt): + p = self.plant + Ta = p['ambient_k'] + # ---- test-cell block temperature: PI thermoelectric (heats and cools), conditional integration + if self.power: + e = self.target_k - (self.T + p['temperature_sensor_bias_k']) # the controller acts on its own (biased) sensor + u = p['controller_gain_w_k'] * e + self.integral_w + Q = min(max(u, -p['tec_max_w']), p['tec_max_w']) + if -p['tec_max_w'] < u < p['tec_max_w'] or (u >= p['tec_max_w'] and e < 0) or (u <= -p['tec_max_w'] and e > 0): + self.integral_w = min(max(self.integral_w + p['controller_gain_w_k'] / p['controller_integral_s'] * e * dt, -p['tec_max_w']), p['tec_max_w']) + else: + Q = 0.0 + self.tec_w = Q + # exact exponential update of the block for constant Q over the sub-step (unconditionally stable) + G, Cb = p['block_loss_w_k'], p['block_heat_capacity_j_k'] + T_inf = Ta + Q / G + tau_b = Cb / G + e_b = math.exp(-dt / tau_b) + T_new = T_inf + (self.T - T_inf) * e_b + self._add('tec_heat_j', Q * dt) + self._add('ambient_exchange_j', G * ((T_inf - Ta) * dt + (self.T - T_inf) * tau_b * (1.0 - e_b))) # exact integral of G (T - T_amb) dt + self.T = T_new + # ---- RH generator model (indicated) and true humidity + if self.power: + self.rh_model = self.rh_target + (self.rh_model - self.rh_target) * math.exp(-dt / p['rh_time_constant_s']) + if self.rh_target == 0.0 and self.rh_model < 1e-6: + self.rh_model = 0.0 + aw = self._rh_true() + pw = aw * saturation_pressure_pa(self.T) + g = self.gas + n_c = molar_flow(CARRIER_FLOW_SCCM) + # ---- per cell: chambers, film, leaks + outflows = {} + for cell in CELLS: + c = self.cells[cell] + film = c['film'] + open_ = self._cell_open(cell) + flow_on = self.power and not open_ + c['flux'] = 0.0 + c['leak'] = 0.0 + if open_: + outflows[cell] = 0.0 + if film is not None: + Tf = Ta + _, D, S = self._transport(film, Tf, p['ambient_rh']) + cb = S * self._air_o2_pa() + jt_, jb_ = self._film_advance(c, D, cb, cb, dt) + self._add('film_air_exchange_mol', (jt_ - jb_) * film['area'] * dt) + continue + V_h = p['carrier_chamber_volume_m3'] + V_t = p['test_chamber_volume_m3'] + carrier_on = flow_on and self._carrier_ok() + # test-gas chamber: test gas during conditioning/testing, carrier flush otherwise; no supply = no flow (stagnant) + t = c['test'] + testing_gas = (flow_on and t is not None and t['phase'] == 'running' and c['phase'] in ('conditioning', 'testing') and g is not None) + if (testing_gas and self._test_gas_ok()) or (flow_on and not testing_gas and carrier_on): + target = g['test_o2_fraction'] * max(self._baro() - pw, 0.0) if testing_gas else 0.0 + F_t = molar_flow(p['test_gas_flow_sccm_per_cell']) * GAS_CONSTANT * self.T / self._baro() + c['p_up'] = target + (c['p_up'] - target) * math.exp(-F_t / V_t * dt) + p_up = c['p_up'] + # carrier-side inputs other than the film (constant over the sub-step); the sweep (kh) needs carrier flow + edge = p['edge_leak_mol_s_pa'] * p_up + ingress = p['ambient_ingress_mol_s_pa'] * (1.0 - p['truseal_flush_efficiency']) * self._air_o2_pa() + residual = self._carrier_residual_fraction() * n_c if carrier_on else 0.0 + q_in = edge + ingress + residual + kh = n_c * GAS_CONSTANT * self.T / self._baro() / V_h if carrier_on else 0.0 + n_old = c['n_h'] + film_out = 0.0 + open_flow = 0.0 + if film is not None: + _, D, S = self._transport(film, self.T, aw) + j_top, j_bot, n_new, out = self._film_chamber_advance(c, D, S * p_up, S * GAS_CONSTANT * self.T / V_h, q_in, kh, dt) + film_out = j_bot * film['area'] # mol/s averaged over the sub-step + self._add('film_test_side_in_mol', j_top * film['area'] * dt) + self._add('film_to_carrier_mol', film_out * dt) + else: + # empty cartridge: the chambers communicate through the open window (two-way, solved implicitly) + a_h = GAS_CONSTANT * self.T / V_h + n_new = (n_old + dt * (q_in + OPEN_WINDOW_MOL_S_PA * p_up)) / (1.0 + dt * kh + dt * OPEN_WINDOW_MOL_S_PA * a_h) + open_flow = OPEN_WINDOW_MOL_S_PA * (p_up - n_new * a_h) + out = kh * n_new + self._add('open_cell_mol', open_flow * dt) + inputs = film_out + q_in + open_flow + self._add('edge_leak_mol', edge * dt) + self._add('ambient_ingress_mol', ingress * dt) + self._add('carrier_o2_impurity_mol', residual * dt) + self._add('carrier_in_mol', inputs * dt) + c['flux'] = film_out + c['leak'] = edge + ingress + c['n_h'] = n_new # sweep outflow 'out' = backward-Euler kh n_h' of every solver sub-step + outflows[cell] = out + # ---- rezero stream and sensor + zero_stream = (self._carrier_residual_fraction() * n_c + p['rezero_path_leak_mol_s']) if (self.power and self._carrier_ok()) else 0.0 + self._add('rezero_stream_mol', zero_stream * dt) + route = self.route + if route in CELLS: + s_in = outflows.get(route, 0.0) + elif route == 'Z': + s_in = zero_stream + else: + s_in = 0.0 + for cell, out in outflows.items(): + if cell == route: + self._add('to_sensor_mol', out * dt) + else: + self._add('to_vent_mol', out * dt) + self.sensor_in = s_in + if self.power: + eta = p['sensor_efficiency'] + tau_s = p['sensor_time_constant_s'] + e_s = math.exp(-dt / tau_s) + I_ss = 4.0 * FARADAY * eta * s_in + I0 = self.sensor_I_o2 + self.sensor_I_o2 = I_ss + (I0 - I_ss) * e_s + self.sensor_I_bg = p['sensor_background_a'] + (self.sensor_I_bg - p['sensor_background_a']) * e_s + self.sensor_I = self.sensor_I_o2 + self.sensor_I_bg + self._add('sensor_input_mol', s_in * dt) + self._add('sensor_consumed_mol', (I_ss * dt + (I0 - I_ss) * tau_s * (1.0 - e_s)) / (4.0 * FARADAY)) # exact charge of the O2 current + self._add('sensor_passthrough_mol', (1.0 - eta) * s_in * dt) + # measurement noise: first-order correlated with the sensor time constant, additive and proportional (one stream for + # panel counts, exam and ReZero readings, so every agent-visible channel carries the same noise) + k_s = math.sqrt(max(0.0, 1.0 - e_s * e_s)) + self.noise_abs = self.noise_abs * e_s + p['sensor_noise_a'] * k_s * self.rng.gauss(0.0, 1.0) + self.noise_rel = self.noise_rel * e_s + p['sensor_relative_noise'] * k_s * self.rng.gauss(0.0, 1.0) + if self._carrier_ok(): + self._add('carrier_gas_used_mol', molar_flow(p['carrier_total_flow_sccm']) * dt) + if self._active_cells() and self._test_gas_ok(): + self._add('test_gas_used_mol', molar_flow(p['test_total_flow_sccm']) * dt) + return s_in + + def _film_chamber_advance(self, c, D, c_top, sigma, q_in, kh, dt): + """Film and carrier chamber advanced together; returns sub-step averaged (J_top_in, J_bot_out), the new chamber O2 and the + averaged sweep outflow (mol/s).""" + film = c['film'] + tau = film['L'] ** 2 / D + h = min(dt, max(0.02 * tau, 1.0)) + n = max(1, math.ceil(dt / h - 1e-12)) + h = dt / n + jt = jb = ot = 0.0 + conc, n_h = c['conc'], c['n_h'] + for _ in range(n): + conc, n_h, a_, b_ = film_chamber_step(conc, film['dx'], D, c_top, n_h, sigma, film['area'], q_in, kh, h) + jt += a_ * h + jb += b_ * h + ot += kh * n_h * h + c['conc'] = conc + return jt / dt, jb / dt, n_h, ot / dt + + def _film_advance(self, c, D, c_top, c_bot, dt): + film = c['film'] + tau = film['L'] ** 2 / D + h = min(dt, max(0.02 * tau, 1.0)) + n = max(1, math.ceil(dt / h - 1e-12)) + h = dt / n + jt = jb = 0.0 + conc = c['conc'] + for _ in range(n): + conc, a_, b_ = film_step(conc, film['dx'], D, c_top, c_bot, h) + jt += a_ * h + jb += b_ * h + c['conc'] = conc + return jt / dt, jb / dt + + def step(self, dt_s): + validate(number('s', 0.0, 86400.0), dt_s) + raw = dt_s * 1e9 + self._clock_remainder_ns + ns = round(raw) + self._clock_remainder_ns = raw - ns + if ns <= 0 or self.plant is None: + self.time_ns += max(ns, 0) + self.revision += 1 + return + end = self.time_ns + ns + while self.time_ns < end: + nxt = self._next_events(end) + dt = (nxt - self.time_ns) / 1e9 + s_in = self._integrate(dt) + self._advance_mechanics(nxt) + self.time_ns = nxt + # sensor protection: an excessive measured current switches the sensor to bypass; an over-ranged cell fails its own test, + # an over-ranged ReZero stream fails every active test (2/28 manual: "all active tests will be failed") + I_meas = self._measured_current() + if self.power and self.route in CELLS + ('Z',) and not (math.isfinite(I_meas) and I_meas <= OVER_RANGE_CURRENT_A): + stream = self.route + self._add('over_range_events', 1) + self.over_range = True + self._route() # -> bypass for the rest of the slot + for cell in ([stream] if stream in CELLS else list(self._active_cells())): + if self._test_active(cell): + self._finish(cell, 'failed', 'SENSOR_OVER_RANGE') + for cell in CELLS: + cc = self.cells[cell] + t = cc['test'] + if t is not None and t['phase'] == 'running' and cc['phase'] == 'conditioning' and t['conditioning_end_ns'] is not None and self.time_ns >= t['conditioning_end_ns']: + cc['phase'] = t['cell_phase'] = 'testing' + t['conditioning_end_ns'] = None + self._route() + if self.seq is not None and self.time_ns >= self.seq['end_ns']: + self._complete_slot() + if self.seq is not None and not self._active_cells(): + self.seq = None + self.route = 'bypass' + if self.over_range and self.route == 'bypass' and self._measured_current() < 0.5 * OVER_RANGE_CURRENT_A: + self.over_range = False # routing resumes with the next slot; the tripped stream is not re-entered + self.revision += 1 + + +class AmetekOxtranSession: + def __init__(self, host, principal_id): + self._host = host + self._principal = principal_id + + @property + def _role(self): + return self._host._principals[self._principal] + + def _target(self, instance_id): + if not isinstance(instance_id, str) or instance_id != self._host.instance_id: + raise ActionRejected('UNKNOWN_INSTANCE') + + def describe(self, *, instance_id=None, asset_type_id=None): + if (instance_id is None) == (asset_type_id is None): + raise ActionRejected('INVALID_ARGUMENT') + if instance_id is not None: + self._target(instance_id) + if asset_type_id is not None and asset_type_id != ASSET_TYPE_ID: + raise ActionRejected('UNKNOWN_INSTANCE') + meta = copy.deepcopy(export_ametek_oxtran_contract_metadata()) + return dict(protocol_version=PROTOCOL_VERSION, asset_type_id=ASSET_TYPE_ID, asset_version='1.0.0', + capabilities={k: v for k, v in meta['capabilities'].items() if v['visibility'] == 'agent' or self._role != 'agent'}, + state_slots={k: v for k, v in meta['state_slots'].items() if v['visibility'] == 'agent' or self._role != 'agent'}) + + def read(self, *, instance_id, state_ids=None): + self._target(instance_id) + h = self._host + values = h.read(self._role) + ids = list(values) if state_ids is None else state_ids + if not isinstance(ids, list) or any(not isinstance(k, str) for k in ids): + raise ActionRejected('INVALID_ARGUMENT') + if any(k not in values for k in ids): + raise ActionRejected('ACCESS_DENIED') + return dict(instance_id=instance_id, status='succeeded', state_revision=h.revision, clock={'domain': 'simulation', 'time_s': h.time_s}, + observations={k: dict(value=copy.deepcopy(values[k]), unit=SLOTS[k]['unit'], + quality='unavailable' if values[k] is None else 'estimated' if SLOTS[k]['origin'] in ('sensor', 'derived') else 'valid', + sample_time_s=h.time_s, sample_window_s=None) for k in ids}) + + @staticmethod + def _filter_result(result): + result = copy.deepcopy(result) + # Public test payloads use the same redaction for every role; provenance.read is the evaluator channel. + if 'readings' in result and 'template_source' in result: + result['template_source'] = (str(LIBRARY_PATH.relative_to(ROOT)) + '; selected record available only through evaluator provenance.read') if result['template_source'] is not None else None + return result + + def _foreign(self, cell): + h = self._host + t = h.cells[cell]['test'] + owner = h._owners.get(t['op']) if t is not None else None + return owner is not None and owner != self._principal and h._principals.get(owner) == 'agent' + + def invoke(self, *, instance_id, capability_id, arguments, request_id): + h = self._host + try: + self._target(instance_id) + if not isinstance(capability_id, str) or capability_id not in CAPS: + raise ActionRejected('UNKNOWN_CAPABILITY') + if self._role == 'agent' and CAPS[capability_id]['visibility'] != 'agent': + raise ActionRejected('ACCESS_DENIED') + if not isinstance(request_id, str) or not request_id: + raise ActionRejected('INVALID_ARGUMENT') + validate(CAPS[capability_id]['input_schema'], arguments) + key = (self._principal, request_id) + digest = json.dumps([capability_id, arguments], sort_keys=True, allow_nan=False) + if key in h._requests: + old, response = h._requests[key] + if old != digest: + raise ActionRejected('REQUEST_CONFLICT') + return copy.deepcopy(response) + # Tests started by another *agent* are private to it; panel/host-started tests are shared by every operator. + if self._role == 'agent': + cell = arguments.get('cell') if isinstance(arguments, dict) else None + if capability_id in ('test.stop', 'test.result', 'test.configure', 'cell.load_unload') and cell in CELLS and self._foreign(cell): + raise ActionRejected('ACCESS_DENIED') + if capability_id in ('thermal.set_temperature', 'humidity.set', 'instrument.configure') and any( + self._foreign(c) and h._test_active(c) for c in CELLS): + raise ActionRejected('ACCESS_DENIED') + if capability_id == 'power.set' and not arguments['enabled'] and any(self._foreign(c) and h._test_active(c) for c in CELLS): + raise ActionRejected('ACCESS_DENIED') + result = self._filter_result(h.invoke(capability_id, **arguments)) + operation = result.get('operation_id') if capability_id == 'test.start' else None + if operation: + h._owners[operation] = self._principal + response = dict(protocol_version=PROTOCOL_VERSION, instance_id=instance_id, request_id=request_id, operation_id=operation, + status='accepted' if operation else 'succeeded', state_revision=h.revision, clock={'domain': 'simulation', 'time_s': h.time_s}, + result=result, observations={}, error=None) + h._requests[key] = (digest, copy.deepcopy(response)) + return response + except ActionRejected as exc: + return dict(protocol_version=PROTOCOL_VERSION, instance_id=instance_id, request_id=request_id, operation_id=None, + status='unsupported' if str(exc) == 'UNSUPPORTED' else 'rejected', state_revision=h.revision, + clock={'domain': 'simulation', 'time_s': h.time_s}, result={}, observations={}, + error=dict(code=str(exc), message=str(exc), retryable=False, side_effects='none')) + + def write(self, *, instance_id, state_id, value, request_id): + self._target(instance_id) + if not isinstance(state_id, str): + raise ActionRejected('INVALID_ARGUMENT') + entry = SLOTS.get(state_id) + if not entry or state_id not in WRITE_VIA: + raise ActionRejected('ACCESS_DENIED') + capability, argument = WRITE_VIA[state_id] + return self.invoke(instance_id=instance_id, capability_id=capability, arguments={argument: value}, request_id=request_id) + + def poll(self, operation_id): + h = self._host + if not isinstance(operation_id, str): + raise ActionRejected('INVALID_ARGUMENT') + if h._owners.get(operation_id) != self._principal: + raise ActionRejected('ACCESS_DENIED') + t = h.operations.get(operation_id) + if t is None: + raise ActionRejected('UNKNOWN_OPERATION') + result = h._result_of(t) if t['phase'] == 'running' else h.records[operation_id] + return dict(operation_id=operation_id, status=result['phase'], result=self._filter_result(result)) + + def cancel(self, operation_id, request_id): + self.poll(operation_id) + h = self._host + if not isinstance(request_id, str) or not request_id: + raise ActionRejected('INVALID_ARGUMENT') + key = (self._principal, request_id) + if key in h._cancel_operations: + if h._cancel_operations[key] != operation_id: + raise ActionRejected('REQUEST_CONFLICT') + return copy.deepcopy(h._requests[key][1]) + if key in h._requests: + raise ActionRejected('REQUEST_CONFLICT') + t = h.operations[operation_id] + if t['phase'] != 'running': + raise ActionRejected('NOT_RUNNING') + h._abort_test(t['cell']) + result = dict(cell=t['cell'], phase=t['phase'], exam_count=len([r for r in t['readings'] if r['kind'] == 'exam'])) + response = dict(protocol_version=PROTOCOL_VERSION, instance_id=h.instance_id, request_id=request_id, operation_id=operation_id, status='succeeded', + state_revision=h.revision, clock={'domain': 'simulation', 'time_s': h.time_s}, result=result, observations={}, error=None) + h._requests[key] = (json.dumps(['cancel', operation_id]), copy.deepcopy(response)) + h._cancel_operations[key] = operation_id + return response + + +WRITE_VIA = {'thermal.target_k': ('thermal.set_temperature', 'target_k'), 'humidity.target_fraction': ('humidity.set', 'rh_fraction')} +_PHASES = ['cell_a.phase', 'cell_b.phase'] +PRECONDITIONS = { + 'plant.configure': ('只能声明一次(plant.configured为假),须显式接受工程参数;热时间常数须不小于5个数值子步', ['plant.configured']), + 'gas.configure': ('须显式接受气源声明;两池都没有进行中的测试', _PHASES), + 'instrument.configure': ('两池都没有进行中的测试;手动气压计模式须给出气压值', _PHASES), + 'test.configure': ('该池没有进行中的测试;收敛模式的最大周期数须不小于收敛次数+1', _PHASES), + 'power.set': ('须已声明工程参数;断电会取消所有进行中的测试', ['plant.configured', 'power.enabled']), + 'thermal.set_temperature': ('须已声明工程参数;目标在10–40°C', ['plant.configured']), + 'humidity.set': ('须已声明工程参数;目标为0(干气)或5–90%', ['plant.configured']), + 'drawer.move': ('须已声明工程参数;该池未夹紧、压板完全抬起且不在行程中', ['plant.configured', 'cell_a.clamped', 'cell_b.clamped', 'clamp_a.position_m', 'clamp_b.position_m']), + 'sample.mount': ('抽屉完全拉出且静止、测试盒未夹紧、盒内无膜;须接受传输先验;亲水模板须给出湿度系数,疏水模板不接受非零系数', + ['drawer_a.position_m', 'drawer_b.position_m', 'cell_a.clamped', 'cell_b.clamped', 'cell_a.film_mounted', 'cell_b.film_mounted']), + 'sample.unmount': ('抽屉完全拉出且静止、测试盒未夹紧、盒内有膜', ['drawer_a.position_m', 'drawer_b.position_m', 'cell_a.clamped', 'cell_b.clamped', 'cell_a.film_mounted', 'cell_b.film_mounted']), + 'cell.load_unload': ('须通电且压板不在行程中;夹紧前抽屉须推到底;松开前该池测试须已结束', + ['power.enabled', 'cell_a.clamp_moving', 'cell_b.clamp_moving', 'cell_a.drawer_closed', 'cell_b.drawer_closed', 'cell_a.clamped', 'cell_b.clamped'] + + _PHASES), + 'test.start': ('须已声明工程参数、气源、仪器参数与该池方法;通电;两路供气表压在厂家范围;该池已夹紧且没有进行中的测试', + ['plant.configured', 'gas.configured', 'instrument.configured', 'cell_a.method_configured', 'cell_b.method_configured', 'power.enabled', + 'gas.supply_ok', 'cell_a.clamped', 'cell_b.clamped'] + _PHASES), + 'test.stop': ('该池有进行中的测试', _PHASES), +} +ERROR_ZH = { + 'INVALID_ARGUMENT': '参数不符合输入结构、类型或范围(或收敛判据与最大周期数矛盾)', 'ACCESS_DENIED': '该角色无权调用,或该池测试属于另一个agent', + 'REQUEST_CONFLICT': '同一request_id已用于不同的请求', 'UNKNOWN_INSTANCE': '实例ID不存在', 'UNSUPPORTED': '本配置不提供该功能(理由见function_zh)', + 'PLANT_ALREADY_CONFIGURED': '工程参数只能声明一次', 'ENGINEERING_ACCEPTANCE_REQUIRED': '未显式接受工程假设、气源声明或传输先验', + 'THERMAL_TIME_CONSTANT_OUTSIDE_NUMERICAL_DOMAIN': '测试池热时间常数小于5个数值子步,超出数值适用域', 'BUSY': '有进行中的测试,不能改这项配置', + 'MANUAL_BAROMETER_REQUIRED': '手动气压计模式缺少气压值', 'PLANT_REQUIRED': '尚未声明工程参数(test.start还需要气源声明)', + 'RH_OUTSIDE_CONTROLLED_RANGE': '湿度目标既不是0也不在5–90%受控范围', 'CARTRIDGE_CLAMPED': '测试盒已夹紧或压板未完全抬起,抽屉不能移动', + 'FILM_ALREADY_MOUNTED': '测试盒内已有膜样', 'DRAWER_NOT_OPEN': '抽屉未完全拉出、仍在移动或测试盒被夹紧', 'UNKNOWN_TEMPLATE': '模板库中没有该模板', + 'DIFFUSIVITY_REQUIRED': '模板没有实验扩散系数,且未给出替代值', 'HUMIDITY_COEFFICIENT_NOT_APPLICABLE': '疏水模板不接受非零湿度系数', + 'HUMIDITY_COEFFICIENT_REQUIRED': '亲水模板装膜时必须给出湿度系数', 'NO_FILM': '测试盒内没有膜样', + 'POWER_OFF': '未通电时拒绝(无副作用);运行中断电使测试以POWER_OFF取消(已记录读数保留)', 'CLAMP_BUSY': '压板正在动作', + 'TEST_ACTIVE': '该池测试进行中,不能松开', 'DRAWER_NOT_CLOSED': '抽屉未推到底,不能夹紧', 'METHOD_REQUIRED': '未设定仪器参数或该池测试方法', + 'GAS_SUPPLY_PRESSURE_OUT_OF_RANGE': '载气或测试气供气表压不在厂家范围', 'CELL_NOT_CLAMPED': '该池未夹紧', 'NOT_RUNNING': '该池没有进行中的测试', + 'USER_CANCEL': '测试被停止或取消(已记录读数保留)', 'SENSOR_OVER_RANGE': '传感器超量程保护使测试失败(池通道:该池;ReZero通道:全部进行中的测试)', + 'TOO_MANY_READINGS': '读数达到5000条记录上限,测试失败', +} +_COMMON_ERRORS = ['INVALID_ARGUMENT', 'REQUEST_CONFLICT', 'UNKNOWN_INSTANCE'] +_GUARDED = {'test.stop', 'test.result', 'test.configure', 'cell.load_unload', 'thermal.set_temperature', 'humidity.set', 'instrument.configure', 'power.set'} + + +def _errors_of(k): + """Codes the Session can return for capability k: schema/idempotency/instance errors, ACCESS_DENIED only for evaluator + capabilities or the foreign-test guard, then the runtime's own rejections (and asynchronous terminal reasons).""" + if k in UNSUPPORTED: + return ['UNSUPPORTED'] + _COMMON_ERRORS + access = ['ACCESS_DENIED'] if (CAPS[k]['visibility'] != 'agent' or k in _GUARDED) else [] + return _COMMON_ERRORS + access + CAP_ERRORS.get(k, []) +CAP_ERRORS = { + 'plant.configure': ['PLANT_ALREADY_CONFIGURED', 'ENGINEERING_ACCEPTANCE_REQUIRED', 'THERMAL_TIME_CONSTANT_OUTSIDE_NUMERICAL_DOMAIN'], + 'gas.configure': ['ENGINEERING_ACCEPTANCE_REQUIRED', 'BUSY'], 'instrument.configure': ['MANUAL_BAROMETER_REQUIRED', 'BUSY'], 'test.configure': ['BUSY'], + 'power.set': ['PLANT_REQUIRED'], 'thermal.set_temperature': ['PLANT_REQUIRED'], 'humidity.set': ['PLANT_REQUIRED', 'RH_OUTSIDE_CONTROLLED_RANGE'], + 'drawer.move': ['PLANT_REQUIRED', 'CARTRIDGE_CLAMPED'], + 'sample.mount': ['PLANT_REQUIRED', 'FILM_ALREADY_MOUNTED', 'DRAWER_NOT_OPEN', 'ENGINEERING_ACCEPTANCE_REQUIRED', 'UNKNOWN_TEMPLATE', 'DIFFUSIVITY_REQUIRED', + 'HUMIDITY_COEFFICIENT_NOT_APPLICABLE', 'HUMIDITY_COEFFICIENT_REQUIRED'], + 'sample.unmount': ['NO_FILM', 'DRAWER_NOT_OPEN'], 'cell.load_unload': ['PLANT_REQUIRED', 'POWER_OFF', 'CLAMP_BUSY', 'TEST_ACTIVE', 'DRAWER_NOT_CLOSED'], + 'test.start': ['PLANT_REQUIRED', 'POWER_OFF', 'METHOD_REQUIRED', 'GAS_SUPPLY_PRESSURE_OUT_OF_RANGE', 'CELL_NOT_CLAMPED', 'BUSY', 'USER_CANCEL', 'SENSOR_OVER_RANGE', + 'TOO_MANY_READINGS'], + 'test.stop': ['NOT_RUNNING'], +} +_PARTIAL = {'USER_CANCEL', 'POWER_OFF', 'SENSOR_OVER_RANGE', 'TOO_MANY_READINGS'} +_MAN, _BRO, _PAGE, _CERT, _M228, _ASTM = ('manufacturer_primary', 'manufacturer_brochure_2025', 'manufacturer_product_page', 'manufacturer_certified_film_instructions', + 'related_model_manual_228', 'astm_d3985') +CAP_SOURCES = { # documents each capability's behaviour (or its unsupported status) rests on; ids are registered in the contract sources + 'plant.configure': ['simulation_assumption', _M228], 'gas.configure': [_PAGE, _M228, 'simulation_assumption'], 'instrument.configure': [_M228, _CERT], + 'test.configure': [_CERT, _M228, _MAN], 'power.set': [_PAGE, 'simulation_assumption'], 'thermal.set_temperature': [_MAN, _BRO, _M228, 'simulation_assumption'], + 'humidity.set': ['user_workbook', _MAN, _BRO, 'simulation_assumption'], 'drawer.move': [_PAGE, _M228, 'geometry', 'simulation_assumption'], + 'sample.mount': ['template_library', 'template_source_polyverse', _PAGE, 'simulation_assumption'], 'sample.unmount': ['template_library', 'simulation_assumption'], + 'cell.load_unload': [_PAGE, _M228], 'test.start': [_MAN, _CERT, _M228, _ASTM, 'template_library', 'simulation_assumption'], 'test.stop': [_M228], + 'test.result': [_MAN, _M228, _ASTM], 'analysis.otr': [_ASTM, _M228], 'ledger.read': ['simulation_assumption', 'runtime_code'], + 'provenance.read': ['template_library', 'template_source_polyverse'], 'sim.step': ['runtime_code', 'simulation_assumption'], + 'hardware.connect': [_PAGE], 'robot.mount_film': ['simulation_assumption'], 'package.test': [_PAGE, _MAN], 'cartridge.reduced_area': [_PAGE, _MAN], + 'cartridge.edge_effect': [_PAGE, _MAN], 'cartridge.blister': [_PAGE, _MAN], 'test_mode.convergence_by_hours': [_PAGE, _BRO], 'test.qc_mode': [_PAGE, _BRO], + 'test.auto_method': [_PAGE, _BRO], 'test.sequencing': [_PAGE, _BRO], 'report.export': [_PAGE, _BRO], 'accuracy.certification': [_CERT, _ASTM], + 'sensor.adjust': [_CERT, _PAGE, _M228]} +_RESULT_SLOTS = ['cell_a.phase', 'cell_b.phase', 'cell_a.exam_count', 'cell_b.exam_count', 'cell_a.last_otr_mol_m2_s', 'cell_b.last_otr_mol_m2_s', + 'cell_a.final_otr_mol_m2_s', 'cell_b.final_otr_mol_m2_s'] +OBSERVES = { + 'plant.configure': ['plant.configured'], 'gas.configure': ['gas.configured', 'gas.supply_ok'], 'instrument.configure': ['instrument.configured'], + 'power.set': ['power.enabled'], 'thermal.set_temperature': ['thermal.target_k', 'thermal.indicated_k'], + 'humidity.set': ['humidity.target_fraction', 'humidity.indicated_fraction'], + 'drawer.move': ['drawer_a.position_m', 'drawer_b.position_m', 'cell_a.drawer_closed', 'cell_b.drawer_closed'], + 'sample.mount': ['cell_a.film_mounted', 'cell_b.film_mounted'], 'sample.unmount': ['cell_a.film_mounted', 'cell_b.film_mounted'], + 'cell.load_unload': ['cell_a.clamped', 'cell_b.clamped', 'cell_a.clamp_moving', 'cell_b.clamp_moving', 'cell_a.indicator_on', 'cell_b.indicator_on'], + 'test.configure': ['cell_a.method_configured', 'cell_b.method_configured'], + 'test.start': _RESULT_SLOTS + ['sensor.route', 'sequence.slot_remaining_s'], 'test.stop': _RESULT_SLOTS, 'test.result': _RESULT_SLOTS, + 'sim.step': ['clock.time_s'], +} +PARAM_ZH = { + 'ambient_k': '实验室环境温度', 'ambient_rh': '实验室环境相对湿度(决定装膜时膜内溶解氧与环境渗入的O₂分压)', 'barometric_pa': '实验室大气压(绝对)', + 'block_heat_capacity_j_k': '测试池块集中热容', 'block_loss_w_k': '测试池块对环境的散热系数', 'tec_max_w': '热电模块最大加热/制冷功率', + 'controller_gain_w_k': '温控PI比例增益', 'controller_integral_s': '温控PI积分时间', 'temperature_sensor_bias_k': '池温传感器静态偏差(在±0.2K内)', + 'rh_time_constant_s': '湿度发生器一阶时间常数', 'rh_bias': '湿度静态偏差(在±4%RH内)', 'test_chamber_volume_m3': '每池测试气腔全混体积', + 'carrier_chamber_volume_m3': '每池载气腔全混体积', 'test_gas_flow_sccm_per_cell': '每池测试气流量(标准状态)', 'catalyst_removal_efficiency': '载气催化除氧效率(H₂≥1%时有效)', + 'edge_leak_mol_s_pa': '测试盒边缘泄漏导通(按测试侧O₂分压)', 'ambient_ingress_mol_s_pa': '环境向载气侧的渗入导通(TruSeal冲洗前)', + 'truseal_flush_efficiency': 'TruSeal双密封冲洗对环境渗入的去除比例', 'rezero_path_leak_mol_s': 'ReZero路径的O₂漏入速率', 'sensor_time_constant_s': 'Coulox传感器一阶响应时间常数', + 'sensor_efficiency': '传感器O₂还原效率', 'sensor_background_a': '传感器背景电流', 'sensor_noise_a': '传感器加性噪声标准差', 'sensor_relative_noise': '传感器比例噪声标准差', + 'noise_seed': '噪声随机数种子', 'clamp_actuation_s': '气动压板全行程时间', 'drawer_speed_m_s': '宿主拉/推抽屉的速度', 'carrier_total_flow_sccm': '整机载气总消耗流量(标准状态)', + 'test_total_flow_sccm': '整机测试气总消耗流量(标准状态)', 'accept_engineering': '宿主显式接受以上工程参数', 'carrier_h2_fraction': '载气中H₂份额(厂家98/2 N₂/H₂)', + 'carrier_o2_impurity_fraction': '载气钢瓶O₂杂质份额', 'carrier_supply_gauge_pa': '载气供气表压', 'test_o2_fraction': '测试气O₂份额(≥99.9%或空气)', + 'test_supply_gauge_pa': '测试气供气表压', 'accept_gas_supply': '宿主显式接受气源声明', 'thickness_m': '膜样实际厚度', 'exposed_area_m2': '膜样暴露面积(箔掩膜可缩小)', + 'permeability_override_mol_m_per_m2_s_pa': '宿主替代的298K渗透系数', 'diffusivity_override_m2_s': '宿主替代的298K扩散系数', + 'permeability_activation_energy_j_mol': '渗透系数的Arrhenius活化能', 'diffusivity_activation_energy_j_mol': '扩散系数的Arrhenius活化能', + 'humidity_coefficient': '亲水聚合物的湿度塑化系数β(P、D乘exp(β·a_w))', 'accept_transport_assumptions': '宿主显式接受膜传输先验', + 'cycles': '标准模式检测周期数', 'exam_minutes': '每个检测时段长度', 'conditioning_hours': '调理时间(传感器旁路、测试气已通)', + 'convergence_percent': '收敛判据:相邻检测相对变化上限', 'convergence_count': '收敛判据:连续满足的检测次数', 'max_cycles': '收敛模式最大检测周期数', + 'declared_area_m2': '报告用的声明面积', 'declared_thickness_m': '报告渗透率用的声明厚度', 'temperature_tolerance_k': '测试期间允许的池温偏差', + 'permeant_concentration_percent': '测试气渗透物浓度(归一到100% O₂)', 'rezero_enabled': '是否启用ReZero基线', 'rezero_frequency': '每几个池时段做一次ReZero', + 'rezero_exam_minutes': 'ReZero时段长度', 'manual_barometer_pa': '手动输入的气压', +} +NULLABLE_ZH = {'permeability_override_mol_m_per_m2_s_pa': 'null=用模板298K渗透系数', 'diffusivity_override_m2_s': 'null=用模板扩散系数,模板无D时必须给出', + 'humidity_coefficient': '疏水模板必须为null或0,亲水模板装膜时必须给出', 'declared_thickness_m': 'null=不报告渗透率', + 'manual_barometer_pa': 'null=用内置气压计(自动模式)'} +_CELL_SLOTS = lambda k: [f'cell_{c}.{k}' for c in 'ab'] # noqa: E731 +EFFECTS = { + 'plant.configure': ['plant.configured', 'thermal.target_k', 'truth.block_temperature_k'], + 'gas.configure': ['gas.configured', 'gas.supply_ok'], + 'instrument.configure': ['instrument.configured'], + 'test.configure': _CELL_SLOTS('method_configured'), + 'power.set': ['power.enabled', 'power.angle_rad', 'thermal.indicated_k', 'humidity.indicated_fraction', 'barometer.indicated_pa', 'sensor.raw_counts', 'sensor.route', + 'sequence.slot_remaining_s', 'truth.tec_power_w'] + _CELL_SLOTS('phase') + _CELL_SLOTS('indicator_on') + _CELL_SLOTS('final_otr_mol_m2_s') + _CELL_SLOTS('clamped') + + _CELL_SLOTS('clamp_moving') + [f'truth.cell_{c}.{k}' for c in 'ab' for k in ('carrier_side_o2_mol', 'test_side_o2_pa')] + ['truth.sensor_current_a'], + 'thermal.set_temperature': ['thermal.target_k'], + 'humidity.set': ['humidity.target_fraction'], + 'drawer.move': _CELL_SLOTS('drawer_closed'), + 'sample.mount': _CELL_SLOTS('film_mounted') + [f'truth.cell_{c}.film_o2_mol' for c in 'ab'], + 'sample.unmount': _CELL_SLOTS('film_mounted') + [f'truth.cell_{c}.film_o2_mol' for c in 'ab'], + 'cell.load_unload': _CELL_SLOTS('clamped') + _CELL_SLOTS('indicator_on') + _CELL_SLOTS('clamp_moving'), + 'test.start': _CELL_SLOTS('phase') + _CELL_SLOTS('exam_count') + _CELL_SLOTS('last_otr_mol_m2_s') + ['sensor.route', 'sequence.slot_remaining_s'], + 'test.stop': _CELL_SLOTS('phase') + _CELL_SLOTS('final_otr_mol_m2_s') + ['sensor.route'], + 'sim.step': list(SLOTS), +} +for _k, _v in EFFECTS.items(): + CAPS[_k]['effects'] = _v +ERRORS = sorted(set(re.findall(r"ActionRejected\('([A-Z_0-9]+)'", Path(__file__).read_text())) | + {'USER_CANCEL', 'OPERATOR_STOP', 'POWER_OFF', 'SENSOR_OVER_RANGE', 'TEST_COMPLETE', 'TOO_MANY_READINGS'}) +ASYNC = {'test.start'} +LIMITATIONS = [ + '选定OX-TRAN 2/22 L两池型、标准50cm²可拆卸水平测试盒;未选缩小面积(5.64cm²)/边缘效应/泡罩测试盒、整包测试适配器、PermWare与PERM-NET Lite;不建模Auto-Test、QC模式、顺序测试与报告导出。', + '厂家规格(L型50cm²):量程0.005–200cc/(m²·day)、整包0.000025–1.0cc/(pkg·day)、温度10–40°C±0.2°C、膜厚≤120mil;分辨率按调研表取0.002cc/(m²·day)(2025规格书/产品页为0.0001),RH按调研表取5–90%±4%(2025规格书为0%/30–90%±3%,产品页为0–90%±3%),冲突记录在source_evidence.json;0%RH作为干气测试另行允许(认证膜说明)。', + '测试池块为集中热节点,热电模块可加热/制冷;热容、散热、功率上限与PI参数为宿主工程参数,缺省值按同机身2/28手册“约60分钟到达40°C设定的99%”调校;控温以自身(带±0.2K内静态偏差的)传感器为准,因此真实池温=设定值−偏差、显示值=设定值。', + '湿度发生器为一阶响应加静态偏差(±4%内),加湿原理与水源未公开;湿测试气按道尔顿分压稀释O₂驱动压(p_O₂=y·(P−p_w)),仪器报告不对此稀释作修正(工程判断)。', + '膜为一维Fick扩散:P、D取所选模板在298K的实验值(polyVERSE汇编),S=P/D;温度按宿主给定的活化能Arrhenius外推(缺省45kJ/mol,约6%/K,处于厂家“6–15%/°C”下限);模板库的D·S与P不一致时以P与D为准。亲水聚合物的湿度塑化系数必须由宿主显式给出,疏水聚合物湿度影响按零处理(假设);未建模结晶度、取向、涂层分层、非Fick溶胀或浓度依赖扩散。', + '载气腔、测试气腔为全混体积(宿主给定体积与流量);边缘泄漏∝测试侧O₂分压,环境渗入按TruSeal冲洗效率折减;单池零点在测试侧改通载气后测量,可扣除环境渗入但不能扣除与测试气分压成正比的边缘泄漏;空测试盒按开放窗口大导通处理(通常触发传感器超量程)。', + 'Coulox传感器按法拉第定律(1cc/day≈0.000199A)、一阶响应、背景电流、效率、10pA计数量化与宿主噪声建模;噪声为一阶相关(相关时间=传感器时间常数)的加性与比例噪声,面板原始计数、检测与ReZero读数取自同一测量信号;测得电流超过量程上限1.25倍即旁路保护(检测滞后不超过一个≤10s子步):池通道超量程使该池测试失败,ReZero通道超量程使所有进行中的测试失败(2/28手册),该时段不再接回;电流回落到阈值一半后解除,下一时段恢复轮换;传感器寿命/电解液消耗未建模。', + '调研表把“载气和测试气流”列为操作设置:本资产载气固定为每池10sccm(认证膜说明规定的设定值),测试气每池流量与两路总流量是宿主(evaluator)的工程参数,agent不能改流量;流量计、针阀和流量报警未建模。', + '检测序列按固定时段A、B、Z轮换(ReZero频率=每N个池时段一次ReZero),空闲池的时段以旁路计时;该排法由认证膜说明中“周期数/测试小时”的比例推断,厂家帮助系统不可得。报告OTR=(I检测−I_ReZero)/(4F)/面积×760mmHg/P大气×100/渗透物浓度,并按调研表分辨率量化;2/22没有公开的用户增益调整(认证膜超差需送修),sensor.adjust为unsupported。', + '连续模式由操作者test.stop结束(有结束零点则先测零点);标准/收敛模式中途test.stop为终止;异步操作的cancel总是中止。测试中温度或湿度设定改变或显示值偏离容差时结果分别标为temperature/humidity_out_of_tolerance。收敛模式按最近N次相对变化≤阈值判定(阈值与N由方法给出,厂家精确算法未公开);重复性按“0.002cc/(m²·day)或1%取大”判定(掩膜时绝对项与读数量化一样按50cm²/覆盖面积放大);名义渗透量/渗透率=OTR/101325Pa(及×声明厚度),未扣除湿气稀释。', + '抽屉拉出/推回、装膜/取膜为宿主代理(不是机器人接触验证);夹紧为气动一键动作;断电时压板停在当前位置,未完成的行程视为未密封(载气腔与空气相通),压板未完全抬起时抽屉不能拉出(工程假设);盖板只是被动场景关节。', + 'agent只能看到带噪声的量化计数、显示温湿度、气压、检测读数与结果;真实通量、膜内含氧、腔体分压、真实湿度与温度、所选模板身份只对evaluator可见;test.result对所有角色隐去模板身份;亲水模板的湿度系数在装膜时由宿主给出,agent的湿度设定不会因模板类别被拒。某个agent启动的测试,其他agent不能停止、读取完整记录(test.result)、改配置、改该池夹紧,也不能在其运行时改温度、湿度、仪器参数或断电;各池阶段、检测次数、最近与最终OTR属于前面板公开显示,所有操作者可见。', + '时间推进为事件对齐的子步(≤10s;膜内再按扩散时间细分):膜与载气腔在同一隐式方程组中求解(对任意渗透率与腔体体积无条件稳定、非负);O₂物质账按求解器的真实界面通量、吹扫出流与传感器电荷(含在途量)记账,热量账按指数解析积分记账,均用补偿求和,因此残差是对积分器的真实守恒检查而不是恒等式;不同step切分只造成传感器噪声抽样时刻外的微小数值差。', + '只有传感器整段接在该气流上的检测时段才记录读数或ReZero:调理在时段中途结束、测试在时段中途开始或超量程恢复后的剩余时段不计。无载气压力时载气腔不吹扫、传感器无进气;无测试气压力时测试腔不换气。更换气源或断电后先重新测ReZero;启用ReZero时没有基线就先排ReZero时段,不会做无基线的检测。', + '没有真实硬件、WinPerm 2界面、认证膜实测、NIST溯源或ASTM D3985精密度验证;模板为文献汇编的干气P、D,不是OX-TRAN原生测试文件。', +] + + +def export_ametek_oxtran_contract_metadata(): + slots = {} + caps = {} + for k, v in SLOTS.items(): + slots[k] = dict(meaning_zh=v['meaning'], component_ids=[v['component']], value_schema=copy.deepcopy(v['schema']), unit=v['unit'], + reference_conditions=v['reference'], origin=v['origin'], visibility=v['visibility'], + access='read_write' if k in WRITE_VIA else 'read_only', + read_binding=dict(backend='host', artifact_id='runtime', accessor=f'AmetekOxtranSession.read(state_ids=[{k!r}])'), + write_via=None if k not in WRITE_VIA else dict(capability_id=WRITE_VIA[k][0], argument=WRITE_VIA[k][1], fixed_arguments={}), + sampling=dict(mode='instant', time_domain='simulation', + window_description='Pure read; sensor counts 10 pA, display 0.01 K / 0.001 RH / 10 Pa quantisation; exam readings at the end of each exam slot.'), + source_ids=['simulation_assumption']) + for k, v in CAPS.items(): + un = k in UNSUPPORTED + async_ = k in ASYNC + c = {key: copy.deepcopy(v[key]) for key in ['input_schema', 'output_schema', 'component_ids', 'function_zh', 'kind', 'visibility', 'example_arguments']} + c.update(availability='unsupported' if un else 'implemented', + implementation={layer: 'absent' if un or layer in ('scene', 'robot', 'hardware') else 'implemented' for layer in ['process', 'scene', 'robot', 'hardware', 'host']}, + binding=None if un else dict(backend='host', artifact_id='runtime', entrypoint='asset_runtime.ametek_oxtran.AmetekOxtranSession.invoke', + invocation=f'session.invoke(instance_id="oxtran_01",capability_id={k!r},arguments={v["example_arguments"]!r},request_id="unique")'), + preconditions=[] if un or k not in PRECONDITIONS else [dict( + description_zh=PRECONDITIONS[k][0] + ';被拒时状态不变。', state_ids=list(PRECONDITIONS[k][1]), enforced_by='runtime', check='AmetekOxtranRuntime.invoke')], + state_effects=[dict(state_id=s, timing='on_step' if k == 'sim.step' else 'immediate', description_zh='设定或操作标志;温湿度、扩散、传感器与检测序列只随step推进') + for s in v['effects']], + observes=[] if un else list(OBSERVES.get(k, [])), model_effects=dict(mode='none', description_zh='运行层只输出状态,由场景层绑定关节与读数', binding_ids=[]), + execution=dict(mode='asynchronous' if async_ else 'synchronous', time_domain='simulation', + completion_criterion='按方法达到N周期/收敛/单池零点结束(或停止/超量程/断电)' if async_ else '原子配置或外部动作请求,实际状态由step推进', + completion_state_ids=['cell_a.phase', 'cell_b.phase'] if async_ else [], timeout_s=None, cancellation='supported' if async_ else 'unsupported', + retry='same_request_id', resources=['host_clock', 'test_cell', 'coulox_sensor', 'flow_controllers'], + partial_failure_zh='停止/断电/超量程只终止该池检测序列;已记录读数、ReZero记录与膜内状态保留,测试气切回载气冲洗。'), + errors=[dict(code=e, meaning_zh=ERROR_ZH[e], side_effects='partial' if async_ and e in _PARTIAL else 'none') + for e in _errors_of(k)], + verification=[], limitations=list(LIMITATIONS), source_ids=list(CAP_SOURCES[k])) + if k in ('test.start', 'cell.load_unload', 'drawer.move', 'thermal.set_temperature', 'humidity.set', 'power.set', 'sample.mount'): + c['state_effects'] += [dict(state_id=s, timing='on_step', description_zh='由统一宿主时钟推进温湿度、机械动作、扩散、腔体吹扫、传感器与检测序列') + for s in SLOTS if s not in v['effects'] and SLOTS[s]['origin'] in ('sensor', 'derived', 'scene', 'process_truth')] + caps[k] = c + mechanism = dict( + component_ids=['thermal_module', 'rh_generator', 'cartridge_a', 'cartridge_b', 'film_a', 'film_b', 'cell_head_a', 'cell_head_b', 'coulox_sensor', + 'rezero_cell', 'flow_controllers', 'catalyst_converter', 'barometer', 'controller_board'], + state_ids=list(slots), meaning_zh='测试池热电控温与湿度发生、膜内一维Fick扩散(Arrhenius与水活度修正)、载气/测试气腔吹扫、边缘泄漏与环境渗入、库仑传感器与ReZero基线、检测序列与OTR归一', + implementation='lumped', + equations=['C_b dT/dt = Q_tec - G (T - T_amb) ; Q_tec = clamp(Kp e + I, -Q_max, Q_max) (conditional integration), exact exponential update per sub-step', + 'dc/dt = D d2c/dx2 in the film ; c(0) = S p_up, c(L) = S p_dn ; P(T,aw) = P_ref exp(-E_P/R (1/T - 1/T_ref) + beta aw), D likewise, S = P/D ; backward-Euler finite volume (exactly conservative)', + 'p_up -> y_O2 (P_baro - RH p_sat(T)) during conditioning/testing (0 when flushed with carrier), first order with tau = V_t/F_t', + 'dn_h/dt = J_film A + k_edge p_up + k_amb (1 - eta_flush) p_O2,air + x_res n_c - (F_c/V_h) n_h (film and chamber solved in one backward-Euler tridiagonal system; F_c = 0 without carrier supply)', + 'I_sensor -> 4 F eta n_in + I_bg, first order tau_s ; counts = I / 10 pA ; 1 cc/day = 0.000199 A', + 'OTR = (I_exam - I_rezero)/(4F) / A x 760 mmHg / P_baro x 100 / permeant%, quantised to 0.002 cc/(m2 day) at 50 cm2', + 'final OTR = mean(last N exams) - individual zero ; repeatability allowance = max(0.002 cc/(m2 day), 1 %)'], + parameters={}, source_ids=['simulation_assumption', 'template_library'], limitations=list(LIMITATIONS)) + import importlib.util + spec = importlib.util.spec_from_file_location('_oxtran_local_annotations', ROOT / 'scripts/asset_runtime/_annotations.py') + ann = importlib.util.module_from_spec(spec) + spec.loader.exec_module(ann) + ann.KEY_ZH.update({k: v['meaning'] for k, v in SLOTS.items()}) + ann.PARAM_ZH.update(PARAM_ZH) + ann.annotate_export(SLUG, caps, slots, {'oxygen_permeation': mechanism}, + inputs={'plant.configure': (PLANT, PLANT_EXAMPLE), 'gas.configure': (GAS, GAS_EXAMPLE), 'sample.mount': (MOUNT, MOUNT_EXAMPLE), + 'test.configure': (TEST_CFG, TEST_CFG_EXAMPLE), 'instrument.configure': (INSTRUMENT, INSTRUMENT_EXAMPLE)}) + params = mechanism['parameters'] + for cap_name, (schema, example) in (('sample.mount', (MOUNT, MOUNT_EXAMPLE)), ('test.configure', (TEST_CFG, TEST_CFG_EXAMPLE)), + ('instrument.configure', (INSTRUMENT, INSTRUMENT_EXAMPLE))): + for name, prop in schema['properties'].items(): + if name in params or 'anyOf' not in prop: + continue + base = next(x for x in prop['anyOf'] if x.get('type') != 'null') + params[name] = dict(value=example.get(name), unit=base.get('x-unit', '1'), + meaning_zh=f'{PARAM_ZH.get(name, name)};宿主在 {cap_name} 显式输入,可为null({NULLABLE_ZH[name]});此处登记示例值,非厂家标定或实测。', + evidence='assumption', source_ids=['simulation_assumption'], + uncertainty=f"schema 允许 {base.get('minimum')}–{base.get('maximum')} {base.get('x-unit', '1')} 或 null") + for k, v in SLOTS.items(): + slots[k]['meaning_zh'] = v['meaning'] + if v['reference']: + slots[k]['reference_conditions'] = v['reference'] + return dict(asset_type_id=ASSET_TYPE_ID, catalog_id=CATALOG_ID, capabilities=caps, state_slots=slots, mechanisms={'oxygen_permeation': mechanism}) diff --git a/scripts/asset_runtime/lakeshore_8604vsm.py b/scripts/asset_runtime/lakeshore_8604vsm.py new file mode 100644 index 0000000000000000000000000000000000000000..f32bf827027712703a13994a0c9336ee14f50a76 --- /dev/null +++ b/scripts/asset_runtime/lakeshore_8604vsm.py @@ -0,0 +1,518 @@ +"""Lake Shore8604, room-temperature86-LC/standard poles/ExactGAP2. +SI magnetic moment A m2 (1 emu=1e-3 A m2). Rate-limited external B, +explicit interval-mean lock-in observations, synthetic Preisach memory when +requested, and separately conserved electrical/magnetic/passive-thermal energy. +""" +from __future__ import annotations +import copy,importlib.util,json,math +from pathlib import Path +import numpy as np +PROTOCOL_VERSION='1.0.0';SLUG='lakeshore_8604vsm';ASSET_TYPE_ID='instrument.'+SLUG;CATALOG_ID='CHEM-143' +ROOT=Path(__file__).resolve().parents[2];ASSET=ROOT/'assets/expansion_batch04/t1_thermal'/SLUG;LIBRARY_PATH=ASSET/'magnetic_library.json' +MU0=4e-7*math.pi;MAX_FIELD_T=2.37;FIELD_RESOLUTION_T=1e-7;MIN_MOMENT_A_M2=2.5e-11;MAX_MOMENT_A_M2=1. +class ActionRejected(ValueError):pass + +def number(unit='1',lo=None,hi=None): + s={'type':'number','x-unit':unit} + if lo is not None:s['minimum']=lo + if hi is not None:s['maximum']=hi + return s + +def obj(properties):return dict(type='object',properties=properties,required=list(properties),additionalProperties=False) +def nullable(s):return {'anyOf':[s,{'type':'null'}]} +def array(s,minimum=0,maximum=200001):return dict(type='array',items=s,minItems=minimum,maxItems=maximum) +def enum(items):return {'type':'string','enum':items} +BOOL={'type':'boolean'};TEXT={'type':'string'};PHASE=enum(['idle','running','succeeded','cancelled','failed']) + +def validate(s,v): + if 'anyOf' in s: + for o in s['anyOf']: + try:validate(o,v);return + except ActionRejected:pass + raise ActionRejected('INVALID_ARGUMENT') + k=s.get('type') + if k in ('number','integer'): + if isinstance(v,bool) or not isinstance(v,(int,float)) or not math.isfinite(v) or k=='integer' and type(v) is not int or not s.get('minimum',-math.inf)<=v<=s.get('maximum',math.inf):raise ActionRejected('INVALID_ARGUMENT') + elif k=='object': + if not isinstance(v,dict) or set(v)!=set(s['properties']):raise ActionRejected('INVALID_ARGUMENT') + for key,value in v.items():validate(s['properties'][key],value) + elif k=='array': + if not isinstance(v,list) or not s.get('minItems',0)<=len(v)<=s.get('maxItems',math.inf):raise ActionRejected('INVALID_ARGUMENT') + for x in v:validate(s['items'],x) + elif k=='boolean' and type(v) is not bool:raise ActionRejected('INVALID_ARGUMENT') + elif k=='string' and not isinstance(v,str):raise ActionRejected('INVALID_ARGUMENT') + elif k=='null' and v is not None:raise ActionRejected('INVALID_ARGUMENT') + if 'enum' in s and v not in s['enum']:raise ActionRejected('INVALID_ARGUMENT') + + +def library():return {x['id']:x for x in json.loads(LIBRARY_PATH.read_text())['templates']} +def quant(value,resolution):return float(round(value/resolution)*resolution) +def weighted_exponential_integrals(dt,tau): + x=dt/tau + if x<.5: + out=[] + for n in range(3): + term=1/(n+1);total=term + for k in range(1,30):term*=-x/(n+k+1);total+=term + out.append(dt**(n+1)*total) + return out + j0=-tau*math.expm1(-x);j1=tau*dt-tau*j0;return j0,j1,tau*dt*dt-2*tau*j1 + +def infer_moment(voltage_v,sensitivity_v_per_a_m2,calibration_gain,calibration_offset_v): + if sensitivity_v_per_a_m2<=0 or calibration_gain<=0:raise ActionRejected('CALIBRATION_INVALID') + return (voltage_v-calibration_offset_v)*calibration_gain/sensitivity_v_per_a_m2 + +def analyze_loop(rows): + if len(rows)<3 or any(x['moment_a_m2'] is None for x in rows):raise ActionRejected('INVALID_OBSERVATIONS') + crossings=[];remanence=[] + for a,b in zip(rows,rows[1:]): + b0,b1=a['field_t'],b['field_t'];m0,m1=a['moment_a_m2'],b['moment_a_m2'];direction='ascending' if b1>b0 else 'descending' + if b0==b1:continue + if m0*m1<=0 and m0!=m1: + value=b0-m0*(b1-b0)/(m1-m0);crossings.append(dict(field_t=value,external_h_a_m=value/MU0,direction=direction)) + if b0*b1<=0: + value=m0-b0*(m1-m0)/(b1-b0);remanence.append(dict(moment_a_m2=value,direction=direction)) + area=float(sum((a['field_t']+b['field_t'])*.5*(b['moment_a_m2']-a['moment_a_m2']) for a,b in zip(rows,rows[1:]))) + return dict(coercive_crossings=crossings,remanence_estimates=remanence,observed_b_dm_j=area,evidence='external_observations_linear_zero_crossings; applied_B_over_mu0_is_external_H_not_demagnetization_corrected_internal_H; open_path_integral_not_necessarily_cycle_loss') + +def analyze_forc(rows): + valid=[r for r in rows if r['reversal_field_t'] is not None] + if len(valid)<6 or any(r['moment_a_m2'] is None for r in valid):raise ActionRejected('INVALID_OBSERVATIONS') + x=np.array([[r['field_t'],r['reversal_field_t']] for r in valid]);y=np.array([r['moment_a_m2'] for r in valid]);scale=float(np.ptp(x,axis=0).max()) + if scale<=0 or len(set(x[:,1]))<3:raise ActionRejected('FORC_GRID_REQUIRED') + out=[] + for i,point in enumerate(x): + ids=np.argsort(np.linalg.norm(x-point,axis=1))[:min(15,len(x))];q=(x[ids]-point)/scale;A=np.column_stack([np.ones(len(q)),q[:,0],q[:,1],q[:,0]**2,q[:,0]*q[:,1],q[:,1]**2]) + if np.linalg.matrix_rank(A)<6:continue + c=np.linalg.lstsq(A,y[ids],rcond=None)[0];out.append(dict(field_t=float(point[0]),reversal_field_t=float(point[1]),coercive_coordinate_t=float((point[0]-point[1])/2),interaction_coordinate_t=float((point[0]+point[1])/2),density_a_m2_per_t2=float(-.5*c[4]/scale**2),fit_residual_a_m2=float(np.sqrt(np.mean((A@c-y[ids])**2))),neighbours=len(ids))) + if not out:raise ActionRejected('FORC_GRID_REQUIRED') + return dict(distribution=out,evidence='local_quadratic_fit_to_external_FORC_observations; rho=-0.5*d2m/(dB*dBr); SI_A_m2_per_T2; not_unique_material_microstructure_or_FORCinel_reproduction') + +PLANT_EXAMPLE=dict(ambient_k=300.,field_per_current_t_a=.04,coil_inductance_h=.05,coil_resistance_ohm=.25,magnet_thermal_capacity_j_k=5000.,magnet_cooling_conductance_w_k=50.,sample_local_capacity_j_k=.01,sample_conductance_w_k=.01,pickup_coupling_wb_per_a_m3=.1,voltage_gain=1.03,voltage_offset_v=2e-7,detector_tau_s=.01,lift_speed_m_s=.1,rotation_speed_rad_s=1.,drawer_speed_m_s=.1,accept_engineering=True) +PLANT=obj({k:(BOOL if type(v) is bool else number({'ambient_k':'K','field_per_current_t_a':'T/A','coil_inductance_h':'H','coil_resistance_ohm':'ohm','magnet_thermal_capacity_j_k':'J/K','magnet_cooling_conductance_w_k':'W/K','sample_local_capacity_j_k':'J/K','sample_conductance_w_k':'W/K','pickup_coupling_wb_per_a_m3':'Wb/(A*m^3)','voltage_gain':'1','voltage_offset_v':'V','detector_tau_s':'s','lift_speed_m_s':'m/s','rotation_speed_rad_s':'rad/s','drawer_speed_m_s':'m/s'}[k], -1. if k=='voltage_offset_v' else 1e-12)) for k,v in PLANT_EXAMPLE.items()}) +PLANT['properties']['ambient_k']=number('K',285,303) +VIBRATION_EXAMPLE=dict(enabled=True,amplitude_m=.0005,frequency_hz=82.) +VIBRATION=obj(dict(enabled=BOOL,amplitude_m=number('m',1e-6,.001),frequency_hz=number('Hz',1,200))) +COIL_EXAMPLE=dict(nominal_coupling_wb_per_a_m3=.1,moment_range_a_m2=.01) +COIL=obj(dict(nominal_coupling_wb_per_a_m3=number('Wb/(A*m^3)',1e-10,1e6),moment_range_a_m2=number('A*m^2',MIN_MOMENT_A_M2,MAX_MOMENT_A_M2))) +RELAY=obj(dict(coercive_field_t=number('T',1e-8,10),bias_field_t=number('T',-10,10),weight=number('1',1e-12,1),initial_sign={'type':'integer','enum':[-1,1],'x-unit':'1'})) +RELAYS_EXAMPLE=[dict(coercive_field_t=v,bias_field_t=0.,weight=1/5,initial_sign=-1) for v in [.02,.035,.05,.065,.08]] +SAMPLE_EXAMPLE=dict(reference_id='kuleuven_cf_300k',mass_kg=5e-5,volume_m3=math.pi*(.001)**2*.002,specific_heat_capacity_j_kg_k=650.,initial_temperature_k=300.,temperature_tolerance_k=.5,linear_valid_max_field_t=.6,magnetic_model='preisach_proxy',proxy_specific_moment_a_m2_kg=None,relays=RELAYS_EXAMPLE,accept_engineering_assumptions=True) +SAMPLE=obj(dict(reference_id=TEXT,mass_kg=number('kg',0,.01),volume_m3=number('m^3',1e-15,1e-5),specific_heat_capacity_j_kg_k=number('J/(kg*K)',1,1e5),initial_temperature_k=number('K',285,303),temperature_tolerance_k=number('K',0,5),linear_valid_max_field_t=number('T',1e-7,MAX_FIELD_T),magnetic_model=enum(['linear_susceptibility','preisach_proxy']),proxy_specific_moment_a_m2_kg=nullable(number('A*m^2/kg',0,1e5)),relays=array(RELAY,1,1000),accept_engineering_assumptions=BOOL)) +STANDARD_EXAMPLE=dict(mass_kg=.00006316,volume_m3=math.pi/6*.002383**3,specific_heat_capacity_j_kg_k=440.,initial_temperature_k=298.,reference_field_t=MU0*398000.,reference_moment_a_m2=.00347,accept_host_standard_proxy=True) +STANDARD=obj(dict(mass_kg=number('kg',0,.01),volume_m3=number('m^3',1e-15,1e-5),specific_heat_capacity_j_kg_k=number('J/(kg*K)',1,1e5),initial_temperature_k=number('K',285,303),reference_field_t=number('T',1e-7,MAX_FIELD_T),reference_moment_a_m2=number('A*m^2',MIN_MOMENT_A_M2,MAX_MOMENT_A_M2),accept_host_standard_proxy=BOOL)) +METHOD_EXAMPLE=dict(field_points_t=[.2,.1,.075,.05,.025,0.,-.025,-.05,-.075,-.1,-.2,-.1,-.075,-.05,-.025,0.,.025,.05,.075,.1,.2],ramp_rate_t_s=1.,averaging_time_s=.05,settling_time_s=.05,require_calibration=False) +METHOD=obj(dict(field_points_t=array(number('T',-MAX_FIELD_T,MAX_FIELD_T),1,50000),ramp_rate_t_s=number('T/s',1e-6,1),averaging_time_s=number('s',.01,3600),settling_time_s=number('s',0,3600),require_calibration=BOOL)) +FORC_EXAMPLE=dict(saturation_field_t=.2,reversal_fields_t=[-.12,-.08,-.04,0.],points_per_curve=9,ramp_rate_t_s=1.,averaging_time_s=.05,settling_time_s=.05,require_calibration=False) +FORC=obj(dict(saturation_field_t=number('T',1e-7,MAX_FIELD_T),reversal_fields_t=array(number('T',-MAX_FIELD_T,MAX_FIELD_T),3,1000),points_per_curve={'type':'integer','minimum':3,'maximum':1000,'x-unit':'1'},ramp_rate_t_s=number('T/s',1e-6,1),averaging_time_s=number('s',.01,3600),settling_time_s=number('s',0,3600),require_calibration=BOOL)) +ROW=obj(dict(point_index={'type':'integer','x-unit':'1'},field_t=number('T'),external_h_a_m=number('A/m'),in_phase_voltage_v=number('V'),moment_a_m2=nullable(number('A*m^2')),angle_rad=number('rad'),window_start_s=number('s'),window_end_s=number('s'),reversal_field_t=nullable(number('T')),quality=enum(['estimated','below_documented_dynamic_range','overflow','reference_temperature_invalid']))) +RESULT=obj(dict(operation_id=nullable(TEXT),phase=PHASE,kind=TEXT,elapsed_s=number('s'),rows=array(ROW),error=nullable(TEXT),template_source=nullable(TEXT),evidence=TEXT)) +LEDGER_KEYS=['loaded_mass_kg','removed_mass_kg','mass_kg','mass_residual_kg','loaded_volume_m3','removed_volume_m3','volume_m3','volume_residual_m3','source_energy_j','coil_joule_j','magnetic_work_j','hysteresis_heat_j','sample_sensible_loaded_j','sample_sensible_removed_j','magnetic_loaded_j','magnetic_removed_j','coil_stored_j','magnetic_stored_j','sample_thermal_j','magnet_thermal_j','sample_heat_export_j','magnet_heat_export_j','energy_residual_j'] +LEDGER=obj({k:number('kg' if k.endswith('_kg') else 'm^3' if k.endswith('_m3') else 'J') for k in LEDGER_KEYS}) +CROSS=obj(dict(field_t=number('T'),external_h_a_m=number('A/m'),direction=enum(['ascending','descending']))) +LOOP_OUTPUT=obj(dict(coercive_crossings=array(CROSS),remanence_estimates=array(obj(dict(moment_a_m2=number('A*m^2'),direction=enum(['ascending','descending'])))),observed_b_dm_j=number('J'),evidence=TEXT)) +FORC_OUTPUT=obj(dict(distribution=array(obj(dict(field_t=number('T'),reversal_field_t=number('T'),coercive_coordinate_t=number('T'),interaction_coordinate_t=number('T'),density_a_m2_per_t2=number('A*m^2/T^2'),fit_residual_a_m2=number('A*m^2'),neighbours={'type':'integer','x-unit':'1'}))),evidence=TEXT)) +CAPS={} +def cap(k,s,o,example,component,meaning,visibility='agent',kind='device_command'):CAPS[k]=dict(input_schema=s,output_schema=o,example_arguments=example,component_ids=[component],function_zh=meaning,visibility=visibility,kind=kind,effects=[]) +for key,schema,example,component in [('plant.configure',PLANT,PLANT_EXAMPLE,'magnet'),('coil.configure',COIL,COIL_EXAMPLE,'controller'),('method.configure',METHOD,METHOD_EXAMPLE,'controller'),('forc.configure',FORC,FORC_EXAMPLE,'controller')]:cap(key,schema,obj(dict(configured=BOOL)),example,component,'设置明确工程参数或采集方法;不推进时间','evaluator' if key=='plant.configure' else 'agent','configuration') +cap('sample.load',SAMPLE,obj(dict(present=BOOL)),SAMPLE_EXAMPLE,'sample','载入真实磁性参考与显式磁滞/热假设','evaluator') +cap('standard.load',STANDARD,obj(dict(present=BOOL)),STANDARD_EXAMPLE,'sample','宿主装入已知磁矩标准代理;真实标准证书并非对本仿真认证','evaluator') +cap('sample.remove',obj({}),obj(dict(removed_mass_kg=number('kg'),removed_volume_m3=number('m^3'))),{},'sample','取走磁性库存、质量和当前显热','evaluator') +cap('power.set',obj(dict(enabled=BOOL)),obj(dict(enabled=BOOL)),{'enabled':True},'power_switch','控制电源;非零场拒绝断电以免瞬间销毁储能') +cap('field.set_target',obj(dict(field_t=number('T',-MAX_FIELD_T,MAX_FIELD_T),ramp_rate_t_s=number('T/s',1e-6,1))),obj(dict(target_t=number('T'))),dict(field_t=.1,ramp_rate_t_s=1.),'power_supply','只写量化目标,B由step以有限速率推进') +cap('sample.set_lift',obj(dict(lift_m=number('m',0,.35))),obj(dict(target_m=number('m'))),dict(lift_m=0.),'head_lift','电动测量头有限速率升降,需零场/振动关闭') +cap('sample.set_angle',obj(dict(angle_rad=number('rad',-1e6,1e6))),obj(dict(target_rad=number('rad'))),dict(angle_rad=math.pi/2),'sample_rotor','零外场、关闭振动后以0.1度设置分辨有限旋转') +cap('storage.set_open',obj(dict(opened=BOOL)),obj(dict(target_m=number('m'))),dict(opened=True),'storage_drawer','手工抽屉工程有限运动代理','evaluator') +cap('vibration.configure',VIBRATION,obj(dict(enabled=BOOL)),VIBRATION_EXAMPLE,'vibration_carriage','配置振动工程频率幅度;解析采样姿态与锁相包络,非完整波形求解') +cap('calibration.start',obj(dict(reference_moment_a_m2=number('A*m^2',MIN_MOMENT_A_M2,1),field_t=number('T',1e-6,MAX_FIELD_T),averaging_time_s=number('s',.01,3600))),obj(dict(operation_id=TEXT)),dict(reference_moment_a_m2=.00347,field_t=MU0*398000.,averaging_time_s=1.),'controller','实际正负场积分观测拟合增益/零偏,不读隐藏真实增益') +cap('calibration.clear',obj({}),obj(dict(valid=BOOL)),{},'controller','清除校准') +cap('acquisition.start',obj({}),obj(dict(operation_id=TEXT)),{},'controller','依有限扫场、等待、真实积分采集loop或FORC') +cap('acquisition.stop',obj({}),obj(dict(phase=PHASE,elapsed_s=number('s'))),{},'controller','保留完成读数及磁记忆/热账,停止扫场于实际值') +cap('acquisition.result',obj({}),RESULT,{},'controller','返回实际区间观测及明确合成模型标记','agent','query') +cap('analysis.loop',obj(dict(rows=array(ROW,3))),LOOP_OUTPUT,dict(rows=[]),'controller','从外部曲线估计零场剩磁、零矩外场矫顽与路径功','agent','analysis') +cap('analysis.forc',obj(dict(rows=array(ROW,6))),FORC_OUTPUT,dict(rows=[]),'controller','从外部FORC局部二次拟合混合导数','agent','analysis') +cap('analysis.moment',obj(dict(voltage_v=number('V'),sensitivity_v_per_a_m2=number('V/(A*m^2)',1e-12),calibration_gain=number('1',1e-12),calibration_offset_v=number('V'))),obj(dict(moment_a_m2=number('A*m^2'))),dict(voltage_v=.001,sensitivity_v_per_a_m2=1.,calibration_gain=1.,calibration_offset_v=0.),'controller','仅按外部电压/校准/灵敏度反演磁矩','agent','analysis') +cap('provenance.read',obj({}),obj(dict(current_sample=nullable(TEXT),operation_source=nullable(TEXT))),{},'controller','选中来源与测量来源快照仅限宿主','evaluator','query') +cap('ledger.read',obj({}),LEDGER,{},'controller','受限样品库存及有范围的电磁热能账','evaluator','query') +cap('sim.step',obj(dict(dt_s=number('s',0,86400))),obj(dict(time_s=number('s'))),dict(dt_s=.02),'controller','唯一宿主时钟','evaluator','simulation') +UNSUPPORTED={'hardware.connect':'没有真实驱动','robot.load':'没有机器人装样','thermal.set_temperature':'未选温控附件,不能给基础仪器假加热器','magnet.change_gap':'固定标准极帽Gap2,无在线极距/高场帽切换','measurement.vector':'未选矢量线圈','noise.empirical':'无独立实测噪声模型,不从15nemu规格虚构分布','accuracy.certification':'未验证厂家条件准确度','analysis.unique_forc_from_major_loop':'majorloop不能唯一决定FORC或微结构'} +for k,v in UNSUPPORTED.items():cap(k,obj({}),obj({}),{},'controller',v) +SLOTS={} +def slot(k,s,unit,origin,component,meaning,visibility='agent'):SLOTS[k]=dict(schema=s,unit=unit,origin=origin,component=component,meaning=meaning,visibility=visibility,write=None) +slot('clock.time_s',number('s'),'s','derived','controller','宿主统一仿真时钟,read不推进') +for k in ['plant.configured','coil.configured','method.configured','sample.present','power.enabled','vibration.enabled','calibration.valid']:slot(k,BOOL,'1','setpoint','controller','已配置/存在/启用状态;不是完整计量认证') +for k in ['sample.lift_m','sample.target_lift_m','storage.position_m','storage.target_m']:slot(k,number('m'),'m','scene' if 'target' not in k else 'setpoint','head_lift' if k.startswith('sample') else 'storage_drawer','实际有限运动位置或目标,单位m;只由宿主step推进') +for k in ['sample.angle_rad','sample.target_angle_rad','sample.orientation_rad']:slot(k,number('rad'),'rad','scene' if 'target' not in k else 'setpoint','sample_rotor','无界累计转角/目标及周期等价场景姿态;不是磁性各向异性实测参数') +slot('sample.vibration_z_m',number('m'),'m','scene','vibration_carriage','工程正弦振动解析时刻姿态;场景采样可混叠,不声称解析全频运动') +slot('power.angle_rad',number('rad'),'rad','scene','power_switch','开关显示姿态代理') +for k in ['field.target_t','field.indicated_t']:slot(k,nullable(number('T')) if 'indicated' in k else number('T'),'T','sensor' if 'indicated' in k else 'setpoint','hall_probe','Gap2外施空气场B或量化目标;100nT分辨;不是样品内部B') +slot('field.external_h_a_m',nullable(number('A/m')),'A/m','derived','hall_probe','外场B/μ0,未做样品退磁场修正') +slot('moment.indicated_a_m2',nullable(number('A*m^2')),'A*m^2','sensor','controller','锁相包络估算磁矩;1emu=1e-3 A m²,掉电/未开振动不可用') +slot('detector.in_phase_v',nullable(number('V')),'V','sensor','controller','有符号锁相同相电压包络含工程一阶响应,不是负RMS幅值') +for k in ['thermal.sample_k','thermal.magnet_k']:slot(k,nullable(number('K')),'K','sensor','sample' if 'sample' in k else 'magnet','模型被动集中热节点;不是温控附件或整机热容') +slot('acquisition.phase',PHASE,'1','derived','controller','异步操作终态或运行态') +slot('acquisition.stage',TEXT,'1','derived','controller','ramping/settling/averaging,均等待真实host时间') +slot('acquisition.elapsed_s',number('s'),'s','derived','controller','操作实际已耗时间') +slot('acquisition.points',{'type':'integer','x-unit':'1'},'1','derived','controller','已完成积分观测数') +slot('calibration.gain',number(),'1','derived','controller','外部±已知磁矩与实际观测拟合出的乘性校正') +slot('calibration.offset_v',number('V'),'V','derived','controller','外部双极标准观测拟合出的电压零偏') +for k,u in [('truth.field_t','T'),('truth.moment_a_m2','A*m^2'),('truth.mass_kg','kg'),('truth.sample_k','K')]:slot(k,number(u),u,'process_truth','sample','受限过程真值,公共结果不透出材料身份','evaluator') + +class LakeShore8604VsmRuntime: + def __init__(self,instance_id='vsm_01'): + self.instance_id=instance_id;self.time_ns=0;self._clock_remainder_ns=0.;self.revision=0;self.power=False;self.plant=None;self.coil=None;self.method=None;self.sample=None;self.record=None;self.source=None + self.axes={k:dict(position=v,target=v,start=v,start_ns=0,arrival_ns=0) for k,v in [('field',0.),('lift',.35),('angle',0.),('drawer',0.)]};self.ramp_rate=1. + self.vibration=dict(enabled=False,amplitude_m=.0005,frequency_hz=82.);self.sensor=0.;self.sample_k=300.;self.magnet_k=300.;self.linear_coefficient=0.;self.relays=[];self.amplitudes=[] + self.calibration_valid=False;self.calibration_gain=1.;self.calibration_offset=0.;self.phase='idle';self.stage='idle';self.elapsed=0.;self.rows=[];self.operation_id=None;self.operation_kind='none';self.error=None;self._counter=0;self._operation_source=None;self.records={};self._principals={};self._requests={};self._owners={};self._cancel_operations={};self._event_ns=None;self._sequence=[];self._index=0;self._v_integral=0.;self._b_integral=0. + self.book={k:0. for k in ['loaded_mass_kg','removed_mass_kg','loaded_volume_m3','removed_volume_m3','source_energy_j','coil_joule_j','magnetic_work_j','hysteresis_heat_j','sample_sensible_loaded_j','sample_sensible_removed_j','magnetic_loaded_j','magnetic_removed_j','sample_heat_export_j','magnet_heat_export_j']} + @property + def time_s(self):return self.time_ns/1e9 + def register_principal(self,name,visibility): + if not isinstance(name,str) or not name or visibility not in ('agent','evaluator','debug') or name in self._principals:raise ActionRejected('INVALID_ARGUMENT') + self._principals[name]=visibility + def session(self,name): + if name not in self._principals:raise ActionRejected('ACCESS_DENIED') + return LakeShore8604VsmSession(self,name) + def _pos(self,k):return self.axes[k]['position'] + def _moving(self,k):return self.time_ns=a['arrival_ns'] else a['start']+(a['target']-a['start'])*(self.time_ns-a['start_ns'])/(a['arrival_ns']-a['start_ns']) + def _capacity(self):return self.plant['sample_local_capacity_j_k']+(self.sample['mass_kg']*self.sample['specific_heat_capacity_j_kg_k'] if self.sample else 0.) + def _sensitivity(self,actual=False): + if not self.coil:return 0. + coupling=self.plant['pickup_coupling_wb_per_a_m3'] if actual else self.coil['nominal_coupling_wb_per_a_m3'] + return coupling*self.vibration['amplitude_m']*2*math.pi*self.vibration['frequency_hz']/math.sqrt(2) + def _moment(self,B=None): + B=self._pos('field') if B is None else B;c=math.cos(self._pos('angle')) + return self.linear_coefficient*B+sum(a*r['state'] for a,r in zip(self.amplitudes,self.relays))*c + def _magnetic_energy(self):return .5*self.linear_coefficient*self._pos('field')**2+sum(a*r['bias_field_t']*r['state'] for a,r in zip(self.amplitudes,self.relays)) + def _temperature_valid(self): + if not self.sample or self.sample.get('standard'):return True + nominal=self.record.get('reference_temperature_K');interval=self.record.get('valid_temperature_range_K') + if nominal is not None and abs(self.sample_k-nominal)>self.sample['temperature_tolerance_k']+1e-9:return False + if interval and interval[1]-interval[0]>1e-9 and not interval[0]-1e-9<=self.sample_k<=interval[1]+1e-9:return False + return abs(self.sample_k-self.sample['initial_temperature_k'])<=self.sample['temperature_tolerance_k']+1e-9 + def ledger(self): + d=copy.deepcopy(self.book);mass=self.sample['mass_kg'] if self.sample else 0.;volume=self.sample['volume_m3'] if self.sample else 0.;d.update(mass_kg=mass,mass_residual_kg=d['loaded_mass_kg']-d['removed_mass_kg']-mass,volume_m3=volume,volume_residual_m3=d['loaded_volume_m3']-d['removed_volume_m3']-volume,coil_stored_j=0.,magnetic_stored_j=self._magnetic_energy(),sample_thermal_j=0.,magnet_thermal_j=0.) + if self.plant:d.update(coil_stored_j=.5*self.plant['coil_inductance_h']*(self._pos('field')/self.plant['field_per_current_t_a'])**2,sample_thermal_j=self._capacity()*(self.sample_k-self.plant['ambient_k']),magnet_thermal_j=self.plant['magnet_thermal_capacity_j_k']*(self.magnet_k-self.plant['ambient_k'])) + d['energy_residual_j']=d['source_energy_j']+d['sample_sensible_loaded_j']+d['magnetic_loaded_j']-d['sample_sensible_removed_j']-d['magnetic_removed_j']-sum(d[k] for k in ['coil_stored_j','magnetic_stored_j','sample_thermal_j','magnet_thermal_j','sample_heat_export_j','magnet_heat_export_j']);return d + def read(self,visibility='agent'): + indicated=None + if self.power and self.vibration['enabled'] and self.coil: + inferred=infer_moment(self.sensor,self._sensitivity(),self.calibration_gain,self.calibration_offset) + if abs(inferred)<=self.coil['moment_range_a_m2'] and self._temperature_valid():indicated=inferred + field=quant(self._pos('field'),FIELD_RESOLUTION_T) if self.power else None + d={'clock.time_s':self.time_s,'plant.configured':self.plant is not None,'coil.configured':self.coil is not None,'method.configured':self.method is not None,'sample.present':self.sample is not None,'power.enabled':self.power,'vibration.enabled':self.vibration['enabled'],'calibration.valid':self.calibration_valid,'sample.lift_m':self._pos('lift'),'sample.target_lift_m':self.axes['lift']['target'],'storage.position_m':self._pos('drawer'),'storage.target_m':self.axes['drawer']['target'],'sample.angle_rad':self._pos('angle'),'sample.target_angle_rad':self.axes['angle']['target'],'sample.orientation_rad':math.atan2(math.sin(self._pos('angle')),math.cos(self._pos('angle'))),'sample.vibration_z_m':self.vibration['amplitude_m']*math.sin(2*math.pi*self.vibration['frequency_hz']*self.time_s) if self.power and self.vibration['enabled'] else 0.,'power.angle_rad':.28 if self.power else 0.,'field.target_t':self.axes['field']['target'],'field.indicated_t':field,'field.external_h_a_m':None if field is None else field/MU0,'moment.indicated_a_m2':indicated,'detector.in_phase_v':self.sensor if self.power and self.vibration['enabled'] else None,'thermal.sample_k':self.sample_k if self.plant else None,'thermal.magnet_k':self.magnet_k if self.plant else None,'acquisition.phase':self.phase,'acquisition.stage':self.stage,'acquisition.elapsed_s':self.elapsed,'acquisition.points':len(self.rows),'calibration.gain':self.calibration_gain,'calibration.offset_v':self.calibration_offset,'truth.field_t':self._pos('field'),'truth.moment_a_m2':self._moment(),'truth.mass_kg':self.sample['mass_kg'] if self.sample else 0.,'truth.sample_k':self.sample_k} + return {k:copy.deepcopy(v) for k,v in d.items() if visibility!='agent' or SLOTS[k]['visibility']=='agent'} + def _propagate(self,ns): + dt=ns/1e9 + if dt<=0 or not self.plant:return + p=self.plant;B0=self._pos('field');rate=self._rate('field');B1=B0+rate*dt;I0=B0/p['field_per_current_t_a'];I1=B1/p['field_per_current_t_a'];r=p['coil_resistance_ohm']/p['field_per_current_t_a']**2 + joule=r*(B0*B0*dt+B0*rate*dt*dt+rate*rate*dt**3/3);dcoil=.5*p['coil_inductance_h']*(I1*I1-I0*I0);dmag=.5*self.linear_coefficient*(B1*B1-B0*B0) + self.book['coil_joule_j']+=joule;self.book['magnetic_work_j']+=dmag;self.book['source_energy_j']+=joule+dcoil+dmag + C=p['magnet_thermal_capacity_j_k'];G=p['magnet_cooling_conductance_w_k'];tau=C/G;before=C*(self.magnet_k-p['ambient_k']);j0,j1,j2=weighted_exponential_integrals(dt,tau);after=before*math.exp(-dt/tau)+r*(B0*B0*j0+2*B0*rate*j1+rate*rate*j2);self.magnet_k=p['ambient_k']+after/C;self.book['magnet_heat_export_j']+=joule-(after-before) + C=self._capacity();before=C*(self.sample_k-p['ambient_k']);after=before*math.exp(-p['sample_conductance_w_k']*dt/C);self.sample_k=p['ambient_k']+after/C;self.book['sample_heat_export_j']+=before-after + active=self.power and self.vibration['enabled'];gain=p['voltage_gain']*self._sensitivity(True) if active else 0.;f0=gain*self._moment(B0)+(p['voltage_offset_v'] if active else 0.);f1=gain*self.linear_coefficient*rate;old=self.sensor;tau=p['detector_tau_s'];self.sensor=f0+f1*(dt-tau)+(old-f0+f1*tau)*math.exp(-dt/tau) + if self.phase=='running' and self.stage=='averaging':self._v_integral+=f0*dt+.5*f1*dt*dt-tau*(self.sensor-old);self._b_integral+=B0*dt+.5*rate*dt*dt + def _next_switch(self): + B=self._pos('field');c=math.cos(self._pos('angle'));v=self._rate('field')*c + if not v:return None + times=[] + for r in self.relays: + if v>0 and r['state']<0:threshold=r['bias_field_t']+r['coercive_field_t'] + elif v<0 and r['state']>0:threshold=r['bias_field_t']-r['coercive_field_t'] + else:continue + dt=(threshold-B*c)/v + if dt>=-1e-12:times.append(self.time_ns+max(1,int(math.ceil(dt*1e9-1e-7)))) + return min(times) if times else None + def _switch(self): + B=self._pos('field');c=math.cos(self._pos('angle'));effective=B*c + for amplitude,r in zip(self.amplitudes,self.relays): + state=1 if effective>=r['bias_field_t']+r['coercive_field_t']-1e-12 else -1 if effective<=r['bias_field_t']-r['coercive_field_t']+1e-12 else r['state'] + if state==r['state']:continue + dm=amplitude*(state-r['state']);work=effective*dm;stored=r['bias_field_t']*dm;heat=work-stored + if heat<-1e-12:raise RuntimeError('Nonpassive relay switch') + r['state']=state;self.book['magnetic_work_j']+=work;self.book['source_energy_j']+=work;self.book['hysteresis_heat_j']+=heat;self.sample_k+=heat/self._capacity() + def _result(self): + if self.phase!='running' and self.operation_id in self.records:return copy.deepcopy(self.records[self.operation_id]) + return dict(operation_id=self.operation_id,phase=self.phase,kind=self.operation_kind,elapsed_s=self.elapsed,rows=copy.deepcopy(self.rows),error=self.error,template_source=self._operation_source,evidence='synthetic_forward_model; actual_host_time_interval_observations; measured_reference_anchor_is_not_measured_this_loop_or_FORC') + def _finish(self,phase,error=None): + self.phase=phase;self.stage='idle';self.error=error;self._event_ns=None + if self.operation_id:self.records[self.operation_id]=dict(operation_id=self.operation_id,phase=phase,kind=self.operation_kind,elapsed_s=self.elapsed,rows=copy.deepcopy(self.rows),error=error,template_source=self._operation_source,evidence='synthetic_forward_model; actual_host_time_interval_observations; measured_reference_anchor_is_not_measured_this_loop_or_FORC') + def _begin_point(self): + point=self._sequence[self._index];self.ramp_rate=self._job_method['ramp_rate_t_s'];self._target('field',point['field_t']);self.stage='ramping';self._event_ns=self.axes['field']['arrival_ns'] + def _advance(self): + while self.phase=='running' and self._event_ns<=self.time_ns: + if self.stage=='ramping':self.stage='settling';self._event_ns=self.time_ns+round(self._job_method['settling_time_s']*1e9) + elif self.stage=='settling': + if not self._sequence[self._index]['record']: + self._index+=1;self._begin_point();continue + self.stage='averaging';self._window_start_ns=self.time_ns;self._v_integral=0.;self._b_integral=0.;self._event_ns=self.time_ns+round(self._job_method['averaging_time_s']*1e9) + else: + dt=(self.time_ns-self._window_start_ns)/1e9;v=self._v_integral/dt;B=quant(self._b_integral/dt,FIELD_RESOLUTION_T);moment=infer_moment(v,self._sensitivity(),self.calibration_gain,self.calibration_offset);quality='estimated';error=None + if abs(moment)>self.coil['moment_range_a_m2']:quality='overflow';error='MOMENT_OVERFLOW';moment=None + elif not self._temperature_valid():quality='reference_temperature_invalid';error='REFERENCE_TEMPERATURE_RANGE';moment=None + elif abs(moment)1e-10 or self._moving('field'):raise ActionRejected('LOADING_POSITION_REQUIRED') + def _field_guard(self,values): + if self.sample and not self.sample.get('standard') and any(abs(x)>self.sample['linear_valid_max_field_t']+1e-12 for x in values):raise ActionRejected('HOST_MAGNETIC_VALIDITY_RANGE') + def invoke(self,capability,**a): + if capability not in CAPS:raise ActionRejected('UNKNOWN_CAPABILITY') + validate(CAPS[capability]['input_schema'],a) + if capability in UNSUPPORTED:raise ActionRejected('UNSUPPORTED') + if capability=='acquisition.result':return self._result() + if capability=='ledger.read':return self.ledger() + if capability=='provenance.read':return dict(current_sample=self.source,operation_source=self._operation_source) + if capability=='analysis.loop':return analyze_loop(a['rows']) + if capability=='analysis.forc':return analyze_forc(a['rows']) + if capability=='analysis.moment':return dict(moment_a_m2=infer_moment(**a)) + if capability=='sim.step':self.step(a['dt_s']);return dict(time_s=self.time_s) + if self.phase=='running' and capability not in ('acquisition.stop','power.set'):raise ActionRejected('BUSY') + if capability=='plant.configure': + if self.plant or self.sample or self.power:raise ActionRejected('ALREADY_CONFIGURED') + if not a['accept_engineering']:raise ActionRejected('EXPLICIT_ASSUMPTIONS_REQUIRED') + I=MAX_FIELD_T/a['field_per_current_t_a'];V=a['coil_resistance_ohm']*I+a['coil_inductance_h']/a['field_per_current_t_a'] + if I>70+1e-12 or V>35+1e-12 or I*V>2450+1e-12:raise ActionRejected('POWER_SUPPLY_ENVELOPE') + self.plant=copy.deepcopy(a);self.sample_k=self.magnet_k=a['ambient_k'];out=dict(configured=True) + elif capability=='coil.configure':self.coil=copy.deepcopy(a);self.calibration_valid=False;self.calibration_gain=1.;self.calibration_offset=0.;out=dict(configured=True) + elif capability in ('method.configure','forc.configure'): + if capability=='forc.configure': + quantized=[quant(x,FIELD_RESOLUTION_T) for x in a['reversal_fields_t']];saturation=quant(a['saturation_field_t'],FIELD_RESOLUTION_T) + if any(x>=saturation for x in quantized) or len(set(quantized))!=len(quantized) or len(quantized)*(a['points_per_curve']+1)>50000:raise ActionRejected('FORC_GRID_REQUIRED') + a=copy.deepcopy(a);a['reversal_fields_t']=quantized;a['saturation_field_t']=saturation + self.method=copy.deepcopy(a);self.method['kind']='forc' if capability=='forc.configure' else 'points';out=dict(configured=True) + elif capability in ('sample.load','standard.load'): + self._load_guard();standard=capability=='standard.load';record=None;relays=[];amplitudes=[];linear=0. + if standard: + if not a['accept_host_standard_proxy']:raise ActionRejected('EXPLICIT_ASSUMPTIONS_REQUIRED') + linear=a['reference_moment_a_m2']/a['reference_field_t'];source=json.dumps(dict(kind='host_linear_calibrant_proxy',numerical_example_anchor='NIST772a298K398kA_m_not_certificate_validation'),sort_keys=True) + else: + if not a['accept_engineering_assumptions']:raise ActionRejected('EXPLICIT_ASSUMPTIONS_REQUIRED') + record=library().get(a['reference_id']) + if record is None:raise ActionRejected('UNKNOWN_REFERENCE') + temp=record.get('reference_temperature_K');domain=record.get('valid_temperature_range_K') + if temp is not None and abs(a['initial_temperature_k']-temp)>a['temperature_tolerance_k'] or domain and domain[1]-domain[0]>1e-9 and not domain[0]<=a['initial_temperature_k']<=domain[1]:raise ActionRejected('REFERENCE_TEMPERATURE_RANGE') + chi=record.get('molar_susceptibility_m3_mol');molar_mass=record.get('molar_mass_kg_mol') + if chi is not None and molar_mass is not None:linear=a['mass_kg']/molar_mass*chi/MU0 + if a['magnetic_model']=='linear_susceptibility' and (chi is None or molar_mass is None):raise ActionRejected('REFERENCE_PROPERTY_MISSING') + if a['magnetic_model']=='preisach_proxy': + value=a['proxy_specific_moment_a_m2_kg'] + if value is None:value=record.get('measured_specific_moment_max_abs_a_m2_kg') + if value is None:raise ActionRejected('EXPLICIT_PROXY_AMPLITUDE_REQUIRED') + if not math.isclose(sum(r['weight'] for r in a['relays']),1.,rel_tol=0,abs_tol=1e-10):raise ActionRejected('RELAY_WEIGHTS') + for r in a['relays']: + if r['bias_field_t']+r['coercive_field_t']<=0 and r['initial_sign']<0 or r['bias_field_t']-r['coercive_field_t']>=0 and r['initial_sign']>0:raise ActionRejected('INCONSISTENT_INITIAL_MAGNETIC_STATE') + relays=[dict(r,state=r['initial_sign']) for r in a['relays']];amplitudes=[a['mass_kg']*value*r['weight'] for r in relays] + source=json.dumps(record.get('source'),sort_keys=True,ensure_ascii=False) + p=copy.deepcopy(a);p['standard']=standard;C0=self._capacity();old=C0*(self.sample_k-self.plant['ambient_k']);incoming=a['mass_kg']*a['specific_heat_capacity_j_kg_k']*(a['initial_temperature_k']-self.plant['ambient_k']);self.sample=p;self.record=record;self.source=source;self.linear_coefficient=linear;self.relays=relays;self.amplitudes=amplitudes;self.sample_k=self.plant['ambient_k']+(old+incoming)/self._capacity();self.book['sample_sensible_loaded_j']+=incoming;self.book['magnetic_loaded_j']+=self._magnetic_energy();self.book['loaded_mass_kg']+=a['mass_kg'];self.book['loaded_volume_m3']+=a['volume_m3'];out=dict(present=True) + elif capability=='sample.remove': + if not self.sample:raise ActionRejected('NO_SAMPLE') + if self._pos('lift')<.34 or self._moving('lift') or self.vibration['enabled'] or abs(self._pos('field'))>1e-10 or self._moving('field'):raise ActionRejected('LOADING_POSITION_REQUIRED') + m=self.sample['mass_kg'];v=self.sample['volume_m3'];self.book['removed_mass_kg']+=m;self.book['removed_volume_m3']+=v;self.book['sample_sensible_removed_j']+=m*self.sample['specific_heat_capacity_j_kg_k']*(self.sample_k-self.plant['ambient_k']);self.book['magnetic_removed_j']+=self._magnetic_energy();self.sample=None;self.record=None;self.source=None;self.linear_coefficient=0.;self.relays=[];self.amplitudes=[];out=dict(removed_mass_kg=m,removed_volume_m3=v) + elif capability=='power.set': + if not self.plant:raise ActionRejected('NOT_CONFIGURED') + if not a['enabled'] and (abs(self._pos('field'))>1e-10 or self._moving('field')):raise ActionRejected('ZERO_FIELD_REQUIRED') + if not a['enabled']: + if self.phase=='running':self._finish('cancelled','POWER_OFF') + self.vibration['enabled']=False + for k in self.axes:self._target(k,self._pos(k)) + self.power=a['enabled'];out=dict(enabled=self.power) + elif capability=='field.set_target': + if not self.power:raise ActionRejected('POWER_OFF') + if self._pos('lift')>1e-9 and self.sample or self._moving('lift') or self._moving('angle'):raise ActionRejected('MEASUREMENT_POSITION_REQUIRED') + target=quant(a['field_t'],FIELD_RESOLUTION_T);self._field_guard([target]);self.ramp_rate=a['ramp_rate_t_s'];self._target('field',target);out=dict(target_t=target) + elif capability in ('sample.set_lift','sample.set_angle','storage.set_open'): + if not self.plant or not self.power:raise ActionRejected('POWER_OFF') + if capability!='storage.set_open' and (abs(self._pos('field'))>1e-10 or self._moving('field') or self.vibration['enabled']):raise ActionRejected('ZERO_FIELD_AND_VIBRATION_OFF_REQUIRED') + k='lift' if capability=='sample.set_lift' else 'angle' if capability=='sample.set_angle' else 'drawer';value=a['lift_m'] if k=='lift' else quant(a['angle_rad'],math.pi/1800) if k=='angle' else .2 if a['opened'] else 0.;self._target(k,value);out={'target_rad' if k=='angle' else 'target_m':value} + elif capability=='vibration.configure': + if not self.power or not self.coil:raise ActionRejected('NOT_CONFIGURED') + if a['enabled'] and (self._pos('lift')>1e-9 or self._moving('lift') or self._moving('angle')):raise ActionRejected('MEASUREMENT_POSITION_REQUIRED') + if any(a[k]!=self.vibration[k] for k in ('amplitude_m','frequency_hz')):self.calibration_valid=False + self.vibration=copy.deepcopy(a);out=dict(enabled=a['enabled']) + elif capability=='calibration.clear':self.calibration_valid=False;self.calibration_gain=1.;self.calibration_offset=0.;out=dict(valid=False) + elif capability in ('acquisition.start','calibration.start'): + iscal=capability=='calibration.start' + if not self.power or not self.plant or not self.coil or not self.vibration['enabled']:raise ActionRejected('NOT_CONFIGURED') + if not self.sample:raise ActionRejected('NO_SAMPLE') + if self._pos('lift')>1e-9 or self._moving('lift') or self._moving('angle'):raise ActionRejected('MEASUREMENT_POSITION_REQUIRED') + if not self._temperature_valid():raise ActionRejected('REFERENCE_TEMPERATURE_RANGE') + if iscal: + method=dict(ramp_rate_t_s=1.,averaging_time_s=a['averaging_time_s'],settling_time_s=max(.05,10*self.plant['detector_tau_s']));sequence=[dict(field_t=quant(B,FIELD_RESOLUTION_T),record=True,reversal_field_t=None) for B in [a['field_t'],-a['field_t']]] + else: + if not self.method:raise ActionRejected('NOT_CONFIGURED') + if self.method['require_calibration'] and not self.calibration_valid:raise ActionRejected('CALIBRATION_REQUIRED') + method=copy.deepcopy(self.method);sequence=[] + if method['kind']=='points':sequence=[dict(field_t=quant(B,FIELD_RESOLUTION_T),record=True,reversal_field_t=None) for B in method['field_points_t']] + else: + saturation=method['saturation_field_t'] + for Br in method['reversal_fields_t']: + sequence.append(dict(field_t=quant(saturation,FIELD_RESOLUTION_T),record=False,reversal_field_t=Br)) + sequence.extend(dict(field_t=quant(float(B),FIELD_RESOLUTION_T),record=True,reversal_field_t=Br) for B in np.linspace(Br,saturation,method['points_per_curve'])) + self._field_guard([p['field_t'] for p in sequence]) + if not iscal and method['kind']=='forc' and self.relays and method['saturation_field_t']*abs(math.cos(self._pos('angle')))=0; reversible linear U=0.5*a*B^2.','I=B/k; V=R*I+L*dI/dt; P_R=I^2*R, E_L=0.5*L*I^2. Electrical input=dE_L+Joule+magnetic work.','Cmag*dTmag/dt=I^2*R-Gmag*(Tmag-Tambient); Csample*dTsample/dt=-Gsample*(Tsample-Tambient)+hysteretic event heat.','V_inphase=engineering_gain*pickup_coupling*amplitude*2*pi*frequency*m/sqrt(2)+offset; detector tau*dV/dt=V_inphase-V.','Recorded Vbar=(integral V dt)/actual_window; observed moment=(Vbar-cal_offset)*cal_gain/nominal_sensitivity.','Calibration gain=2*external_reference_moment*nominal_sensitivity/(Vplus-Vminus); offset=(Vplus+Vminus)/2.','FORC rho=-0.5*d2(moment)/(dB*dBr), evaluated by local quadratic fit to external observations only.','Host step is sole clock, with fractional-nanosecond carry; switching/ramp/axis/integration events split propagation analytically.'],parameters={},source_ids=['simulation_assumption','template_library'],limitations=LIMITATIONS) + spec=importlib.util.spec_from_file_location('_vsm_local_annotations',ROOT/'scripts/asset_runtime/_annotations.py');ann=importlib.util.module_from_spec(spec);spec.loader.exec_module(ann);ann.KEY_ZH.update({k:v['meaning'] for k,v in SLOTS.items()});ann.annotate_export(SLUG,caps,slots,{'vsm_magnetometry':mechanism},inputs={'plant.configure':(PLANT,PLANT_EXAMPLE),'coil.configure':(COIL,COIL_EXAMPLE),'sample.load':(SAMPLE,SAMPLE_EXAMPLE),'standard.load':(STANDARD,STANDARD_EXAMPLE),'method.configure':(METHOD,METHOD_EXAMPLE),'forc.configure':(FORC,FORC_EXAMPLE),'vibration.configure':(VIBRATION,VIBRATION_EXAMPLE)}) + for k,v in SLOTS.items():slots[k]['meaning_zh']=v['meaning'] + return dict(asset_type_id=ASSET_TYPE_ID,catalog_id=CATALOG_ID,capabilities=caps,state_slots=slots,mechanisms={'vsm_magnetometry':mechanism}) diff --git a/scripts/asset_runtime/lakeshore_measurereadym91.py b/scripts/asset_runtime/lakeshore_measurereadym91.py new file mode 100644 index 0000000000000000000000000000000000000000..8a139166a1b2841a61b513f7da4bce56e781366c --- /dev/null +++ b/scripts/asset_runtime/lakeshore_measurereadym91.py @@ -0,0 +1,495 @@ +"""CHEM141 M91: traditional current/field reversal, external magnet and vdP. + +Only observed voltages/currents/fields enter inverse Hall/vdP fits. A host-controlled +external field boundary evolves in time; M91 does not create a magnetic field. +""" +from __future__ import annotations +import copy,importlib.util,json,math +from pathlib import Path +import numpy as np +from scipy.integrate import solve_ivp +PROTOCOL_VERSION='1.0.0';SLUG='lakeshore_measurereadym91';ASSET_TYPE_ID='instrument.'+SLUG;CATALOG_ID='CHEM-141' +ROOT=Path(__file__).resolve().parents[2];ASSET=ROOT/'assets/expansion_batch04/t1_thermal'/SLUG;LIBRARY_PATH=ASSET/'hall_library.json' + +class ActionRejected(ValueError):pass + +def number(unit='1',lo=None,hi=None): + s={'type':'number','x-unit':unit} + if lo is not None:s['minimum']=lo + if hi is not None:s['maximum']=hi + return s + +def obj(properties):return dict(type='object',properties=properties,required=list(properties),additionalProperties=False) +def nullable(s):return {'anyOf':[s,{'type':'null'}]} +def array(s,minimum=0,maximum=200001):return dict(type='array',items=s,minItems=minimum,maxItems=maximum) +def enum(items):return {'type':'string','enum':items} +BOOL={'type':'boolean'};TEXT={'type':'string'};PHASE=enum(['idle','running','succeeded','cancelled','failed']) + +def validate(s,v): + if 'anyOf' in s: + for o in s['anyOf']: + try:validate(o,v);return + except ActionRejected:pass + raise ActionRejected('INVALID_ARGUMENT') + k=s.get('type') + if k in ('number','integer'): + if isinstance(v,bool) or not isinstance(v,(int,float)) or not math.isfinite(v) or k=='integer' and type(v) is not int or not s.get('minimum',-math.inf)<=v<=s.get('maximum',math.inf):raise ActionRejected('INVALID_ARGUMENT') + elif k=='object': + if not isinstance(v,dict) or set(v)!=set(s['properties']):raise ActionRejected('INVALID_ARGUMENT') + for key,value in v.items():validate(s['properties'][key],value) + elif k=='array': + if not isinstance(v,list) or not s.get('minItems',0)<=len(v)<=s.get('maxItems',math.inf):raise ActionRejected('INVALID_ARGUMENT') + for x in v:validate(s['items'],x) + elif k=='boolean' and type(v) is not bool:raise ActionRejected('INVALID_ARGUMENT') + elif k=='string' and not isinstance(v,str):raise ActionRejected('INVALID_ARGUMENT') + elif k=='null' and v is not None:raise ActionRejected('INVALID_ARGUMENT') + if 'enum' in s and v not in s['enum']:raise ActionRejected('INVALID_ARGUMENT') + +from scipy.linalg import expm +from scipy.optimize import brentq +ELEMENTARY_CHARGE_C=1.602176634e-19 +WARMUP_S=1800. +CURRENT_RANGES=[1e-6,1e-5,1e-4,1e-3,1e-2,1e-1] +VOLTAGE_RANGES=[.001,.01,.1,1.,10.] +VOLTAGE_EXCITATION_RANGES=[.01,.1,1.,10.] +CURRENT_MEASUREMENT_RANGES=[1e-8,1e-5,.01,.1] +CONTACTS=['vdp_a','vdp_b','hall'] + +def library():return {x['id']:x for x in json.loads(LIBRARY_PATH.read_text())['templates']} +def transport(record,temperature,clamp=False): + curves=record['curves'];values={};lo=-math.inf;hi=math.inf + for key,field in [('hall_coefficient','value_m3_C'),('resistivity','value_ohm_m')]: + rows=curves[key];tt=np.array([v['temperature_K'] for v in rows]);vv=np.array([v[field] for v in rows]);lo=max(lo,float(tt[0]));hi=min(hi,float(tt[-1]));values[key]=float(np.interp(temperature,tt,vv)) + allowed=record.get('valid_temperature_range_K',[lo,hi]);lo=max(lo,allowed[0]);hi=min(hi,allowed[1]);valid=lo-1e-6<=temperature<=hi+1e-6 + if not valid and not clamp:return None + return dict(hall_coefficient_m3_c=values['hall_coefficient'],resistivity_ohm_m=values['resistivity'],valid=bool(valid),domain_k=[lo,hi]) + +def vdp_resistances(sheet_ohm,asymmetry):return sheet_ohm*np.logaddexp(0.,np.array([asymmetry,-asymmetry]))/math.pi + +def external_field_at(initial,target,dt,slew,tau): + error=target-initial;edge=slew*tau + if abs(error)<=edge:return target-error*math.exp(-dt/tau) + linear_time=(abs(error)-edge)/slew + if dt<=linear_time:return initial+math.copysign(slew*dt,error) + return target-math.copysign(edge,error)*math.exp(-(dt-linear_time)/tau) + +def _linear_fit(X,y): + coefficient,_,rank,_=np.linalg.lstsq(X,y,rcond=None) + if rank1e-6) or not np.any(B < -1e-6):raise ActionRejected('FIELD_REVERSAL_REQUIRED') + bp=float(np.mean(B[B>0]));bn=float(np.mean(B[B<0])) + if abs(bp+bn)/max(abs(bp),abs(bn))>field_symmetry_relative:raise ActionRejected('FIELD_PAIR_ASYMMETRY') + resistance=[];rms=[] + for name in CONTACTS[:2]: + idx=configs==name + if sum(idx)<4:raise ActionRejected('ANALYSIS_DATA') + X=np.column_stack([I[idx]/iscale,np.ones(sum(idx)),times[idx]]);fit,error=_linear_fit(X,V[idx]);R=float(fit[0]/iscale) + if not .01<=R<=1e7:raise ActionRejected('RESISTANCE_RANGE') + resistance.append(R);rms.append(error) + idx=configs=='hall' + if sum(idx)<6:raise ActionRejected('ANALYSIS_DATA') + X=np.column_stack([I[idx]/iscale,I[idx]*B[idx]/(iscale*bscale),np.ones(sum(idx)),times[idx]]);fit,error=_linear_fit(X,V[idx]);rms.append(error);RH=float(fit[1]/(iscale*bscale)*thickness_m/hall_geometry_factor) + if abs(RH)<1e-30:raise ActionRejected('HALL_UNRESOLVED') + ra,rb=resistance;sheet=brentq(lambda rs:math.exp(-math.pi*ra/rs)+math.exp(-math.pi*rb/rs)-1,min(ra,rb)*1e-6,math.pi*(ra+rb)*100,xtol=1e-13,rtol=1e-13);rho=sheet*thickness_m;nH=1/(ELEMENTARY_CHARGE_C*abs(RH));muH=abs(RH)/rho + return dict(hall_coefficient_m3_c=RH,resistivity_ohm_m=rho,sheet_resistance_ohm=sheet,vdp_resistance_a_ohm=ra,vdp_resistance_b_ohm=rb,hall_carrier_density_m3=nH,hall_mobility_m2_v_s=muH,assumed_single_carrier_density_m3=hall_factor*nH,assumed_drift_mobility_m2_v_s=muH/hall_factor,carrier_type='hole_like_positive_hall' if RH>0 else 'electron_like_negative_hall',fit_rms_v=max(rms),evidence='external_current_and_field_reversal_voltage_fit; scalar_van_der_Pauw_and_single_carrier_Hall_factor_assumptions; not_proprietary_FastHall_algorithm') + +PLANT_EXAMPLE=dict(ambient_k=300.,contact_asymmetry=.2,hall_misalignment_fraction=.02,hall_geometry_factor=1.,drive_geometry_factor=1.,current_contact_resistance_ohm=20.,compliance_voltage_v=10.,voltage_offset_a_v=2e-6,voltage_offset_b_v=-1e-6,voltage_offset_hall_v=3e-6,voltage_drift_v_s=1e-10,voltage_gain=1.,voltage_resolution_fraction=1e-7,voltage_response_tau_s=.002,temperature_resolution_k=1e-4,clamp_speed_m_s=.006,ui_tilt_speed_rad_s=.5,accept_engineering=True) +PLANT=obj({'ambient_k':number('K',283.15,313.15),'contact_asymmetry':number('1',-5,5),'hall_misalignment_fraction':number('1',-.5,.5),'hall_geometry_factor':number('1',.1,2),'drive_geometry_factor':number('1',.1,100),'current_contact_resistance_ohm':number('ohm',0,1e9),'compliance_voltage_v':number('V',1,10),'voltage_offset_a_v':number('V',-.1,.1),'voltage_offset_b_v':number('V',-.1,.1),'voltage_offset_hall_v':number('V',-.1,.1),'voltage_drift_v_s':number('V/s',-1e-3,1e-3),'voltage_gain':number('1',.1,10),'voltage_resolution_fraction':number('1',1e-12,.01),'voltage_response_tau_s':number('s',1e-5,10),'temperature_resolution_k':number('K',1e-6,1),'clamp_speed_m_s':number('m/s',.00001,.1),'ui_tilt_speed_rad_s':number('rad/s',.0001,1.),'accept_engineering':BOOL}) +GEOMETRY_EXAMPLE=dict(side_m=.01,thickness_m=.0005) +GEOMETRY=obj({'side_m':number('m',.001,.1),'thickness_m':number('m',1e-7,.01)}) +THERMAL_EXAMPLE=dict(minimum_temperature_k=290.,maximum_temperature_k=350.,closed_conductance_w_k=.2,open_conductance_w_k=.02,controller_gain_w_k=.5,heating_limit_w=5.,cooling_limit_w=5.,accept_external_thermal_boundary=True) +THERMAL=obj({'minimum_temperature_k':number('K',1,1500),'maximum_temperature_k':number('K',1,1500),'closed_conductance_w_k':number('W/K',1e-6,1000),'open_conductance_w_k':number('W/K',0,1000),'controller_gain_w_k':number('W/K',1e-6,1e5),'heating_limit_w':number('W',.001,1e5),'cooling_limit_w':number('W',.001,1e5),'accept_external_thermal_boundary':BOOL}) +FIELD_EXAMPLE=dict(maximum_abs_t=2.,slew_t_s=1.,response_tau_s=.1,probe_gain=1.,probe_offset_t=0.,probe_resolution_t=1e-7,accept_external_magnet=True) +FIELD=obj({'maximum_abs_t':number('T',.001,100),'slew_t_s':number('T/s',1e-6,100),'response_tau_s':number('s',.001,1e5),'probe_gain':number('1',.1,10),'probe_offset_t':number('T',-1,1),'probe_resolution_t':number('T',1e-12,.1),'accept_external_magnet':BOOL}) +SAMPLE_EXAMPLE=dict(reference_id='starry_40927',density_kg_m3=6000.,specific_heat_capacity_j_kg_k=300.,initial_temperature_k=300.,accept_directional_scalar_and_thermal_assumptions=True) +SAMPLE=obj({'reference_id':TEXT,'density_kg_m3':number('kg/m^3',1,30000),'specific_heat_capacity_j_kg_k':number('J/kg/K',1,10000),'initial_temperature_k':number('K',1,1500),'accept_directional_scalar_and_thermal_assumptions':BOOL}) +METHOD_EXAMPLE=dict(current_range_a=.001,current_a=.0005,voltage_range_v=.001,phase_duration_s=.1,repeats=1,field_settling_tolerance_t=1e-4) +METHOD=obj({'current_range_a':dict(type='number',enum=CURRENT_RANGES,**{'x-unit':'A'}),'current_a':number('A',0,.1),'voltage_range_v':dict(type='number',enum=VOLTAGE_RANGES,**{'x-unit':'V'}),'phase_duration_s':number('s',.001,60),'repeats':dict(type='integer',minimum=1,maximum=100,**{'x-unit':'1'}),'field_settling_tolerance_t':number('T',1e-8,.1)}) +VOLTAGE_EXAMPLE=dict(voltage_range_v=.1,voltage_v=.01,current_measurement_range_a=.01,current_limit_a=.1,current_resolution_fraction=1e-7) +VOLTAGE=obj({'voltage_range_v':dict(type='number',enum=VOLTAGE_EXCITATION_RANGES,**{'x-unit':'V'}),'voltage_v':number('V',0,10),'current_measurement_range_a':dict(type='number',enum=CURRENT_MEASUREMENT_RANGES,**{'x-unit':'A'}),'current_limit_a':number('A',1e-7,.1),'current_resolution_fraction':number('1',1e-12,.01)}) +CALIBRATION_EXAMPLE=dict(voltage_gain_correction=1.,voltage_offset_v=0.,field_gain_correction=1.,field_offset_t=0.) +CALIBRATION=obj({'voltage_gain_correction':number('1',.1,10),'voltage_offset_v':number('V',-.1,.1),'field_gain_correction':number('1',.1,10),'field_offset_t':number('T',-1,1)}) +CONTACT_SCHEMA=enum(CONTACTS) +ROW=obj({'time_s':number('s',0),'host_time_s':number('s',0),'contact_configuration':CONTACT_SCHEMA,'polarity':enum(['zero','positive','negative']),'current_a':nullable(number('A')),'voltage_v':nullable(number('V')),'field_t':nullable(number('T')),'temperature_k':nullable(number('K')),'quality':enum(['estimated','unavailable']),'error_code':nullable(TEXT)}) +ANALYSIS_ROW=obj({'host_time_s':number('s',0),'contact_configuration':CONTACT_SCHEMA,'current_a':number('A'),'voltage_v':number('V'),'field_t':number('T')}) +ANALYSIS_INPUT=obj({'observations':array(ANALYSIS_ROW,18,2000),'thickness_m':number('m',1e-7,.01),'hall_geometry_factor':number('1',.1,2),'hall_factor':number('1',.1,10),'field_symmetry_relative':number('1',1e-6,.1),'accept_single_carrier_model':BOOL}) +INFERENCE=obj({'hall_coefficient_m3_c':number('m^3/C'),'resistivity_ohm_m':number('ohm*m',0),'sheet_resistance_ohm':number('ohm',0),'vdp_resistance_a_ohm':number('ohm',0),'vdp_resistance_b_ohm':number('ohm',0),'hall_carrier_density_m3':number('1/m^3',0),'hall_mobility_m2_v_s':number('m^2/V/s',0),'assumed_single_carrier_density_m3':number('1/m^3',0),'assumed_drift_mobility_m2_v_s':number('m^2/V/s',0),'carrier_type':enum(['hole_like_positive_hall','electron_like_negative_hall']),'fit_rms_v':number('V',0),'evidence':TEXT}) +_ex=[] +for block,B in enumerate([.5,-.5]): + for j,name in enumerate(CONTACTS): + for k,I in enumerate([0.,.0005,-.0005]): + tm=block*5+j*.3+k*.1;R=[.2,.3,.001*B/.0005+.03][j];_ex.append(dict(host_time_s=tm,contact_configuration=name,current_a=I,voltage_v=I*R+2e-6+1e-8*tm,field_t=B)) +ANALYSIS_EXAMPLE=dict(observations=_ex,thickness_m=.0005,hall_geometry_factor=1.,hall_factor=1.,field_symmetry_relative=.01,accept_single_carrier_model=True) +RESULT=obj({'operation_id':nullable(TEXT),'phase':PHASE,'elapsed_s':number('s',0),'rows':array(ROW,0,900),'template_source':nullable(TEXT),'evidence':TEXT,'error_code':nullable(TEXT)}) +CAPS={};SLOTS={} +def cap(k,i,o,c,z,kind='device_command',visibility='agent',example=None):CAPS[k]=dict(input_schema=i,output_schema=o,component_ids=c,function_zh=z,kind=kind,visibility=visibility,example_arguments=copy.deepcopy(example or {}),effects=[]) +def slot(k,s,u,z,origin='derived',visibility='agent',component='controller'):SLOTS[k]=dict(schema=s,unit=u,meaning=z,origin=origin,visibility=visibility,component=component,write=None) +cap('plant.configure',PLANT,obj({'configured':BOOL}),['controller','contact_carriage'],'宿主显式接触/顺从电压/传感/几何误差参数,非OEM精度常数','configuration','evaluator',PLANT_EXAMPLE) +cap('geometry.configure',GEOMETRY,obj({'configured':BOOL}),['sample_sheet'],'方形vdP薄片几何,四角接点;装样后锁定质量体积','configuration','evaluator',GEOMETRY_EXAMPLE) +cap('thermal.configure',THERMAL,obj({'configured':BOOL}),['thermal_port'],'宿主外部工程热边界,非M91加热器或OEM温控系统','configuration','evaluator',THERMAL_EXAMPLE) +cap('field.configure',FIELD,obj({'configured':BOOL}),['field_reference'],'宿主外部磁体边界及场探头,磁体参数不冒充M91能力','configuration','evaluator',FIELD_EXAMPLE) +cap('field.set_target',obj({'field_t':number('T',-100,100)}),obj({'target_t':number('T')}),['field_reference'],'仅宿主设置外场目标;实际B受slew/τ随step演化,M91本体不造磁','simulation','evaluator',{'field_t':.5}) +cap('sample.load',SAMPLE,obj({'loaded':BOOL}),['sample_sheet'],'装入带真实RH/rho实验曲线的样品,热参数与标量方向明确接受','configuration','evaluator',SAMPLE_EXAMPLE) +cap('sample.remove',obj({}),obj({'loaded':BOOL}),['sample_sheet'],'卸下整片及当前显热,保留已焦耳耗散账','configuration','evaluator') +cap('sample.set_clamp',obj({'closed':BOOL}),obj({'target_m':number('m',0,.012)}),['contact_carriage'],'宿主手动四针整体抬起/接触,有限移动代理','simulation','evaluator',{'closed':True}) +cap('ui.set_tilt',obj({'angle_rad':number('rad',0,.26)}),obj({'target_rad':number('rad',0,.26)}),['controller'],'TiltView人工调角有限速度代理,范围为工程假设','simulation','evaluator',{'angle_rad':.13}) +cap('power.set',obj({'enabled':BOOL}),obj({'enabled':BOOL}),['power_button'],'控制器电源;每次重新上电需宿主累计1800s预热,短按动画仅状态代理',example={'enabled':True}) +cap('thermal.set_temperature',obj({'temperature_k':number('K',1,1500)}),obj({'target_k':number('K')}),['thermal_port'],'宿主外部热控制目标,温度只随step变化','simulation','evaluator',{'temperature_k':300.}) +cap('thermal.disable',obj({}),obj({'enabled':BOOL}),['thermal_port'],'停止外部主动调温,已有显热和焦耳过程不回滚','simulation','evaluator') +cap('method.configure',METHOD,obj({'configured':BOOL,'programmed_current_a':number('A',0,.1)}),['controller'],'电流六档及每档1e-5分辨率,电压量程是满量程非最小信号阈值','configuration',example=METHOD_EXAMPLE) +cap('options.configure',obj({'high_resistance_firmware_enabled':BOOL}),obj({'high_resistance_firmware_enabled':BOOL}),['controller'],'宿主明确选择M9-ADD-HR固件以开放电压激励,默认未选;不宣称200GΩ全域计量','configuration','evaluator',{'high_resistance_firmware_enabled':True}) +cap('excitation.voltage.configure',VOLTAGE,obj({'configured':BOOL,'programmed_voltage_v':number('V',0,10),'current_limit_a':number('A',1e-7,.1)}),['controller'],'HR固件下配置并选择电压激励:电压编程1e-5满档;真实负载电流、独立电流量程和显式分辨率模型','configuration',example=VOLTAGE_EXAMPLE) +cap('sensor.calibrate',CALIBRATION,obj({'configured':BOOL}),['controller','field_reference'],'使用外部标准给出的电压和场探头校正,不读取真值','configuration',example=CALIBRATION_EXAMPLE) +cap('acquisition.start',obj({}),obj({'operation_id':TEXT,'expected_duration_s':number('s',0)}),['controller','contact_carriage'],'在一个已稳定外场下依次采vdP-A/vdP-B/Hall的零/正/负激励观测;current模式±I、voltage模式±V') +cap('acquisition.stop',obj({}),obj({'phase':PHASE,'elapsed_s':number('s',0)}),['controller'],'停止激励并冻结已完成相,外部场和已有显热继续演化') +cap('acquisition.result',obj({}),RESULT,['controller'],'公开反转原始观测,所有会话统一隐去选中来源','query') +cap('analysis.hall_vdp',ANALYSIS_INPUT,INFERENCE,['controller'],'从两种相反外场实测代理拟合电流/磁场反转项并数值解vdP;非FastHall私有算法','analysis',example=ANALYSIS_EXAMPLE) +cap('provenance.read',obj({}),obj({'reference_id':nullable(TEXT),'template_source':nullable(TEXT),'evidence':TEXT}),['controller'],'仅宿主读取当前真实RH/rho曲线记录','query','evaluator') +LEDGER_UNITS=dict(mass_loaded_kg='kg',mass_present_kg='kg',mass_removed_kg='kg',mass_error_kg='kg',volume_loaded_m3='m^3',volume_present_m3='m^3',volume_removed_m3='m^3',volume_error_m3='m^3',source_input_j='J',sample_joule_j='J',contact_heat_export_j='J',electrical_error_j='J',controller_input_j='J',ambient_loss_j='J',loaded_sensible_j='J',removed_sensible_j='J',thermal_stored_j='J',thermal_energy_error_j='J') +cap('ledger.read',obj({}),obj({k:number(u) for k,u in LEDGER_UNITS.items()}),['controller'],'样品质量/体积/显热/焦耳、接触热外流与外部温控账;不计外部磁体供电','query','evaluator') +cap('sim.step',obj({'dt_s':number('s',0,86400)}),obj({'time_s':number('s',0)}),['controller'],'单一宿主时间推进真实1800s预热、外部磁场、温度与反转采样','simulation','evaluator',{'dt_s':10.}) +UNSUPPORTED=['hardware.connect','robot.load','measurement.fasthall_proprietary','measurement.hall_bar','measurement.high_resistance_200gohm_range','measurement.multicarrier_tensor','noise.empirical','accuracy.certification'] +for k in UNSUPPORTED:cap(k,obj({}),obj({}),['controller'],'未实现:'+k) +for k,c in [('plant.configured','controller'),('geometry.configured','sample_sheet'),('thermal.configured','thermal_port'),('field.configured','field_reference'),('sample.present','sample_sheet'),('power.enabled','power_button'),('warmup.ready','controller'),('thermal.enabled','thermal_port'),('clamp.moving','contact_carriage')]:slot(k,BOOL,'1','当前配置/运行状态',component=c) +for k,z in [('clamp.position_m','四针当前上提量'),('clamp.target_m','四针目标上提量')]:slot(k,number('m',0,.012),'m',z+';0接触/.012装卸开放','setpoint' if 'target' in k else 'scene',component='contact_carriage') +for k,z in [('ui.tilt_rad','TiltView当前手动代理角'),('ui.target_tilt_rad','TiltView目标手动代理角')]:slot(k,number('rad',0,.26),'rad',z+',范围和速度为工程假设','setpoint' if 'target' in k else 'scene',component='controller') +slot('power.position_m',number('m',0,.0015),'m','电源按键100ms三角按下释放姿态代理,不把通电状态当永久按住','scene',component='power_button') +slot('warmup.elapsed_s',number('s',0,1800),'s','当前连续供电累计预热,1800s封顶,掉电清零') +slot('thermal.target_k',number('K'),'K','宿主外部热边界目标','setpoint',component='thermal_port') +slot('thermal.indicated_k',nullable(number('K')),'K','样品与固定0.1J/K夹具集中节点量化观测','sensor',component='sample_sheet') +slot('field.target_t',number('T'),'T','宿主外部磁体目标,不是M91磁场输出','setpoint',component='field_reference') +slot('field.indicated_t',nullable(number('T')),'T','外部探头增益/偏置/量化后的垂直样品场观测','sensor',component='field_reference') +slot('excitation.programmed_current_a',number('A',0,.1),'A','经当前量程1e-5分辨率量化的电流幅度','setpoint') +slot('options.high_resistance_firmware_enabled',BOOL,'1','宿主明确配置的M9-ADD-HR固件选型,默认关闭') +slot('excitation.mode',enum(['current','voltage']),'1','当前激励模式;method.configure回到电流模式,电压模式须已选HR固件','setpoint') +slot('excitation.programmed_voltage_v',number('V',0,10),'V','电压模式经1e-5满档量化的源幅度,电流模式为零','setpoint') +slot('excitation.current_measurement_range_a',nullable(number('A',1e-8,.1)),'A','电压模式下独立电流观测满量程;不会据此限制实际电流','setpoint') +slot('excitation.source_voltage_v',nullable(number('V',-10,10)),'V','当前实际源端电压模型估计,触发限流或顺从后按真实负载计算,不等于四接点输入电压','derived') +slot('measured.current_a',nullable(number('A')),'A','电流模式为实际源电流估计;电压模式为显式分辨率量化电流观测,独立测量档溢出不可用','sensor') +slot('measured.voltage_v',nullable(number('V')),'V','当前接点配置的量化电压观测;不把所有相都叫Hall电压','sensor') +slot('acquisition.contact_configuration',enum(CONTACTS+['idle']),'1','当前真实测量接点配置') +slot('acquisition.polarity',enum(['zero','positive','negative']),'1','当前电流相,停止时为零') +slot('clock.time_s',number('s',0),'s','唯一宿主时钟') +slot('acquisition.phase',PHASE,'1','异步反转采样状态') +slot('acquisition.elapsed_s',number('s',0),'s','本次真实采样时长') +slot('acquisition.points',{'type':'integer','minimum':0,'maximum':900,'x-unit':'1'},'1','实际完成相数') +for k,u in [('truth.sample_k','K'),('truth.field_t','T'),('truth.sample_mass_kg','kg')]:slot(k,nullable(number(u)),u,'宿主真实样品/外部场状态,非代理可见真值','process_truth','evaluator') + +class LakeShoreMeasurereadyM91Runtime: + def __init__(self,instance_id='m91_01'): + self.instance_id=instance_id;self.plant=None;self.geometry=None;self.thermal=None;self.field=None;self.sample=None;self.record=None;self.power=False;self._power_started_ns=None;self._button_started_ns=-1000000000;self.thermal_enabled=False;self.target=300.;self.field_actual=0.;self.field_target=0.;self.axes={'clamp':dict(position=.012,target=.012,start=.012,start_ns=0,arrival_ns=0),'ui':dict(position=0.,target=0.,start=0.,start_ns=0,arrival_ns=0)};self.x=np.zeros(7);self.time_ns=0;self._clock_remainder_ns=0.;self.revision=0;self.method=copy.deepcopy(METHOD_EXAMPLE);self.programmed_current=METHOD_EXAMPLE['current_a'];self.calibration=copy.deepcopy(CALIBRATION_EXAMPLE);self.high_resistance_firmware_enabled=False;self.excitation_mode='current';self.voltage=copy.deepcopy(VOLTAGE_EXAMPLE);self.programmed_voltage=VOLTAGE_EXAMPLE['voltage_v'];self.current_limit=VOLTAGE_EXAMPLE['current_limit_a'];self.phase='idle';self.elapsed=0.;self.rows=[];self.error=None;self.operation_id=None;self._counter=0;self._start_ns=0;self._phase_index=0;self.expected_duration=0.;self.records={};self._principals={};self._requests={};self._owners={};self._cancel_operations={};self._source=None;self._reference_id=None;self._evidence='no_sample';self._operation_source=None;self._operation_evidence='no_measurement';self.mass_loaded=self.mass_removed=self.volume_loaded=self.volume_removed=self.loaded_sensible=self.removed_sensible=0. + @property + def time_s(self):return self.time_ns/1e9 + def register_principal(self,principal_id,visibility='agent'): + if not isinstance(principal_id,str) or not principal_id or principal_id in self._principals or visibility not in ('agent','debug','evaluator'):raise ActionRejected('REQUEST_CONFLICT') + self._principals[principal_id]=visibility + def session(self,principal_id): + if principal_id not in self._principals:raise ActionRejected('ACCESS_DENIED') + return LakeShoreMeasurereadyM91Session(self,principal_id) + def describe(self):return export_lakeshore_measurereadym91_contract_metadata() + def _warmup(self):return min(WARMUP_S,(self.time_ns-self._power_started_ns)/1e9) if self.power and self._power_started_ns is not None else 0. + def _moving(self,key):return self.time_nsmax(abs(requested)*1e-10,1e-18),resistance=R) + def _observed_current(self,e=None): + if not self.power or self.phase!='running':return None + e=self._electrical() if e is None else e + if self.excitation_mode=='current':return e['current'] + full=self.voltage['current_measurement_range_a'] + if abs(e['current'])>full:return None + q=full*self.voltage['current_resolution_fraction'];return float(round(e['current']/q)*q) + def _observed_voltage(self): + if not self.power or self.phase!='running':return None + c=self.calibration;voltage=(self.x[1]-c['voltage_offset_v'])*c['voltage_gain_correction'] + if abs(voltage)>self.method['voltage_range_v']:return None + q=self.method['voltage_range_v']*self.plant['voltage_resolution_fraction'];return float(round(voltage/q)*q) + def read(self,role='evaluator'): + if role not in ('agent','debug','evaluator'):raise ActionRejected('ACCESS_DENIED') + active=self.power and self.phase=='running';e=self._electrical();d={'plant.configured':self.plant is not None,'geometry.configured':self.geometry is not None,'thermal.configured':self.thermal is not None,'field.configured':self.field is not None,'sample.present':self.sample is not None,'power.enabled':self.power,'warmup.ready':self._warmup()>=WARMUP_S,'thermal.enabled':self.thermal_enabled,'clamp.moving':self._moving('clamp'),'clamp.position_m':self.axes['clamp']['position'],'clamp.target_m':self.axes['clamp']['target'],'ui.tilt_rad':self.axes['ui']['position'],'ui.target_tilt_rad':self.axes['ui']['target'],'power.position_m':self._button_position(),'warmup.elapsed_s':self._warmup(),'thermal.target_k':self.target,'thermal.indicated_k':float(round(self._temperature()/self.plant['temperature_resolution_k'])*self.plant['temperature_resolution_k']) if self.plant and self.thermal else None,'field.target_t':self.field_target,'field.indicated_t':self._field_observed(),'excitation.programmed_current_a':self.programmed_current,'measured.current_a':self._observed_current(e),'options.high_resistance_firmware_enabled':self.high_resistance_firmware_enabled,'excitation.mode':self.excitation_mode,'excitation.programmed_voltage_v':self.programmed_voltage if self.excitation_mode=='voltage' else 0.,'excitation.current_measurement_range_a':self.voltage['current_measurement_range_a'] if self.excitation_mode=='voltage' else None,'excitation.source_voltage_v':e['source_voltage'] if active else None,'measured.voltage_v':self._observed_voltage(),'acquisition.contact_configuration':self._contact(),'acquisition.polarity':self._polarity(),'clock.time_s':self.time_s,'acquisition.phase':self.phase,'acquisition.elapsed_s':self.elapsed,'acquisition.points':len(self.rows),'truth.sample_k':self._temperature(),'truth.field_t':self.field_actual if self.field else None,'truth.sample_mass_kg':self._mass() if self.sample else None} + return {k:v for k,v in d.items() if role!='agent' or SLOTS[k]['visibility']=='agent'} + def _propagate(self,ns): + if not ns:return + dt=ns/1e9;field_end=self._field_at(dt) + if not self.plant or not self.thermal:self.field_actual=field_end;return + p=self.plant;th=self.thermal;C=self._capacity();G=th['closed_conductance_w_k'] if self._closed() else th['open_conductance_w_k'];K=th['controller_gain_w_k'] if self.thermal_enabled and self._closed() else 0.;target=self.target-p['ambient_k'];active=self.power and self.phase=='running' + def thermal_control(delta):return min(th['heating_limit_w'],max(-th['cooling_limit_w'],(K+G)*target-K*delta)) if K else 0. + if active: + name=self._contact();offset=p[{'vdp_a':'voltage_offset_a_v','vdp_b':'voltage_offset_b_v','hall':'voltage_offset_hall_v'}[name]];start_time=self.time_s + def rhs(t,y): + e=self._electrical(p['ambient_k']+y[0],self._field_at(t));controller=thermal_control(y[0]);ambient=G*y[0];signal=p['voltage_gain']*e['voltage']+offset+p['voltage_drift_v_s']*(start_time+t);return [(controller-ambient+e['sample_power'])/C,(signal-y[1])/p['voltage_response_tau_s'],e['sample_power'],e['contact_power'],e['current']*e['source_voltage'],controller,ambient] + sol=solve_ivp(rhs,(0.,dt),self.x,method='Radau',rtol=1e-10,atol=[1e-11,1e-14,1e-15,1e-15,1e-15,1e-12,1e-12]) + if not sol.success:raise RuntimeError('INTEGRATION_FAILED') + self.x=sol.y[:,-1] + else: + initial=float(self.x[0]);low=min(initial,0.,target);high=max(initial,0.,target);saturated=K and ((K+G)*target-K*low>th['heating_limit_w'] or (K+G)*target-K*high < -th['cooling_limit_w']) + if saturated: + def rhs(_t,y): + control=thermal_control(y[0]);ambient=G*y[0];return [(control-ambient)/C,control,ambient] + sol=solve_ivp(rhs,(0.,dt),[self.x[0],self.x[5],self.x[6]],method='Radau',rtol=1e-10,atol=1e-11) + if not sol.success:raise RuntimeError('THERMAL_INTEGRATION_FAILED') + self.x[[0,5,6]]=sol.y[:,-1] + else: + A=np.zeros((4,4));A[0,0]=-(G+K)/C;A[0,3]=(K+G)*target/C if K else 0.;A[1,0]=-K;A[1,3]=(K+G)*target if K else 0.;A[2,0]=G;self.x[[0,5,6]]=(expm(A*dt)@np.array([self.x[0],self.x[5],self.x[6],1.]))[:3] + self.x[1]*=math.exp(-dt/p['voltage_response_tau_s']) + self.field_actual=field_end + def _ledger(self): + stored=self._capacity()*float(self.x[0]);joule,contact,source,control,ambient=self.x[2:];return dict(mass_loaded_kg=self.mass_loaded,mass_present_kg=self._mass(),mass_removed_kg=self.mass_removed,mass_error_kg=self.mass_loaded-self._mass()-self.mass_removed,volume_loaded_m3=self.volume_loaded,volume_present_m3=self._volume(),volume_removed_m3=self.volume_removed,volume_error_m3=self.volume_loaded-self._volume()-self.volume_removed,source_input_j=float(source),sample_joule_j=float(joule),contact_heat_export_j=float(contact),electrical_error_j=float(source-joule-contact),controller_input_j=float(control),ambient_loss_j=float(ambient),loaded_sensible_j=self.loaded_sensible,removed_sensible_j=self.removed_sensible,thermal_stored_j=stored,thermal_energy_error_j=float(control+joule-ambient+self.loaded_sensible-self.removed_sensible-stored)) + def _result(self):return dict(operation_id=self.operation_id,phase=self.phase,elapsed_s=self.elapsed,rows=copy.deepcopy(self.rows),template_source=self._operation_source,evidence=self._operation_evidence,error_code=self.error) + def _finish(self,phase,error=None): + self.phase=phase;self.error=error + if self.operation_id:self.records[self.operation_id]=self._result() + def _record(self): + e=self._electrical();voltage=self._observed_voltage();current=self._observed_current(e);error='REFERENCE_TEMPERATURE_RANGE' if not e['valid'] else 'SOURCE_COMPLIANCE' if e['compliance'] else 'CURRENT_MEASUREMENT_OVERFLOW' if current is None else 'VOLTAGE_OVERFLOW' if voltage is None else None + if not error and self._contact()!='hall' and self._polarity()!='zero' and not .01<=abs(e['resistance'])<=1e7:error='RESISTANCE_RANGE' + self.rows.append(dict(time_s=self.elapsed,host_time_s=self.time_s,contact_configuration=self._contact(),polarity=self._polarity(),current_a=current,voltage_v=voltage,field_t=self._field_observed(),temperature_k=self.read()['thermal.indicated_k'],quality='unavailable' if error else 'estimated',error_code=error));self._phase_index+=1 + if error:self._finish('failed',error) + elif self._phase_index>=9*self.method['repeats']:self._finish('succeeded') + def invoke(self,capability,**a): + if capability not in CAPS:raise ActionRejected('UNKNOWN_CAPABILITY') + validate(CAPS[capability]['input_schema'],a) + if capability in UNSUPPORTED:raise ActionRejected('UNSUPPORTED') + if capability=='analysis.hall_vdp':return infer_hall_vdp(**a) + if capability=='acquisition.result':return self._result() + if capability=='provenance.read':return dict(reference_id=self._reference_id,template_source=self._source,evidence=self._evidence) + if capability=='ledger.read':return self._ledger() + if capability=='sim.step':self.step(a['dt_s']);return {'time_s':self.time_s} + if self.phase=='running' and capability not in ('acquisition.stop','power.set'):raise ActionRejected('BUSY') + if capability=='plant.configure': + if self.plant or not a['accept_engineering']:raise ActionRejected('PRECONDITION_FAILED') + self.plant=copy.deepcopy(a);self.target=a['ambient_k'];out={'configured':True} + elif capability=='geometry.configure': + if self.sample:raise ActionRejected('PRECONDITION_FAILED') + self.geometry=copy.deepcopy(a);out={'configured':True} + elif capability=='thermal.configure': + if not self.plant or self.thermal or not a['accept_external_thermal_boundary'] or not a['minimum_temperature_k']<=self.plant['ambient_k']<=a['maximum_temperature_k'] or a['minimum_temperature_k']>=a['maximum_temperature_k']:raise ActionRejected('THERMAL_ENVELOPE') + self.thermal=copy.deepcopy(a);out={'configured':True} + elif capability=='field.configure': + if self.field or not a['accept_external_magnet']:raise ActionRejected('PRECONDITION_FAILED') + self.field=copy.deepcopy(a);out={'configured':True} + elif capability=='field.set_target': + if not self.field or abs(a['field_t'])>self.field['maximum_abs_t']:raise ActionRejected('FIELD_ENVELOPE') + self.field_target=a['field_t'];out={'target_t':self.field_target} + elif capability=='sample.load': + if not self.plant or not self.thermal or not self.geometry or self.sample or self._moving('clamp') or self.axes['clamp']['position']<.011 or not a['accept_directional_scalar_and_thermal_assumptions']:raise ActionRejected('PRECONDITION_FAILED') + record=library().get(a['reference_id']) + if record is None:raise ActionRejected('UNKNOWN_REFERENCE') + if transport(record,a['initial_temperature_k']) is None:raise ActionRejected('REFERENCE_TEMPERATURE_RANGE') + if not self.thermal['minimum_temperature_k']<=a['initial_temperature_k']<=self.thermal['maximum_temperature_k']:raise ActionRejected('THERMAL_ENVELOPE') + old=self._capacity();self.sample=copy.deepcopy(a);self.record=copy.deepcopy(record);new=self._capacity();delta=a['initial_temperature_k']-self.plant['ambient_k'];self.x[0]=(old*self.x[0]+(new-old)*delta)/new;self.loaded_sensible+=(new-old)*delta;self.mass_loaded+=self._mass();self.volume_loaded+=self._volume();self._reference_id=a['reference_id'];self._source=json.dumps(record['source'],ensure_ascii=False,sort_keys=True);self._evidence='experimental_signed_Hall_and_resistivity_digitized_curves; scalar_directional_and_thermal_parameters_explicit_assumptions';out={'loaded':True} + elif capability=='sample.remove': + if not self.sample or self._moving('clamp') or self.axes['clamp']['position']<.011:raise ActionRejected('PRECONDITION_FAILED') + self.mass_removed+=self._mass();self.volume_removed+=self._volume();self.removed_sensible+=self._mass()*self.sample['specific_heat_capacity_j_kg_k']*float(self.x[0]);self.sample=self.record=None;self._source=self._reference_id=None;self._evidence='no_sample';out={'loaded':False} + elif capability in ('sample.set_clamp','ui.set_tilt'): + if not self.plant:raise ActionRejected('PRECONDITION_FAILED') + key='clamp' if capability=='sample.set_clamp' else 'ui';target=(0. if a['closed'] else .012) if key=='clamp' else a['angle_rad'];speed=self.plant['clamp_speed_m_s' if key=='clamp' else 'ui_tilt_speed_rad_s'];axis=self.axes[key];axis.update(target=target,start=axis['position'],start_ns=self.time_ns,arrival_ns=self.time_ns+round(abs(target-axis['position'])/speed*1e9));out={'target_m' if key=='clamp' else 'target_rad':target} + elif capability=='power.set': + if not a['enabled'] and self.phase=='running':self._finish('cancelled','POWER_OFF') + if a['enabled']!=self.power:self._button_started_ns=self.time_ns;self._power_started_ns=self.time_ns if a['enabled'] else None + self.power=a['enabled'];out={'enabled':self.power} + elif capability=='thermal.set_temperature': + if not self.thermal or not self.thermal['minimum_temperature_k']<=a['temperature_k']<=self.thermal['maximum_temperature_k']:raise ActionRejected('THERMAL_ENVELOPE') + self.target=a['temperature_k'];self.thermal_enabled=True;out={'target_k':self.target} + elif capability=='thermal.disable':self.thermal_enabled=False;out={'enabled':False} + elif capability=='method.configure': + if a['current_a']>a['current_range_a'] or abs(a['phase_duration_s']*1e9-round(a['phase_duration_s']*1e9))>1e-4:raise ActionRejected('CURRENT_OR_TIME_RANGE') + quantum=a['current_range_a']*1e-5;programmed=float(round(a['current_a']/quantum)*quantum);self.method=copy.deepcopy(a);self.programmed_current=programmed;self.excitation_mode='current';out={'configured':True,'programmed_current_a':programmed} + elif capability=='options.configure': + if not a['high_resistance_firmware_enabled'] and self.excitation_mode=='voltage':raise ActionRejected('EXCITATION_MODE_ACTIVE') + self.high_resistance_firmware_enabled=a['high_resistance_firmware_enabled'];out={'high_resistance_firmware_enabled':self.high_resistance_firmware_enabled} + elif capability=='excitation.voltage.configure': + if not self.high_resistance_firmware_enabled:raise ActionRejected('HIGH_RESISTANCE_FIRMWARE_REQUIRED') + if a['voltage_v']>a['voltage_range_v']:raise ActionRejected('VOLTAGE_EXCITATION_RANGE') + voltage_quantum=a['voltage_range_v']*1e-5;programmed=float(round(a['voltage_v']/voltage_quantum)*voltage_quantum);limit_full=next(fs for fs in CURRENT_RANGES if fs>=a['current_limit_a']);limit_quantum=limit_full*.001;limit=float(round(a['current_limit_a']/limit_quantum)*limit_quantum) + self.voltage=copy.deepcopy(a);self.programmed_voltage=programmed;self.current_limit=limit;self.excitation_mode='voltage';out={'configured':True,'programmed_voltage_v':programmed,'current_limit_a':limit} + elif capability=='sensor.calibrate':self.calibration=copy.deepcopy(a);out={'configured':True} + elif capability=='acquisition.start': + if not self.power or not self.plant or not self.geometry or not self.thermal or not self.field or not self.sample or not self._closed() or self._moving('clamp'):raise ActionRejected('PRECONDITION_FAILED') + if self._warmup()self.method['field_settling_tolerance_t']:raise ActionRejected('FIELD_NOT_SETTLED') + if transport(self.record,self._temperature()) is None:raise ActionRejected('REFERENCE_TEMPERATURE_RANGE') + self._counter+=1;self.operation_id=f'{self.instance_id}:acquisition:{self._counter}';self._operation_source=self._source;self._operation_evidence=self._evidence;self.phase='running';self.elapsed=0.;self.rows=[];self.error=None;self._start_ns=self.time_ns;self._phase_index=0;self.expected_duration=9*self.method['repeats']*round(self.method['phase_duration_s']*1e9)/1e9;out={'operation_id':self.operation_id,'expected_duration_s':self.expected_duration} + elif capability=='acquisition.stop': + if self.phase!='running':raise ActionRejected('NOT_RUNNING') + self._finish('cancelled','USER_CANCEL');out={'phase':self.phase,'elapsed_s':self.elapsed} + else:raise ActionRejected('UNKNOWN_CAPABILITY') + self.revision+=1;return copy.deepcopy(out) + def step(self,dt_s): + validate(number('s',0,86400),dt_s);total=math.fsum((self._clock_remainder_ns,dt_s*1e9));ns=round(total);self._clock_remainder_ns=total-ns + if not ns:return + end=self.time_ns+ns + while self.time_ns=axis['arrival_ns'] else axis['start']+math.copysign(speed*(self.time_ns-axis['start_ns'])/1e9,axis['target']-axis['start']) + if self.phase=='running': + self.elapsed=(self.time_ns-self._start_ns)/1e9 + if self.time_ns==self._start_ns+(self._phase_index+1)*round(self.method['phase_duration_s']*1e9):self._record() + self.revision+=1 + +class LakeShoreMeasurereadyM91Session: + def __init__(self, host, principal_id): self._host = host; self._principal = principal_id + @property + def _role(self): return self._host._principals[self._principal] + def _target(self, instance_id): + if instance_id != self._host.instance_id: raise ActionRejected('UNKNOWN_INSTANCE') + def describe(self, *, instance_id=None, asset_type_id=None): + if (instance_id is None) == (asset_type_id is None): raise ActionRejected('INVALID_ARGUMENT') + if instance_id is not None: self._target(instance_id) + if asset_type_id is not None and asset_type_id != ASSET_TYPE_ID: raise ActionRejected('UNKNOWN_INSTANCE') + meta = export_lakeshore_measurereadym91_contract_metadata() + return dict(protocol_version=PROTOCOL_VERSION, asset_type_id=ASSET_TYPE_ID, asset_version='1.0.0', capabilities={k:v for k,v in meta['capabilities'].items() if v['visibility']=='agent' or self._role!='agent'}, state_slots={k:v for k,v in meta['state_slots'].items() if v['visibility']=='agent' or self._role!='agent'}) + def read(self, *, instance_id, state_ids=None): + self._target(instance_id); h=self._host; values=h.read(self._role); ids=list(values) if state_ids is None else state_ids + if not isinstance(ids,list) or any(not isinstance(k,str) for k in ids): raise ActionRejected('INVALID_ARGUMENT') + if any(k not in values for k in ids): raise ActionRejected('ACCESS_DENIED') + return dict(instance_id=instance_id, status='succeeded', state_revision=h.revision, clock={'domain':'simulation','time_s':h.time_s}, observations={k:dict(value=copy.deepcopy(values[k]),unit=SLOTS[k]['unit'],quality='unavailable' if values[k] is None else 'estimated' if SLOTS[k]['origin'] in ('sensor','derived') else 'valid',sample_time_s=h.time_s,sample_window_s=None) for k in ids}) + def _filter_result(self, result): + result = copy.deepcopy(result) + # A bridge may dispatch agent-visible capabilities through a privileged + # session. Public acquisition payloads therefore use the SAME redaction + # for every role. Full provenance has its own evaluator-only capability. + if 'rows' in result and 'template_source' in result: + result['template_source'] = str(LIBRARY_PATH.relative_to(ROOT)) + '; selected record provenance available only through evaluator provenance.read' if result['template_source'] is not None else None + result['evidence'] = 'observed_contact_voltages_current_and_external_field_with_explicit_scalar_Hall_vdP_assumptions; selected template details require evaluator provenance.read' if result['operation_id'] is not None else 'no_measurement' + return result + def invoke(self, *, instance_id, capability_id, arguments, request_id): + h=self._host + try: + self._target(instance_id) + if not isinstance(capability_id,str) or capability_id not in CAPS: raise ActionRejected('UNKNOWN_CAPABILITY') + if self._role=='agent' and CAPS[capability_id]['visibility']!='agent': raise ActionRejected('ACCESS_DENIED') + if not isinstance(request_id,str) or not request_id: raise ActionRejected('INVALID_ARGUMENT') + validate(CAPS[capability_id]['input_schema'],arguments); key=(self._principal,request_id); digest=json.dumps([capability_id,arguments],sort_keys=True,allow_nan=False) + if key in h._requests: + old,response=h._requests[key] + if old!=digest: raise ActionRejected('REQUEST_CONFLICT') + return copy.deepcopy(response) + if capability_id in ('acquisition.stop','acquisition.result') and self._role=='agent' and h.operation_id and h._owners.get(h.operation_id)!=self._principal: raise ActionRejected('ACCESS_DENIED') + if capability_id=='power.set' and not arguments['enabled'] and h.phase=='running' and self._role=='agent' and h._owners.get(h.operation_id)!=self._principal: raise ActionRejected('ACCESS_DENIED') + result=self._filter_result(h.invoke(capability_id,**arguments)); operation=result.get('operation_id') if capability_id=='acquisition.start' else None + if operation: h._owners[operation]=self._principal + response=dict(protocol_version=PROTOCOL_VERSION,instance_id=instance_id,request_id=request_id,operation_id=operation,status='accepted' if operation else 'succeeded',state_revision=h.revision,clock={'domain':'simulation','time_s':h.time_s},result=result,observations={},error=None) + h._requests[key]=(digest,copy.deepcopy(response)); return response + except ActionRejected as exc: + return dict(protocol_version=PROTOCOL_VERSION,instance_id=instance_id,request_id=request_id,operation_id=None,status='unsupported' if str(exc)=='UNSUPPORTED' else 'rejected',state_revision=h.revision,clock={'domain':'simulation','time_s':h.time_s},result={},observations={},error=dict(code=str(exc),message=str(exc),retryable=False,side_effects='none')) + def write(self, *, instance_id, state_id, value, request_id): + self._target(instance_id); entry=SLOTS.get(state_id) + if not entry or not entry['write']: raise ActionRejected('ACCESS_DENIED') + capability,argument=entry['write']; return self.invoke(instance_id=instance_id,capability_id=capability,arguments={argument:value},request_id=request_id) + def poll(self, operation_id): + h=self._host + if h._owners.get(operation_id)!=self._principal: raise ActionRejected('ACCESS_DENIED') + result=h._result() if operation_id==h.operation_id and h.phase=='running' else h.records.get(operation_id) + if result is None: raise ActionRejected('UNKNOWN_OPERATION') + return dict(operation_id=operation_id,status=result['phase'],result=self._filter_result(result)) + def cancel(self, operation_id, request_id): + self.poll(operation_id); h=self._host + if not isinstance(request_id,str) or not request_id: raise ActionRejected('INVALID_ARGUMENT') + key=(self._principal,request_id) + if key in h._cancel_operations: + if h._cancel_operations[key]!=operation_id: raise ActionRejected('REQUEST_CONFLICT') + return copy.deepcopy(h._requests[key][1]) + if key in h._requests: raise ActionRejected('REQUEST_CONFLICT') + if operation_id!=h.operation_id or h.phase!='running': raise ActionRejected('NOT_RUNNING') + result=self.invoke(instance_id=h.instance_id,capability_id='acquisition.stop',arguments={},request_id=request_id) + if result['status']=='succeeded': h._cancel_operations[key]=operation_id + return result + +EFFECTS={ + 'plant.configure':['plant.configured','thermal.target_k','truth.sample_k'], + 'geometry.configure':['geometry.configured'], + 'thermal.configure':['thermal.configured','thermal.indicated_k'], + 'field.configure':['field.configured','field.indicated_t','truth.field_t'], + 'field.set_target':['field.target_t'], + 'sample.load':['sample.present','truth.sample_mass_kg','truth.sample_k','thermal.indicated_k'], + 'sample.remove':['sample.present','truth.sample_mass_kg'], + 'sample.set_clamp':['clamp.target_m','clamp.moving'], + 'ui.set_tilt':['ui.target_tilt_rad'], + 'power.set':['power.enabled','power.position_m','warmup.ready','warmup.elapsed_s','acquisition.phase','measured.current_a','measured.voltage_v','acquisition.contact_configuration','acquisition.polarity','excitation.source_voltage_v'], + 'thermal.set_temperature':['thermal.target_k','thermal.enabled'],'thermal.disable':['thermal.enabled'], + 'method.configure':['excitation.programmed_current_a','excitation.mode','excitation.programmed_voltage_v','excitation.current_measurement_range_a'], + 'options.configure':['options.high_resistance_firmware_enabled'], + 'excitation.voltage.configure':['excitation.mode','excitation.programmed_voltage_v','excitation.current_measurement_range_a'], + 'sensor.calibrate':['field.indicated_t','measured.voltage_v'], + 'acquisition.start':['acquisition.phase','acquisition.elapsed_s','acquisition.points','acquisition.contact_configuration','acquisition.polarity','measured.current_a','measured.voltage_v','excitation.source_voltage_v'], + 'acquisition.stop':['acquisition.phase','measured.current_a','measured.voltage_v','acquisition.contact_configuration','acquisition.polarity','excitation.source_voltage_v'], + 'sim.step':list(SLOTS)} +for k,v in EFFECTS.items():CAPS[k]['effects']=v +ERRORS=sorted(set(__import__('re').findall(r"ActionRejected\('([A-Z_0-9]+)'",Path(__file__).read_text()))|{'POWER_OFF','USER_CANCEL','SOURCE_COMPLIANCE','CURRENT_MEASUREMENT_OVERFLOW','VOLTAGE_OVERFLOW','REFERENCE_TEMPERATURE_RANGE','RESISTANCE_RANGE'}) + +def export_lakeshore_measurereadym91_contract_metadata(): + slots={};caps={} + for k,v in SLOTS.items(): + slots[k]=dict(meaning_zh=v['meaning'],component_ids=[v['component']],value_schema=copy.deepcopy(v['schema']),unit=v['unit'],reference_conditions='SI; four-corner thin uniform scalar sheet; external normal B; conventional current and external-field reversal.',origin=v['origin'],visibility=v['visibility'],access='read_only',read_binding=dict(backend='host',artifact_id='runtime',accessor=f'LakeShoreMeasurereadyM91Session.read(state_ids=[{k!r}])'),write_via=None,sampling=dict(mode='instant',time_domain='simulation',window_description='Only explicit host step advances field, thermal, motion, detector response and 1800s warmup. Each zero/positive/negative excitation phase records its endpoint after declared dwell: current mode uses +/-I and voltage mode uses +/-V.'),source_ids=['simulation_assumption']) + limits=[ + '本体是M91 Hall控制器;磁体、样品夹具、场探头和温控边界由宿主明确组合,不虚构机内磁场或样品加热器。外部磁体供电/磁能不在本体电热账内。', + '本模型实现M91实际支持的传统电流/外部磁场反转vdP子集。FastHall无需物理反磁私有算法、Hall bar及200GΩ全域高阻计量未实现;电压激励明确依赖宿主选择M9-ADD-HR固件;不把unsupported负例称实现验证。', + '上电后只由真实宿主时间累计1800s预热,每次掉电清零;read/配置不推进时间,重复power.set(True)不重置已连续预热。', + '电流源六量程1µA至100mA,每档编程步长1e-5×满量程;1µA档10pA是分辨率,1µA不是可编程电流下限。电压观测五量程1mV至10V是满量程,微伏信号不因小于1mV而拒绝。', + '电压源四满量程10mV/100mV/1V/10V,编程步长1e-5×量程,10mV档可编程100nV而非最小输出10mV。仅M9-ADD-HR固件明确启用后可切换电压模式;method.configure切回电流模式。', + '电压模式实际I=Vset/(Rdrive+Rcontact),源电流limit按0.1%满档量化,自动满档采用最小可容纳限值电流档的显式工程规则(厂家未公开该自动选档细节),SCPI保守范围100nA至100mA;概述0至100mA与SCPI下限不同已记录。限流后实际Vsource=Iactual*(Rdrive+Rcontact),并保留功率后标compliance失败。', + '电压模式电流观测四满量程10nA/10µA/10mA/100mA依手册,官网不同分组未混用;current_resolution_fraction仅宿主工程量化模型,非OEM精度/噪声。测量档溢出不限制实际电流,观测current_a为null并失败,不允许null进入反演。', + '基础电阻范围10mΩ至10MΩ。电流源宿主顺从电压1至10V;达到顺从时实际电流按样品与两电流接触总阻抗降额,保留真实焦耳热并将测量标失败,不能假称目标电流已达到。', + '默认10×10mm、厚0.5mm四角薄片;geometry.configure只改变过程几何,静态示例mesh不自动缩放。装样时质量=ρside²d,载入后禁止改几何;卸样带走全部样品质量/体积及显热。', + '真实库提供实验数字化带符号RH(T)和rho(T),不同温网格分别线性插值;有效域与原论文保守温区相交。未由Seebeck推Hall符号,无域外材料外推有效读数。', + '密度、Cp、接触电阻、接触非对称、Hall几何因子、驱动几何因子和传感增益/偏置/τ/分辨率为宿主明确假设,不能当64种样品实测参数或OEM精度常数。', + '薄片均匀、简单连通、四角小接触、标量方向代表是假设;不求解有限接触电流密度、张量各向异性、磁阻、非线性I-V或多载流子输运。vdP前向RA/RB满足指数恒等式但接触非对称不来自3D电流场求解。', + '反演只使用外部观测I,V,B及时间,分别拟合电流奇项、I×B项、常偏置与线性漂移,再数值解vdP。两种B需方向相反且幅度满足显式容差,未宣称免反磁FastHall。', + 'nH=1/(e|RH|)、muH=|RH|/rho是Hall派生量;额外n=rH*nH、mu=muH/rH依赖宿主显式单载流子Hall因子。ZrNiSn等来源可能多带,不把这些派生值冒充真实总载流子浓度。', + '每个外场操作为vdP-A、vdP-B和Hall接点各零/正/负激励(电流模式±I、电压模式±V),按实际phase_duration等待并求一阶电压传感响应;有限响应或温漂会产生可见拟合偏差,非瞬时真值直抄。', + '外部磁场满足有限slew和一阶响应,set_target只写目标;切换场时拒绝正在采样的操作。M91断电不关闭独立外部场/温控,取消仅停止测量激励并冻结已有相,已有热量继续交换。', + '样品与固定0.1J/K夹具热容共一个工程集中节点。闭合夹具由外部热控制器调温,开夹转为环境热交换;显式加热/冷却功率上限与热导未知必须输入,不借用主机35W供电当加热功率。', + '源电能分为样品I²R热和接触热导出环境,样品热与外部控制器/环境/装卸显热闭合;未计外部磁体功耗、Peltier/Thomson或磁化能,热账仅此明确电阻性子模型。', + 'TiltView可手动倾斜,角范围/速度是工程代理;电源为100ms短按三角姿态不保持压下,低帧率可能看不到完整按键动作。显示覆盖为任意当前接点配置电压,并非每相都是Hall电压。', + '所有Session公开result/poll即使evaluator转发也统一去除所选来源,privileged provenance.read单独返回当前样品溯源;操作结果保存采样时来源快照,Python/磁盘共享不是OS安全隔离。', + '真实硬件校准、OEM精度/噪声、FastHall性能、机器人装样、完整电磁场/接触求解、外部温控与磁体硬件联调not_run。'] + for k,v in CAPS.items(): + un=k in UNSUPPORTED;async_=k=='acquisition.start';caps[k]={key:copy.deepcopy(v[key]) for key in ['input_schema','output_schema','component_ids','function_zh','kind','visibility','example_arguments']} + caps[k].update(availability='unsupported' if un else 'implemented',implementation={layer:'absent' if un or layer in ('scene','robot','hardware') else 'implemented' for layer in ['process','scene','robot','hardware','host']},binding=None if un else dict(backend='host',artifact_id='runtime',entrypoint='asset_runtime.lakeshore_measurereadym91.LakeShoreMeasurereadyM91Session.invoke',invocation=f'session.invoke(instance_id="m91_01",capability_id={k!r},arguments={v["example_arguments"]!r},request_id="unique")'),preconditions=[] if un or v['kind'] in ('query','analysis') else [dict(description_zh='运行入口原子检查明确外场/热条件、夹持、真实1800s预热、参考温域、量程和异步所有权。',state_ids=['power.enabled','warmup.ready','sample.present','clamp.position_m','field.configured','acquisition.phase'],enforced_by='runtime',check='LakeShoreMeasurereadyM91Runtime.invoke guards before commit')],state_effects=[dict(state_id=s,timing='immediate',description_zh='命令实际即时状态变化') for s in v['effects']],observes=[],model_effects=dict(mode='none',description_zh='只输出可映射状态,实际场景验证单独登记。',binding_ids=[]),execution=dict(mode='asynchronous' if async_ else 'synchronous',time_domain='simulation',completion_criterion='各接点配置的零/正/负激励相按真实停留时间采样,全部完成或测量范围错误终止' if async_ else '原子命令;预热/外场/电热/机械/采样仅宿主step推进',completion_state_ids=['acquisition.phase'] if async_ else [],timeout_s=None,cancellation='supported' if async_ else 'unsupported',retry='same_request_id',resources=['host_clock','external_magnet','four_contact_fixture','programmable_source','voltmeter'],partial_failure_zh='取消/断电停止电流并冻结已完成测量相;外部场和独立温控、已积显热继续。范围错误保留不可用相后停止激励。'),errors=[dict(code=e,meaning_zh=e,side_effects='partial' if async_ and e in ('POWER_OFF','USER_CANCEL','SOURCE_COMPLIANCE','CURRENT_MEASUREMENT_OVERFLOW','VOLTAGE_OVERFLOW','REFERENCE_TEMPERATURE_RANGE','RESISTANCE_RANGE') else 'none') for e in ERRORS],verification=[],limitations=limits,source_ids=['manufacturer_primary','simulation_assumption','template_library']) + if k in ('thermal.set_temperature','thermal.disable','sample.set_clamp','ui.set_tilt','field.set_target','acquisition.start','power.set'): + caps[k]['state_effects'] += [dict(state_id=s,timing='on_step',description_zh='宿主时间推进外场、预热、电热、机械或实际测量相') for s in SLOTS if s not in v['effects'] and s not in ('plant.configured','geometry.configured','thermal.configured','field.configured','sample.present','power.enabled')] + mechanism=dict(component_ids=['controller','contact_carriage','sample_sheet','thermal_port','field_reference'],state_ids=list(slots),meaning_zh='传统外部磁场与电流反转的四接点Hall及van der Pauw观测反演,真实预热、有限场响应与电热质量账',implementation='lumped',equations=[ + 'Rs=rho(T)/d; RA=Rs*log(1+exp(u))/pi; RB=Rs*log(1+exp(-u))/pi. Therefore exp(-pi*RA/Rs)+exp(-pi*RB/Rs)=1. u is declared contact-asymmetry proxy.', + 'Current step=range*1e-5; Current mode:Iactual=sign(Iset)*min(abs(Iset),Vcompliance/(Rs*drive_geometry_factor+Rcontact)),1<=Vcompliance<=10V. Voltage mode:Irequested=Vset/(Rdrive+Rcontact),Iactual=sign(Irequested)*min(abs(Irequested),Ilimit),Vactual=Iactual*(Rdrive+Rcontact);Ilimit100nA..100mA with0.1%FS programming and explicitly assumed smallest-containing-FS selection. Voltage ranges limit maximum magnitude, not minimum resolvable measured signal.', + 'V_A=I*RA; V_B=I*RB; V_H=I*(RH(T)*B/d*hall_geometry_factor+misalignment*sqrt(RA*RB)). Gain/offset/linear drift feed explicit first-order detector dz/dt=(Vsignal-z)/tau.', + 'dB/dt=clip((Btarget-B)/tau,-slew,+slew), integrated analytically through transition. Field and thermal source are external boundaries and continue independently of M91 logical power.', + 'External inverse fits V=R*I+offset+drift*t for A/B and V=Rmisalign*I+(RH*g/d)*I*B+offset+drift*t for Hall. A bracketing root solves vdP sheet resistance using observed RA/RB only.', + 'nH=1/(e*abs(RH)),muH=abs(RH)/rho; assumed single-carrier n=rH*nH,mu=muH/rH. Hall sign labels Hall response only; multiband true carrier populations are not inferred.', + 'Psource=I*Vsource=I²*(Rdrive+Rcontact); Psample=I²*Rdrive; Pcontact_export=I²*Rcontact. Csample_total*dT/dt=Pcontroller+Psample-G*(T-Ta), Csample_total=0.1J/K+rho_mass*volume*Cp.', + 'Pcontroller=clip((K+G)*(Ttarget-Ta)-K*(T-Ta),-cooling_limit,+heating_limit) when clamped and external controller enabled. Open clamp uses ambient Gopen and no active controller. Incoming/outgoing sample sensible heat is ledgered.', + 'Idle linear thermal states use exact matrix exponential; active detector/temperature-dependent electrical model uses Radau integration with sampling-event boundaries; nanosecond residual carries fractional host timestep (e.g.60Hz). Warmup is1800 host seconds after last powerup.'],parameters={},source_ids=['simulation_assumption','template_library'],limitations=limits) + spec=importlib.util.spec_from_file_location('_m91_local_annotations',ROOT/'scripts/asset_runtime/_annotations.py');ann=importlib.util.module_from_spec(spec);spec.loader.exec_module(ann);ann.KEY_ZH.update({k:v['meaning'] for k,v in SLOTS.items()});ann.annotate_export(SLUG,caps,slots,{'hall_van_der_pauw':mechanism},inputs={'plant.configure':(PLANT,PLANT_EXAMPLE),'geometry.configure':(GEOMETRY,GEOMETRY_EXAMPLE),'thermal.configure':(THERMAL,THERMAL_EXAMPLE),'field.configure':(FIELD,FIELD_EXAMPLE),'sample.load':(SAMPLE,SAMPLE_EXAMPLE),'method.configure':(METHOD,METHOD_EXAMPLE),'excitation.voltage.configure':(VOLTAGE,VOLTAGE_EXAMPLE)}) + for key,value in SLOTS.items():slots[key]['meaning_zh']=value['meaning'] + return dict(asset_type_id=ASSET_TYPE_ID,catalog_id=CATALOG_ID,capabilities=caps,state_slots=slots,mechanisms={'hall_van_der_pauw':mechanism}) diff --git a/scripts/asset_runtime/novocontrol_alphat.py b/scripts/asset_runtime/novocontrol_alphat.py new file mode 100644 index 0000000000000000000000000000000000000000..dc8231f8272a4fcbd22594c4b56d1b0a05d8de45 --- /dev/null +++ b/scripts/asset_runtime/novocontrol_alphat.py @@ -0,0 +1,431 @@ +"""CHEM140 Alpha-T RevC with current converter: observed phasor spectroscopy. + +Finite dwell,50ohm generator loading,external OSL inverse calibration and explicit +thermal budgets. Static dielectric references never become claimed measured spectra. +""" +from __future__ import annotations +import copy,importlib.util,json,math +from pathlib import Path +import numpy as np +from scipy.integrate import solve_ivp +PROTOCOL_VERSION='1.0.0';SLUG='novocontrol_alphat';ASSET_TYPE_ID='instrument.'+SLUG;CATALOG_ID='CHEM-140' +ROOT=Path(__file__).resolve().parents[2];ASSET=ROOT/'assets/expansion_batch04/t1_thermal'/SLUG;LIBRARY_PATH=ASSET/'dielectric_library.json' + +class ActionRejected(ValueError):pass + +def number(unit='1',lo=None,hi=None): + s={'type':'number','x-unit':unit} + if lo is not None:s['minimum']=lo + if hi is not None:s['maximum']=hi + return s + +def obj(properties):return dict(type='object',properties=properties,required=list(properties),additionalProperties=False) +def nullable(s):return {'anyOf':[s,{'type':'null'}]} +def array(s,minimum=0,maximum=200001):return dict(type='array',items=s,minItems=minimum,maxItems=maximum) +def enum(items):return {'type':'string','enum':items} +BOOL={'type':'boolean'};TEXT={'type':'string'};PHASE=enum(['idle','running','succeeded','cancelled','failed']) + +def validate(s,v): + if 'anyOf' in s: + for o in s['anyOf']: + try:validate(o,v);return + except ActionRejected:pass + raise ActionRejected('INVALID_ARGUMENT') + k=s.get('type') + if k in ('number','integer'): + if isinstance(v,bool) or not isinstance(v,(int,float)) or not math.isfinite(v) or k=='integer' and type(v) is not int or not s.get('minimum',-math.inf)<=v<=s.get('maximum',math.inf):raise ActionRejected('INVALID_ARGUMENT') + elif k=='object': + if not isinstance(v,dict) or set(v)!=set(s['properties']):raise ActionRejected('INVALID_ARGUMENT') + for key,value in v.items():validate(s['properties'][key],value) + elif k=='array': + if not isinstance(v,list) or not s.get('minItems',0)<=len(v)<=s.get('maxItems',math.inf):raise ActionRejected('INVALID_ARGUMENT') + for x in v:validate(s['items'],x) + elif k=='boolean' and type(v) is not bool:raise ActionRejected('INVALID_ARGUMENT') + elif k=='string' and not isinstance(v,str):raise ActionRejected('INVALID_ARGUMENT') + elif k=='null' and v is not None:raise ActionRejected('INVALID_ARGUMENT') + if 'enum' in s and v not in s['enum']:raise ActionRejected('INVALID_ARGUMENT') + +from scipy.linalg import expm +EPS0=8.8541878128e-12 +SOURCE_RESISTANCE_OHM=50. +CONVERTER_LIMIT_A=.04 +MIN_POINT_S=1/10.5 + +def library():return {x['id']:x for x in json.loads(LIBRARY_PATH.read_text())['templates']} +def cx(unit):return obj({'real':number(unit),'imag':number(unit)}) +def pack(z):return dict(real=float(complex(z).real),imag=float(complex(z).imag)) +def unpack(v):return complex(v['real'],v['imag']) +def vacuum_capacitance(diameter_m,thickness_m):return EPS0*math.pi*(diameter_m/2)**2/thickness_m + +def dielectric_response(epsilon_static,epsilon_infinity,relaxation_time_s,dc_conductivity_s_m,frequency_hz): + w=2*math.pi*frequency_hz;return epsilon_infinity+(epsilon_static-epsilon_infinity)/(1+1j*w*relaxation_time_s)-1j*dc_conductivity_s_m/(w*EPS0) + +def infer_dielectric(frequency_hz,voltage_rms,current_rms,diameter_m,thickness_m): + voltage=unpack(voltage_rms);current=unpack(current_rms) + if abs(voltage)<1e-30 or abs(current)<1e-30:raise ActionRejected('ANALYSIS_ZERO_SIGNAL') + z=voltage/current + if not math.isfinite(z.real) or not math.isfinite(z.imag) or abs(z)<1e-300:raise ActionRejected('ANALYSIS_DATA') + y=1/z;w=2*math.pi*frequency_hz;c0=vacuum_capacitance(diameter_m,thickness_m);eps=y/(1j*w*c0) + if eps.real<=0 or -eps.imag < -1e-9*max(abs(eps),1.):raise ActionRejected('NONPASSIVE_OR_NONCAPACITIVE_RESULT') + loss=max(0.,-eps.imag) + return dict(impedance_ohm=pack(z),epsilon_real=float(eps.real),epsilon_loss=float(loss),tan_delta=float(loss/eps.real),parallel_capacitance_f=float(c0*eps.real),conductivity_real_s_m=float(w*EPS0*loss),conductivity_imag_s_m=float(w*EPS0*eps.real),evidence='inverse_of_supplied_RMS_complex_voltage_and_current; epsilon=Y/(j*omega*C0); sigma_real_includes_dielectric_loss_not_only_dc_conduction') + +def solve_osl(frequency_hz,open_measured_ohm,short_measured_ohm,load_measured_ohm,load_resistance_ohm): + zo,zs,zl=map(unpack,[open_measured_ohm,short_measured_ohm,load_measured_ohm]);scale=max(abs(zo),abs(zs),abs(zl),1e-30) + if abs(zo)<1e-30 or abs(zl-zs)<1e-12*max(abs(zl),abs(zs),1e-30) or abs(zo-zs)<1e-12*scale:raise ActionRejected('CALIBRATION_DEGENERATE') + a=load_resistance_ohm*(1-zl/zo)/(zl-zs);b=-a*zs;c=-1/zo + if not all(math.isfinite(v) for z in (a,b,c) for v in (z.real,z.imag)):raise ActionRejected('CALIBRATION_DEGENERATE') + return dict(frequency_hz=frequency_hz,a=pack(a),b_ohm=pack(b),c_s=pack(c),evidence='three_standard_Mobius_inverse_from_external_open_short_load_measurements; no_hidden_fixture_or_gain_access') + +def correct_impedance(z,calibration): + denominator=unpack(calibration['c_s'])*z+1 + if abs(denominator)<1e-14:raise ActionRejected('CALIBRATION_SINGULAR') + return (unpack(calibration['a'])*z+unpack(calibration['b_ohm']))/denominator + +PLANT_EXAMPLE=dict(ambient_k=293.2,fixture_series_resistance_ohm=.2,fixture_series_inductance_h=1e-7,fixture_parallel_capacitance_f=2e-12,fixture_parallel_conductance_s=1e-10,voltage_gain_magnitude=1.,voltage_gain_phase_rad=0.,current_gain_magnitude=1.,current_gain_phase_rad=0.,voltage_resolution_v=1e-10,current_resolution_a=1e-18,detector_tau_s=.002,temperature_resolution_k=1e-4,clamp_speed_m_s=.025,accept_engineering=True) +PLANT=obj({'ambient_k':number('K',283.15,313.15),'fixture_series_resistance_ohm':number('ohm',0,1e6),'fixture_series_inductance_h':number('H',0,1),'fixture_parallel_capacitance_f':number('F',1e-18,1e-3),'fixture_parallel_conductance_s':number('S',0,1),'voltage_gain_magnitude':number('1',.1,10),'voltage_gain_phase_rad':number('rad',-math.pi,math.pi),'current_gain_magnitude':number('1',.1,10),'current_gain_phase_rad':number('rad',-math.pi,math.pi),'voltage_resolution_v':number('V',1e-15,.1),'current_resolution_a':number('A',1e-24,.001),'detector_tau_s':number('s',1e-6,100),'temperature_resolution_k':number('K',1e-6,1),'clamp_speed_m_s':number('m/s',.0001,.1),'accept_engineering':BOOL}) +GEOMETRY_EXAMPLE=dict(diameter_m=.02,thickness_m=.001) +GEOMETRY=obj({'diameter_m':number('m',.001,.1),'thickness_m':number('m',1e-6,.02)}) +THERMAL_EXAMPLE=dict(minimum_temperature_k=293.15,maximum_temperature_k=303.15,bath_capacity_j_k=5.,bath_ambient_conductance_w_k=.1,sample_bath_conductance_w_k=.5,open_sample_ambient_conductance_w_k=.05,controller_gain_w_k=5.,heating_limit_w=30.,cooling_limit_w=30.,accept_external_engineering_system=True) +THERMAL=obj({'minimum_temperature_k':number('K',100,1000),'maximum_temperature_k':number('K',100,1000),'bath_capacity_j_k':number('J/K',.001,1e7),'bath_ambient_conductance_w_k':number('W/K',0,1000),'sample_bath_conductance_w_k':number('W/K',1e-6,1000),'open_sample_ambient_conductance_w_k':number('W/K',0,100),'controller_gain_w_k':number('W/K',1e-6,1e5),'heating_limit_w':number('W',.001,1e5),'cooling_limit_w':number('W',.001,1e5),'accept_external_engineering_system':BOOL}) +SAMPLE_EXAMPLE=dict(reference_id='water_crc_7732_18_5',epsilon_infinity=4.9,relaxation_time_s=1e-11,dc_conductivity_s_m=5e-6,density_kg_m3=1000.,specific_heat_capacity_j_kg_k=4180.,initial_temperature_k=293.2,temperature_tolerance_k=.5,accept_spectrum_assumption=True,accept_thermal_assumption=True) +SAMPLE=obj({'reference_id':TEXT,'epsilon_infinity':number('1',1,1e5),'relaxation_time_s':number('s',1e-15,1e12),'dc_conductivity_s_m':number('S/m',0,1e8),'density_kg_m3':number('kg/m^3',1,30000),'specific_heat_capacity_j_kg_k':number('J/kg/K',1,10000),'initial_temperature_k':number('K',100,1000),'temperature_tolerance_k':number('K',.0001,2.),'accept_spectrum_assumption':BOOL,'accept_thermal_assumption':BOOL}) +METHOD_EXAMPLE=dict(frequencies_hz=[10.,100.,1000.,10000.,100000.],source_voltage_rms_v=.3,cycles_per_point=1,settling_s=.01,require_calibration=False) +METHOD=obj({'frequencies_hz':array(number('Hz',3e-6,4e7),1,2001),'source_voltage_rms_v':number('V',0,3),'cycles_per_point':dict(type='integer',minimum=1,maximum=1000,**{'x-unit':'1'}),'settling_s':number('s',0,10000),'require_calibration':BOOL}) +MODE=enum(['sample','open','short','load']) +OSL_INPUT=obj({'frequency_hz':number('Hz',3e-6,4e7),'open_measured_ohm':cx('ohm'),'short_measured_ohm':cx('ohm'),'load_measured_ohm':cx('ohm'),'load_resistance_ohm':number('ohm',.01,1e12)}) +OSL_RESULT=obj({'frequency_hz':number('Hz',3e-6,4e7),'a':cx('1'),'b_ohm':cx('ohm'),'c_s':cx('S'),'evidence':TEXT}) +OSL_EXAMPLE=dict(frequency_hz=1000.,open_measured_ohm=pack(100-1e6j),short_measured_ohm=pack(.2+.0006j),load_measured_ohm=pack(1000.199+.999j),load_resistance_ohm=1000.) +ANALYSIS_INPUT=obj({'frequency_hz':number('Hz',3e-6,4e7),'voltage_rms':cx('V'),'current_rms':cx('A'),'diameter_m':number('m',.001,.1),'thickness_m':number('m',1e-6,.02)}) +ANALYSIS_EXAMPLE=dict(frequency_hz=1000.,voltage_rms=pack(1.),current_rms=pack(1e-8+1e-6j),diameter_m=.02,thickness_m=.001) +INFERENCE=obj({'impedance_ohm':cx('ohm'),'epsilon_real':number('1',0),'epsilon_loss':number('1',0),'tan_delta':number('1',0),'parallel_capacitance_f':number('F',0),'conductivity_real_s_m':number('S/m',0),'conductivity_imag_s_m':number('S/m',0),'evidence':TEXT}) +ROW=obj({'time_s':number('s',0),'host_time_s':number('s',0),'frequency_hz':number('Hz'),'point_duration_s':number('s',0),'load_mode':MODE,'source_voltage_rms_v':number('V'),'voltage_rms':nullable(cx('V')),'current_rms':nullable(cx('A')),'raw_impedance_ohm':nullable(cx('ohm')),'impedance_ohm':nullable(cx('ohm')),'epsilon_real':nullable(number('1')),'epsilon_loss':nullable(number('1')),'tan_delta':nullable(number('1')),'parallel_capacitance_f':nullable(number('F')),'conductivity_real_s_m':nullable(number('S/m')),'conductivity_imag_s_m':nullable(number('S/m')),'sample_temperature_k':nullable(number('K')),'calibration_applied':BOOL,'quality':enum(['estimated','unavailable']),'error_code':nullable(TEXT)}) +RESULT=obj({'operation_id':nullable(TEXT),'phase':PHASE,'elapsed_s':number('s',0),'rows':array(ROW,0,2001),'template_source':nullable(TEXT),'evidence':TEXT,'error_code':nullable(TEXT)}) +CAPS={};SLOTS={} +def cap(k,i,o,c,z,kind='device_command',visibility='agent',example=None):CAPS[k]=dict(input_schema=i,output_schema=o,component_ids=c,function_zh=z,kind=kind,visibility=visibility,example_arguments=copy.deepcopy(example or {}),effects=[]) +def slot(k,s,u,z,origin='derived',visibility='agent',component='controller'):SLOTS[k]=dict(schema=s,unit=u,meaning=z,origin=origin,visibility=visibility,component=component,write=None) +cap('plant.configure',PLANT,obj({'configured':BOOL}),['controller','current_converter'],'宿主显式寄生/相位增益/探测响应参数,厂家50Ω源电阻固定','configuration','evaluator',PLANT_EXAMPLE) +cap('geometry.configure',GEOMETRY,obj({'configured':BOOL}),['electrode_upper','electrode_lower','sample_disc'],'工程平板夹具几何与C0;装样后尺寸锁定守恒','configuration','evaluator',GEOMETRY_EXAMPLE) +cap('thermal.configure',THERMAL,obj({'configured':BOOL}),['thermal_port','electrode_lower'],'明确选择外部工程集中热边界,不假造OEM温控附件额定温区','configuration','evaluator',THERMAL_EXAMPLE) +cap('sample.load',SAMPLE,obj({'loaded':BOOL}),['sample_disc'],'真实静态介电参考加显式Debye/直流导电/热物性假设,不冒充实测宽频谱','configuration','evaluator',SAMPLE_EXAMPLE) +cap('sample.remove',obj({}),obj({'loaded':BOOL}),['sample_disc'],'移出整片/定容液体样品及当前显热,不回滚已耗散热','configuration','evaluator') +cap('sample.set_clamp',obj({'closed':BOOL}),obj({'target_m':number('m',0,.025)}),['electrode_upper'],'宿主手动上电极有限运动代理,开放时转为外界热交换','simulation','evaluator',{'closed':True}) +cap('power.set',obj({'enabled':BOOL}),obj({'enabled':BOOL}),['power_switch'],'关闭源电压/控制并取消采集,样品显热继续交换',example={'enabled':True}) +cap('thermal.set_temperature',obj({'temperature_k':number('K',100,1000)}),obj({'target_k':number('K')}),['thermal_port'],'只写已配置外部热边界范围内目标,实际温度仅step推进',example={'temperature_k':293.2}) +cap('thermal.disable',obj({}),obj({'enabled':BOOL}),['thermal_port'],'停止外部主动温控,热交换与介电耗散仍按实际供电继续') +cap('fixture.select_load',obj({'mode':MODE,'load_resistance_ohm':number('ohm',.01,1e12)}),obj({'mode':MODE}),['electrode_upper','current_converter'],'宿主连接样品或外部open/short/已知纯电阻参考;非已验证自动校准切换硬件','simulation','evaluator',{'mode':'sample','load_resistance_ohm':1000.}) +cap('method.configure',METHOD,obj({'configured':BOOL}),['controller'],'每点实际等待cycles/f和无OptionF的10.5点/s下限,幅度按频界检查','configuration',example=METHOD_EXAMPLE) +cap('calibration.solve',OSL_INPUT,OSL_RESULT,['controller'],'只用外部open/short/load复阻抗观测解三项Möbius校正','analysis',example=OSL_EXAMPLE) +cap('calibration.apply',obj({'records':array(OSL_RESULT,1,2001)}),obj({'configured':BOOL}),['controller'],'应用外部逐频点校准系数;不外推/插值到未校准频率','configuration',example={'records':[solve_osl(**OSL_EXAMPLE)]}) +cap('calibration.clear',obj({}),obj({'configured':BOOL}),['controller'],'清除校准记录并明确返回未校准状态','configuration') +cap('acquisition.start',obj({}),obj({'operation_id':TEXT,'expected_duration_s':number('s',0)}),['controller','current_converter'],'异步逐频率实际驻留并采集RMS复电压电流') +cap('acquisition.stop',obj({}),obj({'phase':PHASE,'elapsed_s':number('s',0)}),['controller'],'停止源激励并冻结已完成频点,部分点不伪装完成') +cap('acquisition.result',obj({}),RESULT,['controller'],'公开复VI观测和反演介电/损耗/阻抗;任意会话均隐藏选中物质来源','query') +cap('analysis.dielectric',ANALYSIS_INPUT,INFERENCE,['controller'],'仅由外部复VI及平板几何反演,σ实部包括介电损耗与直流导电','analysis',example=ANALYSIS_EXAMPLE) +cap('provenance.read',obj({}),obj({'reference_id':nullable(TEXT),'template_source':nullable(TEXT),'evidence':TEXT}),['controller'],'仅宿主读取当前样品真实静态参考及显式谱假设来源','query','evaluator') +LEDGER_UNITS=dict(mass_loaded_kg='kg',mass_present_kg='kg',mass_removed_kg='kg',mass_error_kg='kg',volume_loaded_m3='m^3',volume_present_m3='m^3',volume_removed_m3='m^3',volume_error_m3='m^3',generator_active_input_j='J',source_resistor_heat_j='J',fixture_parasitic_heat_j='J',reference_load_heat_j='J',sample_dielectric_heat_j='J',electrical_error_j='J',controller_input_j='J',ambient_loss_j='J',loaded_sensible_j='J',removed_sensible_j='J',thermal_stored_j='J',thermal_energy_error_j='J') +cap('ledger.read',obj({}),obj({k:number(u) for k,u in LEDGER_UNITS.items()}),['controller'],'周期平均源/50Ω/寄生/参考/样品耗散及热/质量/体积守恒账','query','evaluator') +cap('sim.step',obj({'dt_s':number('s',0,86400)}),obj({'time_s':number('s',0)}),['controller'],'单一宿主时钟支持分数纳秒余数,超长低频点必须实际累计推进','simulation','evaluator',{'dt_s':.1}) +UNSUPPORTED=['hardware.connect','robot.load','measurement.dc_bias_option_b','measurement.fast_option_f','measurement.high_voltage','measurement.oem_thermal_attachment','noise.empirical','accuracy.certification','measurement.field_transients'] +for k in UNSUPPORTED:cap(k,obj({}),obj({}),['controller'],'未实现:'+k) +for k,c in [('plant.configured','controller'),('geometry.configured','electrode_lower'),('thermal.configured','thermal_port'),('sample.present','sample_disc'),('power.enabled','power_switch'),('thermal.enabled','thermal_port'),('clamp.moving','electrode_upper'),('calibration.configured','controller')]:slot(k,BOOL,'1','实际配置或运行状态',component=c) +for suffix in ['position_m','target_m']:slot('clamp.'+suffix,number('m',0,.025),'m','上电极开口相对测量位置位移;0闭合,.025开放','setpoint' if suffix=='target_m' else 'scene',component='electrode_upper') +slot('power.angle_rad',number('rad',0,.28),'rad','电源开关工程姿态','scene',component='power_switch') +slot('thermal.target_k',number('K'),'K','外部工程热边界温度目标,不代表OEM温控能力','setpoint',component='thermal_port') +slot('thermal.indicated_k',nullable(number('K')),'K','样品与电极集中节点量化温度API观测,非厂家精度认证','sensor',component='sample_disc') +slot('excitation.frequency_hz',nullable(number('Hz')),'Hz','当前真实驻留频点,未激励时null','derived',component='controller') +slot('excitation.source_voltage_rms_v',number('V'),'V','当前50Ω前源RMS幅度,停止时0,不等于样品两端幅度','derived',component='controller') +slot('fixture.load_mode',MODE,'1','宿主当前接入sample/open/short/load参考','setpoint',component='current_converter') +slot('measured.voltage_rms_v',nullable(cx('V')),'V','含显式增益/相位/响应/量化的复RMS电压观测','sensor',component='current_converter') +slot('measured.current_rms_a',nullable(cx('A')),'A','含显式增益/相位/响应/量化的复RMS电流;超过40mA时不可用','sensor',component='current_converter') +slot('clock.time_s',number('s',0),'s','唯一宿主时钟') +slot('acquisition.phase',PHASE,'1','异步频扫状态') +slot('acquisition.elapsed_s',number('s',0),'s','本次实际源激励时长') +slot('acquisition.expected_duration_s',number('s',0),'s','逐点频率周期及通信速率下限计算的所需总时长') +slot('acquisition.points',{'type':'integer','minimum':0,'maximum':2001,'x-unit':'1'},'1','实际完成的频点数,不含尚未完成点') +for k,u in [('truth.bath_k','K'),('truth.sample_k','K'),('truth.sample_mass_kg','kg'),('truth.dc_conductivity_s_m','S/m')]:slot(k,nullable(number(u)),u,'仅宿主真实热/样品参数状态','process_truth','evaluator') + +class NovocontrolAlphatRuntime: + def __init__(self,instance_id='alphat_01'): + self.instance_id=instance_id;self.plant=None;self.geometry=None;self.thermal=None;self.sample=None;self.record=None;self.power=False;self.thermal_enabled=False;self.target=293.2;self.clamp=.025;self.clamp_target=.025;self._clamp_start=.025;self._clamp_start_ns=0;self._clamp_arrival_ns=0;self.x=np.zeros(4);self.detector=np.zeros(2,dtype=complex);self.time_ns=0;self._clock_remainder_ns=0.;self.revision=0;self.mode='sample';self.load_resistance=1000.;self.method=copy.deepcopy(METHOD_EXAMPLE);self.calibration={};self.phase='idle';self.elapsed=0.;self.rows=[];self.error=None;self.operation_id=None;self._counter=0;self._start_ns=0;self._point_index=0;self._point_start_ns=0;self._point_end_ns=0;self.expected_duration=0.;self.records={};self._principals={};self._requests={};self._owners={};self._cancel_operations={};self._source=None;self._reference_id=None;self._evidence='no_sample';self._operation_source=None;self._operation_evidence='no_measurement';self.mass_loaded=self.mass_removed=self.volume_loaded=self.volume_removed=self.loaded_sensible=self.removed_sensible=0.;self.electrical_energy=np.zeros(5) + @property + def time_s(self):return self.time_ns/1e9 + def register_principal(self,principal_id,visibility='agent'): + if not isinstance(principal_id,str) or not principal_id or principal_id in self._principals or visibility not in ('agent','debug','evaluator'):raise ActionRejected('REQUEST_CONFLICT') + self._principals[principal_id]=visibility + def session(self,principal_id): + if principal_id not in self._principals:raise ActionRejected('ACCESS_DENIED') + return NovocontrolAlphatSession(self,principal_id) + def describe(self):return export_novocontrol_alphat_contract_metadata() + def _moving(self):return self.time_nsCONVERTER_LIMIT_A*(1+1e-12):return 'CURRENT_CONVERTER_OVERFLOW' + if self.mode=='sample' and self.sample and abs(self._temperature(1)-self.sample['reference_k'])>self.sample['temperature_tolerance_k']:return 'REFERENCE_TEMPERATURE_RANGE' + return None + def _observed(self): + if not self.power or not self.plant or self.phase!='running':return None,None + circuit=self._circuit() + if self._measurement_error(circuit):return None,None + p=self.plant;quant=lambda z,q:complex(round(z.real/q)*q,round(z.imag/q)*q);return pack(quant(self.detector[0],p['voltage_resolution_v'])),pack(quant(self.detector[1],p['current_resolution_a'])) + def read(self,role='evaluator'): + if role not in ('agent','debug','evaluator'):raise ActionRejected('ACCESS_DENIED') + voltage,current=self._observed();d={'plant.configured':self.plant is not None,'geometry.configured':self.geometry is not None,'thermal.configured':self.thermal is not None,'sample.present':self.sample is not None,'power.enabled':self.power,'thermal.enabled':self.thermal_enabled,'clamp.moving':self._moving(),'calibration.configured':bool(self.calibration),'clamp.position_m':self.clamp,'clamp.target_m':self.clamp_target,'power.angle_rad':.28 if self.power else 0.,'thermal.target_k':self.target,'thermal.indicated_k':float(round(self._temperature(1)/self.plant['temperature_resolution_k'])*self.plant['temperature_resolution_k']) if self.power and self.thermal else None,'excitation.frequency_hz':self._frequency(),'excitation.source_voltage_rms_v':self.method['source_voltage_rms_v'] if self.phase=='running' and self.power else 0.,'fixture.load_mode':self.mode,'measured.voltage_rms_v':voltage,'measured.current_rms_a':current,'clock.time_s':self.time_s,'acquisition.phase':self.phase,'acquisition.elapsed_s':self.elapsed,'acquisition.expected_duration_s':self.expected_duration,'acquisition.points':len(self.rows),'truth.bath_k':self._temperature(0),'truth.sample_k':self._temperature(1),'truth.sample_mass_kg':self._mass() if self.sample else None,'truth.dc_conductivity_s_m':self.sample['dc_conductivity_s_m'] if self.sample else None} + return {k:v for k,v in d.items() if role!='agent' or SLOTS[k]['visibility']=='agent'} + def _propagate(self,ns): + if not ns:return + dt=ns/1e9;circuit=self._circuit() if self.power and self.phase=='running' else dict(voltage=0j,current=0j,power=np.zeros(5));self.electrical_energy+=circuit['power']*dt + if self.plant: + p=self.plant;gv=p['voltage_gain_magnitude']*complex(math.cos(p['voltage_gain_phase_rad']),math.sin(p['voltage_gain_phase_rad']));gi=p['current_gain_magnitude']*complex(math.cos(p['current_gain_phase_rad']),math.sin(p['current_gain_phase_rad']));target=np.array([circuit['voltage']*gv,circuit['current']*gi]);self.detector=target+(self.detector-target)*math.exp(-dt/p['detector_tau_s']) + if not self.thermal:return + t=self.thermal;C=self._capacities();gb=t['sample_bath_conductance_w_k'] if self._closed() else 0.;gs=0. if self._closed() else t['open_sample_ambient_conductance_w_k'];ga=t['bath_ambient_conductance_w_k'];K=t['controller_gain_w_k'] if self.power and self.thermal_enabled else 0.;target=self.target-self.plant['ambient_k'];P=float(circuit['power'][4]);low=min(float(min(self.x[:2])),0.,target);high=max(float(max(self.x[:2])),0.,target)+P*dt/min(C);saturated=K and ((K+ga)*target-K*low>t['heating_limit_w'] or (K+ga)*target-K*high < -t['cooling_limit_w']) + if saturated: + def rhs(_time,y): + b,s=y[:2];raw=(K+ga)*target-K*b;control=min(t['heating_limit_w'],max(-t['cooling_limit_w'],raw));ambient=ga*b+gs*s;return [(control-gb*(b-s)-ga*b)/C[0],(gb*(b-s)-gs*s+P)/C[1],control,ambient] + sol=solve_ivp(rhs,(0.,dt),self.x,method='Radau',rtol=1e-10,atol=[1e-11,1e-11,1e-10,1e-10]) + if not sol.success:raise RuntimeError('THERMAL_INTEGRATION_FAILED') + self.x=sol.y[:,-1] + else: + A=np.zeros((5,5));A[0,0]=-(gb+ga+K)/C[0];A[0,1]=gb/C[0];A[0,4]=(K+ga)*target/C[0] if K else 0.;A[1,0]=gb/C[1];A[1,1]=-(gb+gs)/C[1];A[1,4]=P/C[1];A[2,0]=-K;A[2,4]=(K+ga)*target if K else 0.;A[3,0]=ga;A[3,1]=gs;self.x=(expm(A*dt)@np.r_[self.x,1.])[:4] + def _ledger(self): + generator,source,parasitic,reference,sample=self.electrical_energy;stored=float(self._capacities()@self.x[:2]) if self.thermal else 0.;control,ambient=self.x[2:];return dict(mass_loaded_kg=self.mass_loaded,mass_present_kg=self._mass(),mass_removed_kg=self.mass_removed,mass_error_kg=self.mass_loaded-self._mass()-self.mass_removed,volume_loaded_m3=self.volume_loaded,volume_present_m3=self._volume(),volume_removed_m3=self.volume_removed,volume_error_m3=self.volume_loaded-self._volume()-self.volume_removed,generator_active_input_j=float(generator),source_resistor_heat_j=float(source),fixture_parasitic_heat_j=float(parasitic),reference_load_heat_j=float(reference),sample_dielectric_heat_j=float(sample),electrical_error_j=float(generator-source-parasitic-reference-sample),controller_input_j=float(control),ambient_loss_j=float(ambient),loaded_sensible_j=self.loaded_sensible,removed_sensible_j=self.removed_sensible,thermal_stored_j=stored,thermal_energy_error_j=float(control+sample-ambient+self.loaded_sensible-self.removed_sensible-stored)) + def _result(self):return dict(operation_id=self.operation_id,phase=self.phase,elapsed_s=self.elapsed,rows=copy.deepcopy(self.rows),template_source=self._operation_source,evidence=self._operation_evidence,error_code=self.error) + def _finish(self,phase,error=None): + self.phase=phase;self.error=error + if self.operation_id:self.records[self.operation_id]=self._result() + def _record(self): + frequency=self._frequency();circuit=self._circuit();error=self._measurement_error(circuit);voltage,current=self._observed();raw=None;corrected=None;inferred=None;calibration=self.calibration.get(frequency) if self.mode=='sample' else None + if not error: + try: + if voltage is None or current is None or abs(unpack(current))<1e-30:raise ActionRejected('ANALYSIS_ZERO_SIGNAL') + raw=unpack(voltage)/unpack(current);corrected=correct_impedance(raw,calibration) if calibration else raw + if self.mode=='sample': + inferred=infer_dielectric(frequency,pack(corrected*unpack(current)),current,**self.geometry) + if not .01<=abs(corrected)<=2e14 or not 1e-15<=inferred['parallel_capacitance_f']<=10.:raise ActionRejected('MEASUREMENT_RANGE') + except ActionRejected as exc:error=str(exc) + row=dict(time_s=self.elapsed,host_time_s=self.time_s,frequency_hz=frequency,point_duration_s=(self.time_ns-self._point_start_ns)/1e9,load_mode=self.mode,source_voltage_rms_v=self.method['source_voltage_rms_v'],voltage_rms=voltage,current_rms=current,raw_impedance_ohm=pack(raw) if raw is not None else None,impedance_ohm=pack(corrected) if corrected is not None else None,**{k:inferred[k] if inferred and not error else None for k in ['epsilon_real','epsilon_loss','tan_delta','parallel_capacitance_f','conductivity_real_s_m','conductivity_imag_s_m']},sample_temperature_k=self.read()['thermal.indicated_k'],calibration_applied=calibration is not None,quality='unavailable' if error else 'estimated',error_code=error);self.rows.append(row) + if error:self._finish('failed',error);return + self._point_index+=1 + if self._point_index>=len(self.method['frequencies_hz']):self._finish('succeeded') + else:self._point_start_ns=self.time_ns;self._point_end_ns=self.time_ns+self._point_duration_ns(self._frequency()) + def invoke(self,capability,**a): + if capability not in CAPS:raise ActionRejected('UNKNOWN_CAPABILITY') + validate(CAPS[capability]['input_schema'],a) + if capability in UNSUPPORTED:raise ActionRejected('UNSUPPORTED') + if capability=='analysis.dielectric':return infer_dielectric(**a) + if capability=='calibration.solve':return solve_osl(**a) + if capability=='acquisition.result':return self._result() + if capability=='provenance.read':return dict(reference_id=self._reference_id,template_source=self._source,evidence=self._evidence) + if capability=='ledger.read':return self._ledger() + if capability=='sim.step':self.step(a['dt_s']);return {'time_s':self.time_s} + if self.phase=='running' and capability not in ('acquisition.stop','power.set'):raise ActionRejected('BUSY') + if capability=='plant.configure': + if self.plant or not a['accept_engineering']:raise ActionRejected('PRECONDITION_FAILED') + self.plant=copy.deepcopy(a);self.target=a['ambient_k'];out={'configured':True} + elif capability=='geometry.configure': + if self.sample:raise ActionRejected('PRECONDITION_FAILED') + self.geometry=copy.deepcopy(a);out={'configured':True} + elif capability=='thermal.configure': + if not self.plant or self.thermal or not a['accept_external_engineering_system'] or not a['minimum_temperature_k']<=self.plant['ambient_k']<=a['maximum_temperature_k'] or a['minimum_temperature_k']>=a['maximum_temperature_k']:raise ActionRejected('PRECONDITION_FAILED') + self.thermal=copy.deepcopy(a);out={'configured':True} + elif capability=='sample.load': + if not self.plant or not self.geometry or not self.thermal or self.sample or self._moving() or self.clamp<.024 or not a['accept_spectrum_assumption'] or not a['accept_thermal_assumption']:raise ActionRejected('PRECONDITION_FAILED') + record=library().get(a['reference_id']) + if record is None:raise ActionRejected('UNKNOWN_REFERENCE') + epsilon=record.get('relative_permittivity_static');temperature=record.get('reference_temperature_K') + if not isinstance(epsilon,(int,float)) or not math.isfinite(epsilon) or epsilona['temperature_tolerance_k']:raise ActionRejected('REFERENCE_TEMPERATURE_RANGE') + if not self.thermal['minimum_temperature_k']<=a['initial_temperature_k']<=self.thermal['maximum_temperature_k']:raise ActionRejected('THERMAL_ENVELOPE') + old=self._capacities()[1];self.sample=copy.deepcopy(a);self.sample.update(epsilon_static=epsilon,reference_k=temperature);self.record=copy.deepcopy(record);new=self._capacities()[1];delta=a['initial_temperature_k']-self.plant['ambient_k'];self.x[1]=(old*self.x[1]+(new-old)*delta)/new;self.loaded_sensible+=(new-old)*delta;self.mass_loaded+=self._mass();self.volume_loaded+=self._volume();self._reference_id=a['reference_id'];self._source=json.dumps(record['source'],ensure_ascii=False,sort_keys=True);self._evidence='real_static_permittivity_reference; synthetic_Debye_spectrum_and_dc_conductivity_explicit_host_assumptions';out={'loaded':True} + elif capability=='sample.remove': + if not self.sample or self._moving() or self.clamp<.024:raise ActionRejected('PRECONDITION_FAILED') + self.mass_removed+=self._mass();self.volume_removed+=self._volume();self.removed_sensible+=self._mass()*self.sample['specific_heat_capacity_j_kg_k']*float(self.x[1]);self.sample=self.record=None;self._source=self._reference_id=None;self._evidence='no_sample';out={'loaded':False} + elif capability=='sample.set_clamp': + if not self.plant:raise ActionRejected('PRECONDITION_FAILED') + self.clamp_target=0. if a['closed'] else .025;self._clamp_start=self.clamp;self._clamp_start_ns=self.time_ns;self._clamp_arrival_ns=self.time_ns+round(abs(self.clamp_target-self.clamp)/self.plant['clamp_speed_m_s']*1e9);out={'target_m':self.clamp_target} + elif capability=='power.set': + if not a['enabled'] and self.phase=='running':self._finish('cancelled','POWER_OFF') + self.power=a['enabled'] + if not self.power:self.thermal_enabled=False + out={'enabled':self.power} + elif capability=='thermal.set_temperature': + if not self.power or not self.thermal or not self.thermal['minimum_temperature_k']<=a['temperature_k']<=self.thermal['maximum_temperature_k']:raise ActionRejected('THERMAL_ENVELOPE') + self.target=a['temperature_k'];self.thermal_enabled=True;out={'target_k':self.target} + elif capability=='thermal.disable':self.thermal_enabled=False;out={'enabled':False} + elif capability=='fixture.select_load':self.mode=a['mode'];self.load_resistance=a['load_resistance_ohm'];out={'mode':self.mode} + elif capability=='method.configure': + frequencies=a['frequencies_hz'] + if len(set(frequencies))!=len(frequencies) or any(f>=1e7 and a['source_voltage_rms_v']>1. for f in frequencies):raise ActionRejected('FREQUENCY_VOLTAGE_ENVELOPE') + self.method=copy.deepcopy(a);out={'configured':True} + elif capability=='calibration.apply': + if len({x['frequency_hz'] for x in a['records']})!=len(a['records']) or any(abs(unpack(x['a'])-unpack(x['b_ohm'])*unpack(x['c_s']))<1e-20 for x in a['records']):raise ActionRejected('CALIBRATION_DEGENERATE') + self.calibration={x['frequency_hz']:copy.deepcopy(x) for x in a['records']};out={'configured':True} + elif capability=='calibration.clear':self.calibration={};out={'configured':False} + elif capability=='acquisition.start': + if not self.power or not self.plant or not self.geometry or not self.thermal or not self._closed() or self._moving() or self.mode=='sample' and not self.sample:raise ActionRejected('PRECONDITION_FAILED') + if self.method['source_voltage_rms_v']==0:raise ActionRejected('ZERO_EXCITATION') + if self.mode=='sample' and abs(self._temperature(1)-self.sample['reference_k'])>self.sample['temperature_tolerance_k']:raise ActionRejected('REFERENCE_TEMPERATURE_RANGE') + if self.mode=='sample' and self.method['require_calibration'] and any(f not in self.calibration for f in self.method['frequencies_hz']):raise ActionRejected('CALIBRATION_MISSING') + self._counter+=1;self.operation_id=f'{self.instance_id}:acquisition:{self._counter}';self._operation_source=self._source if self.mode=='sample' else None;self._operation_evidence=self._evidence if self.mode=='sample' else 'actual_simulated_external_reference_observation';self.phase='running';self.elapsed=0.;self.rows=[];self.error=None;self._start_ns=self.time_ns;self._point_index=0;self._point_start_ns=self.time_ns;self._point_end_ns=self.time_ns+self._point_duration_ns(self._frequency());self.expected_duration=sum(self._point_duration_ns(f) for f in self.method['frequencies_hz'])/1e9;out={'operation_id':self.operation_id,'expected_duration_s':self.expected_duration} + elif capability=='acquisition.stop': + if self.phase!='running':raise ActionRejected('NOT_RUNNING') + self._finish('cancelled','USER_CANCEL');out={'phase':self.phase,'elapsed_s':self.elapsed} + else:raise ActionRejected('UNKNOWN_CAPABILITY') + self.revision+=1;return copy.deepcopy(out) + def step(self,dt_s): + validate(number('s',0,86400),dt_s);total=math.fsum((self._clock_remainder_ns,dt_s*1e9));ns=round(total);self._clock_remainder_ns=total-ns + if not ns:return + end=self.time_ns+ns + while self.time_ns=self._clamp_arrival_ns else self._clamp_start+math.copysign(self.plant['clamp_speed_m_s']*(self.time_ns-self._clamp_start_ns)/1e9,self.clamp_target-self._clamp_start) + if self.phase=='running': + self.elapsed=(self.time_ns-self._start_ns)/1e9 + if self.time_ns==self._point_end_ns:self._record() + self.revision+=1 + +class NovocontrolAlphatSession: + def __init__(self, host, principal_id): self._host = host; self._principal = principal_id + @property + def _role(self): return self._host._principals[self._principal] + def _target(self, instance_id): + if instance_id != self._host.instance_id: raise ActionRejected('UNKNOWN_INSTANCE') + def describe(self, *, instance_id=None, asset_type_id=None): + if (instance_id is None) == (asset_type_id is None): raise ActionRejected('INVALID_ARGUMENT') + if instance_id is not None: self._target(instance_id) + if asset_type_id is not None and asset_type_id != ASSET_TYPE_ID: raise ActionRejected('UNKNOWN_INSTANCE') + meta = export_novocontrol_alphat_contract_metadata() + return dict(protocol_version=PROTOCOL_VERSION, asset_type_id=ASSET_TYPE_ID, asset_version='1.0.0', capabilities={k:v for k,v in meta['capabilities'].items() if v['visibility']=='agent' or self._role!='agent'}, state_slots={k:v for k,v in meta['state_slots'].items() if v['visibility']=='agent' or self._role!='agent'}) + def read(self, *, instance_id, state_ids=None): + self._target(instance_id); h=self._host; values=h.read(self._role); ids=list(values) if state_ids is None else state_ids + if not isinstance(ids,list) or any(not isinstance(k,str) for k in ids): raise ActionRejected('INVALID_ARGUMENT') + if any(k not in values for k in ids): raise ActionRejected('ACCESS_DENIED') + return dict(instance_id=instance_id, status='succeeded', state_revision=h.revision, clock={'domain':'simulation','time_s':h.time_s}, observations={k:dict(value=copy.deepcopy(values[k]),unit=SLOTS[k]['unit'],quality='unavailable' if values[k] is None else 'estimated' if SLOTS[k]['origin'] in ('sensor','derived') else 'valid',sample_time_s=h.time_s,sample_window_s=None) for k in ids}) + def _filter_result(self, result): + result = copy.deepcopy(result) + # A bridge may dispatch agent-visible capabilities through a privileged + # session. Public acquisition payloads therefore use the SAME redaction + # for every role. Full provenance has its own evaluator-only capability. + if 'rows' in result and 'template_source' in result: + result['template_source'] = str(LIBRARY_PATH.relative_to(ROOT)) + '; selected record provenance available only through evaluator provenance.read' if result['template_source'] is not None else None + result['evidence'] = 'observed_complex_VI_with_explicit_synthetic_spectrum_and_fixture_assumptions; selected template details require evaluator provenance.read' if result['operation_id'] is not None else 'no_measurement' + return result + def invoke(self, *, instance_id, capability_id, arguments, request_id): + h=self._host + try: + self._target(instance_id) + if not isinstance(capability_id,str) or capability_id not in CAPS: raise ActionRejected('UNKNOWN_CAPABILITY') + if self._role=='agent' and CAPS[capability_id]['visibility']!='agent': raise ActionRejected('ACCESS_DENIED') + if not isinstance(request_id,str) or not request_id: raise ActionRejected('INVALID_ARGUMENT') + validate(CAPS[capability_id]['input_schema'],arguments); key=(self._principal,request_id); digest=json.dumps([capability_id,arguments],sort_keys=True,allow_nan=False) + if key in h._requests: + old,response=h._requests[key] + if old!=digest: raise ActionRejected('REQUEST_CONFLICT') + return copy.deepcopy(response) + if capability_id in ('acquisition.stop','acquisition.result') and self._role=='agent' and h.operation_id and h._owners.get(h.operation_id)!=self._principal: raise ActionRejected('ACCESS_DENIED') + if capability_id=='power.set' and not arguments['enabled'] and h.phase=='running' and self._role=='agent' and h._owners.get(h.operation_id)!=self._principal: raise ActionRejected('ACCESS_DENIED') + result=self._filter_result(h.invoke(capability_id,**arguments)); operation=result.get('operation_id') if capability_id=='acquisition.start' else None + if operation: h._owners[operation]=self._principal + response=dict(protocol_version=PROTOCOL_VERSION,instance_id=instance_id,request_id=request_id,operation_id=operation,status='accepted' if operation else 'succeeded',state_revision=h.revision,clock={'domain':'simulation','time_s':h.time_s},result=result,observations={},error=None) + h._requests[key]=(digest,copy.deepcopy(response)); return response + except ActionRejected as exc: + return dict(protocol_version=PROTOCOL_VERSION,instance_id=instance_id,request_id=request_id,operation_id=None,status='unsupported' if str(exc)=='UNSUPPORTED' else 'rejected',state_revision=h.revision,clock={'domain':'simulation','time_s':h.time_s},result={},observations={},error=dict(code=str(exc),message=str(exc),retryable=False,side_effects='none')) + def write(self, *, instance_id, state_id, value, request_id): + self._target(instance_id); entry=SLOTS.get(state_id) + if not entry or not entry['write']: raise ActionRejected('ACCESS_DENIED') + capability,argument=entry['write']; return self.invoke(instance_id=instance_id,capability_id=capability,arguments={argument:value},request_id=request_id) + def poll(self, operation_id): + h=self._host + if h._owners.get(operation_id)!=self._principal: raise ActionRejected('ACCESS_DENIED') + result=h._result() if operation_id==h.operation_id and h.phase=='running' else h.records.get(operation_id) + if result is None: raise ActionRejected('UNKNOWN_OPERATION') + return dict(operation_id=operation_id,status=result['phase'],result=self._filter_result(result)) + def cancel(self, operation_id, request_id): + self.poll(operation_id); h=self._host + if not isinstance(request_id,str) or not request_id: raise ActionRejected('INVALID_ARGUMENT') + key=(self._principal,request_id) + if key in h._cancel_operations: + if h._cancel_operations[key]!=operation_id: raise ActionRejected('REQUEST_CONFLICT') + return copy.deepcopy(h._requests[key][1]) + if key in h._requests: raise ActionRejected('REQUEST_CONFLICT') + if operation_id!=h.operation_id or h.phase!='running': raise ActionRejected('NOT_RUNNING') + result=self.invoke(instance_id=h.instance_id,capability_id='acquisition.stop',arguments={},request_id=request_id) + if result['status']=='succeeded': h._cancel_operations[key]=operation_id + return result + +EFFECTS={ + 'plant.configure':['plant.configured','thermal.target_k'], + 'geometry.configure':['geometry.configured'], + 'thermal.configure':['thermal.configured','truth.bath_k','truth.sample_k','thermal.indicated_k'], + 'sample.load':['sample.present','truth.sample_mass_kg','truth.dc_conductivity_s_m','truth.sample_k','thermal.indicated_k'], + 'sample.remove':['sample.present','truth.sample_mass_kg','truth.dc_conductivity_s_m'], + 'sample.set_clamp':['clamp.target_m','clamp.moving'], + 'power.set':['power.enabled','power.angle_rad','thermal.enabled','thermal.indicated_k','excitation.frequency_hz','excitation.source_voltage_rms_v','measured.voltage_rms_v','measured.current_rms_a','acquisition.phase'], + 'thermal.set_temperature':['thermal.target_k','thermal.enabled'],'thermal.disable':['thermal.enabled'], + 'fixture.select_load':['fixture.load_mode'], + 'calibration.apply':['calibration.configured'],'calibration.clear':['calibration.configured'], + 'acquisition.start':['acquisition.phase','acquisition.elapsed_s','acquisition.expected_duration_s','acquisition.points','excitation.frequency_hz','excitation.source_voltage_rms_v','measured.voltage_rms_v','measured.current_rms_a'], + 'acquisition.stop':['acquisition.phase','excitation.frequency_hz','excitation.source_voltage_rms_v','measured.voltage_rms_v','measured.current_rms_a'], + 'sim.step':list(SLOTS)} +for k,v in EFFECTS.items():CAPS[k]['effects']=v +ERRORS=sorted(set(__import__('re').findall(r"ActionRejected\('([A-Z_0-9]+)'",Path(__file__).read_text()))|{'POWER_OFF','USER_CANCEL','CURRENT_CONVERTER_OVERFLOW','REFERENCE_TEMPERATURE_RANGE'}) + +def export_novocontrol_alphat_contract_metadata(): + slots={};caps={} + for k,v in SLOTS.items():slots[k]=dict(meaning_zh=v['meaning'],component_ids=[v['component']],value_schema=copy.deepcopy(v['schema']),unit=v['unit'],reference_conditions='SI; RMS phasors with exp(+j*omega*t),epsilon*=epsilon_real-j*epsilon_loss,Y=j*omega*C0*epsilon. Alpha-T RevC,current converter40mA;50ohmsource.',origin=v['origin'],visibility=v['visibility'],access='read_only',read_binding=dict(backend='host',artifact_id='runtime',accessor=f'NovocontrolAlphatSession.read(state_ids=[{k!r}])'),write_via=None,sampling=dict(mode='instant',time_domain='simulation',window_description='Host clock only; displayed phasor is an explicitly assumed first-order demodulator endpoint estimate after actual frequency dwell, not an instantaneous AC waveform sample.'),source_ids=['simulation_assumption']) + limits=[ + 'Alpha-T RevC含电流转换接口;范围3µHz至40MHz。10MHz以下0至3Vrms,原表below/above边界未明,恰好10MHz本模型保守限制1Vrms并与高频同处理。源输出阻抗固定50Ω。', + '未选OptionF时每点等待settling+max(cycles/f,1/10.5)s;3µHz一周期至少333333.333s,不能瞬时出谱。600点/s、OptionB直流偏置和高压选件unsupported。', + '电流转换器物理电流超过40mA即观测不可用、完成当前点时采集失败切断源;不把测量量程伪装成源电流限流。样品端RMS电压由50Ω分压与寄生网络决定,并非始终等于源幅度。', + '模板提供真实文献编纂静态介电常数/温度,curves为空。Debye高频极限、松弛τ、σdc均由宿主显式假设,生成曲线为synthetic,不冒充67种真实宽频实测谱。', + '默认water静态ε80.1@293.2K;ε∞4.9、τ1e-11s、σdc5e-6S/m、ρ1000kg/m³和Cp4180J/kg/K仅工程水近似,库内未知字段仍null。改变τ用于教学弛豫峰不能写成物质实验结果。', + 'Debye关系epsilon*=epsilon_inf+(epsilon_s-epsilon_inf)/(1+j*omega*tau)-j*sigma_dc/(omega*eps0);C0=eps0*A/d。复电导定义sigma*=j*omega*eps0*epsilon,实部包含介电损耗与直流导电;不能与宿主sigma_dc混称。', + '工程平板D20mm厚1mm的绝缘液池/固体垫片实例,电极下方为generator高电位、上方为current-converter虚地。geometry.configure影响过程几何,静态3D示例不自动缩放。装样后禁止改几何以免质量体积生灭。', + '本批工程夹具用串联R/L、并联C/G寄生网络;已知BDS1200上限10MHz、ZGS只适配Alpha-A,不把两者拼成Alpha-T原厂40MHz夹具。Analyzer BNC端范围不能自动等同样品端精度。', + '外部open/short/已知纯电阻load经实际相同网络和两个复增益通道测量,solve由三个外部观测解Möbius逆,再apply逐频点记录;不读隐藏寄生/增益,不跨未校准频率插值。fixture.select_load只是宿主接线代理,不声称自动校准机械。', + '所有电压电流为RMS复相量,P=Re(V*conj(I))不含1/2。样品耗散进入样品热节点,50Ω源/寄生/参考负载耗散导出外部环境,分别留账。', + '采用稳态周期平均有功功率及工程一阶解调估计,未求解交流逐周期波形、电磁起停暂态或电场/极化储能。能量验证限于周期平均有功与热账,不宣称瞬态总电磁能量认证。', + '明确选择宿主外部工程有限热容边界;温区、功率、热导由thermal.configure输入,未指定Novotherm/Quatro等原厂温控系统。温度超静态参考容差时测量失败,但现有显热仍继续交换。', + '样品温度在宿主参考容差内时epsilon_s/epsilon_inf/tau/sigma_dc作为常系数近似,不宣称温度谱插值。样品热节点包含固定0.1J/K夹具/电极工程热容,非OEM参数。', + '整片/定容样品几何确定体积,密度/Cp为宿主显式假设,载入/移出显热完整记账。开夹时样品脱离热台转与环境换热,未求解深度接触、压力或溶剂挥发。', + '厂家误差强依赖频率/阻抗/校准和环境,不能把条件精度套全域;这里的增益/相位/分辨率/τ是输入假设,真实噪声和准确度认证not_run。', + '主机有蓝色双行字符LCD,几何只保留静态外观/身份文字;动态LCD未实现,READOUTS为空不等于没有显示屏。', + '所有session公开result/poll统一脱敏,包括内部evaluator桥接;选中静态参考来源只在evaluator provenance.read。共享Python与磁盘不等于OS级真值隔离。', + '真实硬件、机器人装样、OEM夹具/温控校准、直流偏置、高压、安全联锁与电磁暂态not_run。'] + for k,v in CAPS.items(): + un=k in UNSUPPORTED;async_=k=='acquisition.start';caps[k]={key:copy.deepcopy(v[key]) for key in ['input_schema','output_schema','component_ids','function_zh','kind','visibility','example_arguments']} + caps[k].update(availability='unsupported' if un else 'implemented',implementation={layer:'absent' if un or layer in ('scene','robot','hardware') else 'implemented' for layer in ['process','scene','robot','hardware','host']},binding=None if un else dict(backend='host',artifact_id='runtime',entrypoint='asset_runtime.novocontrol_alphat.NovocontrolAlphatSession.invoke',invocation=f'session.invoke(instance_id="alphat_01",capability_id={k!r},arguments={v["example_arguments"]!r},request_id="unique")'),preconditions=[] if un or v['kind'] in ('query','analysis') else [dict(description_zh='明确夹具/热边界、夹持、静态参考温域、频率/电压/校准网格由运行入口原子检查。',state_ids=['power.enabled','sample.present','clamp.position_m','thermal.configured','acquisition.phase'],enforced_by='runtime',check='NovocontrolAlphatRuntime.invoke guards before commit')],state_effects=[dict(state_id=s,timing='immediate',description_zh='命令实际即时状态变化') for s in v['effects']],observes=[],model_effects=dict(mode='none',description_zh='只输出可映射状态,实际模型求值由独立场景报告登记。',binding_ids=[]),execution=dict(mode='asynchronous' if async_ else 'synchronous',time_domain='simulation',completion_criterion='每个频点累计指定真实周期和通信时间后采样,所有频点完成或实际范围错误终止' if async_ else '原子命令;电热/运动/频扫驻留仅宿主step推进',completion_state_ids=['acquisition.phase'] if async_ else [],timeout_s=None,cancellation='supported' if async_ else 'unsupported',retry='same_request_id',resources=['host_clock','parallel_plate_fixture','source','current_converter'],partial_failure_zh='取消/断电切断源并冻结已完成频点,未完成点不输出;已积耗散热和显热不回滚。范围错误完成当前频点时记不可用并停止。'),errors=[dict(code=e,meaning_zh=e,side_effects='partial' if async_ and e in ('POWER_OFF','USER_CANCEL','CURRENT_CONVERTER_OVERFLOW','MEASUREMENT_RANGE') else 'none') for e in ERRORS],verification=[],limitations=limits,source_ids=['manufacturer_primary','simulation_assumption','template_library']) + if k in ('thermal.set_temperature','thermal.disable','sample.set_clamp','acquisition.start','power.set'): + caps[k]['state_effects'] += [dict(state_id=s,timing='on_step',description_zh='宿主推进热过程、夹持或实际频扫') for s in SLOTS if s not in v['effects'] and s not in ('plant.configured','geometry.configured','thermal.configured','sample.present','power.enabled')] + mechanism=dict(component_ids=['controller','current_converter','electrode_upper','electrode_lower','sample_disc','thermal_port'],state_ids=list(slots),meaning_zh='带50Ω源和夹具寄生的复介电相量网络,有限扫频时间、外部OSL校准、有限热容与有功热守恒',implementation='lumped',equations=[ + 'epsilon*=epsilon_inf+(epsilon_s-epsilon_inf)/(1+j*omega*tau)-j*sigma_dc/(omega*eps0); Ysample=j*omega*C0*epsilon*,C0=eps0*pi*(D/2)^2/d. Static epsilon_s is source data; all dynamic parameters are explicit assumptions.', + 'Yparallel=Ysample+Gparasitic+j*omega*Cparasitic; Zfixture=Rseries+j*omega*Lseries+1/Yparallel; I=Vs/(50ohm+Zfixture),Vfixture=I*Zfixture. External open/short/load changes the sample admittance branch only.', + 'Measured RMS channels follow explicit complex gains and first-order demodulator response, with independently declared engineering quantization. Physical converter current>40mA returns unavailable, not clipped current.', + 'OSL inverse Zcorrected=(a*Zmeasured+b)/(c*Zmeasured+1), c=-1/Zopen, a=Rload*(1-Zload/Zopen)/(Zload-Zshort),b=-a*Zshort; coefficients are computed solely from supplied external observed standards.', + 'Z=V/I; epsilon=1/(Z*j*omega*C0); tan_delta=epsilon_loss/epsilon_real; sigma_real=omega*eps0*epsilon_loss and sigma_imag=omega*eps0*epsilon_real. Sample observation limits enforce C1e-15..10F and |Z|.01..2e14ohm.', + 'Each point dwell=settling+max(cycles/f,1/10.5)s, rounded upward to nanosecond. A fractional-nanosecond residual retains normal60Hz host clock accuracy. Filter and circuit clocks never advance on read/invoke configuration.', + 'Pgenerator=Re(Vs*conj(I)); Psource=|I|²*50; Pseries=|I|²*Rseries; Pshunt=|Vparallel|²*Gparasitic; Psample=|Vparallel|²*Re(Ysample). Pgenerator=Psource+Pseries+Pshunt+Psample+Preference with RMS convention.', + 'Cb*dTb=Pcontroller-Gb*(Tb-Ts)-Ga*(Tb-Ta); Cs*dTs=Gb*(Tb-Ts)-Gopen*(Ts-Ta)+Psample. Closed fixture:Gb>0,Gopen=0;open:Gb=0,Gopen>0. External controller has explicit heating/cooling limits.', + 'Matrix exponential propagates linear thermal/energy states; Radau solves the same equations if power saturation is possible. Complex demodulator state has exact exp(-dt/tau) propagation. Sample loading capacity-weights incoming sensible heat; removing exports actual sensible heat.', + 'Electrical ledger is steady cycle-averaged active energy, excluding unmodeled turn-on/off electromagnetic stored energy and transients.'],parameters={},source_ids=['simulation_assumption','template_library'],limitations=limits) + spec=importlib.util.spec_from_file_location('_alpha_local_annotations',ROOT/'scripts/asset_runtime/_annotations.py');ann=importlib.util.module_from_spec(spec);spec.loader.exec_module(ann);ann.KEY_ZH.update({k:v['meaning'] for k,v in SLOTS.items()});ann.annotate_export(SLUG,caps,slots,{'dielectric_spectroscopy':mechanism},inputs={'plant.configure':(PLANT,PLANT_EXAMPLE),'geometry.configure':(GEOMETRY,GEOMETRY_EXAMPLE),'thermal.configure':(THERMAL,THERMAL_EXAMPLE),'sample.load':(SAMPLE,SAMPLE_EXAMPLE),'method.configure':(METHOD,METHOD_EXAMPLE)}) + for key,value in SLOTS.items():slots[key]['meaning_zh']=value['meaning'] + return dict(asset_type_id=ASSET_TYPE_ID,catalog_id=CATALOG_ID,capabilities=caps,state_slots=slots,mechanisms={'dielectric_spectroscopy':mechanism}) diff --git a/scripts/asset_runtime/shimadzu_ags10knxd.py b/scripts/asset_runtime/shimadzu_ags10knxd.py new file mode 100644 index 0000000000000000000000000000000000000000..f4458e34dda5c3405a7c428118a1ac2c3b98c408 --- /dev/null +++ b/scripts/asset_runtime/shimadzu_ags10knxd.py @@ -0,0 +1,494 @@ +"""AGS-10kNXD / high-precision10kNcell / real5kNSCG / TRAPEZIUM X. +One-dimensional tensile elastoplastic proxy with separate frame compliance, +clip-extensometer observations, fixed-rate sampling/control and irreversible +plastic/fracture energy. No universal-test-mode or OEM accuracy certification. +""" +from __future__ import annotations +import copy,importlib.util,json,math +from pathlib import Path +import numpy as np +PROTOCOL_VERSION='1.0.0';SLUG='shimadzu_ags10knxd';ASSET_TYPE_ID='instrument.'+SLUG;CATALOG_ID='CHEM-144' +ROOT=Path(__file__).resolve().parents[2];ASSET=ROOT/'assets/expansion_batch04/t1_thermal'/SLUG;LIBRARY_PATH=ASSET/'mechanical_library.json' +LOAD_CELL_MAX_N=10000.;FIXTURE_MAX_N=5000.;MIN_SPEED_M_S=.001e-3/60;MAX_SPEED_M_S=1000e-3/60;POSITION_RESOLUTION_M=1e-6;CONTROL_PERIOD_NS=10_000_000 +class ActionRejected(ValueError):pass + +def number(unit='1',lo=None,hi=None): + s={'type':'number','x-unit':unit} + if lo is not None:s['minimum']=lo + if hi is not None:s['maximum']=hi + return s + +def obj(properties):return dict(type='object',properties=properties,required=list(properties),additionalProperties=False) +def nullable(s):return {'anyOf':[s,{'type':'null'}]} +def array(s,minimum=0,maximum=200001):return dict(type='array',items=s,minItems=minimum,maxItems=maximum) +def enum(items):return {'type':'string','enum':items} +BOOL={'type':'boolean'};TEXT={'type':'string'};PHASE=enum(['idle','running','succeeded','cancelled','failed']) + +def validate(s,v): + if 'anyOf' in s: + for o in s['anyOf']: + try:validate(o,v);return + except ActionRejected:pass + raise ActionRejected('INVALID_ARGUMENT') + k=s.get('type') + if k in ('number','integer'): + if isinstance(v,bool) or not isinstance(v,(int,float)) or not math.isfinite(v) or k=='integer' and type(v) is not int or not s.get('minimum',-math.inf)<=v<=s.get('maximum',math.inf):raise ActionRejected('INVALID_ARGUMENT') + elif k=='object': + if not isinstance(v,dict) or set(v)!=set(s['properties']):raise ActionRejected('INVALID_ARGUMENT') + for key,value in v.items():validate(s['properties'][key],value) + elif k=='array': + if not isinstance(v,list) or not s.get('minItems',0)<=len(v)<=s.get('maxItems',math.inf):raise ActionRejected('INVALID_ARGUMENT') + for x in v:validate(s['items'],x) + elif k=='boolean' and type(v) is not bool:raise ActionRejected('INVALID_ARGUMENT') + elif k=='string' and not isinstance(v,str):raise ActionRejected('INVALID_ARGUMENT') + elif k=='null' and v is not None:raise ActionRejected('INVALID_ARGUMENT') + if 'enum' in s and v not in s['enum']:raise ActionRejected('INVALID_ARGUMENT') + + +def library():return {x['id']:x for x in json.loads(LIBRARY_PATH.read_text())['templates']} +def quant(x,res):return float(round(x/res)*res) +PLANT_EXAMPLE=dict(ambient_k=292.65,frame_stiffness_n_m=1e8,force_gain=1.002,force_offset_n=.02,force_response_tau_s=.002,force_resolution_n=.01,extensometer_gain=1.,extensometer_offset_m=0.,extensometer_resolution_m=1e-7,local_thermal_capacity_j_k=.01,sample_conductance_w_k=.1,plastic_heat_fraction=.9,fracture_heat_fraction=.5,grip_speed_m_s=.01,force_control_gain_m_per_n_s=5e-7,strain_control_gain_m_s=.01,accept_engineering=True) +PLANT=obj(dict(ambient_k=number('K',278.15,313.15),frame_stiffness_n_m=number('N/m',1e7,1e12),force_gain=number('1',.01,100),force_offset_n=number('N',-100,100),force_response_tau_s=number('s',1e-6,10),force_resolution_n=number('N',1e-9,100),extensometer_gain=number('1',.01,100),extensometer_offset_m=number('m',-.001,.001),extensometer_resolution_m=number('m',1e-12,.001),local_thermal_capacity_j_k=number('J/K',1e-6,1e5),sample_conductance_w_k=number('W/K',1e-9,1e5),plastic_heat_fraction=number('1',0,1),fracture_heat_fraction=number('1',0,1),grip_speed_m_s=number('m/s',1e-6,.1),force_control_gain_m_per_n_s=number('m/(N*s)',1e-12,1),strain_control_gain_m_s=number('m/s',1e-9,1),accept_engineering=BOOL)) +FIXTURE_EXAMPLE=dict(rated_force_n=5000.,software_trapezium_x=True,extensometer_enabled=True,extensometer_gauge_m=.025,accept_engineering_extensometer=True) +FIXTURE=obj(dict(rated_force_n={'type':'number','const':5000.,'enum':[5000.],'x-unit':'N'},software_trapezium_x=BOOL,extensometer_enabled=BOOL,extensometer_gauge_m=number('m',.001,.25),accept_engineering_extensometer=BOOL)) +SAMPLE_EXAMPLE=dict(reference_id='epfl_s355_j2m_hem320_web',gauge_length_m=.025,initial_area_m2=2e-6,volume_m3=1.1e-7,density_kg_m3=7850.,specific_heat_capacity_j_kg_k=470.,initial_temperature_k=292.65,temperature_tolerance_k=10.,host_elastic_modulus_pa=None,host_yield_strength_pa=None,hardening_modulus_pa=1e9,engineering_strain_at_break=.05,accept_bilinear_geometry_temperature_fracture_assumptions=True) +SAMPLE=obj(dict(reference_id=TEXT,gauge_length_m=number('m',.001,.2),initial_area_m2=number('m^2',1e-10,1e-3),volume_m3=number('m^3',1e-12,.01),density_kg_m3=number('kg/m^3',1,5e4),specific_heat_capacity_j_kg_k=number('J/(kg*K)',1,1e5),initial_temperature_k=number('K',200,500),temperature_tolerance_k=number('K',0,100),host_elastic_modulus_pa=nullable(number('Pa',1e3,1e13)),host_yield_strength_pa=nullable(number('Pa',1,1e11)),hardening_modulus_pa=number('Pa',0,1e12),engineering_strain_at_break=number('1',1e-6,.5),accept_bilinear_geometry_temperature_fracture_assumptions=BOOL)) +METHOD_EXAMPLE=dict(mode='speed',speed_m_s=.0005,target_crosshead_m=.003,target_force_n=400.,target_strain=.01,sample_rate_hz=1000,duration_s=10.,force_stop_n=5000.,stop_on_break=True) +METHOD=obj(dict(mode=enum(['speed','force','strain']),speed_m_s=number('m/s',MIN_SPEED_M_S,MAX_SPEED_M_S),target_crosshead_m=number('m',0,.3),target_force_n=number('N',0,10000),target_strain=number('1',0,.5),sample_rate_hz={'type':'integer','enum':[1,10,50,100,200,500,1000],'x-unit':'Hz'},duration_s=number('s',.001,3600),force_stop_n=number('N',1,10000),stop_on_break=BOOL)) +ROW=obj(dict(point_index={'type':'integer','x-unit':'1'},time_s=number('s'),kind=enum(['sample','fracture_pre','fracture_post']),force_n=nullable(number('N')),crosshead_m=number('m'),extensometer_extension_m=nullable(number('m')),broken=BOOL,quality=enum(['estimated','below_documented_accuracy_range','overload','temperature_invalid']))) +ANALYSIS=obj(dict(rows=array(ROW,3),area_prior_m2=nullable(number('m^2',1e-12,1)),gauge_prior_m=nullable(number('m',1e-9,1)),frame_compliance_prior_m_n=nullable(number('m/N',0,1)),elastic_fit_min_strain=number('1',0,.5),elastic_fit_max_strain=number('1',0,.5))) +ANALYSIS_OUTPUT=obj(dict(points=array(obj(dict(time_s=number('s'),stress_pa=nullable(number('Pa')),strain=nullable(number('1'))))),elastic_modulus_pa=nullable(number('Pa')),ultimate_observed_stress_pa=nullable(number('Pa')),maximum_observed_force_n=number('N'),observed_break_strain=nullable(number('1')),observed_break_extension_m=nullable(number('m')),evidence=TEXT)) +RESULT=obj(dict(operation_id=nullable(TEXT),phase=PHASE,mode=TEXT,elapsed_s=number('s'),rows=array(ROW),terminal_reason=nullable(TEXT),template_source=nullable(TEXT),evidence=TEXT)) +LEDGER_KEYS=['loaded_mass_kg','removed_mass_kg','mass_kg','mass_residual_kg','loaded_volume_m3','removed_volume_m3','volume_m3','volume_residual_m3','actuator_work_j','plastic_work_j','plastic_heat_j','plastic_defect_stored_j','frame_elastic_j','sample_elastic_j','hardening_stored_j','fracture_surface_j','fracture_heat_j','machine_damping_export_j','sensible_loaded_j','sensible_removed_j','internal_removed_j','sample_thermal_j','heat_export_j','energy_residual_j'] +LEDGER=obj({k:number('kg' if k.endswith('_kg') else 'm^3' if k.endswith('_m3') else 'J') for k in LEDGER_KEYS}) +CAPS={} +def cap(k,s,o,example,component,meaning,visibility='agent',kind='device_command'):CAPS[k]=dict(input_schema=s,output_schema=o,example_arguments=example,component_ids=[component],function_zh=meaning,visibility=visibility,kind=kind,effects=[]) +for k,s,e,component in [('plant.configure',PLANT,PLANT_EXAMPLE,'crosshead'),('fixture.configure',FIXTURE,FIXTURE_EXAMPLE,'upper_grip'),('method.configure',METHOD,METHOD_EXAMPLE,'controller')]:cap(k,s,obj(dict(configured=BOOL)),e,component,'配置过程/夹具/软件或试验程序;不推进时间','evaluator' if k in ('plant.configure','fixture.configure') else 'agent','configuration') +cap('sample.load',SAMPLE,obj(dict(present=BOOL)),SAMPLE_EXAMPLE,'specimen_lower','载入真实材料参考与显式均匀拉伸/断裂/热参数','evaluator') +cap('sample.remove',obj({}),obj(dict(removed_mass_kg=number('kg'),removed_volume_m3=number('m^3'))),{},'specimen_lower','取出全部试样/碎片与塑性库存、当前显热','evaluator') +cap('power.set',obj(dict(enabled=BOOL)),obj(dict(enabled=BOOL)),dict(enabled=True),'power_switch','启停控制器;停止驱动不清除塑性、断裂或储能') +cap('grip.set_closed',obj(dict(which=enum(['upper','lower']),closed=BOOL)),obj(dict(target_opening_m=number('m'))),dict(which='upper',closed=True),'upper_jaw','手工SCG夹紧/松开有限运动代理,非夹压力实测','evaluator') +CAPS['grip.set_closed']['component_ids'].append('lower_jaw') +cap('crosshead.move_to',obj(dict(position_m=number('m',0,.3),speed_m_s=number('m/s',MIN_SPEED_M_S,MAX_SPEED_M_S))),obj(dict(target_m=number('m'))),dict(position_m=.001,speed_m_s=.0005),'crosshead','设置有限速横梁目标;带样会真实加载,含独立5kN夹具限值') +cap('emergency.engage',obj({}),obj(dict(engaged=BOOL)),{},'emergency_stop','停止有限驱动并保留机械/热状态,不宣称硬件安全认证') +cap('emergency.reset',obj({}),obj(dict(engaged=BOOL)),{},'emergency_stop','宿主手动释放急停;不自动继续试验','evaluator') +cap('force.zero',obj({}),obj(dict(zero_n=number('N'))),{},'load_cell','卸载条件下以当前实际传感器观测置零') +cap('force.calibrate',obj(dict(reference_force_n=number('N',20,10000))),obj(dict(gain=number('1'))),dict(reference_force_n=100.),'load_cell','由外部已知载荷与实际观测拟合增益,不读取隐藏gain') +cap('acquisition.start',obj({}),obj(dict(operation_id=TEXT)),{},'controller','按独立采样/控制时钟运行有限拉伸,记录实际力位移与引伸计') +cap('acquisition.stop',obj({}),obj(dict(phase=PHASE,elapsed_s=number('s'))),{},'controller','停止横梁与采样,保留塑性应变、破断和已产生热量') +cap('acquisition.result',obj({}),RESULT,{},'controller','冻结完成记录,公开结果所有角色隐藏选中材料身份','agent','query') +cap('analysis.tensile',ANALYSIS,ANALYSIS_OUTPUT,dict(rows=[],area_prior_m2=2e-6,gauge_prior_m=.025,frame_compliance_prior_m_n=None,elastic_fit_min_strain=.0002,elastic_fit_max_strain=.0015),'controller','由外部观测及独立面积/标距先验分析应力应变与模量','agent','analysis') +cap('provenance.read',obj({}),obj(dict(current_sample=nullable(TEXT),operation_source=nullable(TEXT))),{},'controller','独立受限当前/记录来源','evaluator','query') +cap('ledger.read',obj({}),LEDGER,{},'controller','受限质量体积、弹性/塑性/破断与热能账','evaluator','query') +cap('sim.step',obj(dict(dt_s=number('s',0,86400))),obj(dict(time_s=number('s'))),dict(dt_s=.02),'controller','唯一宿主时钟','evaluator','simulation') +UNSUPPORTED={'hardware.connect':'没有真实仪器驱动','robot.load':'没有机器人装样','measurement.compression':'本SCG平条一维拉伸子集不实现压缩','measurement.bending':'未配弯曲夹具','measurement.peel':'未配剥离夹具','thermal.set_temperature':'未选温控附件,样品仅被动换热和耗散发热','noise.empirical':'没有实测noise模型,±0.5%不是随机分布','accuracy.certification':'没有OEM/ISO/ASTM计量认证','analysis.strain_without_prior_or_extensometer':'横梁位移不能无条件替代试样应变'} +for k,v in UNSUPPORTED.items():cap(k,obj({}),obj({}),{},'controller',v) +SLOTS={} +def slot(k,s,u,o,c,meaning,vis='agent'):SLOTS[k]=dict(schema=s,unit=u,origin=o,component=c,meaning=meaning,visibility=vis,write=None) +slot('fixture.extensometer_enabled',BOOL,'1','setpoint','extensometer','已配置工程引伸计硬件存在标志,不随断电隐去') +slot('clock.time_s',number('s'),'s','derived','controller','统一宿主时间,只由step推进') +for k in ['plant.configured','fixture.configured','method.configured','sample.present','sample.broken','power.enabled','emergency.engaged']:slot(k,BOOL,'1','derived' if k=='sample.broken' else 'setpoint','controller','配置/存在/不可逆破断/启用状态,不等于全部硬件验证') +for k in ['crosshead.position_m','crosshead.target_m']:slot(k,number('m'),'m','scene' if 'position' in k else 'setpoint','crosshead','横梁绝对参考增量,+Z拉伸;不是试样单独伸长') +slot('crosshead.indicated_m',nullable(number('m')),'m','sensor','controller','横梁光编码器显示代理,1µm分辨,不声称±.01mm位置准确度已验证') +slot('frame.deflection_m',number('m'),'m','scene','compliance_carriage','串联机架/夹具工程顺应位移F/K,upper夹持点位移=横梁−该值') +for side in ['upper','lower']: + slot('grip.'+side+'_opening_m',number('m'),'m','scene',side+'_jaw','单侧jaw开口增量,0夹紧/.006m打开;手工有限运动代理') + slot('grip.target_'+side+'_opening_m',number('m'),'m','setpoint',side+'_jaw','夹具单侧开口目标,只在step运动') +slot('sample.visual_extension_m',number('m'),'m','scene','specimen_lower','未断样品实体伸长;断后两片残余塑性总长度增量,非连续体有限元网格') +slot('sample.fracture_gap_m',number('m'),'m','scene','specimen_upper','断后夹点分离扣除残余材料长度的裂口,断前0') +slot('power.angle_rad',number('rad'),'rad','scene','power_switch','电源开关显示姿态代理') +slot('emergency.position_m',number('m'),'m','scene','emergency_stop','急停手动闩锁显示位置,0或.004m,不冒安全认证') +slot('force.indicated_n',nullable(number('N')),'N','sensor','load_cell','含工程传感器响应/量化/校准的拉力读数,20N以下不承诺厂家高精度') +slot('extensometer.extension_m',nullable(number('m')),'m','sensor','extensometer','独立工程夹持引伸计观测伸长;未配则null,非横梁改名') +slot('extensometer.strain',nullable(number('1')),'1','derived','extensometer','独立引伸计伸长除其明确配置标距') +slot('thermal.sample_k',nullable(number('K')),'K','sensor','specimen_lower','试样和宿主局部节点被动温度,85kg整机不代入热容') +for k in ['calibration.force_gain','calibration.force_zero_n']:slot(k,number('N' if k.endswith('_n') else '1'),'N' if k.endswith('_n') else '1','derived','load_cell','从当前外部观测与已知载荷获得的校正') +slot('acquisition.phase',PHASE,'1','derived','controller','异步采集状态') +slot('acquisition.elapsed_s',number('s'),'s','derived','controller','试验实际耗时') +slot('acquisition.points',{'type':'integer','x-unit':'1'},'1','derived','controller','实际采样与明确破断事件行数') +for k,u in [('truth.force_n','N'),('truth.plastic_strain','1'),('truth.total_strain','1'),('truth.mass_kg','kg'),('truth.sample_k','K')]:slot(k,number(u),u,'process_truth','specimen_lower','受限一维本构过程真值','evaluator') + +# Exact constitutive / scene drive coordinates are host-only. Public strain +# must come from the configured observable extensometer or independent priors. +for _private_drive in ['frame.deflection_m','sample.visual_extension_m','sample.fracture_gap_m']: + SLOTS[_private_drive]['visibility']='evaluator' + +def analyze_tensile(rows,area_prior_m2,gauge_prior_m,frame_compliance_prior_m_n,elastic_fit_min_strain,elastic_fit_max_strain): + if len(rows)<3 or any(x['force_n'] is None for x in rows) or elastic_fit_max_strain<=elastic_fit_min_strain:raise ActionRejected('INVALID_OBSERVATIONS') + points=[];fit=[];break_e=None;break_x=None + for row in rows: + F=row['force_n'];stress=None if area_prior_m2 is None else F/area_prior_m2;extension=row['extensometer_extension_m'] + if extension is None and frame_compliance_prior_m_n is not None and not row['broken']:extension=row['crosshead_m']-F*frame_compliance_prior_m_n + strain=None if gauge_prior_m is None or extension is None else extension/gauge_prior_m + points.append(dict(time_s=row['time_s'],stress_pa=stress,strain=strain)) + if stress is not None and strain is not None and elastic_fit_min_strain<=strain<=elastic_fit_max_strain and not row['broken']:fit.append((strain,stress)) + if row['kind']=='fracture_pre':break_e=strain;break_x=extension + modulus=None + if len(fit)>=3 and np.ptp(np.array(fit)[:,0])>1e-12:modulus=float(np.polyfit(np.array(fit)[:,0],np.array(fit)[:,1],1)[0]) + return dict(points=points,elastic_modulus_pa=modulus,ultimate_observed_stress_pa=None if area_prior_m2 is None else max(x['force_n'] for x in rows)/area_prior_m2,maximum_observed_force_n=max(x['force_n'] for x in rows),observed_break_strain=break_e,observed_break_extension_m=break_x,evidence='external_force_and_extensometer_or_explicit_frame_compliance_correction; independent_area_gauge_priors; maximum_observed_stress_is_not_certified_material_UTS; fracture_pre_is_event_observation_not_hidden_breakstrain') + +class ShimadzuAgs10knxdRuntime: + def __init__(self,instance_id='ags_01'): + self.instance_id=instance_id;self.time_ns=0;self._clock_remainder_ns=0.;self.revision=0;self.power=False;self.emergency=False;self.plant=None;self.fixture=None;self.method=None;self.sample=None;self.reference=None;self.source=None + self.axes={k:dict(position=v,target=v,start=v,start_ns=0,arrival_ns=0) for k,v in [('crosshead',0.),('upper',.006),('lower',.006)]};self.drive_speed=MIN_SPEED_M_S;self.force=0.;self.plastic=0.;self.broken=False;self.defect_stored=0.;self.fracture_surface=0.;self.temperature=292.65;self.sensor_force=0.;self.force_gain=1.;self.force_zero=0.;self.last_stop_reason=None + self.phase='idle';self.operation_id=None;self.mode='none';self.elapsed=0.;self.rows=[];self.terminal_reason=None;self._counter=0;self._operation_source=None;self.records={};self._principals={};self._requests={};self._owners={};self._cancel_operations={};self._sample_ns=None;self._control_ns=None + self.book={k:0. for k in ['loaded_mass_kg','removed_mass_kg','loaded_volume_m3','removed_volume_m3','actuator_work_j','plastic_work_j','plastic_heat_j','fracture_heat_j','machine_damping_export_j','sensible_loaded_j','sensible_removed_j','internal_removed_j','heat_export_j']} + @property + def time_s(self):return self.time_ns/1e9 + def register_principal(self,name,visibility): + if not isinstance(name,str) or not name or visibility not in ('agent','evaluator','debug') or name in self._principals:raise ActionRejected('INVALID_ARGUMENT') + self._principals[name]=visibility + def session(self,name): + if name not in self._principals:raise ActionRejected('ACCESS_DENIED') + return ShimadzuAgs10knxdSession(self,name) + def _pos(self,k):return self.axes[k]['position'] + def _moving(self,k):return self.time_ns=a['arrival_ns'] else a['start']+(a['target']-a['start'])*(self.time_ns-a['start_ns'])/(a['arrival_ns']-a['start_ns']) + def _held(self):return self.sample is not None and all(self._pos(k)<1e-12 and not self._moving(k) for k in ['upper','lower']) + def _mass(self):return self.sample['volume_m3']*self.sample['density_kg_m3'] if self.sample else 0. + def _capacity(self):return self.plant['local_thermal_capacity_j_k']+(self._mass()*self.sample['specific_heat_capacity_j_kg_k'] if self.sample else 0.) + def _free_extension(self):return self.sample['gauge_length_m']*self.plastic if self.sample else 0. + def _strain(self):return self.plastic+(self.force/self.sample['initial_area_m2']/self.E if self.sample and not self.broken else 0.) + def _compliance(self):return self.sample['gauge_length_m']/(self.sample['initial_area_m2']*self.E)+1/self.plant['frame_stiffness_n_m'] + def _solve(self,x): + if not self._held() or self.broken:return 0.,self.plastic + L=self.sample['gauge_length_m'];A=self.sample['initial_area_m2'];H=self.sample['hardening_modulus_pa'];C=self._compliance();trial=max(0.,(x-L*self.plastic)/C);yield_force=A*(self.Y+H*self.plastic) + plastic=self.plastic if trial<=yield_force else max(self.plastic,(x-C*A*self.Y)/(L+C*A*H));return max(0.,(x-L*plastic)/C),plastic + def _stored(self,F=None,plastic=None): + F=self.force if F is None else F;plastic=self.plastic if plastic is None else plastic + frame=.5*F*F/self.plant['frame_stiffness_n_m'] if self.plant else 0.;elastic=hardening=0. + if self.sample: + V=self.sample['initial_area_m2']*self.sample['gauge_length_m'];elastic=.5*(F/self.sample['initial_area_m2'])**2/self.E*V;hardening=.5*self.sample['hardening_modulus_pa']*plastic*plastic*V + return frame,elastic,hardening + def _temperature_valid(self): + if not self.sample:return True + nominal=self.reference.get('reference_temperature_K');domain=self.reference.get('valid_temperature_range_K');tol=self.sample['temperature_tolerance_k'] + if nominal is not None and abs(self.temperature-nominal)>tol+1e-9:return False + if domain and domain[1]-domain[0]>1e-9 and not domain[0]-1e-9<=self.temperature<=domain[1]+1e-9:return False + return abs(self.temperature-self.sample['initial_temperature_k'])<=tol+1e-9 + def _observed_force(self): + if not self.power:return None + result=quant((self.sensor_force-self.force_zero)*self.force_gain,self.plant['force_resolution_n']) + return result if abs(result)<=LOAD_CELL_MAX_N and self._temperature_valid() else None + def _observed_extension(self): + if not self.power or not self.fixture or not self.fixture['extensometer_enabled'] or not self.sample or self.broken:return None + p=self.plant;return quant(self._strain()*self.fixture['extensometer_gauge_m']*p['extensometer_gain']+p['extensometer_offset_m'],p['extensometer_resolution_m']) + def ledger(self): + d=copy.deepcopy(self.book);mass=self._mass();volume=self.sample['volume_m3'] if self.sample else 0.;frame,elastic,hardening=self._stored();thermal=self._capacity()*(self.temperature-self.plant['ambient_k']) if self.plant else 0.;d.update(mass_kg=mass,mass_residual_kg=d['loaded_mass_kg']-d['removed_mass_kg']-mass,volume_m3=volume,volume_residual_m3=d['loaded_volume_m3']-d['removed_volume_m3']-volume,plastic_defect_stored_j=self.defect_stored,frame_elastic_j=frame,sample_elastic_j=elastic,hardening_stored_j=hardening,fracture_surface_j=self.fracture_surface,sample_thermal_j=thermal) + d['energy_residual_j']=d['actuator_work_j']+d['sensible_loaded_j']-d['sensible_removed_j']-d['internal_removed_j']-d['heat_export_j']-d['machine_damping_export_j']-sum(d[k] for k in ['plastic_defect_stored_j','frame_elastic_j','sample_elastic_j','hardening_stored_j','fracture_surface_j','sample_thermal_j']);return d + def read(self,visibility='agent'): + extension=self._free_extension() if self.broken else self._strain()*self.sample['gauge_length_m'] if self.sample else 0.;frame=self.force/self.plant['frame_stiffness_n_m'] if self.plant else 0.;gap=max(0.,self._pos('crosshead')-extension) if self.sample and self.broken else 0.;ext=self._observed_extension() + d={'clock.time_s':self.time_s,'plant.configured':self.plant is not None,'fixture.configured':self.fixture is not None,'fixture.extensometer_enabled':bool(self.fixture and self.fixture['extensometer_enabled']),'method.configured':self.method is not None,'sample.present':self.sample is not None,'sample.broken':self.broken,'power.enabled':self.power,'emergency.engaged':self.emergency,'crosshead.position_m':self._pos('crosshead'),'crosshead.target_m':self.axes['crosshead']['target'],'crosshead.indicated_m':quant(self._pos('crosshead'),POSITION_RESOLUTION_M) if self.power else None,'frame.deflection_m':frame,'sample.visual_extension_m':extension,'sample.fracture_gap_m':gap,'power.angle_rad':.28 if self.power else 0.,'emergency.position_m':.004 if self.emergency else 0.,'force.indicated_n':self._observed_force(),'extensometer.extension_m':ext,'extensometer.strain':None if ext is None else ext/self.fixture['extensometer_gauge_m'],'thermal.sample_k':self.temperature if self.plant else None,'calibration.force_gain':self.force_gain,'calibration.force_zero_n':self.force_zero,'acquisition.phase':self.phase,'acquisition.elapsed_s':self.elapsed,'acquisition.points':len(self.rows),'truth.force_n':self.force,'truth.plastic_strain':self.plastic,'truth.total_strain':self._strain(),'truth.mass_kg':self._mass(),'truth.sample_k':self.temperature} + for side in ['upper','lower']:d['grip.'+side+'_opening_m']=self._pos(side);d['grip.target_'+side+'_opening_m']=self.axes[side]['target'] + return {k:copy.deepcopy(v) for k,v in d.items() if visibility!='agent' or SLOTS[k]['visibility']=='agent'} + def _propagate(self,ns): + dt=ns/1e9 + if dt<=0 or not self.plant:return + x1=self._pos('crosshead')+self._rate()*dt;F0=self.force;p0=self.plastic;F1,p1=self._solve(x1);before=sum(self._stored(F0,p0));after=sum(self._stored(F1,p1));plasticwork=0. + if self.sample:plasticwork=self.Y*(p1-p0)*self.sample['initial_area_m2']*self.sample['gauge_length_m'] + heat=plasticwork*self.plant['plastic_heat_fraction'];self.book['actuator_work_j']+=after-before+plasticwork;self.book['plastic_work_j']+=plasticwork;self.book['plastic_heat_j']+=heat;self.defect_stored+=plasticwork-heat;self.force=F1;self.plastic=p1 + C=self._capacity();G=self.plant['sample_conductance_w_k'];u0=C*(self.temperature-self.plant['ambient_k']);decay=math.exp(-G*dt/C);u1=u0*decay+(heat/dt)*C/G*(-math.expm1(-G*dt/C));self.temperature=self.plant['ambient_k']+u1/C;self.book['heat_export_j']+=heat-(u1-u0) + gain=self.plant['force_gain'] if self.power else 0.;f0=gain*F0+(self.plant['force_offset_n'] if self.power else 0.);slope=gain*(F1-F0)/dt;tau=self.plant['force_response_tau_s'];self.sensor_force=f0+slope*(dt-tau)+(self.sensor_force-f0+slope*tau)*math.exp(-dt/tau) + def _fracture_position(self): + ep=self.sample['engineering_strain_at_break'];A=self.sample['initial_area_m2'];L=self.sample['gauge_length_m'];H=self.sample['hardening_modulus_pa'];sigma=self.E*(ep-self.plastic) + if sigma>self.Y+H*self.plastic:sigma=self.E*(self.Y+H*ep)/(self.E+H) + return L*ep+A*max(0,sigma)/self.plant['frame_stiffness_n_m'] + def _force_position(self,load): + L=self.sample['gauge_length_m'];A=self.sample['initial_area_m2'];H=self.sample['hardening_modulus_pa'];plastic=self.plastic + if load>A*(self.Y+H*plastic): + if H<=0:return math.inf + plastic=(load/A-self.Y)/H + return self._compliance()*load+L*plastic + def _next_material_event(self): + rate=self._rate();x=self._pos('crosshead') + if rate<=0 or not self._held() or self.broken:return None + A=self.sample['initial_area_m2'];yield_x=self._compliance()*A*(self.Y+self.sample['hardening_modulus_pa']*self.plastic)+self._free_extension();limit=min(FIXTURE_MAX_N,self.method['force_stop_n'] if self.phase=='running' else FIXTURE_MAX_N);positions=[(self._fracture_position(),'fracture'),(self._force_position(limit),'force_limit')] + if yield_x>x+1e-12:positions.append((yield_x,'yield')) + candidates=[] + for target,kind in positions: + if math.isfinite(target) and target>=x-1e-12:candidates.append((self.time_ns+max(1,int(math.ceil((target-x)/rate*1e9-1e-7))),kind)) + return min(candidates) if candidates else None + def _record(self,kind='sample'): + F=self._observed_force();quality='estimated' + if not self._temperature_valid():quality='temperature_invalid' + elif F is None:quality='overload' + elif abs(F)<20:quality='below_documented_accuracy_range' + self.rows.append(dict(point_index=len(self.rows),time_s=self.time_s,kind=kind,force_n=F,crosshead_m=quant(self._pos('crosshead'),POSITION_RESOLUTION_M),extensometer_extension_m=self._observed_extension(),broken=self.broken,quality=quality)) + return F is not None + def _break(self): + if self.broken:return + valid_pre=self._record('fracture_pre') if self.phase=='running' else True + frame,elastic,_=self._stored();heat=elastic*self.plant['fracture_heat_fraction'];self.fracture_surface+=elastic-heat;self.book['fracture_heat_j']+=heat;self.book['machine_damping_export_j']+=frame;self.temperature+=heat/self._capacity();self.force=0.;self.broken=True + if self.phase=='running': + valid_post=self._record('fracture_post') + if not valid_pre or not valid_post:self._finish('failed','REFERENCE_TEMPERATURE_RANGE' if not self._temperature_valid() else 'LOAD_CELL_OVERFLOW') + elif self.method['stop_on_break'] or self.mode!='speed':self._finish('succeeded','fracture') + def _stop_drive(self):self._target('crosshead',self._pos('crosshead'),MIN_SPEED_M_S) + def _finish(self,phase,reason): + self._stop_drive();self.phase=phase;self.terminal_reason=reason;self.last_stop_reason=reason;self._sample_ns=self._control_ns=None + if self.operation_id:self.records[self.operation_id]=dict(operation_id=self.operation_id,phase=phase,mode=self.mode,elapsed_s=self.elapsed,rows=copy.deepcopy(self.rows),terminal_reason=reason,template_source=self._operation_source,evidence='synthetic_forward_model; literature_E_yield_reference_and_explicit_bilinear_hardening_fracture_geometry_thermal_assumptions; actual_external_observations') + def _result(self): + if self.phase!='running' and self.operation_id in self.records:return copy.deepcopy(self.records[self.operation_id]) + return dict(operation_id=self.operation_id,phase=self.phase,mode=self.mode,elapsed_s=self.elapsed,rows=copy.deepcopy(self.rows),terminal_reason=self.terminal_reason,template_source=self._operation_source,evidence='synthetic_forward_model; actual_time_samples_and_explicit_fracture_events; not_original_material_test') + def _control(self): + if self.mode=='speed':return + if self.mode=='force': + observed=self._observed_force() + if observed is None:self._finish('failed','REFERENCE_TEMPERATURE_RANGE' if not self._temperature_valid() else 'LOAD_CELL_OVERFLOW');return + error=self.method['target_force_n']-observed;v=self.plant['force_control_gain_m_per_n_s']*error + else: + ext=self._observed_extension() + if ext is None:self._finish('failed','EXTENSOMETER_UNAVAILABLE');return + error=self.method['target_strain']-ext/self.fixture['extensometer_gauge_m'];v=self.plant['strain_control_gain_m_s']*error + speed=min(abs(v),self.method['speed_m_s']);target=self.method['target_crosshead_m'] if v>0 else self._free_extension() + if speed100:raise ActionRejected('AUTOMATIC_CONTROL_MAX_100HZ') + if not self.fixture['software_trapezium_x'] and (a['sample_rate_hz']>10 or a['mode']!='speed'):raise ActionRejected('SOFTWARE_OPTION_REQUIRED') + if a['mode']=='strain' and not self.fixture['extensometer_enabled']:raise ActionRejected('EXTENSOMETER_REQUIRED') + if a['force_stop_n']>FIXTURE_MAX_N or a['target_force_n']>FIXTURE_MAX_N:raise ActionRejected('FIXTURE_FORCE_LIMIT') + self.method=a;result=dict(configured=True) + elif k=='sample.load': + if not self.plant or not self.fixture:raise ActionRejected('CONFIGURATION_REQUIRED') + if self.sample:raise ActionRejected('SAMPLE_PRESENT') + if any(self._moving(x) for x in self.axes) or self._pos('crosshead')>1e-12 or any(self._pos(x)<.006-1e-12 for x in ['upper','lower']):raise ActionRejected('LOADING_GEOMETRY') + if not a['accept_bilinear_geometry_temperature_fracture_assumptions']:raise ActionRejected('ENGINEERING_ACCEPTANCE_REQUIRED') + ref=library().get(a['reference_id']) + if ref is None:raise ActionRejected('UNKNOWN_REFERENCE') + E=a['host_elastic_modulus_pa'] if a['host_elastic_modulus_pa'] is not None else ref.get('elastic_modulus_Pa');Y=a['host_yield_strength_pa'] if a['host_yield_strength_pa'] is not None else ref.get('yield_strength_Pa') + if E is None or Y is None or E<=0 or Y<=0:raise ActionRejected('MISSING_CONSTITUTIVE_PRIOR') + if a['volume_m3']a['gauge_length_m']+1e-12:raise ActionRejected('EXTENSOMETER_GAUGE_OUTSIDE_SAMPLE') + T=a['initial_temperature_k'];domain=ref.get('valid_temperature_range_K');nominal=ref.get('reference_temperature_K');tol=a['temperature_tolerance_k'] + if nominal is not None and abs(T-nominal)>tol+1e-9 or domain and domain[1]-domain[0]>1e-9 and not domain[0]<=T<=domain[1]:raise ActionRejected('REFERENCE_TEMPERATURE_RANGE') + incoming=a['volume_m3']*a['density_kg_m3']*a['specific_heat_capacity_j_kg_k']*(T-self.plant['ambient_k']);old=self._capacity()*(self.temperature-self.plant['ambient_k']);self.sample=a;self.reference=ref;self.E=float(E);self.Y=float(Y);self.source=json.dumps(dict(reference_id=a['reference_id'],source=ref.get('source'),evidence=ref.get('evidence')),sort_keys=True);self.plastic=0.;self.force=0.;self.broken=False;self.defect_stored=0.;self.fracture_surface=0.;self.temperature=self.plant['ambient_k']+(old+incoming)/self._capacity();self.book['loaded_mass_kg']+=self._mass();self.book['loaded_volume_m3']+=a['volume_m3'];self.book['sensible_loaded_j']+=incoming;result=dict(present=True) + elif k=='sample.remove': + if not self.sample:raise ActionRejected('NO_SAMPLE') + if any(self._moving(x) for x in self.axes) or any(self._pos(x)<.006-1e-12 for x in ['upper','lower']) or abs(self.force)>1e-6:raise ActionRejected('UNLOAD_REQUIRED') + mass=self._mass();volume=self.sample['volume_m3'];self.book['removed_mass_kg']+=mass;self.book['removed_volume_m3']+=volume;self.book['sensible_removed_j']+=mass*self.sample['specific_heat_capacity_j_kg_k']*(self.temperature-self.plant['ambient_k']);self.book['internal_removed_j']+=sum(self._stored())+self.defect_stored+self.fracture_surface;self.sample=self.reference=self.source=None;self.plastic=0.;self.broken=False;self.force=0.;self.defect_stored=self.fracture_surface=0.;result=dict(removed_mass_kg=mass,removed_volume_m3=volume) + elif k=='power.set': + if not self.plant:raise ActionRejected('PLANT_REQUIRED') + if not a['enabled']: + if self.phase=='running':self._finish('cancelled','POWER_OFF') + for axis in self.axes:self._target(axis,self._pos(axis),MIN_SPEED_M_S if axis=='crosshead' else None) + self.power=a['enabled'];result=dict(enabled=self.power) + elif k=='grip.set_closed': + if not self.plant:raise ActionRejected('PLANT_REQUIRED') + if self._moving('crosshead') or abs(self.force)>1e-6:raise ActionRejected('UNLOAD_REQUIRED') + if self.sample and a['closed'] and abs(self._pos('crosshead')-self._free_extension())>1e-10:raise ActionRejected('GRIP_PRESTRAIN_UNSUPPORTED') + target=0. if a['closed'] else .006;self._target(a['which'],target);result=dict(target_opening_m=target) + elif k=='crosshead.move_to': + if not self.power:raise ActionRejected('POWER_OFF') + if self.emergency:raise ActionRejected('EMERGENCY_ENGAGED') + if self.sample and not self._held():raise ActionRejected('GRIPS_NOT_CLOSED') + if self.sample and a['position_m']1e-6 or any(self._moving(x) for x in self.axes):raise ActionRejected('UNLOAD_REQUIRED') + self.force_zero=self.sensor_force;result=dict(zero_n=self.force_zero) + elif k=='force.calibrate': + if not self.power:raise ActionRejected('POWER_OFF') + if any(self._moving(x) for x in self.axes):raise ActionRejected('MOVING') + if self.sample and a['reference_force_n']>FIXTURE_MAX_N:raise ActionRejected('FIXTURE_FORCE_LIMIT') + observation=self.sensor_force-self.force_zero + if observation<=0:raise ActionRejected('ZERO_CALIBRATION_SIGNAL') + gain=a['reference_force_n']/observation + if not math.isfinite(gain) or not .001<=gain<=1000:raise ActionRejected('INVALID_CALIBRATION') + self.force_gain=gain;result=dict(gain=gain) + elif k=='acquisition.start': + if not self.power:raise ActionRejected('POWER_OFF') + if self.emergency:raise ActionRejected('EMERGENCY_ENGAGED') + if not self.method or not self.fixture or not self.plant:raise ActionRejected('CONFIGURATION_REQUIRED') + if not self.sample:raise ActionRejected('NO_SAMPLE') + if self.broken:raise ActionRejected('SAMPLE_BROKEN') + if not self._held():raise ActionRejected('GRIPS_NOT_CLOSED') + if any(self._moving(x) for x in self.axes):raise ActionRejected('MOVING') + if not self._temperature_valid():raise ActionRejected('REFERENCE_TEMPERATURE_RANGE') + if self.force>=self.method['force_stop_n']:raise ActionRejected('METHOD_FORCE_STOP') + if self._observed_force() is None:raise ActionRejected('LOAD_CELL_OVERFLOW') + if self.method['target_crosshead_m']self.time_ns];event=self._next_material_event() + if event:candidates.append(event[0]) + if self.phase=='running':candidates.extend(x for x in [self._sample_ns,self._control_ns,self._end_ns] if x is not None and x>self.time_ns) + nxt=min(candidates);self._propagate(nxt-self.time_ns);self.time_ns=nxt;self._positions() + if self.phase=='running':self.elapsed=(self.time_ns-self._start_ns)/1e9 + if event and event[0]==self.time_ns: + if event[1]=='fracture':self._break() + elif event[1]=='force_limit': + self.last_stop_reason='FIXTURE_FORCE_LIMIT' if self.force>=FIXTURE_MAX_N-1e-4 else 'METHOD_FORCE_STOP' + if self.phase=='running':self._record();self._finish('failed',self.last_stop_reason) + else:self._stop_drive() + if self.phase=='running' and self._sample_ns==self.time_ns: + valid=self._record();self._sample_ns+=self._period_ns + if not valid:self._finish('failed','REFERENCE_TEMPERATURE_RANGE' if not self._temperature_valid() else 'LOAD_CELL_OVERFLOW') + if self.phase=='running' and self._control_ns==self.time_ns:self._control();self._control_ns=self.time_ns+CONTROL_PERIOD_NS if self.phase=='running' else None + if self.phase=='running' and (self.time_ns>=self._end_ns or self.mode=='speed' and not self._moving('crosshead')): + valid=self._record() if not self.rows or self.rows[-1]['time_s']!=self.time_s else self.rows[-1]['force_n'] is not None + if not valid:self._finish('failed','REFERENCE_TEMPERATURE_RANGE' if not self._temperature_valid() else 'LOAD_CELL_OVERFLOW') + else:self._finish('succeeded','duration_limit' if self.time_ns>=self._end_ns else 'target_reached') + self.revision+=1 + +class ShimadzuAgs10knxdSession: + def __init__(self, host, principal_id): self._host = host; self._principal = principal_id + @property + def _role(self): return self._host._principals[self._principal] + def _target(self, instance_id): + if instance_id != self._host.instance_id: raise ActionRejected('UNKNOWN_INSTANCE') + def describe(self, *, instance_id=None, asset_type_id=None): + if (instance_id is None) == (asset_type_id is None): raise ActionRejected('INVALID_ARGUMENT') + if instance_id is not None: self._target(instance_id) + if asset_type_id is not None and asset_type_id != ASSET_TYPE_ID: raise ActionRejected('UNKNOWN_INSTANCE') + meta = export_shimadzu_ags10knxd_contract_metadata() + return dict(protocol_version=PROTOCOL_VERSION, asset_type_id=ASSET_TYPE_ID, asset_version='1.0.0', capabilities={k:v for k,v in meta['capabilities'].items() if v['visibility']=='agent' or self._role!='agent'}, state_slots={k:v for k,v in meta['state_slots'].items() if v['visibility']=='agent' or self._role!='agent'}) + def read(self, *, instance_id, state_ids=None): + self._target(instance_id); h=self._host; values=h.read(self._role); ids=list(values) if state_ids is None else state_ids + if not isinstance(ids,list) or any(not isinstance(k,str) for k in ids): raise ActionRejected('INVALID_ARGUMENT') + if any(k not in values for k in ids): raise ActionRejected('ACCESS_DENIED') + return dict(instance_id=instance_id, status='succeeded', state_revision=h.revision, clock={'domain':'simulation','time_s':h.time_s}, observations={k:dict(value=copy.deepcopy(values[k]),unit=SLOTS[k]['unit'],quality='unavailable' if values[k] is None else 'estimated' if SLOTS[k]['origin'] in ('sensor','derived') else 'valid',sample_time_s=h.time_s,sample_window_s=None) for k in ids}) + def _filter_result(self, result): + result = copy.deepcopy(result) + # A bridge may dispatch agent-visible capabilities through a privileged + # session. Public acquisition payloads therefore use the SAME redaction + # for every role. Full provenance has its own evaluator-only capability. + if 'rows' in result and 'template_source' in result: + result['template_source'] = str(LIBRARY_PATH.relative_to(ROOT)) + '; selected record provenance available only through evaluator provenance.read' if result['template_source'] is not None else None + result['evidence'] = 'synthetic_forward_model; actual_force_crosshead_extensometer_observations; literature_reference_and_explicit_bilinear_geometry_thermal_fracture_assumptions; selected record restricted' if result['operation_id'] is not None else 'no_measurement' + return result + def invoke(self, *, instance_id, capability_id, arguments, request_id): + h=self._host + try: + self._target(instance_id) + if not isinstance(capability_id,str) or capability_id not in CAPS: raise ActionRejected('UNKNOWN_CAPABILITY') + if self._role=='agent' and CAPS[capability_id]['visibility']!='agent': raise ActionRejected('ACCESS_DENIED') + if not isinstance(request_id,str) or not request_id: raise ActionRejected('INVALID_ARGUMENT') + validate(CAPS[capability_id]['input_schema'],arguments); key=(self._principal,request_id); digest=json.dumps([capability_id,arguments],sort_keys=True,allow_nan=False) + if key in h._requests: + old,response=h._requests[key] + if old!=digest: raise ActionRejected('REQUEST_CONFLICT') + return copy.deepcopy(response) + if capability_id in ('acquisition.stop','acquisition.result') and self._role=='agent' and h.operation_id and h._owners.get(h.operation_id)!=self._principal: raise ActionRejected('ACCESS_DENIED') + if capability_id=='power.set' and not arguments['enabled'] and h.phase=='running' and self._role=='agent' and h._owners.get(h.operation_id)!=self._principal: raise ActionRejected('ACCESS_DENIED') + result=self._filter_result(h.invoke(capability_id,**arguments)); operation=result.get('operation_id') if capability_id in ('acquisition.start',) else None + if operation: h._owners[operation]=self._principal + response=dict(protocol_version=PROTOCOL_VERSION,instance_id=instance_id,request_id=request_id,operation_id=operation,status='accepted' if operation else 'succeeded',state_revision=h.revision,clock={'domain':'simulation','time_s':h.time_s},result=result,observations={},error=None) + h._requests[key]=(digest,copy.deepcopy(response)); return response + except ActionRejected as exc: + return dict(protocol_version=PROTOCOL_VERSION,instance_id=instance_id,request_id=request_id,operation_id=None,status='unsupported' if str(exc)=='UNSUPPORTED' else 'rejected',state_revision=h.revision,clock={'domain':'simulation','time_s':h.time_s},result={},observations={},error=dict(code=str(exc),message=str(exc),retryable=False,side_effects='none')) + def write(self, *, instance_id, state_id, value, request_id): + self._target(instance_id); entry=SLOTS.get(state_id) + if not entry or not entry['write']: raise ActionRejected('ACCESS_DENIED') + capability,argument=entry['write']; return self.invoke(instance_id=instance_id,capability_id=capability,arguments={argument:value},request_id=request_id) + def poll(self, operation_id): + h=self._host + if h._owners.get(operation_id)!=self._principal: raise ActionRejected('ACCESS_DENIED') + result=h._result() if operation_id==h.operation_id and h.phase=='running' else h.records.get(operation_id) + if result is None: raise ActionRejected('UNKNOWN_OPERATION') + return dict(operation_id=operation_id,status=result['phase'],result=self._filter_result(result)) + def cancel(self, operation_id, request_id): + self.poll(operation_id); h=self._host + if not isinstance(request_id,str) or not request_id: raise ActionRejected('INVALID_ARGUMENT') + key=(self._principal,request_id) + if key in h._cancel_operations: + if h._cancel_operations[key]!=operation_id: raise ActionRejected('REQUEST_CONFLICT') + return copy.deepcopy(h._requests[key][1]) + if key in h._requests: raise ActionRejected('REQUEST_CONFLICT') + if operation_id!=h.operation_id or h.phase!='running': raise ActionRejected('NOT_RUNNING') + result=self.invoke(instance_id=h.instance_id,capability_id='acquisition.stop',arguments={},request_id=request_id) + if result['status']=='succeeded': h._cancel_operations[key]=operation_id + return result + +for i,strain in enumerate([.0002,.0005,.001]): + CAPS['analysis.tensile']['example_arguments']['rows'].append(dict(point_index=i,time_s=i*.1,kind='sample',force_n=2e11*strain*2e-6,crosshead_m=strain*.025+(2e11*strain*2e-6)/1e8,extensometer_extension_m=strain*.025,broken=False,quality='estimated')) +EFFECTS={ + 'plant.configure':['plant.configured','thermal.sample_k','truth.sample_k'], + 'fixture.configure':['fixture.configured','fixture.extensometer_enabled','method.configured'], + 'method.configure':['method.configured'], + 'sample.load':['sample.present','sample.broken','thermal.sample_k','truth.sample_k','truth.mass_kg','extensometer.extension_m','extensometer.strain'], + 'sample.remove':['sample.present','sample.broken','truth.mass_kg','truth.plastic_strain','truth.total_strain','sample.visual_extension_m','sample.fracture_gap_m','extensometer.extension_m','extensometer.strain'], + 'power.set':['power.enabled','power.angle_rad','force.indicated_n','crosshead.indicated_m','extensometer.extension_m','extensometer.strain','crosshead.target_m','grip.target_upper_opening_m','grip.target_lower_opening_m','acquisition.phase'], + 'grip.set_closed':['grip.target_upper_opening_m','grip.target_lower_opening_m'], + 'crosshead.move_to':['crosshead.target_m'], + 'emergency.engage':['emergency.engaged','emergency.position_m','crosshead.target_m','grip.target_upper_opening_m','grip.target_lower_opening_m','acquisition.phase'], + 'emergency.reset':['emergency.engaged','emergency.position_m'], + 'force.zero':['calibration.force_zero_n','force.indicated_n'], + 'force.calibrate':['calibration.force_gain','force.indicated_n'], + 'acquisition.start':['acquisition.phase','acquisition.elapsed_s','acquisition.points','crosshead.target_m'], + 'acquisition.stop':['acquisition.phase','crosshead.target_m'], + 'sim.step':list(SLOTS)} +for k,v in EFFECTS.items():CAPS[k]['effects']=v +ERRORS=sorted(set(__import__('re').findall(r"ActionRejected\('([A-Z_0-9]+)'",Path(__file__).read_text()))|{'USER_CANCEL','EMERGENCY_STOP','LOAD_CELL_OVERFLOW','METHOD_FORCE_STOP'}) +LIMITATIONS=[ + '配置AGS-10kNXD高精度10kN传感器、真实SCG5kN手动拉伸夹具、TRAPEZIUM X软件;5000N夹具限值独立于10000N传感器量程,不实现弯曲/剥离/压缩和温控附件。', + '试验速度0.001..1000mm/min;最大1500mm/min回程不是本试验速度范围。1µm是位移显示分辨,不是定位准确度;±0.5% indicated仅20..10000N厂家条件,不自动变模拟噪声或已测精度。', + '有选定TRAPEZIUM软件时速度模式最多1000Hz真实采样;厂家自动force/stress或strain控制10ms,因此力/应变控制最多100Hz,工程反馈也严格每10ms更新。无软件选项仅保守10Hz速度模式,不声称OEM所有无软件模式。', + '材料库真实金属processed true/log曲线及E/0.2%yield和独立聚合物汇总标量是参考,不是本机器原生输出。真实E/Y驱动显式一维双线性代理;硬化H、工程断裂ε、温域常数近似、尺寸迁移和热参数须宿主接受。真实局部断口true strain不冒充engineering break elongation,截断曲线末点不是UTS或断裂。', + '均匀有效标距采用engineering strain、固定initial area的小变形一维代理,不解颈缩、面积演变、局部损伤或全场应变;源true-stress标量迁移到该代理是工程假设。rate-independent plasticity不是真实全速率材料响应。', + '横梁q=L*(elastic_strain+plastic_strain)+F/K;K包含机架/夹具串联顺应,不能把q/L直接当试样应变。工程夹持引伸计独立输出标距伸长,可显式不配;面积和标距均需独立先验才分析stress/strain。', + 'H使用储能硬化变量:Uhard=.5*H*ep²*A*L;不可逆plasticwork=Y*d(ep)*A*L,β变热其余保留缺陷能。显式断裂阈值释放sampleelastic至热/新表面,frameelastic导出至机架阻尼;残余塑性及硬化/缺陷能随碎片保留。', + '准静态一维力平衡不解横梁惯性或真实破断应力波。理想瞬时断裂时F物理突降,传感器仍有一阶响应;断裂pre/post是额外明确事件记录,不能冒充1000Hz时间网格中的额外独立采样。', + '被动热节点=宿主输入完整样品质量*Cp+局部接触热容,不使用85kg整机质量。塑性只对有效AL积分,完整体积/密度是独立先验并包含未变形tabs;视觉tabs形状不作为精确体积计量。没有主动温控器。', + '取消/急停/断电停止位移并按自锁丝杆假设保留静载弹性能,之后仍被动换热;不会重置塑性或断裂。带样不允许横梁进入低于残余自由长度的压缩/松弛区域,开夹须F≈0。夹具动作是有限时间手工代理,不声称真实电动SCG。', + '校准从当前实际传感器观测和外部已知力先验求zero/gain;不存在未接加载标准的自动已知真值,外部力先验没有证书即非计量认证。仅输出校准参数,不声称闭环准确度达标。', + '固定3D示例自由标距25mm、2mm×1mm,两个15mm夹持tabs。过程可配置其它尺寸但当前视觉仍是固定示例,不声称自动匹配任意试样。sample.present=false须隐藏试样,卸样后q可非零。', + '所有普通Session acquisition.result/poll跨角色统一隐藏选中材料身份,独立provenance.read仅evaluator;共享磁盘/Python不是操作系统隔离。实机驱动、机器人、经验噪声与OEM/ASTM/ISO认证均not_run。'] + +def export_shimadzu_ags10knxd_contract_metadata(): + slots={};caps={} + for k,v in SLOTS.items():slots[k]=dict(meaning_zh=v['meaning'],component_ids=[v['component']],value_schema=copy.deepcopy(v['schema']),unit=v['unit'],reference_conditions='SI; 10kN high-precision load cell / 5kN SCG tensile fixture / configured software and engineering extensometer.',origin=v['origin'],visibility=v['visibility'],access='read_only',read_binding=dict(backend='host',artifact_id='runtime',accessor=f'ShimadzuAgs10knxdSession.read(state_ids=[{k!r}])'),write_via=None,sampling=dict(mode='instant',time_domain='simulation',window_description='Pure read; sampling at configured fixed time grid with separately labelled fracture event observations.'),source_ids=['simulation_assumption']) + for k,v in CAPS.items(): + un=k in UNSUPPORTED;async_=k=='acquisition.start';caps[k]={key:copy.deepcopy(v[key]) for key in ['input_schema','output_schema','component_ids','function_zh','kind','visibility','example_arguments']} + caps[k].update(availability='unsupported' if un else 'implemented',implementation={layer:'absent' if un or layer in ('scene','robot','hardware') else 'implemented' for layer in ['process','scene','robot','hardware','host']},binding=None if un else dict(backend='host',artifact_id='runtime',entrypoint='asset_runtime.shimadzu_ags10knxd.ShimadzuAgs10knxdSession.invoke',invocation=f'session.invoke(instance_id="ags_01",capability_id={k!r},arguments={v["example_arguments"]!r},request_id="unique")'),preconditions=[] if un or v['kind'] in ('query','analysis') else [dict(description_zh='入口原子核对夹具/软件、载荷、夹持和独立材料/热/断裂先验;采样与控制必须显式step。',state_ids=['power.enabled','sample.present','fixture.configured','emergency.engaged','acquisition.phase'],enforced_by='runtime',check='ShimadzuAgs10knxdRuntime.invoke')],state_effects=[dict(state_id=s,timing='on_step' if k=='sim.step' else 'immediate',description_zh='声明设置或观测变化,真实驱动/热/传感器过程由step推进') for s in v['effects']],observes=[],model_effects=dict(mode='none',description_zh='运行层输出绑定状态,实际几何、双片变形和读数联动由独立scene验证。',binding_ids=[]),execution=dict(mode='asynchronous' if async_ else 'synchronous',time_domain='simulation',completion_criterion='实际有限位移/时限/明确破断条件完成;力/应变控制为限时反馈,完成不等于误差为零' if async_ else '原子命令,step为唯一物理时钟',completion_state_ids=['acquisition.phase'] if async_ else [],timeout_s=None,cancellation='supported' if async_ else 'unsupported',retry='same_request_id',resources=['host_clock','crosshead','tensile_fixture','load_cell','extensometer'],partial_failure_zh='保留已采样点、真实位移/力、塑性、断裂和全部热/弹性/缺陷能账。'),errors=[dict(code=e,meaning_zh=e,side_effects='partial' if async_ and e in ('USER_CANCEL','EMERGENCY_STOP','LOAD_CELL_OVERFLOW','REFERENCE_TEMPERATURE_RANGE','FIXTURE_FORCE_LIMIT','METHOD_FORCE_STOP') else 'none') for e in ERRORS],verification=[],limitations=LIMITATIONS,source_ids=['manufacturer_primary','simulation_assumption','template_library']) + if k in ('acquisition.start','crosshead.move_to','grip.set_closed','power.set','emergency.engage'): + caps[k]['state_effects'] += [dict(state_id=s,timing='on_step',description_zh='由统一宿主时钟推进准静态本构、被动热和实际传感器响应') for s in SLOTS if s not in v['effects'] and SLOTS[s]['origin'] in ('sensor','derived','scene','process_truth')] + mechanism=dict(component_ids=['crosshead','compliance_carriage','load_cell','upper_grip','lower_grip','specimen_lower','specimen_upper','extensometer','controller'],state_ids=list(slots),meaning_zh='串联顺应的拉伸双线性塑性、明确破断与可核算热/储能;独立传感器、固定采样和10ms反馈时钟',implementation='lumped',equations=['q=L*(ep+F/(A*E))+F/K; engineering strain=ep+F/(A*E).','yield stress=Y+H*ep; tensile return mapping enforces irreversible ep and quasi-static series equilibrium.','Uelastic=F²/(2K)+0.5*(F/A)²/E*A*L; Uhardening=0.5*H*ep²*A*L.','dWactuator=d(Uelastic+Uhardening)+Y*A*L*d(ep); Qplastic=beta*Y*A*L*d(ep), remaining work stored as defect energy.','At host-assumed fracture strain, sample elastic energy partitions into heat/surface; frame elastic energy exports as damping. ep and hardening/defect/surface energy remain with fragments.','C*dT/dt=-G*(T-Tambient)+Pplastic; sample load/remove transfers physical mass, volume, sensible heat and internal inventory.','tau*dFdet/dt=gain*F+offset-Fdet; Fobs=round((Fdet-zero)*cal_gain/res)*res.','Calibration cal_gain=external_known_force/(actual_detector_observation-zero); no hidden truth is used.','External analysis: sigma=Fobs/Aprior; strain=extension_observed/Lprior or (qobs-Fobs*Cframe_prior)/Lprior; no joint inversion of unknown geometry.','Sampling grid up to1000Hz with selected software; automatic force/strain feedback and associated sampling max100Hz. Fractional-nanosecond carry and yield/fracture/axis events maintain partition invariance.'],parameters={},source_ids=['simulation_assumption','template_library'],limitations=LIMITATIONS) + spec=importlib.util.spec_from_file_location('_ags_local_annotations',ROOT/'scripts/asset_runtime/_annotations.py');ann=importlib.util.module_from_spec(spec);spec.loader.exec_module(ann);ann.KEY_ZH.update({k:v['meaning'] for k,v in SLOTS.items()});ann.annotate_export(SLUG,caps,slots,{'uniaxial_tension':mechanism},inputs={'plant.configure':(PLANT,PLANT_EXAMPLE),'fixture.configure':(FIXTURE,FIXTURE_EXAMPLE),'sample.load':(SAMPLE,SAMPLE_EXAMPLE),'method.configure':(METHOD,METHOD_EXAMPLE)}) + for k,v in SLOTS.items():slots[k]['meaning_zh']=v['meaning'] + return dict(asset_type_id=ASSET_TYPE_ID,catalog_id=CATALOG_ID,capabilities=caps,state_slots=slots,mechanisms={'uniaxial_tension':mechanism}) diff --git a/scripts/asset_runtime/signatone_quadpro2.py b/scripts/asset_runtime/signatone_quadpro2.py new file mode 100644 index 0000000000000000000000000000000000000000..d384b501c1ece0e9ea4c12eaea314e4853f0e8b6 --- /dev/null +++ b/scripts/asset_runtime/signatone_quadpro2.py @@ -0,0 +1,543 @@ +"""QuadPro2-DAC0 with Keithley2450: timed four-contact thin-film wafer mapping.""" +from __future__ import annotations +import copy,importlib.util,json,math +from pathlib import Path +import numpy as np +from scipy.integrate import solve_ivp +PROTOCOL_VERSION='1.0.0';SLUG='signatone_quadpro2';ASSET_TYPE_ID='instrument.'+SLUG;CATALOG_ID='CHEM-142' +ROOT=Path(__file__).resolve().parents[2];ASSET=ROOT/'assets/expansion_batch04/t1_thermal'/SLUG;LIBRARY_PATH=ASSET/'sheet_resistance_library.json' + +class ActionRejected(ValueError):pass + +def number(unit='1',lo=None,hi=None): + s={'type':'number','x-unit':unit} + if lo is not None:s['minimum']=lo + if hi is not None:s['maximum']=hi + return s + +def obj(properties):return dict(type='object',properties=properties,required=list(properties),additionalProperties=False) +def nullable(s):return {'anyOf':[s,{'type':'null'}]} +def array(s,minimum=0,maximum=200001):return dict(type='array',items=s,minItems=minimum,maxItems=maximum) +def enum(items):return {'type':'string','enum':items} +BOOL={'type':'boolean'};TEXT={'type':'string'};PHASE=enum(['idle','running','succeeded','cancelled','failed']) + +def validate(s,v): + if 'anyOf' in s: + for o in s['anyOf']: + try:validate(o,v);return + except ActionRejected:pass + raise ActionRejected('INVALID_ARGUMENT') + k=s.get('type') + if k in ('number','integer'): + if isinstance(v,bool) or not isinstance(v,(int,float)) or not math.isfinite(v) or k=='integer' and type(v) is not int or not s.get('minimum',-math.inf)<=v<=s.get('maximum',math.inf):raise ActionRejected('INVALID_ARGUMENT') + elif k=='object': + if not isinstance(v,dict) or set(v)!=set(s['properties']):raise ActionRejected('INVALID_ARGUMENT') + for key,value in v.items():validate(s['properties'][key],value) + elif k=='array': + if not isinstance(v,list) or not s.get('minItems',0)<=len(v)<=s.get('maxItems',math.inf):raise ActionRejected('INVALID_ARGUMENT') + for x in v:validate(s['items'],x) + elif k=='boolean' and type(v) is not bool:raise ActionRejected('INVALID_ARGUMENT') + elif k=='string' and not isinstance(v,str):raise ActionRejected('INVALID_ARGUMENT') + elif k=='null' and v is not None:raise ActionRejected('INVALID_ARGUMENT') + if 'enum' in s and v not in s['enum']:raise ActionRejected('INVALID_ARGUMENT') + +from scipy.linalg import expm +CURRENT_RANGES=[10.**p for p in range(-8,1)] +VOLTAGE_RANGES=[.02,.2,2.,20.,200.] +PROBE_SPACINGS=[.001016,.00127,.0015875] +CONFIGURATIONS={'a_14_23':(0,3,1,2),'b_13_24':(0,2,1,3)} +WARMUP_S=3600.;CALIBRATION_S=180.;PROBE_RAISED_M=.01 + +def library():return {v['id']:v for v in json.loads(LIBRARY_PATH.read_text())['templates']} +def reference_rho(record,T,allow_invalid=False): + rows=record['curves']['resistivity'];lo=max(rows[0]['temperature_K'],record['valid_temperature_range_K'][0]);hi=min(rows[-1]['temperature_K'],record['valid_temperature_range_K'][1]);valid=lo-1e-6<=T<=hi+1e-6 + if not valid and not allow_invalid:return None + return float(np.interp(T,[p['temperature_K'] for p in rows],[p['value_ohm_m'] for p in rows])),valid + +def probe_points(x_m,y_m,spacing_m,orientation_rad=0.): + direction=complex(math.cos(orientation_rad),math.sin(orientation_rad));center=complex(x_m,y_m) + return [center+v*spacing_m*direction for v in [-1.5,-.5,.5,1.5]] +def disk_kernel(z,a,radius_m,contact_radius_m=None): + # Neumann disk source kernel, modulo constants which cancel for source/sink. + distance=abs(z-a) if contact_radius_m is None else max(abs(z-a),contact_radius_m) + return math.log(distance/radius_m)+math.log(abs(1-z*a.conjugate()/radius_m**2)) +def disk_transfer_coefficient(diameter_m,spacing_m,x_m,y_m,configuration='a_14_23',orientation_rad=0.,contact_radius_m=0.): + R=diameter_m/2;pts=probe_points(x_m,y_m,spacing_m,orientation_rad) + if any(abs(p)+max(contact_radius_m,1e-10)>=R for p in pts):raise ActionRejected('PROBE_OUTSIDE_WAFER') + a,b,c,d=CONFIGURATIONS[configuration] + potential=lambda z:-(disk_kernel(z,pts[a],R)-disk_kernel(z,pts[b],R))/(2*math.pi) + value=potential(pts[c])-potential(pts[d]) + if not value>0:raise ActionRejected('GEOMETRY_UNRESOLVED') + return float(value) +def disk_drive_coefficient(diameter_m,spacing_m,x_m,y_m,configuration,contact_radius_m): + R=diameter_m/2;pts=probe_points(x_m,y_m,spacing_m);a,b,_,_=CONFIGURATIONS[configuration] + potential=lambda z:-(disk_kernel(z,pts[a],R,contact_radius_m)-disk_kernel(z,pts[b],R,contact_radius_m))/(2*math.pi) + return float(potential(pts[a])-potential(pts[b])) + +def infer_sheet_resistance(diameter_m,spacing_m,x_m,y_m,observations,calibration_gain,thickness_prior_m): + estimates=[] + for configuration in CONFIGURATIONS: + rows=[p for p in observations if p['configuration']==configuration] + if len(rows)!=2 or rows[0]['current_a']*rows[1]['current_a']>=0:raise ActionRejected('CURRENT_REVERSAL_REQUIRED') + dI=rows[0]['current_a']-rows[1]['current_a'];dV=rows[0]['voltage_v']-rows[1]['voltage_v'] + if abs(dI)<1e-20:raise ActionRejected('CURRENT_UNRESOLVED') + coefficient=disk_transfer_coefficient(diameter_m,spacing_m,x_m,y_m,configuration);value=calibration_gain*dV/dI/coefficient + if not math.isfinite(value) or value<=0:raise ActionRejected('NONPOSITIVE_SHEET_RESISTANCE') + estimates.append(value) + mean=float(np.mean(estimates));spread=abs(estimates[0]-estimates[1])/mean + return dict(sheet_resistance_ohm_sq=mean,resistivity_ohm_m=None if thickness_prior_m is None else mean*thickness_prior_m,configuration_a_ohm_sq=estimates[0],configuration_b_ohm_sq=estimates[1],configuration_disagreement_fraction=spread,evidence='external_reversed_VI_and_finite_disk_Neumann_correction; rho_only_with_explicit_thickness_prior; not_OEM_ASTM_certification') + +PLANT_EXAMPLE=dict(ambient_k=300.,voltage_gain=1.03,voltage_offset_v=2e-6,voltage_response_tau_s=.01,current_gain=1.,electrical_contact_radius_m=10e-6,current_contact_resistance_ohm=20.,thermal_conductance_w_k=.05,local_thermal_capacity_j_k=.1,xy_speed_m_s=.04,z_speed_m_s=.005,hood_speed_rad_s=.5,temperature_resolution_k=.001,rear_triax_connected=True,accept_engineering=True) +PLANT=obj({'ambient_k':number('K',283.15,313.15),'voltage_gain':number('1',.1,10),'voltage_offset_v':number('V',-.1,.1),'voltage_response_tau_s':number('s',1e-5,10),'current_gain':number('1',.1,10),'electrical_contact_radius_m':number('m',1e-7,4e-5),'current_contact_resistance_ohm':number('ohm',0,1e9),'thermal_conductance_w_k':number('W/K',0,1000),'local_thermal_capacity_j_k':number('J/K',.001,100),'xy_speed_m_s':number('m/s',1e-5,.3),'z_speed_m_s':number('m/s',1e-5,.03),'hood_speed_rad_s':number('rad/s',.001,2),'temperature_resolution_k':number('K',1e-5,1),'rear_triax_connected':BOOL,'accept_engineering':BOOL}) +WAFER_EXAMPLE=dict(diameter_m=.1,substrate_thickness_m=.0005) +WAFER=obj({'diameter_m':number('m',.01,.3),'substrate_thickness_m':number('m',1e-5,.01)}) +PROBE_EXAMPLE=dict(spacing_m=.00127,force_per_pin_n=.83356525,tip_radius_m=40.64e-6,tip_material='tungsten_carbide') +PROBE=obj({'spacing_m':dict(type='number',enum=PROBE_SPACINGS,**{'x-unit':'m'}),'force_per_pin_n':dict(type='number',enum=[.44129925,.83356525,1.765197],**{'x-unit':'N'}),'tip_radius_m':dict(type='number',enum=[40.64e-6,127e-6,254e-6],**{'x-unit':'m'}),'tip_material':enum(['tungsten_carbide','osmium'])}) +THERMAL_SAMPLE=dict(conducting_thickness_m=1e-6,film_density_kg_m3=6000.,film_cp_j_kg_k=300.,substrate_density_kg_m3=2330.,substrate_cp_j_kg_k=700.,initial_temperature_k=300.,accept_thin_layer_and_thermal_assumptions=True) +THERMAL_PROPERTIES={'conducting_thickness_m':number('m',1e-9,5e-5),'film_density_kg_m3':number('kg/m^3',1,30000),'film_cp_j_kg_k':number('J/kg/K',1,10000),'substrate_density_kg_m3':number('kg/m^3',1,30000),'substrate_cp_j_kg_k':number('J/kg/K',1,10000),'initial_temperature_k':number('K',1,363.14),'accept_thin_layer_and_thermal_assumptions':BOOL} +SAMPLE_EXAMPLE=dict(THERMAL_SAMPLE,reference_id='starry_40927',gradient_x_fraction=.1,gradient_y_fraction=-.05,radial_fraction=.03,accept_synthetic_map_and_bulk_reference=True) +SAMPLE=obj(dict(THERMAL_PROPERTIES,reference_id=TEXT,gradient_x_fraction=number('1',-.2,.2),gradient_y_fraction=number('1',-.2,.2),radial_fraction=number('1',-.2,.2),accept_synthetic_map_and_bulk_reference=BOOL)) +STANDARD_EXAMPLE=dict(THERMAL_SAMPLE,actual_sheet_resistance_ohm_sq=100.,accept_host_standard_not_certified=True) +STANDARD=obj(dict(THERMAL_PROPERTIES,actual_sheet_resistance_ohm_sq=number('ohm/sq',1e-12,1e15),accept_host_standard_not_certified=BOOL)) +POINT=obj({'x_m':number('m',-.15,.15),'y_m':number('m',-.15,.15)}) +MAP_EXAMPLE=dict(points=[dict(x_m=x,y_m=y) for x,y in [(0,0),(.02,0),(0,.02),(-.02,0),(0,-.02),(.049,0)]],edge_exclusion_m=.003,thickness_prior_m=1e-6) +MAP=obj({'points':array(POINT,1,14000),'edge_exclusion_m':number('m',0,.15),'thickness_prior_m':nullable(number('m',1e-9,5e-5))}) +METHOD_EXAMPLE=dict(auto_current=True,current_min_a=1e-8,current_max_a=.001,fixed_current_a=.0001,voltage_range_v=.2,voltage_compliance_v=20.,target_voltage_min_v=.005,target_voltage_max_v=.08,phase_duration_s=.3,settling_s=.2,require_calibration=True,require_warmup=False) +METHOD=obj({'auto_current':BOOL,'current_min_a':dict(type='number',enum=CURRENT_RANGES,**{'x-unit':'A'}),'current_max_a':dict(type='number',enum=CURRENT_RANGES,**{'x-unit':'A'}),'fixed_current_a':number('A',0,1),'voltage_range_v':dict(type='number',enum=VOLTAGE_RANGES,**{'x-unit':'V'}),'voltage_compliance_v':number('V',.002,200),'target_voltage_min_v':number('V',1e-8,100),'target_voltage_max_v':number('V',1e-7,200),'phase_duration_s':number('s',.3,30),'settling_s':number('s',0,60),'require_calibration':BOOL,'require_warmup':BOOL}) +OBSERVATION=obj({'configuration':enum(list(CONFIGURATIONS)),'current_a':number('A'),'voltage_v':number('V'),'host_time_s':number('s',0)}) +OBS_INPUT=obj({'configuration':enum(list(CONFIGURATIONS)),'current_a':number('A'),'voltage_v':number('V')}) +INFERENCE=obj({'sheet_resistance_ohm_sq':number('ohm/sq',0),'resistivity_ohm_m':nullable(number('ohm*m',0)),'configuration_a_ohm_sq':number('ohm/sq',0),'configuration_b_ohm_sq':number('ohm/sq',0),'configuration_disagreement_fraction':number('1',0),'evidence':TEXT}) +ANALYSIS_INPUT=obj({'diameter_m':number('m',.01,.3),'spacing_m':dict(type='number',enum=PROBE_SPACINGS,**{'x-unit':'m'}),'x_m':number('m',-.15,.15),'y_m':number('m',-.15,.15),'observations':array(OBS_INPUT,4,4),'calibration_gain':number('1',.1,10),'thickness_prior_m':nullable(number('m',1e-9,5e-5))}) +ANALYSIS_EXAMPLE=dict(diameter_m=.1,spacing_m=.00127,x_m=0.,y_m=0.,observations=[dict(configuration=c,current_a=I,voltage_v=I*100*disk_transfer_coefficient(.1,.00127,0,0,c)+2e-6) for c in CONFIGURATIONS for I in [.0001,-.0001]],calibration_gain=1.,thickness_prior_m=None) +MAP_ROW=obj({'point_index':dict(type='integer',minimum=0,maximum=13999,**{'x-unit':'1'}),'x_m':number('m'),'y_m':number('m'),'time_s':number('s',0),'host_time_s':number('s',0),'observations':array(OBSERVATION,0,4),'sheet_resistance_ohm_sq':nullable(number('ohm/sq')),'resistivity_ohm_m':nullable(number('ohm*m')),'configuration_disagreement_fraction':nullable(number('1')),'quality':enum(['estimated','unavailable']),'error_code':nullable(TEXT)}) +STATS=obj({'count':dict(type='integer',minimum=0,maximum=14000,**{'x-unit':'1'}),'mean_ohm_sq':nullable(number('ohm/sq')),'std_ohm_sq':nullable(number('ohm/sq')),'minimum_ohm_sq':nullable(number('ohm/sq')),'maximum_ohm_sq':nullable(number('ohm/sq')),'relative_std_percent':nullable(number('%'))}) +AUTO_ROW=obj({'requested_current_a':number('A'),'measured_current_positive_a':number('A'),'measured_current_negative_a':number('A'),'voltage_positive_v':nullable(number('V')),'voltage_negative_v':nullable(number('V')),'reversal_signal_v':nullable(number('V')),'time_s':number('s',0),'source_compliance':BOOL}) +EXCLUDED=obj({'point_index':dict(type='integer',minimum=0,maximum=13999,**{'x-unit':'1'}),'x_m':number('m'),'y_m':number('m'),'reason':TEXT}) +RESULT=obj({'operation_id':nullable(TEXT),'operation_kind':nullable(enum(['mapping','calibration'])),'phase':PHASE,'elapsed_s':number('s',0),'rows':array(MAP_ROW,0,14000),'excluded_points':array(EXCLUDED,0,14000),'auto_trials':array(AUTO_ROW,0,9),'selected_current_a':number('A',0,1),'statistics':STATS,'calibration_gain':nullable(number('1')),'template_source':nullable(TEXT),'evidence':TEXT,'error_code':nullable(TEXT)}) +CAPS={};SLOTS={} +def cap(k,i,o,c,z,kind='device_command',visibility='agent',example=None):CAPS[k]=dict(input_schema=i,output_schema=o,component_ids=c,function_zh=z,kind=kind,visibility=visibility,example_arguments=copy.deepcopy(example or {}),effects=[]) +def slot(k,s,u,z,origin='derived',visibility='agent',component='controller'):SLOTS[k]=dict(schema=s,unit=u,meaning=z,origin=origin,visibility=visibility,component=component,write=None) +cap('plant.configure',PLANT,obj({'configured':BOOL}),['controller','source_meter','sample_stage'],'宿主明确误差、运动速度、被动热参数及2450 rear triax连接,不注入厂家准确度','configuration','evaluator',PLANT_EXAMPLE) +cap('wafer.configure',WAFER,obj({'configured':BOOL}),['sample_wafer'],'10至300mm圆片和绝缘支承基底厚度,载入后锁定几何','configuration','evaluator',WAFER_EXAMPLE) +cap('probe.configure',PROBE,obj({'configured':BOOL}),['probe_head'],'选择SP4间距、tip/载荷并使既有校准失效;不伪装Pa压力或动态重建3D探针','configuration',example=PROBE_EXAMPLE) +cap('sample.load',SAMPLE,obj({'loaded':BOOL}),['sample_wafer'],'装载真实rho文献参考驱动的薄膜+基底;地图/膜厚/热参数明确宿主假设','configuration','evaluator',SAMPLE_EXAMPLE) +cap('standard.load',STANDARD,obj({'loaded':BOOL}),['sample_wafer'],'宿主装入独立给定实际Rs的薄膜标样代理,证书/NIST真实性未验证','configuration','evaluator',STANDARD_EXAMPLE) +cap('sample.remove',obj({}),obj({'loaded':BOOL}),['sample_wafer'],'卸除全部膜/基底质量和显热,既有测量与耗散账不回滚','configuration','evaluator') +cap('power.set',obj({'enabled':BOOL}),obj({'enabled':BOOL}),['power_switch','source_meter'],'整系统源与自动运动电源,2450额定精度预热状态随真实时间累计',example={'enabled':True}) +cap('stage.move',POINT,obj({'target_x_m':number('m'),'target_y_m':number('m')}),['stage_x','sample_stage'],'安全抬针后移动真实XY机械坐标,测点坐标与样品台位移取反',example={'x_m':.01,'y_m':-.01}) +cap('probe.set_contact',obj({'contact':BOOL}),obj({'target_m':number('m',0,PROBE_RAISED_M)}),['probe_head'],'有限速度下降接触或抬针,不跳跃针尖姿态',example={'contact':True}) +cap('enclosure.set_open',obj({'opened':BOOL}),obj({'target_rad':number('rad',0,1.1)}),['hood'],'宿主手动暗箱翻盖有限速度代理,打开装样、关闭测量','simulation','evaluator',{'opened':False}) +cap('map.configure',MAP,obj({'configured':BOOL,'accepted_points':dict(type='integer',minimum=0,maximum=14000,**{'x-unit':'1'}),'excluded_points':dict(type='integer',minimum=0,maximum=14000,**{'x-unit':'1'})}),['sample_stage','controller'],'最多14000自定义点及边缘排除;无导电厚度先验时仅报告Rs','configuration',example=MAP_EXAMPLE) +cap('method.configure',METHOD,obj({'configured':BOOL}),['source_meter','controller'],'AutoRange只首点逐档真试测,后续地图固定该电流;每点双接线正反四相≥1.2s','configuration',example=METHOD_EXAMPLE) +cap('calibration.start',obj({'reference_sheet_resistance_ohm_sq':number('ohm/sq',1e-12,1e15)}),obj({'operation_id':TEXT,'minimum_duration_s':number('s',180)}),['source_meter','probe_head','controller'],'外部给定标样值与真实4相观测决定校正;实际累计至少180s,换针后重做',example={'reference_sheet_resistance_ohm_sq':100.}) +cap('calibration.clear',obj({}),obj({'calibrated':BOOL}),['controller'],'显式清除既有校正','configuration') +cap('acquisition.start',obj({}),obj({'operation_id':TEXT,'accepted_points':dict(type='integer',minimum=1,maximum=14000,**{'x-unit':'1'})}),['source_meter','stage_x','sample_stage','probe_head','controller'],'自动抬针/XY移动/下针/等待/首点量程/双接线正反四相,逐点建立实际地图') +cap('acquisition.stop',obj({}),obj({'phase':PHASE,'elapsed_s':number('s',0)}),['controller','source_meter','probe_head'],'切断激励、停止当前运动并保留完成点及已生热;不瞬移回零') +cap('acquisition.result',obj({}),RESULT,['controller'],'公开地图/统计/量程试测/原始VI,所有角色统一去除所选参考身份','query') +cap('analysis.sheet_resistance',ANALYSIS_INPUT,INFERENCE,['controller'],'仅外部VI/几何/校正反演Rs,rho必须有独立导电膜厚先验','analysis',example=ANALYSIS_EXAMPLE) +cap('provenance.read',obj({}),obj({'reference_id':nullable(TEXT),'template_source':nullable(TEXT),'evidence':TEXT}),['controller'],'仅宿主读取当前参考曲线或输入标样来源','query','evaluator') +LEDGER_UNITS=dict(mass_loaded_kg='kg',mass_present_kg='kg',mass_removed_kg='kg',mass_error_kg='kg',volume_loaded_m3='m^3',volume_present_m3='m^3',volume_removed_m3='m^3',volume_error_m3='m^3',source_input_j='J',sample_joule_j='J',contact_heat_export_j='J',electrical_error_j='J',ambient_heat_export_j='J',loaded_sensible_j='J',removed_sensible_j='J',thermal_stored_j='J',thermal_energy_error_j='J') +cap('ledger.read',obj({}),obj({k:number(u) for k,u in LEDGER_UNITS.items()}),['controller'],'薄膜/基底质量体积、被动温度、样品焦耳热/接触热外流账','query','evaluator') +cap('sim.step',obj({'dt_s':number('s',0,86400)}),obj({'time_s':number('s',0)}),['controller'],'唯一宿主时钟,有限自动运动、首点量程、180s校准、预热/采样/被动热','simulation','evaluator',{'dt_s':10.}) +UNSUPPORTED=['hardware.connect','robot.load','temperature.tcr_control','measurement.thick_bulk_wafer','analysis.joint_unknown_thickness_and_resistivity','measurement.astm_certification','noise.empirical','accuracy.certification'] +for k in UNSUPPORTED:cap(k,obj({}),obj({}),['controller'],'本配置未实现:'+k) +for k,c in [('plant.configured','controller'),('wafer.configured','sample_wafer'),('probe.configured','probe_head'),('sample.present','sample_wafer'),('power.enabled','power_switch'),('source.warmup_ready','source_meter'),('calibration.valid','controller'),('stage.moving','sample_stage')]:slot(k,BOOL,'1','当前配置/运行状态',component=c) +for k,u,z,c in [('stage.x_m','m','真实X台位置','stage_x'),('stage.y_m','m','真实Y台位置','sample_stage'),('stage.target_x_m','m','X台目标','stage_x'),('stage.target_y_m','m','Y台目标','sample_stage'),('probe.position_m','m','探针当前上提量;0接触','probe_head'),('probe.target_m','m','探针目标上提量;0接触','probe_head')]:slot(k,number(u,-.15,.15),u,z+';运动只随step改变','setpoint' if 'target' in k else 'scene',component=c) +slot('hood.angle_rad',number('rad',0,1.1),'rad','暗箱翻盖当前角,0闭合/1.1打开','scene',component='hood') +slot('hood.target_angle_rad',number('rad',0,1.1),'rad','暗箱翻盖目标角','setpoint',component='hood') +slot('power.angle_rad',number('rad',0,.28),'rad','电源开关姿态代理','scene',component='power_switch') +slot('source.warmup_elapsed_s',number('s',0,3600),'s','2450当前连续上电预热,3600s封顶;不构成额定准确度认证',component='source_meter') +slot('thermal.indicated_k',nullable(number('K')),'K','薄膜/基底及局部显式热容节点的量化温度,仅被动环境热交换','sensor',component='sample_wafer') +slot('measurement.selected_current_a',number('A',0,1),'A','本图首点AutoRange选定后固定的电流幅度','derived',component='source_meter') +slot('measured.current_a',nullable(number('A')),'A','2450实际电流经显式增益及厂家测量分辨率量化后的观测','sensor',component='source_meter') +slot('measured.voltage_v',nullable(number('V')),'V','四针输入电压增益/偏置/一阶响应及2450测量分辨率量化观测','sensor',component='source_meter') +slot('measurement.last_sheet_resistance_ohm_sq',nullable(number('ohm/sq')),'ohm/sq','最后实际完成点的几何修正Rs,未完成点不输出') +slot('display.sheet_resistance_ohm_sq',nullable(number('ohm/sq')),'ohm/sq','通电时PC显示最后已测点Rs;断电返回不可用,历史测量值仍保留') +slot('measurement.mean_sheet_resistance_ohm_sq',nullable(number('ohm/sq')),'ohm/sq','已完成地图点的算术平均Rs,非隐藏全图真值') +slot('calibration.gain',nullable(number('1')),'1','由外部参考Rs与实际观测比值形成的校正,换针失效') +slot('acquisition.phase',PHASE,'1','异步地图/校准运行状态') +slot('acquisition.stage',TEXT,'1','真实自动序列阶段:运动、接触、量程、四相、抬针') +slot('acquisition.points',{'type':'integer','minimum':0,'maximum':14000,'x-unit':'1'},'1','实际完成有效或失败测点行数') +slot('acquisition.elapsed_s',number('s',0),'s','当前作业实际宿主历时') +slot('clock.time_s',number('s',0),'s','唯一宿主时间') +for k,u,z in [('truth.sample_k','K','薄膜/基底集中节点真温'),('truth.sample_mass_kg','kg','薄膜及基底总质量'),('truth.conducting_thickness_m','m','隐藏导电膜厚,不等于基底厚度')]:slot(k,nullable(number(u)),u,z,'process_truth','evaluator','sample_wafer') + +class SignatoneQuadpro2Runtime: + def __init__(self,instance_id='quadpro2_01'): + self.instance_id=instance_id;self.plant=self.wafer=self.probe=self.sample=self.record=None;self.sample_kind=None;self.map=None;self.accepted=[];self.excluded=[];self.method=copy.deepcopy(METHOD_EXAMPLE);self.power=False;self.power_started_ns=None;self.time_ns=0;self._clock_remainder_ns=0.;self.revision=0 + self.axes={k:dict(position=v,target=v,start=v,start_ns=0,arrival_ns=0) for k,v in [('x',0.),('y',0.),('z',PROBE_RAISED_M),('hood',1.1)]};self.x=np.zeros(6) # theta,voltage detector,sourceJ,sampleJ,contactJ,ambientJ + self.calibration_gain=None;self.phase='idle';self.stage='idle';self.operation_kind=None;self.operation_id=None;self.elapsed=0.;self.rows=[];self.auto_trials=[];self.selected_current=0.;self.error=None;self._counter=0;self._start_ns=0;self._event_ns=None;self._job_points=[];self._job_excluded=[];self._site=0;self._measure_phase=0;self._partial=[];self._auto_candidates=[];self._auto_index=0;self._auto_positive=None;self._calibration_reference=None;self._last_sheet=None + self.records={};self._principals={};self._requests={};self._owners={};self._cancel_operations={};self._source=self._reference_id=None;self._evidence='no_sample';self._operation_source=None;self._operation_evidence='no_measurement';self.mass_loaded=self.mass_removed=self.volume_loaded=self.volume_removed=self.loaded_sensible=self.removed_sensible=0. + @property + def time_s(self):return self.time_ns/1e9 + def register_principal(self,principal_id,visibility='agent'): + if not isinstance(principal_id,str) or not principal_id or principal_id in self._principals or visibility not in ('agent','debug','evaluator'):raise ActionRejected('REQUEST_CONFLICT') + self._principals[principal_id]=visibility + def session(self,principal_id): + if principal_id not in self._principals:raise ActionRejected('ACCESS_DENIED') + return SignatoneQuadpro2Session(self,principal_id) + def describe(self):return export_signatone_quadpro2_contract_metadata() + def _warmup(self):return min(WARMUP_S,(self.time_ns-self.power_started_ns)/1e9) if self.power and self.power_started_ns is not None else 0. + def _moving(self,key=None):return any(self.time_ns=PROBE_RAISED_M-1e-12 and not self._moving('z') + def _closed(self):return self.axes['hood']['position']<=1e-12 and self.axes['hood']['target']==0 and not self._moving('hood') + def _volume(self):return math.pi*(self.wafer['diameter_m']/2)**2*(self.wafer['substrate_thickness_m']+self.sample['conducting_thickness_m']) if self.sample else 0. + def _masses(self): + if not self.sample:return 0.,0. + A=math.pi*(self.wafer['diameter_m']/2)**2;return A*self.wafer['substrate_thickness_m']*self.sample['substrate_density_kg_m3'],A*self.sample['conducting_thickness_m']*self.sample['film_density_kg_m3'] + def _mass(self):return sum(self._masses()) + def _sample_capacity(self): + if not self.sample:return 0. + ms,mf=self._masses();return ms*self.sample['substrate_cp_j_kg_k']+mf*self.sample['film_cp_j_kg_k'] + def _capacity(self):return (self.plant['local_thermal_capacity_j_k'] if self.plant else .1)+self._sample_capacity() + def _temperature(self):return self.plant['ambient_k']+float(self.x[0]) if self.plant else None + def _axis_speed(self,k):return self.plant['hood_speed_rad_s' if k=='hood' else 'z_speed_m_s' if k=='z' else 'xy_speed_m_s'] + def _move(self,**targets): + for k,target in targets.items(): + a=self.axes[k];a.update(target=target,start=a['position'],start_ns=self.time_ns,arrival_ns=self.time_ns+round(abs(target-a['position'])/self._axis_speed(k)*1e9)) + def _stop_motion(self): + for k in ['x','y','z']: + a=self.axes[k];a.update(target=a['position'],start=a['position'],start_ns=self.time_ns,arrival_ns=self.time_ns) + def _set_stage(self,stage,wait_s=None):self.stage=stage;self._event_ns=self.time_ns+round(wait_s*1e9) if wait_s is not None else max(self.axes[k]['arrival_ns'] for k in ['x','y','z']) + def _point(self):return self._job_points[self._site] if self._job_points else dict(point_index=0,x_m=-self.axes['x']['position'],y_m=-self.axes['y']['position']) + def _electrically_active(self):return self.power and self.phase=='running' and self.stage in ('auto_positive','auto_negative','measure') and self.axes['z']['position']<=1e-12 and self._closed() + def _configuration(self):return 'a_14_23' if self.stage.startswith('auto') or self._measure_phase<2 else 'b_13_24' + def _requested_current(self): + if not self._electrically_active():return 0. + if self.stage.startswith('auto'):return self._auto_candidates[self._auto_index]*(1 if self.stage=='auto_positive' else -1) + return self.selected_current*(1 if self._measure_phase%2==0 else -1) + def _current_range(self,I=None): + value=abs(self._requested_current() if I is None else I);return next((v for v in CURRENT_RANGES if v>=value*(1-1e-12)),1.) + def _local_sheet(self,T): + if self.sample_kind=='standard':return self.sample['actual_sheet_resistance_ohm_sq'],T<363.15 + raw=reference_rho(self.record,T,allow_invalid=True);p=self._point();R=self.wafer['diameter_m']/2;xx=p['x_m']/R;yy=p['y_m']/R;factor=1+self.sample['gradient_x_fraction']*xx+self.sample['gradient_y_fraction']*yy+self.sample['radial_fraction']*(xx*xx+yy*yy) + return raw[0]/self.sample['conducting_thickness_m']*factor,raw[1] and T<363.15 + def _electrical(self,T=None): + if not self._electrically_active():return dict(current=0.,voltage=0.,source_voltage=0.,sample_power=0.,contact_power=0.,compliance=False,valid=True) + T=self._temperature() if T is None else T;Rs,valid=self._local_sheet(T);p=self._point();c=self._configuration();geo=(self.wafer['diameter_m'],self.probe['spacing_m'],p['x_m'],p['y_m']);K=disk_transfer_coefficient(*geo,c);drive=Rs*disk_drive_coefficient(*geo,c,self.plant['electrical_contact_radius_m']);contact=self.plant['current_contact_resistance_ohm'];total=drive+contact;requested=self._requested_current();I=math.copysign(min(abs(requested),self.method['voltage_compliance_v']/total,math.sqrt(20./total),.1 if self.method['voltage_compliance_v']>20 else 1.),requested) + return dict(current=I,voltage=I*Rs*K,source_voltage=I*total,sample_power=I*I*drive,contact_power=I*I*contact,compliance=abs(I-requested)>max(abs(requested)*1e-10,1e-18),valid=bool(valid)) + def _observed(self,e=None): + if not self._electrically_active():return None,None + e=self._electrical() if e is None else e;v=float(self.x[1]);full=self.method['voltage_range_v'];qv=full*5e-7;qi=self._current_range()*1e-6;return float(round(e['current']*self.plant['current_gain']/qi)*qi),None if abs(v)>full else float(round(v/qv)*qv) + def _stats(self): + values=[x['sheet_resistance_ohm_sq'] for x in self.rows if x['sheet_resistance_ohm_sq'] is not None] + if not values:return dict(count=0,mean_ohm_sq=None,std_ohm_sq=None,minimum_ohm_sq=None,maximum_ohm_sq=None,relative_std_percent=None) + mean=float(np.mean(values));std=float(np.std(values));return dict(count=len(values),mean_ohm_sq=mean,std_ohm_sq=std,minimum_ohm_sq=min(values),maximum_ohm_sq=max(values),relative_std_percent=100*std/mean) + def read(self,role='evaluator'): + if role not in ('agent','debug','evaluator'):raise ActionRejected('ACCESS_DENIED') + current,voltage=self._observed();d={'plant.configured':self.plant is not None,'wafer.configured':self.wafer is not None,'probe.configured':self.probe is not None,'sample.present':self.sample is not None,'power.enabled':self.power,'source.warmup_ready':self._warmup()>=WARMUP_S,'calibration.valid':self.calibration_gain is not None,'stage.moving':self._moving(),'stage.x_m':self.axes['x']['position'],'stage.y_m':self.axes['y']['position'],'stage.target_x_m':self.axes['x']['target'],'stage.target_y_m':self.axes['y']['target'],'probe.position_m':self.axes['z']['position'],'probe.target_m':self.axes['z']['target'],'hood.angle_rad':self.axes['hood']['position'],'hood.target_angle_rad':self.axes['hood']['target'],'power.angle_rad':.28 if self.power else 0.,'source.warmup_elapsed_s':self._warmup(),'thermal.indicated_k':float(round(self._temperature()/self.plant['temperature_resolution_k'])*self.plant['temperature_resolution_k']) if self.plant else None,'measurement.selected_current_a':self.selected_current,'measured.current_a':current,'measured.voltage_v':voltage,'measurement.last_sheet_resistance_ohm_sq':self._last_sheet,'display.sheet_resistance_ohm_sq':self._last_sheet if self.power else None,'measurement.mean_sheet_resistance_ohm_sq':self._stats()['mean_ohm_sq'],'calibration.gain':self.calibration_gain,'acquisition.phase':self.phase,'acquisition.stage':self.stage,'acquisition.points':len(self.rows),'acquisition.elapsed_s':self.elapsed,'clock.time_s':self.time_s,'truth.sample_k':self._temperature(),'truth.sample_mass_kg':self._mass() if self.sample else None,'truth.conducting_thickness_m':self.sample['conducting_thickness_m'] if self.sample else None} + return {k:v for k,v in d.items() if role!='agent' or SLOTS[k]['visibility']=='agent'} + def _propagate(self,ns): + if not ns or not self.plant:return + dt=ns/1e9;p=self.plant;C=self._capacity();G=p['thermal_conductance_w_k'] + if self._electrically_active(): + def rhs(_t,y): + e=self._electrical(p['ambient_k']+y[0]);loss=G*y[0];return [(e['sample_power']-loss)/C,(p['voltage_gain']*e['voltage']+p['voltage_offset_v']-y[1])/p['voltage_response_tau_s'],e['current']*e['source_voltage'],e['sample_power'],e['contact_power'],loss] + sol=solve_ivp(rhs,(0.,dt),self.x,method='Radau',rtol=1e-10,atol=[1e-11,1e-13,1e-13,1e-13,1e-13,1e-12]) + if not sol.success:raise RuntimeError('ELECTROTHERMAL_INTEGRATION_FAILED') + self.x=sol.y[:,-1] + else: + initial=self.x[0];self.x[0]*=math.exp(-G*dt/C);self.x[5]+=C*(initial-self.x[0]);self.x[1]*=math.exp(-dt/p['voltage_response_tau_s']) + def _ledger(self): + source,sample,contact,ambient=self.x[2:];stored=self._capacity()*float(self.x[0]);return dict(mass_loaded_kg=self.mass_loaded,mass_present_kg=self._mass(),mass_removed_kg=self.mass_removed,mass_error_kg=self.mass_loaded-self._mass()-self.mass_removed,volume_loaded_m3=self.volume_loaded,volume_present_m3=self._volume(),volume_removed_m3=self.volume_removed,volume_error_m3=self.volume_loaded-self._volume()-self.volume_removed,source_input_j=float(source),sample_joule_j=float(sample),contact_heat_export_j=float(contact),electrical_error_j=float(source-sample-contact),ambient_heat_export_j=float(ambient),loaded_sensible_j=self.loaded_sensible,removed_sensible_j=self.removed_sensible,thermal_stored_j=stored,thermal_energy_error_j=float(sample-ambient+self.loaded_sensible-self.removed_sensible-stored)) + def _result(self): + if self.phase!='running' and self.operation_id in self.records:return copy.deepcopy(self.records[self.operation_id]) + return dict(operation_id=self.operation_id,operation_kind=self.operation_kind,phase=self.phase,elapsed_s=self.elapsed,rows=copy.deepcopy(self.rows),excluded_points=copy.deepcopy(self._job_excluded),auto_trials=copy.deepcopy(self.auto_trials),selected_current_a=self.selected_current,statistics=self._stats(),calibration_gain=self.calibration_gain,template_source=self._operation_source,evidence=self._operation_evidence,error_code=self.error) + def _finish(self,phase,error=None): + self.phase=phase;self.stage='idle';self.error=error;self._event_ns=None;self._stop_motion() + if self.operation_id:self.records[self.operation_id]=self._result() + def _capture(self): + e=self._electrical();I,V=self._observed(e);error='REFERENCE_TEMPERATURE_RANGE' if not e['valid'] else 'SOURCE_COMPLIANCE' if e['compliance'] else 'VOLTAGE_OVERFLOW' if V is None else None + return I,V,error,e + def _failure_row(self,error): + p=self._point();self.rows.append(dict(point_index=p['point_index'],x_m=p['x_m'],y_m=p['y_m'],time_s=self.elapsed,host_time_s=self.time_s,observations=copy.deepcopy(self._partial),sheet_resistance_ohm_sq=None,resistivity_ohm_m=None,configuration_disagreement_fraction=None,quality='unavailable',error_code=error));self._finish('failed',error) + def _begin_measure(self): + self._measure_phase=0;self._partial=[];dwell=max(self.method['phase_duration_s'],CALIBRATION_S/4) if self.operation_kind=='calibration' else self.method['phase_duration_s'];self._set_stage('measure',dwell) + def _begin_point(self): + self._partial=[];self._move(z=PROBE_RAISED_M);self._set_stage('raise') + def _advance_event(self): + if self.stage=='raise': + p=self._point();self._move(x=-p['x_m'],y=-p['y_m']);self._set_stage('move') + elif self.stage=='move':self._move(z=0.);self._set_stage('lower') + elif self.stage=='lower':self._set_stage('settle',self.method['settling_s']) + elif self.stage=='settle': + if self._site==0 and self.method['auto_current']: + self._auto_index=0;self._set_stage('auto_positive',.6) + else:self._begin_measure() + elif self.stage=='auto_positive': + self._auto_positive=self._capture();self._set_stage('auto_negative',.6) + elif self.stage=='auto_negative': + Ip,Vp,ep,physical_p=self._auto_positive;In,Vn,en,physical_n=self._capture();signal=None if Vp is None or Vn is None else abs(Vp-Vn)/2;current=self._auto_candidates[self._auto_index];self.auto_trials.append(dict(requested_current_a=current,measured_current_positive_a=Ip,measured_current_negative_a=In,voltage_positive_v=Vp,voltage_negative_v=Vn,reversal_signal_v=signal,time_s=self.elapsed,source_compliance=physical_p['compliance'] or physical_n['compliance'])) + if ep or en: + previous=self.auto_trials[-2] if len(self.auto_trials)>1 else None + if (ep or en)=='REFERENCE_TEMPERATURE_RANGE' or previous is None or previous['reversal_signal_v'] is None or previous['reversal_signal_v']<=10*self.method['voltage_range_v']*5e-7:self._failure_row(ep or en);return + self.selected_current=previous['requested_current_a'];self._begin_measure() + elif signalself.method['target_voltage_max_v'] and len(self.auto_trials)>1 else current;self._begin_measure() + elif self.stage=='measure': + I,V,error,_e=self._capture() + if error:self._failure_row(error);return + self._partial.append(dict(configuration=self._configuration(),current_a=I,voltage_v=V,host_time_s=self.time_s));self._measure_phase+=1 + if self._measure_phase<4: + self._set_stage('measure',max(self.method['phase_duration_s'],CALIBRATION_S/4) if self.operation_kind=='calibration' else self.method['phase_duration_s']);return + p=self._point();prior=None if self.operation_kind=='calibration' else self.map['thickness_prior_m'];args=dict(diameter_m=self.wafer['diameter_m'],spacing_m=self.probe['spacing_m'],x_m=p['x_m'],y_m=p['y_m'],observations=[{k:x[k] for k in OBS_INPUT['properties']} for x in self._partial],calibration_gain=1. if self.operation_kind=='calibration' else self.calibration_gain or 1.,thickness_prior_m=prior) + try:inferred=infer_sheet_resistance(**args) + except ActionRejected as exc:self._failure_row(str(exc));return + self.rows.append(dict(point_index=p['point_index'],x_m=p['x_m'],y_m=p['y_m'],time_s=self.elapsed,host_time_s=self.time_s,observations=copy.deepcopy(self._partial),sheet_resistance_ohm_sq=inferred['sheet_resistance_ohm_sq'],resistivity_ohm_m=inferred['resistivity_ohm_m'],configuration_disagreement_fraction=inferred['configuration_disagreement_fraction'],quality='estimated',error_code=None));self._last_sheet=inferred['sheet_resistance_ohm_sq'] + if self.operation_kind=='calibration': + gain=self._calibration_reference/inferred['sheet_resistance_ohm_sq'] + if not .1<=gain<=10:self._finish('failed','CALIBRATION_RANGE');return + self.calibration_gain=gain + self._move(z=PROBE_RAISED_M);self._set_stage('raise_after') + elif self.stage=='raise_after': + self._site+=1 + if self._site>=len(self._job_points):self._finish('succeeded') + else:self._begin_point() + else:raise RuntimeError('UNKNOWN_SEQUENCE_STAGE') + def _filter_points(self,a): + accepted=[];excluded=[];R=self.wafer['diameter_m']/2 + for i,p in enumerate(a['points']): + reason=None + if math.hypot(p['x_m'],p['y_m'])>R-a['edge_exclusion_m']+1e-12:reason='EDGE_EXCLUSION' + elif max(abs(p['x_m']),abs(p['y_m']))>.13:reason='STAGE_TRAVEL' + else: + try:disk_transfer_coefficient(self.wafer['diameter_m'],self.probe['spacing_m'],p['x_m'],p['y_m'],contact_radius_m=self.plant['electrical_contact_radius_m']) + except ActionRejected:reason='PROBE_FOOTPRINT_OUTSIDE_WAFER' + row=dict(point_index=i,**p) + if reason:excluded.append(dict(row,reason=reason)) + else:accepted.append(row) + return accepted,excluded + def _load(self,a,standard): + if not self.plant or not self.wafer or not self.probe or self.sample or not self._raised() or self._moving() or self.axes['hood']['position']<1.0 or self._moving('hood') or max(abs(self.axes['x']['position']),abs(self.axes['y']['position']))>1e-12 or not a['accept_thin_layer_and_thermal_assumptions']:raise ActionRejected('PRECONDITION_FAILED') + if a['conducting_thickness_m']/self.probe['spacing_m']>.05:raise ActionRejected('THIN_LAYER_DOMAIN') + if standard: + if not a['accept_host_standard_not_certified']:raise ActionRejected('ASSUMPTION_NOT_ACCEPTED') + record=None + else: + if not a['accept_synthetic_map_and_bulk_reference']:raise ActionRejected('ASSUMPTION_NOT_ACCEPTED') + record=library().get(a['reference_id']) + if record is None:raise ActionRejected('UNKNOWN_REFERENCE') + if reference_rho(record,a['initial_temperature_k']) is None:raise ActionRejected('REFERENCE_TEMPERATURE_RANGE') + old=self._capacity();self.sample=copy.deepcopy(a);self.sample_kind='standard' if standard else 'material';self.record=copy.deepcopy(record);new=self._capacity();delta=a['initial_temperature_k']-self.plant['ambient_k'];self.x[0]=(old*self.x[0]+(new-old)*delta)/new;self.loaded_sensible+=(new-old)*delta;self.mass_loaded+=self._mass();self.volume_loaded+=self._volume();self._reference_id=None if standard else a['reference_id'];self._source='host_input_thin_film_standard_no_certificate' if standard else json.dumps(record['source'],ensure_ascii=False,sort_keys=True);self._evidence='explicit_host_standard_and_thermal_assumptions' if standard else 'measured_literature_rho; assumed_bulk_to_thin_film_and_synthetic_spatial_map';return {'loaded':True} + def invoke(self,capability,**a): + if capability not in CAPS:raise ActionRejected('UNKNOWN_CAPABILITY') + validate(CAPS[capability]['input_schema'],a) + if capability in UNSUPPORTED:raise ActionRejected('UNSUPPORTED') + if capability=='analysis.sheet_resistance':return infer_sheet_resistance(**a) + if capability=='acquisition.result':return self._result() + if capability=='provenance.read':return dict(reference_id=self._reference_id,template_source=self._source,evidence=self._evidence) + if capability=='ledger.read':return self._ledger() + if capability=='sim.step':self.step(a['dt_s']);return {'time_s':self.time_s} + if self.phase=='running' and capability not in ('acquisition.stop','power.set'):raise ActionRejected('BUSY') + if capability=='plant.configure': + if self.plant or not a['accept_engineering']:raise ActionRejected('PRECONDITION_FAILED') + self.plant=copy.deepcopy(a);out={'configured':True} + elif capability=='wafer.configure': + if self.sample:raise ActionRejected('PRECONDITION_FAILED') + self.wafer=copy.deepcopy(a);self.map=None;self.accepted=[];self.excluded=[];out={'configured':True} + elif capability=='probe.configure': + if not self.plant or not self._raised() or self._moving() or self.axes['hood']['position']<1.0 or self._moving('hood'):raise ActionRejected('PRECONDITION_FAILED') + if self.sample and self.sample['conducting_thickness_m']/a['spacing_m']>.05:raise ActionRejected('THIN_LAYER_DOMAIN') + self.probe=copy.deepcopy(a);self.calibration_gain=None;self.map=None;self.accepted=[];self.excluded=[];out={'configured':True} + elif capability in ('sample.load','standard.load'):out=self._load(a,capability=='standard.load') + elif capability=='sample.remove': + if not self.sample or not self._raised() or self._moving() or self.axes['hood']['position']<1.0 or self._moving('hood') or max(abs(self.axes['x']['position']),abs(self.axes['y']['position']))>1e-12:raise ActionRejected('PRECONDITION_FAILED') + self.mass_removed+=self._mass();self.volume_removed+=self._volume();self.removed_sensible+=self._sample_capacity()*float(self.x[0]);self.sample=self.record=self.sample_kind=None;self._source=self._reference_id=None;self._evidence='no_sample';out={'loaded':False} + elif capability=='power.set': + if not a['enabled']: + if self.phase=='running':self._finish('cancelled','POWER_OFF') + else:self._stop_motion() + if self.power!=a['enabled']:self.power_started_ns=self.time_ns if a['enabled'] else None + self.power=a['enabled'];out={'enabled':self.power} + elif capability=='enclosure.set_open': + if not self.plant or self._moving() or not self._raised():raise ActionRejected('PRECONDITION_FAILED') + target=1.1 if a['opened'] else 0.;self._move(hood=target);out={'target_rad':target} + elif capability=='stage.move': + if not self.power or not self.plant or not self._raised() or self._moving('hood') or max(abs(a['x_m']),abs(a['y_m']))>.13:raise ActionRejected('STAGE_TRAVEL_OR_CLEARANCE') + self._move(x=a['x_m'],y=a['y_m']);out={'target_x_m':a['x_m'],'target_y_m':a['y_m']} + elif capability=='probe.set_contact': + if not self.power or not self.plant or self._moving('x') or self._moving('y') or self._moving('hood') or a['contact'] and (not self.sample or not self.probe or not self._closed()):raise ActionRejected('PRECONDITION_FAILED') + if a['contact']:disk_transfer_coefficient(self.wafer['diameter_m'],self.probe['spacing_m'],-self.axes['x']['position'],-self.axes['y']['position'],contact_radius_m=self.plant['electrical_contact_radius_m']) + target=0. if a['contact'] else PROBE_RAISED_M;self._move(z=target);out={'target_m':target} + elif capability=='map.configure': + if not self.wafer or not self.probe or not self.plant:raise ActionRejected('PRECONDITION_FAILED') + if a['edge_exclusion_m']>=self.wafer['diameter_m']/2:raise ActionRejected('EDGE_EXCLUSION_RANGE') + if a['edge_exclusion_m']+1e-1220 and a['current_max_a']>.1:raise ActionRejected('SOURCE_RANGE_ENVELOPE') + if a['current_min_a']>a['current_max_a'] or a['fixed_current_a']>a['current_max_a'] or a['target_voltage_min_v']>=a['target_voltage_max_v'] or a['target_voltage_max_v']>a['voltage_range_v']:raise ActionRejected('METHOD_RANGE') + if any(abs(a[k]*1e9-round(a[k]*1e9))>1e-4 for k in ['phase_duration_s','settling_s']):raise ActionRejected('TIME_GRID') + self.method=copy.deepcopy(a);out={'configured':True} + elif capability=='calibration.clear':self.calibration_gain=None;out={'calibrated':False} + elif capability in ('acquisition.start','calibration.start'): + if not self.power or not self.plant or not self.wafer or not self.probe or not self.sample or not self._closed() or self._moving():raise ActionRejected('PRECONDITION_FAILED') + if self.method['require_warmup'] and self._warmup()=363.15:raise ActionRejected('PROBE_TEMPERATURE_RANGE') + if not self.plant['rear_triax_connected'] and (self.method['current_min_a']<1e-6 if self.method['auto_current'] else self._current_range(self.method['fixed_current_a'])<1e-6):raise ActionRejected('REAR_TRIAX_REQUIRED') + iscal=capability=='calibration.start' + if iscal and self.sample_kind!='standard':raise ActionRejected('STANDARD_REQUIRED') + if not iscal and (not self.map or not self.accepted):raise ActionRejected('MAP_REQUIRED') + if not iscal and self.method['require_calibration'] and self.calibration_gain is None:raise ActionRejected('CALIBRATION_REQUIRED') + if not self.method['auto_current'] and self.method['fixed_current_a']<=0:raise ActionRejected('ZERO_EXCITATION') + points=[dict(point_index=0,x_m=0.,y_m=0.)] if iscal else self.accepted + for p in points:disk_transfer_coefficient(self.wafer['diameter_m'],self.probe['spacing_m'],p['x_m'],p['y_m'],contact_radius_m=self.plant['electrical_contact_radius_m']) + self._counter+=1;self.operation_id=f'{self.instance_id}:acquisition:{self._counter}';self.operation_kind='calibration' if iscal else 'mapping';self._operation_source=self._source;self._operation_evidence=self._evidence;self.phase='running';self.elapsed=0.;self.rows=[];self.auto_trials=[];self.error=None;self._start_ns=self.time_ns;self._site=0;self._job_points=copy.deepcopy(points);self._job_excluded=[] if iscal else copy.deepcopy(self.excluded);self._calibration_reference=a['reference_sheet_resistance_ohm_sq'] if iscal else None;self._auto_candidates=[v for v in CURRENT_RANGES if self.method['current_min_a']<=v<=self.method['current_max_a']];q=self._current_range(self.method['fixed_current_a'])*5e-5;self.selected_current=0. if self.method['auto_current'] else float(round(self.method['fixed_current_a']/q)*q);self._begin_point();out={'operation_id':self.operation_id,'minimum_duration_s':CALIBRATION_S} if iscal else {'operation_id':self.operation_id,'accepted_points':len(points)} + elif capability=='acquisition.stop': + if self.phase!='running':raise ActionRejected('NOT_RUNNING') + self._finish('cancelled','USER_CANCEL');out={'phase':self.phase,'elapsed_s':self.elapsed} + else:raise ActionRejected('UNKNOWN_CAPABILITY') + self.revision+=1;return copy.deepcopy(out) + def step(self,dt_s): + validate(number('s',0,86400),dt_s);total=math.fsum((self._clock_remainder_ns,dt_s*1e9));ns=round(total);self._clock_remainder_ns=total-ns + if not ns:return + end=self.time_ns+ns + while self.time_ns=a['arrival_ns'] else a['start']+math.copysign(self._axis_speed(k)*(self.time_ns-a['start_ns'])/1e9,a['target']-a['start']) + if self.phase=='running': + self.elapsed=(self.time_ns-self._start_ns)/1e9 + if self.time_ns==self._event_ns:self._advance_event() + self.revision+=1 + +class SignatoneQuadpro2Session: + def __init__(self, host, principal_id): self._host = host; self._principal = principal_id + @property + def _role(self): return self._host._principals[self._principal] + def _target(self, instance_id): + if instance_id != self._host.instance_id: raise ActionRejected('UNKNOWN_INSTANCE') + def describe(self, *, instance_id=None, asset_type_id=None): + if (instance_id is None) == (asset_type_id is None): raise ActionRejected('INVALID_ARGUMENT') + if instance_id is not None: self._target(instance_id) + if asset_type_id is not None and asset_type_id != ASSET_TYPE_ID: raise ActionRejected('UNKNOWN_INSTANCE') + meta = export_signatone_quadpro2_contract_metadata() + return dict(protocol_version=PROTOCOL_VERSION, asset_type_id=ASSET_TYPE_ID, asset_version='1.0.0', capabilities={k:v for k,v in meta['capabilities'].items() if v['visibility']=='agent' or self._role!='agent'}, state_slots={k:v for k,v in meta['state_slots'].items() if v['visibility']=='agent' or self._role!='agent'}) + def read(self, *, instance_id, state_ids=None): + self._target(instance_id); h=self._host; values=h.read(self._role); ids=list(values) if state_ids is None else state_ids + if not isinstance(ids,list) or any(not isinstance(k,str) for k in ids): raise ActionRejected('INVALID_ARGUMENT') + if any(k not in values for k in ids): raise ActionRejected('ACCESS_DENIED') + return dict(instance_id=instance_id, status='succeeded', state_revision=h.revision, clock={'domain':'simulation','time_s':h.time_s}, observations={k:dict(value=copy.deepcopy(values[k]),unit=SLOTS[k]['unit'],quality='unavailable' if values[k] is None else 'estimated' if SLOTS[k]['origin'] in ('sensor','derived') else 'valid',sample_time_s=h.time_s,sample_window_s=None) for k in ids}) + def _filter_result(self, result): + result = copy.deepcopy(result) + # A bridge may dispatch agent-visible capabilities through a privileged + # session. Public acquisition payloads therefore use the SAME redaction + # for every role. Full provenance has its own evaluator-only capability. + if 'rows' in result and 'template_source' in result: + result['template_source'] = str(LIBRARY_PATH.relative_to(ROOT)) + '; selected record provenance available only through evaluator provenance.read' if result['template_source'] is not None else None + result['evidence'] = 'observed_four_probe_VI_with_finite_disk_thin_layer_and_explicit_synthetic_map_assumptions; selected template details require evaluator provenance.read' if result['operation_id'] is not None else 'no_measurement' + return result + def invoke(self, *, instance_id, capability_id, arguments, request_id): + h=self._host + try: + self._target(instance_id) + if not isinstance(capability_id,str) or capability_id not in CAPS: raise ActionRejected('UNKNOWN_CAPABILITY') + if self._role=='agent' and CAPS[capability_id]['visibility']!='agent': raise ActionRejected('ACCESS_DENIED') + if not isinstance(request_id,str) or not request_id: raise ActionRejected('INVALID_ARGUMENT') + validate(CAPS[capability_id]['input_schema'],arguments); key=(self._principal,request_id); digest=json.dumps([capability_id,arguments],sort_keys=True,allow_nan=False) + if key in h._requests: + old,response=h._requests[key] + if old!=digest: raise ActionRejected('REQUEST_CONFLICT') + return copy.deepcopy(response) + if capability_id in ('acquisition.stop','acquisition.result') and self._role=='agent' and h.operation_id and h._owners.get(h.operation_id)!=self._principal: raise ActionRejected('ACCESS_DENIED') + if capability_id=='power.set' and not arguments['enabled'] and h.phase=='running' and self._role=='agent' and h._owners.get(h.operation_id)!=self._principal: raise ActionRejected('ACCESS_DENIED') + result=self._filter_result(h.invoke(capability_id,**arguments)); operation=result.get('operation_id') if capability_id in ('acquisition.start','calibration.start') else None + if operation: h._owners[operation]=self._principal + response=dict(protocol_version=PROTOCOL_VERSION,instance_id=instance_id,request_id=request_id,operation_id=operation,status='accepted' if operation else 'succeeded',state_revision=h.revision,clock={'domain':'simulation','time_s':h.time_s},result=result,observations={},error=None) + h._requests[key]=(digest,copy.deepcopy(response)); return response + except ActionRejected as exc: + return dict(protocol_version=PROTOCOL_VERSION,instance_id=instance_id,request_id=request_id,operation_id=None,status='unsupported' if str(exc)=='UNSUPPORTED' else 'rejected',state_revision=h.revision,clock={'domain':'simulation','time_s':h.time_s},result={},observations={},error=dict(code=str(exc),message=str(exc),retryable=False,side_effects='none')) + def write(self, *, instance_id, state_id, value, request_id): + self._target(instance_id); entry=SLOTS.get(state_id) + if not entry or not entry['write']: raise ActionRejected('ACCESS_DENIED') + capability,argument=entry['write']; return self.invoke(instance_id=instance_id,capability_id=capability,arguments={argument:value},request_id=request_id) + def poll(self, operation_id): + h=self._host + if h._owners.get(operation_id)!=self._principal: raise ActionRejected('ACCESS_DENIED') + result=h._result() if operation_id==h.operation_id and h.phase=='running' else h.records.get(operation_id) + if result is None: raise ActionRejected('UNKNOWN_OPERATION') + return dict(operation_id=operation_id,status=result['phase'],result=self._filter_result(result)) + def cancel(self, operation_id, request_id): + self.poll(operation_id); h=self._host + if not isinstance(request_id,str) or not request_id: raise ActionRejected('INVALID_ARGUMENT') + key=(self._principal,request_id) + if key in h._cancel_operations: + if h._cancel_operations[key]!=operation_id: raise ActionRejected('REQUEST_CONFLICT') + return copy.deepcopy(h._requests[key][1]) + if key in h._requests: raise ActionRejected('REQUEST_CONFLICT') + if operation_id!=h.operation_id or h.phase!='running': raise ActionRejected('NOT_RUNNING') + result=self.invoke(instance_id=h.instance_id,capability_id='acquisition.stop',arguments={},request_id=request_id) + if result['status']=='succeeded': h._cancel_operations[key]=operation_id + return result + +EFFECTS={ + 'plant.configure':['plant.configured','thermal.indicated_k','truth.sample_k'], + 'wafer.configure':['wafer.configured'], + 'probe.configure':['probe.configured','calibration.valid','calibration.gain'], + 'sample.load':['sample.present','thermal.indicated_k','truth.sample_k','truth.sample_mass_kg','truth.conducting_thickness_m'], + 'standard.load':['sample.present','thermal.indicated_k','truth.sample_k','truth.sample_mass_kg','truth.conducting_thickness_m'], + 'sample.remove':['sample.present','truth.sample_mass_kg','truth.conducting_thickness_m'], + 'power.set':['display.sheet_resistance_ohm_sq','power.enabled','power.angle_rad','source.warmup_ready','source.warmup_elapsed_s','stage.moving','stage.target_x_m','stage.target_y_m','probe.target_m','acquisition.phase','acquisition.stage','measured.current_a','measured.voltage_v'], + 'stage.move':['stage.target_x_m','stage.target_y_m','stage.moving'], + 'probe.set_contact':['probe.target_m','stage.moving'], + 'enclosure.set_open':['hood.target_angle_rad'], + 'calibration.clear':['calibration.valid','calibration.gain'], + 'acquisition.start':['acquisition.phase','acquisition.stage','acquisition.elapsed_s','acquisition.points','measurement.mean_sheet_resistance_ohm_sq','measurement.selected_current_a','probe.target_m','stage.moving','measured.current_a','measured.voltage_v'], + 'calibration.start':['acquisition.phase','acquisition.stage','acquisition.elapsed_s','acquisition.points','measurement.mean_sheet_resistance_ohm_sq','measurement.selected_current_a','probe.target_m','stage.moving','measured.current_a','measured.voltage_v'], + 'acquisition.stop':['acquisition.phase','acquisition.stage','stage.moving','stage.target_x_m','stage.target_y_m','probe.target_m','measured.current_a','measured.voltage_v'], + 'sim.step':list(SLOTS)} +for k,v in EFFECTS.items():CAPS[k]['effects']=v +ERRORS=sorted(set(__import__('re').findall(r"ActionRejected\('([A-Z_0-9]+)'",Path(__file__).read_text()))|{'POWER_OFF','USER_CANCEL','SOURCE_COMPLIANCE','VOLTAGE_OVERFLOW','REFERENCE_TEMPERATURE_RANGE','CALIBRATION_RANGE','AUTORANGE_UNRESOLVED'}) + +def export_signatone_quadpro2_contract_metadata(): + slots={};caps={} + for k,v in SLOTS.items():slots[k]=dict(meaning_zh=v['meaning'],component_ids=[v['component']],value_schema=copy.deepcopy(v['schema']),unit=v['unit'],reference_conditions='SI; QuadPro2-DAC0/Keithley2450/SP4; thin conducting film on insulating circular substrate, passive thermal boundary.',origin=v['origin'],visibility=v['visibility'],access='read_only',read_binding=dict(backend='host',artifact_id='runtime',accessor=f'SignatoneQuadpro2Session.read(state_ids=[{k!r}])'),write_via=None,sampling=dict(mode='instant',time_domain='simulation',window_description='Motion/electrothermal/warmup/sample clocks advance only with host step. Measurements record endpoint after explicit settled positive/negative current dwell.'),source_ids=['simulation_assumption']) + limits=[ + '固定QuadPro2-DAC0:D为Keithley2450,A自动型,C300mm晶片,0无TCR;不是用其它源表参数替代,基础配置没有主动温控。SP4几何默认50085TRQ(1.27mm、85gf/针、WC、40.64µm tip radius、Q适配)。', + 'wafer直径10至300mm。默认100mm直径、0.5mm绝缘基底上1µm导电膜;导电厚度/密度/Cp/空间分布是宿主假设。geometry.configure式变形未实现,wafer.configure/probe.configure改变过程几何不自动重建静态3D示例。', + '导电层厚度必须不超过针距5%,采用二维薄片模型;0.5mm基底厚度不能被当成导电厚度。厚块晶片、体硅有限厚度、有限接触电流场、各向异性张量未实现。', + '电气接触半径是独立宿主工程输入,不等于厂家针尖球面曲率半径。点源Green用于电压探针;驱动电阻在实际电流接触处按声明接触半径截断对数奇点,附加接触阻抗导热至外界。', + '有限圆片绝缘边界采用Neumann Green同号镜像:g(z,a)=ln(|z-a|/R)+ln|1-z*conj(a)/R²|;源汇差的法向导数在圆周为零。中心大圆极限Rs=(π/ln2)V/I;用Smits1958表及独立边界/互易性检查,不宣称复刻ASTM或厂商内部算法。', + '每点两接线A=I14/V23、B=I13/V24,各正负电流共4次端点观测。这里明确实现这两种接线与圆片校正,不假称已验证OEM Dual Configuration具体私有处理。', + '库提供64种真实实验数字化rho(T),独立插值且限制原论文有效温域;无真实二维map、薄膜厚度或薄膜尺寸效应数据。rho由bulk方向参考转换为薄膜是明确假设。', + '空间梯度/径向项仅局部均匀近似:以测点附近Rs标量缩放均匀圆盘Green,不是解非均匀电导全域PDE,输出地图标synthetic spatial assumption。', + '反演仅使用观察到的±I/±V及几何/外部校正,先得到每配置Rs再平均;提供额外厚度先验才计算rho=Rs*t_prior。不同时从同一VI反演未知rho和未知厚度。', + 'AutoRange只在每幅图的第一个接受测点按实际正反试测逐档寻找电流;全部后续site固定同一选定电流,不每点重新量程。自定义地图最多14000点,不采用另一页5至1400摘要限制;冲突在source_evidence。', + '4相每相至少0.3s,总电测驻留至少1.2s/点,外加真实抬针、XY、下针和settling;首点每个AutoRange档还要实际1.2s。不能用host大dt把这些时长省略。', + 'SP4换针使校准失效。calibration.start用宿主装入的薄膜标样和单独输入参考Rs,实际四相每相至少45s、合计180s,再加移动/量程;增益仅由外部参考/观测比值得出。不把厂家VLSI508µm硅标准硬套本薄膜模型,也不冒充实际NIST证书。', + 'Keithley2450源电流档10nA至1A,每档源分辨率FS*5e-5、观测电流分辨率FS*1e-6;电压观测档20mV至200V,分辨率FS*5e-7。工程增益/偏置/τ不代表厂家精度或噪声分布。10/100nA档明确要求rear triax配置。', + '源量程与电压观测档分离;源compliance≤20V档可至1A,>20V至200V档最多100mA,并同时≤20W;compliance至少源电压档10%;达到compliance/功率限制时实际I下降,电能依实际端压/电流累计并标观测失败,不能组合1A和200V。未利用105%过量程能力。', + 'Signatone D系统原表10µΩ至100MΩ只写Ω,未明确Ω/sq;本模型不把它偷换成面电阻硬范围。输入标样1e-12至1e15Ω/sq仅工程数值域,反演要求正有限,实际读数可解析性由2450电流/电压档、分辨率和compliance限制。', + '2450到额定精度需真实3600s连续上电,warmup状态真实累计。默认require_warmup=False为工程估算,设True会在3600s前拒绝测量/校准;任何模式均不承诺OEM额定精度或系统<1%。', + '本几何工程XY行程±130mm;300mm片的圆形采区须至少20mm边缘排除,属于当前结构代理的安全域而非厂家限制。所有四针接点还须在边界内;被排除点有原因,不伪装为实际测量。', + '机械stage实际位移=-测点坐标,固定世界探针落到wafer指定点;针抬起后才能XY,暗箱合上测量。取消/断电在当前姿态停止,不瞬移归零;仅已完成点输出,热量和质量留账。', + '膜与基底共被动集中热节点,局部附加热容由宿主输入(默认0.1J/K,非整机218kg或夹具质量热容)。源电能=样品焦耳热+接触热外流;载入/移出两种材料质量体积和当前显热明确守恒。', + '所有Session公开result/poll均隐藏所选参考身份,内部evaluator转发同样脱敏;privileged provenance.read单独访问。共享Python/磁盘不是OS隔离。', + '真实仪器、机器人装样、TCR温控、真实标样证书/漂移/OEM准确度、完整非均匀PDE和厚晶片计量、急停硬件电路not_run。'] + for k,v in CAPS.items(): + un=k in UNSUPPORTED;async_=k in ('acquisition.start','calibration.start');caps[k]={key:copy.deepcopy(v[key]) for key in ['input_schema','output_schema','component_ids','function_zh','kind','visibility','example_arguments']} + caps[k].update(availability='unsupported' if un else 'implemented',implementation={layer:'absent' if un or layer in ('scene','robot','hardware') else 'implemented' for layer in ['process','scene','robot','hardware','host']},binding=None if un else dict(backend='host',artifact_id='runtime',entrypoint='asset_runtime.signatone_quadpro2.SignatoneQuadpro2Session.invoke',invocation=f'session.invoke(instance_id="quadpro2_01",capability_id={k!r},arguments={v["example_arguments"]!r},request_id="unique")'),preconditions=[] if un or v['kind'] in ('query','analysis') else [dict(description_zh='运行入口原子核对薄层/参考温域、选型、暗箱/针尖/移动安全域、量程、校准与可选预热。',state_ids=['power.enabled','sample.present','probe.position_m','hood.angle_rad','calibration.valid','source.warmup_ready','acquisition.phase'],enforced_by='runtime',check='SignatoneQuadpro2Runtime.invoke guards before commit')],state_effects=[dict(state_id=s,timing='immediate',description_zh='命令实际即时状态变化') for s in v['effects']],observes=[],model_effects=dict(mode='none',description_zh='仅输出独立可绑定状态;真实姿态/显示联动由场景报告取证。',binding_ids=[]),execution=dict(mode='asynchronous' if async_ else 'synchronous',time_domain='simulation',completion_criterion='真实>=180s校准4相及抬针完成' if k=='calibration.start' else '所有接受点依真实运动/等待/首点量程/四相测量后抬针完成' if async_ else '原子命令;物理推进仅由宿主step',completion_state_ids=['acquisition.phase'] if async_ else [],timeout_s=None,cancellation='supported' if async_ else 'unsupported',retry='same_request_id',resources=['host_clock','xy_stage','sp4_probe','keithley2450_source_meter'],partial_failure_zh='取消/断电截断激励并停当前XY/Z,保留已测点、完成的试量程及已积耗散/显热;不能回滚样品质量或已生热。'),errors=[dict(code=e,meaning_zh=e,side_effects='partial' if async_ and e in ('POWER_OFF','USER_CANCEL','SOURCE_COMPLIANCE','VOLTAGE_OVERFLOW','REFERENCE_TEMPERATURE_RANGE','AUTORANGE_UNRESOLVED') else 'none') for e in ERRORS],verification=[],limitations=limits,source_ids=['manufacturer_primary','simulation_assumption','template_library']) + if k in ('stage.move','probe.set_contact','enclosure.set_open','acquisition.start','calibration.start','power.set'): + caps[k]['state_effects'] += [dict(state_id=s,timing='on_step',description_zh='宿主推进有限运动、真实等待、热量、预热与逐点观测') for s in SLOTS if s not in v['effects'] and s not in ('plant.configured','wafer.configured','probe.configured','sample.present','power.enabled')] + mechanism=dict(component_ids=['controller','source_meter','stage_x','sample_stage','probe_head','sample_wafer','hood'],state_ids=list(slots),meaning_zh='有限圆片薄膜四探针Green几何、首点固定图量程、实际标样反演校准、双接线正反测绘与被动电热质量账',implementation='lumped',equations=[ + 'g(z,a)=ln(|z-a|/R)+ln|1-z*conj(a)/R²|; phi(z)=-(Rs*I/(2*pi))*(g(z,a_source)-g(z,a_sink)). For a source/sink pair the circular boundary has zero normal current. V=phi(c)-phi(d).', + 'For center collinear equally-spaced probes and R/s→infinity, K=ln(2)/pi and Rs=(pi/ln2)*V/I. Finite disk K is evaluated per site/configuration, not an arbitrary edge multiplier.', + 'Configurations A=(source1,sink4,V2-V3),B=(source1,sink3,V2-V4). Rtransfer=(Vpositive-Vnegative)/(Ipositive-Inegative); Rs_config=calibration_gain*Rtransfer/K_config; Rs is the mean of two configurations.', + 'rho_output=Rs*thickness_prior only when an independent thickness prior is supplied; no thickness is inferred from a single four-probe resistance experiment.', + 'Rs_forward(T,x,y)=rho_reference(T)/t_film * [1+gx*x/R+gy*y/R+gr*(x²+y²)/R²]. This is an explicitly local homogeneous approximation to a synthetic spatial profile, not a global nonuniform-conductivity PDE solve.', + 'Rdrive regularizes the same Green source potentials at a declared finite current-contact radius. Iactual=sign(Irequested)*min(abs(Irequested),Vcompliance/(Rdrive+Rcontact),sqrt(20W/(Rdrive+Rcontact)),Isource_range_max), where range max is1A for compliance<=20V and0.1A for>20V through200V; measurement voltage range is independent.', + 'Psource=Iactual²*(Rdrive+Rcontact); Psample=Iactual²*Rdrive; Pcontact_export=Iactual²*Rcontact. Ctotal*dT/dt=Psample-G*(T-Ta); Ctotal=Clocal+mfilm*Cpfilm+msubstrate*Cpsubstrate.', + 'Detector dz/dt=(gain*V+offset-z)/tau, observed voltage/current follow declared2450 resolution steps; source resolutionFS*5e-5, measured IFS*1e-6 and measured VFS*5e-7.', + 'Motion axes advance with explicit finite speed. Stage_xy=-sample_point_xy. Each point spends4*dwell>=1.2s measuring plus motion/settling; initial auto-range trials each use1.2s before locking current for entire map.', + 'Calibration waits4*max(dwell,45s)>=180s and obtains gain=external_standard_Rs/observed_uncorrected_Rs. No hidden gain or reference material property is read by inverse.', + 'Only host step advances axes, powerup3600s warmup clock, sequence events and electrothermal ODE. Fractional nanoseconds carry across normal60Hz floating timesteps. Samples carry independently ledgered sensible heat when loaded or removed.'],parameters={},source_ids=['simulation_assumption','template_library'],limitations=limits) + spec=importlib.util.spec_from_file_location('_quadpro_local_annotations',ROOT/'scripts/asset_runtime/_annotations.py');ann=importlib.util.module_from_spec(spec);spec.loader.exec_module(ann);ann.KEY_ZH.update({k:v['meaning'] for k,v in SLOTS.items()});ann.annotate_export(SLUG,caps,slots,{'four_probe_mapping':mechanism},inputs={'plant.configure':(PLANT,PLANT_EXAMPLE),'wafer.configure':(WAFER,WAFER_EXAMPLE),'probe.configure':(PROBE,PROBE_EXAMPLE),'sample.load':(SAMPLE,SAMPLE_EXAMPLE),'standard.load':(STANDARD,STANDARD_EXAMPLE),'method.configure':(METHOD,METHOD_EXAMPLE),'map.configure':(MAP,MAP_EXAMPLE)}) + for key,value in SLOTS.items():slots[key]['meaning_zh']=value['meaning'] + return dict(asset_type_id=ASSET_TYPE_ID,catalog_id=CATALOG_ID,capabilities=caps,state_slots=slots,mechanisms={'four_probe_mapping':mechanism}) diff --git a/scripts/asset_runtime/zwick_hit5p.py b/scripts/asset_runtime/zwick_hit5p.py new file mode 100644 index 0000000000000000000000000000000000000000..1eaa8c89b3ca03567679afa40c9e5bfff5466d20 --- /dev/null +++ b/scripts/asset_runtime/zwick_hit5p.py @@ -0,0 +1,418 @@ +"""HIT5P / ISO179 .5J: real-time nonlinear pendulum and observed empty correction. +Manual raising / host catching are external engineering actions, not OEM motors. +""" +from __future__ import annotations +import copy,importlib.util,json,math +from pathlib import Path +import numpy as np +from scipy.integrate import solve_ivp +PROTOCOL_VERSION='1.0.0';SLUG='zwick_hit5p';ASSET_TYPE_ID='instrument.'+SLUG;CATALOG_ID='CHEM-145' +ROOT=Path(__file__).resolve().parents[2];ASSET=ROOT/'assets/expansion_batch04/t1_thermal'/SLUG;LIBRARY_PATH=ASSET/'impact_library.json' +RELEASE_ANGLE_RAD=math.radians(135.72);ENCODER_RESOLUTION_RAD=math.radians(.018);NOMINAL_ENERGY_J=.5;STRIKE_RADIUS_M=.25;NOMINAL_SPEED_M_S=2.9 +GRAVITY_COEFFICIENT_NM=NOMINAL_ENERGY_J/(1-math.cos(RELEASE_ANGLE_RAD));INERTIA_KG_M2=2*NOMINAL_ENERGY_J/(NOMINAL_SPEED_M_S/STRIKE_RADIUS_M)**2;SUPPORT_SPAN_M=.062 +class ActionRejected(ValueError):pass + +def number(unit='1',lo=None,hi=None): + s={'type':'number','x-unit':unit} + if lo is not None:s['minimum']=lo + if hi is not None:s['maximum']=hi + return s + +def obj(properties):return dict(type='object',properties=properties,required=list(properties),additionalProperties=False) +def nullable(s):return {'anyOf':[s,{'type':'null'}]} +def array(s,minimum=0,maximum=200001):return dict(type='array',items=s,minItems=minimum,maxItems=maximum) +def enum(items):return {'type':'string','enum':items} +BOOL={'type':'boolean'};TEXT={'type':'string'};PHASE=enum(['idle','running','succeeded','cancelled','failed']) + +def validate(s,v): + if 'anyOf' in s: + for o in s['anyOf']: + try:validate(o,v);return + except ActionRejected:pass + raise ActionRejected('INVALID_ARGUMENT') + k=s.get('type') + if k in ('number','integer'): + if isinstance(v,bool) or not isinstance(v,(int,float)) or not math.isfinite(v) or k=='integer' and type(v) is not int or not s.get('minimum',-math.inf)<=v<=s.get('maximum',math.inf):raise ActionRejected('INVALID_ARGUMENT') + elif k=='object': + if not isinstance(v,dict) or set(v)!=set(s['properties']):raise ActionRejected('INVALID_ARGUMENT') + for key,value in v.items():validate(s['properties'][key],value) + elif k=='array': + if not isinstance(v,list) or not s.get('minItems',0)<=len(v)<=s.get('maxItems',math.inf):raise ActionRejected('INVALID_ARGUMENT') + for x in v:validate(s['items'],x) + elif k=='boolean' and type(v) is not bool:raise ActionRejected('INVALID_ARGUMENT') + elif k=='string' and not isinstance(v,str):raise ActionRejected('INVALID_ARGUMENT') + elif k=='null' and v is not None:raise ActionRejected('INVALID_ARGUMENT') + if 'enum' in s and v not in s['enum']:raise ActionRejected('INVALID_ARGUMENT') + +def library():return {r['id']:r for r in json.loads(LIBRARY_PATH.read_text())['templates']} +def encoder(angle):return round(angle/ENCODER_RESOLUTION_RAD)*ENCODER_RESOLUTION_RAD +PLANT_EXAMPLE=dict(ambient_k=296.15,friction_torque_nm=.001,host_raise_speed_rad_s=1.,shield_speed_rad_s=2.,bearing_heat_capacity_j_k=5.,bearing_conductance_w_k=.2,local_sample_heat_capacity_j_k=.01,sample_conductance_w_k=.03,sample_heat_fraction=.8,accept_engineering=True) +PLANT=obj(dict(ambient_k=number('K',273.15,323.15),friction_torque_nm=number('N*m',0,.1),host_raise_speed_rad_s=number('rad/s',.01,2),shield_speed_rad_s=number('rad/s',.01,5),bearing_heat_capacity_j_k=number('J/K',.001,1e5),bearing_conductance_w_k=number('W/K',1e-9,1e4),local_sample_heat_capacity_j_k=number('J/K',1e-6,100),sample_conductance_w_k=number('W/K',1e-9,1e4),sample_heat_fraction=number('1',0,1),accept_engineering=BOOL)) +FIXTURE_EXAMPLE=dict(standard='ISO179_Charpy',pendulum_energy_j=.5,strike_radius_m=.25,support_span_m=.062,release_angle_rad=RELEASE_ANGLE_RAD,accept_effective_inertia=True) +FIXTURE=obj(dict(standard=enum(['ISO179_Charpy']),pendulum_energy_j=dict(type='number',enum=[.5],**{'x-unit':'J'}),strike_radius_m=dict(type='number',enum=[.25],**{'x-unit':'m'}),support_span_m=dict(type='number',enum=[.062],**{'x-unit':'m'}),release_angle_rad=dict(type='number',enum=[RELEASE_ANGLE_RAD],**{'x-unit':'rad'}),accept_effective_inertia=BOOL)) +SAMPLE_EXAMPLE=dict(reference_id='basf_ultradur_b4520',notch='A',length_m=.08,width_m=.01,thickness_m=.004,notch_depth_m=.002,volume_m3=3.192e-6,mass_kg=.00415,specific_heat_capacity_j_kg_k=1200.,initial_temperature_k=296.15,temperature_tolerance_k=2.,host_charpy_strength_j_m2=None,behavior='energy_threshold',no_break_restitution=.2,accept_reference_transfer_and_fracture_proxy=True) +SAMPLE=obj(dict(reference_id=TEXT,notch=enum(['A','unnotched']),length_m=number('m',.063,.15),width_m=number('m',.001,.03),thickness_m=number('m',.0005,.02),notch_depth_m=number('m',0,.025),volume_m3=number('m^3',1e-10,.001),mass_kg=number('kg',1e-7,.2),specific_heat_capacity_j_kg_k=number('J/(kg*K)',1,1e5),initial_temperature_k=number('K',200,400),temperature_tolerance_k=number('K',0,30),host_charpy_strength_j_m2=nullable(number('J/m^2',1,1e7)),behavior=enum(['energy_threshold','unbreakable_proxy']),no_break_restitution=number('1',0,1),accept_reference_transfer_and_fracture_proxy=BOOL)) +METHOD_EXAMPLE=dict(sample_interval_s=.002,timeout_s=10.,remaining_area_prior_m2=3.2e-5) +METHOD=obj(dict(sample_interval_s=number('s',.001,.1),timeout_s=number('s',2,60),remaining_area_prior_m2=nullable(number('m^2',1e-12,.1)))) +ROW=obj(dict(point_index={'type':'integer','x-unit':'1'},time_s=number('s'),encoder_angle_rad=nullable(number('rad')),kind=enum(['sample','impact','apex']),broken=BOOL)) +VALIDITY=enum(['not_completed','valid','below_working_range','above_working_range','no_break','invalid_speed','temperature_invalid','negative_corrected_energy']) +ANALYSIS=obj(dict(release_angle_rad=number('rad',0,math.pi),rebound_angle_rad=number('rad',-math.pi,math.pi),friction_torque_nm=number('N*m',0,1),remaining_area_prior_m2=nullable(number('m^2',1e-12,.1)),outcome=enum(['break','no_break']))) +ANALYSIS_OUTPUT=obj(dict(raw_energy_j=number('J'),corrected_energy_j=number('J'),impact_strength_j_m2=nullable(number('J/m^2')),validity=VALIDITY,evidence=TEXT)) +RESULT=obj(dict(operation_id=nullable(TEXT),phase=PHASE,mode=TEXT,elapsed_s=number('s'),rows=array(ROW),release_angle_rad=nullable(number('rad')),rebound_angle_rad=nullable(number('rad')),raw_energy_j=nullable(number('J')),corrected_energy_j=nullable(number('J')),impact_strength_j_m2=nullable(number('J/m^2')),observed_impact_speed_m_s=nullable(number('m/s')),outcome=enum(['pending','empty','break','no_break']),validity=VALIDITY,terminal_reason=nullable(TEXT),template_source=nullable(TEXT),evidence=TEXT)) +LEDGER_KEYS=['loaded_mass_kg','removed_mass_kg','sample_mass_kg','mass_residual_kg','loaded_volume_m3','removed_volume_m3','sample_volume_m3','volume_residual_m3','host_work_j','pendulum_kinetic_j','pendulum_potential_j','friction_heat_j','bearing_thermal_j','bearing_heat_export_j','sample_absorbed_j','sample_heat_j','sample_damage_stored_j','sample_thermal_j','sample_heat_export_j','sensible_loaded_j','sensible_removed_j','internal_removed_j','energy_residual_j'] +LEDGER=obj({k:number('kg' if k.endswith('_kg') else 'm^3' if k.endswith('_m3') else 'J') for k in LEDGER_KEYS}) +CAPS={} +def cap(k,s,o,e,c,meaning,visibility='agent',kind='device_command'):CAPS[k]=dict(input_schema=s,output_schema=o,example_arguments=e,component_ids=[c],function_zh=meaning,visibility=visibility,kind=kind,effects=[]) +for k,s,e,c in [('plant.configure',PLANT,PLANT_EXAMPLE,'pendulum'),('fixture.configure',FIXTURE,FIXTURE_EXAMPLE,'fixture_base'),('method.configure',METHOD,METHOD_EXAMPLE,'controller')]:cap(k,s,obj(dict(configured=BOOL)),e,c,'配置工程过程、固定ISO179 .5J/62mm夹具或真实观测采样方法','agent' if k=='method.configure' else 'evaluator','configuration') +cap('sample.load',SAMPLE,obj(dict(present=BOOL)),SAMPLE_EXAMPLE,'sample_left','载入Charpy真实参考及显式温度/几何/破坏代理','evaluator') +cap('sample.remove',obj({}),obj(dict(removed_mass_kg=number('kg'),removed_volume_m3=number('m^3'))),{},'sample_left','取出整条或全部收集碎片,带走质量/显热/损伤能','evaluator') +cap('power.set',obj(dict(enabled=BOOL)),obj(dict(enabled=BOOL)),dict(enabled=True),'power_switch','启停电子显示/记录;掉电不删除自由摆机械能') +cap('shield.set_open',obj(dict(opened=BOOL)),obj(dict(target_angle_rad=number('rad'))),dict(opened=True),'shield','宿主有限速开合已选可选Charpy局部防碎片罩','evaluator') +cap('pendulum.raise',obj({}),obj(dict(target_angle_rad=number('rad'))),{},'pendulum','外部手动抬摆有限速代理;非HIT5P电机或自动回摆','evaluator') +cap('pendulum.catch',obj({}),obj(dict(requested=BOOL)),{},'pendulum','请求宿主在下一实际转折点接住,非仪器自带刹车','evaluator') +cap('calibration.start',obj({}),obj(dict(operation_id=TEXT)),{},'latch','真实空摆至首个回升峰值,以量化角度估计有效摩擦') +cap('calibration.clear',obj({}),obj(dict(valid=BOOL)),{},'controller','清除摩擦校正,不改变机械物理') +cap('acquisition.start',obj({}),obj(dict(operation_id=TEXT)),{},'latch','机械释放后的有限时间Charpy冲击和真实角度记录') +cap('acquisition.stop',obj({}),obj(dict(phase=PHASE,elapsed_s=number('s'))),{},'controller','只停记录,自由摆/撞击/摩擦仍随step继续,不回滚损伤') +cap('acquisition.result',obj({}),RESULT,{},'controller','公开角色统一去选中材料身份的能量与破坏状态','agent','query') +cap('analysis.impact',ANALYSIS,ANALYSIS_OUTPUT,dict(release_angle_rad=RELEASE_ANGLE_RAD,rebound_angle_rad=-1.8,friction_torque_nm=.001,remaining_area_prior_m2=3.2e-5,outcome='break'),'controller','从外部量化角度/独立面积先验反演J与J/m²,非Izod J/m','agent','analysis') +cap('ledger.read',obj({}),LEDGER,{},'controller','受限机械/热/损伤/质量体积账','evaluator','query') +cap('provenance.read',obj({}),obj(dict(current_sample=nullable(TEXT),operation_source=nullable(TEXT))),{},'controller','受限当前和已启动操作来源快照','evaluator','query') +cap('sim.step',obj(dict(dt_s=number('s',0,86400))),obj(dict(time_s=number('s'))),dict(dt_s=.02),'controller','唯一宿主时间推进','evaluator','simulation') +UNSUPPORTED={'hardware.connect':'无真实仪器通信','robot.load':'无机器人装样或机械抓取验证','measurement.izod':'选ISO179 Charpy,未配Izod','measurement.tensile_impact':'未配拉伸冲击夹具/摆锤','measurement.instrumented_force':'无仪器化锤/高速力电子学','pendulum.oem_motor_return':'本HIT5P配置无已证自动回摆','brake.oem_disc':'本HIT5P无已配盘式制动','thermal.set_temperature':'未选冷却/加热附件','accuracy.certification':'没有标准认证或实测噪声数据'} +for k,v in UNSUPPORTED.items():cap(k,obj({}),obj({}),{},'controller',v) +SLOTS={} +def slot(k,s,u,o,c,meaning,vis='agent'):SLOTS[k]=dict(schema=s,unit=u,origin=o,component=c,meaning=meaning,visibility=vis,write=None) +slot('clock.time_s',number('s'),'s','derived','controller','唯一宿主时钟,read不推进') +for k in ['plant.configured','fixture.configured','method.configured','sample.present','sample.broken','sample.spent','power.enabled','pendulum.held','latch.engaged','catch.requested','calibration.valid']:slot(k,BOOL,'1','derived','controller','配置/样品/机械边界状态;不是硬件安全认证') +slot('pendulum.angle_rad',number('rad'),'rad','scene','pendulum','精确场景角:0竖下,+135.72°释放侧;世界轴−Y,受限不可绕过encoder','evaluator') +slot('pendulum.target_angle_rad',number('rad'),'rad','setpoint','pendulum','外部手动抬摆目标,不代表已到达') +slot('encoder.angle_rad',nullable(number('rad')),'rad','sensor','controller','0.018°量化角度,分辨率不代表准确度或随机噪声') +for k in ['shield.angle_rad','shield.target_angle_rad']:slot(k,number('rad'),'rad','scene' if '.angle' in k else 'setpoint','shield','局部可选防碎片罩角度,0闭合/1.1打开') +slot('latch.position_m',number('m'),'m','scene','latch','释放锁扣显示代理,0在正释放角锁入/.004退出,非实测锁扣运动') +slot('power.angle_rad',number('rad'),'rad','scene','power_switch','电子电源显示姿态0/.28') +slot('fragments.offset_m',number('m'),'m','scene','sample_right','破断后两半视觉分離示意.006m,不是碎片弹道或新增能量','evaluator') +slot('calibration.friction_torque_nm',nullable(number('N*m')),'N*m','derived','controller','由实际空摆量化α/β求等效Coulomb摩擦,非隐藏plant参数') +slot('measurement.energy_j',nullable(number('J')),'J','sensor','controller','最后外部角度反演校正吸能,量程有效性另读validity;掉电不亮') +slot('measurement.validity',VALIDITY,'1','derived','controller','当前测量有效性,.5J所选工作范围.05.. .4J') +slot('acquisition.phase',PHASE,'1','derived','controller','异步记录状态,完成/取消不等于机械停摆') +slot('acquisition.elapsed_s',number('s'),'s','derived','controller','记录实际时间') +slot('acquisition.points',{'type':'integer','x-unit':'1'},'1','derived','controller','采样及明确impact/apex事件行数') +for k,u in [('truth.angular_velocity_rad_s','rad/s'),('truth.sample_absorbed_j','J'),('truth.sample_temperature_k','K'),('truth.bearing_temperature_k','K'),('truth.sample_mass_kg','kg')]:slot(k,number(u),u,'process_truth','pendulum','受限非线性摆锤/热库存真值','evaluator') + +def analyze_impact(release_angle_rad,rebound_angle_rad,friction_torque_nm,remaining_area_prior_m2,outcome): + alpha=abs(release_angle_rad);beta=abs(rebound_angle_rad);raw=GRAVITY_COEFFICIENT_NM*(math.cos(beta)-math.cos(alpha));corrected=raw-friction_torque_nm*(alpha+beta) + validity='negative_corrected_energy' if corrected<0 else 'below_working_range' if corrected<.05 else 'above_working_range' if corrected>.4 else 'no_break' if outcome=='no_break' else 'valid' + return dict(raw_energy_j=raw,corrected_energy_j=corrected,impact_strength_j_m2=corrected/remaining_area_prior_m2 if remaining_area_prior_m2 is not None and validity=='valid' else None,validity=validity,evidence='external_quantized_angles_and_empty_swing_correction; independent_remaining_area_prior; ISO179_J_per_m2_not_Izod_J_per_m; not_certified_standard_compliance') + +class ZwickHit5pRuntime: + def __init__(self,instance_id='hit_01'): + self.instance_id=instance_id;self.time_ns=0;self._clock_remainder_ns=0.;self.revision=0;self.power=False;self.plant=None;self.fixture=None;self.method=None;self.sample=None;self.reference=None;self.source=None + self.theta=0.;self.omega=0.;self.mechanical='held';self.raise_target=0.;self._raise_start_ns=0;self._raise_end_ns=0;self._raise_angle0=0.;self._raise_started=False;self._raise_rate=0.;self.shield=1.1;self.shield_target=1.1;self.shield_start=1.1;self.shield_start_ns=0;self.shield_end_ns=0;self.catch_requested=False;self._segment=None;self._pending_impact=False;self._first_apex=False + self.broken=False;self.spent=False;self.absorbed=0.;self.damage=0.;self.bearing_U=0.;self.sample_U=0.;self.calibration=None;self.phase='idle';self.operation_id=None;self.mode='none';self.elapsed=0.;self.rows=[];self._counter=0;self.terminal_reason=None;self._operation_source=None;self._release_observed=None;self._rebound_observed=None;self._observed_speed=None;self._outcome='pending';self._validity='not_completed';self._analysis=None;self.last_energy=None;self.records={};self._principals={};self._requests={};self._owners={};self._cancel_operations={} + self.book={k:0. for k in ['loaded_mass_kg','removed_mass_kg','loaded_volume_m3','removed_volume_m3','host_work_j','friction_heat_j','bearing_heat_export_j','sample_absorbed_j','sample_heat_j','sample_heat_export_j','sensible_loaded_j','sensible_removed_j','internal_removed_j']} + @property + def time_s(self):return self.time_ns/1e9 + def register_principal(self,name,visibility): + if not isinstance(name,str) or not name or visibility not in ('agent','evaluator','debug') or name in self._principals:raise ActionRejected('INVALID_ARGUMENT') + self._principals[name]=visibility + def session(self,name): + if name not in self._principals:raise ActionRejected('ACCESS_DENIED') + return ZwickHit5pSession(self,name) + def _mass(self):return self.sample['mass_kg'] if self.sample else 0. + def _capacity(self):return self.plant['local_sample_heat_capacity_j_k']+(self._mass()*self.sample['specific_heat_capacity_j_kg_k'] if self.sample else 0.) + def _temperature(self):return self.plant['ambient_k']+self.sample_U/self._capacity() if self.plant else 296.15 + def _energy(self):return .5*INERTIA_KG_M2*self.omega**2+GRAVITY_COEFFICIENT_NM*(1-math.cos(self.theta)) + def _latch(self):return self.mechanical=='held' and abs(self.theta-RELEASE_ANGLE_RAD)<1e-10 + def _shield_moving(self):return self.time_ns1e-10 else gravity);C_b=self.plant['bearing_heat_capacity_j_k'];G_b=self.plant['bearing_conductance_w_k'];C_s=self._capacity();G_s=self.plant['sample_conductance_w_k'] + def rhs(t,y): + P=torque*direction*y[1];return [y[1],(-GRAVITY_COEFFICIENT_NM*math.sin(y[0])-torque*direction)/INERTIA_KG_M2,P,P-G_b*y[3]/C_b,-G_s*y[4]/C_s,G_b*y[3]/C_b,G_s*y[4]/C_s] + event_kind='impact' if self._pending_impact else 'apex' + def event(t,y):return y[0] if event_kind=='impact' else y[1] + event.terminal=True;event.direction=-1 if event_kind=='impact' or direction>0 else 1 + y0=np.array([self.theta,self.omega,0.,self.bearing_U,self.sample_U,0.,0.]);sol=solve_ivp(rhs,[0,10],y0,events=event,dense_output=True,method='DOP853',rtol=2e-12,atol=2e-14,max_step=.02) + if not sol.success or not len(sol.t_events[0]):raise RuntimeError('Pendulum event integration failed') + duration=float(sol.t_events[0][0]);end=self.time_ns+max(1,round(duration*1e9));self._segment=dict(start_ns=self.time_ns,end_ns=end,duration=duration,solution=sol.sol,last_y=y0,event=event_kind) + def _propagate_free(self,nxt): + s=self._segment;t=s['duration'] if nxt==s['end_ns'] else (nxt-s['start_ns'])/1e9;y=s['solution'](t);old=s['last_y'];self.theta=float(y[0]);self.omega=float(y[1]);self.book['friction_heat_j']+=float(y[2]-old[2]);self.bearing_U=float(y[3]);self.sample_U=float(y[4]);self.book['bearing_heat_export_j']+=float(y[5]-old[5]);self.book['sample_heat_export_j']+=float(y[6]-old[6]);s['last_y']=y + def _physical_impact(self): + self.theta=0.;self._pending_impact=False;self._first_apex=True + if self.phase=='running': + previous=[r for r in self.rows if r['kind']=='sample' and r['encoder_angle_rad'] is not None][-2:] + if len(previous)==2:self._observed_speed=abs((previous[-1]['encoder_angle_rad']-previous[-2]['encoder_angle_rad'])/(previous[-1]['time_s']-previous[-2]['time_s']))*STRIKE_RADIUS_M + self._record('impact') + if self.sample and not self.spent: + available=.5*INERTIA_KG_M2*self.omega**2;required=self.break_energy + if required is not None and available>=required: + lost=required;self.omega=-math.sqrt(max(0,2*(available-lost)/INERTIA_KG_M2));self.broken=True;self._outcome='break' + else: + retained=available*self.sample['no_break_restitution']**2;lost=available-retained;self.omega=math.sqrt(max(0,2*retained/INERTIA_KG_M2));self._outcome='no_break' + heat=lost*self.plant['sample_heat_fraction'];self.absorbed+=lost;self.book['sample_absorbed_j']+=lost;self.book['sample_heat_j']+=heat;self.sample_U+=heat;self.damage+=lost-heat;self.spent=True + else: + if self.phase=='running':self._outcome='empty' + if abs(self.omega)<1e-10:self.mechanical='held';self._physical_apex() + def _physical_apex(self): + self.omega=0. + if self._first_apex: + self._first_apex=False + if self.phase=='running': + self._rebound_observed=encoder(self.theta);self._record('apex') + if self.mode=='calibration': + alpha=abs(self._release_observed);beta=abs(self._rebound_observed);estimate=GRAVITY_COEFFICIENT_NM*(math.cos(beta)-math.cos(alpha))/(alpha+beta) + if estimate<0:self._finish('failed','INVALID_EMPTY_SWING') + else:self.calibration=estimate;self._validity='valid';self._analysis=analyze_impact(alpha,beta,estimate,None,'no_break');self._finish('succeeded','empty_swing_completed') + else: + self._analysis=analyze_impact(self._release_observed,self._rebound_observed,self.calibration,self.method['remaining_area_prior_m2'],self._outcome);self._validity=self._analysis['validity'];self.last_energy=self._analysis['corrected_energy_j'] + if not self._temperature_valid():self._validity='temperature_invalid';self._analysis['impact_strength_j_m2']=None + elif self._observed_speed is None or not 2.9*.9<=self._observed_speed<=2.9*1.1:self._validity='invalid_speed';self._analysis['impact_strength_j_m2']=None + self._finish('succeeded' if self._validity in ('valid','no_break') else 'failed',self._validity) + if self.catch_requested:self.mechanical='held';self.catch_requested=False + self._segment=None + def invoke(self,capability_id,**arguments): + if capability_id not in CAPS:raise ActionRejected('UNKNOWN_CAPABILITY') + validate(CAPS[capability_id]['input_schema'],arguments);k=capability_id;a=copy.deepcopy(arguments) + if k in UNSUPPORTED:raise ActionRejected('UNSUPPORTED') + if k=='acquisition.result':return self._result() + if k=='ledger.read':return self.ledger() + if k=='provenance.read':return dict(current_sample=self.source,operation_source=self._operation_source) + if k=='analysis.impact':return analyze_impact(**a) + if k=='sim.step':self.step(a['dt_s']);return dict(time_s=self.time_s) + if self.phase=='running' and k not in ('acquisition.stop','power.set','pendulum.catch'):raise ActionRejected('BUSY') + if k=='plant.configure': + if self.plant or self.power or self.sample:raise ActionRejected('PLANT_ALREADY_CONFIGURED') + if not a['accept_engineering']:raise ActionRejected('ENGINEERING_ACCEPTANCE_REQUIRED') + if a['bearing_heat_capacity_j_k']/a['bearing_conductance_w_k']<.001 or a['local_sample_heat_capacity_j_k']/a['sample_conductance_w_k']<.001:raise ActionRejected('THERMAL_TIME_CONSTANT_OUTSIDE_NUMERICAL_DOMAIN') + self.plant=a;out=dict(configured=True) + elif k=='fixture.configure': + if self.sample or self.mechanical!='held':raise ActionRejected('SAMPLE_PRESENT_OR_MOVING') + if not a['accept_effective_inertia']:raise ActionRejected('ENGINEERING_ACCEPTANCE_REQUIRED') + self.fixture=a;self.calibration=None;out=dict(configured=True) + elif k=='method.configure': + nanos=a['sample_interval_s']*1e9 + if abs(nanos-round(nanos))>1e-4:raise ActionRejected('SAMPLING_GRID_RESOLUTION') + self.method=a;out=dict(configured=True) + elif k=='sample.load': + if not self.plant or not self.fixture:raise ActionRejected('CONFIGURATION_REQUIRED') + if self.sample:raise ActionRejected('SAMPLE_PRESENT') + if not self._latch() or self.shield<1.1-1e-12 or self._shield_moving():raise ActionRejected('LOADING_GEOMETRY') + if not a['accept_reference_transfer_and_fracture_proxy']:raise ActionRejected('ENGINEERING_ACCEPTANCE_REQUIRED') + if a['notch_depth_m']>=a['width_m'] or a['notch']=='unnotched' and a['notch_depth_m']!=0 or a['notch']=='A' and a['notch_depth_m']<=0:raise ActionRejected('INVALID_NOTCH_GEOMETRY') + if a['volume_m3']>a['length_m']*a['width_m']*a['thickness_m']+1e-12:raise ActionRejected('INVALID_VOLUME') + ref=library().get(a['reference_id']) + if ref is None:raise ActionRejected('UNKNOWN_REFERENCE') + nominal=ref.get('reference_temperature_K');domain=ref.get('valid_temperature_range_K');T=a['initial_temperature_k'];tol=a['temperature_tolerance_k'] + if nominal is not None and abs(T-nominal)>tol+1e-9 or domain and domain[1]-domain[0]>1e-9 and not domain[0]<=T<=domain[1]:raise ActionRejected('REFERENCE_TEMPERATURE_RANGE') + strength=a['host_charpy_strength_j_m2'];field='charpy_notched_impact_strength_J_m2' if a['notch']=='A' else 'charpy_unnotched_impact_strength_J_m2' + if strength is None:strength=ref.get(field) + if a['behavior']=='energy_threshold' and strength is None:raise ActionRejected('MISSING_CHARPY_REFERENCE_OR_PRIOR') + incoming=a['mass_kg']*a['specific_heat_capacity_j_kg_k']*(T-self.plant['ambient_k']);self.sample=a;self.reference=ref;self.source=json.dumps(dict(reference_id=a['reference_id'],source=ref.get('source'),evidence=ref.get('evidence')),sort_keys=True);self.break_energy=None if a['behavior']=='unbreakable_proxy' else strength*(a['width_m']-a['notch_depth_m'])*a['thickness_m'];self.broken=self.spent=False;self.absorbed=self.damage=0.;self.sample_U+=incoming;self.book['sensible_loaded_j']+=incoming;self.book['loaded_mass_kg']+=a['mass_kg'];self.book['loaded_volume_m3']+=a['volume_m3'];out=dict(present=True) + elif k=='sample.remove': + if not self.sample:raise ActionRejected('NO_SAMPLE') + if not self._latch() or self.shield<1.1-1e-12 or self._shield_moving():raise ActionRejected('LOADING_GEOMETRY') + mass=self._mass();volume=self.sample['volume_m3'];sensible=mass*self.sample['specific_heat_capacity_j_kg_k']*(self._temperature()-self.plant['ambient_k']);self.book['sensible_removed_j']+=sensible;self.book['internal_removed_j']+=self.damage;self.book['removed_mass_kg']+=mass;self.book['removed_volume_m3']+=volume;self.sample_U-=sensible;self.sample=self.reference=self.source=None;self.broken=self.spent=False;self.absorbed=self.damage=0.;out=dict(removed_mass_kg=mass,removed_volume_m3=volume) + elif k=='power.set': + if not self.plant:raise ActionRejected('PLANT_REQUIRED') + if not a['enabled'] and self.phase=='running':self._finish('cancelled','POWER_OFF') + self.power=a['enabled'];out=dict(enabled=self.power) + elif k=='shield.set_open': + if not self.plant:raise ActionRejected('PLANT_REQUIRED') + if self.mechanical!='held':raise ActionRejected('PENDULUM_MOVING') + target=1.1 if a['opened'] else 0.;self.shield_start=self.shield;self.shield_target=target;self.shield_start_ns=self.time_ns;self.shield_end_ns=self.time_ns+math.ceil(abs(target-self.shield)/self.plant['shield_speed_rad_s']*1e9);out=dict(target_angle_rad=target) + elif k=='pendulum.raise': + if not self.plant or not self.fixture:raise ActionRejected('CONFIGURATION_REQUIRED') + if self.mechanical!='held':raise ActionRejected('PENDULUM_MOVING') + if self.shield>1e-12 or self._shield_moving():raise ActionRejected('SHIELD_OPEN') + if self.sample and not self.spent and not self._latch():raise ActionRejected('FRESH_SAMPLE_IN_PATH') + self.raise_target=RELEASE_ANGLE_RAD;distance=RELEASE_ANGLE_RAD-self.theta;self._raise_start_ns=self.time_ns;self._raise_end_ns=self.time_ns+math.ceil(abs(distance)/self.plant['host_raise_speed_rad_s']*1e9);self._raise_angle0=self.theta;self._raise_started=False;self._raise_rate=distance/((self._raise_end_ns-self.time_ns)/1e9) if distance else 0.;self.mechanical='raising' if distance else 'held';out=dict(target_angle_rad=self.raise_target) + elif k=='pendulum.catch': + if self.mechanical!='free':raise ActionRejected('NOT_FREE_SWING') + self.catch_requested=True;out=dict(requested=True) + elif k=='calibration.clear':self.calibration=None;out=dict(valid=False) + elif k in ('calibration.start','acquisition.start'): + if not self.power:raise ActionRejected('POWER_OFF') + if not self.plant or not self.fixture or not self.method:raise ActionRejected('CONFIGURATION_REQUIRED') + if not self._latch():raise ActionRejected('NOT_ARMED') + if self.shield>1e-12 or self._shield_moving():raise ActionRejected('SHIELD_OPEN') + if k=='calibration.start' and self.sample:raise ActionRejected('EMPTY_REQUIRED') + if k=='acquisition.start': + if not self.sample:raise ActionRejected('NO_SAMPLE') + if self.spent:raise ActionRejected('SAMPLE_SPENT') + if self.calibration is None:raise ActionRejected('CALIBRATION_REQUIRED') + if not self._temperature_valid():raise ActionRejected('REFERENCE_TEMPERATURE_RANGE') + self._counter+=1;self.operation_id=f'{self.instance_id}:swing:{self._counter}';self.phase='running';self.mode='calibration' if k=='calibration.start' else 'impact';self.elapsed=0.;self.rows=[];self.terminal_reason=None;self._operation_source=self.source;self._release_observed=encoder(self.theta);self._rebound_observed=self._observed_speed=None;self._outcome='pending';self._validity='not_completed';self._analysis=None;self._start_ns=self.time_ns;self._end_ns=self.time_ns+round(self.method['timeout_s']*1e9);self._period_ns=round(self.method['sample_interval_s']*1e9);self._sample_ns=self.time_ns+self._period_ns;self.mechanical='free';self._pending_impact=True;self._first_apex=False;self.catch_requested=False;self._segment=None;self._record();out=dict(operation_id=self.operation_id) + elif k=='acquisition.stop': + if self.phase!='running':raise ActionRejected('NOT_RUNNING') + self._finish('cancelled','USER_CANCEL');out=dict(phase=self.phase,elapsed_s=self.elapsed) + else:raise ActionRejected('UNKNOWN_CAPABILITY') + self.revision+=1;return copy.deepcopy(out) + def step(self,dt_s): + validate(number('s',0,86400),dt_s);raw=dt_s*1e9+self._clock_remainder_ns;ns=round(raw);self._clock_remainder_ns=raw-ns + if not ns:return + end=self.time_ns+ns + while self.time_nsself.time_ns);dt=(nxt-self.time_ns)/1e9 + if self.mechanical=='free':self._propagate_free(nxt) + elif self.mechanical=='raising': + old=self._energy();self.theta=self._raise_angle0+self._raise_rate*(nxt-self._raise_start_ns)/1e9;heat=self.plant['friction_torque_nm']*abs(self._raise_rate)*dt;self.book['friction_heat_j']+=heat;self.book['host_work_j']+=self._energy()-old+heat;self._cool(dt,heat/dt) + else:self._cool(dt) + self.time_ns=nxt + self.shield=self.shield_target if self.time_ns>=self.shield_end_ns else self.shield_start+(self.shield_target-self.shield_start)*(self.time_ns-self.shield_start_ns)/(self.shield_end_ns-self.shield_start_ns) + if self.phase=='running':self.elapsed=(self.time_ns-self._start_ns)/1e9 + if self.mechanical=='raising' and self.time_ns==self._raise_end_ns: + old=self._energy();self.theta=RELEASE_ANGLE_RAD;self.omega=0.;self.book['host_work_j']+=self._energy()-old;self.mechanical='held' + if self.mechanical=='free' and self._segment and self.time_ns==self._segment['end_ns']: + kind=self._segment['event'];self._segment=None + if kind=='impact':self._physical_impact() + else:self._physical_apex() + if self.phase=='running' and self.time_ns==self._sample_ns:self._record();self._sample_ns+=self._period_ns + if self.phase=='running' and self.time_ns>=self._end_ns:self._finish('failed','OBSERVATION_TIMEOUT') + self.revision+=1 + +class ZwickHit5pSession: + def __init__(self, host, principal_id): self._host = host; self._principal = principal_id + @property + def _role(self): return self._host._principals[self._principal] + def _target(self, instance_id): + if instance_id != self._host.instance_id: raise ActionRejected('UNKNOWN_INSTANCE') + def describe(self, *, instance_id=None, asset_type_id=None): + if (instance_id is None) == (asset_type_id is None): raise ActionRejected('INVALID_ARGUMENT') + if instance_id is not None: self._target(instance_id) + if asset_type_id is not None and asset_type_id != ASSET_TYPE_ID: raise ActionRejected('UNKNOWN_INSTANCE') + meta = export_zwick_hit5p_contract_metadata() + return dict(protocol_version=PROTOCOL_VERSION, asset_type_id=ASSET_TYPE_ID, asset_version='1.0.0', capabilities={k:v for k,v in meta['capabilities'].items() if v['visibility']=='agent' or self._role!='agent'}, state_slots={k:v for k,v in meta['state_slots'].items() if v['visibility']=='agent' or self._role!='agent'}) + def read(self, *, instance_id, state_ids=None): + self._target(instance_id); h=self._host; values=h.read(self._role); ids=list(values) if state_ids is None else state_ids + if not isinstance(ids,list) or any(not isinstance(k,str) for k in ids): raise ActionRejected('INVALID_ARGUMENT') + if any(k not in values for k in ids): raise ActionRejected('ACCESS_DENIED') + return dict(instance_id=instance_id, status='succeeded', state_revision=h.revision, clock={'domain':'simulation','time_s':h.time_s}, observations={k:dict(value=copy.deepcopy(values[k]),unit=SLOTS[k]['unit'],quality='unavailable' if values[k] is None else 'estimated' if SLOTS[k]['origin'] in ('sensor','derived') else 'valid',sample_time_s=h.time_s,sample_window_s=None) for k in ids}) + def _filter_result(self, result): + result = copy.deepcopy(result) + # A bridge may dispatch agent-visible capabilities through a privileged + # session. Public acquisition payloads therefore use the SAME redaction + # for every role. Full provenance has its own evaluator-only capability. + if 'rows' in result and 'template_source' in result: + result['template_source'] = str(LIBRARY_PATH.relative_to(ROOT)) + '; selected record provenance available only through evaluator provenance.read' if result['template_source'] is not None else None + result['evidence'] = 'synthetic_forward_model; quantized_encoder_angles_and_observed_empty_swing_correction; manufacturer_ISO179_scalar_reference_and_explicit_fracture_thermal_proxy; selected record restricted' if result['operation_id'] is not None else 'no_measurement' + return result + def invoke(self, *, instance_id, capability_id, arguments, request_id): + h=self._host + try: + self._target(instance_id) + if not isinstance(capability_id,str) or capability_id not in CAPS: raise ActionRejected('UNKNOWN_CAPABILITY') + if self._role=='agent' and CAPS[capability_id]['visibility']!='agent': raise ActionRejected('ACCESS_DENIED') + if not isinstance(request_id,str) or not request_id: raise ActionRejected('INVALID_ARGUMENT') + validate(CAPS[capability_id]['input_schema'],arguments); key=(self._principal,request_id); digest=json.dumps([capability_id,arguments],sort_keys=True,allow_nan=False) + if key in h._requests: + old,response=h._requests[key] + if old!=digest: raise ActionRejected('REQUEST_CONFLICT') + return copy.deepcopy(response) + if capability_id in ('acquisition.stop','acquisition.result') and self._role=='agent' and h.operation_id and h._owners.get(h.operation_id)!=self._principal: raise ActionRejected('ACCESS_DENIED') + if capability_id=='power.set' and not arguments['enabled'] and h.phase=='running' and self._role=='agent' and h._owners.get(h.operation_id)!=self._principal: raise ActionRejected('ACCESS_DENIED') + result=self._filter_result(h.invoke(capability_id,**arguments)); operation=result.get('operation_id') if capability_id in ('acquisition.start','calibration.start') else None + if operation: h._owners[operation]=self._principal + response=dict(protocol_version=PROTOCOL_VERSION,instance_id=instance_id,request_id=request_id,operation_id=operation,status='accepted' if operation else 'succeeded',state_revision=h.revision,clock={'domain':'simulation','time_s':h.time_s},result=result,observations={},error=None) + h._requests[key]=(digest,copy.deepcopy(response)); return response + except ActionRejected as exc: + return dict(protocol_version=PROTOCOL_VERSION,instance_id=instance_id,request_id=request_id,operation_id=None,status='unsupported' if str(exc)=='UNSUPPORTED' else 'rejected',state_revision=h.revision,clock={'domain':'simulation','time_s':h.time_s},result={},observations={},error=dict(code=str(exc),message=str(exc),retryable=False,side_effects='none')) + def write(self, *, instance_id, state_id, value, request_id): + self._target(instance_id); entry=SLOTS.get(state_id) + if not entry or not entry['write']: raise ActionRejected('ACCESS_DENIED') + capability,argument=entry['write']; return self.invoke(instance_id=instance_id,capability_id=capability,arguments={argument:value},request_id=request_id) + def poll(self, operation_id): + h=self._host + if h._owners.get(operation_id)!=self._principal: raise ActionRejected('ACCESS_DENIED') + result=h._result() if operation_id==h.operation_id and h.phase=='running' else h.records.get(operation_id) + if result is None: raise ActionRejected('UNKNOWN_OPERATION') + return dict(operation_id=operation_id,status=result['phase'],result=self._filter_result(result)) + def cancel(self, operation_id, request_id): + self.poll(operation_id); h=self._host + if not isinstance(request_id,str) or not request_id: raise ActionRejected('INVALID_ARGUMENT') + key=(self._principal,request_id) + if key in h._cancel_operations: + if h._cancel_operations[key]!=operation_id: raise ActionRejected('REQUEST_CONFLICT') + return copy.deepcopy(h._requests[key][1]) + if key in h._requests: raise ActionRejected('REQUEST_CONFLICT') + if operation_id!=h.operation_id or h.phase!='running': raise ActionRejected('NOT_RUNNING') + result=self.invoke(instance_id=h.instance_id,capability_id='acquisition.stop',arguments={},request_id=request_id) + if result['status']=='succeeded': h._cancel_operations[key]=operation_id + return result + +EFFECTS={ + 'plant.configure':['plant.configured','truth.sample_temperature_k','truth.bearing_temperature_k'], + 'fixture.configure':['fixture.configured','calibration.valid','calibration.friction_torque_nm'], + 'method.configure':['method.configured'], + 'sample.load':['sample.present','sample.broken','sample.spent','truth.sample_mass_kg','truth.sample_temperature_k','truth.sample_absorbed_j','fragments.offset_m'], + 'sample.remove':['sample.present','sample.broken','sample.spent','truth.sample_mass_kg','truth.sample_temperature_k','truth.sample_absorbed_j','fragments.offset_m'], + 'power.set':['power.enabled','power.angle_rad','encoder.angle_rad','measurement.energy_j','acquisition.phase'], + 'shield.set_open':['shield.target_angle_rad'], + 'pendulum.raise':['pendulum.target_angle_rad','pendulum.held','latch.engaged','latch.position_m'], + 'pendulum.catch':['catch.requested'], + 'calibration.clear':['calibration.valid','calibration.friction_torque_nm'], + 'acquisition.start':['acquisition.phase','acquisition.elapsed_s','acquisition.points','measurement.validity','pendulum.held','latch.engaged','latch.position_m','catch.requested'], + 'calibration.start':['acquisition.phase','acquisition.elapsed_s','acquisition.points','measurement.validity','pendulum.held','latch.engaged','latch.position_m','catch.requested'], + 'acquisition.stop':['acquisition.phase'], + 'sim.step':list(SLOTS)} +for k,v in EFFECTS.items():CAPS[k]['effects']=v +ERRORS=sorted(set(__import__('re').findall(r"ActionRejected\('([A-Z_0-9]+)'",Path(__file__).read_text()))|{'USER_CANCEL','POWER_OFF','OBSERVATION_TIMEOUT','INVALID_EMPTY_SWING'}) +LIMITATIONS=[ + '固定HIT5P / ISO179 Charpy .5J摆锤010930 / 62mm夹具010961,0.5J不是整机最大5J;释放135.72°、摆长250mm、名义2.9m/s±10%、encoder .018°。厂家工作范围10..80%,即.05.. .4J;范围外可报告估计J但不给有效标准化强度。', + '本HIT5P配置为机械释放,不配自动回摆和盘式制动。pendulum.raise为外部手动有限速代理,pendulum.catch请求宿主在下一转折点接住并保持;它们不是OEM电机/刹车,也未验证机器人抓取/人手安全。', + '当前几何摆轴−Y,0竖下、正角释放侧在+X,负角速度撞击向−X;刀口半径.25m不是所有质量的COM。重力矩K=.5/(1−cosα),有效惯量I=2*.5/(2.9/.25)²由名义规格约束推导,不是独立部件惯量实测。厂家.119kg仅名义总摆锤,70kg整机不当摆锤或热容。', + '自由摆I*θddot=−K*sinθ−τeff*sign(ω)。恒定Coulomb有效摩擦为明确空气/轴承合并近似,不解频率相关空气阻力或轴承温变;实际摩擦功τeff*|dθ|进入局部轴承工程热节点。', + '空摆首回升峰值提供τcal=K*(cosβ−cosα)/(α+β),完全来自量化encoder角度及名义K,不读取hidden friction。样品Eobs=K*(cosβ−cosα)−τcal*(α+β);角度分辨不等于OEM准确度,无经验noise分布。', + '真实厂家61牌号ISO179标量来自各明确温度/缺口工况;N不破、未知值与零吸能不同,绝不把Izod J/m换成Charpy J/m²。原始force/displacement/time曲线缺失,当前前向摆动曲线是synthetic_forward_model。', + '宿主接受的energy-threshold代理在实际θ=0时移除参考Charpy强度×剩余截面积的能量;不解接触力峰值、颈缩、裂纹扩展或支点应变。能量不足或unbreakable代理按显式restitution反弹,partial吸能可记录但不能当完整断裂强度。', + '瞬时冲击是集总离散事件,不声称全带宽碰撞/力传感;破断角速度由真实能量扣除得到。β比例进入样品热,其余进入损伤/新表面库存;所有碎片留在收集边界,取样才携出mass、显热与损伤能。', + '显式非线性/热耦合积分的工程计算域要求bearing C/G及未装样local C/G≥1ms;过快热节点原子拒绝,不把该数值稳定边界当OEM物理限制。', + '宿主抬摆轨迹有限速、理想速度约束;启动/停止的惯性能量计入有符号host work,可回收机械能,不假造有限峰值电机功率。被动换热参数为宿主工程输入,无主动温控附件。', + '采样按宿主定义时间网格,impact/apex额外事件独立标记;首峰值完成记录后摆锤继续自由摆,cancel/掉电亦不删机械能。没有宿主catch时继续至Coulomb静摩擦可支撑位置,自然停摆不强制回到0。', + '默认80×10×4mm、A缺口深2mm,剩余面积32mm²。载入其它过程尺寸不会自动重建固定3D示例;sample mass、volume、Cp为独立宿主先验。破后分离是受限视觉示意,不是碎片弹道或连续变形碰撞表面。', + '单温度参考仅在宿主显式容差内作常数近似,不进行不同温度/缺口/速率数据暗中插值。Coulomb校正、工程移植和代理结果不构成ISO179认证。', + '精确场景摆角/片段位置及过程能量受限evaluator,agent使用量化encoder;所有角色普通结果/poll都隐藏选中牌号/来源。完整来源仅provenance.read;共享磁盘/Python不构成OS隔离。'] +def export_zwick_hit5p_contract_metadata(): + slots={};caps={} + for k,v in SLOTS.items():slots[k]=dict(meaning_zh=v['meaning'],component_ids=[v['component']],value_schema=copy.deepcopy(v['schema']),unit=v['unit'],reference_conditions='SI; selected HIT5P ISO179 Charpy0.5J / .25m /135.72deg /62mm span; external manual raise/catch.',origin=v['origin'],visibility=v['visibility'],access='read_only',read_binding=dict(backend='host',artifact_id='runtime',accessor=f'ZwickHit5pSession.read(state_ids=[{k!r}])'),write_via=None,sampling=dict(mode='instant',time_domain='simulation',window_description='Pure read; encoder quantized0.018deg; rows on method time grid with separate impact/apex events.'),source_ids=['simulation_assumption']) + for k,v in CAPS.items(): + un=k in UNSUPPORTED;async_=k in ('acquisition.start','calibration.start');caps[k]={key:copy.deepcopy(v[key]) for key in ['input_schema','output_schema','component_ids','function_zh','kind','visibility','example_arguments']} + caps[k].update(availability='unsupported' if un else 'implemented',implementation={layer:'absent' if un or layer in ('scene','robot','hardware') else 'implemented' for layer in ['process','scene','robot','hardware','host']},binding=None if un else dict(backend='host',artifact_id='runtime',entrypoint='asset_runtime.zwick_hit5p.ZwickHit5pSession.invoke',invocation=f'session.invoke(instance_id="hit_01",capability_id={k!r},arguments={v["example_arguments"]!r},request_id="unique")'),preconditions=[] if un or v['kind'] in ('query','analysis') else [dict(description_zh='入口原子核对ISO179 .5J选型、抬摆锁止、罩位置、空摆校准和实际样品前提。',state_ids=['power.enabled','sample.present','pendulum.held','latch.engaged','shield.angle_rad','acquisition.phase'],enforced_by='runtime',check='ZwickHit5pRuntime.invoke')],state_effects=[dict(state_id=s,timing='on_step' if k=='sim.step' else 'immediate',description_zh='设定或操作标志;真实机械/温度/角度读数仅step推进') for s in v['effects']],observes=[],model_effects=dict(mode='none',description_zh='运行层输出供scene独立绑定验证的状态,不直接写几何',binding_ids=[]),execution=dict(mode='asynchronous' if async_ else 'synchronous',time_domain='simulation',completion_criterion='释放、实际冲击和首回升角观测完成;记录结束不代表机械停摆' if async_ else '原子配置/外部动作请求,实际状态由step推进',completion_state_ids=['acquisition.phase'] if async_ else [],timeout_s=None,cancellation='supported' if async_ else 'unsupported',retry='same_request_id',resources=['host_clock','pendulum','ISO179_fixture','encoder'],partial_failure_zh='停止记录保留全部已点/机械能/破坏/热与库存;自由摆继续至外部catch或自然静止。'),errors=[dict(code=e,meaning_zh=e,side_effects='partial' if async_ and e in ('USER_CANCEL','POWER_OFF','OBSERVATION_TIMEOUT','INVALID_EMPTY_SWING') else 'none') for e in ERRORS],verification=[],limitations=LIMITATIONS,source_ids=['manufacturer_primary','simulation_assumption','template_library']) + if k in ('acquisition.start','calibration.start','pendulum.raise','pendulum.catch','shield.set_open'): + caps[k]['state_effects'] += [dict(state_id=s,timing='on_step',description_zh='由统一宿主时钟推进非线性摆动、摩擦/冲击/被动热及量化encoder') for s in SLOTS if s not in v['effects'] and SLOTS[s]['origin'] in ('sensor','derived','scene','process_truth')] + mechanism=dict(component_ids=['pendulum','striker','latch','fixture_base','sample_left','sample_right','controller'],state_ids=list(slots),meaning_zh='ISO179 .5J非线性摆动、实际空摆角度摩擦校正、能量阈值破坏/反弹和可守恒热库存',implementation='lumped',equations=['Kgrav=.5/(1-cos(alpha)); I=2*.5/(2.9/.25)^2; alpha=135.72deg.','Emechanical=0.5*I*omega²+Kgrav*(1-cos(theta)); I*domega/dt=-Kgrav*sin(theta)-tau*sign(omega).','Pfriction=tau*abs(omega); passive bearing/sample heat nodes retain and export energy.','At theta=0: break iff kinetic>=explicit threshold aCharpy*Aremaining; omega_after=-sqrt(2*(kinetic-threshold)/I).','No-break: omega_after=+restitution*abs(omega_before), absorbed=(1-restitution²)*kinetic; no complete-break strength inferred.','Qsample=heat_fraction*absorbed; remaining absorbed stored as damage/surface energy.','Calibration from observed empty alpha,beta: tau_est=Kgrav*(cos(beta)-cos(alpha))/(alpha+beta).','Observed absorbed energy=Kgrav*(cos(beta)-cos(alpha))-tau_est*(alpha+beta); aCharpy=Eobs/Aremaining_prior only for complete valid break and supplied independent area.','External host raising: dWhost=dEmechanical+dQfriction, including ideal velocity boundary kinetic change; at-turn catch imposes hold at omega0 without energy deletion.','Host sole clock; free-flight dense ODE segments anchored at physical events and integer-nanosecond sampling grid with fractional-nanosecond carry.'],parameters={},source_ids=['simulation_assumption','template_library'],limitations=LIMITATIONS) + spec=importlib.util.spec_from_file_location('_hit_local_annotations',ROOT/'scripts/asset_runtime/_annotations.py');ann=importlib.util.module_from_spec(spec);spec.loader.exec_module(ann);ann.KEY_ZH.update({k:v['meaning'] for k,v in SLOTS.items()});ann.annotate_export(SLUG,caps,slots,{'charpy_pendulum':mechanism},inputs={'plant.configure':(PLANT,PLANT_EXAMPLE),'fixture.configure':(FIXTURE,FIXTURE_EXAMPLE),'sample.load':(SAMPLE,SAMPLE_EXAMPLE),'method.configure':(METHOD,METHOD_EXAMPLE)}) + for k,v in SLOTS.items():slots[k]['meaning_zh']=v['meaning'] + return dict(asset_type_id=ASSET_TYPE_ID,catalog_id=CATALOG_ID,capabilities=caps,state_slots=slots,mechanisms={'charpy_pendulum':mechanism}) diff --git a/scripts/asset_runtime/zwick_mflow.py b/scripts/asset_runtime/zwick_mflow.py new file mode 100644 index 0000000000000000000000000000000000000000..955c53a4b17f81d7370b4e25d5c92c382716d547 --- /dev/null +++ b/scripts/asset_runtime/zwick_mflow.py @@ -0,0 +1,1350 @@ +"""CHEM-146 ZwickRoell Mflow 1128610 extrusion plastometer runtime (ISO 1133 methods A and B, SI units). + +Physics owned by the host clock (``step`` is the only entry that advances time): + * barrel/furnace lumped heat node with a PI controller (heater limited by an explicit engineering power), ambient loss; + * polymer charge: enthalpy with sensible + latent (melting range) terms, pellet compaction (bulk -> melt density), + heat exchange with the barrel, thermal-history clock above the melting onset; + * die flow: reference MVR of the selected manufacturer record transferred to the actual condition with explicit + host priors (power-law index n, flow activation energy Ea, thermal-history rate) and the piston friction: + Q = MVR_ref * ((m g - F_f) / (m_ref g))^(1/n) * exp(-(Ea / (n R)) (1/T - 1/T_ref)) * exp(k_h t_hist) * phi^3 ; + * piston rides on the charge column (compaction + extrusion), weight potential energy -> friction heat (barrel) and + pressure work (charge); manual host withdraw / insert at finite speed; + * automatic cutter: alternate blade half turns, the strand is severed when the blade crosses pi/2; + * external RS-232 analytical balance proxy with settling time, resolution, gain/offset (no built-in balance); + * displacement encoder (0.003 mm), time base (0.002 s), temperature display (0.01 K) quantisation. +A single MVR/MFR scalar does not identify the rheology: n, Ea, melt density, cp, latent heat, compaction and history are +explicit host priors (evidence = assumption). The observed results are computed only from quantised observations. +""" +from __future__ import annotations + +import copy +import json +import math +import re +from pathlib import Path + +PROTOCOL_VERSION = '1.0.0' +SLUG = 'zwick_mflow' +ASSET_TYPE_ID = 'instrument.' + SLUG +CATALOG_ID = 'CHEM-146' +ROOT = Path(__file__).resolve().parents[2] +ASSET = ROOT / 'assets/expansion_batch04/t1_thermal' / SLUG +LIBRARY_PATH = ASSET / 'melt_flow_library.json' + +# ---------------------------------------------------------------- documented / standard constants +GRAVITY = 9.80665 +GAS_CONSTANT = 8.314462618 +BARREL_DIAMETER_M = 0.00955 # 1128612 (documented) +PISTON_HEAD_DIAMETER_M = 0.009474 # ISO 1133-1 piston head +STANDARD_AREA_M2 = math.pi / 4 * ((BARREL_DIAMETER_M + PISTON_HEAD_DIAMETER_M) / 2) ** 2 # ISO mean area, 0.711 cm^2 +DIE_DIAMETER_M = 0.002095 # 312342 (documented) +DIE_LENGTH_M = 0.008 +DIE_AREA_M2 = math.pi * DIE_DIAMETER_M ** 2 / 4 +BARREL_LENGTH_M = 0.180 +PISTON_TRAVEL_M = BARREL_LENGTH_M +PISTON_LOAD_KG = 0.325 # the piston alone is the 0.325 kg load stage (documented) +LOAD_RANGE_KG = (0.325, 21.6) # documented total test load range +TEMPERATURE_RANGE_K = (323.15, 723.15) # documented 50 .. 450 degC +ENCODER_RESOLUTION_M = 3e-6 # documented 0.003 mm +TIME_RESOLUTION_S = 0.002 # documented 0.002 s +TEMPERATURE_DISPLAY_RESOLUTION_K = 0.01 # documented "< 0.1 K"; this model shows 0.01 K steps +CONNECTED_APPARENT_POWER_VA = 700.0 # documented 0.7 kVA full load (not the heater power) +MFR_RANGE_KG_S = (0.1e-3 / 600, 2000e-3 / 600) # product page approx. 0.1 .. 2000 g/10 min +# transducer arm (same geometry as outputs/.../interface_definition.py; checked by the tests) +SENSOR_ZERO_POSITION_M = 0.050 +SENSOR_ARM_LENGTH_M = 0.140 +SENSOR_ELEVATION_MAX_RAD = 0.42 +SENSOR_REFERENCE_ELEVATION_RAD = math.asin(-SENSOR_ZERO_POSITION_M / SENSOR_ARM_LENGTH_M) +SENSOR_RANGE_M = (0.0, SENSOR_ZERO_POSITION_M + SENSOR_ARM_LENGTH_M * math.sin(SENSOR_ELEVATION_MAX_RAD)) +CUTTER_TRAVEL_RAD = math.pi +POWER_SWITCH_ON_RAD = 0.28 +MAX_SUBSTEP_S = 0.05 +MIN_PISTON_M = 0.005 # the piston must stay above the die (end of usable charge) +LIVE_MVR_WINDOW_S = 4.0 + + +class ActionRejected(ValueError): + pass + + +# ---------------------------------------------------------------- schema helpers +def number(unit='1', lo=None, hi=None): + s = {'type': 'number', 'x-unit': unit} + if lo is not None: + s['minimum'] = lo + if hi is not None: + s['maximum'] = hi + return s + + +def obj(properties): + return dict(type='object', properties=properties, required=list(properties), additionalProperties=False) + + +def nullable(s): + return {'anyOf': [s, {'type': 'null'}]} + + +def array(s, minimum=0, maximum=200001): + return dict(type='array', items=s, minItems=minimum, maxItems=maximum) + + +def enum(items): + return {'type': 'string', 'enum': list(items)} + + +BOOL = {'type': 'boolean'} +TEXT = {'type': 'string'} +INT = {'type': 'integer', 'x-unit': '1'} +PHASE = enum(['idle', 'running', 'succeeded', 'cancelled', 'failed']) + + +def validate(s, v): + if 'anyOf' in s: + for o in s['anyOf']: + try: + validate(o, v) + return + except ActionRejected: + pass + raise ActionRejected('INVALID_ARGUMENT') + k = s.get('type') + if k in ('number', 'integer'): + if isinstance(v, bool) or not isinstance(v, (int, float)) or not math.isfinite(v) or (k == 'integer' and type(v) is not int): + raise ActionRejected('INVALID_ARGUMENT') + if not s.get('minimum', -math.inf) <= v <= s.get('maximum', math.inf): + raise ActionRejected('INVALID_ARGUMENT') + elif k == 'object': + if not isinstance(v, dict) or set(v) != set(s['properties']): + raise ActionRejected('INVALID_ARGUMENT') + for key, value in v.items(): + validate(s['properties'][key], value) + elif k == 'array': + if not isinstance(v, list) or not s.get('minItems', 0) <= len(v) <= s.get('maxItems', math.inf): + raise ActionRejected('INVALID_ARGUMENT') + for x in v: + validate(s['items'], x) + elif k == 'boolean' and type(v) is not bool: + raise ActionRejected('INVALID_ARGUMENT') + elif k == 'string' and not isinstance(v, str): + raise ActionRejected('INVALID_ARGUMENT') + elif k == 'null' and v is not None: + raise ActionRejected('INVALID_ARGUMENT') + if 'enum' in s and v not in s['enum']: + raise ActionRejected('INVALID_ARGUMENT') + + +_LIBRARY = None + + +def library(): + global _LIBRARY + if _LIBRARY is None: + _LIBRARY = {r['id']: r for r in json.loads(LIBRARY_PATH.read_text())['templates']} + return _LIBRARY + + +def quantize(value, step): + return round(value / step) * step + + +def sensor_arm_angle(position_m): + """Transducer-arm joint angle (0 = reference pose, piston on the die); upper stop beyond ~107 mm.""" + s = (position_m - SENSOR_ZERO_POSITION_M) / SENSOR_ARM_LENGTH_M + if s >= math.sin(SENSOR_ELEVATION_MAX_RAD): + elevation = SENSOR_ELEVATION_MAX_RAD + else: + elevation = math.asin(max(s, math.sin(SENSOR_REFERENCE_ELEVATION_RAD))) + return elevation - SENSOR_REFERENCE_ELEVATION_RAD + + +# ---------------------------------------------------------------- inputs +PLANT_EXAMPLE = dict(ambient_k=296.15, barrel_heat_capacity_j_k=900.0, barrel_loss_w_k=0.55, heater_max_w=450.0, controller_gain_w_k=80.0, + controller_integral_s=120.0, sample_conductance_w_k=0.25, piston_friction_n=0.30, manual_piston_speed_m_s=0.02, + cutter_half_turn_s=0.25, accept_engineering=True) +PLANT = obj(dict(ambient_k=number('K', 273.15, 323.15), barrel_heat_capacity_j_k=number('J/K', 100.0, 5000.0), barrel_loss_w_k=number('W/K', 0.01, 10.0), + heater_max_w=number('W', 10.0, CONNECTED_APPARENT_POWER_VA), controller_gain_w_k=number('W/K', 1.0, 2000.0), + controller_integral_s=number('s', 5.0, 10000.0), sample_conductance_w_k=number('W/K', 0.001, 20.0), + piston_friction_n=number('N', 0.0, 3.0), manual_piston_speed_m_s=number('m/s', 0.001, 0.1), cutter_half_turn_s=number('s', 0.05, 5.0), + accept_engineering=BOOL)) +SAMPLE_EXAMPLE = dict(reference_id='basf_ultradur_b4520', reference_temperature_k=523.15, reference_load_kg=2.16, mass_kg=0.0060, + bulk_density_kg_m3=800.0, melt_density_kg_m3=1110.0, specific_heat_j_kg_k=1900.0, initial_temperature_k=296.15, + melting_low_k=488.15, melting_high_k=498.15, latent_heat_j_kg=48000.0, power_law_index=0.75, + activation_energy_j_mol=50000.0, history_rate_per_s=5e-5, accept_rheology_thermal_density_and_packing_assumptions=True) +SAMPLE = obj(dict(reference_id=TEXT, reference_temperature_k=number('K', 323.15, 723.15), reference_load_kg=number('kg', 0.325, 21.6), + mass_kg=number('kg', 1e-4, 0.02), bulk_density_kg_m3=number('kg/m^3', 100.0, 3000.0), melt_density_kg_m3=number('kg/m^3', 300.0, 3000.0), + specific_heat_j_kg_k=number('J/(kg*K)', 300.0, 5000.0), initial_temperature_k=number('K', 273.15, 373.15), + melting_low_k=number('K', 273.15, 723.15), melting_high_k=number('K', 273.15, 723.15), latent_heat_j_kg=number('J/kg', 0.0, 3e5), + power_law_index=number('1', 0.2, 1.0), activation_energy_j_mol=number('J/mol', 0.0, 2e5), history_rate_per_s=number('1/s', -0.005, 0.005), + accept_rheology_thermal_density_and_packing_assumptions=BOOL)) +METHOD_EXAMPLE = dict(test_load_kg=2.16, preheat_time_s=300.0, duration_s=240.0, sample_interval_s=0.2, cut_interval_s=10.0, + window_upper_m=0.050, window_lower_m=0.020, temperature_tolerance_k=0.5, automatic_weighing=True) +METHOD = obj(dict(test_load_kg=number('kg', 0.325, 21.6), preheat_time_s=number('s', 60.0, 3600.0), duration_s=number('s', 1.0, 3600.0), + sample_interval_s=number('s', TIME_RESOLUTION_S, 30.0), cut_interval_s=nullable(number('s', 0.5, 600.0)), + window_upper_m=number('m', 0.005, 0.075), window_lower_m=number('m', 0.005, 0.075), temperature_tolerance_k=number('K', 0.01, 5.0), + automatic_weighing=BOOL)) +BALANCE_EXAMPLE = dict(resolution_kg=1e-7, gain=1.0, offset_kg=0.0, settling_s=4.0, accept_external_balance_proxy=True) +BALANCE = obj(dict(resolution_kg=number('kg', 1e-9, 1e-3), gain=number('1', 0.5, 1.5), offset_kg=number('kg', -1e-3, 1e-3), settling_s=number('s', 0.01, 120.0), + accept_external_balance_proxy=BOOL)) +CAL_ENCODER = obj(dict(observed_low_m=number('m', -0.01, 0.2), observed_high_m=number('m', -0.01, 0.2), reference_low_m=number('m', 0.0, 0.2), reference_high_m=number('m', 0.0, 0.2))) +CAL_BALANCE = obj(dict(observed_low_kg=number('kg', -1e-3, 0.2), observed_high_kg=number('kg', -1e-3, 0.2), reference_low_kg=number('kg', 0.0, 0.2), reference_high_kg=number('kg', 0.0, 0.2))) +ROW = obj(dict(point_index=INT, time_s=number('s'), encoder_position_m=nullable(number('m')), temperature_k=nullable(number('K')), + quality=enum(['ok', 'encoder_out_of_range', 'power_off']))) +SEGMENT = obj(dict(segment_id=TEXT, start_time_s=nullable(number('s')), end_time_s=number('s'), duration_s=nullable(number('s')), + observed_mass_kg=nullable(number('kg')), status=enum(['unweighed', 'weighing', 'weighed']), measurement_segment=BOOL)) +FLOW = obj(dict(mvr_m3_s=nullable(number('m^3/s')), mvr_cm3_10min=nullable(number('cm^3/(10min)')), mfr_kg_s=nullable(number('kg/s')), + mfr_g_10min=nullable(number('g/(10min)')), density_at_test_temperature_kg_m3=nullable(number('kg/m^3')), + window_positions_m=nullable(array(number('m'), 2, 2)), window_times_s=nullable(array(number('s'), 2, 2)), weighed_segments=INT, evidence=TEXT)) +VALIDITY = enum(['not_completed', 'valid', 'window_not_traversed', 'temperature_out_of_tolerance', 'preheat_below_iso_minimum', 'sample_exhausted', 'cancelled']) +RESULT = obj(dict(operation_id=nullable(TEXT), phase=PHASE, elapsed_s=number('s'), test_temperature_k=nullable(number('K')), test_load_kg=nullable(number('kg')), + rows=array(ROW), segments=array(SEGMENT, 0, 10000), flow=nullable(FLOW), validity=VALIDITY, terminal_reason=nullable(TEXT), + template_source=nullable(TEXT), evidence=TEXT)) +ANALYSIS = obj(dict(start_position_m=number('m', 0.0, 0.2), end_position_m=number('m', 0.0, 0.2), start_time_s=number('s', 0.0, 1e9), end_time_s=number('s', 0.0, 1e9), + area_prior_m2=number('m^2', 1e-6, 1e-3), weighed_segments=array(obj(dict(mass_kg=number('kg', 0.0, 1.0), duration_s=number('s', TIME_RESOLUTION_S, 1e6))), 0, 10000), + melt_density_prior_kg_m3=nullable(number('kg/m^3', 100.0, 5000.0)))) +ANALYSIS_OUTPUT = obj(dict(mvr_m3_s=number('m^3/s'), mvr_cm3_10min=number('cm^3/(10min)'), mfr_kg_s=nullable(number('kg/s')), mfr_g_10min=nullable(number('g/(10min)')), + density_derived_mfr_kg_s=nullable(number('kg/s')), density_at_test_temperature_kg_m3=nullable(number('kg/m^3')), evidence=TEXT)) +LEDGER_KEYS = ['loaded_mass_kg', 'sample_mass_kg', 'strand_mass_kg', 'segments_mass_kg', 'collected_mass_kg', 'removed_mass_kg', 'extruded_mass_kg', 'mass_residual_kg', + 'heater_input_j', 'host_work_j', 'loaded_enthalpy_j', 'barrel_thermal_j', 'sample_enthalpy_j', 'load_potential_j', 'ambient_export_j', + 'extruded_enthalpy_j', 'removed_enthalpy_j', 'friction_heat_j', 'pressure_work_j', 'energy_residual_j'] +LEDGER = obj({k: number('kg' if k.endswith('_kg') else 'J') for k in LEDGER_KEYS}) + +# ---------------------------------------------------------------- capabilities +CAPS = {} + + +def cap(k, s, o, e, c, meaning, visibility='agent', kind='device_command'): + CAPS[k] = dict(input_schema=s, output_schema=o, example_arguments=e, component_ids=[c], function_zh=meaning, visibility=visibility, kind=kind, effects=[]) + + +CONFIGURED = obj(dict(configured=BOOL)) +cap('plant.configure', PLANT, CONFIGURED, PLANT_EXAMPLE, 'heater', '宿主声明炉体热容/散热、加热器上限与PI控温参数、活塞摩擦、手动速度和切刀半圈时间(工程参数,须显式接受)', 'evaluator', 'configuration') +cap('balance.configure', BALANCE, CONFIGURED, BALANCE_EXAMPLE, 'balance_rs232', '配置外接分析天平代理(分辨率、增益/偏置、稳定时间);Mflow本身没有内置天平', 'evaluator', 'configuration') +cap('method.configure', METHOD, CONFIGURED, METHOD_EXAMPLE, 'controller', '设定方法:试验载荷、预热时间、最长采集时间、采样与切断间隔、活塞位移窗口、温度容差、自动称量', 'agent', 'configuration') +cap('power.set', obj(dict(enabled=BOOL)), obj(dict(enabled=BOOL)), dict(enabled=True), 'power_switch', '开关整机电源;断电停止加热与切刀、取消进行中的采集,已发生的挤出/热量/切段保留') +cap('thermal.set_temperature', obj(dict(target_k=number('K', *TEMPERATURE_RANGE_K))), obj(dict(target_k=number('K'))), dict(target_k=523.15), 'heater', + '只写入料筒目标温度(50–450°C);实际温度由PI控温随宿主step演化') +cap('weight.configure', obj(dict(total_load_kg=number('kg', *LOAD_RANGE_KG))), obj(dict(total_load_kg=number('kg'))), dict(total_load_kg=2.16), 'test_weight', + '宿主手动在活塞上放/换砝码,设定总试验载荷(含0.325kg活塞,不重复加算);砝码势能变化计入宿主功', 'evaluator') +cap('sample.load', SAMPLE, obj(dict(present=BOOL, column_height_m=number('m'))), SAMPLE_EXAMPLE, 'barrel', + '宿主经漏斗把颗粒/粉末装入料筒(活塞须已抽出);绑定厂家MVR参考记录与显式熔体密度/比热/潜热/幂律/活化能/热历史先验', 'evaluator') +cap('sample.remove', obj({}), obj(dict(removed_mass_kg=number('kg'))), {}, 'barrel', '宿主清筒带走剩余料及其焓;已挤出的挤出丝/切段不受影响', 'evaluator') +cap('piston.withdraw', obj({}), obj(dict(target_m=number('m'))), {}, 'piston', '宿主以有限速度把活塞(连同砝码)提到料筒口上方;不是气动提升选件', 'evaluator') +cap('piston.insert', obj({}), obj(dict(target_m=number('m'))), {}, 'piston', '宿主以有限速度放下活塞,直到压在料柱上(或落到口模上);之后砝码载荷作用于料柱', 'evaluator') +cap('cutter.cut', obj({}), obj(dict(requested=BOOL)), {}, 'cutter', '切刀转半圈;刀片经过口模下方(π/2)时切断当前挤出丝,形成一个切段(面板“循环”键同此能力)') +CAPS['cutter.cut']['component_ids'] = ['cutter', 'button_cycle'] +cap('collection.clear', obj({}), obj(dict(collected_mass_kg=number('kg'))), {}, 'collection_tray', '宿主清走收集区全部切段与挂在口模下的挤出丝(称量记录保留)', 'evaluator') +cap('balance.weigh', obj(dict(segment_id=TEXT)), obj(dict(requested=BOOL)), dict(segment_id='mflow_01:acq:1:segment:2'), 'balance_rs232', + '请求外接分析天平称量一个切段;经过稳定时间后按分辨率/标定给出观测质量') +cap('calibration.encoder', CAL_ENCODER, obj(dict(scale=number('1'), offset_m=number('m'))), dict(observed_low_m=0.010, observed_high_m=0.060, reference_low_m=0.010, reference_high_m=0.060), + 'displacement_sensor', '用独立长度标准的两点观测修正位移读数(只用宿主给的观测/参考值,不读过程真值)', 'evaluator') +cap('calibration.balance', CAL_BALANCE, obj(dict(scale=number('1'), offset_kg=number('kg'))), dict(observed_low_kg=0.0, observed_high_kg=0.001, reference_low_kg=0.0, reference_high_kg=0.001), + 'balance_rs232', '用标准砝码两点观测修正外接天平读数', 'evaluator') +cap('acquisition.start', obj({}), obj(dict(operation_id=TEXT)), {}, 'button_start', + '开始采集:核对通电、方法、试样已装且活塞压在料柱上、载荷与方法一致、预热已满、炉温在容差内;先切一次清除预热期挤出物,再按间隔切段并记录位移/时间/温度') +cap('acquisition.stop', obj({}), obj(dict(phase=PHASE, elapsed_s=number('s'))), {}, 'button_stop', '只终止记录与后续自动切断;已挤出物、切段和热状态保留,活塞继续在载荷下下降') +cap('acquisition.result', obj({}), RESULT, {}, 'controller', '返回按观测(量化位移/时间、外部称量)计算的MVR/MFR、切段表与有效性;所有角色都隐去所选材料身份', 'agent', 'query') +cap('analysis.flow', ANALYSIS, ANALYSIS_OUTPUT, dict(start_position_m=0.050, end_position_m=0.020, start_time_s=0.0, end_time_s=60.0, area_prior_m2=STANDARD_AREA_M2, + weighed_segments=[dict(mass_kg=0.0002, duration_s=10.0)], melt_density_prior_kg_m3=None), + 'controller', 'ISO 1133纯函数分析:MVR=A·Δx/Δt(A为独立面积先验),MFR=Σm/Σt,按需给出密度换算;不读取过程真值', 'agent', 'analysis') +cap('ledger.read', obj({}), LEDGER, {}, 'controller', '受限质量/能量账本(装料、挤出、清筒、热输入、散热、摩擦、压力功、势能)', 'evaluator', 'query') +cap('provenance.read', obj({}), obj(dict(current_sample=nullable(TEXT), operation_source=nullable(TEXT))), {}, 'controller', '受限:当前试样与最近采集所用参考记录的来源', 'evaluator', 'query') +cap('sim.step', obj(dict(dt_s=number('s', 0.0, 86400.0))), obj(dict(time_s=number('s'))), dict(dt_s=0.2), 'controller', '唯一宿主时间推进(纳秒整数时钟,余数累计)', 'evaluator', 'simulation') +UNSUPPORTED = { + 'hardware.connect': '无真实Ethernet/RS-232/USB通信或testXpert连接', + 'robot.load': '无机器人装料、压实与清筒验证', + 'pneumatic.lift': '未选气动砝码提升单元1128621', + 'pneumatic.load_selector': '未选带选重器的气动提升单元1128624', + 'die.plug': '未选口模塞1128618(高MFR防预流)', + 'die.change': '未建模更换口模;固定标准口模312342(手腕一转解锁口模的动作不在本资产能力内)', + 'method.astm_c_half_die': '未选半口模325554(ASTM D1238方法C)', + 'material.fluorinated_or_pvc': '所选料筒1128612与活塞1128614为非含氟材料用;含氟材料需耐酸料筒1128613/活塞1128615,PVC需口模092326(ASTM D3364),均未选。口模312342本身为烧结耐磨耐酸件、厂家列为含氟与非含氟材料通用', + 'cleaning.pneumatic_function': '未选清洗功能1128622', + 'preload.function': '未选预热期附加预载1128623', + 'piston.preheat_hold': '未选预热位活塞保持装置1128627(可在预热期完全卸载熔体、避免提前流出);本资产预热期由宿主只放活塞0.325kg', + 'collection.separating_pane': '未选收集单个挤出物的分隔板1128619', + 'thermal.recool': '未选压缩空气回冷单元090173(厂家:平均缩短约50%冷却时间);本资产只有自然冷却', + 'accuracy.certification': '没有ISO 1133-2温度准确度认证、天平计量证书或厂家准确度实验', +} +for k, v in UNSUPPORTED.items(): + cap(k, obj({}), obj({}), {}, 'controller', v) + +# ---------------------------------------------------------------- state slots +SLOTS = {} + + +def slot(k, schema, unit, origin, component, meaning, visibility='agent', reference=None): + SLOTS[k] = dict(schema=schema, unit=unit, origin=origin, component=component, meaning=meaning, visibility=visibility, reference=reference) + + +slot('clock.time_s', number('s'), 's', 'derived', 'controller', '宿主时钟;read不推进') +for k, c, m in [('plant.configured', 'heater', '工程过程参数已声明'), ('method.configured', 'controller', '方法已设定'), ('balance.configured', 'balance_rs232', '外接天平代理已配置'), + ('sample.present', 'barrel', '料筒内有试样'), ('power.enabled', 'power_switch', '整机通电'), ('piston.contact', 'piston', '活塞压在料柱上(载荷作用于试样)'), + ('piston.moving', 'piston', '宿主手动升降进行中'), ('cutter.running', 'cutter', '切刀正在转半圈'), ('balance.busy', 'balance_rs232', '外接天平正在稳定/称量'), + ('encoder.in_range', 'displacement_sensor', '活塞在位移传感器量程内(约0–107mm)且通电')]: + slot(k, BOOL, '1', 'derived', c, m) +slot('thermal.target_k', number('K'), 'K', 'setpoint', 'heater', '料筒目标温度,只是目标') +slot('thermal.indicated_k', nullable(number('K')), 'K', 'sensor', 'heater', '料筒温度显示(0.01K量化);断电为null;未按ISO 1133-2认证') +slot('heater.output_fraction', number('1', 0.0, 1.0), '1', 'derived', 'heater', 'PI控温输出占加热器上限的比例', 'evaluator') +slot('weight.total_load_kg', nullable(number('kg')), 'kg', 'setpoint', 'test_weight', '当前放在活塞上的总载荷(含0.325kg活塞);未配置为null') +slot('method.test_load_kg', nullable(number('kg')), 'kg', 'setpoint', 'controller', '方法声明的试验载荷,采集开始时须与实际载荷一致') +slot('preheat.elapsed_s', nullable(number('s')), 's', 'derived', 'barrel', '装料后经过的时间(预热计时);无试样为null') +slot('piston.position_m', number('m', 0.0, PISTON_TRAVEL_M), 'm', 'scene', 'piston', '活塞底面到口模上表面的精确距离(场景关节);agent须通过位移传感器读数观测', 'evaluator', + '资产坐标+Z;0=活塞底落在口模上表面,0.180m=抽出到料筒口。') +slot('piston.target_m', number('m', 0.0, PISTON_TRAVEL_M), 'm', 'setpoint', 'piston', '宿主最近一次手动升降命令的目标位置(抽出=0.180m,插入=当时料柱高度);不随挤出更新', 'evaluator') +slot('sensor_arm.angle_rad', number('rad'), 'rad', 'scene', 'sensor_arm', '位移传感器转臂关节角(0=活塞落在口模上时;滚轮顶住活塞凸环下表面)', 'evaluator', + '关节绕水平轴(-√½,-√½,0);仰角=asin((位置-0.050)/0.140),超过约0.107m停在上限位。') +slot('cutter.angle_rad', number('rad', 0.0, CUTTER_TRAVEL_RAD), 'rad', 'scene', 'cutter', '切刀刀片转角;0与π为两侧停位,经过π/2时切断挤出丝', 'evaluator', + '绕竖直+Z轴;交替半圈0→π→0。') +slot('power.angle_rad', number('rad'), 'rad', 'scene', 'power_switch', '后置电源摇臂开关姿态:0关、0.28rad开', 'evaluator') +slot('extrudate.length_m', number('m'), 'm', 'scene', 'extrudate_strand', '挂在口模下尚未切断的挤出丝长度(体积/口模截面,忽略离模膨胀,仅供可视)', 'evaluator', + '沿−Z自口模出口(z=0.228m)向下;可视上限0.150m。') +slot('extrudate.last_cut_length_m', number('m'), 'm', 'scene', 'extrudate_segment', '最近一个切段的长度(仅供可视,清走收集区后为0)', 'evaluator') +slot('encoder.position_m', nullable(number('m')), 'm', 'sensor', 'displacement_sensor', '位移传感器读数:活塞位置按0.003mm量化并经两点标定;超量程或断电为null') +slot('measurement.live_mvr_m3_s', nullable(number('m^3/s')), 'm^3/s', 'sensor', 'controller', '采集中按最近约4s的量化位移×ISO平均截面0.711cm²估算的实时MVR(屏幕Live MVR);非采集为null', + reference='熔体在料筒测试温度下的体积流率(不是23°C固体体积)。') +slot('measurement.mvr_m3_s', nullable(number('m^3/s')), 'm^3/s', 'sensor', 'controller', '最近一次完成采集的方法B MVR(位移窗口内的量化观测)', + reference='熔体在料筒测试温度下的体积流率;×6e8=cm³/10min。') +slot('measurement.mfr_kg_s', nullable(number('kg/s')), 'kg/s', 'sensor', 'controller', '最近一次采集的方法A MFR(已称量测量切段Σm/Σt);未称量为null', + reference='质量流率;×6e5=g/10min。') +slot('measurement.validity', VALIDITY, '1', 'derived', 'controller', '最近一次采集的有效性') +slot('acquisition.phase', PHASE, '1', 'derived', 'controller', '采集状态;停止记录不等于停止挤出') +slot('acquisition.elapsed_s', number('s'), 's', 'derived', 'controller', '当前/最近一次采集的经过时间') +slot('acquisition.points', INT, '1', 'derived', 'controller', '当前/最近一次采集的记录点数') +slot('segments.count', INT, '1', 'derived', 'collection_tray', '收集区内切段数(含清除预热挤出物的首段)') +slot('segments.unweighed', INT, '1', 'derived', 'collection_tray', '尚未称量的测量切段数') +for k, u, c, m, ref in [('truth.barrel_temperature_k', 'K', 'heater', '料筒/炉体集中热节点真温', None), + ('truth.sample_temperature_k', 'K', 'barrel', '由焓反演的试样平均温度', None), + ('truth.melt_fraction', '1', 'barrel', '熔融分数(熔程内线性)', None), + ('truth.pellet_fraction', '1', 'barrel', '尚未熔实的颗粒质量份额(只减不增;按堆积密度占体积)', None), + ('truth.sample_mass_kg', 'kg', 'barrel', '料筒内剩余试样质量', None), + ('truth.flow_m3_s', 'm^3/s', 'die', '口模真实体积流率(显式流动代理,不作独立测量)', '熔体在试样温度下的体积流率。'), + ('truth.thermal_history_s', 's', 'barrel', '试样高于熔融起点的累计时间', None), + ('truth.strand_mass_kg', 'kg', 'extrudate_strand', '挂在口模下的挤出丝质量', None), + ('truth.heater_power_w', 'W', 'heater', '加热器瞬时功率', None)]: + slot(k, number(u), u, 'process_truth', c, m, 'evaluator', ref) + + +def analyze_flow(start_position_m, end_position_m, start_time_s, end_time_s, area_prior_m2, weighed_segments, melt_density_prior_kg_m3): + """ISO 1133 arithmetic on external observations only (pure function).""" + if end_time_s <= start_time_s or start_position_m <= end_position_m: + raise ActionRejected('OBSERVATION_DOMAIN') + q = (start_position_m - end_position_m) * area_prior_m2 / (end_time_s - start_time_s) + total_t = sum(r['duration_s'] for r in weighed_segments) + mf = sum(r['mass_kg'] for r in weighed_segments) / total_t if weighed_segments else None + return dict(mvr_m3_s=q, mvr_cm3_10min=q * 6e8, mfr_kg_s=mf, mfr_g_10min=None if mf is None else mf * 6e5, + density_derived_mfr_kg_s=None if melt_density_prior_kg_m3 is None else q * melt_density_prior_kg_m3, + density_at_test_temperature_kg_m3=None if mf is None else mf / q, + evidence='ISO1133 method B: area_prior*dx/dt from supplied quantised positions/times; method A: sum(m)/sum(t) of supplied weighings; ' + 'density conversion only with a supplied melt density at test temperature') + + +HISTORY_LN_LIMIT = math.log(1e3) # thermal-history multiplier bounded to 1e-3 .. 1e3 (numerical domain) +MAX_ROWS = 200000 # rows per acquisition (duration / sample interval + 1 must stay below) +MAX_SEGMENTS = 10000 # segments per acquisition (RESULT schema maxItems); manual cuts share the budget + + +class ZwickMflowRuntime: + """One Mflow instance; the host clock is the only time source (``step``).""" + + def __init__(self, instance_id='mflow_01'): + self.instance_id = instance_id + self.time_ns = 0 + self._clock_remainder_ns = 0.0 + self.revision = 0 + self.plant = None + self.method = None + self.balance = None + self.power = False + self.target_k = 296.15 + self.T_b = 296.15 + self.integral_w = 0.0 + self.heater_w = 0.0 + self.load_kg = None + # piston: position = height of the piston bottom above the die top + self.x = PISTON_TRAVEL_M + self.x_target = PISTON_TRAVEL_M + self.contact = False + self._move = None # dict(start_ns, x0, direction, speed, insert) + # charge + self.sample = None + self.reference = None + self.reference_cell = None + self.source = None + self.m_s = 0.0 + self.H_s = 0.0 + self.m_loaded = 0.0 + self.pellet = 0.0 + self.t_hist = 0.0 + self.load_ns = None + self.q_true = 0.0 + # extrudate / cutter / balance + self.strand_kg = 0.0 + self.strand_m3 = 0.0 + self.segments = [] # segments currently lying in the collection area + self._segment_counter = 0 + self.last_cut_length = 0.0 + self.cutter_angle = 0.0 + self._cut = None # dict(start_ns, mid_ns, end_ns, a0, a1, severed, auto) + self._weigh_queue = [] + self._weighing = None # dict(segment_id, end_ns) + self.encoder_cal = (1.0, 0.0) + self.balance_cal = (1.0, 0.0) + # acquisitions: each keeps its own method snapshot, rows and segments, so later clears / method changes / + # weighings of other segments never rewrite a finished record + self.phase = 'idle' + self.operation_id = None + self.elapsed = 0.0 + self.rows = [] + self._counter = 0 + self.terminal_reason = None + self._operation_source = None + self._acq = None + self._acqs = {} + self.validity = 'not_completed' + self.flow_result = None + self.last_mvr = None + self.last_mfr = None + self.records = {} + self._principals = {} + self._requests = {} + self._owners = {} + self._cancel_operations = {} + self.book = {k: 0.0 for k in ['loaded_mass_kg', 'collected_mass_kg', 'removed_mass_kg', 'heater_input_j', 'host_work_j', 'loaded_enthalpy_j', + 'ambient_export_j', 'extruded_enthalpy_j', 'removed_enthalpy_j', 'friction_heat_j', 'pressure_work_j']} + + # ------------------------------------------------------------ helpers + @property + def time_s(self): + return self.time_ns / 1e9 + + def register_principal(self, name, visibility): + if not isinstance(name, str) or not name or visibility not in ('agent', 'evaluator', 'debug') or name in self._principals: + raise ActionRejected('INVALID_ARGUMENT') + self._principals[name] = visibility + + def session(self, name): + if not isinstance(name, str) or name not in self._principals: + raise ActionRejected('ACCESS_DENIED') + return ZwickMflowSession(self, name) + + def _ambient(self): + return self.plant['ambient_k'] if self.plant else 296.15 + + def _phi_of_T(self, T): + """Latent fraction used by the equilibrium enthalpy h(T) (a zero-width range melts completely at T >= T_lo).""" + s = self.sample + lo, hi = s['melting_low_k'], s['melting_high_k'] + if hi <= lo: + return 1.0 if T >= lo else 0.0 + return min(1.0, max(0.0, (T - lo) / (hi - lo))) + + def _h_of_T(self, T): + s = self.sample + return s['specific_heat_j_kg_k'] * (T - self._ambient()) + s['latent_heat_j_kg'] * self._phi_of_T(T) + + def _phase_of_h(self, h): + """Exact inverse of the piecewise-linear specific enthalpy -> (temperature, melt fraction). + + The melt fraction comes from the enthalpy, so a zero-width melting range still needs the whole latent heat.""" + s = self.sample + cp, L, lo, hi, Ta = s['specific_heat_j_kg_k'], s['latent_heat_j_kg'], s['melting_low_k'], s['melting_high_k'], self._ambient() + h_lo = cp * (lo - Ta) + h_hi = cp * (hi - Ta) + L + if h <= h_lo: + return Ta + h / cp, 0.0 + if h >= h_hi: + return Ta + (h - L) / cp, 1.0 + frac = (h - h_lo) / (h_hi - h_lo) + return lo + frac * (hi - lo), frac + + def _sample_state(self): + if not self.sample or self.m_s <= 0: + return self._ambient(), 0.0 + return self._phase_of_h(self.H_s / self.m_s) + + def _sample_T(self): + return self._sample_state()[0] + + def _phi(self): + return self._sample_state()[1] + + def _column_height(self): + if not self.sample or self.m_s <= 0: + return 0.0 + s = self.sample + return self.m_s * (self.pellet / s['bulk_density_kg_m3'] + (1.0 - self.pellet) / s['melt_density_kg_m3']) / STANDARD_AREA_M2 + + def _load_mass(self): + return PISTON_LOAD_KG if self.load_kg is None else self.load_kg + + def _flow(self, T, phi): + """True melt volume flow through the die (m^3/s) for the loaded, contacting piston.""" + if not (self.sample and self.contact and self.m_s > 0): + return 0.0 + s, ref = self.sample, self.reference_cell + force = self._load_mass() * GRAVITY - self.plant['piston_friction_n'] + if force <= 0: + return 0.0 + n = s['power_law_index'] + history = max(-HISTORY_LN_LIMIT, min(HISTORY_LN_LIMIT, s['history_rate_per_s'] * self.t_hist)) + return (ref['mvr_m3_s'] * (force / (s['reference_load_kg'] * GRAVITY)) ** (1.0 / n) + * math.exp(-(s['activation_energy_j_mol'] / (n * GAS_CONSTANT)) * (1.0 / T - 1.0 / s['reference_temperature_k'])) + * math.exp(history) * phi ** 3) + + def _encoder(self): + if not self.power or not (SENSOR_RANGE_M[0] <= self.x <= SENSOR_RANGE_M[1]): + return None + scale, offset = self.encoder_cal + return quantize(scale * self.x + offset, ENCODER_RESOLUTION_M) + + def _indicated_T(self): + return quantize(self.T_b, TEMPERATURE_DISPLAY_RESOLUTION_K) if self.power else None + + def _live_mvr(self): + if self.phase != 'running' or not self.power: + return None + pts = [r for r in self.rows if r['encoder_position_m'] is not None] + if len(pts) < 2: + return None + last = pts[-1] + first = next((r for r in pts if last['time_s'] - r['time_s'] <= LIVE_MVR_WINDOW_S + 1e-9), None) + if first is None or last['time_s'] <= first['time_s']: + return None + return max(0.0, (first['encoder_position_m'] - last['encoder_position_m']) * STANDARD_AREA_M2 / (last['time_s'] - first['time_s'])) + + def _obs_time(self, t_ns, acq=None): + return quantize((t_ns - acq['start_ns']) / 1e9, TIME_RESOLUTION_S) if acq else quantize(t_ns / 1e9, TIME_RESOLUTION_S) + + def read(self, visibility='agent'): + T_s, phi = self._sample_state() + d = {'clock.time_s': self.time_s, 'plant.configured': self.plant is not None, 'method.configured': self.method is not None, + 'balance.configured': self.balance is not None, 'sample.present': self.sample is not None, 'power.enabled': self.power, + 'piston.contact': self.contact, 'piston.moving': self._move is not None, 'cutter.running': self._cut is not None, + 'balance.busy': self._weighing is not None, 'encoder.in_range': self._encoder() is not None, + 'thermal.target_k': self.target_k, 'thermal.indicated_k': self._indicated_T(), + 'heater.output_fraction': self.heater_w / self.plant['heater_max_w'] if self.plant else 0.0, + 'weight.total_load_kg': self.load_kg, 'method.test_load_kg': self.method['test_load_kg'] if self.method else None, + 'preheat.elapsed_s': None if self.load_ns is None else (self.time_ns - self.load_ns) / 1e9, + 'piston.position_m': self.x, 'piston.target_m': self.x_target, 'sensor_arm.angle_rad': sensor_arm_angle(self.x), + 'cutter.angle_rad': self.cutter_angle, 'power.angle_rad': POWER_SWITCH_ON_RAD if self.power else 0.0, + 'extrudate.length_m': self.strand_m3 / DIE_AREA_M2, 'extrudate.last_cut_length_m': self.last_cut_length, + 'encoder.position_m': self._encoder(), 'measurement.live_mvr_m3_s': self._live_mvr(), + 'measurement.mvr_m3_s': self.last_mvr, 'measurement.mfr_kg_s': self.last_mfr, 'measurement.validity': self.validity, + 'acquisition.phase': self.phase, 'acquisition.elapsed_s': self.elapsed, 'acquisition.points': len(self.rows), + 'segments.count': len(self.segments), 'segments.unweighed': sum(1 for g in self.segments if g['measurement_segment'] and g['status'] != 'weighed'), + 'truth.barrel_temperature_k': self.T_b, 'truth.sample_temperature_k': T_s, 'truth.melt_fraction': phi, + 'truth.pellet_fraction': self.pellet, 'truth.sample_mass_kg': self.m_s, 'truth.flow_m3_s': self.q_true, + 'truth.thermal_history_s': self.t_hist, 'truth.strand_mass_kg': self.strand_kg, 'truth.heater_power_w': self.heater_w} + return {k: copy.deepcopy(v) for k, v in d.items() if visibility != 'agent' or SLOTS[k]['visibility'] == 'agent'} + + def ledger(self): + b = copy.deepcopy(self.book) + seg_mass = sum(g['true_mass_kg'] for g in self.segments) + b.update(sample_mass_kg=self.m_s, strand_mass_kg=self.strand_kg, segments_mass_kg=seg_mass, + extruded_mass_kg=self.strand_kg + seg_mass + self.book['collected_mass_kg'], + barrel_thermal_j=(self.plant['barrel_heat_capacity_j_k'] * (self.T_b - self._ambient())) if self.plant else 0.0, + sample_enthalpy_j=self.H_s, load_potential_j=self._load_mass() * GRAVITY * self.x) + b['mass_residual_kg'] = b['loaded_mass_kg'] - self.m_s - self.strand_kg - seg_mass - b['collected_mass_kg'] - b['removed_mass_kg'] + b['energy_residual_j'] = (b['heater_input_j'] + b['host_work_j'] + b['loaded_enthalpy_j'] - b['barrel_thermal_j'] - b['sample_enthalpy_j'] + - (b['load_potential_j'] - self._potential0) - b['ambient_export_j'] - b['extruded_enthalpy_j'] - b['removed_enthalpy_j']) + return b + + _potential0 = PISTON_LOAD_KG * GRAVITY * PISTON_TRAVEL_M + + # ------------------------------------------------------------ acquisition bookkeeping + def _record(self, t_ns): + enc = self._encoder() + quality = 'power_off' if not self.power else 'ok' if enc is not None else 'encoder_out_of_range' + self.rows.append(dict(point_index=len(self.rows), time_s=self._obs_time(t_ns, self._acq), encoder_position_m=enc, temperature_k=self._indicated_T(), quality=quality)) + + @staticmethod + def _public_segments(segments): + return [dict(segment_id=g['segment_id'], start_time_s=g['start_obs_s'], end_time_s=g['end_obs_s'], + duration_s=None if g['start_obs_s'] is None else quantize(g['end_obs_s'] - g['start_obs_s'], TIME_RESOLUTION_S), + observed_mass_kg=g['observed_mass_kg'], status=g['status'], measurement_segment=g['measurement_segment']) for g in segments] + + @staticmethod + def _compute_flow(acq): + """Method B from the acquisition's own rows and window; method A from its own weighed measurement segments.""" + m = acq['method'] + pts = [r for r in acq['rows'] if r['encoder_position_m'] is not None and r['quality'] == 'ok'] + inside = [r for r in pts if m['window_lower_m'] - 1e-12 <= r['encoder_position_m'] <= m['window_upper_m'] + 1e-12] + mvr = None + window = None + if len(inside) >= 2 and inside[0]['encoder_position_m'] > inside[-1]['encoder_position_m'] and inside[-1]['time_s'] > inside[0]['time_s']: + a, b = inside[0], inside[-1] + mvr = (a['encoder_position_m'] - b['encoder_position_m']) * STANDARD_AREA_M2 / (b['time_s'] - a['time_s']) + window = ([a['encoder_position_m'], b['encoder_position_m']], [a['time_s'], b['time_s']]) + weighed = [g for g in acq['segments'] if g['measurement_segment'] and g['status'] == 'weighed'] + mfr = None + if weighed: + mfr = sum(g['observed_mass_kg'] for g in weighed) / sum(quantize(g['end_obs_s'] - g['start_obs_s'], TIME_RESOLUTION_S) for g in weighed) + if mvr is None and mfr is None: + return None + return dict(mvr_m3_s=mvr, mvr_cm3_10min=None if mvr is None else mvr * 6e8, mfr_kg_s=mfr, mfr_g_10min=None if mfr is None else mfr * 6e5, + density_at_test_temperature_kg_m3=None if (mvr is None or mfr is None or mvr <= 0) else mfr / mvr, + window_positions_m=None if window is None else window[0], window_times_s=None if window is None else window[1], weighed_segments=len(weighed), + evidence='method B: ISO mean area 0.711 cm^2 x quantised encoder displacement / quantised time inside the window of the method used for this run; ' + 'method A: externally weighed measurement segments of this run / their quantised cut interval') + + def _result_of(self, acq): + return dict(operation_id=acq['op'], phase=acq['phase'], elapsed_s=acq['elapsed'], test_temperature_k=acq['target_k'], test_load_kg=acq['load_kg'], + rows=copy.deepcopy(acq['rows']), segments=self._public_segments(acq['segments']), + flow=copy.deepcopy(acq['flow']) if acq['phase'] != 'running' else None, validity=acq['validity'], terminal_reason=acq['terminal_reason'], + template_source=acq['source'], + evidence='synthetic_forward_model; quantised encoder/time/temperature observations and external weighings; manufacturer MVR scalar ' + 'transferred with explicit rheology/thermal/density priors; not native Mflow data') + + def _result(self): + if self._acq is None: + return dict(operation_id=None, phase='idle', elapsed_s=0.0, test_temperature_k=None, test_load_kg=None, rows=[], segments=[], flow=None, + validity='not_completed', terminal_reason=None, template_source=None, evidence='no_measurement') + if self._acq['phase'] == 'running': + return self._result_of(self._acq) + return copy.deepcopy(self.records[self._acq['op']]) + + def _finish(self, phase, reason): + acq = self._acq + method = acq['method'] + if phase == 'cancelled': + validity = 'cancelled' + elif reason == 'SAMPLE_EXHAUSTED': + validity = 'sample_exhausted' + elif not acq['window_traversed']: + validity = 'window_not_traversed' + elif acq['temperature_excursion']: + validity = 'temperature_out_of_tolerance' + elif method['preheat_time_s'] < 300.0: + validity = 'preheat_below_iso_minimum' + else: + validity = 'valid' + acq.update(phase=phase, terminal_reason=reason, validity=validity, end_ns=self.time_ns, elapsed=self.elapsed) + acq['flow'] = self._compute_flow(acq) + self.phase, self.terminal_reason, self.validity, self.flow_result = phase, reason, validity, acq['flow'] + ok = acq['flow'] is not None and validity == 'valid' + self.last_mvr = acq['flow']['mvr_m3_s'] if ok else None + self.last_mfr = acq['flow']['mfr_kg_s'] if ok else None + self.records[acq['op']] = self._result_of(acq) + + def _refresh_record(self, op): + """A weighing that finishes after its run updates only that run's record (masses only, same method snapshot).""" + acq = self._acqs.get(op) + if acq is None or acq['phase'] == 'running': + return + acq['flow'] = self._compute_flow(acq) + self.records[op] = self._result_of(acq) + if op == self.operation_id: + self.flow_result = acq['flow'] + if acq['validity'] == 'valid' and acq['flow'] is not None: + self.last_mfr = acq['flow']['mfr_kg_s'] + + # ------------------------------------------------------------ cutter and balance + def _start_cut(self, auto): + """Blade moves from where it stands to the far rest (0 or pi); the strand is severed where the path crosses pi/2.""" + a0 = self.cutter_angle + a1 = CUTTER_TRAVEL_RAD if a0 < CUTTER_TRAVEL_RAD / 2 else 0.0 + duration = max(1, round(self.plant['cutter_half_turn_s'] * 1e9 * abs(a1 - a0) / CUTTER_TRAVEL_RAD)) + frac = (CUTTER_TRAVEL_RAD / 2 - a0) / (a1 - a0) + self._cut = dict(start_ns=self.time_ns, mid_ns=self.time_ns + round(frac * duration), end_ns=self.time_ns + duration, a0=a0, a1=a1, severed=False, auto=auto) + + def _sever(self, t_ns): + """Blade crosses pi/2: the hanging strand becomes a segment.""" + acq = self._acq if self.phase == 'running' else None + if acq is not None: + acq['cuts'] += 1 + op = acq['op'] if acq is not None else 'manual' + start_obs = acq['last_cut_obs'] if acq is not None else None + end_obs = self._obs_time(t_ns, acq) + measurement = acq is not None and acq['cuts'] >= 2 + if self.strand_kg > 0 or acq is not None: + self._segment_counter += 1 + seg = dict(segment_id=f'{op}:segment:{self._segment_counter}', operation_id=op, true_mass_kg=self.strand_kg, true_volume_m3=self.strand_m3, + start_obs_s=start_obs if measurement else None, end_obs_s=end_obs, observed_mass_kg=None, status='unweighed', + measurement_segment=measurement) + self.segments.append(seg) + if acq is not None: + acq['segments'].append(seg) + self.last_cut_length = self.strand_m3 / DIE_AREA_M2 + if measurement and acq['method']['automatic_weighing'] and self.balance is not None: + self._weigh_queue.append(seg['segment_id']) + self._start_next_weighing() + self.strand_kg = 0.0 + self.strand_m3 = 0.0 + if acq is not None: + acq['last_cut_obs'] = end_obs + + def _start_next_weighing(self): + if self._weighing is None and self._weigh_queue and self.balance is not None: + sid = self._weigh_queue.pop(0) + seg = next(g for g in self.segments if g['segment_id'] == sid) + seg['status'] = 'weighing' + self._weighing = dict(segment_id=sid, end_ns=self.time_ns + max(1, round(self.balance['settling_s'] * 1e9))) + + def _complete_weighing(self): + w = self._weighing + self._weighing = None + seg = next((g for g in self.segments if g['segment_id'] == w['segment_id']), None) + if seg is not None: + b = self.balance + scale, offset = self.balance_cal + raw = quantize(b['gain'] * seg['true_mass_kg'] + b['offset_kg'], b['resolution_kg']) + seg['observed_mass_kg'] = scale * raw + offset + seg['status'] = 'weighed' + self._refresh_record(seg['operation_id']) + self._start_next_weighing() + + # ------------------------------------------------------------ commands + def invoke(self, capability_id, **arguments): + if capability_id not in CAPS: + raise ActionRejected('UNKNOWN_CAPABILITY') + validate(CAPS[capability_id]['input_schema'], arguments) + k = capability_id + a = copy.deepcopy(arguments) + if k in UNSUPPORTED: + raise ActionRejected('UNSUPPORTED') + if k == 'acquisition.result': + return self._result() + if k == 'ledger.read': + return self.ledger() + if k == 'provenance.read': + return dict(current_sample=self.source, operation_source=self._operation_source) + if k == 'analysis.flow': + return analyze_flow(**a) + if k == 'sim.step': + self.step(a['dt_s']) + return dict(time_s=self.time_s) + if self.phase == 'running' and k not in ('acquisition.stop', 'power.set', 'balance.weigh', 'thermal.set_temperature', 'cutter.cut'): + raise ActionRejected('BUSY') + if k == 'plant.configure': + if self.plant is not None: + raise ActionRejected('PLANT_ALREADY_CONFIGURED') + if not a['accept_engineering']: + raise ActionRejected('ENGINEERING_ACCEPTANCE_REQUIRED') + if a['barrel_heat_capacity_j_k'] / (a['controller_gain_w_k'] + a['barrel_loss_w_k']) < 5 * MAX_SUBSTEP_S: + raise ActionRejected('THERMAL_TIME_CONSTANT_OUTSIDE_NUMERICAL_DOMAIN') + self.plant = a + self.T_b = a['ambient_k'] + self.target_k = max(TEMPERATURE_RANGE_K[0], a['ambient_k']) + out = dict(configured=True) + elif k == 'balance.configure': + if not a['accept_external_balance_proxy']: + raise ActionRejected('ENGINEERING_ACCEPTANCE_REQUIRED') + if self._weighing is not None: + raise ActionRejected('BALANCE_BUSY') + self.balance = a + out = dict(configured=True) + elif k == 'method.configure': + if a['window_upper_m'] <= a['window_lower_m']: + raise ActionRejected('INVALID_WINDOW') + nanos = a['sample_interval_s'] / TIME_RESOLUTION_S + if abs(nanos - round(nanos)) > 1e-6: + raise ActionRejected('SAMPLING_NOT_ON_TIME_BASE') + if a['duration_s'] / a['sample_interval_s'] + 2 > MAX_ROWS: + raise ActionRejected('TOO_MANY_SAMPLES') + self.method = a + out = dict(configured=True) + elif k == 'power.set': + if self.plant is None: + raise ActionRejected('PLANT_REQUIRED') + if not a['enabled']: + if self.phase == 'running': + self._finish('cancelled', 'POWER_OFF') + if self._cut is not None: + self._cut = None # blade stops where it is; an uncrossed turn does not cut + self.heater_w = 0.0 + self.integral_w = 0.0 + self.power = a['enabled'] + out = dict(enabled=self.power) + elif k == 'thermal.set_temperature': + if self.plant is None: + raise ActionRejected('PLANT_REQUIRED') + self.target_k = a['target_k'] + out = dict(target_k=self.target_k) + elif k == 'weight.configure': + if self.plant is None: + raise ActionRejected('PLANT_REQUIRED') + if self._move is not None: + raise ActionRejected('PISTON_MOVING') + old = self._load_mass() + self.load_kg = a['total_load_kg'] + self.book['host_work_j'] += (self._load_mass() - old) * GRAVITY * self.x + out = dict(total_load_kg=self.load_kg) + elif k == 'sample.load': + if self.plant is None: + raise ActionRejected('PLANT_REQUIRED') + if self.sample is not None: + raise ActionRejected('SAMPLE_PRESENT') + if self._move is not None or self.x < PISTON_TRAVEL_M - 1e-12: + raise ActionRejected('PISTON_NOT_WITHDRAWN') + if not a['accept_rheology_thermal_density_and_packing_assumptions']: + raise ActionRejected('ENGINEERING_ACCEPTANCE_REQUIRED') + if a['melting_high_k'] < a['melting_low_k']: + raise ActionRejected('INVALID_MELTING_RANGE') + if a['bulk_density_kg_m3'] > a['melt_density_kg_m3']: + raise ActionRejected('BULK_DENSITY_EXCEEDS_MELT_DENSITY') + ref = library().get(a['reference_id']) + if ref is None: + raise ActionRejected('UNKNOWN_REFERENCE') + cell = next((m for m in ref['measurements'] if m.get('mvr_m3_s') is not None + and abs(m['reference_temperature_K'] - a['reference_temperature_k']) < 1e-6 and abs(m['reference_load_kg'] - a['reference_load_kg']) < 1e-9), None) + if cell is None: + raise ActionRejected('NO_NUMERIC_REFERENCE_AT_CONDITION') + height = a['mass_kg'] / (a['bulk_density_kg_m3'] * STANDARD_AREA_M2) + if height > BARREL_LENGTH_M: + raise ActionRejected('CHARGE_EXCEEDS_BARREL') + self.sample = a + self.reference = ref + self.reference_cell = cell + self.source = json.dumps(dict(reference_id=a['reference_id'], grade=ref.get('grade'), condition=[cell['reference_temperature_K'], cell['reference_load_kg']], + mvr_m3_s=cell['mvr_m3_s'], source=cell.get('source', {}).get('publication')), sort_keys=True, ensure_ascii=False) + self.m_s = a['mass_kg'] + self.m_loaded = a['mass_kg'] + self.pellet = 1.0 + self.t_hist = 0.0 + self.H_s = a['mass_kg'] * self._h_of_T(a['initial_temperature_k']) + self.book['loaded_mass_kg'] += a['mass_kg'] + self.book['loaded_enthalpy_j'] += self.H_s + self.load_ns = self.time_ns + out = dict(present=True, column_height_m=height) + elif k == 'sample.remove': + if self.sample is None: + raise ActionRejected('NO_SAMPLE') + if self._move is not None or self.x < PISTON_TRAVEL_M - 1e-12: + raise ActionRejected('PISTON_NOT_WITHDRAWN') + removed = self.m_s + self.book['removed_mass_kg'] += removed + self.book['removed_enthalpy_j'] += self.H_s + self.m_s = 0.0 + self.H_s = 0.0 + self.sample = self.reference = self.reference_cell = self.source = None + self.pellet = 0.0 + self.t_hist = 0.0 + self.load_ns = None + out = dict(removed_mass_kg=removed) + elif k in ('piston.withdraw', 'piston.insert'): + if self.plant is None: + raise ActionRejected('PLANT_REQUIRED') + if self._move is not None: + raise ActionRejected('PISTON_MOVING') + if k == 'piston.withdraw': + target = PISTON_TRAVEL_M + self.contact = False + else: + if self.contact: + raise ActionRejected('ALREADY_IN_CONTACT') + target = max(self._column_height(), 0.0) + self.x_target = target + if abs(target - self.x) > 1e-12: + self._move = dict(start_ns=self.time_ns, x0=self.x, direction=1.0 if target > self.x else -1.0, speed=self.plant['manual_piston_speed_m_s'], insert=k == 'piston.insert') + elif k == 'piston.insert': + self.contact = True + out = dict(target_m=target) + elif k == 'cutter.cut': + if not self.power: + raise ActionRejected('POWER_OFF') + if self._cut is not None: + raise ActionRejected('CUTTER_BUSY') + if self.phase == 'running': + if self._acq['manual_cuts'] >= self._acq['manual_cut_budget']: + raise ActionRejected('TOO_MANY_SEGMENTS') + self._acq['manual_cuts'] += 1 + self._start_cut(auto=False) + out = dict(requested=True) + elif k == 'collection.clear': + if self._weighing is not None: + raise ActionRejected('BALANCE_BUSY') + collected = self.strand_kg + sum(g['true_mass_kg'] for g in self.segments) + self.book['collected_mass_kg'] += collected + self.strand_kg = self.strand_m3 = 0.0 + self.segments = [] + self._weigh_queue = [] + self.last_cut_length = 0.0 + out = dict(collected_mass_kg=collected) + elif k == 'balance.weigh': + if self.balance is None: + raise ActionRejected('BALANCE_REQUIRED') + seg = next((g for g in self.segments if g['segment_id'] == a['segment_id']), None) + if seg is None: + raise ActionRejected('UNKNOWN_SEGMENT') + if seg['status'] != 'unweighed' or a['segment_id'] in self._weigh_queue: + raise ActionRejected('SEGMENT_ALREADY_WEIGHED_OR_QUEUED') + self._weigh_queue.append(a['segment_id']) + self._start_next_weighing() + out = dict(requested=True) + elif k == 'calibration.encoder': + if a['observed_high_m'] - a['observed_low_m'] <= 1e-6 or a['reference_high_m'] - a['reference_low_m'] <= 1e-6: + raise ActionRejected('DEGENERATE_CALIBRATION') + # observed readings were taken with the current correction: compose the new correction on top + s_old, o_old = self.encoder_cal + gain = (a['reference_high_m'] - a['reference_low_m']) / (a['observed_high_m'] - a['observed_low_m']) + off = a['reference_low_m'] - gain * a['observed_low_m'] + self.encoder_cal = (gain * s_old, gain * o_old + off) + out = dict(scale=self.encoder_cal[0], offset_m=self.encoder_cal[1]) + elif k == 'calibration.balance': + if a['observed_high_kg'] - a['observed_low_kg'] <= 1e-9 or a['reference_high_kg'] - a['reference_low_kg'] <= 1e-9: + raise ActionRejected('DEGENERATE_CALIBRATION') + s_old, o_old = self.balance_cal + gain = (a['reference_high_kg'] - a['reference_low_kg']) / (a['observed_high_kg'] - a['observed_low_kg']) + off = a['reference_low_kg'] - gain * a['observed_low_kg'] + self.balance_cal = (gain * s_old, gain * o_old + off) + out = dict(scale=self.balance_cal[0], offset_kg=self.balance_cal[1]) + elif k == 'acquisition.start': + if not self.power: + raise ActionRejected('POWER_OFF') + if self.plant is None or self.method is None: + raise ActionRejected('CONFIGURATION_REQUIRED') + if self.sample is None: + raise ActionRejected('NO_SAMPLE') + if not self.contact or self._move is not None: + raise ActionRejected('PISTON_NOT_ON_CHARGE') + if self.load_kg is None or abs(self.load_kg - self.method['test_load_kg']) > 1e-9: + raise ActionRejected('LOAD_MISMATCH') + if (self.time_ns - self.load_ns) / 1e9 < self.method['preheat_time_s'] - 1e-9: + raise ActionRejected('PREHEAT_NOT_COMPLETE') + if abs(self._indicated_T() - self.target_k) > self.method['temperature_tolerance_k'] + 1e-9: + raise ActionRejected('TEMPERATURE_NOT_STABLE') + if self._cut is not None: + raise ActionRejected('CUTTER_BUSY') + ci = self.method['cut_interval_s'] + if ci is not None and ci < 1.5 * self.plant['cutter_half_turn_s']: + raise ActionRejected('CUT_INTERVAL_TOO_SHORT') + self._counter += 1 + self.operation_id = f'{self.instance_id}:acq:{self._counter}' + self.phase = 'running' + self.elapsed = 0.0 + self.terminal_reason = None + self.validity = 'not_completed' + self.flow_result = None + self._operation_source = self.source + period = round(self.method['sample_interval_s'] * 1e9) + self._acq = dict(op=self.operation_id, method=copy.deepcopy(self.method), rows=[], segments=[], phase='running', validity='not_completed', + terminal_reason=None, flow=None, elapsed=0.0, source=self.source, start_ns=self.time_ns, + end_limit_ns=self.time_ns + round(self.method['duration_s'] * 1e9), period_ns=period, + next_sample_ns=self.time_ns + period, next_cut_ns=None if ci is None else self.time_ns + round(ci * 1e9), + cuts=0, last_cut_obs=None, window_traversed=False, temperature_excursion=False, target_k=self.target_k, load_kg=self.load_kg, end_ns=None) + auto_cuts = 0 if ci is None else int(self.method['duration_s'] // ci) + 2 + self._acq.update(manual_cut_budget=MAX_SEGMENTS - auto_cuts, manual_cuts=0) + self._acqs[self.operation_id] = self._acq + self.rows = self._acq['rows'] + self._record(self.time_ns) + if ci is not None: + self._start_cut(auto=True) # trim cut: removes what flowed during the preheat + out = dict(operation_id=self.operation_id) + elif k == 'acquisition.stop': + if self.phase != 'running': + raise ActionRejected('NOT_RUNNING') + self._finish('cancelled', 'USER_CANCEL') + out = dict(phase=self.phase, elapsed_s=self.elapsed) + else: + raise ActionRejected('UNKNOWN_CAPABILITY') + self.revision += 1 + return copy.deepcopy(out) + + # ------------------------------------------------------------ time integration + def _next_events(self, end): + ev = [end, self.time_ns + round(MAX_SUBSTEP_S * 1e9)] + if self._move is not None: + m = self._move + dist = abs(self.x_target - m['x0']) + ev.append(m['start_ns'] + max(1, math.ceil(dist / m['speed'] * 1e9))) + if self._cut is not None: + ev += [self._cut['mid_ns'], self._cut['end_ns']] if not self._cut['severed'] else [self._cut['end_ns']] + if self._weighing is not None: + ev.append(self._weighing['end_ns']) + if self.phase == 'running': + ev += [self._acq['next_sample_ns'], self._acq['end_limit_ns']] + if self._acq['next_cut_ns'] is not None: + ev.append(self._acq['next_cut_ns']) + return min(t for t in ev if t > self.time_ns) + + def _integrate(self, dt): + """Explicit conservative update over one sub-step (all energy terms booked with the same values).""" + p = self.plant + Ta = p['ambient_k'] + # heater: PI with conditional integration (anti-windup) + if self.power: + e = self.target_k - self.T_b + u = p['controller_gain_w_k'] * e + self.integral_w + P = min(max(u, 0.0), p['heater_max_w']) + if 0.0 < u < p['heater_max_w'] or (u >= p['heater_max_w'] and e < 0) or (u <= 0 and e > 0): + self.integral_w = min(max(self.integral_w + p['controller_gain_w_k'] / p['controller_integral_s'] * e * dt, 0.0), p['heater_max_w']) + else: + P = 0.0 + self.heater_w = P + loss = p['barrel_loss_w_k'] * (self.T_b - Ta) + friction = 0.0 + pressure_work = 0.0 + self.q_true = 0.0 + exchange = 0.0 + if self.sample is not None and self.m_s > 0: + T_s, phi = self._sample_state() + # barrel -> charge heat over dt: exponential relaxation towards the barrel temperature with the secant heat + # capacity (sensible + latent) of the charge; unconditionally stable for any charge size / conductance + G = p['sample_conductance_w_k'] * (self.m_s / self.m_loaded) + dT = self.T_b - T_s + if abs(dT) > 1e-12 and G > 0: + dH_eq = self.m_s * self._h_of_T(self.T_b) - self.H_s + exchange = dH_eq * -math.expm1(-G * dt * dT / dH_eq) + if T_s > self.sample['melting_low_k']: + self.t_hist += dt + # die flow for the contacting piston (melt fraction from the enthalpy) + extruded_volume = 0.0 + if self.contact: + q = self._flow(T_s, phi) + dm = min(self.sample['melt_density_kg_m3'] * q * dt, phi * self.m_s) + if dm > 0: + h = self.H_s / self.m_s + self.m_s -= dm + self.H_s -= dm * h + self.book['extruded_enthalpy_j'] += dm * h + self.strand_kg += dm + self.strand_m3 += dm / self.sample['melt_density_kg_m3'] + extruded_volume = dm / self.sample['melt_density_kg_m3'] + self.q_true = extruded_volume / dt + self.H_s += exchange + # compaction bookkeeping: unmelted pellets only turn into melt (never back to bulk pellets) + self.pellet = min(self.pellet, 1.0 - self._phi()) + if self.contact: + x_new = min(self._column_height(), self.x) + dx = self.x - x_new + if dx > 0: + friction = p['piston_friction_n'] * dx + force = self._load_mass() * GRAVITY - p['piston_friction_n'] + pressure_work = force * dx + # the share that pushed melt through the die is dissipated there and leaves with the extrudate + # (delta_p * V_extruded); only the compaction share heats the charge left in the barrel + die_work = min(pressure_work, force / STANDARD_AREA_M2 * extruded_volume) + self.book['extruded_enthalpy_j'] += die_work + self.H_s += pressure_work - die_work + self.x = x_new + self.book['heater_input_j'] += P * dt + self.book['ambient_export_j'] += loss * dt + self.book['friction_heat_j'] += friction + self.book['pressure_work_j'] += pressure_work + self.T_b += (P * dt - loss * dt - exchange + friction) / p['barrel_heat_capacity_j_k'] + + def _advance_move(self, nxt): + m = self._move + dist = abs(self.x_target - m['x0']) + t = (nxt - m['start_ns']) / 1e9 + done = t * m['speed'] >= dist - 1e-15 + new_x = self.x_target if done else m['x0'] + m['direction'] * m['speed'] * t + dx = new_x - self.x + heat = self.plant['piston_friction_n'] * abs(dx) + self.book['host_work_j'] += self._load_mass() * GRAVITY * dx + heat + self.book['friction_heat_j'] += heat + self.T_b += heat / self.plant['barrel_heat_capacity_j_k'] + self.x = new_x + if done: + self._move = None + if m['insert']: + self.contact = True + + def step(self, dt_s): + validate(number('s', 0.0, 86400.0), dt_s) + raw = dt_s * 1e9 + self._clock_remainder_ns + ns = round(raw) + self._clock_remainder_ns = raw - ns + if ns <= 0 or self.plant is None: + self.time_ns += max(ns, 0) + self.revision += 1 + return + end = self.time_ns + ns + while self.time_ns < end: + nxt = self._next_events(end) + dt = (nxt - self.time_ns) / 1e9 + if self._move is not None: + self._advance_move(nxt) + self._integrate(dt) + # a descending insert can meet the (shrinking) charge column + if self._move is not None and self._move['insert'] and self.x <= self._column_height() + 1e-12: + self.x = max(self._column_height(), 0.0) + self.x_target = self.x + self._move = None + self.contact = True + if self._cut is not None: + c = self._cut + frac = min(1.0, (nxt - c['start_ns']) / max(1, c['end_ns'] - c['start_ns'])) + self.cutter_angle = c['a0'] + (c['a1'] - c['a0']) * frac + self.time_ns = nxt + if self._cut is not None: + c = self._cut + if not c['severed'] and self.time_ns >= c['mid_ns']: + c['severed'] = True + self._sever(self.time_ns) + if self.time_ns >= c['end_ns']: + self.cutter_angle = c['a1'] + self._cut = None + if self._weighing is not None and self.time_ns >= self._weighing['end_ns']: + self._complete_weighing() + if self.phase == 'running': + acq = self._acq + self.elapsed = (self.time_ns - acq['start_ns']) / 1e9 + acq['elapsed'] = self.elapsed + am = acq['method'] + if acq['next_cut_ns'] is not None and self.time_ns >= acq['next_cut_ns']: + acq['next_cut_ns'] += round(am['cut_interval_s'] * 1e9) + if self._cut is None and self.power: + self._start_cut(auto=True) + if self.time_ns >= acq['next_sample_ns']: + acq['next_sample_ns'] += acq['period_ns'] + self._record(self.time_ns) + row = self.rows[-1] + if row['temperature_k'] is not None and abs(row['temperature_k'] - acq['target_k']) > am['temperature_tolerance_k'] + 1e-9: + enc = row['encoder_position_m'] + if enc is not None and am['window_lower_m'] <= enc <= am['window_upper_m']: + acq['temperature_excursion'] = True + enc = row['encoder_position_m'] + if enc is not None and enc <= am['window_lower_m']: + acq['window_traversed'] = any(r['encoder_position_m'] is not None and r['encoder_position_m'] >= am['window_upper_m'] for r in self.rows) + self._finish('succeeded' if acq['window_traversed'] else 'failed', 'WINDOW_TRAVERSED' if acq['window_traversed'] else 'STARTED_BELOW_WINDOW') + if self.phase == 'running' and (self.m_s <= 1e-12 or self.x <= MIN_PISTON_M): + self._finish('failed', 'SAMPLE_EXHAUSTED') + if self.phase == 'running' and self.time_ns >= acq['end_limit_ns']: + self._finish('failed', 'DURATION_ELAPSED') + self.revision += 1 + + +class ZwickMflowSession: + def __init__(self, host, principal_id): + self._host = host + self._principal = principal_id + + @property + def _role(self): + return self._host._principals[self._principal] + + def _target(self, instance_id): + if not isinstance(instance_id, str) or instance_id != self._host.instance_id: + raise ActionRejected('UNKNOWN_INSTANCE') + + def describe(self, *, instance_id=None, asset_type_id=None): + if (instance_id is None) == (asset_type_id is None): + raise ActionRejected('INVALID_ARGUMENT') + if instance_id is not None: + self._target(instance_id) + if asset_type_id is not None and asset_type_id != ASSET_TYPE_ID: + raise ActionRejected('UNKNOWN_INSTANCE') + meta = export_zwick_mflow_contract_metadata() + return dict(protocol_version=PROTOCOL_VERSION, asset_type_id=ASSET_TYPE_ID, asset_version='1.0.0', + capabilities={k: v for k, v in meta['capabilities'].items() if v['visibility'] == 'agent' or self._role != 'agent'}, + state_slots={k: v for k, v in meta['state_slots'].items() if v['visibility'] == 'agent' or self._role != 'agent'}) + + def read(self, *, instance_id, state_ids=None): + self._target(instance_id) + h = self._host + values = h.read(self._role) + ids = list(values) if state_ids is None else state_ids + if not isinstance(ids, list) or any(not isinstance(k, str) for k in ids): + raise ActionRejected('INVALID_ARGUMENT') + if any(k not in values for k in ids): + raise ActionRejected('ACCESS_DENIED') + return dict(instance_id=instance_id, status='succeeded', state_revision=h.revision, clock={'domain': 'simulation', 'time_s': h.time_s}, + observations={k: dict(value=copy.deepcopy(values[k]), unit=SLOTS[k]['unit'], + quality='unavailable' if values[k] is None else 'estimated' if SLOTS[k]['origin'] in ('sensor', 'derived') else 'valid', + sample_time_s=h.time_s, sample_window_s=None) for k in ids}) + + def _filter_result(self, result): + result = copy.deepcopy(result) + # Public acquisition payloads use the same redaction for every role; provenance.read is the evaluator channel. + if 'rows' in result and 'template_source' in result: + result['template_source'] = (str(LIBRARY_PATH.relative_to(ROOT)) + '; selected record available only through evaluator provenance.read') if result['template_source'] is not None else None + result['evidence'] = ('synthetic_forward_model; quantised encoder/time/temperature observations and external weighings; manufacturer MVR scalar with explicit priors; selected record restricted' + if result['operation_id'] is not None else 'no_measurement') + return result + + def invoke(self, *, instance_id, capability_id, arguments, request_id): + h = self._host + try: + self._target(instance_id) + if not isinstance(capability_id, str) or capability_id not in CAPS: + raise ActionRejected('UNKNOWN_CAPABILITY') + if self._role == 'agent' and CAPS[capability_id]['visibility'] != 'agent': + raise ActionRejected('ACCESS_DENIED') + if not isinstance(request_id, str) or not request_id: + raise ActionRejected('INVALID_ARGUMENT') + validate(CAPS[capability_id]['input_schema'], arguments) + key = (self._principal, request_id) + digest = json.dumps([capability_id, arguments], sort_keys=True, allow_nan=False) + if key in h._requests: + old, response = h._requests[key] + if old != digest: + raise ActionRejected('REQUEST_CONFLICT') + return copy.deepcopy(response) + # Operations started by another *agent* are private to it; ones started from the physical panel or by the host + # (evaluator/debug principals, e.g. a Matterix key press) are visible to every operator at the instrument. + owner = h._owners.get(h.operation_id) if h.operation_id else None + foreign = owner is not None and owner != self._principal and h._principals.get(owner) == 'agent' + if capability_id in ('acquisition.stop', 'acquisition.result') and self._role == 'agent' and foreign: + raise ActionRejected('ACCESS_DENIED') + if capability_id in ('cutter.cut', 'thermal.set_temperature') and h.phase == 'running' and self._role == 'agent' and foreign: + raise ActionRejected('ACCESS_DENIED') + if capability_id == 'power.set' and not arguments['enabled'] and h.phase == 'running' and self._role == 'agent' and foreign: + raise ActionRejected('ACCESS_DENIED') + result = self._filter_result(h.invoke(capability_id, **arguments)) + operation = result.get('operation_id') if capability_id == 'acquisition.start' else None + if operation: + h._owners[operation] = self._principal + response = dict(protocol_version=PROTOCOL_VERSION, instance_id=instance_id, request_id=request_id, operation_id=operation, + status='accepted' if operation else 'succeeded', state_revision=h.revision, clock={'domain': 'simulation', 'time_s': h.time_s}, + result=result, observations={}, error=None) + h._requests[key] = (digest, copy.deepcopy(response)) + return response + except ActionRejected as exc: + return dict(protocol_version=PROTOCOL_VERSION, instance_id=instance_id, request_id=request_id, operation_id=None, + status='unsupported' if str(exc) == 'UNSUPPORTED' else 'rejected', state_revision=h.revision, + clock={'domain': 'simulation', 'time_s': h.time_s}, result={}, observations={}, + error=dict(code=str(exc), message=str(exc), retryable=False, side_effects='none')) + + def write(self, *, instance_id, state_id, value, request_id): + self._target(instance_id) + if not isinstance(state_id, str): + raise ActionRejected('INVALID_ARGUMENT') + entry = SLOTS.get(state_id) + if not entry or state_id not in WRITE_VIA: + raise ActionRejected('ACCESS_DENIED') + capability, argument = WRITE_VIA[state_id] + return self.invoke(instance_id=instance_id, capability_id=capability, arguments={argument: value}, request_id=request_id) + + def poll(self, operation_id): + h = self._host + if not isinstance(operation_id, str): + raise ActionRejected('INVALID_ARGUMENT') + if h._owners.get(operation_id) != self._principal: + raise ActionRejected('ACCESS_DENIED') + result = h._result() if operation_id == h.operation_id and h.phase == 'running' else h.records.get(operation_id) + if result is None: + raise ActionRejected('UNKNOWN_OPERATION') + return dict(operation_id=operation_id, status=result['phase'], result=self._filter_result(result)) + + def cancel(self, operation_id, request_id): + self.poll(operation_id) + h = self._host + if not isinstance(request_id, str) or not request_id: + raise ActionRejected('INVALID_ARGUMENT') + key = (self._principal, request_id) + if key in h._cancel_operations: + if h._cancel_operations[key] != operation_id: + raise ActionRejected('REQUEST_CONFLICT') + return copy.deepcopy(h._requests[key][1]) + if key in h._requests: + raise ActionRejected('REQUEST_CONFLICT') + if operation_id != h.operation_id or h.phase != 'running': + raise ActionRejected('NOT_RUNNING') + result = self.invoke(instance_id=h.instance_id, capability_id='acquisition.stop', arguments={}, request_id=request_id) + if result['status'] == 'succeeded': + h._cancel_operations[key] = operation_id + return result + + +WRITE_VIA = {'thermal.target_k': ('thermal.set_temperature', 'target_k')} # the load is placed by the host (evaluator weight.configure) +EFFECTS = { + 'plant.configure': ['plant.configured', 'thermal.target_k', 'truth.barrel_temperature_k', 'truth.sample_temperature_k', 'heater.output_fraction'], + 'balance.configure': ['balance.configured'], + 'method.configure': ['method.configured', 'method.test_load_kg'], + 'power.set': ['power.enabled', 'power.angle_rad', 'thermal.indicated_k', 'encoder.position_m', 'encoder.in_range', 'acquisition.phase', 'measurement.validity', + 'measurement.live_mvr_m3_s', 'truth.heater_power_w', 'heater.output_fraction', 'cutter.running', 'measurement.mvr_m3_s', 'measurement.mfr_kg_s'], + 'thermal.set_temperature': ['thermal.target_k'], + 'weight.configure': ['weight.total_load_kg'], + 'sample.load': ['sample.present', 'preheat.elapsed_s', 'truth.sample_mass_kg', 'truth.sample_temperature_k', 'truth.melt_fraction', 'truth.pellet_fraction', 'truth.thermal_history_s'], + 'sample.remove': ['sample.present', 'preheat.elapsed_s', 'truth.sample_mass_kg', 'truth.sample_temperature_k', 'truth.melt_fraction', 'truth.pellet_fraction', 'truth.thermal_history_s'], + 'piston.withdraw': ['piston.target_m', 'piston.moving', 'piston.contact'], + 'piston.insert': ['piston.target_m', 'piston.moving', 'piston.contact'], + 'cutter.cut': ['cutter.running'], + 'collection.clear': ['segments.count', 'segments.unweighed', 'extrudate.length_m', 'extrudate.last_cut_length_m', 'truth.strand_mass_kg'], + 'balance.weigh': ['balance.busy', 'segments.unweighed'], + 'calibration.encoder': ['encoder.position_m'], + 'calibration.balance': [], + 'acquisition.start': ['acquisition.phase', 'acquisition.elapsed_s', 'acquisition.points', 'measurement.validity', 'cutter.running', 'measurement.live_mvr_m3_s'], + 'acquisition.stop': ['acquisition.phase', 'measurement.validity', 'measurement.live_mvr_m3_s', 'measurement.mvr_m3_s', 'measurement.mfr_kg_s'], + 'sim.step': list(SLOTS), +} +for _k, _v in EFFECTS.items(): + CAPS[_k]['effects'] = _v +ERRORS = sorted(set(re.findall(r"ActionRejected\('([A-Z_0-9]+)'", Path(__file__).read_text())) | + {'USER_CANCEL', 'POWER_OFF', 'WINDOW_TRAVERSED', 'STARTED_BELOW_WINDOW', 'SAMPLE_EXHAUSTED', 'DURATION_ELAPSED'}) +ASYNC = {'acquisition.start'} +LIMITATIONS = [ + '选定Mflow 1128610(230V)基础版:料筒1128612内径9.55mm、活塞1128614(即0.325kg载荷档)、口模312342 2.095mm×8mm(烧结耐磨耐酸);未选气动提升/选重器1128621/1128624、清洗1128622、预载1128623、预热位活塞保持1128627、口模塞1128618、分隔板1128619、回冷090173、半口模325554、耐酸料筒/活塞1128613/1128615与PVC口模092326;不建模换口模。', + '厂家规格:50–450°C、总载荷0.325–21.6kg、位移分辨率0.003mm(方法B误差限±0.02mm)、时间分辨率0.002s(误差限±0.01s)、温度显示分辨率<0.1K、口模以上0–75mm温度准确度<0.3K(ISO 1133-2);这些是分辨率/误差限,不是本模型的噪声模型。', + '炉体为集中热节点,PI控温;热容、散热、加热器上限(≤0.7kVA连接视在功率)、控温参数与试样换热导率都是宿主显式输入的工程参数,不是厂家数据;温度准确度未经ISO 1133-2认证。', + '试样为装料焓节点:比热、潜热(熔程线性)、颗粒堆积密度、熔体密度均为宿主先验;厂家库只给23°C固体密度与DSC熔点,固体密度不得当作测试温度下熔体密度。', + '口模流动由所选厂家MVR标量在其温度/载荷下锚定,经宿主给定的幂律指数n、流动活化能Ea和热历史速率外推到实际条件,并扣除活塞摩擦;单个MVR/MFR不能唯一决定完整流变曲线、入口压力损失、壁滑或温敏性。', + '未熔颗粒按φ³抑制流动(显式假设);颗粒压实只随熔化单向发生,重新凝固不会恢复颗粒堆积。', + '活塞位置=料柱高度(ISO平均截面0.711cm²);方法B的MVR由窗口内首末量化位移与量化时间计算;方法A的MFR只用外接天平称得的测量切段质量与其切断间隔;密度只在两者都有时给出。', + '砝码下落势能分为摩擦功(进入炉体)与压力功:推动熔体通过口模的部分Δp·V在口模内耗散并随挤出物离开,压实部分进入留在料筒内的试样;手动升降活塞的宿主功含势能变化与摩擦热;挤出物带走其焓(在空气中冷却,视为离开系统边界),质量仍在库存中直到收集或清走。', + '切刀为交替半圈,经过π/2瞬间切断;首次切断清除预热期挤出物,之后相邻两次自动切断之间为测量切段;切刀电机功率/速度未公开,半圈时间为工程参数。', + '外接分析天平(厂家可选043851/014720,0.1mg读数)只作RS-232代理:稳定时间、增益/偏置和分辨率由宿主给定;称量不在Mflow主机内完成。', + '位移传感器按照片所见转臂结构建模,量程约0–107mm(工程假设);超量程或断电时读数为null;两点标定只使用宿主提供的独立观测值。', + 'agent只能看到量化位移、显示温度、切段观测和结果;精确活塞位置、熔融分数、真实流率和所选材料身份只对evaluator可见;acquisition.result对所有角色隐去材料身份,完整来源只能经provenance.read获得。', + '时间推进为事件对齐的守恒子步(≤50ms;炉体PI为显式、料筒—试样换热为指数松弛):所有能量/质量项用同一数值记账因而账本精确闭合,但不同step切分会造成约1e-8–1e-7m、1e-4K量级的真值差,恰在量化边界附近的个别记录行(约1%)会相差一个量化步(0.003mm),MVR不受影响。', + '正向模型的位移—体积换算与方法B分析使用同一ISO平均截面0.711cm²,因此方法B的回收只检验量化与算术,不独立检验截面假设(环隙回流未建模)。', + '默认n/Ea先验跨条件外推有明显误差:例如B4330G6 HR从250°C/2.16kg外推到260°C/5kg得约16.5cm³/10min,厂家表为19(−13%);换条件时宿主应改用该条件的厂家数值格或给出更合适的先验。', + '热历史倍率exp(k·t)限制在1e-3–1e3的数值域;堆积密度不得大于熔体密度(被拒);每次采集的记录行不超过200000行(方法设定时检查)。', + '每次采集保存自己的方法快照、记录行与切段:清走收集区、改方法或称量其它切段都不会改写已完成的结果;晚完成的称量只回填其所属采集。每次采集的切段不超过10000个(手动切刀与自动切段共用预算);由某个agent启动的采集中,其他agent不能改温度设定、切刀、停止或读取其结果;面板/宿主启动的采集对所有操作者共享。', + '没有真实硬件、testXpert连接、机器人装料/压实/清筒、挤出丝接触或卷曲、离模膨胀实测与ISO认证。', +] + + +def export_zwick_mflow_contract_metadata(): + slots = {} + caps = {} + for k, v in SLOTS.items(): + slots[k] = dict(meaning_zh=v['meaning'], component_ids=[v['component']], value_schema=copy.deepcopy(v['schema']), unit=v['unit'], + reference_conditions=v['reference'], origin=v['origin'], visibility=v['visibility'], + access='read_write' if k in WRITE_VIA else 'read_only', + read_binding=dict(backend='host', artifact_id='runtime', accessor=f'ZwickMflowSession.read(state_ids=[{k!r}])'), + write_via=None if k not in WRITE_VIA else dict(capability_id=WRITE_VIA[k][0], argument=WRITE_VIA[k][1], fixed_arguments={}), + sampling=dict(mode='instant', time_domain='simulation', window_description='Pure read; encoder 0.003 mm, time 0.002 s, display 0.01 K quantisation; rows on the method time grid.'), + source_ids=['simulation_assumption']) + for k, v in CAPS.items(): + un = k in UNSUPPORTED + async_ = k in ASYNC + c = {key: copy.deepcopy(v[key]) for key in ['input_schema', 'output_schema', 'component_ids', 'function_zh', 'kind', 'visibility', 'example_arguments']} + c.update(availability='unsupported' if un else 'implemented', + implementation={layer: 'absent' if un or layer in ('scene', 'robot', 'hardware') else 'implemented' for layer in ['process', 'scene', 'robot', 'hardware', 'host']}, + binding=None if un else dict(backend='host', artifact_id='runtime', entrypoint='asset_runtime.zwick_mflow.ZwickMflowSession.invoke', + invocation=f'session.invoke(instance_id="mflow_01",capability_id={k!r},arguments={v["example_arguments"]!r},request_id="unique")'), + preconditions=[] if un or v['kind'] in ('query', 'analysis', 'simulation') else [dict( + description_zh='入口原子核对通电、配置、试样/活塞/载荷/预热/温度、切刀与天平忙闲等前提;被拒时状态不变。', + state_ids=['power.enabled', 'plant.configured', 'sample.present', 'piston.contact', 'acquisition.phase'], enforced_by='runtime', check='ZwickMflowRuntime.invoke')], + state_effects=[dict(state_id=s, timing='on_step' if k == 'sim.step' else 'immediate', description_zh='设定或操作标志;温度、位移、挤出与切段只随step推进') for s in v['effects']], + observes=[], model_effects=dict(mode='none', description_zh='运行层只输出状态,由场景层绑定关节与读数', binding_ids=[]), + execution=dict(mode='asynchronous' if async_ else 'synchronous', time_domain='simulation', + completion_criterion='活塞读数越过窗口下限(或超时/料尽/取消)' if async_ else '原子配置或外部动作请求,实际状态由step推进', + completion_state_ids=['acquisition.phase'] if async_ else [], timeout_s=None, cancellation='supported' if async_ else 'unsupported', + retry='same_request_id', resources=['host_clock', 'barrel', 'piston', 'cutter', 'encoder'], + partial_failure_zh='停止/断电/超时只终止记录与自动切断;已挤出物、切段、称量记录与热状态全部保留。'), + errors=[dict(code=e, meaning_zh=e, side_effects='partial' if async_ and e in ('USER_CANCEL', 'POWER_OFF', 'SAMPLE_EXHAUSTED', 'DURATION_ELAPSED', 'STARTED_BELOW_WINDOW') else 'none') for e in ERRORS], + verification=[], limitations=LIMITATIONS, source_ids=['manufacturer_primary', 'simulation_assumption', 'template_library']) + if k in ('acquisition.start', 'piston.insert', 'piston.withdraw', 'cutter.cut', 'thermal.set_temperature', 'power.set', 'balance.weigh', 'weight.configure', 'sample.load'): + c['state_effects'] += [dict(state_id=s, timing='on_step', description_zh='由统一宿主时钟推进热、熔化、挤出、切刀、称量与量化观测') + for s in SLOTS if s not in v['effects'] and SLOTS[s]['origin'] in ('sensor', 'derived', 'scene', 'process_truth')] + caps[k] = c + mechanism = dict( + component_ids=['heater', 'barrel', 'piston', 'test_weight', 'die', 'cutter', 'displacement_sensor', 'sensor_arm', 'controller', 'balance_rs232'], + state_ids=list(slots), meaning_zh='料筒PI控温、装料熔化与压实、幂律口模流动(载荷/摩擦/温度/热历史)、活塞位移观测、切刀切段与外部称量', + implementation='lumped', + equations=['C_b dT_b/dt = P_heater - G_b (T_b - T_amb) - Q_bs + F_f |dx|/dt ; P_heater = clamp(Kp e + I, 0, P_max), dI/dt = (Kp/Ti) e (conditional integration)', + 'h(T) = cp (T - T_amb) + L phi(T), phi = clamp((T - T_lo)/(T_hi - T_lo), 0, 1) ; dH_s/dt = G_s (m_s/m_0)(T_b - T_s) + (m g - F_f) dx/dt - h_s dm_ext/dt', + 'Q = MVR_ref ((m g - F_f)/(m_ref g))^(1/n) exp(-(Ea/(n R))(1/T_s - 1/T_ref)) exp(k_h t_hist) phi^3 ; dm_ext = rho_melt Q dt', + 'x_piston = m_s (p/rho_bulk + (1-p)/rho_melt) / A_ISO, A_ISO = pi/4 ((D_barrel + D_piston)/2)^2 = 0.711 cm^2 ; p = min(p, 1 - phi)', + 'W_host = m g dx + F_f |dx| (manual moves) ; potential released under load -> F_f dx (barrel) + (m g - F_f) dx (charge)', + 'MVR_B = A_ISO (x_first - x_last)/(t_last - t_first) inside [window_lower, window_upper] from quantised encoder (3 um) and time (2 ms)', + 'MFR_A = sum(m_obs)/sum(dt_cut) over externally weighed measurement segments; density_T = MFR/MVR', + 'arm elevation = asin((x - 0.050)/0.140), upper stop 0.42 rad; encoder range ~0 .. 0.107 m'], + parameters={}, source_ids=['simulation_assumption', 'template_library'], limitations=LIMITATIONS) + import importlib.util + spec = importlib.util.spec_from_file_location('_mflow_local_annotations', ROOT / 'scripts/asset_runtime/_annotations.py') + ann = importlib.util.module_from_spec(spec) + spec.loader.exec_module(ann) + ann.KEY_ZH.update({k: v['meaning'] for k, v in SLOTS.items()}) + ann.annotate_export(SLUG, caps, slots, {'melt_flow_rate': mechanism}, + inputs={'plant.configure': (PLANT, PLANT_EXAMPLE), 'sample.load': (SAMPLE, SAMPLE_EXAMPLE), 'method.configure': (METHOD, METHOD_EXAMPLE), + 'balance.configure': (BALANCE, BALANCE_EXAMPLE)}) + for k, v in SLOTS.items(): + slots[k]['meaning_zh'] = v['meaning'] + if v['reference']: + slots[k]['reference_conditions'] = v['reference'] + return dict(asset_type_id=ASSET_TYPE_ID, catalog_id=CATALOG_ID, capabilities=caps, state_slots=slots, mechanisms={'melt_flow_rate': mechanism}) diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..cb232e362caf2a9b0ed9cf67ccbf2119f8e8001b --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,24 @@ +"""Test configuration for the public ChemLab-Assets release. + +The release does not redistribute cached third-party source documents (outputs/**/sources, source_cache, raw/ +folders, references/). Some tests re-hash those caches to prove provenance; when a cache is absent, the test is +reported as skipped with the missing path instead of failing. +""" +import pytest + +UNPUBLISHED = ("/outputs/", "/references/", "/raw/", "source_cache", "/sources/", "/vendor/") + + +def _unpublished(exc): + name = getattr(exc, "filename", None) + return isinstance(exc, FileNotFoundError) and name and any(k in str(name) for k in UNPUBLISHED) + + +@pytest.hookimpl(hookwrapper=True) +def pytest_runtest_makereport(item, call): + outcome = yield + rep = outcome.get_result() + if call.excinfo is not None and call.when in ("setup", "call") and _unpublished(call.excinfo.value): + rep.outcome = "skipped" + rep.longrepr = (str(item.path), item.location[1] or 0, + f"Skipped: needs an unpublished source cache ({call.excinfo.value.filename})") diff --git a/tests/test_asset_ametek_oxtran.py b/tests/test_asset_ametek_oxtran.py new file mode 100644 index 0000000000000000000000000000000000000000..62e57fdeb988bfa8cfc66667c83fc5f77011b3fd --- /dev/null +++ b/tests/test_asset_ametek_oxtran.py @@ -0,0 +1,916 @@ +"""CHEM-147 AMETEK MOCON OX-TRAN 2/22 L runtime tests: python3 -m unittest tests/test_asset_ametek_oxtran.py + +Themes (pipeline.md): setpoints only write targets; read/describe/poll are pure; rejected preconditions leave the state +unchanged; two instances are isolated; agent/evaluator truth isolation and result redaction; O2 mass and heat conservation; +real return values validate against the contract schemas; async completion / cancellation residue. +Physics: Faraday coulometry (1 cc/day = 0.000199 A), Fickian time lag and steady state against the analytical solution, +Arrhenius and humidity transfer, barometric and permeant normalisation, ReZero baseline, individual zero, masks, +over-range protection, drawer/clamp interlocks, thermoelectric heat-up against the manufacturer order of magnitude. +No native scene, robot or hardware claims. +""" +import copy +import importlib.util +import json +import math +import sys +import unittest +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT)) +from scripts.asset_runtime.ametek_oxtran import * # noqa: E402,F401,F403 +from scripts.asset_runtime import ametek_oxtran as rt # noqa: E402 + +PROCESS_EVIDENCE = {} +CHECKS = [] +_spec = importlib.util.spec_from_file_location('oxtran_asset_tool', ROOT / 'skills/chemistry-lab-assets/scripts/asset_tool.py') +asset_tool = importlib.util.module_from_spec(_spec) +_spec.loader.exec_module(asset_tool) +_ispec = importlib.util.spec_from_file_location('oxtran_interface', ROOT / 'outputs/expansion_batch04/t1_thermal/ametek_oxtran/interface_definition.py') +interface = importlib.util.module_from_spec(_ispec) +_ispec.loader.exec_module(interface) +PET = 'poly_ethylene_terephthalate' +T23 = 296.15 + + +def call(h, k, **a): + """Invoke through the runtime, validate the returned value and check that only declared slots changed immediately.""" + before = h.read('debug') + r = h.invoke(k, **a) + validate(CAPS[k]['output_schema'], r) + problems = asset_tool.validate_value(r, CAPS[k]['output_schema']) + if problems: + raise AssertionError(f'{k}: {problems}') + after = h.read('debug') + delta = {x for x in after if before[x] != after[x]} + if k != 'sim.step' and not delta <= set(CAPS[k]['effects']): + raise AssertionError(f'{k}: undeclared state changes {sorted(delta - set(CAPS[k]["effects"]))}') + PROCESS_EVIDENCE.setdefault(k, []).append(dict(time_s=h.time_s, result_keys=sorted(r), actual_call=True)) + return r + + +def configured(plant=None, gas=None, inst=None, cfg=None, cells=('A',)): + h = AmetekOxtranRuntime() + call(h, 'plant.configure', **dict(PLANT_EXAMPLE, **(plant or {}))) + call(h, 'gas.configure', **dict(GAS_EXAMPLE, **(gas or {}))) + call(h, 'instrument.configure', **dict(INSTRUMENT_EXAMPLE, **(inst or {}))) + for c in cells: + call(h, 'test.configure', **dict(TEST_CFG_EXAMPLE, cell=c, **(cfg or {}))) + call(h, 'power.set', enabled=True) + return h + + +def loaded(template=PET, thickness=100e-6, cell='A', h=None, mount=None, clamp=True, settle=3600.0, **kw): + h = h or configured(**kw) + call(h, 'drawer.move', cell=cell, open=True) + h.step(3.0) + call(h, 'sample.mount', **dict(MOUNT_EXAMPLE, cell=cell, template_id=template, thickness_m=thickness, **(mount or {}))) + call(h, 'drawer.move', cell=cell, open=False) + h.step(3.0) + if clamp: + call(h, 'cell.load_unload', cell=cell) + h.step(settle) + return h + + +def run_test(h, cell='A', limit_h=200.0, dt=1800.0): + call(h, 'test.start', cell=cell) + t = 0.0 + while h.cells[cell]['test']['phase'] == 'running' and t < limit_h * 3600: + call(h, 'sim.step', dt_s=dt) + t += dt + return call(h, 'test.result', cell=cell) + + +def steady_otr(template, thickness, T=T23 - PLANT_EXAMPLE['temperature_sensor_bias_k'], rh=0.0, o2=0.999, baro=101325.0, E=45000.0, beta=0.0): + rec = library()[template] + f = math.exp(-E / GAS_CONSTANT * (1 / T - 1 / rec['reference_temperature_K']) + beta * rh) + pw = rh * saturation_pressure_pa(T) + return rec['oxygen_permeability_mol_m_per_m2_s_Pa'] * f * o2 * (baro - pw) / thickness + + +class ConstantsAndLibrary(unittest.TestCase): + def test01_identity_and_documented_constants(self): + self.assertEqual(ASSET_TYPE_ID, 'instrument.ametek_oxtran') + self.assertEqual(CATALOG_ID, 'CHEM-147') + self.assertAlmostEqual(AMP_PER_CC_DAY, 0.000199, delta=0.0000005) # manual appendix D + self.assertEqual(TEMPERATURE_RANGE_K, (283.15, 313.15)) + self.assertAlmostEqual(TEST_AREA_M2, 50e-4) + self.assertAlmostEqual(MAX_FILM_THICKNESS_M, 3.048e-3) + self.assertEqual(OTR_RANGE_CC_M2_DAY, (0.005, 200.0)) + self.assertAlmostEqual(SENSOR_RANGE_MOL_S * CC_DAY_PER_MOL_S, 1.0) # 200 cc/(m2 day) x 50 cm2 = 1 cc/day + + def test02_interface_geometry_agrees_with_runtime(self): + self.assertAlmostEqual(interface.DRAWER_TRAVEL_M, DRAWER_TRAVEL_M) + self.assertAlmostEqual(interface.CLAMP_TRAVEL_M, CLAMP_TRAVEL_M) + self.assertAlmostEqual(interface.POWER_SWITCH_ON_RAD, POWER_SWITCH_ON_RAD) + self.assertAlmostEqual(interface.TEST_AREA_M2, TEST_AREA_M2) + for part, sid, capid, *_ in interface.MOTION: + self.assertIn(sid, SLOTS) + self.assertIn(capid, CAPS) + for r in interface.READOUTS: + self.assertIn(r['source']['bridge'][0], SLOTS) + self.assertEqual(SLOTS[r['source']['bridge'][0]]['visibility'], 'agent') + for lamp in interface.LAMPS: + self.assertIn(lamp['source']['lamp']['bridge'], SLOTS) + for key, (capid, args) in interface.KEY_COMMANDS.items(): + validate(CAPS[capid]['input_schema'], args) + self.assertAlmostEqual(interface.OTR_DISPLAY_SCALE, CC_DAY_PER_MOL_S) + + def test03_template_library_real_and_complete(self): + lib = json.loads(LIBRARY_PATH.read_text()) + self.assertGreaterEqual(lib['coverage']['template_count'], 50) + self.assertGreaterEqual(lib['coverage']['with_measured_diffusivity'], 50) + self.assertEqual(lib['coverage']['synthetic_records'], 0) + for t in lib['templates']: + self.assertEqual(t['evidence'], 'measured_literature') + self.assertTrue(t['source']['sha256'] and t['measurements']) + self.assertGreater(t['oxygen_permeability_mol_m_per_m2_s_Pa'], 0) + pet = library()[PET] + self.assertAlmostEqual(pet['oxygen_permeability_barrer'], 0.11, places=6) + report = json.loads((ROOT / 'outputs/expansion_batch04/t1_thermal/ametek_oxtran/independent_permeation_source_validation.json').read_text()) + self.assertEqual(report['status'], 'passed') + + def test04_film_step_is_exactly_conservative_and_converges_to_linear_profile(self): + c = [5.0] * 20 + dx = 1e-6 + total0 = sum(c) * dx + jt_sum = jb_sum = 0.0 + for _ in range(4000): + c, jt, jb = rt.film_step(c, dx, 1e-12, 10.0, 0.0, 0.5) + jt_sum += jt * 0.5 + jb_sum += jb * 0.5 + self.assertAlmostEqual(sum(c) * dx - total0, jt_sum - jb_sum, delta=1e-12 * total0) + L = 20 * dx + self.assertAlmostEqual(jb, 1e-12 * 10.0 / L, delta=1e-9 * 1e-12 * 10.0 / L) + + def test05_is_stable_requires_step_and_window_drift(self): + self.assertTrue(rt.is_stable([1.0, 1.0, 1.001, 1.0], 3, 1.0, 0.0)) + self.assertFalse(rt.is_stable([1.0, 1.006, 1.012, 1.018], 3, 1.0, 0.0)) # every step < 1 % but drift 1.8 % + self.assertFalse(rt.is_stable([1.0, 1.0], 3, 1.0, 0.0)) + + +class RuntimeContract(unittest.TestCase): + def test10_setpoints_only_write_targets(self): + h = configured() + T0 = h.T + call(h, 'thermal.set_temperature', target_k=313.15) + call(h, 'humidity.set', rh_fraction=0.5) + self.assertEqual(h.T, T0) + self.assertEqual(h.rh_model, 0.0) + self.assertEqual(h.read('agent')['thermal.target_k'], 313.15) + call(h, 'sim.step', dt_s=600.0) + self.assertGreater(h.T, T0 + 3.0) + self.assertGreater(h.rh_model, 0.3) + + def test11_read_describe_poll_do_not_advance_time(self): + h = loaded() + h.register_principal('agent', 'agent') + s = h.session('agent') + r = s.invoke(instance_id='oxtran_01', capability_id='test.start', arguments={'cell': 'A'}, request_id='x1') + t0, rev = h.time_ns, h.revision + before = copy.deepcopy(h.read('debug')) + for _ in range(3): + s.read(instance_id='oxtran_01') + s.describe(instance_id='oxtran_01') + s.poll(r['operation_id']) + call(h, 'test.result', cell='A') + call(h, 'analysis.otr', **CAPS['analysis.otr']['example_arguments']) + self.assertEqual((h.time_ns, h.revision), (t0, rev)) + self.assertEqual(before, h.read('debug')) + + def test12_rejections_leave_state_unchanged(self): + h = configured() + cases = [('test.start', dict(cell='A'), 'CELL_NOT_CLAMPED'), ('sample.mount', dict(MOUNT_EXAMPLE), 'DRAWER_NOT_OPEN'), + ('sample.unmount', dict(cell='A'), 'NO_FILM'), ('humidity.set', dict(rh_fraction=0.02), 'RH_OUTSIDE_CONTROLLED_RANGE'), + ('test.stop', dict(cell='A'), 'NOT_RUNNING'), + ('instrument.configure', dict(INSTRUMENT_EXAMPLE, barometer_mode='manual', manual_barometer_pa=None), 'MANUAL_BAROMETER_REQUIRED'), + ('plant.configure', dict(PLANT_EXAMPLE), 'PLANT_ALREADY_CONFIGURED'), ('package.test', {}, 'UNSUPPORTED')] + for k, a, code in cases: + before = copy.deepcopy(h.read('debug')) + with self.assertRaises(ActionRejected) as e: + h.invoke(k, **a) + self.assertEqual(str(e.exception), code, k) + self.assertEqual(before, h.read('debug'), k) + with self.assertRaises(ActionRejected): + h.invoke('thermal.set_temperature', target_k=320.0) + with self.assertRaises(ActionRejected): + h.invoke('test.configure', **dict(TEST_CFG_EXAMPLE, cycles=True)) + + def test13_two_instances_isolated(self): + a = loaded() + b = configured() + call(a, 'thermal.set_temperature', target_k=303.15) + a.step(3600.0) + self.assertAlmostEqual(b.T, PLANT_EXAMPLE['ambient_k']) + self.assertIsNone(b.cells['A']['film']) + self.assertIsNotNone(a.cells['A']['film']) + + def test14_agent_truth_isolation_and_redaction(self): + h = loaded() + h.register_principal('agent', 'agent'); h.register_principal('eval', 'evaluator') + ag, ev = h.session('agent'), h.session('eval') + obs = ag.read(instance_id='oxtran_01')['observations'] + self.assertTrue(all(SLOTS[k]['visibility'] == 'agent' for k in obs)) + self.assertFalse(any(k.startswith('truth.') for k in obs)) + with self.assertRaises(ActionRejected): + ag.read(instance_id='oxtran_01', state_ids=['truth.cell_a.flux_mol_s']) + for k in ('ledger.read', 'provenance.read', 'sample.mount', 'drawer.move', 'sim.step', 'plant.configure'): + self.assertEqual(ag.invoke(instance_id='oxtran_01', capability_id=k, arguments=CAPS[k]['example_arguments'], request_id='r' + k)['error']['code'], 'ACCESS_DENIED') + r = ag.invoke(instance_id='oxtran_01', capability_id='test.start', arguments={'cell': 'A'}, request_id='s1') + h.step(8 * 3600.0) + res = ag.invoke(instance_id='oxtran_01', capability_id='test.result', arguments={'cell': 'A'}, request_id='q1')['result'] + self.assertNotIn(PET, json.dumps(res)) + self.assertIn('evaluator provenance.read', res['template_source']) + prov = ev.invoke(instance_id='oxtran_01', capability_id='provenance.read', arguments={}, request_id='p1')['result'] + self.assertIn(PET, prov['cell_a']) + self.assertEqual(prov['operations'][0]['operation_id'], r['operation_id']) + desc = ag.describe(instance_id='oxtran_01') + self.assertFalse(any(v['visibility'] != 'agent' for v in desc['capabilities'].values())) + + def test15_foreign_agent_guard_and_shared_panel_tests(self): + h = loaded() + for p in ('a1', 'a2'): + h.register_principal(p, 'agent') + h.register_principal('panel', 'evaluator') + s1, s2, panel = h.session('a1'), h.session('a2'), h.session('panel') + s1.invoke(instance_id='oxtran_01', capability_id='test.start', arguments={'cell': 'A'}, request_id='x') + h.step(3600.0) + for k, a in [('test.stop', {'cell': 'A'}), ('test.result', {'cell': 'A'}), ('cell.load_unload', {'cell': 'A'}), ('thermal.set_temperature', {'target_k': 300.0}), + ('humidity.set', {'rh_fraction': 0.0}), ('power.set', {'enabled': False}), ('instrument.configure', dict(INSTRUMENT_EXAMPLE))]: + self.assertEqual(s2.invoke(instance_id='oxtran_01', capability_id=k, arguments=a, request_id='y' + k)['error']['code'], 'ACCESS_DENIED', k) + self.assertEqual(s1.invoke(instance_id='oxtran_01', capability_id='test.stop', arguments={'cell': 'A'}, request_id='z')['status'], 'succeeded') + # a panel/host-started test is visible to every operator + call(h, 'test.start', cell='A') + h._owners[h.cells['A']['test']['op']] = 'panel' + self.assertEqual(s2.invoke(instance_id='oxtran_01', capability_id='test.result', arguments={'cell': 'A'}, request_id='w')['status'], 'succeeded') + + def test16_request_dedupe_conflict_and_write_via(self): + h = configured() + h.register_principal('agent', 'agent') + s = h.session('agent') + r1 = s.invoke(instance_id='oxtran_01', capability_id='thermal.set_temperature', arguments={'target_k': 300.0}, request_id='same') + r2 = s.invoke(instance_id='oxtran_01', capability_id='thermal.set_temperature', arguments={'target_k': 300.0}, request_id='same') + self.assertEqual(r1, r2) + self.assertEqual(s.invoke(instance_id='oxtran_01', capability_id='thermal.set_temperature', arguments={'target_k': 301.0}, request_id='same')['error']['code'], 'REQUEST_CONFLICT') + w = s.write(instance_id='oxtran_01', state_id='humidity.target_fraction', value=0.5, request_id='w1') + self.assertEqual(w['status'], 'succeeded') + self.assertEqual(h.rh_target, 0.5) + with self.assertRaises(ActionRejected): + s.write(instance_id='oxtran_01', state_id='cell_a.phase', value='idle', request_id='w2') + + def test17_poll_and_cancel_keep_partial_readings(self): + h = loaded() + h.register_principal('agent', 'agent') + s = h.session('agent') + op = s.invoke(instance_id='oxtran_01', capability_id='test.start', arguments={'cell': 'A'}, request_id='s')['operation_id'] + h.step(4 * 3600.0) + self.assertEqual(s.poll(op)['status'], 'running') + n = len(h.cells['A']['test']['readings']) + self.assertGreater(n, 0) + c = s.cancel(op, 'c1') + self.assertEqual(c['status'], 'succeeded') + self.assertEqual(s.cancel(op, 'c1'), c) + res = s.poll(op) + self.assertEqual(res['status'], 'cancelled') + self.assertEqual(len(res['result']['readings']), n) + self.assertEqual(res['result']['validity'], 'cancelled') + h.step(3600.0) + self.assertEqual(h.cells['A']['p_up'] < 1.0, True) # test gas switched back to carrier flushing + with self.assertRaises(ActionRejected): + s.cancel(op, 'c2') + + def test18_unsupported_options_are_explicit(self): + h = configured() + for k in UNSUPPORTED: + with self.assertRaises(ActionRejected) as e: + h.invoke(k) + self.assertEqual(str(e.exception), 'UNSUPPORTED') + + +class Physics(unittest.TestCase): + def test20_heatup_matches_manufacturer_order_of_magnitude(self): + h = configured() + call(h, 'thermal.set_temperature', target_k=313.15) + t = 0.0 + while h.T + PLANT_EXAMPLE['temperature_sensor_bias_k'] < T23 + 0.99 * (313.15 - T23): + h.step(30.0); t += 30.0 + self.assertLess(t, 6 * 3600.0) # not an order of magnitude slower than ~60 min (2/28 manual) + self.assertGreater(t, 20 * 60.0) + h.step(3 * 3600.0) + bias = PLANT_EXAMPLE['temperature_sensor_bias_k'] + self.assertLess(abs(h.T + bias - 313.15), 0.02) # controlled on the (biased) sensor + self.assertLess(abs(h.read('agent')['thermal.indicated_k'] - 313.15), 0.02) + call(h, 'thermal.set_temperature', target_k=283.15) # thermoelectric cooling below ambient + h.step(4 * 3600.0) + self.assertLess(abs(h.T + bias - 283.15), 0.05) + L = h.ledger() + self.assertLess(abs(L['energy_residual_j']), 1e-6 * max(1.0, abs(L['tec_heat_j']))) + + def test21_pet_time_lag_and_steady_state_vs_analytical(self): + h = loaded() + res = run_test(h)['result'] if False else run_test(h) + exams = [r['otr_mol_m2_s'] for r in res['readings'] if r['kind'] == 'exam'] + target = steady_otr(PET, 100e-6) + self.assertEqual(res['validity'], 'valid') + self.assertLess(exams[0], 0.7 * target) # the first exam still sits on the time-lag rise + self.assertLess(abs(res['final_otr_mol_m2_s'] - target) / target, 0.01) + self.assertTrue(res['converged'] and res['within_repeatability_spec']) + self.assertAlmostEqual(res['permeance_mol_m2_s_pa'], res['final_otr_mol_m2_s'] / STD_PRESSURE_PA) + self.assertAlmostEqual(res['permeability_mol_m_per_m2_s_pa'], res['permeance_mol_m2_s_pa'] * 100e-6) + PROCESS_EVIDENCE['representative_pet_100um'] = dict(final_cc_m2_day=res['final_otr_cc_m2_day'], expected_cc_m2_day=target * CC_DAY_PER_MOL_S, + exams=len(exams), individual_zero=res['individual_zero_mol_m2_s']) + + def test22_quantisation_resolution_and_sensor_counts(self): + h = loaded() + res = run_test(h) + for r in res['readings']: + q = r['otr_cc_pkg_day'] / (OTR_RESOLUTION_CC_M2_DAY * TEST_AREA_M2) + self.assertAlmostEqual(q, round(q), places=6) + self.assertIsInstance(r['sensor_counts'], int) + self.assertEqual(h.read('agent')['sensor.raw_counts'], int(round(h._measured_current() / COUNT_A))) # measured (noisy) current + + def test23_faraday_sensor_current_matches_input(self): + h = loaded() + call(h, 'test.start', cell='A') + h.step(6 * 3600.0) + while h.route != 'A': + h.step(60.0) + h.step(29 * 60.0) + I_ss = 4 * FARADAY * PLANT_EXAMPLE['sensor_efficiency'] * h.sensor_in + PLANT_EXAMPLE['sensor_background_a'] + self.assertLess(abs(h.sensor_I - I_ss) / I_ss, 0.01) + + def test24_rezero_baseline_is_subtracted(self): + nz = dict(individual_zero='none') + base = run_test(loaded(gas=dict(carrier_o2_impurity_fraction=2e-6), cfg=nz)) + dirty = run_test(loaded(gas=dict(carrier_o2_impurity_fraction=5e-4), cfg=nz)) # large carrier residual: cancels via ReZero + self.assertGreater(dirty['rezero_readings'][0]['sensor_counts'], 20 * base['rezero_readings'][0]['sensor_counts']) + self.assertLess(abs(dirty['final_otr_mol_m2_s'] - base['final_otr_mol_m2_s']) / base['final_otr_mol_m2_s'], 0.02) + noz = run_test(loaded(gas=dict(carrier_o2_impurity_fraction=5e-4), inst=dict(rezero_enabled=False), cfg=nz)) + self.assertGreater(noz['final_otr_mol_m2_s'], dirty['final_otr_mol_m2_s'] + 5 * REPEATABILITY_CC_M2_DAY / CC_DAY_PER_MOL_S) + + def test25_no_catalyst_removal_without_hydrogen(self): + h1 = loaded(gas=dict(carrier_h2_fraction=0.02)) + h2 = loaded(gas=dict(carrier_h2_fraction=0.0)) + self.assertAlmostEqual(h1._carrier_residual_fraction(), 2e-6 * (1 - PLANT_EXAMPLE['catalyst_removal_efficiency'])) + self.assertAlmostEqual(h2._carrier_residual_fraction(), 2e-6) + + def test26_barometric_and_permeant_normalisation(self): + ref = run_test(loaded()) + alt = run_test(loaded(plant=dict(barometric_pa=85000.0))) + self.assertLess(abs(alt['final_otr_mol_m2_s'] - ref['final_otr_mol_m2_s']) / ref['final_otr_mol_m2_s'], 0.015) # normalised to 760 mmHg + air = run_test(loaded(gas=dict(test_o2_fraction=0.2095), inst=dict(permeant_concentration_percent=20.95))) + self.assertLess(abs(air['final_otr_mol_m2_s'] - ref['final_otr_mol_m2_s']) / ref['final_otr_mol_m2_s'], 0.03) + wrong = run_test(loaded(gas=dict(test_o2_fraction=0.2095))) # air supplied but 100 % declared + self.assertLess(wrong['final_otr_mol_m2_s'], 0.25 * ref['final_otr_mol_m2_s']) + + def test27_temperature_arrhenius(self): + cold = run_test(loaded()) + h = configured() + call(h, 'thermal.set_temperature', target_k=308.15) + h.step(3 * 3600.0) + hot = run_test(loaded(h=h)) + ratio = hot['final_otr_mol_m2_s'] / cold['final_otr_mol_m2_s'] + expected = steady_otr(PET, 100e-6, T=308.15 - PLANT_EXAMPLE['temperature_sensor_bias_k']) / steady_otr(PET, 100e-6) + self.assertLess(abs(ratio - expected) / expected, 0.02) + self.assertGreater(ratio, 1.06 ** 12) # manufacturer: 6-15 % per degC for many barriers + + def test28_humidity_dilution_and_water_sensitive_coefficient(self): + h = configured() + call(h, 'humidity.set', rh_fraction=0.9) + h.step(3 * 3600.0) + wet = run_test(loaded(h=h)) + dry = run_test(loaded()) + pw = h._rh_true() * saturation_pressure_pa(h.T) + self.assertLess(abs(wet['final_otr_mol_m2_s'] / dry['final_otr_mol_m2_s'] - (101325 - pw) / 101325), 0.02) + h2 = configured() + call(h2, 'humidity.set', rh_fraction=0.5) + call(h2, 'drawer.move', cell='A', open=True); h2.step(3.0) + with self.assertRaises(ActionRejected) as e: + h2.invoke('sample.mount', **dict(MOUNT_EXAMPLE, template_id='polyacrylonitrile')) + self.assertEqual(str(e.exception), 'HUMIDITY_COEFFICIENT_REQUIRED') + call(h2, 'sample.mount', **dict(MOUNT_EXAMPLE, template_id='polyacrylonitrile', thickness_m=25e-6, humidity_coefficient=2.0)) + with self.assertRaises(ActionRejected) as e2: + h2.invoke('sample.mount', **dict(MOUNT_EXAMPLE, cell='B', template_id='nylon_6')) + self.assertIn(str(e2.exception), ('DIFFUSIVITY_REQUIRED', 'DRAWER_NOT_OPEN')) + f = h2.cells['A']['film'] + P1, D1, S1 = h2._transport(f, T23, 0.5) + P0, D0, S0 = h2._transport(f, T23, 0.0) + self.assertAlmostEqual(P1 / P0, math.exp(1.0)); self.assertAlmostEqual(S1, S0) + with self.assertRaises(ActionRejected): + h2.invoke('sample.mount', **dict(MOUNT_EXAMPLE, cell='B', humidity_coefficient=1.0)) + + def test29_mask_area_scales_package_but_not_area_result(self): + full = run_test(loaded()) + masked = run_test(loaded(mount=dict(exposed_area_m2=5e-4), cfg=dict(declared_area_m2=5e-4))) + self.assertLess(abs(masked['final_otr_mol_m2_s'] - full['final_otr_mol_m2_s']) / full['final_otr_mol_m2_s'], 0.03) + self.assertLess(abs(masked['final_otr_cc_pkg_day'] / full['final_otr_cc_pkg_day'] - 0.1), 0.005) + pkg = run_test(loaded(cfg=dict(report_basis='package'))) + self.assertAlmostEqual(pkg['final_otr_cc_pkg_day'], pkg['final_otr_mol_m2_s'] * TEST_AREA_M2 * CC_DAY_PER_MOL_S) + + def test30_over_range_protection(self): + h = loaded(thickness=25e-6) # PET 25 um ~ 257 cc/(m2 day) at 23 degC > 200 + res = run_test(h) + self.assertEqual(res['validity'], 'sensor_over_range') + self.assertEqual(res['phase'], 'failed') + self.assertGreaterEqual(h.ledger()['over_range_events'], 1) + h.step(3600.0) + self.assertFalse(h.over_range) + empty = loaded(template=PET, mount=None, clamp=False) + call(empty, 'drawer.move', cell='A', open=True); empty.step(3.0) + call(empty, 'sample.unmount', cell='A') + call(empty, 'drawer.move', cell='A', open=False); empty.step(3.0) + call(empty, 'cell.load_unload', cell='A'); empty.step(600.0) + self.assertEqual(run_test(empty)['validity'], 'sensor_over_range') # an empty cartridge floods the sensor + + def test31_individual_zero_removes_ambient_ingress_not_edge_leak(self): + leaky = run_test(loaded(plant=dict(ambient_ingress_mol_s_pa=4e-15, truseal_flush_efficiency=0.0))) + clean = run_test(loaded()) + self.assertLess(abs(leaky['final_otr_mol_m2_s'] - clean['final_otr_mol_m2_s']) / clean['final_otr_mol_m2_s'], 0.02) + self.assertGreater(leaky['individual_zero_mol_m2_s'], 0.5 * 4e-15 * 0.2095 * 1e5 / TEST_AREA_M2) + edge = run_test(loaded(plant=dict(edge_leak_mol_s_pa=1e-17))) + bias = 1e-17 * 0.999 * 101325 / TEST_AREA_M2 + self.assertGreater(edge['final_otr_mol_m2_s'] - clean['final_otr_mol_m2_s'], 0.8 * bias) + + def test32_two_cells_share_one_sensor_with_rezero(self): + h = configured(cells=('A', 'B')) + loaded(h=h, cell='A') + loaded(h=h, cell='B', template='poly_vinyl_chloride', thickness=50e-6) + call(h, 'test.start', cell='A'); call(h, 'test.start', cell='B') + seen = set() + for _ in range(600): + h.step(600.0) + seen.add(h.route) + if all(h.cells[c]['test']['phase'] != 'running' for c in 'AB'): + break + self.assertTrue({'A', 'B', 'Z'} <= seen) + a, b = call(h, 'test.result', cell='A'), call(h, 'test.result', cell='B') + self.assertEqual(a['validity'], 'valid'); self.assertEqual(b['validity'], 'valid') + self.assertLess(abs(b['final_otr_mol_m2_s'] - steady_otr('poly_vinyl_chloride', 50e-6)) / steady_otr('poly_vinyl_chloride', 50e-6), 0.02) + + def test33_standard_mode_cycles_and_start_zero(self): + h = loaded(cfg=dict(test_mode='standard', cycles=4, individual_zero='start', conditioning_hours=0.0)) + res = run_test(h) + kinds = [r['kind'] for r in res['readings']] + self.assertEqual(kinds.count('exam'), 4) + self.assertEqual(kinds[0], 'individual_zero') + self.assertEqual(res['phase'], 'succeeded') + + def test34_conditioning_keeps_sensor_off_the_cell(self): + h = loaded(cfg=dict(conditioning_hours=5.0)) + call(h, 'test.start', cell='A') + routes = set() + for _ in range(28): + h.step(600.0) + if h.cells['A']['phase'] == 'conditioning': + routes.add(h.route) + self.assertNotIn('A', routes) + self.assertGreater(h.cells['A']['p_up'], 9e4) # test gas already on during conditioning + + def test35_drawer_clamp_interlocks_and_scene_states(self): + h = configured() + call(h, 'drawer.move', cell='A', open=True) + h.step(DRAWER_TRAVEL_M / PLANT_EXAMPLE['drawer_speed_m_s'] / 2) + self.assertTrue(0 < h.read('evaluator')['drawer_a.position_m'] < DRAWER_TRAVEL_M) + with self.assertRaises(ActionRejected): + h.invoke('cell.load_unload', cell='A') + h.step(5.0) + self.assertEqual(h.read('evaluator')['drawer_a.position_m'], DRAWER_TRAVEL_M) + call(h, 'sample.mount', **MOUNT_EXAMPLE) + call(h, 'drawer.move', cell='A', open=False); h.step(5.0) + call(h, 'cell.load_unload', cell='A') + h.step(PLANT_EXAMPLE['clamp_actuation_s'] / 2) + self.assertTrue(0 < h.read('evaluator')['clamp_a.position_m'] < CLAMP_TRAVEL_M) + h.step(5.0) + st = h.read('evaluator') + self.assertEqual(st['clamp_a.position_m'], CLAMP_TRAVEL_M) + self.assertTrue(st['cell_a.clamped'] and st['cell_a.indicator_on']) + with self.assertRaises(ActionRejected): + h.invoke('drawer.move', cell='A', open=True) + call(h, 'test.start', cell='A') + with self.assertRaises(ActionRejected) as e: + h.invoke('cell.load_unload', cell='A') + self.assertEqual(str(e.exception), 'TEST_ACTIVE') + call(h, 'test.stop', cell='A') + call(h, 'cell.load_unload', cell='A'); h.step(5.0) + self.assertFalse(h.read('agent')['cell_a.clamped']) + self.assertGreater(h.ledger()['released_to_air_mol'], 0.0) + + def test36_power_off_cancels_and_keeps_clamp(self): + h = loaded() + call(h, 'test.start', cell='A') + h.step(3 * 3600.0) + call(h, 'power.set', enabled=False) + st = h.read('evaluator') + self.assertEqual(st['cell_a.phase'], 'cancelled') + self.assertTrue(st['cell_a.clamped']) + self.assertIsNone(st['thermal.indicated_k']) + self.assertEqual(st['power.angle_rad'], 0.0) + self.assertEqual(call(h, 'test.result', cell='A')['validity'], 'cancelled') + h.step(3600.0) + self.assertEqual(h.sensor_I, 0.0) + + def test37_conservation_over_a_complete_workflow(self): + h = configured(cells=('A', 'B')) + loaded(h=h, cell='A'); loaded(h=h, cell='B', template='poly_vinyl_chloride', thickness=50e-6) + call(h, 'test.start', cell='A'); call(h, 'test.start', cell='B') + h.step(4 * 3600.0) + self.assertTrue(h._test_active('B')) + call(h, 'test.stop', cell='B') + call(h, 'cell.load_unload', cell='B'); h.step(10.0) + call(h, 'drawer.move', cell='B', open=True); h.step(5.0) + call(h, 'sample.unmount', cell='B') + h.step(10 * 3600.0) + L = call(h, 'ledger.read') + prov = call(h, 'provenance.read') + self.assertIsNone(prov['cell_b']) + self.assertIn('poly_ethylene_terephthalate', prov['cell_a']) + self.assertEqual(len(prov['operations']), 2) + scale = max(L['film_mounted_mol'], L['carrier_in_mol']) + self.assertLess(abs(L['film_residual_mol']), 1e-9 * scale) + self.assertLess(abs(L['carrier_residual_balance_mol']), 1e-9 * scale) + self.assertLess(abs(L['sensor_balance_residual_mol']), 1e-12 * max(L['sensor_input_mol'], 1e-30) + 1e-24) + self.assertLess(abs(L['energy_residual_j']), 1e-6 * max(1.0, abs(L['tec_heat_j']))) + self.assertGreater(L['carrier_gas_used_mol'], 0); self.assertGreater(L['test_gas_used_mol'], 0) + + def test38_step_splitting_is_consistent(self): + a, b = loaded(), loaded() + call(a, 'test.start', cell='A'); call(b, 'test.start', cell='A') + a.step(6 * 3600.0) + for _ in range(360): + b.step(60.0) + self.assertEqual(a.time_ns, b.time_ns) + self.assertLess(abs(a.read('evaluator')['truth.cell_a.flux_mol_s'] - b.read('evaluator')['truth.cell_a.flux_mol_s']), + 0.01 * a.read('evaluator')['truth.cell_a.flux_mol_s']) + self.assertEqual(len(a.cells['A']['test']['readings']), len(b.cells['A']['test']['readings'])) + + def test39_no_user_gain_on_the_2_22_and_analysis(self): + h = loaded() + with self.assertRaises(ActionRejected) as e: # 2/22: out-of-spec certified film -> service, no user adjustment + h.invoke('sensor.adjust') + self.assertEqual(str(e.exception), 'UNSUPPORTED') + self.assertNotIn('sensor.adjust_gain', SLOTS) + out = call(h, 'analysis.otr', readings_mol_m2_s=[1e-8, 1.01e-8, 1e-8], individual_zero_mol_m2_s=1e-10, window=3, driving_partial_pressure_pa=1e5, + thickness_m=1e-4, convergence_percent=2.0) + self.assertAlmostEqual(out['steady_state_otr_mol_m2_s'], 1.0033333333333333e-8 - 1e-10) + self.assertTrue(out['converged']) + self.assertAlmostEqual(out['permeability_barrer'], out['permeability_mol_m_per_m2_s_pa'] / rt.BARRER_SI) + + def test40_metadata_exports_every_capability_and_slot(self): + meta = export_ametek_oxtran_contract_metadata() + self.assertEqual(set(meta['capabilities']), set(CAPS)) + self.assertEqual(set(meta['state_slots']), set(SLOTS)) + for k, c in meta['capabilities'].items(): + self.assertEqual(asset_tool.lint_schema(c['input_schema']) if hasattr(asset_tool, 'lint_schema') else [], [], k) + validate(c['input_schema'], c['example_arguments']) + for k, s in meta['state_slots'].items(): + if s['origin'] == 'process_truth': + self.assertIn(s['visibility'], ('evaluator', 'debug')) + self.assertEqual(set(WRITE_VIA), {'thermal.target_k', 'humidity.target_fraction'}) + + + def test41_high_permeance_film_is_stable_and_matches_coupled_steady_state(self): + # most permeable template with a measured D, thin film, tiny carrier chamber: film and chamber strongly coupled + lib = library() + top = max((k for k in lib if lib[k]['oxygen_diffusivity_m2_s']), key=lambda k: lib[k]['oxygen_permeability_mol_m_per_m2_s_Pa']) + V = 1e-7 + h = loaded(template=top, thickness=25e-6, settle=5.0, plant=dict(carrier_chamber_volume_m3=V), cfg=dict(conditioning_hours=5.0, individual_zero='none')) + call(h, 'test.start', cell='A') + for _ in range(24): + call(h, 'sim.step', dt_s=300.0) + ev = h.read('evaluator') + self.assertTrue(all(math.isfinite(v) for v in ev.values() if isinstance(v, float) and not isinstance(v, bool))) + self.assertGreaterEqual(ev['truth.cell_a.carrier_side_o2_mol'], 0.0) + self.assertEqual(h.cells['A']['phase'], 'conditioning') # sensor bypassed: no over-range trip while conditioning + film = h.cells['A']['film'] + P, D, S = h._transport(film, h.T, h._rh_true()) + p = h.plant + p_up = h.cells['A']['p_up'] + n_c = rt.molar_flow(CARRIER_FLOW_SCCM) + kh = n_c * GAS_CONSTANT * h.T / h._baro() / V + g = TEST_AREA_M2 * P / film['L'] + q_in = p['edge_leak_mol_s_pa'] * p_up + p['ambient_ingress_mol_s_pa'] * (1 - p['truseal_flush_efficiency']) * h._air_o2_pa() + h._carrier_residual_fraction() * n_c + n_ss = (g * p_up + q_in) / (kh + g * GAS_CONSTANT * h.T / V) + self.assertLess(abs(h.cells['A']['n_h'] / n_ss - 1), 1e-6) + self.assertGreater(n_ss * GAS_CONSTANT * h.T / V, 0.5 * p_up) # carrier side far from the zero-back-pressure limit + L = h.ledger() + scale = max(L['film_mounted_mol'], L['carrier_in_mol']) + self.assertLess(abs(L['film_residual_mol']), 1e-9 * scale) + self.assertLess(abs(L['carrier_residual_balance_mol']), 1e-9 * scale) + + def test42_no_carrier_supply_means_no_sweep_and_no_sensor_flow(self): + h = loaded(gas=dict(carrier_supply_gauge_pa=0.0), settle=1800.0) + n_air = AIR_O2_FRACTION * (101325.0 - 0.45 * saturation_pressure_pa(296.15)) * PLANT_EXAMPLE['carrier_chamber_volume_m3'] / (GAS_CONSTANT * 296.15) + self.assertGreaterEqual(h.read('evaluator')['truth.cell_a.carrier_side_o2_mol'], n_air * (1 - 1e-9)) # trapped air is not flushed + L = h.ledger() + self.assertEqual(L['carrier_gas_used_mol'], 0.0) + self.assertLess(abs(L['to_sensor_mol'] + L['to_vent_mol']), 1e-18) # no sweep (rounding-level only) + self.assertEqual(L['rezero_stream_mol'] + L['sensor_input_mol'], 0.0) + self.assertFalse(h.read('agent')['gas.supply_ok']) + with self.assertRaises(ActionRejected) as e: + h.invoke('test.start', cell='A') + self.assertEqual(str(e.exception), 'GAS_SUPPLY_PRESSURE_OUT_OF_RANGE') + + def test43_rezero_stream_is_over_range_protected(self): + # no H2 in the carrier: 1000 ppm O2 x 10 sccm ~ 14 cc/day on the ReZero stream, far above the 1.25 cc/day protection limit + h = loaded(gas=dict(carrier_h2_fraction=0.0, carrier_o2_impurity_fraction=1e-3), cfg=dict(individual_zero='none', conditioning_hours=0.0)) + call(h, 'test.start', cell='A') + self.assertEqual(h.seq['kind'], 'Z') + stream = 1e-3 * rt.molar_flow(CARRIER_FLOW_SCCM) + worst = 0.0 + while h._test_active('A') and h.time_s < 40 * 3600: + h.step(MAX_SUBSTEP_S) + worst = max(worst, h.sensor_I) + self.assertLess(worst, 0.5 * 4 * FARADAY * stream) # protected within one sub-step, far below the stream's current + self.assertGreaterEqual(h.ledger()['over_range_events'], 1) + self.assertEqual(h.zero_list, []) # no ReZero value from a protected slot + self.assertEqual(call(h, 'test.result', cell='A')['validity'], 'sensor_over_range') + + def test44_partial_slots_record_nothing(self): + # conditioning ends 20 s before the end of the first cell-A slot: that slot must not produce an exam + h = loaded(cfg=dict(conditioning_hours=(3600.0 - 20.0) / 3600.0, individual_zero='none', test_mode='standard', cycles=1)) + res = run_test(h, dt=60.0) + times = [r['time_s'] for r in res['readings'] if r['kind'] == 'exam'] + self.assertEqual(times, [9000.0]) # Z 0-1800, A 1800-3600 (partial), idle B, Z, A 7200-9000 + self.assertEqual(res['validity'], 'valid') + self.assertLess(abs(res['final_otr_mol_m2_s'] / steady_otr(PET, 100e-6) - 1), 0.25) + # a test started in the middle of the other cell's idle slot waits for a complete slot + h = configured(cells=('A', 'B')) + loaded(h=h, cell='A'); loaded(h=h, cell='B', template='poly_vinyl_chloride', thickness=50e-6) + call(h, 'test.start', cell='A') + while not (h.seq['kind'] == 'B' and h.time_ns - h.seq['start_ns'] > 60e9): + h.step(30.0) + call(h, 'test.start', cell='B') + start_b = h.time_s + h.step(3 * 3600.0) + exams_b = [r for r in h.cells['B']['test']['readings'] if r['kind'] == 'exam'] + self.assertTrue(exams_b) + self.assertGreaterEqual(exams_b[0]['time_s'], TEST_CFG_EXAMPLE['exam_minutes'] * 60.0) + self.assertGreater(exams_b[0]['time_s'] + start_b, start_b + 1800.0) + + def test45_power_loss_during_release_unseals_the_cell(self): + h = loaded(settle=600.0) + call(h, 'cell.load_unload', cell='A') # release stroke starts + h.step(PLANT_EXAMPLE['clamp_actuation_s'] / 2) + call(h, 'power.set', enabled=False) + st = h.read('evaluator') + self.assertFalse(st['cell_a.clamped']) + self.assertTrue(0 < st['clamp_a.position_m'] < CLAMP_TRAVEL_M) + self.assertEqual(st['truth.cell_a.carrier_side_o2_mol'], 0.0) + with self.assertRaises(ActionRejected) as e: + h.invoke('drawer.move', cell='A', open=True) # the platen is still part-way down + self.assertEqual(str(e.exception), 'CARTRIDGE_CLAMPED') + call(h, 'power.set', enabled=True) + call(h, 'cell.load_unload', cell='A'); h.step(5.0) # completes the clamp stroke and reseals with trapped air + self.assertTrue(h.read('agent')['cell_a.clamped']) + call(h, 'cell.load_unload', cell='A'); h.step(5.0) + call(h, 'drawer.move', cell='A', open=True); h.step(3.0) + self.assertEqual(h.read('evaluator')['drawer_a.position_m'], DRAWER_TRAVEL_M) + L = h.ledger() + scale = max(L['film_mounted_mol'], L['carrier_in_mol']) + self.assertLess(abs(L['carrier_residual_balance_mol']), 1e-9 * scale) + self.assertLess(abs(L['film_residual_mol']), 1e-9 * scale) + + def test46_analysis_inputs_are_bounded(self): + h = configured() + for bad in ([1e308, 1e308], [2e-3]): + with self.assertRaises(ActionRejected): + h.invoke('analysis.otr', readings_mol_m2_s=bad, individual_zero_mol_m2_s=None, window=2, driving_partial_pressure_pa=1e5, thickness_m=None, + convergence_percent=1.0) + out = call(h, 'analysis.otr', readings_mol_m2_s=[1e-3, -1e-3] * (MAX_READINGS // 2), individual_zero_mol_m2_s=-1e-3, window=100, + driving_partial_pressure_pa=1.0, thickness_m=0.01, convergence_percent=1.0) + self.assertTrue(all(math.isfinite(v) for v in out.values() if isinstance(v, float))) + + def test47_describe_returns_private_copies(self): + h = configured() + h.register_principal('ag', 'agent') + d = h.session('ag').describe(instance_id='oxtran_01') + n = len(rt.LIMITATIONS) + d['capabilities']['test.result']['limitations'].append('mutated by a caller') + d['state_slots']['clock.time_s']['meaning_zh'] = 'mutated' + self.assertEqual(len(rt.LIMITATIONS), n) + meta = export_ametek_oxtran_contract_metadata() + self.assertNotIn('mutated by a caller', meta['mechanisms']['oxygen_permeation']['limitations']) + self.assertNotIn('mutated by a caller', meta['capabilities']['power.set']['limitations']) + self.assertNotEqual(meta['state_slots']['clock.time_s']['meaning_zh'], 'mutated') + + def test48_rezero_time_base_and_new_gas_invalidates_the_baseline(self): + h = loaded(cfg=dict(individual_zero='none', conditioning_hours=0.0, test_mode='standard', cycles=2)) + res = run_test(h, dt=600.0) + self.assertEqual([z['time_s'] for z in res['rezero_readings']][:2], [1800.0, 7200.0]) # same time base as the exams + self.assertEqual([r['time_s'] for r in res['readings']], [3600.0, 9000.0]) + self.assertIsNotNone(h.zero_current) + call(h, 'gas.configure', **dict(GAS_EXAMPLE, carrier_o2_impurity_fraction=5e-4)) + self.assertIsNone(h.zero_current) + call(h, 'test.start', cell='A') + self.assertEqual(h.seq['kind'], 'Z') # a new supply is re-zeroed before the next exam + call(h, 'power.set', enabled=False) + self.assertIsNone(h.zero_current) + + def test49_panel_counts_carry_the_measurement_noise(self): + h = loaded() + call(h, 'test.start', cell='A') + diffs = [] + for _ in range(400): + h.step(30.0) + a = h.read('agent') + self.assertEqual(a, h.read('agent')) # reads stay pure + sigma = math.hypot(PLANT_EXAMPLE['sensor_noise_a'], PLANT_EXAMPLE['sensor_relative_noise'] * max(h.sensor_I_o2, 0.0)) + diffs.append((a['sensor.raw_counts'] * COUNT_A - h.read('evaluator')['truth.sensor_current_a']) / sigma) + rms = math.sqrt(sum(d * d for d in diffs) / len(diffs)) + self.assertTrue(0.6 < rms < 1.6, rms) # carries the declared noise, not the noise-free truth + # an exam reading is the panel measurement at the slot end + t = h.cells['A']['test'] + n = len(t['readings']) + while len(t['readings']) == n: + before = h._measured_current() + h.step(1.0) + self.assertEqual(t['readings'][-1]['sensor_counts'], int(round(h._measured_current() / COUNT_A))) + + def test50_over_range_is_detected_on_the_measured_current_and_visible(self): + target = 1.6 / CC_DAY_PER_MOL_S # 1.6 cc/day on the sensor (> 1.25 cc/day) + L = steady_otr(PET, 1.0) * TEST_AREA_M2 / target + h = loaded(thickness=L, settle=3 * 3600.0, cfg=dict(individual_zero='none', conditioning_hours=0.0), + plant=dict(sensor_noise_a=0.0, sensor_relative_noise=0.0)) + call(h, 'test.start', cell='A') + seen = None + for _ in range(800): + h.step(10.0) + a = h.read('agent') + if a['sensor.over_range']: + seen = (a['sensor.route'], a['cell_a.phase']) + break + self.assertEqual(seen, ('bypass', 'failed')) + self.assertGreater(h.sensor_I, 0.5 * OVER_RANGE_CURRENT_A) # the flag is raised by the current, not by the inlet flow + h.step(3600.0) + self.assertFalse(h.read('agent')['sensor.over_range']) + self.assertEqual(call(h, 'test.result', cell='A')['terminal_reason'], 'SENSOR_OVER_RANGE') + + def test51_continuous_mode_ends_by_operator_stop(self): + for zero in ('end', 'none'): + h = loaded(cfg=dict(test_mode='continuous', individual_zero=zero, conditioning_hours=0.0)) + call(h, 'test.start', cell='A') + while h.cells['A']['exam_count'] < 6: + call(h, 'sim.step', dt_s=1800.0) + out = call(h, 'test.stop', cell='A') + if zero == 'end': + self.assertEqual(out['phase'], 'running') + self.assertEqual(h.cells['A']['phase'], 'zero_end') + while h._test_active('A'): + call(h, 'sim.step', dt_s=1800.0) + res = call(h, 'test.result', cell='A') + self.assertEqual(res['phase'], 'succeeded') + self.assertEqual(res['terminal_reason'], 'TEST_COMPLETE' if zero == 'end' else 'OPERATOR_STOP') + self.assertEqual(res['validity'], 'valid') + self.assertEqual(res['individual_zero_mol_m2_s'] is not None, zero == 'end') + self.assertEqual(h.read('agent')['cell_a.final_otr_mol_m2_s'], res['final_otr_mol_m2_s']) + # standard mode stopped early is still a cancellation + h = loaded(cfg=dict(test_mode='standard', cycles=10, individual_zero='none', conditioning_hours=0.0)) + call(h, 'test.start', cell='A'); h.step(3 * 3600.0) + self.assertEqual(call(h, 'test.stop', cell='A')['phase'], 'cancelled') + + def test52_humidity_change_during_a_test_is_flagged(self): + h = loaded(cfg=dict(test_mode='standard', cycles=4, individual_zero='none', conditioning_hours=0.0)) + call(h, 'test.start', cell='A') + h.step(2 * 3600.0) + call(h, 'humidity.set', rh_fraction=0.9) + res = run_test(h) if False else None + while h._test_active('A'): + call(h, 'sim.step', dt_s=1800.0) + res = call(h, 'test.result', cell='A') + self.assertEqual(res['validity'], 'humidity_out_of_tolerance') + self.assertEqual(res['conditions']['target_rh'], 0.0) + + def test53_humidity_coefficient_is_a_mount_prior_without_agent_oracle(self): + h = configured() + call(h, 'drawer.move', cell='A', open=True); h.step(3.0) + with self.assertRaises(ActionRejected) as e: # even for a dry test + h.invoke('sample.mount', **dict(MOUNT_EXAMPLE, template_id='polyacrylonitrile')) + self.assertEqual(str(e.exception), 'HUMIDITY_COEFFICIENT_REQUIRED') + call(h, 'sample.mount', **dict(MOUNT_EXAMPLE, template_id='polyacrylonitrile', humidity_coefficient=0.0)) + h.register_principal('ag', 'agent') + r = h.session('ag').invoke(instance_id='oxtran_01', capability_id='humidity.set', arguments={'rh_fraction': 0.5}, request_id='rh') + self.assertEqual(r['status'], 'succeeded') # no template-class dependent rejection + + def test54_provenance_is_bounded(self): + h = loaded() + for _ in range(MAX_PROVENANCE + 5): + h.invoke('test.start', cell='A') + h.invoke('test.stop', cell='A') + prov = call(h, 'provenance.read') + self.assertEqual(len(prov['operations']), MAX_PROVENANCE) + self.assertEqual(prov['operations'][-1]['operation_id'], h.cells['A']['test']['op']) + + def test55_ledgers_are_real_conservation_checks(self): + h = configured(cells=('A', 'B'), cfg=dict(conditioning_hours=0.5)) + loaded(h=h, cell='A'); loaded(h=h, cell='B', template='poly_vinyl_chloride', thickness=50e-6) + call(h, 'test.start', cell='A'); call(h, 'test.start', cell='B') + h.step(4 * 3600.0) + call(h, 'humidity.set', rh_fraction=0.4); call(h, 'thermal.set_temperature', target_k=303.15) + h.step(3 * 3600.0) + call(h, 'test.stop', cell='B'); call(h, 'cell.load_unload', cell='B'); h.step(5.0) + call(h, 'drawer.move', cell='B', open=True); h.step(3.0) + call(h, 'sample.unmount', cell='B') + call(h, 'sample.mount', **dict(MOUNT_EXAMPLE, cell='B', template_id='polystyrene', thickness_m=500e-6)) + h.step(1200.0) + call(h, 'power.set', enabled=False); h.step(1800.0); call(h, 'power.set', enabled=True) + call(h, 'drawer.move', cell='B', open=False); h.step(3.0) + call(h, 'cell.load_unload', cell='B') + h.step(20 * 3600.0) + L = call(h, 'ledger.read') + scale = max(L['film_mounted_mol'], L['carrier_in_mol']) + self.assertLess(abs(L['film_residual_mol']), 1e-12 * scale) + self.assertLess(abs(L['carrier_residual_balance_mol']), 1e-12 * scale) + self.assertLess(abs(L['sensor_balance_residual_mol']), 1e-13 * L['sensor_input_mol']) + self.assertLess(abs(L['energy_residual_j']), 1e-9 * abs(L['tec_heat_j'])) + self.assertGreater(L['sensor_discarded_mol'], 0.0) + # the residuals are not identities: an O2 amount that appears without a booked flux shows up + h.cells['A']['n_h'] += 1e-9 + self.assertAlmostEqual(h.ledger()['carrier_residual_balance_mol'] / -1e-9, 1.0, places=3) + h.cells['A']['conc'][0] += 1.0 + f = h.cells['A']['film'] + self.assertAlmostEqual(h.ledger()['film_residual_mol'] / -(f['dx'] * f['area']), 1.0, places=3) + + def test56_rezero_over_range_fails_every_active_test_once(self): + h = configured(cells=('A', 'B'), gas=dict(carrier_h2_fraction=0.0, carrier_o2_impurity_fraction=1e-3), cfg=dict(individual_zero='none', conditioning_hours=0.0)) + loaded(h=h, cell='A'); loaded(h=h, cell='B', template='poly_vinyl_chloride', thickness=50e-6) + call(h, 'test.start', cell='A'); call(h, 'test.start', cell='B') + self.assertEqual(h.seq['kind'], 'Z') + for _ in range(360): + h.step(10.0) + for cell in 'AB': + res = call(h, 'test.result', cell=cell) + self.assertEqual((res['phase'], res['validity'], res['terminal_reason']), ('failed', 'sensor_over_range', 'SENSOR_OVER_RANGE')) + self.assertEqual(res['exam_count'], 0) + self.assertEqual(h.ledger()['over_range_events'], 1) # the tripped stream is not re-entered + self.assertEqual(h.zero_list, []) + self.assertIsNone(h.seq) + + def test57_cancel_aborts_even_a_continuous_test(self): + h = loaded(cfg=dict(test_mode='continuous', individual_zero='end', conditioning_hours=0.0)) + h.register_principal('ag', 'agent') + s = h.session('ag') + op = s.invoke(instance_id='oxtran_01', capability_id='test.start', arguments={'cell': 'A'}, request_id='s')['operation_id'] + h.step(6 * 3600.0) + c = s.cancel(op, 'c1') + self.assertEqual((c['status'], c['result']['phase']), ('succeeded', 'cancelled')) + self.assertEqual(s.cancel(op, 'c1'), c) + self.assertEqual(s.poll(op)['status'], 'cancelled') + self.assertEqual(s.poll(op)['result']['validity'], 'cancelled') + with self.assertRaises(ActionRejected): + s.cancel(op, 'c2') + call(h, 'cell.load_unload', cell='A') # no longer TEST_ACTIVE + + def test58_no_exam_without_a_baseline(self): + pvc = 'poly_vinyl_chloride' + kw = dict(template=pvc, thickness=50e-6, cfg=dict(test_mode='standard', cycles=1, individual_zero='none', conditioning_hours=0.0), inst=dict(rezero_frequency=3)) + h = loaded(**kw) + call(h, 'test.start', cell='A') + h.step(3600.0 - 100.0) # Z 0-1800, A 1800-3600: 100 s before the first exam + call(h, 'test.stop', cell='A') + call(h, 'gas.configure', **dict(GAS_EXAMPLE, carrier_o2_impurity_fraction=5e-4)) # new cylinder: baseline invalid + call(h, 'test.start', cell='A') + while h._test_active('A'): + h.step(600.0) + res = call(h, 'test.result', cell='A') + self.assertTrue(res['rezero_readings']) + self.assertLess(res['rezero_readings'][0]['time_s'], res['readings'][0]['time_s']) + self.assertEqual(res['validity'], 'valid') + self.assertLess(abs(res['final_otr_mol_m2_s'] / steady_otr(pvc, 50e-6) - 1), 0.03) + + def test59_capability_metadata_is_specific(self): + meta = export_ametek_oxtran_contract_metadata() + slots = meta['state_slots'] + pre = {json.dumps(c['preconditions'], ensure_ascii=False, sort_keys=True) for c in meta['capabilities'].values() if c['preconditions']} + self.assertGreater(len(pre), 8) # not one template for every command + for k, c in meta['capabilities'].items(): + for e in c['errors']: + self.assertNotEqual(e['meaning_zh'], e['code'], k) + self.assertNotIn(e['code'], ('TEST_COMPLETE', 'OPERATOR_STOP'), k) # success reasons are not errors + for sid in c['observes'] + [x for p in c['preconditions'] for x in p['state_ids']]: + self.assertIn(sid, slots, k) + if c['visibility'] == 'agent': + self.assertTrue(all(slots[sid]['visibility'] == 'agent' for sid in c['observes']), k) + if c['availability'] == 'implemented' and c['kind'] not in ('analysis', 'query'): + self.assertTrue(c['observes'] or k == 'test.configure', k) + params = meta['mechanisms']['oxygen_permeation']['parameters'] + humanized = [k for k, v in params.items() if v['meaning_zh'].split(';')[0].replace(' ', '_').lower() == k.lower()] + self.assertEqual(humanized, []) + self.assertIsNotNone(slots['truth.cell_a.test_side_o2_pa']['reference_conditions']) + for k in ('humidity_coefficient', 'permeability_override_mol_m_per_m2_s_pa', 'diffusivity_override_m2_s', 'declared_thickness_m', 'manual_barometer_pa'): + self.assertIn(k, params) # nullable host priors are exported too + caps = meta['capabilities'] + self.assertNotIn('ACCESS_DENIED', [e['code'] for e in caps['test.start']['errors']]) # agent-visible and not foreign-guarded + self.assertIn('ACCESS_DENIED', [e['code'] for e in caps['test.stop']['errors']]) + self.assertIn('INVALID_ARGUMENT', [e['code'] for e in caps['sensor.adjust']['errors']]) + # the preconditions that reject test.start / cell.load_unload are visible to an agent + h = loaded(cells=('A',), clamp=False) + a = h.read('agent') + self.assertTrue(a['cell_a.method_configured'] and not a['cell_b.method_configured']) + call(h, 'cell.load_unload', cell='A') + self.assertTrue(h.read('agent')['cell_a.clamp_moving']) + h.step(5.0) + self.assertFalse(h.read('agent')['cell_a.clamp_moving']) + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_asset_antonpaar_hit300.py b/tests/test_asset_antonpaar_hit300.py new file mode 100644 index 0000000000000000000000000000000000000000..2a3743e14aa4826ded71876f3e24f15080e6a15a --- /dev/null +++ b/tests/test_asset_antonpaar_hit300.py @@ -0,0 +1,179 @@ +"""CHEM130 empirical indentation, finite work, OP observation and session tests.""" +import copy,hashlib,importlib.util,json,math,sys,unittest +from pathlib import Path +import numpy as np +ROOT=Path(__file__).resolve().parents[1];sys.path.insert(0,str(ROOT/'scripts')) +from asset_runtime import antonpaar_hit300 as rt +OBSERVED=[];STATES=[] +def canonical(v): + if isinstance(v,dict):return {str(k):canonical(x) for k,x in v.items()} + if isinstance(v,(list,tuple)):return [canonical(x) for x in v] + if isinstance(v,np.ndarray):return v.tolist() + return v +def state(h):return json.dumps(canonical(h.__dict__),sort_keys=True,allow_nan=False) +def call(h,k,**a): + before=h.read();r=h.invoke(k,**a);after=h.read();json.dumps(r,allow_nan=False);json.dumps(after,allow_nan=False);OBSERVED.append((k,copy.deepcopy(a),copy.deepcopy(r)));STATES.append(after) + changed={x for x in before if before[x]!=after[x]} + if not changed<=set(rt.CAPS[k]['effects']):raise AssertionError((k,'undeclared state effects',changed-set(rt.CAPS[k]['effects']))) + return r +def step(h,t):h.step(t);STATES.append(h.read());json.dumps(h.read(),allow_nan=False) +def setup(name='hit_test',plant=None,sample=None,method=None,calibration=None): + h=rt.AntonpaarHit300Runtime(name) + for k,a in [('plant.configure',dict(rt.PLANT_EXAMPLE,**(plant or {}))),('specimen.load',dict(rt.SAMPLE_EXAMPLE,**(sample or {}))),('power.set',{'enabled':True}),('clamp.set',{'locked':True}),('stage.set_y',{'position_m':.02,'accept_manual':True}),('stage.move_x',{'position_m':.02,'speed_m_s':.005}),('sensor.zero',{}),('sensor.calibrate',dict(rt.CALIBRATION_EXAMPLE,**(calibration or {}))),('head.set_position',{'distance_m':0.})]:call(h,k,**a) + step(h,9.);call(h,'contact.set',engaged=True);call(h,'method.configure',**dict(dict(rt.METHOD_EXAMPLE,x_positions_m=[.02],hold_s=.2),**(method or {})));return h +def run(h): + call(h,'acquisition.start') + for _ in range(4000): + step(h,.1) + if h.phase!='running':break + if h.phase=='running':raise AssertionError('no finite terminal state') + return call(h,'acquisition.result') +def park(h): + if h.phase=='running':call(h,'acquisition.stop') + step(h,3.);call(h,'contact.set',engaged=False);call(h,'head.set_position',distance_m=.09);step(h,9.) +def cleanup(h):park(h);call(h,'clamp.set',locked=False);call(h,'specimen.remove');call(h,'power.set',enabled=False) +def fixture(m=1.5,frame=0.,n=101): + x=np.linspace(1.,.05,n);p=.005*x**m;h=1e-7+1e-7*x+frame*p;return p.tolist(),h.tolist() +class TestHIT300(unittest.TestCase): + def rejected(self,h,k,error='.',**a): + before=state(h) + with self.assertRaisesRegex(rt.ActionRejected,error):h.invoke(k,**a) + self.assertEqual(before,state(h)) + def ledger(self,h): + l=call(h,'ledger.read');self.assertLess(abs(l['sample_error_kg']),1e-13);self.assertLess(abs(l['volume_error_m3']),1e-19);self.assertLess(abs(l['energy_error_j']),1e-19);self.assertLess(abs(l['thermal_error_j']),1e-19);self.assertGreaterEqual(l['pristine_volume_m3'],0.);self.assertAlmostEqual(l['plastic_work_j'],l['heat_input_j']+l['defect_stored_j'],places=20);return l + def test_01_raw_source_time_padding_and_branch_preservation(self): + r=rt.library()['substances']['borofloat33_5mn_rep1'];original=json.dumps(r,sort_keys=True);m=rt.source_model(r,True);self.assertEqual(len(r['values']['load_n']),652);self.assertIsNone(r['values']['time_s']);self.assertEqual(m['projection']['padding_nodes_excluded'],540);self.assertEqual(m['projection']['active_last_index'],111);self.assertGreater(m['projection']['elastic_release_below_observed_min_load_n'],0);self.assertEqual(original,json.dumps(r,sort_keys=True));self.assertGreater(m['maximum_load'],.005);self.assertTrue(np.all(np.diff(m['plastic'])>=0)) + def test_02_two_real_materials_drive_different_observed_outputs(self): + moduli=[] + for rid in ['borofloat33_5mn_rep1','soda_lime_glass_5mn_rep1']: + h=setup(sample={'reference_id':rid});r=run(h);self.assertEqual(r['phase'],'succeeded');self.assertEqual(r['completed_indents'],1);self.assertIsNotNone(r['points'][0]['analysis']);self.assertEqual(r['reference_id'],rid);moduli.append(r['points'][0]['analysis']['sample_modulus_pa']);self.ledger(h) + self.assertNotEqual(*moduli) + def test_03_full_array_load_release_retract_move_and_history(self): + h=setup(method={'x_positions_m':[.02,.022]});r=run(h);self.assertEqual(r['completed_indents'],2);self.assertEqual(len(r['points']),2);self.assertEqual(len(h.damage),2);self.assertGreater(h.damage[0]['plastic_depth_m'],0);self.assertEqual(h.stage_y,.02);self.assertAlmostEqual(h.stage_x,.022);phases={x['phase'] for x in r['rows']};self.assertTrue({'loading','holding','unloading','release','retracting','moving','approaching'}<=phases);self.assertEqual(h.force,0.);self.ledger(h) + def test_04_actual_load_is_not_target_and_read_never_steps(self): + h=setup();call(h,'acquisition.start');self.assertEqual(h.force,0.);before=state(h) + for _ in range(3):h.read();call(h,'acquisition.result');h.describe() + self.assertEqual(state(h),before);step(h,.1);self.assertGreater(h.force,0.);self.assertLess(h.force,h.force_target);self.assertAlmostEqual(h.force_target,.1*h.method['loading_rate_n_s']);self.assertGreater(h.plastic_depth,0.) + def test_05_op_analytic_powerlaw_hardness_and_reduced_vs_sample_modulus(self): + for exponent in [1.2,1.5,2.,2.8]: + p,h=fixture(exponent);c=rt.CALIBRATION_EXAMPLE;r=rt.oliver_pharr(p,h,c);s=.005*exponent/1e-7;hc=2e-7-c['epsilon']*.005/s;area=24.5*hc*hc;er=math.sqrt(math.pi)*s/(2*c['beta']*math.sqrt(area));e=(1-c['poisson_sample']**2)/(1/er-(1-c['poisson_tip']**2)/c['young_tip_pa']);self.assertAlmostEqual(r['unloading_exponent'],exponent,delta=1e-6);self.assertAlmostEqual(r['hardness_pa'],.005/area,delta=1000);self.assertAlmostEqual(r['sample_modulus_pa'],e,delta=10000);self.assertNotEqual(r['sample_modulus_pa'],r['reduced_modulus_pa']) + def test_06_frame_compliance_corrected_once(self): + p,h=fixture(frame=3e-7);base=rt.oliver_pharr(*fixture(),rt.CALIBRATION_EXAMPLE);good=rt.oliver_pharr(p,h,dict(rt.CALIBRATION_EXAMPLE,frame_compliance_m_n=3e-7));bad=rt.oliver_pharr(p,h,rt.CALIBRATION_EXAMPLE);self.assertAlmostEqual(good['stiffness_n_m'],base['stiffness_n_m'],delta=.01);self.assertAlmostEqual(good['sample_modulus_pa'],base['sample_modulus_pa'],delta=1000);self.assertGreater(abs(bad['stiffness_n_m']-good['stiffness_n_m']),100) + def test_07_op_rejects_loading_creep_nose_and_bad_window(self): + hst=setup();p,h=fixture();a=dict(load_n=p,depth_m=h,calibration=rt.CALIBRATION_EXAMPLE);self.rejected(hst,'analysis.oliver_pharr','NOT_UNLOADING',**dict(a,load_n=p[::-1],depth_m=h[::-1]));nose=h.copy();nose[2]=h[0]*1.1;self.rejected(hst,'analysis.oliver_pharr','UNLOADING_NOSE',**dict(a,depth_m=nose));self.rejected(hst,'analysis.oliver_pharr','FIT_DATA',**dict(a,depth_m=h[:-1]));self.rejected(hst,'analysis.oliver_pharr','CALIBRATION_DOMAIN',**dict(a,calibration=dict(rt.CALIBRATION_EXAMPLE,fit_min_fraction=.8,fit_max_fraction=.5)));self.rejected(hst,'analysis.oliver_pharr','ELASTIC_UNLOADING_NOT_ACCEPTED',**dict(a,calibration=dict(rt.CALIBRATION_EXAMPLE,accept_elastic_unloading=False))) + def test_08_op_peak_depth_is_paired_not_global_max(self): + p,h=fixture();h[1]=h[0]*1.001;r=rt.oliver_pharr(p,h,rt.CALIBRATION_EXAMPLE);self.assertEqual(r['max_depth_m'],h[0]);self.assertNotEqual(r['max_depth_m'],max(h)) + def test_09_area_domain_and_tip_poisson_correction_fail_explicitly(self): + h=setup();p,d=fixture();a=dict(load_n=p,depth_m=d,calibration=dict(rt.CALIBRATION_EXAMPLE,area_min_depth_m=1e-6));self.rejected(h,'analysis.oliver_pharr','CONTACT_AREA_DOMAIN',**a);a['calibration']=dict(rt.CALIBRATION_EXAMPLE,young_tip_pa=1e9);self.rejected(h,'analysis.oliver_pharr','MODULUS_DOMAIN',**a) + def test_10_live_analysis_uses_only_observed_unloading(self): + h=setup();r=run(h);rr=[x for x in r['rows'] if x['phase']=='unloading'];external=call(h,'analysis.oliver_pharr',load_n=[x['force_n'] for x in rr],depth_m=[x['depth_m'] for x in rr],calibration=rt.CALIBRATION_EXAMPLE);self.assertEqual(external,r['points'][0]['analysis']);self.assertIn('h_corrected',external['evidence']) + def test_11_no_fake_success_on_sparse_analysis(self): + h=setup(method={'sample_interval_s':2.});r=run(h);self.assertEqual(r['phase'],'succeeded');self.assertIsNone(r['points'][0]['analysis']);self.assertIn(r['points'][0]['analysis_error'],['FIT_POINTS','FIT_DATA']);self.assertEqual(r['completed_indents'],1) + def test_12_known_force_program_exact_and_actual_phase_times(self): + h=setup(method={'hold_s':1.});r=run(h);phases={k:[x for x in r['rows'] if x['phase']==k] for k in ['loading','holding','unloading','release']};self.assertAlmostEqual(phases['holding'][0]['time_s']-phases['loading'][0]['time_s'],3.,places=9);self.assertAlmostEqual(phases['unloading'][0]['time_s']-phases['holding'][0]['time_s'],1.,places=9);self.assertAlmostEqual(phases['release'][0]['time_s']-phases['unloading'][0]['time_s'],3.,places=9);self.assertGreater(r['elapsed_s'],7.);self.assertAlmostEqual(r['rows'][-1]['elapsed_s'],r['elapsed_s']) + def test_13_piecewise_plastic_work_matches_independent_source_integral(self): + h=setup();r=run(h);pmax=h.method['peak_load_n'];p=h.model['load'];hp=h.model['plastic'];grid=np.r_[0.,p[(p>0)&(p=0));self.assertEqual(before,json.dumps(r,sort_keys=True));self.assertGreaterEqual(sum(bool(v.get('runtime_usable')) for v in lib['substances'].values()),16) + with self.assertRaisesRegex(rt.ActionRejected,'NEGATIVE_SOURCE_FORCE'):rt.curve(r) + def test_02_three_real_passes_residual_not_penetration(self): + h=prescanned(method={'length_m':.002});scratch=run(h);self.assertEqual(scratch['phase'],'succeeded');s=[r for r in scratch['rows'] if r['phase']=='scanning'];self.assertTrue(all(r['residual_depth_m'] is None for r in s));self.assertGreater(s[-1]['penetration_depth_m'],h.local_groove);at_start(h);post=run(h,'postscan');p=[r for r in post['rows'] if r['phase']=='scanning'];self.assertEqual(post['phase'],'succeeded');self.assertTrue(all(r['penetration_depth_m'] is None for r in p));self.assertGreater(p[-1]['residual_depth_m'],0);self.assertLess(abs(p[-1]['residual_depth_m']-h.local_groove),1e-9);self.ledger(h) + def test_03_force_ramp_endpoint_and_integral_moments(self): + from scipy.integrate import quad + for tau in [1e-5,.05,100.]: + for dt in [.000001,.01,.1,1.]: + f0,target,slope=3.,8.,2.;got=rt.force_ramp(f0,target,slope,tau,dt);f=lambda t:target+slope*(t-tau)+(f0-target+slope*tau)*math.exp(-t/tau);pts=sorted({v for v in [tau,5*tau,30*tau,60*tau] if v=x['time_s'] for x,y in zip(r['rows'],r['rows'][1:]))) + def test_39_accepted_source_variants_change_actual_work(self): + usable=[(k,r) for k,r in rt.library()['substances'].items() if r.get('runtime_usable') and k.startswith(('borofloat33_','b4c_','al2o3_'))];works=[] + for rid,ref in usable[:2]: + h=prescanned(sample={'reference_id':rid},method={'source_start_distance_m':ref['values']['distance_m'][0]});r=run(h);self.assertEqual(r['phase'],'succeeded');self.assertEqual(r['reference_id'],rid);works.append(h.tangential_work) + self.assertEqual(len(works),2);self.assertNotEqual(*works) + def test_zz_all_real_capability_returns_and_state_schemas(self): + spec=importlib.util.spec_from_file_location('rst_asset_tool',ROOT/'skills/chemistry-lab-assets/scripts/asset_tool.py');tool=importlib.util.module_from_spec(spec);spec.loader.exec_module(tool);meta=rt.export_antonpaar_rst300_contract_metadata();json.dumps(meta,allow_nan=False) + for k,c in meta['capabilities'].items(): + self.assertEqual(tool.lint_schema(c['input_schema'],path=k+'.input'),[]);self.assertEqual(tool.lint_schema(c['output_schema'],path=k+'.output'),[]) + covered=set() + for k,a,r in OBSERVED: + self.assertEqual(tool.validate_value(a,meta['capabilities'][k]['input_schema'],path=k+'.input'),[]);self.assertEqual(tool.validate_value(r,meta['capabilities'][k]['output_schema'],path=k+'.output'),[]);covered.add(k) + self.assertEqual(covered,set(rt.CAPS)-set(rt.UNSUPPORTED)) + for state_values in STATES: + self.assertEqual(set(state_values),set(rt.SLOTS));json.dumps(state_values,allow_nan=False) + for k,v in state_values.items():self.assertEqual(tool.validate_value(v,meta['state_slots'][k]['value_schema'],path=k),[]) + for k,c in meta['capabilities'].items():self.assertTrue(set(rt.CAPS[k]['effects'])<={e['state_id'] for e in c['state_effects']}) +if __name__=='__main__':unittest.main() diff --git a/tests/test_asset_antonpaar_saxspace.py b/tests/test_asset_antonpaar_saxspace.py new file mode 100644 index 0000000000000000000000000000000000000000..8b04273dab0482ffefa7acc998b7290ac3ec9745 --- /dev/null +++ b/tests/test_asset_antonpaar_saxspace.py @@ -0,0 +1,1547 @@ +"""tests for CHEM-153 antonpaar_saxspace: python3 -m unittest tests/test_asset_antonpaar_saxspace.py + +Topics (pipeline.md): set points only write targets, read/describe are pure, rejected preconditions leave the state unchanged, two instances +are isolated, agent/evaluator truth isolation, conservation (photons, liquid volume, solute mass, tube energy), real return values validated +against the declared schemas (asset_tool lint_schema / validate_value), asynchronous completion and cancellation remnants, host-step +independence, declared immediate and on_step effects covering what the process changes; plus the instrument behaviour (generator interlocks and +ramps, vacuum below 3 mbar, TCStage range and heating rate, q range 0.03-40.7 nm^-1 and SWAXS to 60 deg, MYTHEN2 R 1K strips) and the scattering +physics (absolute scale from water cross-checked against the NIST SRM 3600 certified curve, Guinier Rg and molecular weight of SASBDB proteins +after desmearing, Percus-Yevick concentration effect, silver behenate calibration, silicon Ka doublet, NIST gold nanoparticles, sample states, +faults and the autosampler carry-over). +""" +import copy +import json +import math +import random +import sys +import unittest +from pathlib import Path + +import numpy as np + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / "scripts")) +sys.path.insert(0, str(ROOT / "skills/chemistry-lab-assets/scripts")) +from asset_runtime import antonpaar_saxspace as rt # noqa: E402 +import asset_tool # noqa: E402 + +CHECKS, PROCESS_EVIDENCE = [], {} +_META = {} +RNGS = ('rng', 'rng_acq', 'rng_mount', 'rng_cal') +LYS = 'sasbdb_sasdrm8_lysozyme_c' +BSA = 'sasbdb_sasdeb5_bsa' +GC = 'nist_srm3600_glassy_carbon' +AU30 = 'nist_rm8012_gold_30nm' + + +def _meta(): + if not _META: + _META.update(rt.export_antonpaar_saxspace_contract_metadata()) + return _META + + +_orig_invoke = rt.AntonpaarSaxspaceRuntime.invoke + + +def _instrumented_invoke(self, capability_id, **a): + """Every successful call is checked against its declared output schema and immediate state effects (read does not advance time).""" + before = self.read('evaluator') if capability_id != 'sim.step' else None + t0 = self.time_ns + out = _orig_invoke(self, capability_id, **a) + meta = _meta()['capabilities'][capability_id] + errs = asset_tool.validate_value(out, meta['output_schema']) + if errs: + raise AssertionError(f'{capability_id} output violates its schema: {errs[:3]}') + if before is not None: + assert self.time_ns == t0, capability_id + after = self.read('evaluator') + undeclared = {k for k in after if json.dumps(after[k], sort_keys=True, default=str) != json.dumps(before[k], sort_keys=True, default=str) + and _changed(before[k], after[k])} - set(rt.CAPS[capability_id]['effects']) + if undeclared and rt.EFFECTS: + raise AssertionError(f'{capability_id} changed undeclared state immediately: {sorted(undeclared)}') + PROCESS_EVIDENCE.setdefault(capability_id, []).append(dict(arguments=copy.deepcopy(a), result_keys=sorted(out))) + return out + + +rt.AntonpaarSaxspaceRuntime.invoke = _instrumented_invoke + + +class QuietRng: + """Noise-free stand-in for random.Random (gauges exact, fixed draws) so that two runs differ only by the process.""" + def gauss(self, mu, sigma): + return mu + + def random(self): + return 0.5 + + def uniform(self, a, b): + return 0.5 * (a + b) + + def getrandbits(self, k): + return 12345 + + def seed(self, x): + pass + + +def configured(seed=1, **plant): + h = rt.AntonpaarSaxspaceRuntime() + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, noise_seed=seed, **plant)) + return h + + +def ready(seed=1, xray=True, **plant): + """Powered, SAXSdrive up, chiller flowing, key at I and (optionally) X-rays at 40 kV / 50 mA.""" + h = configured(seed, **plant) + h.invoke('power.set', enabled=True) + h.step(61.0) + h.invoke('generator.set_key', on=True) + if xray: + h.invoke('generator.xray_on') + h.step(21.0) + return h + + +def liquid(h, sid, comps=(), volume=500e-9): + h.invoke('sample.provide', sample_id=sid, form='solution', solvent='water', volume_m3=volume, thickness_m=None, + components=[dict(template_id=t, concentration_kg_m3=c, model_parameters=None) for t, c in comps]) + return sid + + +def solid(h, sid, tid, thickness, form='solid'): + h.invoke('sample.provide', sample_id=sid, form=form, solvent='none', volume_m3=0.0, thickness_m=thickness, + components=[dict(template_id=tid, concentration_kg_m3=None, model_parameters=None)]) + return sid + + +def load(h, sid, holder='capillary_1mm', pump_s=220.0, temp=None, align=True): + """Vent, open the door, exchange the holder, close, pump below 3 mbar, (optionally) set the temperature and TrueFocus-align.""" + if not h.door_open: + h.invoke('vacuum.set_pump', on=False) + h.step(80.0) + h.invoke('chamber.set_door', open=True) + if h.holder is not None or h.holder_broken: + h.invoke('sample.unload') + h.invoke('sample.load', sample_id=sid, holder=holder) + h.invoke('chamber.set_door', open=False) + h.invoke('vacuum.set_pump', on=True) + if temp is not None: + h.invoke('stage.set_temperature', temperature_k=temp) + h.step(pump_s) + if align and holder in ('capillary_1mm', 'mu_cell') and sid is not None: + h.invoke('stage.auto_align') + h.step(rt.ALIGN_S + 2.0) + return h + + +def acquire(h, exposure=300.0, frames=1): + op = h.invoke('acquisition.start', exposure_s=exposure, frames=frames)['operation_id'] + h.step(exposure + 1.0) + rec = h.records[h.operations[op]['record_id']] + assert rec['status'] == 'completed', (rec['status'], rec['error_code']) + return rec['record_id'] + + +def empty_beam(h, pump_s=220.0): + """Vent, open the door, remove the holder, close and pump: the beam passes only air and the collimation (empty-beam background).""" + if not h.door_open: + h.invoke('vacuum.set_pump', on=False) + h.step(80.0) + h.invoke('chamber.set_door', open=True) + if h.holder is not None or h.holder_broken: + h.invoke('sample.unload') + h.invoke('chamber.set_door', open=False) + h.invoke('vacuum.set_pump', on=True) + h.step(pump_s) + return h + + +def calibrated(seed=1, collimation='line'): + """Ready instrument with the zero angle and the SDD calibrated on silver behenate (paste cell).""" + h = ready(seed) + if collimation != 'line': + h.invoke('collimation.set_mode', mode=collimation) + solid(h, 'agbe', 'silver_behenate', 1e-3, form='powder') + load(h, 'agbe', holder='paste_cell') + r = acquire(h, 60.0 if collimation == 'line' else 600.0) + h.invoke('calibration.zero_angle', record_id=r) + h.invoke('calibration.q_scale', record_id=r, calibrant='silver_behenate') + return h + + +def water_calibration(h, temp=293.15, exposure=600.0): + liquid(h, 'water_std') + load(h, 'water_std', temp=temp) + rw = acquire(h, exposure) + load(h, None, temp=temp) + re_ = acquire(h, exposure) + return h.invoke('calibration.absolute', record_id=rw, background_record_id=re_, standard='water', thickness_m=1e-3)['calibration_id'] + + +def rejected(h, cap, code, **a): + before = h.read('evaluator') + rev = h.revision + try: + h.invoke(cap, **a) + except rt.ActionRejected as exc: + assert str(exc) == code, (cap, str(exc), code) + assert json.dumps(h.read('evaluator'), sort_keys=True, default=str) == json.dumps(before, sort_keys=True, default=str), cap + assert h.revision == rev, cap + return True + raise AssertionError(f'{cap} was not rejected (expected {code})') + + +def reduced_arrays(r): + return np.asarray(r['q_per_m']) * 1e-9, np.asarray(r['intensity']) / 100.0, np.asarray(r['sigma']) / 100.0 # 1/nm, 1/cm + + +class ContractAndSchemas(unittest.TestCase): + def test_module_identity(self): + self.assertEqual(rt.ASSET_TYPE_ID, 'instrument.antonpaar_saxspace') + self.assertEqual(rt.CATALOG_ID, 'CHEM-153') + + def test_schemas_lint_and_examples_validate(self): + meta = _meta() + for k, c in meta['capabilities'].items(): + self.assertEqual(asset_tool.lint_schema(c['input_schema']), [], k) + self.assertEqual(asset_tool.lint_schema(c['output_schema']), [], k) + if c['availability'] == 'implemented': + self.assertEqual(asset_tool.validate_value(c['example_arguments'], c['input_schema']), [], k) + for k, s in meta['state_slots'].items(): + self.assertEqual(asset_tool.lint_schema(s['value_schema']), [], k) + + def test_metadata_references_are_consistent(self): + meta = _meta() + slots = set(meta['state_slots']) + for k, c in meta['capabilities'].items(): + for e in c['state_effects']: + self.assertIn(e['state_id'], slots, k) + for x in c['observes']: + self.assertIn(x, slots, k) + for p in c['preconditions']: + for x in p['state_ids']: + self.assertIn(x, slots, k) + for e in c['errors']: + self.assertIn(e['code'], rt.ERROR_ZH, k) + queries = {k for k, v in rt.CAPS.items() if v['kind'] in ('query', 'analysis')} + self.assertEqual(set(rt.EFFECTS) | set(rt.UNSUPPORTED) | queries, set(rt.CAPS)) + self.assertEqual(set(rt.CAP_SOURCES), set(rt.CAPS)) + comps = {p['id'] for p in json.loads((rt.ASSET / 'geometry_manifest.json').read_text())['components']} + for k, c in meta['capabilities'].items(): + self.assertLessEqual(set(c['component_ids']) - {'monitor'}, comps, k) + for k, s in meta['state_slots'].items(): + self.assertLessEqual(set(s['component_ids']) - {'monitor'}, comps, k) + + def test_every_rejection_code_is_declared(self): + """Each ActionRejected code raised by a command method appears in that capability's declared errors.""" + import inspect + import re + src = inspect.getsource(rt.AntonpaarSaxspaceRuntime) + meta = _meta()['capabilities'] + helpers = {'_need_plant': ['PLANT_REQUIRED'], '_need_power': ['PLANT_REQUIRED', 'POWER_OFF'], '_need_gen_power': ['PLANT_REQUIRED', 'POWER_OFF'], + '_need_ready': ['PLANT_REQUIRED', 'POWER_OFF', 'NOT_READY', 'ERROR_PENDING'], '_need_idle': ['ACQUISITION_RUNNING'], + '_need_door_open': ['DOOR_CLOSED'], '_need_stage': ['PLANT_REQUIRED', 'POWER_OFF', 'NOT_READY', 'ERROR_PENDING', 'ACQUISITION_RUNNING'], + '_need_beam_ready': ['PLANT_REQUIRED', 'POWER_OFF', 'NOT_READY', 'ERROR_PENDING', 'ACQUISITION_RUNNING', 'DOOR_OPEN', 'XRAY_NOT_READY', + 'VACUUM_NOT_READY', 'MOTION_IN_PROGRESS', 'RECORDS_FULL'], + '_need_asx': ['PLANT_REQUIRED', 'POWER_OFF', 'NOT_READY', 'ERROR_PENDING', 'ASX_DOOR_OPEN', 'ASX_BUSY', 'ACQUISITION_RUNNING'], + '_rec(': ['UNKNOWN_RECORD', 'RECORD_NOT_COMPLETED'], '_norm(': ['NO_PRIMARY_BEAM'], '_red(': ['UNKNOWN_REDUCED'], + '_cmd_analysis_guinier(': ['UNKNOWN_REDUCED', 'GUINIER_FAILED']} + for k in rt.CAPS: + if k in rt.UNSUPPORTED: + continue + m = re.search(r' def _cmd_' + k.replace('.', '_') + r'\(.*?(?=\n def |\Z)', src, re.S) + self.assertIsNotNone(m, k) + body = m.group(0) + codes = set(re.findall(r"ActionRejected\('([A-Z_]+)'\)", body)) + for hname, hcodes in helpers.items(): + if hname in body: + codes |= set(hcodes) + codes.discard('INVALID_ARGUMENT') + declared = {e['code'] for e in meta[k]['errors']} + self.assertLessEqual(codes, declared, (k, sorted(codes - declared))) + + def test_unsupported_capabilities_report_unsupported(self): + h = configured() + h.register_principal('a', 'agent') + s = h.session('a') + for k in rt.UNSUPPORTED: + r = s.invoke(instance_id=h.instance_id, capability_id=k, arguments={}, request_id='u-' + k) + self.assertEqual(r['status'], 'unsupported', k) + self.assertEqual(r['error']['code'], 'UNSUPPORTED') + + +class HostClockAndPurity(unittest.TestCase): + def test_read_and_describe_do_not_advance_time(self): + h = ready() + h.register_principal('a', 'agent') + t, rev = h.time_ns, h.revision + h.read('evaluator') + s = h.session('a') + s.read(instance_id=h.instance_id) + s.describe(instance_id=h.instance_id) + self.assertEqual((h.time_ns, h.revision), (t, rev)) + + def test_step_zero_and_negative(self): + h = configured() + rev = h.revision + h.step(0.0) + self.assertEqual(h.revision, rev) + with self.assertRaises(rt.ActionRejected): + h.step(-1.0) + + def test_host_step_chopping_does_not_change_the_result(self): + def run(chunks): + h = ready(seed=5) + h.rng = QuietRng() + liquid(h, 'lys', [(LYS, 5.0)]) + load(h, 'lys', temp=283.15) + h.invoke('acquisition.swaxs_scan', arm_angles_rad=[0.0, 0.3], exposure_s=30.0) + h.invoke('asx.set_door', open=True) + h.invoke('asx.set_door', open=False) + for dt in chunks: + h.step(dt) + rec = h.records['sx-%d' % h.seq['sx']] + return h.read('evaluator'), h.ledger(), rec + (a, la, ra), (b, lb, rb) = run([90.0]), run([0.37] * 243 + [0.09]) + for k in ('truth.pressure_pa', 'truth.stage_temperature_k', 'detector.arm_angle_rad', 'stage.y_m', 'clock.time_s'): + self.assertAlmostEqual(a[k], b[k], delta=1e-9 * max(abs(a[k]), 1e-12), msg=k) + self.assertEqual(ra['status'], rb['status']) + self.assertEqual(len(ra['segments']), len(rb['segments'])) + for k in ('photons_incident', 'photons_scattered_detected', 'tube_energy_j'): + self.assertAlmostEqual(la[k], lb[k], delta=1e-9 * max(la[k], 1.0), msg=k) + + def test_reads_do_not_change_later_counts(self): + """Reading (agent and evaluator, incl. detector.total_counts that evaluates the rate model) during an exposure leaves the record and the + ledgers bit-identical to a run without reads (the rate cache holds values that depend on its quantised key only).""" + h = ready(seed=4) + liquid(h, 'w') + load(h, 'w') + h.invoke('acquisition.start', exposure_s=30.0, frames=1) + a, b = copy.deepcopy(h), copy.deepcopy(h) + for _ in range(70): + a.step(0.5) + a.read('agent') + a.read('evaluator') + b.step(0.5) + ra, rb = a.records['sx-1'], b.records['sx-1'] + self.assertEqual(ra['status'], 'completed') + self.assertEqual(ra['primary_beam_counts'], rb['primary_beam_counts']) + self.assertEqual(ra['segments'][0]['counts'], rb['segments'][0]['counts']) + self.assertEqual(a.ledger(), b.ledger()) + + def test_set_points_only_write_targets(self): + h = ready() + h.invoke('detector.move_arm', angle_rad=0.5) + self.assertEqual(h.arm, 0.0) + h.step(1.0) + self.assertAlmostEqual(h.arm, rt.ARM_SPEED_RAD_S, places=12) + h.invoke('stage.set_temperature', temperature_k=333.15) + t0 = h.t_stage + self.assertEqual(h.t_set, 333.15) + h.step(60.0) + self.assertAlmostEqual(h.t_stage - t0, rt.HOT_STAGE_RAMP_K_S * 60.0, places=6) # 10 C/min while far from the set point + h.invoke('generator.set_power', voltage_v=30000.0, current_a=0.02) + self.assertEqual(h.kv, 40000.0) + h.step(2.0) + self.assertAlmostEqual(h.kv, 40000.0 - 2.0 * rt.HV_RAMP_V_S, places=6) + + +class GeneratorAndInterlocks(unittest.TestCase): + def test_start_up_key_ramp_and_lamps(self): + h = configured() + rejected(h, 'generator.xray_on', 'POWER_OFF') + h.invoke('power.set', enabled=True) + h.step(rt.BOOT_S - 1.0) + self.assertEqual(h.state, 'booting') + rejected(h, 'generator.xray_on', 'NOT_READY') + h.step(2.0) + self.assertEqual(h.state, 'ready') + rejected(h, 'generator.xray_on', 'KEY_OFF') + h.invoke('generator.set_key', on=True) + self.assertTrue(h.read()['panel.xray_off_lamp']) + h.invoke('generator.xray_on') + self.assertTrue(h.read()['panel.warning_lamp']) + h.step(10.0) + self.assertAlmostEqual(h.kv, 20000.0, places=6) + self.assertAlmostEqual(h.ma, 0.05, places=9) + h.step(11.0) + self.assertEqual(h.read()['generator.voltage_indicated_v'], 40000.0) + self.assertAlmostEqual(h.read()['generator.current_indicated_a'], 0.05, places=9) + h.invoke('generator.set_key', on=False) + self.assertFalse(h.xray_on) + self.assertEqual(h.kv, 0.0) + + def test_chiller_needs_30_s_and_its_failure_trips_the_tube(self): + h = configured() + h.invoke('power.set', enabled=True) + h.step(20.0) + self.assertFalse(h.read()['chiller.flow_ok']) + h.step(45.0) + h.invoke('generator.set_key', on=True) + h.invoke('generator.xray_on') + h.step(25.0) + h.invoke('fault.inject', fault='chiller_failure', active=True) + h.step(1.0) + r = h.read() + self.assertFalse(r['generator.xray_on']) + self.assertEqual(r['generator.fault_code'], 'COOLING_WATER_LOW') + self.assertTrue(r['panel.standby_lamp']) + rejected(h, 'generator.xray_on', 'GENERATOR_FAULT') + rejected(h, 'generator.acknowledge', 'COOLING_WATER_LOW') + h.invoke('fault.inject', fault='chiller_failure', active=False) + h.invoke('generator.acknowledge') + h.invoke('generator.xray_on') + self.assertTrue(h.xray_on) + + def test_emergency_stop_fails_the_acquisition_and_latches(self): + h = ready() + liquid(h, 'w') + load(h, 'w') + op = h.invoke('acquisition.start', exposure_s=100.0, frames=1)['operation_id'] + h.step(10.0) + h.invoke('generator.emergency_stop') + rec = h.records[h.operations[op]['record_id']] + self.assertEqual((rec['status'], rec['error_code']), ('failed', 'XRAY_OFF')) + self.assertEqual(rec['segments'], []) + self.assertFalse(h.read()['shutter.open']) + rejected(h, 'generator.xray_on', 'EMERGENCY_STOP') + rejected(h, 'generator.acknowledge', 'EMERGENCY_STOP') + h.invoke('generator.release_emergency_stop') + h.invoke('generator.acknowledge') + h.invoke('generator.xray_on') + self.assertTrue(h.xray_on) + + def test_mains_fault_and_power_cycle(self): + h = ready() + h.invoke('plant.configure', room_k=295.15, mains_voltage_v=180.0, noise_seed=9) + r = h.read() + self.assertFalse(r['power.enabled']) + self.assertEqual(r['system.error_code'], 'MAINS_FAULT') + rejected(h, 'power.set', 'MAINS_OUT_OF_RANGE', enabled=True) + h.invoke('plant.configure', room_k=295.15, mains_voltage_v=230.0, noise_seed=9) + h.invoke('power.set', enabled=True) + self.assertIsNone(h.read()['system.error_code']) + + +class VacuumDoorAndStage(unittest.TestCase): + def test_pump_down_below_3_mbar_and_door_interlock(self): + h = ready() + liquid(h, 'w') + h.invoke('chamber.set_door', open=True) + h.invoke('sample.load', sample_id='w', holder='capillary_1mm') + rejected(h, 'vacuum.set_pump', 'DOOR_OPEN', on=True) + h.invoke('chamber.set_door', open=False) + h.invoke('vacuum.set_pump', on=True) + rejected(h, 'chamber.set_door', 'PUMP_ON', open=True) + h.step(20.0) + rejected(h, 'chamber.set_door', 'CHAMBER_UNDER_VACUUM', open=True) + t_ready = rt.V_VAC_M3 / rt.S_PUMP_M3_S * math.log((rt.P_ATM - rt.P_ULT_PA) / (rt.VACUUM_READY_PA - rt.P_ULT_PA)) + h.step(t_ready - 25.0) + self.assertFalse(h.read()['vacuum.ready']) + rejected(h, 'acquisition.start', 'VACUUM_NOT_READY', exposure_s=10.0, frames=1) + h.step(10.0) + self.assertTrue(h.read()['vacuum.ready']) + self.assertLess(h.p, rt.VACUUM_READY_PA) + h.invoke('vacuum.set_pump', on=False) + h.step(60.0) + self.assertGreater(h.p, rt.DOOR_OPEN_MIN_PA) + h.invoke('chamber.set_door', open=True) + + def test_air_measurement_is_allowed_but_air_scatters(self): + h = ready() + liquid(h, 'w') + load(h, 'w', align=False) + r_vac = h.records[acquire(h, 60.0)] + h.invoke('vacuum.set_pump', on=False) + h.step(90.0) + r_air = h.records[acquire(h, 60.0)] + mid = slice(200, 400) + self.assertGreater(sum(r_air['segments'][0]['counts'][mid]), 1.5 * sum(r_vac['segments'][0]['counts'][mid])) + self.assertLess(r_air['primary_beam_counts'], r_vac['primary_beam_counts']) + + def test_stage_temperature_range_ramp_and_mount(self): + h = ready() + rejected(h, 'stage.set_temperature', 'TEMPERATURE_OUT_OF_RANGE', temperature_k=473.15) + h.invoke('stage.set_temperature', temperature_k=253.15) + h.step(600.0) + self.assertAlmostEqual(h.t_stage, 253.15, delta=rt.TEMP_ACCURACY_K) + h.invoke('chamber.set_door', open=True) + rejected(h, 'stage.mount', 'STAGE_NOT_AMBIENT', stage_type='tcstage_extended') + h.invoke('stage.set_temperature', temperature_k=295.15) + h.step(600.0) + h.invoke('stage.mount', stage_type='tcstage_extended') + h.invoke('stage.set_temperature', temperature_k=773.15) + h.step(60.0) + self.assertAlmostEqual(h.t_stage, 295.15 + 10.0, delta=0.01) + self.assertEqual(h.read()['stage.type'], 'tcstage_extended') + + +class SamplesAndHolders(unittest.TestCase): + def test_sample_validation(self): + h = configured() + bad = [dict(form='solution', solvent='none'), dict(form='solid', thickness_m=None), dict(form='powder', components=[dict(template_id=LYS, concentration_kg_m3=5.0, + model_parameters=None)])] + base = dict(sample_id='x', form='solution', solvent='water', volume_m3=1e-7, thickness_m=None, components=[]) + for b in bad: + a = dict(base, **b) + if a['form'] != 'solution': + a['solvent'], a['volume_m3'] = 'none', 0.0 + if 'thickness_m' not in b: + a['thickness_m'] = 1e-3 + try: + h.invoke('sample.provide', **a) + raise AssertionError(b) + except rt.ActionRejected as exc: + self.assertIn(str(exc), ('SAMPLE_FORM_INVALID', 'CONCENTRATION_REQUIRED'), b) + rejected(h, 'sample.provide', 'CONCENTRATION_REQUIRED', **dict(base, components=[dict(template_id=LYS, concentration_kg_m3=None, model_parameters=None)])) + rejected(h, 'sample.provide', 'UNKNOWN_TEMPLATE', **dict(base, components=[dict(template_id='nope', concentration_kg_m3=1.0, model_parameters=None)])) + rejected(h, 'sample.provide', 'SAMPLE_FORM_INVALID', **dict(base, form='solid', solvent='none', volume_m3=0.0, thickness_m=2e-3, + components=[dict(template_id=GC, concentration_kg_m3=None, model_parameters=None)])) + rejected(h, 'sample.provide', 'MODEL_PARAMETERS_INVALID', **dict(base, form='solid', solvent='none', volume_m3=0.0, thickness_m=1e-3, + components=[dict(template_id='model_lamellar', concentration_kg_m3=None, + model_parameters=dict(d_spacing_m=1e-6))])) + + def test_load_volumes_holders_and_empty_capillary(self): + h = ready(xray=False) + liquid(h, 'lys', [(LYS, 5.0)], volume=100e-9) + solid(h, 'gc', GC, 1.055e-3) + rejected(h, 'sample.load', 'DOOR_CLOSED', sample_id='lys', holder='capillary_1mm') + h.invoke('chamber.set_door', open=True) + rejected(h, 'sample.load', 'HOLDER_UNSUITABLE', sample_id='lys', holder='solid_holder') + rejected(h, 'sample.load', 'HOLDER_UNSUITABLE', sample_id='gc', holder='capillary_1mm') + h.invoke('sample.load', sample_id='lys', holder='capillary_1mm') + self.assertAlmostEqual(h.samples['lys']['bench_volume_m3'], 40e-9, places=18) + rejected(h, 'sample.load', 'HOLDER_OCCUPIED', sample_id='gc', holder='solid_holder') + h.invoke('sample.unload') + rejected(h, 'sample.load', 'INSUFFICIENT_VOLUME', sample_id='lys', holder='capillary_1mm') + h.invoke('sample.load', sample_id='lys', holder='mu_cell') + h.invoke('sample.unload') + h.invoke('sample.load', sample_id=None, holder='capillary_1mm') + self.assertIsNone(h.read()['holder.sample_id']) + self.assertEqual(h.read()['holder.type'], 'capillary_1mm') + + def test_truefocus_finds_the_capillary_axis(self): + h = ready(seed=4) + liquid(h, 'w') + load(h, 'w', align=False) + off = h.cap_offset + self.assertGreater(abs(off), 0.05e-3) + g0 = h._geometry() + h.invoke('stage.auto_align') + h.step(rt.ALIGN_S + 1.0) + h.step(2.0) + self.assertAlmostEqual(h.stage['y'], off, delta=4e-5) + g1 = h._geometry() + self.assertGreater(g1['scat_path_m'], g0['scat_path_m']) + self.assertLess(g1['t_total'], g0['t_total']) + h.invoke('stage.move', y_m=5e-3, z_m=0.0) + h.step(6.0) + self.assertEqual(h._geometry()['pos'], 'between') + h.invoke('stage.auto_align') + h.step(rt.ALIGN_S + 1.0) + op = [o for o in h.operations.values() if o['kind'] == 'align'][-1] + self.assertEqual(op.get('reason'), 'NO_CAPILLARY_FOUND') + + +class ScatteringPhysics(unittest.TestCase): + def test_water_scale_reproduces_the_nist_glassy_carbon(self): + """Absolute scale from water (compressibility) applied to a measured SRM 3600 coupon reproduces the certified curve (line collimation, desmeared).""" + h = calibrated(seed=2) + cal = water_calibration(h) + solid(h, 'gc', GC, 1.055e-3) + load(h, 'gc', holder='solid_holder') + rg = acquire(h, 300.0) + empty_beam(h) + rb = acquire(h, 300.0) + red = h.invoke('data.reduce', record_id=rg, background_record_id=rb, calibration_id=cal, thickness_m=1.055e-3, desmear=True) + q, i, s = reduced_arrays(red) + t = rt.template(GC) + m = (q > 0.1) & (q < 2.0) + ratio = i[m] / rt.srm3600_cm(t, q[m]) + self.assertAlmostEqual(float(np.median(ratio)), 1.0, delta=0.08) + CHECKS.append(dict(id='water_scale_vs_srm3600', status='passed', median_ratio=float(np.median(ratio)))) + + def test_lysozyme_rg_and_molecular_weight(self): + h = calibrated(seed=3) + cal = water_calibration(h) + liquid(h, 'buf') + liquid(h, 'lys', [(LYS, 5.0)]) + load(h, 'buf', temp=283.15) + rb = acquire(h, 900.0) + load(h, 'lys', temp=283.15) + rl = acquire(h, 900.0) + red = h.invoke('data.reduce', record_id=rl, background_record_id=rb, calibration_id=cal, thickness_m=1e-3, desmear=True) + g = h.invoke('analysis.guinier', reduced_id=red['reduced_id'], qrg_max=1.3) + rg_true = rt.template(LYS)['rg_template_nm'] * 1e-9 + self.assertAlmostEqual(g['rg_m'], rg_true, delta=max(3 * g['rg_sigma_m'], 0.06 * rg_true)) + mw = h.invoke('analysis.molecular_weight', reduced_id=red['reduced_id'], concentration_kg_m3=5.0, drho_m_m_kg=rt.DRHO_M_PROTEIN_M_KG) + self.assertAlmostEqual(mw['molecular_weight_kg_mol'], 14.3, delta=0.15 * 14.3) + smeared = h.invoke('data.reduce', record_id=rl, background_record_id=rb, calibration_id=cal, thickness_m=1e-3, desmear=False) + g2 = h.invoke('analysis.guinier', reduced_id=smeared['reduced_id'], qrg_max=1.3) + self.assertLess(g2['i0'], 0.85 * g['i0']) # line-collimation data must be desmeared for I(0) + CHECKS.append(dict(id='lysozyme_rg_mw', status='passed', rg_nm=g['rg_m'] * 1e9, mw_kda=mw['molecular_weight_kg_mol'])) + + def test_concentration_effect_and_template_scale(self): + t = rt.template(BSA) + q = np.array([0.02, 0.1, 0.3]) + lo = rt.component_cm(dict(kind='curve', template_id=BSA, concentration_mg_ml=2.0), q, 293.15, 0.0) / 2.0 + hi = rt.component_cm(dict(kind='curve', template_id=BSA, concentration_mg_ml=50.0), q, 293.15, 0.0) / 50.0 + self.assertLess(hi[0], 0.8 * lo[0]) # repulsive structure factor lowers I(0)/c at 50 mg/mL + self.assertAlmostEqual(lo[0] / t['_i0c'], 1.0, delta=0.02) + self.assertAlmostEqual(t['_i0c'] / (t['abs_scale']['mass_da'] * 1e-3), 0.00080, delta=0.00008) # I(0)/c per kDa of a protein + + def test_silver_behenate_orders_and_q_calibration(self): + h = calibrated(seed=6, collimation='point') + self.assertAlmostEqual(h.sdd_cal, h.sdd_true, delta=0.002 * h.sdd_true) + self.assertAlmostEqual(h.zero_cal, h.zero_true, delta=2.5e-5) + red = h.invoke('data.reduce', record_id='sx-1', background_record_id=None, calibration_id=None, thickness_m=1e-3, desmear=False) + peaks = [p['q_per_m'] * 1e-9 for p in h.invoke('analysis.peaks', reduced_id=red['reduced_id'])['peaks']] + for n in (1, 2, 3): + qn = 2 * math.pi * n / 5.838 + self.assertTrue(any(abs(p - qn) < 0.01 * qn + 0.02 for p in peaks), (n, peaks)) + + def test_silicon_111_ka_doublet_in_waxs(self): + h = ready(seed=7) + h.invoke('collimation.set_mode', mode='point') + solid(h, 'si', 'silicon_powder', 0.3e-3, form='powder') + load(h, 'si', holder='paste_cell') + tt111 = 2 * math.asin(rt.mean_wavelength_m() / (2 * 0.3135601e-9)) + arm = tt111 - math.atan(0.030 / rt.SDD_NOMINAL_M) + op = h.invoke('acquisition.swaxs_scan', arm_angles_rad=[0.0, arm], exposure_s=60.0)['operation_id'] + h.step(200.0) + rec = h.records[h.operations[op]['record_id']] + self.assertEqual(rec['status'], 'completed') + seg = rec['segments'][1] + c = np.asarray(seg['counts'], float) + tt = np.asarray(seg['two_theta_rad']) + l1, l2, _ = rt.ka_lines() + t1 = 2 * math.asin(l1 / (2 * 0.3135601e-9)) + t2 = 2 * math.asin(l2 / (2 * 0.3135601e-9)) + j1 = int(np.argmax(np.where(np.abs(tt - t1) < math.radians(0.03), c, 0))) + j2 = int(np.argmax(np.where(np.abs(tt - t2) < math.radians(0.03), c, 0))) + mid = int((j1 + j2) / 2) + self.assertGreater(c[j1], c[j2]) # Ka1 : Ka2 = 2 : 1 + self.assertLess(c[mid], 0.95 * c[j2]) # the doublet is resolved (0.07 deg apart) + self.assertGreater(abs(j2 - j1), 3) + + def test_gold_rm8012_guinier_radius(self): + t = rt.template(AU30) + q = np.geomspace(0.02, 0.2, 200) + i = rt.component_cm(dict(kind='sphere_model', template_id=AU30, concentration_mg_ml=0.048), q, 293.15, 0.0) + m = q < 0.08 + a, b = np.polyfit(q[m] ** 2, np.log(i[m]), 1) + rg = math.sqrt(-3 * a) + r = t['mean_diameter_nm'] / 2 + z = 1 / t['schulz_rel_sigma'] ** 2 - 1 + mom = lambda k: math.exp(math.lgamma(z + 1 + k) - math.lgamma(z + 1)) / (z + 1) ** k * r ** k # noqa: E731 + rg_expected = math.sqrt(0.6 * mom(8) / mom(6)) + self.assertAlmostEqual(rg, rg_expected, delta=0.05 * rg_expected) + + def test_swaxs_reaches_60_degrees_and_the_water_halo(self): + h = ready(seed=8) + liquid(h, 'w') + load(h, 'w') + op = h.invoke('acquisition.swaxs_scan', arm_angles_rad=[0.0, 0.2, 0.4, 0.6, rt.ARM_MAX_RAD], exposure_s=60.0)['operation_id'] + h.step(600.0) + rec = h.records[h.operations[op]['record_id']] + self.assertEqual(rec['status'], 'completed') + tt_max = max(max(s['two_theta_rad']) for s in rec['segments']) + q_max = max(max(s['q_per_m']) for s in rec['segments']) + self.assertAlmostEqual(math.degrees(tt_max), 60.0, delta=0.6) + self.assertGreater(q_max, 40.0e9) + red = h.invoke('data.reduce', record_id=rec['record_id'], background_record_id=None, calibration_id=None, thickness_m=1e-3, desmear=False) + q, i, _ = reduced_arrays(red) + self.assertGreater(np.interp(20.0, q, i), 1.8 * np.interp(8.0, q, i)) # water structure peak near 20 nm^-1 + + def test_q_min_and_resolution(self): + h = calibrated(seed=9) + liquid(h, 'w') + load(h, 'w') + r = acquire(h, 60.0) + red = h.invoke('data.reduce', record_id=r, background_record_id=None, calibration_id=None, thickness_m=1e-3, desmear=False) + self.assertLess(red['q_min_valid_per_m'], 0.035e9) + self.assertGreater(red['q_min_valid_per_m'], 0.015e9) + + +class FaultsAndStates(unittest.TestCase): + def test_vacuum_leak_keeps_the_path_above_3_mbar(self): + h = ready() + h.invoke('fault.inject', fault='vacuum_leak', active=True) + liquid(h, 'w') + load(h, 'w', align=False, pump_s=600.0) + self.assertFalse(h.read()['vacuum.ready']) + rejected(h, 'acquisition.start', 'VACUUM_NOT_READY', exposure_s=10.0, frames=1) + + def test_aged_tube_and_misaligned_beamstop(self): + h = ready(seed=2) + liquid(h, 'w') + load(h, 'w') + p0 = h.records[acquire(h, 30.0)]['primary_beam_counts'] + h.invoke('fault.inject', fault='tube_aged', active=True) + p1 = h.records[acquire(h, 30.0)]['primary_beam_counts'] + self.assertAlmostEqual(p1 / p0, 0.6, delta=0.02) + h.invoke('fault.inject', fault='beamstop_misaligned', active=True) + op = h.invoke('acquisition.start', exposure_s=30.0, frames=1)['operation_id'] + rec = h.records[h.operations[op]['record_id']] + self.assertEqual((rec['status'], rec['error_code']), ('failed', 'DETECTOR_OVEREXPOSURE')) + self.assertFalse(h.read()['shutter.open']) + + def test_capillary_bubble_lowers_the_signal(self): + h = ready(seed=2) + liquid(h, 'w') + load(h, 'w') + g0 = h._geometry() + h.invoke('fault.inject', fault='capillary_bubble', active=True) + g1 = h._geometry() + self.assertLess(g1['scat_path_m'], 0.8 * g0['scat_path_m']) # path x transmission: 0.4 d exp(-0.4 mu d) against d exp(-mu d) + self.assertGreater(g1['t_total'], g0['t_total']) + + def test_freezing_boiling_burst_and_aggregation(self): + h = ready(seed=3) + liquid(h, 'lys', [(LYS, 5.0)]) + load(h, 'lys', temp=258.15, pump_s=300.0) + self.assertTrue(h.content['frozen']) + h.invoke('stage.set_temperature', temperature_k=343.15) + h.step(700.0) + self.assertFalse(h.content['frozen']) + a = h.content['agg'][LYS] + self.assertGreater(a, 0.1) + led0 = h.ledger() + h.invoke('stage.set_temperature', temperature_k=373.15) + h.step(400.0) + r = h.read('evaluator') + self.assertTrue(r['holder.broken']) + self.assertEqual(r['system.error_code'], 'SAMPLE_BURST') + led = h.ledger() + self.assertAlmostEqual(led['liquid_residual_m3'], 0.0, delta=1e-18) + self.assertAlmostEqual(led['solute_residual_kg'], 0.0, delta=1e-18) + self.assertGreater(led['liquid_waste_m3'], led0['liquid_waste_m3']) + rejected(h, 'system.acknowledge', 'HOLDER_BROKEN') + + def test_aggregation_raises_the_apparent_rg(self): + q = np.geomspace(0.02, 0.5, 100) + base = dict(kind='curve', template_id=LYS, concentration_mg_ml=5.0) + i0 = rt.component_cm(dict(base, aggregated_fraction=0.0), q, 293.15, 0.0) + i1 = rt.component_cm(dict(base, aggregated_fraction=0.2), q, 293.15, 0.0) + self.assertGreater(i1[0], 5 * i0[0]) + + +class Autosampler(unittest.TestCase): + def test_injection_carry_over_cleaning_and_conservation(self): + h = ready(seed=2) + liquid(h, 'bsa', [(BSA, 10.0)], volume=200e-9) + liquid(h, 'buf', volume=300e-9) + rejected(h, 'asx.load_well', 'ASX_DOOR_CLOSED', sample_id='bsa', well='AA01', volume_m3=100e-9) + h.invoke('asx.set_door', open=True) + h.invoke('asx.load_well', sample_id='bsa', well='AA01', volume_m3=100e-9) + h.invoke('asx.load_well', sample_id='buf', well='AA02', volume_m3=100e-9) + rejected(h, 'asx.inject', 'ASX_DOOR_OPEN', well='AA01') + h.invoke('asx.set_door', open=False) + h.invoke('asx.inject', well='AA01') + self.assertEqual(h.read()['asx.busy'], 'inject') + h.step(60.0) + self.assertIsNone(h.read()['asx.busy']) + self.assertAlmostEqual(h.flow_cell['conc'][BSA], 10.0, places=9) + h.invoke('asx.inject', well='AA02') + h.step(60.0) + self.assertAlmostEqual(h.flow_cell['conc'][BSA], 10.0 * rt.ASX_CARRY_OVER, places=9) + h.invoke('asx.clean') + h.step(150.0) + self.assertEqual(h.read()['asx.flow_cell_state'], 'rinsed') + h.invoke('asx.inject', well='AA02') + h.step(60.0) + self.assertAlmostEqual(h.flow_cell['conc'][BSA], 10.0 * rt.ASX_CARRY_OVER * rt.ASX_CARRY_OVER_CLEAN, delta=1e-12) + led = h.ledger() + self.assertAlmostEqual(led['liquid_residual_m3'], 0.0, delta=1e-18) + self.assertAlmostEqual(led['solute_residual_kg'], 0.0, delta=1e-18) + + def test_flow_cell_measurement_and_cancel(self): + h = ready(seed=2) + liquid(h, 'bsa', [(BSA, 10.0)], volume=200e-9) + h.invoke('asx.set_door', open=True) + h.invoke('asx.load_well', sample_id='bsa', well='BA01', volume_m3=100e-9) + h.invoke('asx.set_door', open=False) + h.register_principal('e', 'evaluator') + s = h.session('e') + op = s.invoke(instance_id=h.instance_id, capability_id='asx.inject', arguments=dict(well='BA01'), request_id='i1')['operation_id'] + h.step(12.0) + s.cancel(op, 'c1') + self.assertEqual(h.operations[op]['phase'], 'cancelled') + led = h.ledger() + self.assertAlmostEqual(led['liquid_residual_m3'], 0.0, delta=1e-18) + h.invoke('asx.inject', well='BA01') + h.step(60.0) + h.invoke('stage.select_position', position='flow_cell') + h.step(10.0) + self.assertEqual(h._beam_content()[0], 'flow_cell') + h.invoke('vacuum.set_pump', on=True) + h.step(220.0) + r = h.records[acquire(h, 60.0)] + self.assertEqual(r['sample_label'], 'BA01') + self.assertEqual(r['sample_position'], 'flow_cell') + + +class LedgersIsolationSessions(unittest.TestCase): + def test_photon_ledger_closes_and_scattering_comes_from_attenuation(self): + h = ready(seed=2) + liquid(h, 'lys', [(LYS, 5.0)]) + load(h, 'lys') + acquire(h, 120.0) + led = h.ledger() + self.assertAlmostEqual(led['photons_residual'], 0.0, delta=1e-6 * led['photons_incident']) + self.assertLess(led['photons_scattered_detected'], led['photons_attenuated_sample'] + led['photons_attenuated_windows'] + led['photons_attenuated_air']) + self.assertAlmostEqual(led['tube_on_time_s'], h.time_s - 61.0, delta=1e-6) + self.assertGreater(led['tube_energy_j'], 0.9 * 40000.0 * 0.05 * (h.time_s - 61.0 - 20.0)) + + def test_two_instances_are_isolated(self): + a, b = ready(seed=1), ready(seed=1) + a.invoke('detector.move_arm', angle_rad=0.3) + a.step(10.0) + self.assertEqual(b.arm, 0.0) + self.assertNotEqual(a.arm, b.arm) + + def test_agent_does_not_see_truth(self): + h = ready() + liquid(h, 'lys', [(LYS, 5.0)]) + load(h, 'lys') + rid = acquire(h, 30.0) + h.register_principal('a', 'agent') + s = h.session('a') + obs = s.read(instance_id=h.instance_id)['observations'] + self.assertFalse([k for k in obs if k.startswith('truth.')]) + r = s.invoke(instance_id=h.instance_id, capability_id='acquisition.result', arguments=dict(record_id=rid), request_id='r1') + text = json.dumps(r) + self.assertNotIn('lysozyme', text.lower()) + self.assertNotIn(LYS, text) + r = s.invoke(instance_id=h.instance_id, capability_id='provenance.read', arguments={}, request_id='r2') + self.assertEqual(r['error']['code'], 'ACCESS_DENIED') + d = s.describe(instance_id=h.instance_id) + self.assertFalse([k for k in d['state_slots'] if k.startswith('truth.')]) + + def test_records_and_control_belong_to_their_agent(self): + h = ready() + liquid(h, 'w') + load(h, 'w') + for p in ('a', 'b'): + h.register_principal(p, 'agent') + sa, sb = h.session('a'), h.session('b') + r = sa.invoke(instance_id=h.instance_id, capability_id='acquisition.start', arguments=dict(exposure_s=30.0, frames=1), request_id='x1') + self.assertEqual(r['status'], 'accepted') + rb = sb.invoke(instance_id=h.instance_id, capability_id='detector.move_arm', arguments=dict(angle_rad=0.2), request_id='y1') + self.assertEqual(rb['error']['code'], 'ACCESS_DENIED') + self.assertTrue(sb.read(instance_id=h.instance_id)['observations']['acquisition.started_by_other_agent']['value']) + h.step(40.0) + rid = h.operations[r['operation_id']]['record_id'] + self.assertEqual(sb.invoke(instance_id=h.instance_id, capability_id='acquisition.result', arguments=dict(record_id=rid), request_id='y2')['error']['code'], + 'ACCESS_DENIED') + self.assertEqual(sb.invoke(instance_id=h.instance_id, capability_id='data.reduce', arguments=dict(record_id=rid, background_record_id=None, calibration_id=None, + thickness_m=1e-3, desmear=False), request_id='y3')['error']['code'], + 'ACCESS_DENIED') + self.assertEqual(sa.read(instance_id=h.instance_id)['observations']['result.last_record_id']['value'], rid) + again = sa.invoke(instance_id=h.instance_id, capability_id='acquisition.start', arguments=dict(exposure_s=30.0, frames=1), request_id='x1') + self.assertEqual(again['operation_id'], r['operation_id']) + conflict = sa.invoke(instance_id=h.instance_id, capability_id='acquisition.start', arguments=dict(exposure_s=31.0, frames=1), request_id='x1') + self.assertEqual(conflict['error']['code'], 'REQUEST_CONFLICT') + + def test_cancel_keeps_finished_segments_and_power_off_fails(self): + h = ready() + liquid(h, 'w') + load(h, 'w') + h.register_principal('a', 'agent') + s = h.session('a') + r = s.invoke(instance_id=h.instance_id, capability_id='acquisition.swaxs_scan', arguments=dict(arm_angles_rad=[0.0, 0.4], exposure_s=30.0), request_id='s1') + h.step(45.0) + s.cancel(r['operation_id'], 'c1') + rec = h.records[h.operations[r['operation_id']]['record_id']] + self.assertEqual((rec['status'], rec['error_code'], len(rec['segments'])), ('cancelled', 'USER_CANCEL', 1)) + self.assertEqual(h.arm_target, h.arm) + op = h.invoke('acquisition.start', exposure_s=60.0, frames=1) + h.step(5.0) + h.invoke('power.set', enabled=False) + rec = h.records[h.operations[op['operation_id']]['record_id']] + self.assertEqual((rec['status'], rec['error_code']), ('failed', 'POWER_OFF')) + led = h.ledger() + self.assertAlmostEqual(led['photons_residual'], 0.0, delta=1e-6 * led['photons_incident']) + + def test_tray_well_xray_off_result_and_ledger_calls(self): + """Capabilities otherwise reached only through helpers: tray temperature, well removal (liquid to waste), X-RAY OFF, data.result and + ledger.read, each through invoke with its declared output.""" + h = ready(seed=11) + liquid(h, 'w', volume=300e-9) + h.invoke('asx.set_tray_temperature', temperature_k=277.15) + h.step(1500.0) + self.assertAlmostEqual(h.read('evaluator')['truth.tray_temperature_k'], 277.15, delta=0.2) + h.invoke('asx.set_door', open=True) + h.invoke('asx.load_well', sample_id='w', well='AB03', volume_m3=100e-9) + waste0 = h.invoke('ledger.read')['liquid_waste_m3'] + h.invoke('asx.unload_well', well='AB03') + led = h.invoke('ledger.read') + self.assertAlmostEqual(led['liquid_waste_m3'] - waste0, 100e-9, delta=1e-15) + self.assertLessEqual(abs(led['liquid_residual_m3']), 1e-18) + self.assertEqual(h.read('evaluator')['asx.wells'], {}) + h.invoke('asx.set_door', open=False) + load(h, 'w') + rid = acquire(h, 30.0) + red = h.invoke('data.reduce', record_id=rid, background_record_id=None, calibration_id=None, thickness_m=1e-3, desmear=False) + again = h.invoke('data.result', reduced_id=red['reduced_id']) + self.assertEqual(again, red) + h.invoke('generator.xray_off') + v = h.read('evaluator') + self.assertFalse(v['generator.xray_on']) + self.assertEqual(v['truth.voltage_v'], 0.0) + self.assertFalse(v['panel.warning_lamp']) + + def test_queries_and_bookkeeping(self): + h = ready() + self.assertEqual(h.invoke('records.list'), dict(records=[], reduced=[], calibrations=[])) + ev = h.invoke('events.read', since_s=0.0) + self.assertTrue(any(e['code'] == 'SOFTWARE_READY' for e in ev['events'])) + self.assertEqual(h.invoke('provenance.read')['templates'], []) + self.assertEqual(h.invoke('sim.step', dt_s=1.0)['time_s'], h.time_s) + + +# ---------------------------------------------------------------- declared effects (scenario states for the effect discovery) +def _scenario(name): + if name == 'fresh': + return rt.AntonpaarSaxspaceRuntime() + if name == 'off': + h = configured() + liquid(h, 'w') + return h + if name == 'booting': + h = configured() + h.invoke('power.set', enabled=True) + h.step(10.0) + liquid(h, 'w') + return h + if name == 'ready': + h = ready(xray=False) + liquid(h, 'w') + liquid(h, 'lys', [(LYS, 5.0)]) + return h + if name == 'xray_ramping': + h = ready(xray=False) + liquid(h, 'w') + h.invoke('generator.xray_on') + h.step(3.0) + return h + if name == 'door_open_loaded': + h = ready() + liquid(h, 'w') + liquid(h, 'lys', [(LYS, 5.0)]) + solid(h, 'gc', GC, 1.055e-3) + h.invoke('chamber.set_door', open=True) + h.invoke('sample.load', sample_id='w', holder='capillary_1mm') + return h + if name == 'pumping': + h = ready() + liquid(h, 'w') + h.invoke('chamber.set_door', open=True) + h.invoke('sample.load', sample_id='w', holder='capillary_1mm') + h.invoke('chamber.set_door', open=False) + h.invoke('vacuum.set_pump', on=True) + h.step(20.0) + return h + if name == 'loaded_vacuum': + h = ready() + liquid(h, 'w') + liquid(h, 'lys', [(LYS, 5.0)]) + load(h, 'lys', temp=283.15) + acquire(h, 5.0) + return h + if name == 'measuring': + h = _scenario('loaded_vacuum') + h.invoke('acquisition.start', exposure_s=60.0, frames=1) + h.step(2.3) + return h + if name == 'scanning': + h = _scenario('loaded_vacuum') + h.invoke('acquisition.swaxs_scan', arm_angles_rad=[0.0, 0.3], exposure_s=4.0) + h.step(5.5) + return h + if name == 'aligning': + h = ready() + liquid(h, 'w') + load(h, 'w', align=False) + h.invoke('stage.auto_align') + h.step(3.0) + return h + if name == 'asx_loaded': + h = ready() + liquid(h, 'w') + liquid(h, 'bsa', [(BSA, 10.0)]) + h.invoke('asx.set_door', open=True) + h.invoke('asx.load_well', sample_id='bsa', well='AA01', volume_m3=100e-9) + h.invoke('asx.load_well', sample_id='w', well='AA02', volume_m3=100e-9) + h.invoke('asx.set_door', open=False) + h.invoke('asx.inject', well='AA01') + h.step(60.0) + return h + if name == 'asx_injecting': + h = _scenario('asx_loaded') + h.invoke('asx.inject', well='AA02') + h.step(7.5) + return h + if name == 'estop': + h = ready() + liquid(h, 'w') + h.invoke('generator.emergency_stop') + return h + if name == 'cooling_fault': + h = ready() + h.invoke('fault.inject', fault='chiller_failure', active=True) + h.step(1.0) + return h + if name == 'hot_protein': + h = ready() + liquid(h, 'lys', [(LYS, 5.0)]) + load(h, 'lys', temp=353.15, pump_s=500.0) + return h + if name == 'burst': + h = _scenario('hot_protein') + h.invoke('stage.set_temperature', temperature_k=378.15) + h.step(300.0) + return h + if name == 'burst_cleared': + h = _scenario('burst') + h.invoke('vacuum.set_pump', on=False) + h.step(700.0) + h.invoke('chamber.set_door', open=True) + h.invoke('sample.unload') + h.invoke('system.acknowledge') + h.invoke('stage.set_temperature', temperature_k=295.15) + return h + if name == 'door_open_empty': + h = ready() + liquid(h, 'w') + liquid(h, 'lys', [(LYS, 5.0)]) + solid(h, 'gc', GC, 1.055e-3) + h.invoke('chamber.set_door', open=True) + return h + if name == 'asx_door_open': + h = ready() + liquid(h, 'w') + h.invoke('asx.set_door', open=True) + h.invoke('asx.load_well', sample_id='w', well='AA02', volume_m3=100e-9) + return h + if name == 'estop_released': + h = ready() + h.invoke('generator.emergency_stop') + h.invoke('generator.release_emergency_stop') + return h + if name == 'measuring_air': + h = ready() + liquid(h, 'lys', [(LYS, 5.0)]) + h.invoke('chamber.set_door', open=True) + h.invoke('sample.load', sample_id='lys', holder='capillary_1mm') + h.invoke('chamber.set_door', open=False) + h.invoke('acquisition.start', exposure_s=60.0, frames=1) + h.step(10.0) + return h + if name == 'door_open_pump_on': + h = configured() + h.invoke('power.set', enabled=True) + h.step(65.0) + h.invoke('vacuum.set_pump', on=True) + h.invoke('power.set', enabled=False) + h.invoke('chamber.set_door', open=True) + h.invoke('power.set', enabled=True) + h.step(65.0) + return h + if name == 'extended_hot_setpoint': + h = ready() + h.invoke('chamber.set_door', open=True) + h.invoke('stage.mount', stage_type='tcstage_extended') + h.invoke('stage.set_temperature', temperature_k=873.15) + return h + if name == 'vented_closed': + h = ready() + liquid(h, 'w') + load(h, 'w', align=False) + h.invoke('vacuum.set_pump', on=False) + h.step(80.0) + return h + if name == 'solid_open': + h = ready() + solid(h, 'gc', GC, 1.055e-3) + h.invoke('chamber.set_door', open=True) + h.invoke('sample.load', sample_id='gc', holder='solid_holder') + return h + if name == 'burst_open': + h = _scenario('burst') + h.invoke('vacuum.set_pump', on=False) + h.step(700.0) + h.invoke('chamber.set_door', open=True) + return h + if name == 'burst_unloaded': + h = _scenario('burst_open') + h.invoke('sample.unload') + return h + if name == 'mains_fault_restored': + h = ready() + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, mains_voltage_v=180.0)) + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE)) + return h + if name == 'cooling_fault_cleared': + h = _scenario('cooling_fault') + h.invoke('fault.inject', fault='chiller_failure', active=False) + return h + if name == 'faults_measuring': + h = ready() + liquid(h, 'w') + load(h, 'w') + for f in ('vacuum_leak', 'tube_aged', 'capillary_bubble'): + h.invoke('fault.inject', fault=f, active=True) + h.invoke('acquisition.start', exposure_s=60.0, frames=1) + h.step(5.0) + return h + if name == 'estop_unpowered': + h = configured() + h.invoke('generator.emergency_stop') + return h + if name == 'agbe_measured': + h = ready() + solid(h, 'agbe', 'silver_behenate', 1e-3, form='powder') + load(h, 'agbe', holder='paste_cell') + acquire(h, 30.0) + return h + raise KeyError(name) + + +SCENARIOS = ['fresh', 'off', 'booting', 'ready', 'xray_ramping', 'door_open_loaded', 'door_open_empty', 'pumping', 'loaded_vacuum', 'measuring', 'scanning', + 'aligning', 'asx_loaded', 'asx_door_open', 'asx_injecting', 'estop', 'estop_released', 'cooling_fault', 'hot_protein', 'burst', 'burst_cleared', + 'agbe_measured', 'measuring_air', 'door_open_pump_on', 'extended_hot_setpoint', 'vented_closed', 'solid_open', 'burst_open', 'burst_unloaded', + 'mains_fault_restored', 'cooling_fault_cleared', 'faults_measuring', 'estop_unpowered'] +STEP_DTS = (0.4, 1.0, 3.0, 15.0, 120.0) + + +def _variants(cap): + V = { + 'plant.configure': [dict(rt.PLANT_EXAMPLE), dict(room_k=300.15, mains_voltage_v=180.0, noise_seed=2)], + 'sample.provide': [dict(rt.SAMPLE_EXAMPLE, sample_id='new')], + 'fault.inject': [dict(fault=f, active=True) for f in rt.FAULTS] + [dict(fault=f, active=False) for f in rt.FAULTS], + 'power.set': [dict(enabled=True), dict(enabled=False)], 'system.acknowledge': [{}], + 'generator.set_key': [dict(on=True), dict(on=False)], 'generator.xray_on': [{}], 'generator.xray_off': [{}], 'generator.acknowledge': [{}], + 'generator.emergency_stop': [{}], 'generator.release_emergency_stop': [{}], + 'generator.set_power': [dict(voltage_v=30000.0, current_a=0.03), dict(voltage_v=40000.0, current_a=0.05)], + 'vacuum.set_pump': [dict(on=True), dict(on=False)], 'chamber.set_door': [dict(open=True), dict(open=False)], + 'stage.mount': [dict(stage_type='tcstage_extended'), dict(stage_type='tcstage_peltier')], 'sample.load': [dict(sample_id='lys', holder='capillary_1mm'), dict(sample_id=None, holder='capillary_1mm'), + dict(sample_id='gc', holder='solid_holder')], + 'sample.unload': [{}], 'stage.set_temperature': [dict(temperature_k=313.15), dict(temperature_k=253.15)], + 'stage.move': [dict(y_m=2e-3, z_m=1e-3)], 'stage.select_position': [dict(position='flow_cell'), dict(position='capillary')], + 'stage.auto_align': [{}], 'collimation.set_mode': [dict(mode='point'), dict(mode='line')], 'detector.move_arm': [dict(angle_rad=0.4), dict(angle_rad=0.0)], + 'acquisition.start': [dict(exposure_s=2.0, frames=2)], 'acquisition.swaxs_scan': [dict(arm_angles_rad=[0.0, 0.2], exposure_s=2.0)], + 'asx.set_door': [dict(open=True), dict(open=False)], 'asx.load_well': [dict(sample_id='w', well='AB01', volume_m3=50e-9)], + 'asx.unload_well': [dict(well='AA02')], 'asx.set_tray_temperature': [dict(temperature_k=277.15)], 'asx.inject': [dict(well='AA02')], + 'asx.clean': [{}], 'calibration.zero_angle': [dict(record_id='sx-1')], 'calibration.q_scale': [dict(record_id='sx-1', calibrant='silver_behenate')], + 'sim.step': [dict(dt_s=0.5), dict(dt_s=30.0)], + } + return V.get(cap, []) + + +def _num(x): + return isinstance(x, (int, float)) and not isinstance(x, bool) + + +def _flat(v, prefix=''): + out = {} + if isinstance(v, dict): + for k, x in v.items(): + out.update(_flat(x, f'{prefix}.{k}')) + elif isinstance(v, list) and len(v) <= 64: + for i, x in enumerate(v): + out.update(_flat(x, f'{prefix}[{i}]')) + else: + out[prefix] = json.dumps(v, sort_keys=True, default=str) if isinstance(v, list) else v + return out + + +def _changed(a, b, scale=None): + """Relative comparison (no absolute floor).""" + if _num(a) and _num(b): + return abs(a - b) > 1e-9 * (max(abs(a), abs(b)) if scale is None else scale) + 1e-300 + return a != b + + +def _step_differs(v1, a2, v0, b2): + """Does the step change the value differently with the call (v1 -> a2) than without it (v0 -> b2)? (leaf-wise, numeric increments)""" + f1, fa, f0, fb = _flat(v1), _flat(a2), _flat(v0), _flat(b2) + for leaf in set(f1) | set(fa) | set(f0) | set(fb): + x1, xa, x0, xb = (f.get(leaf, '') for f in (f1, fa, f0, fb)) + ca, cb = _changed(x1, xa), _changed(x0, xb) + if not (ca or cb): + continue + if ca and cb and all(_num(x) for x in (x1, xa, x0, xb)) and not _changed(xa - x1, xb - x0, max(abs(x1), abs(xa), abs(x0), abs(xb))): + continue + if ca and cb and (x1, xa) == (x0, xb): + continue + return True + return False + + + +class ReviewRound1Regressions(unittest.TestCase): + """Regression tests for the findings of the first independent runtime review (F01-F19).""" + + def _session_invoke(self, h, principal, cap, args, rid): + return h.session(principal).invoke(instance_id=h.instance_id, capability_id=cap, arguments=args, request_id=rid) + + def test_f01_agent_events_hide_faults_and_the_frozen_state(self): + h = ready(seed=21) + h.register_principal('ag', 'agent') + h.register_principal('ev', 'evaluator') + h.invoke('fault.inject', fault='tube_aged', active=True) + liquid(h, 's1') + load(h, 's1', align=False) + h.invoke('stage.set_temperature', temperature_k=253.15) + h.step(900.0) + self.assertTrue(h.read('evaluator')['truth.samples']['holder']['frozen']) + ag = {e['code'] for e in self._session_invoke(h, 'ag', 'events.read', dict(since_s=0.0), 'e1')['result']['events']} + ev = {e['code'] for e in self._session_invoke(h, 'ev', 'events.read', dict(since_s=0.0), 'e2')['result']['events']} + self.assertFalse([c for c in ag if c.startswith('FAULT_')] + [c for c in ag if c == 'SAMPLE_FROZEN']) + self.assertIn('FAULT_TUBE_AGED', ev) + self.assertIn('SAMPLE_FROZEN', ev) + + def test_f02_records_do_not_reveal_the_composition(self): + h = ready(seed=22) + liquid(h, 'buf') + liquid(h, 'mix', [(LYS, 5.0), (BSA, 2.0)]) + rs = [] + for sid in ('buf', 'mix'): + load(h, sid) + rs.append(h.records[acquire(h, 10.0)]['template_source']) + self.assertEqual(rs[0], rs[1]) + self.assertEqual(set(rs[0]), {'library', 'note_zh'}) + + def test_f03_f04_ledger_split_by_optical_depth_and_real_closure(self): + h = ready(seed=23) + load(h, None) + rid = acquire(h, 60.0) + led = h.invoke('ledger.read') + self.assertEqual(led['photons_attenuated_sample'], 0.0) # an empty capillary absorbs only in its quartz walls + self.assertGreater(led['photons_attenuated_windows'], 0.0) + self.assertLess(abs(led['photons_residual']), 1e-9 * led['photons_incident']) + self.assertGreater(led['photons_direct_off_detector'], 0.0) # 20 mm line beam vs 8 mm strips + self.assertGreater(led['photons_direct_stopped'], led['photons_direct_detected']) + g = h._geometry() + liquid(h, 'w') + load(h, 'w') + g = h._geometry() + # 1 mm water in a 10 um quartz capillary: windows take ~14 % of the absorbed share at the beam centre, not a fixed 35 % + share = g['att_window'] / (g['att_window'] + g['att_sample']) + self.assertLess(share, 0.25) + self.assertGreater(share, 0.05) + self.assertTrue(rid) + + def test_f05_water_calibration_in_air_equals_vacuum(self): + """Air and collimator scattering pass through the sample: after normalising by the transmitted primary beam and subtracting the empty + capillary, the water scale measured in air equals the one measured under vacuum.""" + def measure(h, sid, vac): + if h.pump_on: + h.invoke('vacuum.set_pump', on=False) + h.step(80.0) + if not h.door_open: + h.invoke('chamber.set_door', open=True) + if h.holder is not None: + h.invoke('sample.unload') + h.invoke('sample.load', sample_id=sid, holder='capillary_1mm') + h.invoke('chamber.set_door', open=False) + if vac: + h.invoke('vacuum.set_pump', on=True) + h.step(220.0) + h.invoke('stage.auto_align') + h.step(rt.ALIGN_S + 4.0) + return acquire(h, 600.0) + f = {} + for vac in (True, False): + h = ready(seed=24) + liquid(h, 'w') + rw = measure(h, 'w', vac) + re_ = measure(h, None, vac) + f[vac] = h.invoke('calibration.absolute', record_id=rw, background_record_id=re_, standard='water', thickness_m=1e-3)['factor'] + self.assertAlmostEqual(f[False] / f[True], 1.0, delta=0.05) + + def test_f06_primary_normalisation_does_not_depend_on_the_zero_calibration(self): + h = ready(seed=1) + load(h, None) + r_empty = acquire(h, 300.0) + liquid(h, 'w') + load(h, 'w') + r_w = acquire(h, 300.0) + before = h.invoke('calibration.absolute', record_id=r_w, background_record_id=r_empty, standard='water', thickness_m=1e-3)['factor'] + h.invoke('calibration.zero_angle', record_id=r_empty) + after = h.invoke('calibration.absolute', record_id=r_w, background_record_id=r_empty, standard='water', thickness_m=1e-3)['factor'] + self.assertAlmostEqual(after / before, 1.0, delta=0.02) + + def test_f07_overexposure_during_an_exposure_fails_the_acquisition(self): + h = ready(seed=25) + liquid(h, 'w') + load(h, 'w') + op = h.invoke('acquisition.start', exposure_s=300.0, frames=1)['operation_id'] + h.step(10.0) + h.invoke('fault.inject', fault='beamstop_misaligned', active=True) + rid = h.operations[op]['record_id'] + self.assertEqual(h.records[rid]['status'], 'failed') + self.assertEqual(h.records[rid]['error_code'], 'DETECTOR_OVEREXPOSURE') + self.assertFalse(h.read('evaluator')['shutter.open']) + + def test_f08_model_spheres_carry_over_one_percent(self): + h = ready(seed=26) + sph = dict(radius_m=10e-9, rel_sigma=0.1, volume_fraction=0.01, material='silica', matrix='water') + h.invoke('sample.provide', sample_id='sph', form='dispersion', solvent='water', volume_m3=200e-9, thickness_m=None, + components=[dict(template_id='model_spheres', concentration_kg_m3=None, model_parameters=sph)]) + liquid(h, 'buf', volume=200e-9) + h.invoke('asx.set_door', open=True) + h.invoke('asx.load_well', sample_id='sph', well='AA01', volume_m3=100e-9) + h.invoke('asx.load_well', sample_id='buf', well='AA02', volume_m3=100e-9) + h.invoke('asx.set_door', open=False) + for well in ('AA01', 'AA02'): + h.invoke('asx.inject', well=well) + h.step(60.0) + comps = [c for c in h.flow_cell['components'] if c['kind'] == 'model_spheres'] + self.assertEqual(len(comps), 1) + self.assertAlmostEqual(comps[0]['parameters']['volume_fraction'], 0.01 * rt.ASX_CARRY_OVER, delta=1e-12) + + def test_f09_stage_mount_on_step_effects_are_declared(self): + h = ready(seed=27) + h.invoke('chamber.set_door', open=True) + h.invoke('stage.mount', stage_type='tcstage_extended') + h.invoke('stage.set_temperature', temperature_k=773.15) + a, b = copy.deepcopy(h), copy.deepcopy(h) + a.invoke('stage.mount', stage_type='tcstage_peltier') + a.step(1500.0) + b.step(1500.0) + va, vb = a.read('evaluator'), b.read('evaluator') + changed = {k for k in ('truth.stage_temperature_k', 'stage.temperature_indicated_k') if va[k] != vb[k]} + self.assertEqual(changed, {'truth.stage_temperature_k', 'stage.temperature_indicated_k'}) + self.assertLessEqual(changed, set(rt.ON_STEP['stage.mount'])) + + def test_f13_emergency_stop_pressed_unpowered_needs_standby(self): + h = configured(seed=28) + h.invoke('generator.emergency_stop') + h.invoke('power.set', enabled=True) + h.step(61.0) + h.invoke('generator.set_key', on=True) + h.invoke('generator.release_emergency_stop') + self.assertTrue(rejected(h, 'generator.xray_on', 'GENERATOR_FAULT')) + h.invoke('generator.acknowledge') + h.invoke('generator.xray_on') + + def test_f14_zero_angle_from_silver_behenate_is_unbiased(self): + h = ready(seed=29) + solid(h, 'agbe', 'silver_behenate', 1e-3, form='powder') + load(h, 'agbe', holder='paste_cell') + z = h.invoke('calibration.zero_angle', record_id=acquire(h, 60.0))['zero_m'] + self.assertLess(abs(z - h.zero_true), 3e-6) + + def test_f17_point_collimation_desmear_and_molecular_weight(self): + h = ready(seed=30) + h.invoke('collimation.set_mode', mode='point') + liquid(h, 'bsa', [(BSA, 5.0)]) + liquid(h, 'buf') + load(h, 'bsa') + rs = acquire(h, 1800.0) + load(h, 'buf') + rb = acquire(h, 1800.0) + liquid(h, 'water_std') + load(h, 'water_std') + rw = acquire(h, 1800.0) + load(h, None) + re_ = acquire(h, 1800.0) + cal = h.invoke('calibration.absolute', record_id=rw, background_record_id=re_, standard='water', thickness_m=1e-3)['calibration_id'] + smeared = h.invoke('data.reduce', record_id=rs, background_record_id=rb, calibration_id=cal, thickness_m=1e-3, desmear=False) + self.assertTrue(rejected(h, 'analysis.molecular_weight', 'DESMEAR_REQUIRED', reduced_id=smeared['reduced_id'], concentration_kg_m3=5.0, + drho_m_m_kg=rt.DRHO_M_PROTEIN_M_KG)) + red = h.invoke('data.reduce', record_id=rs, background_record_id=rb, calibration_id=cal, thickness_m=1e-3, desmear=True) + mw = h.invoke('analysis.molecular_weight', reduced_id=red['reduced_id'], concentration_kg_m3=5.0, drho_m_m_kg=rt.DRHO_M_PROTEIN_M_KG) + m_template = rt.template(BSA)['abs_scale']['mass_da'] / 1000.0 + self.assertAlmostEqual(mw['molecular_weight_kg_mol'] / m_template, 1.0, delta=0.12) + + def test_f18_truefocus_finds_the_empty_flow_cell(self): + h = ready(seed=31) + h.invoke('stage.select_position', position='flow_cell') + h.step(10.0) + op = h.invoke('stage.auto_align')['operation_id'] + h.step(rt.ALIGN_S + 4.0) + self.assertEqual(h.operations[op]['phase'], 'completed') + self.assertIsNone(h.operations[op].get('reason')) + self.assertAlmostEqual(h.stage['y'], rt.FLOW_CELL_Y_M + h.fc_offset, delta=3e-5) + + def test_f19_room_temperature_change_is_not_cache_dependent(self): + h = ready(seed=32) + load(h, None) + h.invoke('vacuum.set_pump', on=False) + h.step(80.0) + h.invoke('acquisition.start', exposure_s=60.0, frames=1) + h.step(20.0) + a, b = copy.deepcopy(h), copy.deepcopy(h) + for x in (a, b): + x.invoke('plant.configure', room_k=305.15, mains_voltage_v=230.0, noise_seed=1) + b.invoke('fault.inject', fault='chiller_failure', active=False) # a no-op call that used to clear the rate cache + a.step(45.0) + b.step(45.0) + self.assertEqual(a.records['sx-1']['segments'][0]['counts'], b.records['sx-1']['segments'][0]['counts']) + + + +class ReviewRound2Regressions(unittest.TestCase): + """Regression tests for the second independent runtime review (F20-F22).""" + + def _spheres_solid(self, h, sid, radius, phi, thick): + h.invoke('sample.provide', sample_id=sid, form='solid', solvent='none', volume_m3=0.0, thickness_m=thick, + components=[dict(template_id='model_spheres', concentration_kg_m3=None, + model_parameters=dict(radius_m=radius, rel_sigma=0.1, volume_fraction=phi, material='silica', matrix='polystyrene'))]) + + def test_f20_primary_peak_is_found_or_refused_never_misplaced(self): + for seed, radius, phi, thick in ((51, 50e-9, 0.02, 1e-3), (52, 10e-9, 0.3, 2e-3)): + h = ready(seed=seed) + self._spheres_solid(h, 's', radius, phi, thick) + load(h, 's', holder='solid_holder') + rid = acquire(h, 30.0) + pc = h.records[rid]['primary_beam_counts'] + g = h._geometry() + expected = h._flux() * g['t_total'] * rt.detector_efficiency() * rt.STRIP_LENGTH_M / rt.LINE_LENGTH_M * rt.BEAMSTOP_T * 30.0 + self.assertIsNotNone(pc) # the attenuated peak is beam-shaped even when weaker than the scattering outside + self.assertAlmostEqual(pc / expected, 1.0, delta=0.05) + z = h.invoke('calibration.zero_angle', record_id=rid)['zero_m'] + self.assertLess(abs(z - h.zero_true), 10e-6) + + def test_f20_ordinary_samples_keep_their_primary_beam(self): + h = ready(seed=54) + solid(h, 'gc', GC, 1.055e-3) + load(h, 'gc', holder='solid_holder') + rid = acquire(h, 60.0) + self.assertIsNotNone(h.records[rid]['primary_beam_counts']) + z = h.invoke('calibration.zero_angle', record_id=rid)['zero_m'] + self.assertLess(abs(z - h.zero_true), 5e-6) + + def test_f23_zero_beyond_three_sigma_is_still_found(self): + """Instruments whose true zero lies 0.15-0.21 mm from nominal (seeds 1377 and 129 of the review) still find their primary beam before + the first zero calibration, and after it the normalisation uses the calibrated zero.""" + for seed in (1377, 129): + h = ready(seed=seed) + self.assertGreater(abs(h.zero_true), 0.14e-3) + empty_beam(h) + rid = acquire(h, 60.0) + self.assertIsNotNone(h.records[rid]['primary_beam_counts']) + z = h.invoke('calibration.zero_angle', record_id=rid)['zero_m'] + self.assertLess(abs(z - h.zero_true), 5e-6) + h.invoke('data.reduce', record_id=rid, background_record_id=None, calibration_id=None, thickness_m=1e-3, desmear=False) + + def test_f24_far_zero_with_steep_scatterers(self): + """Far-zero instruments before the zero calibration with steeply scattering solids (review round 4): the attenuated primary, not a scatter + maximum near the hint, is found.""" + for seed, radius, phi in ((129, 100e-9, 0.003), (129, 80e-9, 0.01), (1377, 100e-9, 0.003)): + h = ready(seed=seed) + self._spheres_solid(h, 's', radius, phi, 1e-3) + load(h, 's', holder='solid_holder') + rid = acquire(h, 30.0) + g = h._geometry() + expected = h._flux() * g['t_total'] * rt.detector_efficiency() * rt.STRIP_LENGTH_M / rt.LINE_LENGTH_M * rt.BEAMSTOP_T * 30.0 + self.assertAlmostEqual(h.records[rid]['primary_beam_counts'] / expected, 1.0, delta=0.05) + z = h.invoke('calibration.zero_angle', record_id=rid)['zero_m'] + self.assertLess(abs(z - h.zero_true), 5e-6) + + def test_f21_alignment_is_protected_against_overexposure(self): + h = ready(seed=53) + liquid(h, 'l', [(LYS, 5.0)]) + load(h, 'l', align=False) + h.invoke('fault.inject', fault='beamstop_misaligned', active=True) + op = h.invoke('stage.auto_align')['operation_id'] + h.step(2.0) + self.assertEqual(h.operations[op]['phase'], 'failed') + self.assertEqual(h.operations[op]['reason'], 'DETECTOR_OVEREXPOSURE') + self.assertFalse(h.read('evaluator')['shutter.open']) + + def test_f22_model_spheres_leave_the_rinse_residue(self): + h = ready(seed=55) + h.invoke('sample.provide', sample_id='sph', form='dispersion', solvent='water', volume_m3=200e-9, thickness_m=None, + components=[dict(template_id='model_spheres', concentration_kg_m3=None, + model_parameters=dict(radius_m=10e-9, rel_sigma=0.1, volume_fraction=0.01, material='silica', matrix='water'))]) + liquid(h, 'buf', volume=200e-9) + h.invoke('asx.set_door', open=True) + h.invoke('asx.load_well', sample_id='sph', well='AA01', volume_m3=50e-9) + h.invoke('asx.load_well', sample_id='buf', well='AA02', volume_m3=50e-9) + h.invoke('asx.set_door', open=False) + h.invoke('asx.inject', well='AA01') + h.step(60.0) + h.invoke('asx.clean') + h.step(130.0) + h.invoke('asx.inject', well='AA02') + h.step(60.0) + comps = [c for c in h.flow_cell['components'] if c['kind'] == 'model_spheres'] + self.assertEqual(len(comps), 1) + self.assertAlmostEqual(comps[0]['parameters']['volume_fraction'], 0.01 * rt.ASX_CARRY_OVER_CLEAN, delta=1e-15) + + +class DeclaredEffects(unittest.TestCase): + def test_on_step_effects_cover_what_the_process_changes(self): + """For every capability accepted in any scenario state: the slots it changes at once are declared effects, the slots whose change during the + following step differs from an identical run without the call are declared on_step effects, and the step itself only changes slots declared + as on_step effects of sim.step (noise-free and noisy runs; both runs draw identical noise during the step).""" + missing_imm, missing_step = {}, {} + states = {n: _scenario(n) for n in SCENARIOS} + for noisy in (False, True): + for n, S in states.items(): + for i, name in enumerate(RNGS): + setattr(S, name, random.Random(7 + i) if noisy else QuietRng()) + for cap in rt.CAPS: + if cap in rt.UNSUPPORTED or rt.CAPS[cap]['kind'] in ('query', 'analysis'): + continue + for sname, S in states.items(): + for args in _variants(cap): + A = copy.deepcopy(S) + v0 = A.read('evaluator') + try: + _orig_invoke(A, cap, **args) + except rt.ActionRejected: + continue + v1 = A.read('evaluator') + if cap == 'sim.step': + for k in v0: + if _changed(v0[k], v1[k]) and k not in rt.ON_STEP['sim.step'] + rt.EFFECTS['sim.step']: + missing_step.setdefault('sim.step', set()).add(k) + continue + for k in v0: + if json.dumps(v0[k], sort_keys=True, default=str) != json.dumps(v1[k], sort_keys=True, default=str) and _changed(v0[k], v1[k]) \ + and k not in rt.EFFECTS[cap]: + missing_imm.setdefault(cap, set()).add(k) + for dt in STEP_DTS: + A2, B2 = copy.deepcopy(A), copy.deepcopy(S) + for name in RNGS: + setattr(A2, name, copy.deepcopy(getattr(B2, name))) + A2.step(dt) + B2.step(dt) + a2, b2 = A2.read('evaluator'), B2.read('evaluator') + for k in v0: + if k not in rt.ON_STEP.get(cap, []) and _step_differs(v1[k], a2[k], v0[k], b2[k]): + missing_step.setdefault(cap, set()).add(k) + if k not in rt.ON_STEP['sim.step'] + ['clock.time_s'] and _changed(v0[k], b2[k]): + missing_step.setdefault('sim.step', set()).add(k) + self.assertEqual(missing_imm, {}) + self.assertEqual(missing_step, {}) + self.assertFalse([s for v in rt.ON_STEP.values() for s in v if rt.SLOTS[s]['origin'] == 'setpoint']) + + def test_units_and_sampling(self): + meta = _meta() + si = {'1', 's', 'm', 'rad', 'Pa', 'V', 'A', 'K', 'J', 'W', 'kg', 'm^3', '1/s', 'Pa*m^3/s', 'm^3/s', 'm/s', 'V/s', 'A/s', 'K/s', 'rad/s', '1/m', 'kg/m^3', + 'kg/mol', 'm^2/kg', 'm/kg', '1/sr'} + units = {v['unit'] for v in meta['state_slots'].values()} + for mech in meta['mechanisms'].values(): + units |= {p_['unit'] for p_ in mech['parameters'].values()} + self.assertEqual(units - si, set(), units - si) + h = ready() + h.register_principal('e', 'evaluator') + h.invoke('detector.move_arm', angle_rad=0.3) + h.step(0.5) + obs = h.session('e').read(instance_id=h.instance_id)['observations'] + self.assertIsNone(obs['detector.arm_indicated_rad']['sample_window_s']) + self.assertGreater(obs['detector.arm_indicated_rad']['value'], 0.0) + self.assertEqual(obs['vacuum.pressure_indicated_pa']['sample_window_s'], rt.CYCLE_S) + g0 = h.read()['vacuum.pressure_indicated_pa'] + h.step(0.2) + self.assertEqual(h.read()['vacuum.pressure_indicated_pa'], g0) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_asset_antonpaar_trb.py b/tests/test_asset_antonpaar_trb.py new file mode 100644 index 0000000000000000000000000000000000000000..a4a2b582c6a8049f5f739d8a8b7c5b606d2a0ec1 --- /dev/null +++ b/tests/test_asset_antonpaar_trb.py @@ -0,0 +1,168 @@ +"""CHEM128 real-pair finite tribology and protocol regression tests.""" +import copy,hashlib,importlib.util,json,math,sys,unittest +from pathlib import Path +from unittest import mock +import numpy as np +ROOT=Path(__file__).resolve().parents[1];sys.path.insert(0,str(ROOT/'scripts')) +from asset_runtime import antonpaar_trb as rt +OBSERVED=[];STATES=[] +def canonical(v): + if isinstance(v,dict):return {str(k):canonical(x) for k,x in v.items()} + if isinstance(v,(list,tuple)):return [canonical(x) for x in v] + if isinstance(v,np.ndarray):return v.tolist() + return v +def state(h):return json.dumps(canonical(h.__dict__),sort_keys=True,allow_nan=False) +def call(h,k,**a): + before=h.read();r=h.invoke(k,**a);after=h.read();OBSERVED.append((k,copy.deepcopy(a),copy.deepcopy(r)));STATES.append(after) + changed={x for x in before if before[x]!=after[x]};declared=set(rt.CAPS[k]['effects']) + if not changed<=declared:raise AssertionError((k,'undeclared changed state',changed-declared)) + return r +def setup(name='trb_test',plant=None,sample=None,pin=None,drive=None,method=None,lubricant=None,load=10.,radius=.01): + h=rt.AntonpaarTrbRuntime(name) + for k,a in [('plant.configure',dict(rt.PLANT_EXAMPLE,**(plant or {}))),('specimen.load',dict(rt.SAMPLE_EXAMPLE,**(sample or {}))),('pin.load',dict(rt.PIN_EXAMPLE,**(pin or {}))),('normal_load.set',{'force_n':load}),('radius.set',{'radius_m':radius}),('drive.configure',dict(rt.DRIVE_EXAMPLE,**(drive or {})))]:call(h,k,**a) + if lubricant is not None:call(h,'lubricant.load',**dict(rt.LUBRICANT_EXAMPLE,**lubricant)) + call(h,'power.set',enabled=True);call(h,'sensor.zero');call(h,'contact.set',engaged=True);call(h,'lid.set',opened=False);call(h,'method.configure',**dict(dict(rt.METHOD_EXAMPLE,duration_s=2.),**(method or {})));return h +def run(h,seconds=None): + call(h,'acquisition.start');h.step(h.method['duration_s'] if seconds is None else seconds);return call(h,'acquisition.result') +def access(h): + if h.phase=='running':call(h,'acquisition.stop') + call(h,'lid.set',opened=True);call(h,'contact.set',engaged=False) +def cleanup(h): + access(h) + for k in ['specimen','pin','lubricant']: + if getattr(h,k) is not None:call(h,k+'.remove') + call(h,'debris.collect');call(h,'power.set',enabled=False) +class TestTRB(unittest.TestCase): + def rejected(self,h,k,error='.',**a): + before=state(h) + with self.assertRaisesRegex(rt.ActionRejected,error):h.invoke(k,**a) + self.assertEqual(before,state(h)) + def ledger(self,h): + l=call(h,'ledger.read') + for k in ['specimen_error_kg','pin_error_kg','lubricant_error_kg']:self.assertLess(abs(l[k]),1e-13,k) + self.assertLess(abs(l['thermal_error_j']),1e-7);return l + def test_01_real_pair_sources_and_integrated_work(self): + energies=[] + for rid in ['cr100_leadbronze_dry_003','cr100_leadbronze_dry_005']: + h=setup(sample={'reference_id':rid});original=copy.deepcopy(h.reference);r=run(h);self.assertEqual(r['phase'],'succeeded');self.assertEqual(len(r['rows']),21);self.assertAlmostEqual(r['sliding_distance_m'],.2);x=np.array(original['values']['sliding_distance_m']);y=np.array(original['values']['friction_coefficient']);q=np.r_[0,x[(x>0)&(x<.2)],.2];expected=10*np.trapz(np.interp(q,x,y),q);self.assertAlmostEqual(h.friction_energy,expected,places=10);self.assertEqual(original,h.reference);self.assertEqual(len(x),5002);self.assertEqual(original['conditions']['normal_force_n'],10);self.assertAlmostEqual(original['conditions']['counterbody_radius_m'],.00476);energies.append(h.friction_energy);self.ledger(h) + self.assertNotEqual(*energies) + def test_02_high_speed_rotary_full_turns_not_endpoint_alias(self): + h=setup(drive={'angular_speed_rad_s':rt.OMEGA_MAX},method={'duration_s':.3});r=run(h);self.assertAlmostEqual(r['sliding_distance_m'],2*math.pi*.01*10,places=11);self.assertAlmostEqual(h.disk_angle,0.,places=9);self.assertGreater(h.friction_energy,0) + def test_03_linear_10hz_reversals_have_nonzero_distance(self): + h=setup(drive={'mode':'linear','frequency_hz':10.,'stroke_m':.01},method={'duration_s':.3});r=run(h);self.assertAlmostEqual(r['sliding_distance_m'],.06,places=11);self.assertAlmostEqual(h.linear_position,0.,places=10);self.assertGreater(h.friction_energy,0);self.ledger(h) + def test_04_angular_reciprocal_signed_force_and_path(self): + h=setup(drive={'mode':'angular','frequency_hz':1.,'angular_amplitude_rad':.5},method={'duration_s':1.});r=run(h);self.assertAlmostEqual(r['sliding_distance_m'],.02,places=11);self.assertLess(min(x['friction_force_n'] for x in r['rows'] if x['friction_force_n'] is not None),0);self.assertGreater(min(x['friction_coefficient'] for x in r['rows'] if x['friction_coefficient'] is not None),0);self.ledger(h) + def test_05_exact_turning_point_zero_speed_no_fake_mu(self): + h=setup(drive={'mode':'linear','frequency_hz':2.5,'stroke_m':.01});call(h,'acquisition.start');h.step(.1);self.assertAlmostEqual(h.signed_speed,0.,places=10);self.assertIsNone(h.read()['friction.coefficient']);self.assertEqual(h.read()['friction.unavailable_reason'],'REVERSAL_ZERO_SPEED') + def test_06_combined_limits_and_atomic_reject(self): + h=setup();access(h) + for args,error in [(dict(rt.DRIVE_EXAMPLE,mode='linear',frequency_hz=10.,stroke_m=.06),'LINEAR_SPEED_RANGE'),(dict(rt.DRIVE_EXAMPLE,mode='angular',frequency_hz=8.),'ANGULAR_COMBINATION_RANGE'),(dict(rt.DRIVE_EXAMPLE,mode='angular',frequency_hz=.01,angular_amplitude_rad=math.pi/36),'ANGULAR_COMBINATION_RANGE')]:self.rejected(h,'drive.configure',error,**args) + self.rejected(h,'normal_load.set',force_n=60.0001);self.rejected(h,'radius.set',radius_m=.040001);self.rejected(h,'drive.configure',**dict(rt.DRIVE_EXAMPLE,angular_speed_rad_s=rt.OMEGA_MAX+1)) + def test_07_deadweight_manual_access_and_actual_force_limit(self): + h=setup();self.rejected(h,'normal_load.set','ARM_LOADED',force_n=5.);call(h,'acquisition.start');self.rejected(h,'contact.set','BUSY',engaged=False);self.rejected(h,'normal_load.set','BUSY',force_n=5.);access(h);call(h,'normal_load.set',force_n=4.);self.assertEqual(h._normal_true(),0.);call(h,'contact.set',engaged=True);self.assertEqual(h._normal_true(),4.) + h=setup(plant={'normal_force_factor':2.});access(h);self.rejected(h,'normal_load.set','NORMAL_FORCE_RANGE',force_n=31.) + def test_08_torque_start_and_first_crossing_terminal(self): + h=setup(load=60.,radius=.04,method={'source_start_distance_m':2.});self.rejected(h,'acquisition.start','DRIVE_FORCE_RANGE') + h=setup(radius=.04);h.ref_x=np.array([0.,.1,1.]);h.ref_mu=np.array([.1,2.,2.]);r=run(h);self.assertEqual(r['phase'],'failed');self.assertEqual(r['error_code'],'DRIVE_FORCE_RANGE');self.assertAlmostEqual(r['sliding_distance_m'],(.45/(10*.04)-.1)/1.9*.1,places=11);self.assertGreater(r['elapsed_s'],0);self.assertEqual(r['rows'][-1]['elapsed_s'],r['elapsed_s']);self.ledger(h) + def test_09_source_endpoint_finite_and_no_extrapolation(self): + h=setup(method={'source_start_distance_m':500.});r=run(h);self.assertEqual(r['phase'],'failed');self.assertEqual(r['error_code'],'REFERENCE_DISTANCE_RANGE');self.assertAlmostEqual(r['sliding_distance_m'],.009,places=9);self.rejected(h,'acquisition.start','REFERENCE_DISTANCE_RANGE');self.ledger(h) + def test_10_origin_history_survives_restart_and_method(self): + h=setup();run(h);distance=h.sample_distance;call(h,'method.configure',**dict(h.method,duration_s=.5));run(h);self.assertAlmostEqual(h.sample_distance,distance+.05);self.rejected(h,'method.configure','SOURCE_ORIGIN_LOCKED',**dict(h.method,source_start_distance_m=1.)) + def test_11_finite_both_wear_inventories_and_recovery(self): + h=setup();run(h);l=self.ledger(h);self.assertAlmostEqual(l['specimen_wear_volume_m3'],1e-5*10*.2/2e9,places=20);self.assertAlmostEqual(l['pin_wear_volume_m3'],1e-6*10*.2/4e9,places=20);self.assertGreater(l['specimen_debris_kg'],0);cleanup(h);l=self.ledger(h);self.assertEqual(l['specimen_remaining_kg'],0);self.assertEqual(l['pin_remaining_kg'],0);self.assertEqual(l['specimen_debris_kg'],0);self.assertGreater(l['specimen_debris_recovered_kg'],0) + def test_12_extremely_small_specimen_and_pin_stop(self): + for item,label in [('sample','SPECIMEN_EXHAUSTED'),('pin','PIN_EXHAUSTED')]: + h=setup(**{item:{'volume_m3':1e-15,'hardness_pa':1e3,'archard_coefficient':.1}});r=run(h);self.assertEqual(r['phase'],'failed');self.assertEqual(r['error_code'],label);self.assertLess(r['elapsed_s'],1e-9);self.assertLessEqual(getattr(h,'specimen_volume' if item=='sample' else 'pin_volume'),1e-28);self.ledger(h) + def test_13_finite_lubricant_preserves_catch_inventory(self): + h=setup(lubricant={'volume_m3':1e-12,'loss_per_distance_m2':1e-6});r=run(h);self.assertEqual(r['error_code'],'LUBRICANT_EXHAUSTED');self.assertAlmostEqual(r['sliding_distance_m'],1e-6,places=15);self.assertLess(h.lubricant_volume,1e-24);l=self.ledger(h);self.assertAlmostEqual(l['lubricant_loaded_kg'],l['lubricant_dragout_kg'],places=18);cleanup(h);self.ledger(h) + def test_14_differential_common_mode_rejection(self): + a=setup();b=setup(plant={'common_drift_n_s':.7,'thermal_common_drift_n_k':.4});run(a);run(b);self.assertGreater(abs(a.left-b.left),1.);self.assertAlmostEqual(a.observed_work,b.observed_work,places=11) + for x,y in zip(a.rows,b.rows): + if x['friction_force_n'] is not None:self.assertAlmostEqual(x['friction_force_n'],y['friction_force_n'],places=11) + def test_15_observed_load_and_sensor_gain_not_true_mu(self): + h=setup(plant={'normal_read_gain':2.,'friction_gain_left':1.5,'friction_gain_right':1.5});call(h,'acquisition.start');h.step(1.);s=h.read();self.assertAlmostEqual(s['friction.coefficient'],abs(s['friction.indicated_n'])/20.);self.assertNotAlmostEqual(s['friction.coefficient'],h._mu(),places=4);self.assertEqual(s['truth.normal_force_n'],10.) + def test_16_low_load_and_sensor_overrange_are_unavailable(self): + h=setup(load=.001);call(h,'acquisition.start');h.step(.1);self.assertIsNone(h.read()['friction.coefficient']);self.assertEqual(h.read()['friction.unavailable_reason'],'LOW_LOAD') + h=setup(plant={'friction_gain_left':100.,'friction_gain_right':100.});r=run(h);self.assertEqual(r['error_code'],'FRICTION_SENSOR_OVER_RANGE');self.assertIsNone(r['rows'][-1]['friction_force_n']);self.assertGreater(h.friction_energy,0);self.ledger(h) + def test_17_external_calibration_zero_and_optional_wear(self): + h=setup(plant={'friction_offset_left_n':.5,'wear_sensor_enabled':True,'temperature_sensor_offset_k':2.});access(h);h.step(.1);call(h,'sensor.zero');self.assertAlmostEqual(h.calibration['friction_zero_n'],.5);cal=dict(rt.CAPS['sensor.calibrate']['example_arguments'],temperature_zero_k=2.,friction_zero_n=.5);call(h,'sensor.calibrate',**cal);call(h,'contact.set',engaged=True);call(h,'lid.set',opened=False);run(h);self.assertGreater(h.rows[-1]['wear_depth_m'],0);self.assertAlmostEqual(h.rows[-1]['temperature_k'],h.temperature);self.assertIsNone(setup().read()['wear.indicated_m']) + def test_18_stiff_optional_heater_exact_and_finite(self): + h=setup(plant={'thermal_capacity_j_k':.01,'heater_installed':True,'heater_max_w':1000.,'heater_gain_w_k':1e6});call(h,'thermal.set_temperature',temperature_k=303.15);self.assertEqual(h.temperature,296.15);h.step(1.);expected=(1e6*303.15+296.15)/(1e6+1);self.assertAlmostEqual(h.temperature,expected,places=8);self.assertLess(h.temperature,303.15);self.ledger(h) + def test_19_friction_heat_adiabatic_energy_and_passive_cooling(self): + h=setup(plant={'heat_loss_w_k':0.});run(h);self.assertAlmostEqual(h.temperature,296.15+h.friction_energy/100.,places=9);self.assertEqual(h.heater_energy,0);self.ledger(h) + h=setup(plant={'thermal_capacity_j_k':10.});run(h);start=h.temperature;call(h,'power.set',enabled=False);h.step(3.);self.assertAlmostEqual(h.temperature,296.15+(start-296.15)*math.exp(-.3),places=10);self.ledger(h) + def test_20_thermal_permissions_and_liquid_limits_atomic(self): + h=setup();self.rejected(h,'thermal.set_temperature','HEATER_NOT_INSTALLED',temperature_k=300.);self.rejected(h,'thermal.set_temperature','NO_ACTIVE_COOLING',temperature_k=295.) + h=setup(plant={'heater_installed':True,'heater_max_w':100.,'temperature_max_k':723.15},lubricant={});self.rejected(h,'thermal.set_temperature','LIQUID_TEMPERATURE_RANGE',temperature_k=423.16) + def test_21_hot_access_and_temperature_terminal_preserve_work(self): + h=setup(plant={'thermal_capacity_j_k':.01,'heat_loss_w_k':0.,'temperature_max_k':296.16,'safe_access_temperature_k':296.151});r=run(h);self.assertEqual(r['error_code'],'THERMAL_MODEL_RANGE');self.assertGreater(h.temperature,296.16);self.assertGreater(h.friction_energy,0);access(h);self.rejected(h,'specimen.remove','HOT_SPECIMEN');self.ledger(h) + def test_22_profile_loss_pileup_net_and_radial_weight(self): + h=setup();a=dict(rt.CAPS['analysis.wear_profile']['example_arguments'],geometry='linear',x_m=[0.,.001,.002],height_m=[.0001,0.,-.0001],track_length_m=.01);r=call(h,'analysis.wear_profile',**a);self.assertAlmostEqual(r['loss_volume_m3'],5e-10,places=18);self.assertAlmostEqual(r['pileup_volume_m3'],5e-10,places=18);self.assertAlmostEqual(r['net_volume_m3'],0.,places=18) + a.update(geometry='circular');r=call(h,'analysis.wear_profile',**a);self.assertGreater(r['net_volume_m3'],0.);self.assertAlmostEqual(r['net_volume_m3'],2*math.pi*(.002**3/(12)*.1),places=18);self.rejected(h,'analysis.wear_profile','MODEL_NOT_ACCEPTED',**dict(a,accept_uniform_profile=False));self.rejected(h,'analysis.wear_profile','PROFILE_GRID',**dict(a,x_m=[0.,0.,.002])) + def test_23_hertz_force_contact_and_pressure_integral(self): + h=setup();a=rt.CAPS['analysis.hertz']['example_arguments'];r=call(h,'analysis.hertz',**a);radius=r['contact_radius_m'];self.assertAlmostEqual(4*r['effective_modulus_pa']*radius**3/(3*a['radius_m']),a['normal_force_n'],places=11);self.assertAlmostEqual(2*math.pi*r['peak_pressure_pa']*radius**2/3,a['normal_force_n'],places=11);self.rejected(h,'analysis.hertz','MODEL_NOT_ACCEPTED',**dict(a,accept_elastic_homogeneous=False));self.rejected(h,'analysis.hertz','HERTZ_MODEL_DOMAIN',**dict(a,young_sample_pa=1e5,young_pin_pa=1e5,radius_m=1e-5)) + def test_24_noquerytime_owner_result_and_freeze(self): + h=setup();s=h.session();op=s.invoke(instance_id=h.instance_id,capability_id='acquisition.start',arguments={},request_id='s')['operation_id'];h.step(.4);before=state(h);h.read();h.describe();call(h,'reference.query',reference_id=rt.SAMPLE_EXAMPLE['reference_id']);call(h,'ledger.read');s.read(instance_id=h.instance_id);s.poll(op);self.assertEqual(state(h),before);q=s.invoke(instance_id=h.instance_id,capability_id='acquisition.result',arguments={},request_id='r');self.assertIsNone(q['operation_id']);self.assertEqual(h._owners[op],'agent');s.cancel(op,'cancel');frozen=s.poll(op);mass=h.specimen_volume;h.step(1.);self.assertEqual(mass,h.specimen_volume);cleanup(h);self.assertEqual(s.poll(op),frozen) + def test_25_owner_poll_result_cancel_and_idempotence(self): + h=setup();h.register_principal('other');a=h.session();b=h.session('other');args=dict(instance_id=h.instance_id,capability_id='acquisition.start',arguments={},request_id='one');r=a.invoke(**args);self.assertEqual(r,a.invoke(**args));op=r['operation_id'];self.assertEqual(h._counter,1) + for k in ['acquisition.result','acquisition.stop']:self.assertEqual(b.invoke(instance_id=h.instance_id,capability_id=k,arguments={},request_id=k)['error']['code'],'ACCESS_DENIED') + for method in [lambda:b.poll(op),lambda:b.cancel(op,'bad')]: + with self.assertRaises(rt.ActionRejected):method() + self.assertEqual(a.invoke(**dict(args,capability_id='acquisition.result'))['error']['code'],'REQUEST_CONFLICT');self.assertEqual(a.cancel(op,'cancel')['status'],'succeeded');self.assertEqual(a.cancel(op,'cancel')['status'],'succeeded') + def test_26_truth_recovery_and_simclock_permissions(self): + h=setup();s=h.session();d=s.describe(instance_id=h.instance_id);self.assertFalse(any(k.startswith('truth.') for k in d['state_slots']));self.assertFalse(any(k.startswith('truth.') for k in s.read(instance_id=h.instance_id)['observations'])) + for k in ['plant.configure','specimen.load','specimen.remove','pin.load','pin.remove','lubricant.load','lubricant.remove','debris.collect','ledger.read','sim.step']: + before=state(h);r=s.invoke(instance_id=h.instance_id,capability_id=k,arguments=rt.CAPS[k]['example_arguments'],request_id=k);self.assertEqual(r['error']['code'],'ACCESS_DENIED');self.assertEqual(state(h),before) + with self.assertRaises(rt.ActionRejected):s.read(instance_id=h.instance_id,state_ids=['truth.specimen_volume_m3']) + run(h);text=json.dumps(h._result());self.assertNotIn('hardness_pa',text);self.assertNotIn('archard_coefficient',text);self.assertNotIn('specimen_volume_m3',text) + def test_27_two_instances_fixed_host_partition(self): + a=setup(name='same');b=setup(name='same');call(a,'acquisition.start');call(b,'acquisition.start');a.step(1.) + for _ in range(100):b.step(.01) + self.assertEqual(a.read(),b.read());self.assertEqual(a.rows,b.rows);before=state(b);a.step(.1);self.assertEqual(before,state(b));before=state(a);a.step(0.);self.assertEqual(before,state(a)) + def test_28_emergency_and_manual_home_after_cancel(self): + h=setup(drive={'mode':'linear','frequency_hz':1.});call(h,'acquisition.start');h.step(.1);pos=h.linear_position;call(h,'emergency.stop');self.assertEqual(h.phase,'failed');frozen=h._result();h.step(1.);self.assertEqual(pos,h.linear_position);self.assertEqual(frozen,h._result());call(h,'emergency.reset');self.rejected(h,'acquisition.start','HOME_REQUIRED');access(h);call(h,'motion.home');self.assertEqual(h.linear_position,pos);h.step(.1);self.assertLess(abs(h.linear_position),abs(pos));h.step(.2);self.assertFalse(h.homing);call(h,'contact.set',engaged=True);call(h,'lid.set',opened=False);run(h) + def test_29_strict_source_conditions_and_reference_eligibility(self): + h=setup(sample={'accept_condition_transfer':False});run(h);h=setup(sample={'accept_condition_transfer':False},drive={'mode':'linear'});self.rejected(h,'acquisition.start','REFERENCE_CONDITIONS') + h=setup(sample={'accept_condition_transfer':False},lubricant={});self.rejected(h,'acquisition.start','REFERENCE_LUBRICATION') + h=setup();access(h);call(h,'specimen.remove');record=next(v for v in rt.library()['substances'].values() if not v.get('runtime_usable'));self.rejected(h,'specimen.load','INVALID_REFERENCE',**dict(rt.SAMPLE_EXAMPLE,reference_id=next(k for k,v in rt.library()['substances'].items() if v==record))) + def test_30_unknown_temperature_requires_explicit_acceptance(self): + h=setup(sample={'accept_unknown_conditions':False});h.reference['conditions']['temperature_k']=None;self.rejected(h,'acquisition.start','UNKNOWN_REFERENCE_CONDITIONS') + def test_31_zero_radius_stop_distance_and_sampling(self): + h=setup(radius=0.);self.rejected(h,'acquisition.start','ZERO_TRACK_RADIUS');h=setup(method={'stop_distance_m':.012345});r=run(h);self.assertEqual(r['phase'],'succeeded');self.assertAlmostEqual(r['sliding_distance_m'],.012345,places=12);self.assertAlmostEqual(r['elapsed_s'],.12345,places=10);self.assertEqual(r['rows'][-1]['elapsed_s'],r['elapsed_s']);self.assertGreater(h.time_s,r['elapsed_s']);self.rejected(h,'method.configure','SAMPLING_GRID',**dict(h.method,sample_interval_s=.15)) + def test_32_schema_input_nonfinite_and_unsupported(self): + h=setup() + for v in [float('nan'),float('inf'),-1,True]: + before=state(h) + with self.assertRaises(rt.ActionRejected):h.step(v) + self.assertEqual(state(h),before) + for k in rt.UNSUPPORTED:self.rejected(h,k,'UNSUPPORTED') + self.rejected(h,'method.configure',**dict(rt.METHOD_EXAMPLE,bogus=1));self.rejected(h,'power.set',enabled=1) + def test_33_history_stable_on_new_sample_and_new_operation(self): + h=setup();s=h.session();op=s.invoke(instance_id=h.instance_id,capability_id='acquisition.start',arguments={},request_id='a')['operation_id'];h.step(2.);old=s.poll(op);access(h);call(h,'specimen.remove');call(h,'specimen.load',**dict(rt.SAMPLE_EXAMPLE,reference_id='cr100_leadbronze_dry_005'));call(h,'contact.set',engaged=True);call(h,'lid.set',opened=False);s.invoke(instance_id=h.instance_id,capability_id='acquisition.start',arguments={},request_id='b');h.step(.1);self.assertEqual(s.poll(op),old) + def test_34_negative_source_not_silently_made_dissipative(self): + r=copy.deepcopy(rt.library()['substances'][rt.SAMPLE_EXAMPLE['reference_id']]);r['values']['friction_coefficient'][0]=-.1 + with self.assertRaisesRegex(rt.ActionRejected,'INVALID_REFERENCE'):rt.curve(r) + def test_35_plant_initial_only_and_explicit_assumptions(self): + h=setup();self.rejected(h,'plant.configure','INITIALIZATION_ONLY',**rt.PLANT_EXAMPLE) + h=rt.AntonpaarTrbRuntime();self.rejected(h,'plant.configure','MODEL_NOT_ACCEPTED',**dict(rt.PLANT_EXAMPLE,accept_engineering=False));self.rejected(h,'plant.configure','THERMAL_CONFIGURATION',**dict(rt.PLANT_EXAMPLE,heater_max_w=10.)) + def test_35b_strict_temperature_is_checked_during_friction(self): + h=setup(plant={'thermal_capacity_j_k':.01,'heat_loss_w_k':0.},sample={'accept_condition_transfer':False},method={'temperature_tolerance_k':.01});r=run(h);self.assertEqual(r['error_code'],'REFERENCE_CONDITIONS');self.assertEqual(r['phase'],'failed');self.assertGreater(h.friction_energy,0);self.ledger(h) + def test_35c_cancel_retry_old_operation_cannot_cancel_new(self): + h=setup();s=h.session();first=s.invoke(instance_id=h.instance_id,capability_id='acquisition.start',arguments={},request_id='first')['operation_id'];h.step(.2);r=s.cancel(first,'cancel');second=s.invoke(instance_id=h.instance_id,capability_id='acquisition.start',arguments={},request_id='second')['operation_id'];before=state(h);self.assertEqual(s.cancel(first,'cancel'),r);self.assertEqual(state(h),before);self.assertEqual(h.phase,'running') + with self.assertRaisesRegex(rt.ActionRejected,'REQUEST_CONFLICT'):s.cancel(second,'cancel') + self.assertEqual(state(h),before) + def test_36_actual_all_api_outputs_and_state_schema(self): + h=setup();call(h,'sim.step',dt_s=.1);call(h,'acquisition.start');h.step(.3);call(h,'acquisition.stop');access(h);call(h,'motion.home');h.step(4.);call(h,'thermal.set_temperature',temperature_k=296.15);call(h,'sensor.calibrate',**rt.CAPS['sensor.calibrate']['example_arguments']);call(h,'reference.query',reference_id=rt.SAMPLE_EXAMPLE['reference_id']);call(h,'analysis.hertz',**rt.CAPS['analysis.hertz']['example_arguments']);call(h,'analysis.wear_profile',**rt.CAPS['analysis.wear_profile']['example_arguments']);call(h,'emergency.stop');call(h,'emergency.reset');cleanup(h) + h=setup(lubricant={});cleanup(h);call(h,'ledger.read');call(h,'acquisition.result');meta=rt.export_antonpaar_trb_contract_metadata();seen={k for k,a,r in OBSERVED};self.assertEqual(set(rt.CAPS)-set(rt.UNSUPPORTED)-seen,set()) + p=ROOT/'skills/chemistry-lab-assets/scripts/asset_tool.py';sp=importlib.util.spec_from_file_location('trb_asset_tool',p);m=importlib.util.module_from_spec(sp);sys.modules[sp.name]=m;sp.loader.exec_module(m) + for k,a,r in OBSERVED: + errors=m.validate_value(a,meta['capabilities'][k]['input_schema'],path=k+'.input')+m.validate_value(r,meta['capabilities'][k]['output_schema'],path=k+'.output');self.assertEqual(errors,[],k) + for snapshot in STATES: + self.assertEqual(set(snapshot),set(meta['state_slots'])) + for k,v in snapshot.items(): + errors=m.validate_value(v,meta['state_slots'][k]['value_schema'],path=k);self.assertEqual(errors,[],k) + for k,c in meta['capabilities'].items(): + errors=m.lint_schema(c['input_schema'],path=k+'.input')+m.lint_schema(c['output_schema'],path=k+'.output');self.assertEqual(errors,[],k) + for e in c['state_effects']:self.assertIn(e['state_id'],meta['state_slots']) + +if __name__=='__main__':unittest.main() diff --git a/tests/test_asset_bd_facsariaiii.py b/tests/test_asset_bd_facsariaiii.py new file mode 100644 index 0000000000000000000000000000000000000000..e787dac857a08dd172b49ca0e9bd7c1fbb43be37 --- /dev/null +++ b/tests/test_asset_bd_facsariaiii.py @@ -0,0 +1,1220 @@ +"""CHEM-168 BD FACSAria III cell sorter: runtime tests (python3 -m unittest tests/test_asset_bd_facsariaiii.py, matterix env).""" +import copy +import json +import math +import sys +import unittest +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / 'scripts')) +sys.path.insert(0, str(ROOT / 'skills/chemistry-lab-assets/scripts')) +from asset_runtime import bd_facsariaiii as m # noqa: E402 +import asset_tool # noqa: E402 + +rt = m +PSI = m.PSI +SEEN = set() # (capability, rejection code) pairs produced by the tests +CHECKS, PROCESS_EVIDENCE, REJECTIONS = [], {}, {} +_META = {} + + +def _meta(): + if not _META: + _META.update(m.export_bd_facsariaiii_contract_metadata()) + return _META + + +def _changed(a, b): + return json.dumps(a, sort_keys=True, default=str) != json.dumps(b, sort_keys=True, default=str) + + +_orig_invoke = m.BdFacsariaiiiRuntime.invoke + + +def _instrumented_invoke(self, capability_id, **a): + """Every successful call is checked against its declared output schema, the clock and the declared immediate effects; every rejection code is + recorded.""" + before = self.read('evaluator') if capability_id != 'sim.step' else None + t0 = self.t + try: + out = _orig_invoke(self, capability_id, **a) + except m.ActionRejected as exc: + REJECTIONS.setdefault(capability_id, set()).add(str(exc)) + if before is not None: + after = self.read('evaluator') + ch = {k for k in after if _changed(before[k], after[k])} + if ch: + raise AssertionError(f'{capability_id} rejected but changed state: {sorted(ch)}') + raise + meta = _meta()['capabilities'][capability_id] + errs = asset_tool.validate_value(out, meta['output_schema']) + if errs: + raise AssertionError(f'{capability_id} output violates its schema: {errs[:3]}') + if before is not None: + assert self.t == t0, capability_id + after = self.read('evaluator') + undeclared = {k for k in after if _changed(before[k], after[k])} - set(m.EFFECTS.get(capability_id, [])) + if undeclared: + raise AssertionError(f'{capability_id} changed undeclared state immediately: {sorted(undeclared)}') + PROCESS_EVIDENCE.setdefault(capability_id, []).append(dict(arguments=json.loads(json.dumps(a, default=str)), result_keys=sorted(out))) + return out + + +m.BdFacsariaiiiRuntime.invoke = _instrumented_invoke + + +class Rig: + def __init__(self, seed=7, room=295.15): + self.R = m.BdFacsariaiiiRuntime() + self.R.register_principal('agent', 'agent') + self.R.register_principal('other', 'agent') + self.R.register_principal('ev', 'evaluator') + self.A, self.B, self.E = self.R.session('agent'), self.R.session('other'), self.R.session('ev') + self.I = self.R.instance_id + self.n = 0 + self.call(self.E, 'plant.configure', room_k=room, mains_voltage_v=230.0, noise_seed=seed) + + def call(self, s, cap, expect=None, **a): + self.n += 1 + r = s.invoke(instance_id=self.I, capability_id=cap, arguments=a, request_id=f'q{self.n}') + if expect is None: + assert r['status'] in ('succeeded', 'accepted'), (cap, r['error']) + else: + assert r['status'] in ('rejected', 'unsupported') and r['error']['code'] == expect, (cap, expect, r['status'], r['error']) + SEEN.add((cap, expect)) + return r + + def rd(self, *ids): + return {k: v['value'] for k, v in self.E.read(instance_id=self.I, state_ids=list(ids))['observations'].items()} + + def v(self, k): + return self.rd(k)[k] + + def step(self, dt): + self.call(self.E, 'sim.step', dt_s=float(dt)) + + def ready(self, warm=True, sweet=True, preset=None): + A = self.A + self.call(A, 'power.press_switch') + for L in m.LASERS: + self.call(A, 'lasers.set', laser=L, enabled=True) + if preset: + self.call(A, 'door.set', door='flow_cell', angle_rad=1.2) + self.call(A, 'nozzle.install', nozzle=m._cal()['presets'][preset]['nozzle_um']) + self.call(A, 'door.set', door='flow_cell', angle_rad=0.0) + self.call(A, 'sort_setup.select', preset=preset) + self.call(A, 'fluidics.startup') + self.step(m.STARTUP_S + 1) + self.call(A, 'stream.set', on=True) + self.step(30) + if sweet: + self.call(A, 'sweet_spot.set', enabled=True) + if warm: + self.step(m.WARMUP_S) + + def provide(self, sid, pops, vol=3e-6): + self.call(self.E, 'sample.provide', sample_id=sid, volume_m3=vol, populations=pops) + + def tube(self, tid, sources, buf=0.0, s=None, ttype='12x75'): + self.call(s or self.A, 'tube.prepare', tube_id=tid, tube_type=ttype, sources=sources, buffer_volume_m3=buf) + + def load(self, tid, s=None, wait=5.0): + self.call(s or self.A, 'tube.install', tube_id=tid) + self.call(s or self.A, 'sample.load') + self.step(wait) + + def unload(self, s=None): + self.call(s or self.A, 'sample.unload') + self.step(4) + self.call(s or self.A, 'tube.remove') + + def stats(self, source='live', gates=None, params=None, comp=None): + a = dict(source=source) + if comp is not None: + a['compensation'] = comp + if gates is not None: + a['gates'] = gates + if params is not None: + a['parameters'] = params + return self.call(self.A, 'statistics.read', **a)['result'] + + def record(self, rid, n): + op = self.call(self.A, 'acquisition.record', record_id=rid, events=n)['operation_id'] + for _ in range(600): + if self.A.poll(op)['status'] != 'running': + break + self.step(0.5) + return self.A.poll(op) + + def install(self, device, prefill=5e-7): + self.call(self.A, 'door.set', door='sort_chamber', angle_rad=1.6) + self.call(self.A, 'collection.install', device=device, prefill_m3=prefill) + self.call(self.A, 'door.set', door='sort_chamber', angle_rad=0.0) + + def sort(self, lid, max_s=120.0): + op = self.call(self.A, 'sort.start', layout_id=lid)['operation_id'] + t = 0.0 + while self.A.poll(op)['status'] == 'running' and t < max_s: + self.step(1.0) + t += 1.0 + return op + + def collected(self): + out = {} + for loc in self.call(self.E, 'collection.inspect')['result']['locations']: + out[loc['location']] = {p['population_id'].split('/')[-1]: p['particles'] for p in loc['populations']} + return out + + +PBMC = [dict(population_id='cd4', particle_id='human_t_cell_cd4', concentration_per_m3=6e12, stains=[dict(dye='fluorescein_fitc', molecules=45000.0, cv=0.35)]), + dict(population_id='bcell', particle_id='human_b_cell', concentration_per_m3=4e12, stains=[dict(dye='fluorescein_fitc', molecules=300.0, cv=0.5)])] + + +def set_true_drop_delay(rig): + rig.call(rig.A, 'drop_delay.set', drops=round(rig.v('truth.drop_delay_drops'), 2)) # as found by Accudrop (tested separately) + + +def purity(c, loc, pop): + tot = sum(c.get(loc, {}).values()) + return c[loc].get(pop, 0.0) / tot if tot else 0.0 + + +def two_way(rig, mode='purity', n=8000, lid='two'): + A = rig.A + rig.call(A, 'gate.define', gate_id='cells', kind='rectangle', x='FSC-A', y='SSC-A', x_range=[20000.0, 262143.0], y_range=[0.0, 262143.0]) + rig.call(A, 'gate.define', gate_id='singlets', parent='cells', kind='interval', x='FSC-W', x_range=[0.0, 85000.0]) # doublet discrimination + rig.call(A, 'gate.define', gate_id='pos', parent='singlets', kind='interval', x='B530_30-A', x_range=[3000.0, 262143.0]) + rig.call(A, 'gate.define', gate_id='neg', parent='singlets', kind='interval', x='B530_30-A', x_range=[-2000.0, 1500.0]) + rig.install('2way_12x75') + rig.call(A, 'deflection.set', voltage_on=True) + rig.call(A, 'sort.layout', layout_id=lid, device='2way_12x75', precision_mode=mode, targets={'left': 'pos', 'right': 'neg'}, + target_events={'left': n, 'right': n}) + + +# ---------------------------------------------------------------- libraries, calibration, contract +class ContractAndLibraries(unittest.TestCase): + def test_contract_metadata_and_examples(self): + meta = m.export_bd_facsariaiii_contract_metadata() + self.assertEqual(meta['asset_type_id'], 'instrument.bd_facsariaiii') + self.assertGreaterEqual(len(meta['capabilities']), 60) + for k, c in meta['capabilities'].items(): + m.validate(c['input_schema'], c['example_arguments']) + for e in c['state_effects']: + self.assertIn(e['state_id'], meta['state_slots']) + for k, s in meta['state_slots'].items(): + self.assertIn(s['unit'], ('1', 's', 'm', 'rad', 'K', 'Pa', 'V', 'Hz', 'W', 'm3', '1/s', 'm/s', 'K/s', '1/min', '°C', 'J', 'm3/s'), k) + agent_caps = [k for k, c in meta['capabilities'].items() if c['visibility'] == 'agent'] + for k in agent_caps: + for e in meta['capabilities'][k]['observes']: + self.assertEqual(meta['state_slots'][e]['visibility'], 'agent', (k, e)) + + def test_libraries_real_data(self): + fl, pl = m.fluorochromes(), m.particles() + self.assertGreaterEqual(len(fl), 50) + self.assertGreaterEqual(len(pl), 25) + self.assertTrue(all('FPbase' in d['source'] for d in fl.values())) + self.assertTrue(all(len(p['scatter']['fsc_cross_section_m2']) == len(p['scatter']['diameter_um']) for p in pl.values())) + pb = m._photon() + i = pb['didx']['fluorescein_fitc'] + j = m.FL_DETS.index('B530_30') + q = pb['q'][i, j] + self.assertAlmostEqual(q, m.optics()['detectors']['B530_30']['q_pe_per_mesf'], places=9) + # documented 85 MESF-FITC = 3 sqrt(background) / Q + self.assertAlmostEqual(3 * math.sqrt(pb['bg'][j]) / q, 85.0, places=6) + + def test_fluidics_calibration_reproduces_table_3_1(self): + cal = m._cal()['presets'] + for name, dd in (('70_high', 44.0), ('70_medium', 45.0), ('100', 29.0), ('85', 37.0), ('130', 24.0)): + c = cal[name] + q = m._q_sheath(c['a'] * 2, c['v']) + self.assertAlmostEqual(c['frequency_hz'] * c['vdead'] / q + c['nb_ref'], dd, places=9) + self.assertTrue(4.0 < c['lambda_over_d'] < 4.6, (name, c['lambda_over_d'])) # near the Rayleigh optimum 4.51 + # the documented High (60 V, attenuation off) and Medium (50 V, attenuation on) defaults give one coupling of the 70 um nozzle + self.assertAlmostEqual(cal['70_high']['G'] / cal['70_medium']['G'], 1.0, delta=0.01) + r = Rig() + r.ready(warm=False, sweet=False, preset='70_medium') + d = r.v('truth.laser_delays_s') + self.assertAlmostEqual(d['violet'] * 1e6, 54.0, delta=0.6) + self.assertAlmostEqual(d['red'] * 1e6, -54.0, delta=0.6) + + def test_water_properties(self): + self.assertAlmostEqual(m.water_surface_tension(293.15), 0.07274, delta=2e-5) + self.assertAlmostEqual(m.water_density(277.13), 999.97, delta=0.01) + self.assertAlmostEqual(m.water_viscosity(293.15), 1.002e-3, delta=1.5e-5) + + +# ---------------------------------------------------------------- fluidics, breakoff, Sweet Spot +class Fluidics(unittest.TestCase): + def test_startup_stream_and_cart(self): + r = Rig() + A = r.A + r.call(A, 'stream.set', 'POWER_OFF', on=True) + r.call(A, 'power.press_switch') + r.call(A, 'stream.set', 'FLUIDICS_NOT_READY', on=True) + op = r.call(A, 'fluidics.startup')['operation_id'] + r.call(A, 'fluidics.startup', 'FLUIDICS_BUSY') + r.step(m.STARTUP_S - 1) + self.assertEqual(A.poll(op)['status'], 'running') + r.step(2) + self.assertEqual(A.poll(op)['status'], 'succeeded') + self.assertAlmostEqual(r.v('cart.air_pressure_pa') / PSI, 88.0, delta=0.5) + self.assertAlmostEqual(r.v('cart.gauge_angle_rad'), 88.0 / 160.0 * 1.5 * math.pi, delta=0.02) + sheath0 = r.v('truth.cart_sheath_m3') + r.call(A, 'stream.set', on=True) + r.step(60) + self.assertAlmostEqual(r.v('sheath.pressure_pa') / PSI, 70.0, delta=0.05) + used = sheath0 - r.v('truth.cart_sheath_m3') + q = r.v('truth.jet_speed_m_s') * math.pi * 35e-6 ** 2 + self.assertAlmostEqual(used / 60.0, q, delta=0.05 * q) # ~6.5 ml/min at 70 psi + self.assertAlmostEqual(q * 6e7, 6.46, delta=0.1) + r.call(A, 'cart.refill_sheath', 'STREAM_ON', volume_m3=0.001) + r.call(A, 'fluidics.shutdown', 'STREAM_ON') + r.call(A, 'stream.set', on=False) + r.call(A, 'fluidics.shutdown', 'CLOSED_LOOP_NOZZLE_REQUIRED') + r.call(A, 'nozzle.install', 'DOOR_CLOSED', nozzle='closed_loop') + r.call(A, 'door.set', door='flow_cell', angle_rad=1.2) + r.call(A, 'nozzle.install', nozzle='closed_loop') + op = r.call(A, 'fluidics.shutdown')['operation_id'] + r.step(m.SHUTDOWN_S + 1) + self.assertEqual(A.poll(op)['status'], 'succeeded') + self.assertEqual(r.v('fluidics.state'), 'shutdown') + + def test_drop1_jumps_by_the_drop_spacing_and_gap_is_continuous(self): + r = Rig() + r.ready(warm=False, sweet=False) + A = r.A + rows = [] + for amp in [50.0 + 0.5 * k for k in range(41)]: + r.call(A, 'breakoff.set', amplitude_v=amp) + o = r.rd('breakoff.drop1_px', 'breakoff.gap_px', 'breakoff.drop_spacing_px', 'truth.breakoff_length_m') + rows.append((amp, o['breakoff.drop1_px'], o['breakoff.gap_px'], o['breakoff.drop_spacing_px'], o['truth.breakoff_length_m'])) + d1 = sorted({round(x[1], 1) for x in rows}) + self.assertGreaterEqual(len(d1), 2) + for a, b in zip(d1, d1[1:]): + self.assertAlmostEqual(b - a, rows[0][3], delta=0.2) # documented ~57 px jumps + self.assertTrue(all(rows[i][4] > rows[i + 1][4] for i in range(len(rows) - 1))) # higher amplitude: shorter breakoff + self.assertTrue(all(0 < x[2] <= x[3] + 1e-6 for x in rows)) + + def test_sweet_spot_holds_breakoff_and_drop_delay_while_sheath_warms(self): + drift = {} + for sweet in (False, True): + r = Rig() + r.ready(warm=False, sweet=sweet) + r.step(300) # Sweet Spot first pulls the Gap to its 6-px target + a0 = r.rd('breakoff.drop1_px', 'truth.drop_delay_drops', 'breakoff.amplitude_v') + r.step(1800) + a1 = r.rd('breakoff.drop1_px', 'breakoff.gap_px', 'truth.drop_delay_drops', 'breakoff.amplitude_v', 'truth.sheath_temperature_k', 'sweet_spot.paused') + drift[sweet] = (a0, a1) + off0, off1 = drift[False] + on0, on1 = drift[True] + self.assertGreater(abs(off1['truth.drop_delay_drops'] - off0['truth.drop_delay_drops']), 0.1) # unattended stream drifts (~1 K warm-up) + self.assertLess(abs(on1['truth.drop_delay_drops'] - on0['truth.drop_delay_drops']), 0.05) + self.assertNotEqual(on1['breakoff.amplitude_v'], on0['breakoff.amplitude_v']) + self.assertLessEqual(abs(on1['breakoff.gap_px'] - 6.0), 2.0) + self.assertFalse(on1['sweet_spot.paused']) + + def test_sweet_spot_locks_controls_and_attenuation(self): + r = Rig() + r.ready(warm=False) + A = r.A + r.call(A, 'breakoff.set', 'SWEET_SPOT_ON', amplitude_v=40.0) + r.call(A, 'sheath.set_pressure', 'SWEET_SPOT_ON', pressure_pa=60 * PSI) + r.call(A, 'sort_setup.select', 'STREAM_ON', preset='100') + b0 = r.v('truth.breakoff_length_m') + r.call(A, 'sweet_spot.set', enabled=False) + r.call(A, 'breakoff.set', attenuation=True) + self.assertGreater(r.v('truth.breakoff_length_m'), b0 + 1e-3) # attenuated drive: much longer breakoff + + def test_cart_air_leak_limits_sheath_pressure(self): + r = Rig() + r.ready(warm=False, sweet=False) + r.call(r.E, 'fault.inject', fault='cart_air_leak', active=True) + r.step(300) + o = r.rd('cart.air_pressure_pa', 'sheath.pressure_pa', 'warnings.active') + self.assertLess(o['cart.air_pressure_pa'] / PSI, 41.0) + self.assertLess(o['sheath.pressure_pa'] / PSI, 36.0) + self.assertIn('SHEATH_PRESSURE_LOW', o['warnings.active']) + + +# ---------------------------------------------------------------- acquisition physics +class Acquisition(unittest.TestCase): + def test_event_rate_follows_concentration_and_flow(self): + r = Rig() + r.ready(sweet=False) + r.provide('s', PBMC) + r.tube('t', [dict(sample_id='s', volume_m3=2e-6)], 1e-6) + conc = (6e12 + 4e12) * 2e-6 / 3e-6 + r.load('t') + for setting in (1.0, 6.0): + r.call(r.A, 'acquisition.flow_rate', setting=setting) + r.step(3) + q = r.R._flow_m3_s() + self.assertAlmostEqual(r.v('acquisition.threshold_rate_eps'), conc * q, delta=0.06 * conc * q) + self.assertAlmostEqual(r.R._flow_m3_s() * 6e10, 65.0, delta=0.01) # setting 6: 65 ul/min (linear 10-120) + + def test_cv_rises_with_flow_rate_core_width(self): + cv = {} + for setting in (1.0, 11.0): + r = Rig() + r.ready(sweet=False) + r.tube('b', [dict(bead_id='cst_bead_bright', volume_m3=3e-7)], 7e-7) + r.call(r.A, 'acquisition.flow_rate', setting=setting) + r.load('b', wait=8.0) + st = r.stats(params=['B530_30-A']) + cv[setting] = st['rows'][0]['parameters'][0]['rcv'] + self.assertLess(cv[1.0], 0.04) + self.assertGreater(cv[11.0], cv[1.0] + 0.015) + + def test_shutter_lasers_warmup_and_threshold(self): + r = Rig() + r.ready(warm=False, sweet=False) + r.provide('s', PBMC) + r.tube('t', [dict(sample_id='s', volume_m3=2e-6)], 1e-6) + r.load('t') + self.assertIn('LASERS_WARMING', r.v('warnings.active')) + p_cold = r.v('lasers.power_w')['blue'] + cold = r.stats(params=['B530_30-A'])['rows'][0]['parameters'][0]['median'] + r.call(r.A, 'door.set', door='flow_cell', angle_rad=0.5) + r.step(2) + self.assertEqual(r.v('acquisition.threshold_rate_eps'), 0.0) # shutter blocks the lasers + r.call(r.A, 'door.set', door='flow_cell', angle_rad=0.0) + r.step(1800) + r.step(2) + warm = r.stats(params=['B530_30-A'])['rows'][0]['parameters'][0]['median'] + self.assertGreater(r.v('lasers.power_w')['blue'], p_cold * 1.04) # power rises during the 30-min warm-up + self.assertGreater(warm, cold * 1.02) + self.assertNotIn('LASERS_WARMING', r.v('warnings.active')) + rate = r.v('acquisition.threshold_rate_eps') + r.call(r.A, 'cytometer.settings', thresholds=[dict(parameter='FSC', value=150000.0)]) + r.step(2) + self.assertLess(r.v('acquisition.threshold_rate_eps'), 0.2 * rate) + + def test_doublets_widen_and_double_area(self): + r = Rig() + r.ready(sweet=False) + r.provide('c', [dict(population_id='cen', particle_id='chicken_erythrocyte_nucleus', concentration_per_m3=4e12, doublet_fraction=0.2, + stains=[dict(dye='propidium_iodide', molecules=8.0e8, cv=0.015)])]) + r.tube('t', [dict(sample_id='c', volume_m3=2e-6)], 1e-6) + r.call(r.A, 'cytometer.settings', voltages={'B695_40': 420.0}) + r.load('t', wait=10) + p = r.call(r.A, 'record.read', record_id=r.record('cen', 4000)['result']['record_id'], parameters=['B695_40-A', 'FSC-W'], max_events=4000)['result'] + import numpy as np + X = np.array(p['events']) + a = X[:, 0] + med = np.median(a) + single = (a > 0.8 * med) & (a < 1.25 * med) + double = (a > 1.6 * med) & (a < 2.5 * med) + ratio = np.median(a[double]) / np.median(a[single]) + self.assertTrue(1.95 <= ratio <= 2.05, ratio) # documented linearity 1.95-2.05 + self.assertGreater(np.median(X[double, 1]), 1.15 * np.median(X[single, 1])) + self.assertLess(np.std(a[single]) / np.mean(a[single]), 0.03) # documented PI-CEN CV < 3 % + + def test_dim_bead_sensitivity_matches_85_mesf(self): + r = Rig() + r.ready(sweet=False) + r.tube('b', [dict(bead_id='ps_bead_3um', volume_m3=2e-7, stains=[dict(dye='fluorescein_fitc', molecules=85.0, cv=0.02)]), + dict(bead_id='ps_bead_3um', volume_m3=2e-7)], 6e-7) + r.call(r.A, 'cytometer.settings', voltages={'B530_30': 650.0}) + r.load('b', wait=6) + import numpy as np + rec = r.record('dim', 6000)['result']['record_id'] + X = np.array(r.call(r.A, 'record.read', record_id=rec, parameters=['B530_30-A'], max_events=5000)['result']['events'])[:, 0] + lo, hi = np.percentile(X, [25, 75]) + # two populations: blank and 85 MESF; the separation is ~3 SD of the blank (definition of the documented sensitivity) + blank = X[X < np.median(X)] + dim = X[X >= np.median(X)] + sep = (np.median(dim) - np.median(blank)) / np.std(blank) + self.assertTrue(2.0 < sep < 4.5, sep) + + def test_rate_limit_and_aborts(self): + r = Rig() + r.ready(sweet=False) + self.assertAlmostEqual(r.v('cytometer.max_event_rate_eps'), 70000.0, delta=1.0) # documented maximum (not extrapolated above it) + S = {d: {d: 1.0} for d in m.FL_DETS} + pairs = [('V450_50', 'V510_50'), ('B530_30', 'YG582_15'), ('YG582_15', 'YG610_20'), ('YG610_20', 'YG582_15'), ('YG582_15', 'YG710_50'), ('YG710_50', 'YG780_60'), + ('R660_20', 'R780_60'), ('R780_60', 'R660_20'), ('YG780_60', 'R780_60'), ('B695_40', 'YG710_50'), ('V510_50', 'B530_30'), ('B530_30', 'V510_50')] + for a, b in pairs: + S[a][b] = 0.1 + r.call(r.A, 'compensation.set', enabled=True, spillover=S) + self.assertAlmostEqual(r.v('cytometer.max_event_rate_eps'), 70000.0 * 14 / 18, delta=1.0) # 12 detectors + 12 pairs: fewer events (assumption) + r.call(r.A, 'cytometer.settings', detectors_enabled=['FSC', 'SSC', 'V450_50', 'B530_30', 'YG582_15', 'YG610_20', 'R660_20', 'R780_60']) + self.assertAlmostEqual(r.v('cytometer.max_event_rate_eps'), 70000.0, delta=1.0) # documented: 8 parameters, 12 pairs + r.provide('s', [dict(population_id='p', particle_id='jurkat', concentration_per_m3=1.6e14)], vol=1e-5) + r.tube('t', [dict(sample_id='s', volume_m3=1.5e-6)], 0.0) + r.call(r.A, 'acquisition.flow_rate', setting=8.0) + r.load('t', wait=5) + o = r.rd('acquisition.threshold_rate_eps', 'acquisition.processed_rate_eps', 'acquisition.abort_rate_eps') + self.assertGreater(o['acquisition.threshold_rate_eps'], 72000.0) + self.assertAlmostEqual(o['acquisition.processed_rate_eps'], 70000.0, delta=100.0) + self.assertGreater(o['acquisition.abort_rate_eps'], 1000.0) + + +# ---------------------------------------------------------------- compensation, gates +class CompensationAndGates(unittest.TestCase): + def test_single_stain_compensation(self): + r = Rig() + r.ready(sweet=False) + A = r.A + r.tube('u', [dict(bead_id='ps_bead_6um', volume_m3=3e-7)], 7e-7) + r.tube('pe', [dict(bead_id='ps_bead_6um', volume_m3=3e-7, stains=[dict(dye='pe_r_pe_r_phycoerythrin', molecules=5.0e4, cv=0.1)])], 7e-7) + r.call(A, 'cytometer.settings', voltages={'YG582_15': 420.0, 'YG610_20': 420.0}) + r.load('u') + r.record('unst', 3000) + r.unload() + r.load('pe') + r.record('pe_ctrl', 3000) + r.unload() + res = r.call(A, 'compensation.calculate', unstained_record='unst', controls={'YG582_15': 'pe_ctrl'})['result'] + spill = res['spillover']['YG582_15']['YG610_20'] + fl = m.fluorochromes()['pe_r_pe_r_phycoerythrin']['detector_response'] + self.assertAlmostEqual(spill, fl['YG610_20'] / fl['YG582_15'], delta=0.03) # spectral spill from FPbase x band-pass + st = r.stats(source='pe_ctrl', params=['YG610_20-A'], comp='current') + un = r.stats(source='unst', params=['YG610_20-A'], comp='current') + self.assertAlmostEqual(st['rows'][0]['parameters'][0]['median'], un['rows'][0]['parameters'][0]['median'], delta=80.0) + raw = r.stats(source='pe_ctrl', params=['YG610_20-A']) # default: the compensation stored with the (uncompensated) record + self.assertFalse(raw['compensated']) + self.assertGreater(raw['rows'][0]['parameters'][0]['median'], st['rows'][0]['parameters'][0]['median'] + 500.0) + rd = r.call(A, 'record.read', record_id='pe_ctrl', parameters=['YG610_20-A'], max_events=200)['result'] + rc = r.call(A, 'record.read', record_id='pe_ctrl', parameters=['YG610_20-A'], max_events=200, compensation='current')['result'] + self.assertEqual((rd['compensated'], rc['compensated']), (False, True)) + self.assertFalse(r.call(A, 'data.export', record_id='pe_ctrl', kind='fcs_csv')['result']['compensated']) + r.load('pe') + r.record('pe_after', 1000) # recorded with compensation on: stored with the record + self.assertTrue(r.stats(source='pe_after', params=['YG610_20-A'])['compensated']) + self.assertTrue([x for x in r.call(A, 'records.list')['result']['records'] if x['record_id'] == 'pe_after'][0]['compensated']) + r.call(A, 'compensation.set', 'INVALID_SPILLOVER', enabled=True, spillover={'B530_30': {'B530_30': 0.5}}) + offd = [v for d, row in res['spillover'].items() for e, v in row.items() if e != d] + self.assertTrue(offd and min(offd) >= m.SPILL_MIN) # noise-level spillover is not a compensation pair + self.assertEqual(res['pairs'], len(offd)) + + def test_gate_hierarchy_polygon_and_errors(self): + r = Rig() + r.ready(sweet=False) + A = r.A + r.provide('s', PBMC) + r.tube('t', [dict(sample_id='s', volume_m3=2e-6)], 1e-6) + r.load('t', wait=4) + r.call(A, 'gate.define', gate_id='p1', kind='polygon', x='FSC-A', y='SSC-A', vertices=[[1.0, 1.0], [262000.0, 1.0], [262000.0, 262000.0], [1.0, 262000.0]]) + r.call(A, 'gate.define', gate_id='pos', parent='p1', kind='interval', x='B530_30-A', x_range=[3000.0, 262143.0]) + r.call(A, 'gate.define', 'INVALID_GATE', gate_id='bad', kind='rectangle', x='FSC-A', x_range=[0.0, 1.0]) + r.call(A, 'gate.define', 'UNKNOWN_GATE', gate_id='orphan', parent='nope', kind='interval', x='FSC-A', x_range=[0.0, 1.0]) + st = r.stats(gates=['p1', 'pos']) + rows = {x['gate']: x for x in st['rows']} + self.assertAlmostEqual(rows['pos']['pct_parent'], 60.0, delta=3.0) # 6e12 : 4e12 populations + r.call(A, 'gate.delete', 'GATE_IN_USE', gate_id='p1') + r.call(A, 'gate.delete', gate_id='pos') + r.call(A, 'gate.delete', gate_id='p1') + + +# ---------------------------------------------------------------- sorting +class Sorting(unittest.TestCase): + def test_purity_mode_two_way_and_post_sort_check(self): + r = Rig() + r.ready() + set_true_drop_delay(r) + r.provide('s', PBMC) + r.tube('t', [dict(sample_id='s', volume_m3=2e-6)], 1e-6) + r.call(r.A, 'acquisition.flow_rate', setting=3.0) + r.load('t') + two_way(r, n=6000) + op = r.sort('two') + self.assertEqual(r.A.poll(op)['status'], 'succeeded') + o = r.rd('sort.counts', 'sort.state', 'sort.drawer_open') + self.assertEqual(o['sort.counts'], {'left': 6000, 'right': 6000}) + self.assertEqual(o['sort.state'], 'completed') + self.assertFalse(o['sort.drawer_open']) + c = r.collected() + self.assertGreater(purity(c, 'left', 'cd4'), 0.97) + self.assertGreater(purity(c, 'right', 'bcell'), 0.97) + # post-sort purity check: the sorted fraction is a new sample + r.unload() + r.call(r.A, 'door.set', door='sort_chamber', angle_rad=1.6) + samples = r.call(r.A, 'collection.remove')['result']['samples'] + left = [s for s in samples if s.endswith('_left')][0] + r.tube('chk', [dict(sample_id=left, volume_m3=4.5e-7)], 0.0) + r.call(r.A, 'acquisition.flow_rate', setting=11.0) + r.load('chk', wait=20) + st = r.stats(gates=['cells', 'singlets', 'pos']) + rows = {x['gate']: x for x in st['rows']} + self.assertGreater(rows['pos']['events'], 100) + self.assertGreater(rows['pos']['pct_parent'], 94.0) + + def test_yield_vs_purity_mode_tradeoff(self): + res = {} + for mode in ('yield', 'purity', '4way_purity'): + r = Rig(seed=3) + r.ready() + set_true_drop_delay(r) + r.provide('s', [dict(population_id='rare', particle_id='human_t_cell_cd4', concentration_per_m3=2e12, stains=[dict(dye='fluorescein_fitc', molecules=45000.0)]), + dict(population_id='bulk', particle_id='human_b_cell', concentration_per_m3=2.0e13)], vol=4e-6) + r.tube('t', [dict(sample_id='s', volume_m3=3e-6)], 0.0) + r.call(r.A, 'acquisition.flow_rate', setting=6.0) + r.load('t') + two_way(r, mode=mode, n=3000) + r.sort('two', max_s=60) + c = r.collected() + led = r.call(r.E, 'ledger.read')['result']['ledger'] + res[mode] = (purity(c, 'left', 'rare'), c['left'].get('rare', 0.0) / max(1.0, r.v('sort.counts')['left']), r.v('sort.efficiency')) + self.assertGreater(res['purity'][0], res['yield'][0] + 0.03) # yield mode: extra drops carry bulk cells + self.assertGreater(res['4way_purity'][0], 0.97) + self.assertGreater(res['yield'][2], res['purity'][2]) # purity mode rejects conflicts + + def test_conflicts_grow_with_event_rate_poisson(self): + eff = {} + for conc in (3e12, 3e13): + r = Rig(seed=5) + r.ready() + set_true_drop_delay(r) + r.provide('s', [dict(population_id='cd4', particle_id='human_t_cell_cd4', concentration_per_m3=conc * 0.5, stains=[dict(dye='fluorescein_fitc', molecules=45000.0)]), + dict(population_id='bcell', particle_id='human_b_cell', concentration_per_m3=conc * 0.5)], vol=4e-6) + r.tube('t', [dict(sample_id='s', volume_m3=3e-6)], 0.0) + r.call(r.A, 'acquisition.flow_rate', setting=6.0) + r.load('t') + two_way(r, mode='4way_purity', n=4000) + r.sort('two', max_s=60) + rate = r.v('acquisition.threshold_rate_eps') + eff[conc] = (r.v('sort.efficiency'), rate) + lo, hi = eff[3e12], eff[3e13] + self.assertGreater(lo[0], hi[0]) + # 4-way purity (1 drop, purity mask 32): the drop and the adjacent half-drops (2 drop periods) must be free of events of the other population + # (half of the events); pulse pile-up merges neighbours closer than ~5 us, so the free window is effectively 2 / f - 5 us + r_o = 0.5 * hi[1] + self.assertGreater(hi[0], math.exp(-2.0 * r_o / 90000.0) - 0.02) + self.assertLess(hi[0], math.exp(-r_o * (2.0 / 90000.0 - 6e-6)) + 0.03) + + def test_drop_delay_error_and_auto_drop_delay(self): + r = Rig(seed=11) + r.ready() + A = r.A + true_dd = r.v('truth.drop_delay_drops') + self.assertGreater(abs(true_dd - 44.0), 0.05) # this instrument differs from the factory default + r.tube('acc', [dict(bead_id='accudrop_bead', volume_m3=1e-6)], 0.0) + r.call(A, 'sort.auto_drop_delay', 'PLATES_OFF') + r.call(A, 'deflection.set', voltage_on=True) + r.call(A, 'sort.auto_drop_delay', 'ACCUDROP_BEADS_REQUIRED') + r.call(A, 'tube.install', tube_id='acc') + r.call(A, 'sample.load') + r.call(A, 'sort.auto_drop_delay', 'NOT_ACQUIRING') # the port is still rising + r.step(5) + op = r.call(A, 'sort.auto_drop_delay')['operation_id'] + seen = [] + for _ in range(19): + r.step(5.0) + seen.append(r.v('accudrop.left_stream_fraction')) + r.step(4.5) + self.assertEqual(A.poll(op)['status'], 'running') + r.step(1.0) # 7 + 13 points x 5 s = 100 s + self.assertGreater(max(x for x in seen if x is not None), 0.7) # the camera sees the beads move into the left stream + self.assertLess(min(x for x in seen if x is not None), 0.3) + p = A.poll(op) + self.assertEqual(p['status'], 'succeeded') + self.assertAlmostEqual(r.v('drop_delay.drops'), r.v('truth.drop_delay_drops'), delta=0.1) + # manual Accudrop check: fine tune mode, left stream fraction at the found delay vs. one drop off + r.call(A, 'gate.define', gate_id='all', kind='interval', x='FSC-A', x_range=[-2000.0, 262143.0]) + r.install('2way_12x75') + r.call(A, 'sort.layout', layout_id='acc', device='2way_12x75', precision_mode='fine_tune', targets={'left': 'all'}) + r.call(A, 'deflection.set', optical_filter_in=True) + sop = r.call(A, 'sort.start', layout_id='acc')['operation_id'] + r.step(3) + good = r.v('accudrop.left_stream_fraction') + r.call(A, 'drop_delay.set', drops=r.v('drop_delay.drops') + 0.5) + r.step(2) + half = r.v('accudrop.left_stream_fraction') + self.assertGreater(good, 0.93) + self.assertAlmostEqual(half, 0.5, delta=0.12) # fine tune: 1 - |error| + r.R.step(0.0) + A.cancel(sop, 'c1') + self.assertEqual(A.poll(sop)['status'], 'cancelled') + + def test_single_cell_plate_sort_counts(self): + r = Rig() + r.ready() + set_true_drop_delay(r) + r.provide('s', PBMC) + r.tube('t', [dict(sample_id='s', volume_m3=2e-6)], 1e-6) + r.call(r.A, 'acquisition.flow_rate', setting=1.0) + r.load('t') + r.call(r.A, 'gate.define', gate_id='pos', kind='interval', x='B530_30-A', x_range=[3000.0, 262143.0]) + r.call(r.A, 'door.set', door='sort_chamber', angle_rad=1.6) + r.call(r.A, 'collection.install', device='plate_96', prefill_m3=1e-7) + r.call(r.A, 'deflection.set', voltage_on=True) + r.call(r.A, 'sort.layout', layout_id='pl', device='plate_96', precision_mode='single_cell', targets={'plate': 'pos'}, events_per_well=1, wells=['A1', 'A2', 'A3', 'B1']) + r.call(r.A, 'sort.start', 'DOOR_OPEN', layout_id='pl') + r.call(r.A, 'door.set', door='sort_chamber', angle_rad=0.0) + op = r.sort('pl', max_s=30) + self.assertEqual(r.A.poll(op)['status'], 'succeeded') + c = {w: x for w, x in r.collected().items() if sum(x.values()) > 0} + self.assertEqual(sorted(c), ['A1', 'A2', 'A3', 'B1']) + n1 = sum(1 for w in c.values() if sum(w.values()) == 1) + self.assertGreaterEqual(n1, 3) # single-cell mode: one cell per well (rare doublets aside) + self.assertTrue(all(set(w) <= {'cd4'} for w in c.values())) + + def test_side_stream_aim_drawer_and_sub_threshold_contamination(self): + r = Rig() + r.ready() + set_true_drop_delay(r) + A = r.A + r.provide('s', PBMC + [dict(population_id='debris', particle_id='human_platelet', concentration_per_m3=2e13)], vol=3e-6) + r.tube('t', [dict(sample_id='s', volume_m3=2e-6)], 1e-6) + r.call(A, 'acquisition.flow_rate', setting=3.0) + r.load('t') + two_way(r, n=3000) + r.call(A, 'deflection.set', test_sort=True) + ss = {x['stream']: x for x in r.call(A, 'sort.side_streams')['result']['streams']} + self.assertLess(abs(ss['left']['offset_from_target_m']), 1e-3) + self.assertTrue(r.call(A, 'sort.side_streams')['result']['centre_in_aspirator']) + r.call(A, 'deflection.set', test_sort=False, side_stream_fraction={'left': 0.25}) + op = r.sort('two', max_s=60) + c = r.collected() + self.assertLess(sum(c.get('left', {}).values()), 0.1 * r.v('sort.counts')['left']) # mis-aimed left stream misses the tube + self.assertGreater(c['right'].get('debris', 0.0), 0.0) # platelets below the FSC threshold ride along unseen + self.assertEqual(r.A.poll(op)['status'], 'succeeded') + + def test_clog_protection_and_partial_clog_contamination(self): + r = Rig() + r.ready() + r.provide('s', PBMC) + r.tube('t', [dict(sample_id='s', volume_m3=2e-6)], 1e-6) + r.load('t') + two_way(r, n=10 ** 6) + op = r.call(r.A, 'sort.start', layout_id='two')['operation_id'] + r.step(3) + r.call(r.E, 'fault.inject', fault='clog_full', active=True) + r.step(1) + o = r.rd('stream.on', 'deflection.voltage_on', 'sort.drawer_open', 'sample.port_state', 'errors.active') + self.assertEqual((o['stream.on'], o['deflection.voltage_on'], o['sort.drawer_open']), (False, False, False)) # documented Sweet Spot response + self.assertEqual(o['sample.port_state'], 'unloading') + self.assertIn('CLOG', o['errors.active']) + self.assertEqual(r.A.poll(op)['status'], 'failed') + self.assertEqual(r.A.poll(op)['result']['error'], 'CLOG') + r.step(4) + r.call(r.A, 'door.set', door='flow_cell', angle_rad=1.2) + r.call(r.A, 'nozzle.install', nozzle='70') # sonicated / new nozzle + self.assertNotIn('CLOG', r.v('errors.active')) + # a partial clog is not detected: the bent centre stream runs into the right tube + r2 = Rig() + r2.ready() + r2.provide('s', PBMC) + r2.tube('t', [dict(sample_id='s', volume_m3=2e-6)], 1e-6) + r2.load('t') + two_way(r2, n=10 ** 6) + r2.call(r2.A, 'sort.start', layout_id='two') + r2.step(3) + before = r2.collected().get('right', {}).get('cd4', 0.0) + r2.call(r2.E, 'fault.inject', fault='clog_partial', active=True) + r2.step(5) + self.assertTrue(r2.v('stream.on')) + self.assertGreater(r2.collected()['right'].get('cd4', 0.0), before + 200) + + def test_emergency_stop(self): + r = Rig() + r.ready(warm=False) + r.provide('s', PBMC) + r.tube('t', [dict(sample_id='s', volume_m3=2e-6)], 1e-6) + r.call(r.A, 'tube.install', tube_id='t') + r.call(r.A, 'sample.load') + r.step(1) + self.assertTrue(r.v('lamp.estop_light')) # lit while a tube is loading + r.step(3) + self.assertFalse(r.v('lamp.estop_light')) + r.call(r.A, 'deflection.set', voltage_on=True) + r.call(r.A, 'safety.emergency_stop') + o = r.rd('safety.estop_latched', 'safety.estop_position_m', 'stream.on', 'deflection.voltage_on', 'sample.port_state', 'lasers.on', 'power.enabled') + self.assertEqual((o['safety.estop_latched'], o['stream.on'], o['deflection.voltage_on']), (True, False, False)) + self.assertAlmostEqual(o['safety.estop_position_m'], m.ESTOP_TRAVEL) + self.assertTrue(o['power.enabled'] and all(o['lasers.on'].values())) # lasers and main power stay on + self.assertTrue(r.v('lamp.estop_light')) # User's Guide p.42-43: lit while latched + r.step(5) + self.assertTrue(r.v('lamp.estop_light')) + r.call(r.A, 'stream.set', 'EMERGENCY_STOP_LATCHED', on=True) + r.call(r.A, 'safety.reset_emergency_stop') + self.assertFalse(r.v('lamp.estop_light')) # turning the button clockwise: light off + r.call(r.A, 'stream.set', on=True) + r.step(30) + r.call(r.A, 'sample.load') # the tube stayed on the lowered port + r.step(4) + op = r.call(r.A, 'acquisition.record', record_id='e1', events=10 ** 5)['operation_id'] + r.step(1) + r.call(r.B, 'safety.emergency_stop') # another agent may always press the hardware button + self.assertEqual((r.A.poll(op)['status'], r.A.poll(op)['result']['error']), ('failed', 'EMERGENCY_STOP')) + self.assertTrue(any(e['code'] == 'EMERGENCY_STOP' and 'agent按下' in e['message_zh'] for e in r.call(r.A, 'events.read', since_s=0.0)['result']['events'])) + r.call(r.B, 'safety.reset_emergency_stop') + + +# ---------------------------------------------------------------- temperatures, cart warnings, CS&T, power +class Instrument(unittest.TestCase): + def test_sample_and_collection_temperature(self): + r = Rig() + r.ready(warm=False, sweet=False) + r.provide('s', PBMC) + r.tube('t', [dict(sample_id='s', volume_m3=2e-6)], 1e-6) + r.load('t') + r.call(r.A, 'acquisition.set', acquiring=False) + r.call(r.A, 'sample.temperature', 'INVALID_ARGUMENT', setpoint_k='277.15') + r.call(r.A, 'sample.temperature', 'INVALID_ARGUMENT', setpoint_k=280.0) # only the four software set points + r.call(r.A, 'sample.temperature', setpoint_k=277.15) + r.call(r.A, 'collection.temperature', setpoint_k=277.15) + r.step(2700) + o = r.rd('sample.chamber_temperature_k', 'collection.temperature_k', 'truth.sample_temperature_k') + self.assertLess(abs(o['sample.chamber_temperature_k'] - 277.15), 0.06 * (295.15 - 277.15)) # ~45 min (documented) + self.assertLess(abs(o['collection.temperature_k'] - 277.15), 0.2) + self.assertLess(o['truth.sample_temperature_k'], 279.0) + + def test_level_warning_auto_stream_off(self): + r = Rig() + r.ready(warm=False, sweet=False) + r.R.cart['waste'] = 0.0095 + r.step(1) + self.assertIn('WASTE_FULL', r.v('warnings.active')) + r.step(600) + r.call(r.A, 'warnings.dismiss') + r.step(600) + self.assertTrue(r.v('stream.on')) + r.step(900) + self.assertFalse(r.v('stream.on')) # documented: 15 min without dismissal turns the stream off + r.call(r.A, 'stream.set', on=True) # still full: a fresh warning period, not an immediate stop + r.step(60) + self.assertTrue(r.v('stream.on')) + r.step(900) + self.assertFalse(r.v('stream.on')) + r.R.cart['waste'] = 0.0101 # overflow + r.call(r.A, 'stream.set', on=True) + r.step(1) + self.assertIn('WASTE_OVERFLOW', r.v('errors.active')) + r.call(r.A, 'stream.set', on=False) + r.call(r.A, 'cart.empty_waste', bleach_m3=0.001) + self.assertAlmostEqual(r.v('cart.waste_level_fraction'), 0.1, delta=1e-9) + self.assertNotIn('WASTE_OVERFLOW', r.v('errors.active')) + r.R.cart['sheath'] = 1.2e-5 # runs dry (~0.1 ml/s at 70 psi) + r.call(r.A, 'stream.set', on=True) + r.step(150) + self.assertIn('SHEATH_EMPTY', r.v('errors.active')) + self.assertFalse(r.v('stream.on')) + r.call(r.A, 'cart.refill_sheath', volume_m3=0.009) + self.assertNotIn('SHEATH_EMPTY', r.v('errors.active')) + + def test_cst_check(self): + r = Rig() + r.ready() + r.tube('cst', [dict(bead_id='cst_bead_bright', volume_m3=2e-7), dict(bead_id='cst_bead_mid', volume_m3=2e-7), dict(bead_id='cst_bead_dim', volume_m3=2e-7)], 4e-7) + r.call(r.A, 'cst.performance_check', 'CST_BEADS_REQUIRED') + r.call(r.A, 'tube.install', tube_id='cst') + r.call(r.A, 'sample.load') + r.call(r.A, 'cst.performance_check', 'NOT_ACQUIRING') + r.step(5) + r.call(r.A, 'cytometer.settings', laser_delays_s={'violet': 30e-6}) + op = r.call(r.A, 'cst.performance_check')['operation_id'] + r.step(301) + self.assertEqual(r.A.poll(op)['status'], 'succeeded') + self.assertEqual(r.v('cst.status'), 'passed') + self.assertAlmostEqual(r.v('cytometer.laser_delays_s')['violet'], r.v('truth.laser_delays_s')['violet'], delta=1e-6) + r.call(r.E, 'fault.inject', fault='laser_failure_red', active=True) + op = r.call(r.A, 'cst.performance_check')['operation_id'] + r.step(301) + self.assertEqual(r.v('cst.status'), 'failed') + self.assertIn('LASER_FAILURE_RED', r.v('errors.active')) + + def test_power_loss_and_restore(self): + r = Rig() + r.ready(warm=True, sweet=True) + r.call(r.E, 'fault.inject', fault='power_loss', active=True) + o = r.rd('power.enabled', 'stream.on', 'lasers.on', 'fluidics.state', 'cart.air_pressure_pa') + self.assertFalse(o['power.enabled'] or o['stream.on'] or any(o['lasers.on'].values())) + self.assertEqual(o['fluidics.state'], 'ready') + r.call(r.E, 'fault.inject', fault='power_loss', active=False) + self.assertTrue(r.v('power.enabled')) + self.assertFalse(any(r.v('lasers.warm').values())) # lasers must be switched on and warmed again + + def test_settling_without_agitation(self): + r = Rig() + r.ready(sweet=False) + r.tube('si', [dict(bead_id='silica_bead_1um', volume_m3=1e-6)], 0.0) + tb = r.R.tubes['si'] + tb['settle'] = {k: 0.0 for k in tb['counts']} + k = list(tb['counts'])[0] + r.R.popspec[k]['diameter_m'] = 2e-5 # heavy particle: settles in minutes + r.R.popspec[k]['density_kg_m3'] = 2200.0 + r.load('si') + r.step(2) + rate0 = r.v('acquisition.threshold_rate_eps') + r.step(900) + self.assertLess(r.v('acquisition.threshold_rate_eps'), 0.1 * rate0) + r.call(r.A, 'sample.agitation', 'INVALID_ARGUMENT', speed='250_rpm') + r.call(r.A, 'sample.agitation', speed='300_rpm') + self.assertAlmostEqual(r.v('sample.agitation_rate_hz'), 5.0) + r.step(120) + self.assertLess(r.v('acquisition.threshold_rate_eps'), 0.1 * rate0) # facility: agitation even at 300 rpm is pretty ineffective + d0 = r.call(r.E, 'tube.inspect', tube_id='si')['result']['settled_depth_m'][k] + r.step(10) + d1 = r.call(r.E, 'tube.inspect', tube_id='si')['result']['settled_depth_m'][k] + v_s = 2.0 / 9.0 * (2200.0 - m.water_density(r.R.tubes['si']['T'])) * 9.80665 * 1e-10 / m.water_viscosity(r.R.tubes['si']['T']) + self.assertLess(d1 - d0, 0.45 * v_s * 10.0) # agitation only slows the settling front (40 % of Stokes) + self.assertGreater(d1 - d0, 0.35 * v_s * 10.0) # ... and does not stop it (no resuspension) + r.call(r.A, 'tube.mix', 'TUBE_NOT_ON_BENCH', tube_id='si') + r.unload() + r.call(r.A, 'tube.mix', tube_id='si') # pause, take the tube out and mix it (facility advice) + self.assertEqual(max(r.call(r.E, 'tube.inspect', tube_id='si')['result']['settled_depth_m'].values()), 0.0) + r.load('si', wait=5) + self.assertGreater(r.v('acquisition.threshold_rate_eps'), 0.5 * rate0) + + +class ReviewRound1(unittest.TestCase): + def test_unload_ends_sort_and_records(self): + r = Rig() + r.ready() + set_true_drop_delay(r) + r.provide('s', PBMC, vol=4e-6) + r.tube('t', [dict(sample_id='s', volume_m3=1.5e-6)], 5e-7) + r.tube('t2', [dict(sample_id='s', volume_m3=1.5e-6)], 5e-7) + r.load('t') + two_way(r, n=10 ** 6) + op = r.call(r.A, 'sort.start', layout_id='two')['operation_id'] + rec = r.call(r.A, 'acquisition.record', record_id='rr', events=10 ** 5)['operation_id'] + r.step(3) + n0 = r.v('sort.counts')['left'] + self.assertGreater(n0, 100) + r.call(r.A, 'sample.unload') + o = r.rd('sort.state', 'sort.drawer_open', 'operations.running') + self.assertEqual((o['sort.state'], o['sort.drawer_open']), ('stopped', False)) + self.assertEqual((r.A.poll(op)['status'], r.A.poll(op)['result']['error']), ('failed', 'SAMPLE_UNLOADED')) + self.assertEqual(r.A.poll(rec)['status'], 'failed') + r.step(4) + r.call(r.A, 'tube.remove') + r.load('t2') + r.step(3) + self.assertEqual(r.v('sort.counts')['left'], n0) # nothing continues on the next tube + op2 = r.call(r.A, 'sort.start', layout_id='two')['operation_id'] + r.step(2) + self.assertLess(r.v('sort.counts')['left'], n0) # a new sort counts from zero + r.A.cancel(op2, 'c2') + + def test_overflow_spill_ledger_and_truth_event(self): + r = Rig() + r.ready() + set_true_drop_delay(r) + r.provide('s', PBMC, vol=4e-6) + r.tube('t', [dict(sample_id='s', volume_m3=2e-6)], 1e-6) + r.load('t') + two_way(r, n=10 ** 6) + r.call(r.A, 'door.set', door='sort_chamber', angle_rad=1.6) + r.call(r.A, 'collection.remove') + r.call(r.A, 'collection.install', device='2way_12x75', prefill_m3=5.0e-6) # full tubes + r.call(r.A, 'door.set', door='sort_chamber', angle_rad=0.0) + led0 = r.call(r.E, 'ledger.read')['result']['ledger'] + op = r.call(r.A, 'sort.start', layout_id='two')['operation_id'] + r.step(5) + led = {k: v - led0[k] for k, v in r.call(r.E, 'ledger.read')['result']['ledger'].items()} + self.assertGreater(led['particles_spilled_from_collection'], 0.0) + resid = led['particles_drawn'] - led['particles_sorted'] - led['particles_to_waste'] - led['particles_lost_off_target'] - led['particles_leaked_into_collection'] + self.assertAlmostEqual(resid, 0.0, delta=1e-6) + tot = sum(sum(x.values()) for x in r.collected().values()) + self.assertAlmostEqual(tot, led['particles_sorted'] - led['particles_spilled_from_collection'], delta=1e-6) + self.assertAlmostEqual(led['collection_spilled_m3'], led['collection_added_m3'], delta=1e-12) # full tubes: every added drop spills over + frac = led['collection_spilled_m3'] / (2 * 5.0e-6) + self.assertLess(led['particles_spilled_from_collection'], 3.0 * frac * tot + 30.0) # proportional (binomial), not >= 1 per population per tick + ev_a = [e for e in r.call(r.A, 'events.read', since_s=0.0)['result']['events'] if e['code'] == 'COLLECTION_OVERFLOW'] + ev_e = [e for e in r.call(r.E, 'events.read', since_s=0.0)['result']['events'] if e['code'] == 'COLLECTION_OVERFLOW'] + self.assertEqual(ev_a, []) # truth: the instrument has no level sensor + self.assertEqual(len(ev_e), 2) # once per location + r.A.cancel(op, 'c3') + + def test_custom_non_sorting_setup_and_plates(self): + r = Rig() + r.call(r.A, 'power.press_switch') + for L in m.LASERS: + r.call(r.A, 'lasers.set', laser=L, enabled=True) + r.call(r.A, 'sort_setup.select', preset='70_custom') # Table 3-1 Custom: 70 um non-sorting, high sensitivity + o = r.rd('sheath.pressure_setpoint_pa', 'breakoff.frequency_hz', 'breakoff.amplitude_v', 'deflection.plate_voltage_v', 'cytometer.laser_delays_s', + 'cytometer.window_extension_s', 'cytometer.area_scaling', 'deflection.side_stream_fraction', 'breakoff.attenuation') + self.assertAlmostEqual(o['sheath.pressure_setpoint_pa'] / PSI, 20.0, places=3) + self.assertEqual((o['breakoff.frequency_hz'], o['breakoff.amplitude_v'], o['deflection.plate_voltage_v'], o['breakoff.attenuation']), (30000.0, 10.0, 0.0, False)) + self.assertAlmostEqual(o['cytometer.laser_delays_s']['violet'], 82e-6) + self.assertAlmostEqual(o['cytometer.laser_delays_s']['red'], -82e-6) + self.assertAlmostEqual(o['cytometer.window_extension_s'], 4e-6) + self.assertEqual((o['cytometer.area_scaling']['blue'], o['cytometer.area_scaling']['red'], o['cytometer.area_scaling']['violet']), (0.75, 0.5, 0.25)) + self.assertEqual(set(o['deflection.side_stream_fraction'].values()), {0.0}) + r.call(r.A, 'fluidics.startup') + r.step(m.STARTUP_S + 1) + r.call(r.A, 'stream.set', on=True) + r.step(30) + o = r.rd('truth.laser_delays_s', 'truth.jet_speed_m_s', 'breakoff.drop1_px') + self.assertAlmostEqual(o['truth.laser_delays_s']['violet'], 82e-6, delta=1e-6) # the fitted flow reproduces the documented delay + self.assertLess(o['truth.jet_speed_m_s'], 0.5 * 28.0) + hi = Rig() + hi.ready(sweet=False) + rates = {} + for name, rig in (('custom', r), ('high', hi)): + rig.tube('b', [dict(bead_id='ps_bead_3um', volume_m3=2e-7, stains=[dict(dye='fluorescein_fitc', molecules=300.0, cv=0.02)])], 8e-7) + rig.call(rig.A, 'cytometer.settings', voltages={'B530_30': 550.0}) + rig.step(m.WARMUP_S if name == 'custom' else 0.0) + rig.load('b', wait=6) + rig.record('dimb', 2000) + rates[name] = rig.stats(source='dimb', params=['B530_30-A'])['rows'][0]['parameters'][0]['median'] + self.assertGreater(rates['custom'], 1.8 * rates['high']) # ~2.3 x longer transit at 20 psi: more photons per particle + # ACDU 24-well plate: one cell per well + h = Rig() + h.ready() + set_true_drop_delay(h) + h.provide('s', PBMC) + h.tube('t', [dict(sample_id='s', volume_m3=2e-6)], 1e-6) + h.call(h.A, 'acquisition.flow_rate', setting=1.0) + h.load('t') + h.call(h.A, 'gate.define', gate_id='pos', kind='interval', x='B530_30-A', x_range=[3000.0, 262143.0]) + h.call(h.A, 'door.set', door='sort_chamber', angle_rad=1.6) + h.call(h.A, 'collection.install', device='plate_24', prefill_m3=5e-7) + h.call(h.A, 'door.set', door='sort_chamber', angle_rad=0.0) + h.call(h.A, 'deflection.set', voltage_on=True) + h.call(h.A, 'sort.layout', layout_id='p24', device='plate_24', precision_mode='single_cell', targets={'plate': 'pos'}, events_per_well=2, wells=['A1', 'B6', 'D6']) + op = h.sort('p24', max_s=30) + self.assertEqual(h.A.poll(op)['status'], 'succeeded') + W3 = ('A1', 'B6', 'D6') + v_single = sum(x['volume_m3'] - 5e-7 for x in h.call(h.E, 'collection.inspect')['result']['locations'] if x['location'] in W3) + h.call(h.A, 'door.set', door='sort_chamber', angle_rad=1.6) + h.call(h.A, 'collection.remove') + h.call(h.A, 'collection.install', device='plate_24', prefill_m3=5e-7) + h.call(h.A, 'door.set', door='sort_chamber', angle_rad=0.0) + h.call(h.A, 'sort.layout', layout_id='p24y', device='plate_24', precision_mode='purity', targets={'plate': 'pos'}, events_per_well=40, wells=['A1', 'B6', 'D6']) + op2 = h.sort('p24y', max_s=60) + self.assertEqual(h.A.poll(op2)['status'], 'succeeded') + v_yield = sum(x['volume_m3'] - 5e-7 for x in h.call(h.E, 'collection.inspect')['result']['locations'] if x['location'] in W3) + self.assertGreater(v_yield / 120.0, 1.5 * v_single / 6.0) # purity mode (yield mask 32): two drops per decision, single cell one + c = {w: sum(x.values()) for w, x in h.collected().items() if sum(x.values()) > 0} + self.assertEqual(sorted(c), ['A1', 'B6', 'D6']) + + def test_rate_window_and_si_units(self): + r = Rig() + r.ready(warm=False, sweet=False) + ob = r.A.read(instance_id=r.I, state_ids=['acquisition.threshold_rate_eps', 'sort.sort_rate_eps', 'sample.agitation_rate_hz'])['observations'] + w = ob['acquisition.threshold_rate_eps']['sample_window_s'] + self.assertEqual(len(w), 2) + self.assertAlmostEqual(w[1] - w[0], 1.0) + self.assertAlmostEqual(w[1], r.R.t, delta=0.1) + self.assertEqual(ob['sample.agitation_rate_hz']['unit'], '1/s') + ob2 = r.A.read(instance_id=r.I, state_ids=['acquisition.events_processed'])['observations']['acquisition.events_processed'] + self.assertIsNone(ob2['sample_window_s']) # a running total, not a 1-s rate + out = r.call(r.A, 'amo.set', enabled=True, mode='rapid')['result'] + self.assertAlmostEqual(out['chamber_exchange_rate_per_s'], 69.0 / 60.0) + meta = m.export_bd_facsariaiii_contract_metadata() + units = {k: v['unit'] for k, v in meta['state_slots'].items()} + self.assertFalse([k for k, u in units.items() if u in ('1/min', 'SI', '%')]) + params = meta['mechanisms']['flow_sorting_process']['parameters'] + self.assertFalse([k for k, p in params.items() if p['unit'] in ('1/min', 'SI', '%')]) + + +# ---------------------------------------------------------------- framework +class Framework(unittest.TestCase): + def test_sessions_isolation_and_idempotency(self): + r = Rig() + A, B, E = r.A, r.B, r.E + r.call(A, 'fault.inject', 'ACCESS_DENIED', fault='clog_full', active=True) + with self.assertRaises(m.ActionRejected): + A.read(instance_id=r.I, state_ids=['truth.faults']) + r.ready(warm=False, sweet=False) + r.provide('s', PBMC) + r.tube('ta', [dict(sample_id='s', volume_m3=1e-6)], 0.0) + r.call(B, 'tube.install', 'ACCESS_DENIED', tube_id='ta') + self.assertNotIn('ta', B.read(instance_id=r.I, state_ids=['tubes.on_bench'])['observations']['tubes.on_bench']['value']) + r.load('ta') + op = r.call(A, 'acquisition.record', record_id='ra', events=100000)['operation_id'] + r.step(1) + r.call(B, 'stream.set', 'ACCESS_DENIED', on=False) # another agent's operation is running + r.call(B, 'statistics.read', 'ACCESS_DENIED', source='ra') + self.assertTrue(B.read(instance_id=r.I, state_ids=['operation.started_by_other_agent'])['observations']['operation.started_by_other_agent']['value']) + with self.assertRaises(m.ActionRejected): + B.poll(op) + # idempotency + r1 = A.invoke(instance_id=r.I, capability_id='drop_delay.set', arguments=dict(drops=43.5), request_id='same') + r2 = A.invoke(instance_id=r.I, capability_id='drop_delay.set', arguments=dict(drops=43.5), request_id='same') + self.assertEqual(r1, r2) + r3 = A.invoke(instance_id=r.I, capability_id='drop_delay.set', arguments=dict(drops=42.0), request_id='same') + self.assertEqual(r3['error']['code'], 'REQUEST_CONFLICT') + SEEN.add(('drop_delay.set', 'REQUEST_CONFLICT')) + A.cancel(op, 'cx') + self.assertEqual(A.poll(op)['status'], 'cancelled') + r.call(A, 'laser.uv_355nm', 'UNSUPPORTED') + + def test_atomic_rejection(self): + r = Rig() + r.ready(warm=False, sweet=False) + r.provide('s', PBMC) + before = copy.deepcopy(r.R.read('evaluator')) + samples = copy.deepcopy(r.R.samples) + r.call(r.A, 'tube.prepare', 'VOLUME_OUT_OF_RANGE', tube_id='x', tube_type='1.5ml', sources=[dict(sample_id='s', volume_m3=1e-6)], buffer_volume_m3=1e-6) + r.call(r.A, 'tube.prepare', 'INSUFFICIENT_SAMPLE', tube_id='x', tube_type='15ml', sources=[dict(sample_id='s', volume_m3=2e-6), dict(sample_id='s', volume_m3=2e-6)]) + r.call(r.A, 'sort.layout', 'INVALID_LAYOUT', layout_id='l', device='2way_12x75', precision_mode='purity', targets={'far_left': 'x'}) + r.call(r.A, 'cytometer.settings', 'INVALID_THRESHOLD', thresholds=[dict(parameter='FSC', value=1.0), dict(parameter='FSC', value=2.0)]) + self.assertEqual(r.R.read('evaluator'), before) + self.assertEqual(r.R.samples, samples) + + def test_step_partition_independence(self): + out = [] + for parts in ([8.0], [0.5] * 16, [2.0, 0.25, 0.25, 0.5, 5.0]): + r = Rig(seed=9) + r.ready(warm=False, sweet=True) + r.provide('s', PBMC) + r.tube('t', [dict(sample_id='s', volume_m3=2e-6)], 1e-6) + r.load('t', wait=0.0) + for p in parts: + r.R.step(p) + out.append((r.R.read('evaluator'), r.R.ledger())) + self.assertEqual(out[0], out[1]) + self.assertEqual(out[0], out[2]) + + +class MoreRejections(unittest.TestCase): + def test_preconditions(self): + r = Rig() + A = r.A + r.call(A, 'lasers.set', 'POWER_OFF', laser='blue', enabled=True) + r.ready(warm=False, sweet=False) + r.provide('s', PBMC) + r.call(A, 'sample.load', 'NO_TUBE') + r.tube('t', [dict(sample_id='s', volume_m3=1e-6)], 0.0) + r.tube('t2', [dict(sample_id='s', volume_m3=1e-6)], 0.0) + r.call(A, 'tube.prepare', 'ITEM_EXISTS', tube_id='t', tube_type='12x75', sources=[dict(sample_id='s', volume_m3=1e-7)]) + r.call(A, 'tube.prepare', 'UNKNOWN_SAMPLE', tube_id='t3', tube_type='12x75', sources=[dict(sample_id='nope', volume_m3=1e-7)]) + r.call(A, 'tube.prepare', 'INVALID_SOURCE', tube_id='t3', tube_type='12x75', sources=[dict(volume_m3=1e-7)]) + r.call(A, 'tube.install', tube_id='t') + r.call(A, 'tube.install', 'PORT_OCCUPIED', tube_id='t2') + r.call(A, 'acquisition.record', 'NOT_ACQUIRING', record_id='x', events=10) + r.call(A, 'collection.install', 'DOOR_CLOSED', device='2way_12x75') + r.call(A, 'door.set', door='sort_chamber', angle_rad=0.3) + r.call(A, 'amo.set', 'DOOR_OPEN', enabled=True) + r.call(A, 'sort.start', 'UNKNOWN_LAYOUT', layout_id='none') + r.call(A, 'sort.pause', 'NOT_SORTING') + r.call(A, 'sweet_spot.set', enabled=True) + r.call(A, 'sort_setup.select', 'STREAM_ON', preset='100') + r.call(A, 'nozzle.install', 'STREAM_ON', nozzle='100') + r.call(r.E, 'sample.provide', 'UNKNOWN_PARTICLE', sample_id='z', volume_m3=1e-6, populations=[dict(population_id='p', particle_id='unicorn', concentration_per_m3=1.0)]) + r.call(r.E, 'tube.inspect', 'UNKNOWN_ITEM', tube_id='zz') + r.call(A, 'statistics.read', 'UNKNOWN_RECORD', source='nope') + r.call(A, 'sample.unload', 'NOT_LOADED') + + +class Coverage(unittest.TestCase): + def test_remaining_capabilities(self): + r = Rig() + A, E = r.A, r.E + r.call(A, 'power.set', enabled=True) + r.call(A, 'fluidics.startup') + r.step(m.STARTUP_S + 1) + op = r.call(A, 'cleaning.run', mode='clean_flow_cell')['operation_id'] + self.assertEqual(r.v('fluidics.state'), 'cleaning') + r.step(m.CLEAN_S['clean_flow_cell'] + 1) + self.assertEqual(A.poll(op)['status'], 'succeeded') + r.call(A, 'door.set', door='flow_cell', angle_rad=1.2) + r.call(A, 'nozzle.install', nozzle='closed_loop') + op = r.call(A, 'cleaning.run', mode='prepare_aseptic_sort')['operation_id'] + A.cancel(op, 'cc') + self.assertEqual(r.v('fluidics.state'), 'ready') + r.call(A, 'nozzle.install', nozzle='70') + r.call(A, 'door.set', door='flow_cell', angle_rad=0.0) + r.call(A, 'cart.refill_cleaning') + r.call(A, 'cart.refill_sheath', volume_m3=float(0.010 - r.v('truth.cart_sheath_m3'))) + r.call(A, 'cart.refill_sheath', 'CONTAINER_OVERFLOW', volume_m3=0.001) + r.call(A, 'sheath.set_pressure', pressure_pa=60 * PSI) + self.assertEqual(r.v('sort_setup.preset'), 'custom') + r.call(A, 'sort_setup.select', preset='70_high') + r.call(A, 'stream.set', on=True) + r.step(30) + r.call(A, 'amo.set', enabled=True, mode='rapid') + self.assertTrue(r.v('amo.on')) + for L in m.LASERS: + r.call(A, 'lasers.set', laser=L, enabled=True) + r.provide('s', PBMC) + r.tube('t', [dict(sample_id='s', volume_m3=2e-6)], 1e-6) + r.load('t') + rid = r.record('r1', 2000)['result']['record_id'] + lst = r.call(A, 'records.list')['result']['records'] + self.assertEqual(lst[0]['events'], 2000) + ex = r.call(A, 'data.export', record_id=rid, kind='fcs_csv')['result'] + self.assertEqual(ex['rows'], 2000) + self.assertTrue(r.R.exports['r1.csv'].startswith('FSC-A,FSC-H,FSC-W')) + ev = r.call(A, 'events.read', since_s=0.0)['result']['events'] + self.assertTrue(any(e['code'] == 'RECORD_DONE' for e in ev)) + pv = r.call(A, 'provenance.read')['result'] + self.assertEqual(len(pv['detectors']), 10) + two_way(r, n=10 ** 6) + r.call(A, 'sweet_spot.set', enabled=True) + r.step(0.2) + self.assertTrue(r.v('sweet_spot.paused')) # Gap still off target: sorting would pause + r.step(60) + self.assertFalse(r.v('sweet_spot.paused')) + tb = r.call(E, 'tube.inspect', tube_id='t')['result'] + self.assertLess(tb['volume_m3'], 3e-6) + sop = r.call(A, 'sort.start', layout_id='two')['operation_id'] + r.step(3) + r.call(A, 'sort.pause') + n0 = r.v('sort.counts')['left'] + r.step(2) + self.assertEqual(r.v('sort.counts')['left'], n0) + r.call(A, 'sort.resume') + r.step(2) + self.assertGreater(r.v('sort.counts')['left'], n0) + A.cancel(sop, 'cs') + self.assertEqual(r.v('sort.state'), 'stopped') + r.call(A, 'drawer.set', open=True) + r.step(2) + self.assertAlmostEqual(r.v('sort.drawer_position_m'), m.DRAWER_TRAVEL) + missing = sorted(k for k in m.CAPS if k not in m.UNSUPPORTED and k not in PROCESS_EVIDENCE) + self.assertLessEqual(len(missing), 40) + + +class ZDeclaredEffects(unittest.TestCase): + """Immediate state changes stay within EFFECTS; changes after a step stay within EFFECTS | ON_STEP (compared with the same host not called).""" + + def _check(self, rig, cap, args, session=None): + meta = m.export_bd_facsariaiii_contract_metadata()['capabilities'][cap] + eff = {e['state_id'] for e in meta['state_effects'] if e['timing'] == 'immediate'} + on_step = {e['state_id'] for e in meta['state_effects']} + base = copy.deepcopy(rig.R) + s0 = rig.R.read('evaluator') + (session or rig.A).invoke(instance_id=rig.I, capability_id=cap, arguments=args, request_id=f'eff_{cap}') + s1 = rig.R.read('evaluator') + changed = {k for k in s0 if s0[k] != s1[k]} - {'operation.started_by_other_agent'} + self.assertTrue(changed <= eff, (cap, sorted(changed - eff))) + for dt in (2.0, 28.0): + rig.R.step(dt) + base.step(dt) + a, b = rig.R.read('evaluator'), base.read('evaluator') + diff = {k for k in a if a[k] != b[k]} + self.assertTrue(diff <= (eff | on_step), (cap, dt, sorted(diff - (eff | on_step)))) + + def test_declared_effects(self): + r = Rig() + r.ready(warm=False, sweet=False) + r.provide('s', PBMC) + r.tube('t', [dict(sample_id='s', volume_m3=2e-6)], 1e-6) + r.tube('t2', [dict(sample_id='s', volume_m3=5e-7)], 1e-6) + for cap, args in [('lasers.set', dict(laser='red', enabled=False)), ('breakoff.set', dict(amplitude_v=55.0)), ('drop_delay.set', dict(drops=43.0)), + ('deflection.set', dict(voltage_on=True, plate_voltage_v=5000.0)), ('acquisition.flow_rate', dict(setting=3.0)), + ('cytometer.settings', dict(voltages={'B530_30': 550.0})), ('sample.chamber_light', {}), ('tube.install', dict(tube_id='t')), + ('sample.load', {}), ('sweet_spot.set', dict(enabled=True)), ('door.set', dict(door='side', angle_rad=1.0)), + ('gate.define', dict(gate_id='g1', kind='interval', x='FSC-A', x_range=[1000.0, 262143.0])), + ('compensation.set', dict(enabled=True)), ('sample.agitation', dict(speed='100_rpm')), ('drawer.set', dict(open=True)), + ('acquisition.set', dict(acquiring=False)), ('acquisition.set', dict(acquiring=True)), ('sample.temperature', dict(setpoint_k=310.15)), + ('collection.temperature', dict(setpoint_k=277.15)), ('amo.set', dict(enabled=True)), ('warnings.dismiss', {}), + ('sort.layout', dict(layout_id='lx', device='2way_12x75', precision_mode='purity', targets={'left': 'g1'})), + ('safety.emergency_stop', {}), ('safety.reset_emergency_stop', {}), ('tube.mix', dict(tube_id='t2')), + ('cart.refill_cleaning', {})]: + self._check(r, cap, args) + self._check(r, 'fault.inject', dict(fault='power_loss', active=True), session=r.E) + + +class ZZRejectionCodes(unittest.TestCase): + def test_codes_are_declared(self): + meta = m.export_bd_facsariaiii_contract_metadata()['capabilities'] + missing = [(c, e) for c, e in sorted(SEEN) if e not in {x['code'] for x in meta[c]['errors']}] + missing += [(c, e) for c, es in sorted(REJECTIONS.items()) for e in sorted(es) if e not in {x['code'] for x in meta[c]['errors']}] + self.assertEqual(missing, []) + self.assertGreaterEqual(len(SEEN), 30) + CHECKS.append(dict(check='rejection_codes_declared', status='passed', codes=len(SEEN))) + + def test_zz_every_implemented_capability_called(self): + missing = sorted(k for k in m.CAPS if k not in m.UNSUPPORTED and k not in PROCESS_EVIDENCE) + self.assertEqual(missing, []) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_asset_binder_fd056.py b/tests/test_asset_binder_fd056.py new file mode 100644 index 0000000000000000000000000000000000000000..a4889a448813bccb35a673f18b653634bc54e432 --- /dev/null +++ b/tests/test_asset_binder_fd056.py @@ -0,0 +1,657 @@ +"""tests for CHEM-011 binder_fd056 (BINDER FD 56 drying and heating chamber with forced convection): python3 -m unittest tests/test_asset_binder_fd056.py + +Themes: contract consistency (slots, effects, errors raised vs declared); agent / evaluator truth isolation; idempotent request ids; two instances +isolated; step-partition independence; rejected calls leave the state unchanged; every output validated against its schema and every success +changes only declared slots; heating-up 15 min, 290 W at 150 C and 4 min recovery as calibrated; heating and fan stop with the door open; +fluctuation and spatial variation; air flap air change; drying of wet samples (constant and falling rate, boiling, chamber vapour, room +humidity) to constant mass; class 2 safety controller (latched, reset with OK) and class 1 overtemperature device (330 C, reset after >= 10 s +without mains below 230 C); Delayed Off timer with the fan selection; ramp; USB recording (interval, standby, outage, stick removal); racks and +loads; Pt100 rupture (1999); fan failure; standby skipping exact; energy, liquid-mass and vapour ledgers close.""" +import json +import math +import re +import sys +import unittest +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / 'scripts')) +from asset_runtime import binder_fd056 as rt # noqa: E402 + +INST = 'binder_fd056_01' +CHECKS = [] +SEEN_CAPS = set() +PROCESS_EVIDENCE = {} +C0 = 273.15 +DOOR_90 = math.pi / 2.0 + + +def _differ(x, y): + if isinstance(x, float) and isinstance(y, float): + return abs(x - y) > 1e-12 * max(1.0, abs(x), abs(y)) + return json.dumps(x, sort_keys=True, default=str) != json.dumps(y, sort_keys=True, default=str) + + +class Rig: + def __init__(self, seed=1, instance=INST, **plant): + self.h = rt.BinderFd056Runtime(instance) + self.h.register_principal('agent', 'agent') + self.h.register_principal('eval', 'evaluator') + self.A = self.h.session('agent') + self.E = self.h.session('eval') + self.n = 0 + self.inst = instance + self.call(self.E, 'plant.configure', **dict(rt.PLANT_EXAMPLE, noise_seed=seed, **plant)) + + def call(self, sess, cap, expect='succeeded', **args): + self.n += 1 + before, t0 = self.h.read('evaluator'), self.h.t + r = sess.invoke(instance_id=self.inst, capability_id=cap, arguments=args, request_id=f'r{self.n}') + after = self.h.read('evaluator') + changed = {k for k in after if _differ(after[k], before[k])} - {'clock.time_s'} + if expect == 'succeeded': + assert r['status'] == 'succeeded', (cap, r['error']) + rt.validate(rt.CAPS[cap]['output_schema'], r['result']) + allowed = set(rt.EFFECTS.get(cap, [])) | (set(rt.ON_STEP['sim.step']) if cap == 'sim.step' else set()) + extra = changed - allowed + assert not extra, (cap, sorted(extra)) + if cap != 'sim.step': + assert self.h.t == t0, cap + SEEN_CAPS.add(cap) + PROCESS_EVIDENCE.setdefault(cap, []).append(dict(arguments=json.dumps(args, sort_keys=True, default=str)[:200], time_s=t0, status=r['status'])) + return r['result'] + assert r['status'] in ('rejected', 'unsupported'), (cap, r['status'], r.get('result')) + assert r['error']['code'] == expect, (cap, r['error']['code'], expect) + assert not changed, (cap, 'rejected call changed', sorted(changed)) + assert expect in [e['code'] for e in rt.export_binder_fd056_contract_metadata()['capabilities'][cap]['errors']], (cap, expect) + return r + + def step(self, s): + self.call(self.E, 'sim.step', dt_s=float(s)) + + def read(self, *ids, who=None): + sess = who or self.E + o = sess.read(instance_id=self.inst, state_ids=list(ids) if ids else None)['observations'] + return {k: v['value'] for k, v in o.items()} if not ids or len(ids) > 1 else o[ids[0]]['value'] + + def truth(self): + return self.read('truth.process') + + def on(self): + self.call(self.A, 'power.set', on=True) + + def setp(self, c): + self.call(self.A, 'temperature.set', temperature_k=C0 + c) + + def door(self, open_): + self.call(self.A, 'door.set', angle_rad=DOOR_90 if open_ else 0.0) + + def sample(self, sid='s1', level=1, position='front_left', ware='weighing_bottle_50x30', dry=0.005, liquid='water', liq_kg=0.002, **kw): + was_open = self.h._door_open() + if not was_open: + self.door(True) + r = self.call(self.A, 'sample.place', sample_id=sid, level=level, position=position, ware=ware, dry_mass_kg=dry, liquid_id=liquid, liquid_mass_kg=liq_kg, **kw) + if not was_open: + self.door(False) + return r + + def remove(self, sid): + self.door(True) + r = self.call(self.A, 'sample.remove', sample_id=sid)['sample'] + self.door(False) + return r + + def ledger(self): + return self.call(self.E, 'ledger.read')['ledger'] + + def events(self, who=None): + return [e['code'] for e in self.call(who or self.E, 'events.read', since_s=0.0)['events']] + + +def _balance(test, L): + scale = max(abs(L['e_heater_j']) + abs(L['e_fan_j']) + abs(L['e_samples_in_j']), 1.0) + test.assertLess(abs(L['energy_balance_j']), 1e-9 * scale + 1e-6, L) + test.assertLess(abs(L['mass_balance_kg']), 1e-12 + 1e-12 * L['m_placed_kg'], L) + test.assertLess(abs(L['vapour_balance_kg']), 1e-12 + 1e-12 * L['m_placed_kg'], L) + + +def _raised_codes(): + src = Path(rt.__file__).read_text() + funcs = {} + for m in re.finditer(r'\n def (\w+)\(self[^\n]*\n(.*?)(?=\n def |\n# ----|\nclass |\ndef )', src, re.S): + funcs[m.group(1)] = m.group(2) + own = {k: set(re.findall(r"ActionRejected\('([A-Z_]+)'\)", v)) for k, v in funcs.items()} + calls = {k: set(re.findall(r'self\.(_\w+)\(', v)) & set(funcs) for k, v in funcs.items()} + out = {} + for k in funcs: + if not k.startswith('_cmd_'): + continue + seen, todo, codes = set(), [k], set() + while todo: + f = todo.pop() + if f in seen: + continue + seen.add(f) + codes |= own.get(f, set()) + todo += [g for g in calls.get(f, ()) if g not in ('_cmd_sim_step', 'step', '_tick')] + out[k] = codes + name = {'_cmd_' + c.replace('.', '_'): c for c in rt.CAPS} + return {name[k]: v for k, v in out.items() if k in name} + + +class Contract(unittest.TestCase): + def test_metadata_slots_effects_consistent(self): + m = rt.export_binder_fd056_contract_metadata() + for k, c in m['capabilities'].items(): + for e in c['state_effects']: + self.assertIn(e['state_id'], m['state_slots'], (k, e)) + for p in c['preconditions']: + for s in p['state_ids']: + self.assertIn(s, m['state_slots'], (k, s)) + for s in rt.SCENE_MIRRORED: + self.assertIn(s, rt.SLOTS) + self.assertEqual(rt.SLOTS[s]['visibility'], 'agent') + units = {p['unit'] for p in m['mechanisms']['drying_oven_process']['parameters'].values()} + self.assertFalse(units & {'degC', 'min', 'deg', 'K/min'}, units) + CHECKS.append(dict(id='metadata_consistent')) + + def test_declared_errors_cover_raised_codes(self): + m = rt.export_binder_fd056_contract_metadata() + for cap, codes in _raised_codes().items(): + declared = {e['code'] for e in m['capabilities'][cap]['errors']} + self.assertFalse(codes - declared, (cap, codes - declared)) + + def test_unsupported_capabilities(self): + g = Rig() + for k in rt.UNSUPPORTED: + r = g.A.invoke(instance_id=INST, capability_id=k, arguments={}, request_id='u' + k) + self.assertEqual((r['status'], r['error']['code']), ('unsupported', 'UNSUPPORTED')) + + def test_agent_truth_isolation(self): + g = Rig() + obs = g.A.read(instance_id=INST)['observations'] + self.assertFalse([k for k in obs if k.startswith('truth.')]) + for cap, args in (('truth.inspect', {}), ('ledger.read', {}), ('fault.inject', dict(fault='fan_failure', active=True)), ('sim.step', dict(dt_s=1.0)), + ('plant.configure', dict(rt.PLANT_EXAMPLE))): + r = g.A.invoke(instance_id=INST, capability_id=cap, arguments=args, request_id='x' + cap) + self.assertEqual(r['error']['code'], 'ACCESS_DENIED') + d = g.A.describe(instance_id=INST) + self.assertNotIn('truth.inspect', d['capabilities']) + self.assertNotIn('truth.process', d['state_slots']) + g.on() + g.setp(280.0) + g.sample('p', ware='ptfe_dish_100', dry=0.01, liquid=None, liq_kg=0.0) + g.step(7200.0) + self.assertIn('WARE_OVERHEATED', g.events()) # PTFE above its service limit: evaluator truth only + self.assertNotIn('WARE_OVERHEATED', g.events(g.A)) + + def test_idempotent_request_ids(self): + g = Rig() + r1 = g.A.invoke(instance_id=INST, capability_id='power.toggle', arguments={}, request_id='same') + r2 = g.A.invoke(instance_id=INST, capability_id='power.toggle', arguments={}, request_id='same') + self.assertEqual(r1, r2) + self.assertTrue(g.read('power.on')) + r3 = g.A.invoke(instance_id=INST, capability_id='power.set', arguments=dict(on=False), request_id='same') + self.assertEqual(r3['error']['code'], 'REQUEST_CONFLICT') + + def test_two_instances_isolated(self): + a, b = Rig(instance='a'), Rig(instance='b') + a.on() + a.setp(80.0) + a.step(60.0) + self.assertFalse(b.read('power.on')) + self.assertEqual(b.h.Ta, rt.PLANT_EXAMPLE['ambient_k']) + + def test_step_partition_independence(self): + def run(parts): + g = Rig(seed=7) + g.call(g.A, 'usb.set_stick', inserted=True) + g.on() + g.call(g.A, 'usb.record', on=True, interval_min=1) + g.setp(105.0) + g.sample('w', liq_kg=0.003) + g.call(g.A, 'timer.set', days=0, hours=0, minutes=4, fan_after='off') + for dt in parts: + g.step(dt) + r = g.h.read('evaluator') + return json.dumps({k: r[k] for k in r if k != 'clock.time_s'}, sort_keys=True, default=float), g.ledger(), g.call(g.A, 'usb.read')['rows'] + a, la, ua = run([300.0]) + b, lb, ub = run([0.05] * 6000) + c, lc, uc = run([7.33] * 40 + [6.8]) + self.assertEqual(a, b) + self.assertEqual(a, c) + self.assertEqual(json.dumps(la, sort_keys=True), json.dumps(lb, sort_keys=True)) + self.assertEqual(ua, ub) + self.assertEqual(ua, uc) + + def test_rejections_change_nothing(self): + g = Rig() + g.call(g.A, 'temperature.set', expect='STANDBY', temperature_k=C0 + 100.0) + g.call(g.A, 'usb.read', expect='NO_STICK') + g.call(g.A, 'sample.place', expect='DOOR_CLOSED', sample_id='a', level=1, position='front_left', ware='petri_dish_100', dry_mass_kg=0.01) + g.call(g.A, 'rack.set', expect='DOOR_CLOSED', level=2, present=True) + g.on() + g.call(g.A, 'usb.record', expect='NO_STICK', on=True) + g.door(True) + g.call(g.A, 'sample.place', expect='NO_RACK', sample_id='a', level=2, position='front_left', ware='petri_dish_100', dry_mass_kg=0.01) + g.call(g.A, 'sample.place', expect='OVERFILL', sample_id='a', level=1, position='front_left', ware='crucible_porcelain_30ml', dry_mass_kg=0.0, + liquid_id='water', liquid_mass_kg=0.05) + g.call(g.A, 'sample.place', expect='NOT_LIQUID', sample_id='a', level=1, position='front_left', ware='beaker_250ml', dry_mass_kg=0.0, liquid_id='diethyl_ether', + liquid_mass_kg=0.05, initial_k=C0 + 40.0) + g.call(g.A, 'sample.place', expect='OVERLOAD', sample_id='a', level=1, position='front_left', ware='steel_tray_300x200', dry_mass_kg=29.5, + dry_density_kg_m3=22000.0) + g.call(g.A, 'sample.place', expect='OVERFILL', sample_id='a', level=1, position='front_left', ware='weighing_bottle_50x30', dry_mass_kg=29.0) + g.call(g.A, 'sample.place', expect='INVALID_ARGUMENT', sample_id='a', level=1, position='front_left', ware='beaker_250ml', dry_mass_kg=0.0, liquid_mass_kg=0.05) + g.call(g.A, 'sample.place', sample_id='a', level=1, position='front_left', ware='beaker_250ml', dry_mass_kg=0.05) + g.call(g.A, 'sample.place', expect='DUPLICATE_ID', sample_id='a', level=3, position='front_left', ware='beaker_250ml', dry_mass_kg=0.05) + g.call(g.A, 'sample.place', expect='POSITION_OCCUPIED', sample_id='b', level=1, position='front_left', ware='beaker_250ml', dry_mass_kg=0.05) + g.call(g.A, 'rack.set', expect='RACK_LOADED', level=1, present=False) + g.call(g.A, 'sample.remove', expect='NO_SAMPLE', sample_id='zz') + g.call(g.E, 'plant.configure', expect='SEED_FIXED', **dict(rt.PLANT_EXAMPLE, noise_seed=99)) + g.call(g.E, 'fault.inject', fault='mains_outage', active=True) + g.call(g.A, 'power.set', expect='NO_MAINS', on=False) + g.call(g.A, 'flap.set', expect='NO_MAINS', position=2) + + +class Physics(unittest.TestCase): + def test_heating_up_energy_and_fluctuation(self): + g = Rig(ambient_k=C0 + 22.0) + g.on() + g.setp(150.0) + g.step(890.0) + self.assertLess(g.h.Tsens, C0 + 149.0) + g.step(20.0) + self.assertGreaterEqual(g.h.Tsens, C0 + 149.0) # 15 min to 150 C (datasheet; calibrated) + g.step(8 * 3600.0) + L0, t0 = g.ledger(), g.h.t + dev = 0.0 + for _ in range(360): + g.step(10.0) + dev = max(dev, abs(g.h.Tsens - (C0 + 150.0))) + L1 = g.ledger() + self.assertAlmostEqual((L1['e_electric_total_j'] - L0['e_electric_total_j']) / (g.h.t - t0), 290.0, delta=2.0) # 290 Wh/h at 150 C + self.assertLess(dev, 0.3) # +-0.3 K fluctuation + self.assertEqual(g.read('display.temperature'), 150.0) + self.assertEqual(g.read('display.text'), 'SP 150') + _balance(self, L1) + + def test_door_stops_heating_and_recovery(self): + g = Rig(ambient_k=C0 + 22.0) + g.on() + g.setp(150.0) + g.step(3 * 3600.0) + g.door(True) + g.step(5.0) + self.assertFalse(g.read('fan.running')) + self.assertEqual(g.truth()['heater_w'], 0.0) + g.step(25.0) + self.assertLess(g.truth()['air_k'], C0 + 110.0) # fresh room air in, liner still hot + g.door(False) + g.step(230.0) + self.assertLess(g.h.Tsens, C0 + 149.0) + g.step(20.0) + self.assertGreaterEqual(g.h.Tsens, C0 + 149.0) # 4 min recovery (datasheet; calibrated) + _balance(self, g.ledger()) + + def test_spatial_variation_and_flap(self): + g = Rig(ambient_k=C0 + 22.0) + g.on() + g.setp(150.0) + g.step(3 * 3600.0) + offs = [g.h._offset(lv, p) for lv in rt.LEVELS for p in rt.POSITIONS] + self.assertAlmostEqual(max(abs(x) for x in offs), 1.7, delta=0.03) + e0, t0 = g.ledger()['e_electric_total_j'], g.h.t + g.step(1800.0) + p_closed = (g.ledger()['e_electric_total_j'] - e0) / (g.h.t - t0) + g.call(g.A, 'flap.set', position=4) + self.assertEqual(g.read('flap.angle_rad'), math.radians(60.0)) + g.step(3 * 3600.0) + e0, t0 = g.ledger()['e_electric_total_j'], g.h.t + g.step(1800.0) + p_open = (g.ledger()['e_electric_total_j'] - e0) / (g.h.t - t0) + self.assertGreater(p_open, p_closed + 150.0) # 80 /h of fresh air to heat + self.assertGreater(max(abs(g.h._offset(lv, p)) for lv in rt.LEVELS for p in rt.POSITIONS), 2.0) # flap open: worse uniformity + _balance(self, g.ledger()) + + def test_drying_to_constant_mass(self): + g = Rig() + g.on() + g.setp(105.0) + g.sample('w', dry=0.005, liq_kg=0.002) + masses = [] + for _ in range(12): + g.step(600.0) + masses.append(g.truth()['samples']['w']['total_mass_kg']) + self.assertTrue(all(b <= a for a, b in zip(masses, masses[1:]))) + self.assertLess(g.truth()['samples']['w']['liquid_kg'], 1e-6) # dry within 2 h at 105 C + g.step(3600.0) + r = g.remove('w') + self.assertAlmostEqual(r['total_mass_kg'], rt.WARES['weighing_bottle_50x30']['mass_kg'] + 0.005, delta=1e-6) # constant mass + self.assertAlmostEqual(r['liquid_lost_kg'], 0.002, delta=1e-9) + L = g.ledger() + self.assertEqual(g.call(g.E, 'truth.inspect')['process']['samples'], {}) + self.assertGreater(L['m_vented_kg'] + L['m_condensed_kg'], 0.0019) + _balance(self, L) + + def test_falling_rate_and_humidity(self): + def loss(rh, dry): + g = Rig(relative_humidity=rh) + g.on() + g.setp(45.0) + g.sample('w', ware='petri_dish_100', dry=dry, liq_kg=0.010) + g.step(1800.0) + _balance(self, g.ledger()) + return 0.010 - g.truth()['samples']['w']['liquid_kg'] + self.assertGreater(loss(0.0, 0.0), loss(0.9, 0.0) * 1.05) # humid room air slows drying at 45 C + self.assertGreater(loss(0.5, 0.0), loss(0.5, 0.12) * 1.5) # 10 g on 120 g solid: below the critical moisture + + def test_boiling_limits_sample_temperature(self): + g = Rig() + g.on() + g.setp(150.0) + g.sample('e', ware='beaker_250ml', dry=0.0, liquid='ethanol', liq_kg=0.050) + tb = rt.boiling_k('ethanol', rt.PLANT_EXAMPLE['pressure_pa']) + tmax = 0.0 + for _ in range(60): + g.step(30.0) + s = g.truth()['samples']['e'] + if s['liquid_kg'] > 0: + tmax = max(tmax, s['temperature_k']) + self.assertLessEqual(tmax, tb + 1e-6) + self.assertGreater(g.truth()['samples']['e']['boiled_kg'] + g.truth()['samples']['e']['evaporated_kg'], 0.01) + _balance(self, g.ledger()) + + def test_safety_controller_class2(self): + g = Rig() + g.on() + g.setp(100.0) + g.call(g.A, 'safety.set_limit', limit_k=C0 + 105.0) + g.step(3600.0) + g.call(g.E, 'fault.inject', fault='ssr_stuck_on', active=True) + for _ in range(600): + g.step(1.0) + if g.read('alarm.state'): + break + self.assertEqual(g.read('alarm.state'), 'limit_active') + self.assertEqual(g.read('display.text'), 'ALAr tLI') + self.assertTrue(g.read('indicator.alarm')) + self.assertLess(g.truth()['air_k'], C0 + 125.0) + g.call(g.A, 'alarm.acknowledge') + self.assertEqual(g.read('alarm.state'), 'limit_active') # still above: no reset + g.call(g.E, 'fault.inject', fault='ssr_stuck_on', active=False) + g.call(g.A, 'temperature.set', temperature_k=C0 + 95.0) + g.step(1800.0) + self.assertEqual(g.read('alarm.state'), 'limit_latched') + self.assertEqual(g.truth()['heater_w'], 0.0) + g.call(g.A, 'alarm.acknowledge') + self.assertIsNone(g.read('alarm.state')) + g.step(1800.0) + self.assertAlmostEqual(g.h.Tsens, C0 + 95.0, delta=0.3) + _balance(self, g.ledger()) + + def test_overtemperature_class1(self): + g = Rig() + g.on() + g.setp(250.0) + g.call(g.E, 'fault.inject', fault='safety_controller_failure', active=True) + g.call(g.E, 'fault.inject', fault='ssr_stuck_on', active=True) + g.step(3 * 3600.0) + self.assertEqual(g.read('alarm.state'), 'overtemperature') + self.assertLess(g.truth()['air_k'], C0 + 345.0) + self.assertEqual(g.read('display.text'), 'ALAr OtP') + g.call(g.E, 'fault.inject', fault='ssr_stuck_on', active=False) + g.call(g.E, 'fault.inject', fault='mains_outage', active=True) + g.step(5.0) + g.call(g.E, 'fault.inject', fault='mains_outage', active=False) + self.assertEqual(g.read('alarm.state'), 'overtemperature') # too short and still hot + g.step(4 * 3600.0) + g.call(g.E, 'fault.inject', fault='mains_outage', active=True) + g.step(12.0) + g.call(g.E, 'fault.inject', fault='mains_outage', active=False) + self.assertNotEqual(g.read('alarm.state'), 'overtemperature') # >= 10 s off and below 230 C + _balance(self, g.ledger()) + + def test_timer_delayed_off_and_fan_selection(self): + for fan_after in ('on', 'off'): + g = Rig() + g.on() + g.setp(80.0) + g.call(g.A, 'timer.set', days=0, hours=0, minutes=20, fan_after=fan_after) + self.assertTrue(g.read('indicator.timer')) + g.call(g.A, 'display.cycle') + g.call(g.A, 'display.cycle') + g.call(g.A, 'display.cycle') + self.assertEqual(g.read('display.text'), 't 00020') + g.step(1199.0) + self.assertFalse(g.read('timer.state')['expired']) + g.step(2.0) + self.assertTrue(g.read('timer.state')['expired']) + self.assertEqual(g.read('display.text'), 't End') + self.assertEqual(g.read('fan.running'), fan_after == 'on') + g.step(60.0) + self.assertEqual(g.truth()['heater_w'], 0.0) + g.call(g.A, 'alarm.acknowledge') # OK turns the expired timer off + self.assertFalse(g.read('timer.state')['set']) + self.assertTrue(g.read('fan.running')) + _balance(self, g.ledger()) + + def test_ramp(self): + g = Rig() + g.on() + g.setp(50.0) + g.step(3600.0) + g.call(g.A, 'ramp.set', gradient_k_min=2, target_k=C0 + 90.0) + g.step(600.0) + self.assertAlmostEqual(g.read('ramp.state')['effective_k'], C0 + 70.0, delta=0.05) + self.assertAlmostEqual(g.h.Tsens, C0 + 70.0, delta=1.5) + g.step(1200.0) + self.assertFalse(g.read('ramp.state')['active']) + self.assertEqual(g.read('temperature.set_k'), C0 + 90.0) + g.call(g.A, 'ramp.set', gradient_k_min=3, target_k=C0 + 60.0) # target below the actual value: set directly + self.assertFalse(g.read('ramp.state')['active']) + self.assertEqual(g.read('temperature.set_k'), C0 + 60.0) + + def test_usb_recording_standby_outage(self): + g = Rig() + g.call(g.A, 'usb.set_stick', inserted=True) + g.on() + g.setp(60.0) + g.call(g.A, 'usb.record', on=True, interval_min=2) + g.step(600.0) + rows = g.call(g.A, 'usb.read')['rows'] + self.assertEqual(len(rows), 5) + self.assertEqual([r['time_s'] for r in rows], [0.1, 120.1, 240.1, 360.1, 480.1]) + g.call(g.A, 'power.set', on=False) # recording continues in standby + g.step(1200.0) + self.assertEqual(len(g.call(g.A, 'usb.read')['rows']), 15) + g.call(g.E, 'fault.inject', fault='mains_outage', active=True) # interrupted by an outage + g.step(600.0) + g.call(g.E, 'fault.inject', fault='mains_outage', active=False) + n = len(g.call(g.A, 'usb.read')['rows']) + self.assertEqual(n, 15) + g.step(240.0) + self.assertGreater(len(g.call(g.A, 'usb.read')['rows']), n) + g.call(g.A, 'usb.set_stick', inserted=False) + self.assertIn('USB_REMOVED_WHILE_RECORDING', g.events()) + self.assertFalse(g.read('usb.state')['recording']) + + def test_sensor_rupture_fan_failure_unit(self): + g = Rig() + g.on() + g.setp(100.0) + g.call(g.A, 'unit.set', unit='F') + g.step(3600.0) + self.assertEqual(g.read('display.temperature'), 212.0) + self.assertEqual(g.read('display.text'), 'SP 212') + g.call(g.E, 'fault.inject', fault='sensor_rupture', active=True) + g.step(10.0) + self.assertEqual(g.read('display.temperature'), 1999.0) + self.assertEqual(g.truth()['heater_w'], 0.0) + g2, g3 = Rig(), Rig() + for x in (g2, g3): + x.on() + x.setp(150.0) + x.sample('d', ware='beaker_250ml', dry=0.1, liquid=None, liq_kg=0.0) + g3.call(g3.E, 'fault.inject', fault='fan_failure', active=True) + g2.step(1800.0) + g3.step(1800.0) + t2, t3 = g2.truth(), g3.truth() + self.assertLess(t3['samples']['d']['temperature_k'], t2['samples']['d']['temperature_k'] - 10.0) # no forced convection: the load heats slower + self.assertGreater(t3['heater_k'], t2['heater_k'] + 20.0) # and the element runs hotter + self.assertFalse(g3.read('fan.running')) + _balance(self, g3.ledger()) + + def test_standby_skipping_is_exact(self): + g = Rig() + n = g.h.tick + g.step(30 * 86400.0) + self.assertEqual(g.h.tick - n, int(round(30 * 86400.0 / rt.DT))) + g.on() + g.setp(60.0) + g.step(600.0) + g.call(g.A, 'power.set', on=False) + g.step(24 * 3600.0) + self.assertEqual(g.truth()['air_k'], rt.PLANT_EXAMPLE['ambient_k']) + self.assertTrue(g.read('indicator.standby')) + self.assertIsNone(g.read('display.temperature')) + n = g.h.tick + g.step(10 * 86400.0) + self.assertEqual(g.h.tick - n, int(round(10 * 86400.0 / rt.DT))) + _balance(self, g.ledger()) + + def test_racks_and_keys(self): + g = Rig() + g.on() + g.door(True) + g.call(g.A, 'rack.set', level=2, present=True) + self.assertEqual(g.read('racks.levels'), [1, 2, 3]) + g.call(g.A, 'rack.set', level=2, present=False) + g.door(False) + g.call(g.A, 'temperature.step', delta_k=1.0) + g.call(g.A, 'temperature.step', delta_k=-1.0) + g.call(g.A, 'temperature.step', delta_k=1.0) + self.assertEqual(g.read('temperature.set_k'), C0 + 26.0) + g.call(g.A, 'power.toggle') + self.assertFalse(g.read('power.on')) + + +class RoundOneFixes(unittest.TestCase): + """Regression tests of the round-1 review findings (R1-*).""" + + def test_usb_rows_independent_of_standby_stepping(self): # R1-01 + def run(parts): + g = Rig(seed=3) + g.call(g.A, 'usb.set_stick', inserted=True) + g.on() + g.call(g.A, 'usb.record', on=True, interval_min=1) + g.call(g.A, 'timer.set', days=0, hours=0, minutes=10, fan_after='on') + g.call(g.A, 'power.set', on=False) + for dt in parts: + g.step(dt) + return g.call(g.A, 'usb.read')['rows'] + a = run([1800.0]) + self.assertEqual(a, run([0.1] * 18000)) + self.assertEqual(a, run([33.0] * 54 + [18.0])) + self.assertEqual([r['timer_s'] for r in a[1:4]], [540.0 - 0.1, 480.0 - 0.1, 420.0 - 0.1]) + + def test_vapour_bounded_by_ambient_pressure(self): # R1-02 + g = Rig() + g.on() + g.setp(200.0) + g.sample('wet', ware='steel_tray_300x200', dry=0.2, liquid='water', liq_kg=1.0) + g.call(g.A, 'flap.set', position=0) + pmax = 0.0 + for _ in range(40): + g.step(60.0) + v = g.truth()['vapour_kg'] + pmax = max(pmax, sum(m * rt.R_GAS * g.h.Ta / (rt.LIQ[k]['molar_mass_kg_mol'] * rt.V_AIR) for k, m in v.items())) + self.assertLessEqual(pmax, rt.PLANT_EXAMPLE['pressure_pa'] * (1 + 1e-9)) + _balance(self, g.ledger()) + + def test_class1_clears_automatically_after_cooling(self): # R1-03 + g = Rig() + g.on() + g.setp(250.0) + g.call(g.E, 'fault.inject', fault='safety_controller_failure', active=True) + g.call(g.E, 'fault.inject', fault='ssr_stuck_on', active=True) + for _ in range(240): + g.step(60.0) + if g.read('alarm.state') == 'overtemperature': + break + self.assertEqual(g.read('alarm.state'), 'overtemperature') + g.call(g.E, 'fault.inject', fault='ssr_stuck_on', active=False) + g.call(g.E, 'fault.inject', fault='mains_outage', active=True) + g.step(12.0) + g.call(g.E, 'fault.inject', fault='mains_outage', active=False) + self.assertGreater(g.truth()['air_k'], rt.CLASS1[1]) + self.assertEqual(g.read('alarm.state'), 'overtemperature') # still above 230 C + g.step(6 * 3600.0) + self.assertNotEqual(g.read('alarm.state'), 'overtemperature') # cleared once below 230 C + self.assertIn('OVERTEMP_RESET', g.events()) + _balance(self, g.ledger()) + + def test_door_cuts_heater_immediately(self): # R1-04 + g = Rig() + g.on() + g.setp(150.0) + g.step(120.0) + self.assertGreater(g.truth()['duty'], 0.5) + g.door(True) + self.assertEqual(g.truth()['heater_w'], 0.0) + self.assertFalse(g.read('indicator.heating')) + self.assertFalse(g.read('fan.running')) + + +class RoundTwoFixes(unittest.TestCase): + """Regression tests of the round-2 review findings (R2-*).""" + + def test_no_usb_rows_inside_an_outage(self): # R2-01 + for active in (False, True): + g = Rig(seed=4) + g.call(g.A, 'usb.set_stick', inserted=True) + g.on() + g.setp(50.0) + g.call(g.A, 'usb.record', on=True, interval_min=1) + g.call(g.A, 'timer.set', days=0, hours=0, minutes=30, fan_after='on') + if not active: + g.call(g.A, 'power.set', on=False) + g.step(300.0) + g.call(g.E, 'fault.inject', fault='mains_outage', active=True) + t0 = g.h.t + g.step(400.0) + t1 = g.h.t + g.call(g.E, 'fault.inject', fault='mains_outage', active=False) + g.step(300.0) + rows = g.call(g.A, 'usb.read')['rows'] + self.assertFalse([r['time_s'] for r in rows if t0 < r['time_s'] <= t1 + 1e-9], active) + ts = [r['timer_s'] for r in rows if r['timer_s'] is not None] + self.assertTrue(all(b <= a for a, b in zip(ts, ts[1:])) and max(ts) <= 1800.0, ts) + + def test_vapour_never_above_saturation(self): # R2-02 + g = Rig() + g.on() + g.setp(120.0) + g.sample('wet', ware='steel_tray_300x200', dry=0.2, liquid='water', liq_kg=1.0) + g.step(1800.0) + g.call(g.A, 'power.set', on=False) # warm wet tray in a cooling chamber + worst = 0.0 + for _ in range(60): + g.step(60.0) + m = g.truth()['vapour_kg'].get('water', 0.0) + p = m * rt.R_GAS * g.h.Ta / (rt.LIQ['water']['molar_mass_kg_mol'] * rt.V_AIR) + g.h._room_water_pa() + worst = max(worst, p / rt.p_vap('water', g.h.Ta)) + self.assertLessEqual(worst, 1.0 + 1e-9) + L = g.ledger() + self.assertGreater(L['m_condensed_kg'], 0.0) + _balance(self, L) + + +class ZCoverage(unittest.TestCase): + def test_all_capabilities_exercised(self): + missing = set(rt.CAPS) - set(rt.UNSUPPORTED) - SEEN_CAPS - {'events.read'} + if len(SEEN_CAPS) > 5: + self.assertFalse(missing, sorted(missing)) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_asset_binder_kbf115.py b/tests/test_asset_binder_kbf115.py new file mode 100644 index 0000000000000000000000000000000000000000..8030efb3a5577e6806fcffec90b10dc51cd7aca1 --- /dev/null +++ b/tests/test_asset_binder_kbf115.py @@ -0,0 +1,646 @@ +"""tests for CHEM-198 binder_kbf115 (BINDER KBF 115 constant climate chamber): python3 -m unittest tests/test_asset_binder_kbf115.py + +Themes: contract consistency (slots, effects, errors raised vs declared); agent / evaluator truth isolation; idempotent request ids; two instances +isolated; step-partition independence; rejected calls leave the state unchanged; every output validated against its schema and every success +changes only declared slots; 40 C / 75 %RH steady state (fluctuation, 470 Wh/h, about 100 mL water a day, calibrated); recovery after 30 s door +opening (6 / 7 min, calibrated) and the door-open behaviour (fan to minimum, all off after 60 s, door alarm after 5 min); 200 W heat compensation +at 40 C; climate chart regions (A, B corner reached, outside not reached, dry mode); time programs (ramp / step, tolerance band pause, section +repetition, power-failure resume); safety controller class 3.1, tolerance range alarms, reset and buzzer, the humidity-system alarm that cannot be +acknowledged; freshwater tap / can and wastewater; sample exposure with measured templates (NaCl and KCl deliquescence humidities, solution +branch, adsorbent isotherm, condensation on cold samples, degradation law, mean kinetic temperature); glass-door fog when the door heating +fails; icing below +5 C and the manual defrost; idle mode, humidity off and the 10 min module warm-up, sensor failures; energy and water ledgers +closing exactly.""" +import json +import math +import re +import sys +import unittest +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / 'scripts')) +from asset_runtime import binder_kbf115 as rt # noqa: E402 + +INST = 'binder_kbf115_01' +T0 = 273.15 +CHECKS = [] +SEEN_CAPS = set() +PROCESS_EVIDENCE = {} + + +def _differ(x, y): + if isinstance(x, float) and isinstance(y, float): + return abs(x - y) > 1e-12 * max(1.0, abs(x), abs(y)) + return json.dumps(x, sort_keys=True, default=str) != json.dumps(y, sort_keys=True, default=str) + + +class Rig: + def __init__(self, seed=1, instance=INST, **plant): + self.h = rt.BinderKbf115Runtime(instance) + self.h.register_principal('agent', 'agent') + self.h.register_principal('eval', 'evaluator') + self.A = self.h.session('agent') + self.E = self.h.session('eval') + self.n = 0 + self.inst = instance + self.call(self.E, 'plant.configure', **dict(rt.PLANT_EXAMPLE, noise_seed=seed, **plant)) + + def call(self, sess, cap, expect='succeeded', **args): + self.n += 1 + before, t0 = self.h.read('evaluator'), self.h.t + r = sess.invoke(instance_id=self.inst, capability_id=cap, arguments=args, request_id=f'r{self.n}') + after = self.h.read('evaluator') + changed = {k for k in after if _differ(after[k], before[k])} - {'clock.time_s'} + if expect == 'succeeded': + assert r['status'] == 'succeeded', (cap, r['error']) + rt.validate(rt.CAPS[cap]['output_schema'], r['result']) + if cap != 'sim.step': + extra = changed - set(rt.EFFECTS.get(cap, [])) + assert not extra, (cap, sorted(extra)) + assert self.h.t == t0, cap + SEEN_CAPS.add(cap) + PROCESS_EVIDENCE.setdefault(cap, []).append(dict(arguments=json.dumps(args, sort_keys=True, default=str)[:200], time_s=t0, status=r['status'])) + return r['result'] + assert r['status'] in ('rejected', 'unsupported'), (cap, r['status'], r.get('result')) + assert r['error']['code'] == expect, (cap, r['error']['code'], expect) + assert not changed, (cap, 'rejected call changed', sorted(changed)) + assert expect in [e['code'] for e in rt.export_binder_kbf115_contract_metadata()['capabilities'][cap]['errors']], (cap, expect) + return r + + def step(self, s): + self.call(self.E, 'sim.step', dt_s=float(s)) + + def read(self, *ids, who=None): + sess = who or self.E + o = sess.read(instance_id=self.inst, state_ids=list(ids) if ids else None)['observations'] + return {k: v['value'] for k, v in o.items()} if not ids or len(ids) > 1 else o[ids[0]]['value'] + + def run(self, T_c, rh, settle=6 * 3600.0, fan=1.0): + self.call(self.A, 'power.set', on=True) + self.call(self.A, 'setpoint.set', temperature_k=T0 + T_c, relative_humidity=rh, fan_fraction=fan) + self.step(settle) + + def open(self): + self.call(self.A, 'door.move', angle_rad=1.6) + self.call(self.A, 'glass_door.move', angle_rad=1.5) + + def close(self): + self.call(self.A, 'glass_door.move', angle_rad=0.0) + self.call(self.A, 'door.move', angle_rad=0.0) + + def until(self, pred, limit, every=10.0): + t = 0.0 + while not pred() and t < limit: + self.step(every) + t += every + return t + + def ledger(self): + return self.call(self.E, 'ledger.read')['ledger'] + + def climate(self): + return self.read('truth.climate') + + +def _raised_codes(): + src = Path(rt.__file__).read_text() + funcs = {} + for m in re.finditer(r'\n def (\w+)\(self[^\n]*\n(.*?)(?=\n def |\n# ----|\nclass |\ndef )', src, re.S): + funcs[m.group(1)] = m.group(2) + own = {k: set(re.findall(r"ActionRejected\('([A-Z_]+)'\)", v)) for k, v in funcs.items()} + calls = {k: set(re.findall(r'self\.(_\w+)\(', v)) & set(funcs) for k, v in funcs.items()} + out = {} + for k in funcs: + if not k.startswith('_cmd_'): + continue + seen, todo, codes = set(), [k], set() + while todo: + f = todo.pop() + if f in seen: + continue + seen.add(f) + codes |= own.get(f, set()) + todo += [g for g in calls.get(f, ()) if g not in ('_cmd_sim_step', 'step', '_tick')] + out[k] = codes + name = {'_cmd_' + c.replace('.', '_'): c for c in rt.CAPS} + return {name[k]: v for k, v in out.items() if k in name} + + +def _balance(test, L): + E = (L['e_initial_j'] + L['e_heater_in_j'] + L['e_fan_in_j'] + L['e_door_heating_in_j'] + L['e_wall_in_j'] + L['e_glass_in_j'] + L['e_exchange_in_j'] + + L['e_steam_in_j'] + L['e_sample_heat_in_j'] - L['e_refrigeration_out_j'] - L['e_drain_out_j'] + L['e_samples_added_j'] - L['e_samples_removed_j'] + L['e_reconfigure_in_j']) + scale = max(abs(L['e_initial_j']), abs(L['e_refrigeration_out_j']), abs(L['e_heater_in_j']), 1.0) + test.assertAlmostEqual(L['u_chamber_j'], E, delta=1e-9 * scale + 1e-3) + W = (L['w_initial_kg'] + L['w_supply_in_kg'] + L['w_can_refill_kg'] + L['w_exchange_in_kg'] - L['w_pumped_out_kg'] - L['w_overflow_kg'] + + L['w_samples_added_kg'] - L['w_samples_removed_kg']) + test.assertAlmostEqual(L['w_system_kg'], W, delta=1e-12 + 1e-9 * (L['w_supply_in_kg'] + L['w_system_kg'])) + + +class Contract(unittest.TestCase): + def test_metadata_slots_effects_consistent(self): + meta = rt.export_binder_kbf115_contract_metadata() + slots = set(meta['state_slots']) + self.assertEqual(slots, set(rt.SLOTS)) + for k, c in meta['capabilities'].items(): + for e in c['state_effects']: + self.assertIn(e['state_id'], slots, k) + self.assertTrue({'INVALID_ARGUMENT', 'REQUEST_CONFLICT', 'UNKNOWN_INSTANCE'} <= {e['code'] for e in c['errors']}, k) + self.assertTrue(rt.SCENE_MIRRORED <= slots) + for name, p in meta['mechanisms']['climate_chamber_process']['parameters'].items(): + self.assertEqual(name, name.lower()) + self.assertIn(p['evidence'], ('documented', 'assumption'), name) + + def test_declared_errors_cover_raised_codes(self): + meta = rt.export_binder_kbf115_contract_metadata() + for cap, codes in _raised_codes().items(): + declared = {e['code'] for e in meta['capabilities'][cap]['errors']} + self.assertTrue(codes <= declared, (cap, sorted(codes - declared))) + + def test_unsupported_capabilities(self): + g = Rig() + for k in rt.UNSUPPORTED: + g.call(g.A, k, expect='UNSUPPORTED') + + def test_agent_truth_isolation(self): + g = Rig() + g.call(g.A, 'power.set', on=True) + g.step(600.0) + self.assertFalse(any(k.startswith('truth.') for k in g.read(who=g.A))) + for cap, a in (('truth.inspect', {}), ('ledger.read', {}), ('fault.inject', dict(fault='mains_outage', active=True)), ('sim.step', dict(dt_s=1.0))): + r = g.A.invoke(instance_id=INST, capability_id=cap, arguments=a, request_id='x' + cap) + self.assertEqual(r['error']['code'], 'ACCESS_DENIED') + g.call(g.E, 'fault.inject', fault='heater_failure', active=True) + self.assertFalse(any(e['kind'] in ('fault', 'truth') for e in g.call(g.A, 'events.read', since_s=0.0)['events'])) + g.call(g.E, 'truth.inspect') + + def test_idempotent_request_ids(self): + g = Rig() + a = g.A.invoke(instance_id=INST, capability_id='power.set', arguments=dict(on=True), request_id='same') + b = g.A.invoke(instance_id=INST, capability_id='power.set', arguments=dict(on=True), request_id='same') + self.assertEqual(a, b) + c = g.A.invoke(instance_id=INST, capability_id='power.set', arguments=dict(on=False), request_id='same') + self.assertEqual(c['error']['code'], 'REQUEST_CONFLICT') + + def test_two_instances_isolated(self): + a, b = Rig(instance='i1'), Rig(instance='i2') + a.call(a.A, 'power.set', on=True) + self.assertFalse(b.read('power.on')) + + def test_step_partition_independence(self): + runs = [] + for parts in ([3000.0], [0.3, 7.7, 400.0, 2592.0], [1.0] * 40 + [2960.0]): + g = Rig(seed=7) + g.call(g.A, 'power.set', on=True) + g.call(g.A, 'setpoint.set', temperature_k=T0 + 40.0, relative_humidity=0.75) + for p in parts: + g.step(p) + v = g.read() + v.pop('clock.time_s') + runs.append(json.dumps(v, sort_keys=True, default=str)) + self.assertEqual(runs[0], runs[1]) + self.assertEqual(runs[0], runs[2]) + + def test_rejections_change_nothing(self): + r = rt.BinderKbf115Runtime('fresh') + r.register_principal('e', 'evaluator') + self.assertEqual(r.session('e').invoke(instance_id='fresh', capability_id='power.set', arguments=dict(on=True), request_id='p')['error']['code'], 'PLANT_REQUIRED') + g = Rig() + g.call(g.E, 'plant.configure', expect='SEED_FIXED', **dict(rt.PLANT_EXAMPLE, noise_seed=2)) + g.call(g.E, 'plant.configure', expect='SUPPLY_FIXED', **dict(rt.PLANT_EXAMPLE, water_supply='can')) + g.call(g.A, 'setpoint.set', expect='POWER_OFF', temperature_k=T0 + 30.0) + g.call(g.A, 'alarm.reset', expect='POWER_OFF') + g.call(g.A, 'glass_door.move', expect='OUTER_DOOR_CLOSED', angle_rad=1.0) + g.call(g.A, 'sample.place', expect='OUTER_DOOR_CLOSED', **rt.SAMPLE_EXAMPLE) + g.call(g.A, 'sample.remove', expect='UNKNOWN_SAMPLE', sample_id='nothing') + g.call(g.A, 'can.refill', expect='NO_CAN') + g.call(g.A, 'power.set', on=True) + g.call(g.A, 'setpoint.set', expect='INVALID_ARGUMENT', relative_humidity=0.9) + g.call(g.A, 'setpoint.set', expect='INVALID_ARGUMENT', temperature_k=T0 + 75.0) + g.call(g.A, 'safety.configure', expect='OUT_OF_LIMITS', mode='limit', value_k=50.0) + g.call(g.A, 'tolerance.configure', expect='INVALID_ARGUMENT', delay_s=60.0) + g.call(g.A, 'program.start', expect='UNKNOWN_PROGRAM', program=5) + g.call(g.A, 'program.write', expect='INVALID_REPEAT', **dict(rt.PROGRAM_EXAMPLE, repeat=dict(from_section=2, to_section=2, count=1))) + g.call(g.A, 'program.write', **rt.PROGRAM_EXAMPLE) + g.call(g.A, 'program.start', program=2) + g.call(g.A, 'program.write', expect='PROGRAM_RUNNING', **rt.PROGRAM_EXAMPLE) + g.open() + g.call(g.A, 'door.move', expect='GLASS_DOOR_OPEN', angle_rad=0.0) + g.call(g.A, 'sample.place', expect='NO_SHELF', **dict(rt.SAMPLE_EXAMPLE, shelf=3)) + g.call(g.A, 'sample.place', expect='SHELF_OVERLOAD', **dict(rt.SAMPLE_EXAMPLE, dry_mass_kg=29.0, container_mass_kg=2.0)) + g.call(g.A, 'sample.place', expect='UNQUANTIFIED_SOLUTION', **dict(rt.SAMPLE_EXAMPLE, substance_id='lithium_chloride', initial_water_kg=0.01)) + g.call(g.A, 'sample.place', **rt.SAMPLE_EXAMPLE) + g.call(g.A, 'sample.place', expect='DUPLICATE_SAMPLE', **rt.SAMPLE_EXAMPLE) + for i, sh in enumerate((1, 1, 2, 2)): + g.call(g.A, 'sample.place', **dict(rt.SAMPLE_EXAMPLE, sample_id=f'w{i}', substance_id='inert', dry_mass_kg=24.0, container_mass_kg=0.0, shelf=sh) if i % 2 == 0 + else dict(rt.SAMPLE_EXAMPLE, sample_id=f'w{i}', substance_id='inert', dry_mass_kg=1.0, shelf=sh)) + g.call(g.E, 'plant.configure', **dict(rt.PLANT_EXAMPLE, shelves=4)) + g.call(g.A, 'sample.place', **dict(rt.SAMPLE_EXAMPLE, sample_id='big', substance_id='inert', dry_mass_kg=29.0, container_mass_kg=0.0, shelf=3)) + g.call(g.A, 'sample.place', expect='LOAD_LIMIT', **dict(rt.SAMPLE_EXAMPLE, sample_id='big2', substance_id='inert', dry_mass_kg=29.0, container_mass_kg=0.0, shelf=4)) + g.call(g.E, 'plant.configure', expect='SHELF_OCCUPIED', **dict(rt.PLANT_EXAMPLE, shelves=2)) + g.call(g.A, 'sample.remove', sample_id='big') + g.call(g.E, 'plant.configure', **dict(rt.PLANT_EXAMPLE, shelves=2)) + g.call(g.E, 'fault.inject', expect='INVALID_ARGUMENT', fault='alien', active=True) + + +class Physics(unittest.TestCase): + def test_steady_40_75_energy_water_and_fluctuation(self): + g = Rig() + g.run(40.0, 0.75) + self.assertEqual(g.read('state.current'), 'fixed') + self.assertEqual(g.read('chart.region'), 'A') + L0 = g.ledger() + Ts, RHs = [], [] + for _ in range(240): + g.step(15.0) + c = g.climate() + Ts.append(c['air_k']) + RHs.append(g.read('humidity.chamber')) + L1 = g.ledger() + self.assertLessEqual(max(abs(t - (T0 + 40.0)) for t in Ts), 0.1 + 0.05) # +-0.1 K fluctuation + self.assertLessEqual(max(abs(r - 0.75) for r in RHs), rt.DOC['humidity_fluctuation']) # <= +-2 %RH + self.assertAlmostEqual((L1['electric_energy_j'] - L0['electric_energy_j']) / 3600.0, rt.DOC['energy_40_75_w'], delta=15.0) + g.step(86400.0 - 3600.0) + L2 = g.ledger() + self.assertAlmostEqual(L2['w_supply_in_kg'] - L0['w_supply_in_kg'], rt.DOC['water_consumption_kg_day']['at_40_75_closed'], delta=0.015) + self.assertAlmostEqual(g.read('display.temperature'), 40.0, delta=0.15) + self.assertLessEqual(g.read('truth.power')['mains_current_a'], rt.DOC['unit_fuse_a']) + _balance(self, L2) + + def test_door_recovery_and_door_behaviour(self): + for T_c, rh, target in ((25.0, 0.60, rt.DOC['recovery_25_60_s']), (40.0, 0.75, rt.DOC['recovery_40_75_s'])): + g = Rig() + g.run(T_c, rh) + g.open() + g.step(30.0) + self.assertIn('DOOR_OPEN', g.read('notifications.active')) + self.assertTrue(g.read('indicator.door_open')) + self.assertLess(g.read('humidity.chamber'), rh - 0.03) + g.close() + last = 0.0 + for k in range(1, 1801): + g.step(1.0) + if abs(g.read('temperature.chamber_k') - (T0 + T_c)) > 0.5 or abs(g.read('humidity.chamber') - rh) > 0.03: + last = float(k) + self.assertAlmostEqual(last, target, delta=0.25 * target, msg=(T_c, rh)) # one calibrated parameter for both targets + _balance(self, g.ledger()) + g = Rig() + g.run(40.0, 0.75) + g.call(g.A, 'door.move', angle_rad=1.6) + g.step(30.0) + self.assertEqual(g.read('state.current'), 'fixed') + self.assertAlmostEqual(g.read('truth.power')['fan'], rt.ENG['fan_power_w'] * rt.FAN_LO ** 3, delta=1e-9) # fan at minimum speed + g.step(31.0) + self.assertEqual(g.read('state.current'), 'door_off') # all off after 60 s + p = g.read('truth.power') + self.assertEqual((p['heater'], p['fan'], p['compressor']), (0.0, 0.0, 0.0)) + self.assertNotIn('DOOR_OPEN', g.read('alarms.active')) + g.step(rt.DOC['door_open_alarm_s'] - 61.0 + 1.0) + self.assertIn('DOOR_OPEN', g.read('alarms.active')) + self.assertTrue(g.read('alarm.audible')) + g.call(g.A, 'door.move', angle_rad=0.0) + g.step(1.0) + self.assertIn('DOOR_OPEN', g.read('alarms.active')) # not acknowledged: stays after the door closed + self.assertEqual(g.call(g.A, 'alarm.reset')['cleared'], ['DOOR_OPEN']) + self.assertFalse(g.read('alarm.audible')) + _balance(self, g.ledger()) + + def test_heat_compensation_200w(self): + res = {} + for load in (200.0, 300.0): + g = Rig() + g.call(g.A, 'power.set', on=True) + g.call(g.A, 'function.set', humidity_control=False) + g.call(g.A, 'setpoint.set', temperature_k=T0 + 40.0) + g.open() + g.call(g.A, 'sample.place', sample_id='dut', substance_id='inert', shelf=1, dry_mass_kg=2.0, initial_k=T0 + 40.0, exposed_area_m2=0.2, heat_output_w=load) + g.close() + g.step(5 * 3600.0) + res[load] = g.climate()['air_k'] - (T0 + 40.0) + self.assertEqual(g.read('chart.region'), 'dry') + _balance(self, g.ledger()) + self.assertLess(abs(res[200.0]), 0.15) + self.assertGreater(res[300.0], 1.0) + + def test_climate_chart_regions(self): + g = Rig() + g.run(10.0, 0.40, settle=12 * 3600.0) + self.assertEqual(g.read('chart.region'), 'B') + self.assertIn('CLIMATE_CHART_B', g.read('notifications.active')) + self.assertAlmostEqual(g.read('humidity.chamber'), 0.40, delta=0.03) + g.step(13 * 3600.0) + self.assertIn('CLIMATE_CHART_B_24H', g.read('notifications.active')) + g = Rig() + g.run(20.0, 0.10, settle=12 * 3600.0) + self.assertEqual(g.read('chart.region'), 'outside') + self.assertIn('CLIMATE_CHART_OUTSIDE', g.read('notifications.active')) + self.assertGreater(g.read('humidity.chamber'), 0.10 + 0.03) # below the reachable dew point + self.assertLessEqual(g.climate()['dehumidification_evaporator_k'], rt.ENG['evaporator_min_k'] + 0.5) + _balance(self, g.ledger()) + + def test_program_ramp_step_repeat_pause_and_power_failure(self): + g = Rig() + g.run(25.0, 0.60, settle=4 * 3600.0) + secs = [dict(duration_s=1800.0, temperature_k=T0 + 25.0, relative_humidity=0.60, transition='step'), + dict(duration_s=3600.0, temperature_k=T0 + 25.0, relative_humidity=0.60, transition='ramp'), + dict(duration_s=3600.0, temperature_k=T0 + 25.0, relative_humidity=0.60, transition='ramp'), + dict(duration_s=600.0, temperature_k=T0 + 35.0, relative_humidity=0.70, transition='step'), + dict(duration_s=600.0, temperature_k=T0 + 45.0, relative_humidity=0.70, transition='step', tolerance_k=1.0), + dict(duration_s=1.0, temperature_k=T0 + 45.0, relative_humidity=0.70, transition='step')] + r = g.call(g.A, 'program.write', program=4, sections=secs, repeat=dict(from_section=1, to_section=2, count=1)) + self.assertEqual(r['duration_s'], sum(x['duration_s'] for x in secs) + 1800.0 + 3600.0) + g.call(g.A, 'program.start', program=4) + g.step(1800.0 + 3600.0 + 1800.0 + 3600.0 + 1800.0) # sections 1, 2, repeated 1, 2, half of 3 (ramp) + st = g.read('program.status')['running'] + self.assertEqual((st['section'], st['reps_done']), (3, 1)) + self.assertAlmostEqual(st['elapsed'], 1800.0, delta=1.0) + self.assertAlmostEqual(g.read('setpoint.current')['temperature_k'], T0 + 30.0, delta=0.01) # ramp 25 C -> 35 C: half way 30 C + self.assertAlmostEqual(g.read('setpoint.current')['relative_humidity'], 0.65, delta=1e-4) + g.call(g.E, 'fault.inject', fault='mains_outage', active=True) + g.step(1200.0) + self.assertEqual(g.read('state.current'), 'outage') + self.assertEqual(g.read('alarms.active'), []) # the panel is dead + g.call(g.E, 'fault.inject', fault='mains_outage', active=False) + g.step(1.0) + self.assertAlmostEqual(g.read('program.status')['running']['elapsed'], 1801.0, delta=1.5) # program time held during the outage + self.assertIn('POWER_FAILURE', g.read('alarms.active')) + g.step(1799.0 + 600.0 + 60.0) + self.assertEqual(g.read('program.status')['running']['section'], 5) + self.assertEqual(g.read('state.current'), 'program_paused') # step to 45 C outside the 1 K band + self.assertLess(g.read('program.status')['running']['elapsed'], 120.0) + g.until(lambda: g.read('program.status')['running'] is None, 6 * 3600.0, 60.0) + self.assertEqual(g.read('setpoint.current')['source'], 'fixed') + self.assertTrue(any(e['code'] == 'PROGRAM_PAUSE' for e in g.call(g.A, 'events.read', since_s=0.0)['events'])) + g.call(g.A, 'program.start', program=4) + self.assertTrue(g.call(g.A, 'program.stop')['stopped']) + _balance(self, g.ledger()) + + def test_safety_tolerance_alarms_reset_and_buzzer(self): + g = Rig() + g.run(40.0, 0.75) + g.call(g.A, 'tolerance.configure', temperature_k=2.0, relative_humidity=0.05, delay_s=900.0) + g.call(g.A, 'safety.configure', mode='offset', value_k=2.0) + self.assertAlmostEqual(g.read('safety.settings')['limit_k'], T0 + 42.0) + g.open() + g.call(g.A, 'sample.place', sample_id='hot', substance_id='inert', shelf=2, dry_mass_kg=3.0, initial_k=T0 + 40.0, exposed_area_m2=0.3, heat_output_w=450.0) + g.close() + t = g.until(lambda: 'SAFETY_CONTROLLER' in g.read('alarms.active'), 3 * 3600.0, 10.0) + self.assertLess(t, 3 * 3600.0) + self.assertEqual(g.read('truth.power')['heater'], 0.0) + self.assertTrue(g.read('indicator.alarm_header')) + g.step(960.0) + self.assertIn('TEMPERATURE_RANGE', g.read('alarms.active')) + r = g.call(g.A, 'alarm.reset') + self.assertIn('SAFETY_CONTROLLER', r['muted']) + self.assertFalse(g.read('alarm.audible')) + g.open() + g.call(g.A, 'sample.remove', sample_id='hot') + g.close() + g.until(lambda: 'SAFETY_CONTROLLER' not in g.read('alarms.active'), 4 * 3600.0, 30.0) + self.assertNotIn('SAFETY_CONTROLLER', g.read('alarms.active')) # acknowledged: clears by itself + g.step(3 * 3600.0) + self.assertNotIn('TEMPERATURE_RANGE', g.read('alarms.active')) + g.call(g.A, 'buzzer.set', on=False) + g.call(g.E, 'fault.inject', fault='humidity_module_failure', active=True) + g.step(5.0) + self.assertIn('HUMIDITY_SYSTEM', g.read('alarms.active')) + self.assertFalse(g.read('alarm.audible')) # buzzer off + g.call(g.A, 'buzzer.set', on=True) + self.assertNotIn('HUMIDITY_SYSTEM', g.call(g.A, 'alarm.reset')['muted']) # must not be acknowledged + self.assertTrue(g.read('alarm.audible')) + g.call(g.E, 'fault.inject', fault='humidity_module_failure', active=False) + for f, code in (('temperature_sensor_failure', 'TEMPERATURE_SENSOR'), ('humidity_sensor_failure', 'HUMIDITY_SENSOR'), ('safety_sensor_failure', 'SAFETY_SENSOR'), + ('door_sensor_failure', 'DOOR_SENSOR')): + g.call(g.E, 'fault.inject', fault=f, active=True) + g.step(2.0) + self.assertIn(code, g.read('alarms.active')) + self.assertIsNone(g.read('display.temperature')) + self.assertIsNone(g.read('display.humidity')) + _balance(self, g.ledger()) + + def test_water_supply_can_and_wastewater(self): + g = Rig() + g.run(40.0, 0.75) + g.call(g.A, 'water.supply', open=False) + t = g.until(lambda: 'FRESHWATER_SUPPLY' in g.read('alarms.active'), 48 * 3600.0, 600.0) + self.assertLess(t, 3 * 3600.0) # the next fill attempt fails (level about 10 % down) + self.assertTrue(g.read('indicator.water')) + g.step(36 * 3600.0) # the 0.07 L container runs dry (about 0.1 L a day) + self.assertLess(g.read('humidity.chamber'), 0.70) + g.call(g.A, 'water.supply', open=True) + g.step(3600.0) + self.assertAlmostEqual(g.read('humidity.chamber'), 0.75, delta=0.02) + _balance(self, g.ledger()) + c = Rig(water_supply='can') + self.assertEqual(c.read('water.can_kg'), rt.ENG['can_capacity_kg']) + c.run(25.0, 0.60, settle=3600.0) + kg = c.read('water.can_kg') + self.assertLess(kg, rt.ENG['can_capacity_kg']) + c.call(c.A, 'can.refill') + self.assertEqual(c.read('water.can_kg'), rt.ENG['can_capacity_kg']) + c.h.can_kg = 0.0 # an empty can (evaluator shortcut) + c.h.hum_kg = 0.0 + c.step(10.0) + self.assertIn('FRESHWATER_CAN_EMPTY', c.read('alarms.active')) + w = Rig() + w.run(25.0, 0.80, settle=2 * 3600.0) + w.call(w.E, 'fault.inject', fault='wastewater_blocked', active=True) + old = w.h.waste + w.h.waste = 0.49 # a nearly full can (evaluator shortcut) + w.h.led['w_initial_kg'] += 0.49 - old # keep the water ledger consistent + w.call(w.A, 'setpoint.set', relative_humidity=0.30) + t = w.until(lambda: 'WASTEWATER' in w.read('alarms.active'), 48 * 3600.0, 300.0) + self.assertLess(t, 48 * 3600.0) + self.assertGreaterEqual(w.climate()['wastewater_kg'], rt.DOC['wastewater_tank_kg'] - 1e-9) + _balance(self, w.ledger()) + + def test_sample_exposure_templates(self): + g = Rig() + g.run(25.0, 0.60) + g.open() + g.call(g.A, 'sample.place', sample_id='nacl', substance_id='sodium_chloride', shelf=1, dry_mass_kg=0.010, exposed_area_m2=0.02, initial_k=T0 + 25.0, container_mass_kg=0.05) + g.call(g.A, 'sample.place', sample_id='kcl', substance_id='potassium_chloride', shelf=1, dry_mass_kg=0.010, exposed_area_m2=0.005, initial_k=T0 + 25.0) + g.call(g.A, 'sample.place', sample_id='mof', substance_id='uio_66', shelf=2, dry_mass_kg=0.005, exposed_area_m2=0.003, initial_k=T0 + 25.0) + g.call(g.A, 'sample.place', sample_id='cold', substance_id='inert', shelf=2, dry_mass_kg=0.5, exposed_area_m2=0.02, initial_k=T0 + 5.0, heat_capacity_j_kg_k=900.0) + g.call(g.A, 'sample.place', sample_id='drug', substance_id='inert', shelf=2, dry_mass_kg=0.02, initial_k=T0 + 25.0, + degradation=dict(rate_ref_per_s=1e-7, activation_j_mol=100000.0, humidity_exponent=2.0)) + g.close() + self.assertEqual(len(g.call(g.A, 'samples.read')['samples']), 5) + g.step(1800.0) + tr = g.read('truth.samples') + self.assertGreater(tr['cold']['exposure']['condensation_events'], 0) # cold item below the dew point + g.step(2 * 86400.0) + tr = g.read('truth.samples') + self.assertEqual(tr['nacl']['water_kg'], 0.0) # 60 %RH < NaCl 75.3 % + self.assertEqual(tr['nacl']['state'], 'dry') + q_eq = rt._interp(rt.SORPTION['uio_66']['adsorption']['relative_humidity'], rt.SORPTION['uio_66']['adsorption']['uptake_kg_kg'], 0.60) + self.assertAlmostEqual(tr['mof']['water_kg'] / 0.005, q_eq, delta=0.1 * q_eq) + self.assertEqual(tr['cold']['film_kg'], 0.0) # the film evaporated after warming + g.call(g.A, 'setpoint.set', relative_humidity=0.80) + g.step(4 * 86400.0) + tr = g.read('truth.samples') + self.assertGreater(tr['nacl']['water_kg'], 0.0) # 80 %RH > 75.3 %: deliquesced + self.assertIn(tr['nacl']['state'], ('solution', 'saturated_solution', 'solution_extrapolated')) + self.assertEqual(tr['kcl']['water_kg'], 0.0) # KCl 84.3 %: still dry + g.step(10 * 86400.0) + tr = g.read('truth.samples') + m = 0.010 / rt.SORPTION['sodium_chloride']['solution_branch']['solute_molar_mass_kg_mol'] / tr['nacl']['water_kg'] + aw, q = rt.branch_aw('sodium_chloride', m) + self.assertAlmostEqual(aw, 0.80, delta=0.02) # solution in equilibrium with 80 %RH + g.open() + rep = g.call(g.A, 'sample.remove', sample_id='nacl')['sample'] + self.assertEqual(rep['appearance'], 'liquid') + self.assertAlmostEqual(rep['total_mass_kg'], 0.06 + tr['nacl']['water_kg'], delta=1e-3) + self.assertNotIn('exposure', rep) # hidden process values only in the truth + g.call(g.A, 'sample.remove', sample_id='drug') + g.close() + rm = {r['sample_id']: r for r in g.call(g.E, 'truth.inspect')['removed_samples']} + self.assertAlmostEqual(rm['nacl']['exposure']['mean_kinetic_temperature_k'], T0 + 25.0, delta=0.6) # shelf offset and the latent heat of uptake + self.assertGreater(rm['nacl']['exposure']['time_above_deliquescence_s'], 13 * 86400.0) + self.assertGreater(rm['drug']['degraded_fraction'], 0.0) + self.assertLess(rm['drug']['degraded_fraction'], 1.0) + _balance(self, g.ledger()) + + def test_glass_fog_when_door_heating_fails(self): + g = Rig(ambient_k=T0 + 15.0) + g.run(40.0, 0.80, settle=4 * 3600.0) + self.assertFalse(g.read('door.glass_fogged')) + g.call(g.E, 'fault.inject', fault='door_heating_failure', active=True) + g.step(4 * 3600.0) + self.assertTrue(g.read('door.glass_fogged')) + self.assertLess(g.climate()['glass_k'], g.climate()['dew_point_k']) + g.call(g.E, 'fault.inject', fault='door_heating_failure', active=False) + g.step(8 * 3600.0) + self.assertFalse(g.read('door.glass_fogged')) + _balance(self, g.ledger()) + + def test_icing_below_5c_and_manual_defrost(self): + g = Rig() + g.call(g.A, 'power.set', on=True) + g.call(g.A, 'function.set', humidity_control=False) + g.call(g.A, 'setpoint.set', temperature_k=T0 + 2.0) + g.step(86400.0) + self.assertAlmostEqual(g.read('temperature.chamber_k'), T0 + 2.0, delta=0.3) + g.step(2 * 86400.0) + ice = g.climate()['evaporator_ice_kg'] + self.assertGreater(ice, 0.0) + g.call(g.A, 'function.set', humidity_control=True) # manual defrost: 0 %RH, 40 C, 30 min + g.call(g.A, 'setpoint.set', temperature_k=T0 + 40.0, relative_humidity=0.0) + g.step(1800.0 + 3600.0) + self.assertLess(g.climate()['evaporator_ice_kg'], 0.05 * ice) + _balance(self, g.ledger()) + + def test_idle_humidity_off_warmup_and_logger(self): + g = Rig() + g.run(30.0, 0.70, settle=3 * 3600.0) + g.call(g.A, 'logger.configure', interval_s=120.0) + g.call(g.A, 'function.set', humidity_control=False) + self.assertIsNone(g.read('setpoint.current')['relative_humidity']) + self.assertIn('HUMIDITY_OFF', g.read('notifications.active')) + g.step(1200.0) + self.assertEqual(g.climate()['humidifier_ready'], 0.0) + g.call(g.A, 'function.set', humidity_control=True) + g.step(300.0) + self.assertLess(g.climate()['humidifier_ready'], 1.0) # up to 10 min until fully available + g.step(400.0) + self.assertEqual(g.climate()['humidifier_ready'], 1.0) + g.call(g.A, 'function.set', idle_mode=True) + g.step(600.0) + self.assertEqual(g.read('state.current'), 'idle') + self.assertEqual(g.read('truth.power')['heater'], 0.0) + g.call(g.A, 'function.set', idle_mode=False) + recs = g.call(g.A, 'log.read', last=20)['records'] + self.assertEqual(len(recs), 20) + self.assertAlmostEqual(recs[-1]['time_s'] - recs[-2]['time_s'], 120.0, delta=1e-6) + self.assertEqual(g.read('logger.settings')['interval_s'], 120.0) + g.call(g.A, 'power.set', on=False) + self.assertEqual(g.read('state.current'), 'off') + g.call(g.A, 'power.toggle') + self.assertTrue(g.read('power.on')) + _balance(self, g.ledger()) + + + def test_review_r1_fixes(self): + g = Rig() + g.call(g.A, 'power.set', on=True) + g.call(g.A, 'setpoint.set', temperature_k=T0 + 25.0, relative_humidity=0.60) + g.step(900.0) + self.assertEqual(g.read('truth.climate')['steam_kg_s'], 0.0) # E7: about 20 min before humidification + g.step(900.0) + self.assertGreater(g.read('truth.climate')['steam_kg_s'] + g.read('truth.climate')['humidifier_ready'], 0.0) + g.call(g.A, 'safety.configure', mode='limit', value_k=T0 + 45.0) # absolute limit accepted + g.call(g.A, 'safety.configure', mode='offset', value_k=40.0, expect='OUT_OF_LIMITS') + g.call(g.A, 'safety.configure', mode='offset', value_k=2.0) + g.call(g.A, 'setpoint.set', temperature_k=T0 + 40.0, relative_humidity=0.75, fan_fraction=0.4) # lowest documented fan speed + g.step(10 * 3600.0) + self.assertAlmostEqual(g.read('truth.climate')['relative_humidity'], 0.75, delta=0.035) + g.call(g.E, 'plant.configure', **dict(rt.PLANT_EXAMPLE, ambient_k=T0 + 35.0, pressure_pa=80000.0)) # re-referenced energy stays balanced + g.step(600.0) + _balance(self, g.call(g.E, 'ledger.read')['ledger']) + g.open() + g.call(g.A, 'sample.place', sample_id='h1', substance_id='inert', shelf=1, dry_mass_kg=1.0, initial_k=T0 + 40.0, heat_output_w=400.0) + g.call(g.A, 'sample.place', sample_id='h2', substance_id='inert', shelf=1, dry_mass_kg=1.0, initial_k=T0 + 40.0, heat_output_w=200.0, expect='HEAT_LOAD_LIMIT') + g.call(g.A, 'sample.remove', sample_id='h1') + g.call(g.A, 'sample.place', sample_id='suc', substance_id='d_sucrose', shelf=1, dry_mass_kg=0.010, initial_k=T0 + 25.0, + initial_water_kg=0.010 / rt.SORPTION['d_sucrose']['solution_branch']['solute_molar_mass_kg_mol']) # 1 mol/kg + g.close() + g.call(g.A, 'setpoint.set', temperature_k=T0 + 25.0, relative_humidity=0.30, fan_fraction=1.0) + g.step(2 * 86400.0) + b = rt.SORPTION['d_sucrose']['solution_branch'] + w_min = 0.010 / b['solute_molar_mass_kg_mol'] / b['molality_mol_kg'][-1] + self.assertGreater(g.read('truth.samples')['suc']['water_kg'], 0.9 * w_min) # stops at the most concentrated measured point + g.call(g.A, 'setpoint.set', temperature_k=T0 + 3.0, relative_humidity=0.60) + g.step(60.0) + self.assertIn('HUMIDITY_OFF', g.read('notifications.active')) # E7: humidity control off below 5 C + + + def test_review_r2_fixes(self): + g = Rig() + g.call(g.A, 'power.set', on=True) + g.call(g.A, 'function.set', humidity_control=False) + g.call(g.A, 'setpoint.set', temperature_k=T0 + 60.0, fan_fraction=1.0) # high heater load: integral released after the hold + g.step(6 * 3600.0) + self.assertAlmostEqual(g.read('truth.climate')['air_k'], T0 + 60.0, delta=0.1) + self.assertEqual(g.call(g.A, 'setpoint.set', temperature_k=T0 + 3.0)['chart_region'], 'dry') # same rule as chart.region + g.call(g.A, 'setpoint.set', temperature_k=T0 + 40.0, relative_humidity=0.5) + g.call(g.A, 'function.set', humidity_control=True) # after dry running: no second 20 min wait + g.step(700.0) + self.assertGreater(g.read('truth.climate')['humidifier_ready'], 0.9) + d = Rig() + d.run(50.0, 0.10) # dehumidification without temperature swings + xs = [] + for _ in range(180): + d.step(10.0) + xs.append(d.read('truth.climate')['air_k']) + self.assertLess(max(xs) - min(xs), 0.2) + w = Rig() + w.call(w.A, 'power.set', on=True) + w.call(w.A, 'setpoint.set', temperature_k=T0 + 30.0, relative_humidity=0.65, fan_fraction=0.4) # no overshoot trip at minimum fan + w.step(3600.0) + self.assertNotIn('SAFETY_CONTROLLER', w.read('alarms.active')) + c = Rig() + c.call(c.A, 'power.set', on=True) + c.call(c.A, 'function.set', humidity_control=False) + c.call(c.A, 'setpoint.set', temperature_k=T0 + 59.0) + c.step(6 * 3600.0) + c.call(c.A, 'setpoint.set', temperature_k=T0 + 61.0) # compressor stops: bumpless, no safety trip + peak = 0.0 + for _ in range(120): + c.step(10.0) + peak = max(peak, c.read('truth.climate')['air_k'] - T0 - 61.0) + self.assertLess(peak, 0.8) + self.assertNotIn('SAFETY_CONTROLLER', c.read('alarms.active')) + s = Rig() + s.run(40.0, 0.50, settle=3 * 3600.0) # start-up from the room: no false humidity alarm + self.assertNotIn('HUMIDITY_RANGE', s.read('alarms.active')) + + +class ZCoverage(unittest.TestCase): + def test_all_capabilities_exercised(self): + implemented = {k for k in rt.CAPS if k not in rt.UNSUPPORTED} + missing = implemented - SEEN_CAPS + if len(SEEN_CAPS) > 5: + self.assertFalse(missing, sorted(missing)) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_asset_biolin_mediuml.py b/tests/test_asset_biolin_mediuml.py new file mode 100644 index 0000000000000000000000000000000000000000..551ee825855d5643c77c1205ffa82ac62b0a8a48 --- /dev/null +++ b/tests/test_asset_biolin_mediuml.py @@ -0,0 +1,178 @@ +"""CHEM127 finite real-source Langmuir/Wilhelmy/deposition protocol regressions.""" +import copy,hashlib,importlib.util,json,math,sys,unittest +from pathlib import Path +from unittest import mock +import numpy as np +ROOT=Path(__file__).resolve().parents[1];sys.path.insert(0,str(ROOT/'scripts')) +from asset_runtime import biolin_mediuml as rt +OBSERVED=[] +def call(h,k,**a): + r=h.invoke(k,**a);OBSERVED.append((k,copy.deepcopy(a),copy.deepcopy(r)));return r +def setup(name='mediuml_test',plant=None,sample=None,substrate=False,preimmerse=False): + h=rt.BiolinMediumlRuntime(name) + for k,a in [('plant.configure',dict(rt.PLANT_EXAMPLE,**(plant or {}))),('subphase.load',rt.SUBPHASE_EXAMPLE),('power.set',{'enabled':True})]:call(h,k,**a) + if substrate or preimmerse: + call(h,'substrate.load',**rt.SUBSTRATE_EXAMPLE);call(h,'clamp.set',locked=True) + if preimmerse:call(h,'dipper.move',position_m=.119,speed_m_s=.0018);h.step(66.2) + call(h,'balance.tare');call(h,'solution.load',**dict(rt.SAMPLE_EXAMPLE,**(sample or {})));call(h,'film.spread',volume_m3=50e-9);h.step(4.) + return h +def finish(h,limit=300): + for _ in range(round(limit/.1)): + h.step(.1) + if h.phase!='running':break + return call(h,'acquisition.result') +def compress(h): + call(h,'method.configure',**rt.METHOD_EXAMPLE);call(h,'acquisition.start');return finish(h) +def deposition_ready(plant=None): + h=setup(plant=plant,preimmerse=True);m=dict(rt.METHOD_EXAMPLE,mode='hold',duration_s=100.) + call(h,'method.configure',**m);call(h,'acquisition.start');finish(h) + m.update(mode='deposition',duration_s=45.,dipper_positions_m=[.063]);call(h,'method.configure',**m);return h + +def cleanup(h): + if h.phase=='running':call(h,'acquisition.stop') + if h.control:call(h,'pressure.control',enabled=False,target_n_m=.02,speed_m_s=.0045) + if h.substrate: + call(h,'dipper.move',position_m=0.,speed_m_s=.0018);h.step(70.);call(h,'clamp.set',locked=False);call(h,'substrate.remove') + call(h,'film.clean');call(h,'solution.remove');call(h,'probe.move',distance_m=.04);call(h,'subphase.remove');call(h,'power.set',enabled=False) + +class TestMediumL(unittest.TestCase): + def rejected(self,h,k,error='.',**a): + before=copy.deepcopy(h.__dict__) + with self.assertRaisesRegex(rt.ActionRejected,error):h.invoke(k,**a) + self.assertEqual(before,h.__dict__) + def ledger(self,h): + x=call(h,'ledger.read') + for k in ['solute_error_mol','solute_error_kg','solvent_error_m3']:self.assertLess(abs(x[k]),1e-18,k) + self.assertLess(abs(x['subphase_error_kg']),1e-12);self.assertLess(abs(x['thermal_error_j']),1e-10);return x + def test_01_real_source_compression_and_same_number_area(self): + h=setup();n=h.surface_mol;r=compress(h);self.assertEqual(r['phase'],'succeeded');self.assertEqual(len(r['rows']),169);self.assertAlmostEqual(r['elapsed_s'],16.8);self.assertAlmostEqual(h.area,.016);self.assertEqual(h.surface_mol,n);a,p=rt.curve(h.reference);self.assertAlmostEqual(h._eos()[0],np.interp(h.area/n/rt.NA,a,p));self.assertGreater(r['rows'][-1]['surface_pressure_n_m'],r['rows'][0]['surface_pressure_n_m']);self.ledger(h) + def test_02_three_real_references_preserved_and_distinct(self): + lib=rt.library();ids=['statins2020_dmpc_control','statins2020_dmpe_control','statins2020_dmps_control'];pressures=[] + for rid in ids: + rec=copy.deepcopy(lib['substances'][rid]);h=setup(sample={'reference_id':rid});compress(h);pressures.append(h._eos()[0]);self.assertEqual(h.reference,rec);self.assertGreater(len(rec['values']['molecular_area_m2']),600);self.assertEqual(rec['conditions']['temperature_k'],294.15);self.assertEqual(h.source,json.dumps(rec['source'],ensure_ascii=False));self.ledger(h) + self.assertEqual(len(set(round(p,8) for p in pressures)),3);self.assertGreaterEqual(len(lib['substances']),46);self.assertEqual(sum(v.get('runtime_usable') is True for v in lib['substances'].values()),3) + def test_03_negative_noise_and_local_derivative_not_clipped(self): + rec=rt.library()['substances']['statins2020_dmpc_control'];a,p=rt.curve(rec);self.assertLess(min(p),0);found=False + for j in range(len(a)-1): + x=(a[j]+a[j+1])/2 + if x 0.99 and 0.85 < sc['efficiency'] < 1.05, sc) + cq = cq_of(h) + self.assertTrue(12.0 < cq[('A1', 'sybr_green')] < 17.0) + for r in range(3): + self.assertTrue(cq[(f'G{r + 1}', 'sybr_green')] is None or cq[(f'G{r + 1}', 'sybr_green')] > 34.0) + peaks = {p['well']: p['peaks_k'] for p in h.invoke('analysis.melt_peaks')['peaks']} + tm = rt.assays()['hs_gapdh']['melt_tm_k'] + rt.CHEM['melt_tm_offset_k'] # effective amplicon Tm in the reaction + self.assertEqual(len(peaks['A1']), 1) + self.assertAlmostEqual(peaks['A1'][0], tm, delta=1.0) + ex = h.invoke('data.export', kind='cq_csv') + self.assertEqual(ex['rows'], 21) + amp = h.invoke('data.amplification', wells=['A1', 'G1'])['curves'] + self.assertEqual([c['well'] for c in amp], ['A1', 'G1']) + self.assertEqual(len(amp[0]['rfu']), 40) + self.assertGreater(amp[0]['baseline_subtracted'][-1], 1000.0) # plateau of a 1e6-copy well + mc = h.invoke('data.melt', wells=['A1'])['curves'][0] + self.assertEqual(len(mc['temperature_k']), 61) + self.assertGreater(mc['rfu'][0], mc['rfu'][-1]) # dsDNA melts: SYBR signal falls + open_lid(h) + self.assertEqual(h.invoke('plate.remove')['plate_id'], 'p1') + self.assertFalse(h.read()['plate.loaded']) + self.assertEqual(h.read()['plates.on_bench'], ['p1']) + check('sybr_standard_curve', slope=sc['slope'], efficiency=sc['efficiency'], r2=sc['r2'], melt_peak=peaks['A1'][0]) + + def test_gene_expression_delta_delta_cq(self): + h = powered() + h.invoke('sample.provide', sample_id='ctrl', kind='template', copies_per_m3={'hs_gapdh': 2.5e13, 'hs_il6': 2.5e11}) + h.invoke('sample.provide', sample_id='lps', kind='template', copies_per_m3={'hs_gapdh': 2.5e13, 'hs_il6': 8.0e12}) + wells = [W(f'{row}{k + 1}', [a], sample=s, group=s) for row, s in (('A', 'ctrl'), ('B', 'lps')) for k, a in enumerate(['hs_gapdh', 'hs_gapdh', 'hs_il6', 'hs_il6'])] + run_plate(h, wells, scan='sybr_fam', melt=False) + res = h.invoke('analysis.gene_expression', reference_targets=['hs_gapdh'], control_group='ctrl')['results'] + il6 = {x['sample']: x for x in res if x['target'] == 'hs_il6'} + self.assertAlmostEqual(il6['ctrl']['delta_delta_cq'], 0.0, places=9) + self.assertTrue(16.0 < il6['lps']['relative_quantity'] < 64.0, il6['lps']) # 32-fold more IL-6 template + with self.assertRaises(rt.ActionRejected) as e: + h.invoke('analysis.gene_expression', reference_targets=['hs_gapdh'], control_group='nope') + self.assertEqual(str(e.exception), 'UNKNOWN_GROUP') + check('gene_expression', relative_quantity=il6['lps']['relative_quantity']) + + def test_brochure_probe_example(self): + h = powered() + h.invoke('sample.provide', sample_id='il1b', kind='template', copies_per_m3={'hs_il1b': 1e14}) + wells = [W(w, ['hs_il1b'], chem='probe', sample='il1b', tv=1e-9, vol=1e-8, rep=['fam']) for w in rt.WELLS] + run_plate(h, wells, scan='sybr_fam', melt=False, vol=1e-8) + v = np.array([c for c in cq_of(h).values() if c is not None]) + self.assertEqual(len(v), 96) + self.assertAlmostEqual(float(v.mean()), 19.81, delta=0.3) # Bulletin 7279 p.6: Cq 19.81 +- 0.10 + self.assertLess(float(v.std(ddof=1)), 0.2) + check('probe_example', mean=float(v.mean()), sd=float(v.std(ddof=1))) + + def test_five_plex_unmixing_crosstalk_and_competition(self): + dyes = [('hs_actb', 'fam'), ('hs_tbp', 'hex'), ('hs_gapdh', 'texas_red'), ('hs_b2m', 'cy5'), ('hs_hprt1', 'quasar_705')] + + def single(a, d, n): + h = powered() + h.invoke('sample.provide', sample_id='s', kind='template', copies_per_m3={a: n / 2e-9}) + run_plate(h, [W('A1', [a], chem='probe', sample='s', rep=[d])], melt=False) + return cq_of(h)[('A1', d)] + + def multi(pairs, copies): + h = powered() + h.invoke('sample.provide', sample_id='mix', kind='template', copies_per_m3={a: n / 2e-9 for (a, d), n in zip(pairs, copies) if n > 0}) + run_plate(h, [W('A1', [a for a, d in pairs], chem='probe', sample='mix', rep=[d for a, d in pairs])], melt=False) + return h, cq_of(h) + one = {d: single(a, d, 1e5) for a, d in dyes} + h, five = multi(dyes, [1e5] * 5) + for a, d in dyes: + self.assertAlmostEqual(five[('A1', d)], one[d], delta=0.6) # equal-abundance 5-plex: colour compensation recovers each dye + # crosstalk: the Texas Red target is absent; Cy5 bleeds into channel 3 (raw rise) but the unmixed Texas Red curve stays flat + h, three = multi([dyes[0], dyes[2], dyes[3]], [1e5, 0.0, 1e5]) + self.assertIsNone(three[('A1', 'texas_red')]) + raw3 = [rd['raw'][0][2] for rd in h.run['reads'] if rd['kind'] == 'amp'] + self.assertGreater(raw3[-1] - float(np.mean(raw3[2:8])), 100.0) + # competition: an abundant target (1e6) saturates the shared polymerase before a rare one (1e3) reaches the threshold (primer limiting is the fix) + h, duo = multi([dyes[0], dyes[3]], [1e6, 1e3]) + rare = single('hs_b2m', 'cy5', 1e3) + self.assertTrue(duo[('A1', 'cy5')] is None or duo[('A1', 'cy5')] > rare + 0.5) + check('five_plex', single=one, multi={d: five[('A1', d)] for a, d in dyes}, rare_single=rare, rare_with_abundant=duo[('A1', 'cy5')]) + + def test_inhibition_and_cycling_limits(self): + def cq(**kw): + h = powered() + h.invoke('sample.provide', sample_id='s', kind='template', copies_per_m3={'hs_hprt1': 5e13}, inhibitor=kw.pop('inh', 0.0)) + run_plate(h, [W('A1', ['hs_hprt1'], sample='s')], scan='sybr_fam', melt=False, **kw) + return cq_of(h)[('A1', 'sybr_green')], h + base, _ = cq() + inh, _ = cq(inh=0.4) + self.assertGreater(inh, base + 1.0) + low_den, _ = cq(denat=rt.assays()['hs_hprt1']['melt_tm_k'] + rt.CHEM['melt_tm_offset_k'] - 6.0) + self.assertIsNone(low_den) # the amplicon is never denatured + hot_anneal, _ = cq(anneal=rt.assays()['hs_hprt1']['primer_tm_k'] + 10.0) + self.assertTrue(hot_anneal is None or hot_anneal > base + 5.0) # the primers do not anneal + no_act, _ = cq(activation=0) + self.assertGreater(no_act, base + 0.3) # hot-start enzyme activated only during the first cycles + check('limits', base=base, inhibited=inh, no_activation=no_act) + + def test_annealing_gradient_direction_and_primer_dimer(self): + h = powered() + h.invoke('sample.provide', sample_id='s', kind='template', copies_per_m3={'hs_gapdh': 5e14}) + upper = round(rt.assays()['hs_gapdh']['primer_tm_k'] + 2.0 - 273.15) + 273.15 # near the optimum (primer Tm + 2 K) + steps = [dict(kind='temperature', temperature_k=368.15, hold_s=180.0), dict(kind='temperature', temperature_k=368.15, hold_s=10.0), + dict(kind='gradient', lower_k=upper - 10.0, upper_k=upper, hold_s=30.0, plate_read=True), dict(kind='goto', goto_step=2, cycles=39)] + wells = [] + for row in 'AH': + for k, dil in enumerate([1, 1e-1, 1e-2, 1e-3]): + for rep in range(3): + wells.append(W(f'{row}{3 * k + rep + 1}', ['hs_gapdh'], sample='s', dil=dil, stype='standard', q=1e6 * dil)) + run_plate(h, wells, scan='sybr_fam', extra=steps) + cq = cq_of(h) + eff = {} + for row in 'AH': + xs = np.repeat(np.log10([1e6, 1e5, 1e4, 1e3]), 3) + ys = np.array([cq[(f'{row}{c + 1}', 'sybr_green')] for c in range(12)]) + s = np.polyfit(xs, ys, 1)[0] + eff[row] = 10 ** (-1 / s) - 1 + self.assertGreater(eff['A'], eff['H'] + 0.02) # brochure GAPDH gradient: E 98.7 % at 62 C vs 93.6 % at 56 C + k = powered() + run_plate(k, [W(f'A{c + 1}', ['hs_gapdh'], stype='ntc') for c in range(3)], scan='sybr_fam', cycles=50) + pk = [p for p in k.invoke('analysis.melt_peaks')['peaks'] if p['peaks_k']] + self.assertTrue(pk) # late primer-dimer product in the NTC after 50 cycles + self.assertTrue(all(abs(x - rt.CHEM['pd_tm_k']) < 3.0 for p in pk for x in p['peaks_k'])) + check('gradient_dimer', efficiency=eff, ntc_peaks=len(pk)) + + def test_evaporation_scan_modes_and_faults(self): + h = powered() + h.invoke('sample.provide', sample_id='s', kind='template', copies_per_m3={'hs_gapdh': 5e13}) + run_plate(h, [W('A1', ['hs_gapdh'], sample='s')], seal='none', scan='sybr_fam', melt=False) + v = h.invoke('well.inspect', well='A1')['truth']['volume_m3'] + self.assertLess(v, 2e-8 * 0.995) # unsealed: water lost while hot + self.assertAlmostEqual(h.ledger()['water_evaporated_m3'], 2e-8 - v, delta=1e-15) + raw = h.run['reads'][0]['raw'][0] + self.assertIsNotNone(raw[0]) + self.assertTrue(all(x is None for x in raw[1:])) # fast scan: channel 1 only + k = powered() + k.invoke('fault.inject', fault='led_failure_channel_1', active=True) + run_plate(k, [W('A1', ['hs_gapdh'])], scan='sybr_fam', cycles=3, melt=False) + self.assertIn('LED_FAILURE_CHANNEL_1', k.read()['errors.active']) + self.assertTrue(k.read()['lamp.status_red']) + self.assertFalse(k.read()['lamp.status_blue'] or k.read()['lamp.status_green']) # one colour at a time: the error wins + k.invoke('fault.inject', fault='led_failure_channel_1', active=False) + self.assertFalse(k.read()['lamp.status_red']) + self.assertTrue(k.read()['lamp.status_blue']) # completed, lid not opened yet + m = powered() + open_lid(m) + m.invoke('fault.inject', fault='lid_obstructed', active=True) + m.invoke('lid.close') + m.step(10.0) + self.assertEqual(m.read()['lid.state'], 'stopped') + self.assertIn('LID_OBSTRUCTED', m.read()['errors.active']) + p = powered() + open_lid(p) + close_lid(p) + protocol(p, cycles=5, melt=False) + p.invoke('run.start', scan_mode='sybr_fam') + p.step(420.0) + reads0 = len(p.run['reads']) + p.invoke('fault.inject', fault='power_loss', active=True) # guide p.121: the run resumes when the power returns + self.assertEqual(p.read()['run.state'], 'power_failed') + self.assertEqual(p.read()['run.warnings'], ['POWER_FAILURE']) + self.assertFalse(any(p.read()[k] for k in ('lamp.status_green', 'lamp.status_blue', 'lamp.status_red'))) + p.step(300.0) + p.invoke('fault.inject', fault='power_loss', active=False) + self.assertEqual(p.read()['run.state'], 'lid_heating') + while p.run['state'] in ('lid_heating', 'running'): + p.step(60.0) + self.assertEqual(p.run['state'], 'completed') + self.assertEqual(p.run['cycle'], 5) + self.assertGreaterEqual(reads0, 1) + self.assertEqual(len(p.run['reads']), 5) # no read lost or duplicated by the outage + self.assertEqual(p.invoke('runs.list')['runs'][0]['warnings'], ['POWER_FAILURE']) + check('evaporation_scan_faults') + + +# ---------------------------------------------------------------- framework +class Framework(unittest.TestCase): + def test_read_describe_pure_and_clock(self): + h = powered() + h.register_principal('ag', 'agent') + v0 = h.read('evaluator') + h.session('ag').describe(instance_id=INST) + h.session('ag').read(instance_id=INST) + self.assertEqual(json.dumps(h.read('evaluator'), sort_keys=True), json.dumps(v0, sort_keys=True)) + t = h.invoke('sim.step', dt_s=2.25)['time_s'] + self.assertEqual(t, h.t) + check('pure_reads') + + def test_step_partition_independent(self): + def go(splits): + h = powered(seed=4) + open_lid(h) + h.invoke('sample.provide', sample_id='s', kind='template', copies_per_m3={'hs_gapdh': 5e13}) + h.invoke('plate.prepare', plate_id='p', plate_type='white_lowprofile_96', seal='optical_film', wells=[W('A1', ['hs_gapdh'], sample='s'), W('B2', ['hs_gapdh'])]) + h.invoke('plate.load', plate_id='p') + close_lid(h) + protocol(h, cycles=6) + h.invoke('run.start', scan_mode='all_channels') + for dt in splits(900.0): + h.step(dt) + mid = h.read('evaluator') + for dt in splits(1500.0): + h.step(dt) + return h, mid + a, am = go(lambda T: [T]) + b, bm = go(lambda T: [0.375] * int(T / 0.375)) # 0.375 s host steps (exact in binary, off the 0.1 s grid) + self.assertEqual(json.dumps(am, sort_keys=True), json.dumps(bm, sort_keys=True)) + self.assertEqual(json.dumps(a.read('evaluator'), sort_keys=True), json.dumps(b.read('evaluator'), sort_keys=True)) + self.assertEqual(json.dumps(a.run['reads'], sort_keys=True), json.dumps(b.run['reads'], sort_keys=True)) + self.assertEqual(json.dumps(a.ledger(), sort_keys=True), json.dumps(b.ledger(), sort_keys=True)) + check('step_partition') + + def test_conservation_ledgers(self): + h = powered() + h.invoke('sample.provide', sample_id='s', kind='template', copies_per_m3={'hs_gapdh': 5e13, 'hs_actb': 5e12}) + run_plate(h, [W('A1', ['hs_gapdh'], sample='s'), W('A2', ['hs_actb'], sample='s'), W('A3', ['hs_actb', 'hs_tbp'], chem='probe', sample='s', rep=['fam', 'hex'])], + cycles=30, melt=False) + L = h.ledger() + made = sum(float(h.N[i, j] - h.plates['p1']['wells'][w]['copies'][a]) for w in ('A1', 'A2', 'A3') for i in [rt.WIDX[w]] + for j, a in enumerate(h.plates['p1']['wells'][w]['assays'])) + self.assertAlmostEqual(L['amplicon_copies_made'], made, delta=1e-6 * made) + primers = float((h.p0 - h.P)[h.active].sum()) + self.assertAlmostEqual(L['primer_consumed_mol'] * rt.AVOGADRO / 2.0, primers, delta=1e-6 * primers) + self.assertGreater(L['electrical_energy_j'], L['lid_heater_energy_j']) + self.assertEqual(h.invoke('ledger.read')['ledger'], h.ledger()) + check('ledgers') + + def test_rejections_leave_state_unchanged(self): + h = powered() + v0 = json.dumps(h.read('evaluator'), sort_keys=True, default=str) + for cap, args in [('plate.load', dict(plate_id='none')), ('run.start', dict(scan_mode='all_channels')), ('run.pause', {}), ('run.resume', {}), + ('plate.remove', {}), ('analysis.cq', {}), ('protocol.set', dict(name='x', sample_volume_m3=0.0, lid_temperature_k=378.15, + steps=[dict(kind='goto', goto_step=1, cycles=2)]))]: + with self.assertRaises(rt.ActionRejected): + h.invoke(cap, **args) + self.assertEqual(json.dumps(h.read('evaluator'), sort_keys=True, default=str), v0) + check('rejections_pure') + + def test_agent_isolation_ownership_idempotency_and_cancel(self): + h = powered() + h.register_principal('ag', 'agent') + h.register_principal('ag2', 'agent') + s, s2 = h.session('ag'), h.session('ag2') + obs = s.read(instance_id=INST)['observations'] + self.assertFalse([k for k in obs if k.startswith('truth.')]) + self.assertEqual(s.invoke(instance_id=INST, capability_id='well.inspect', arguments=dict(well='A1'), request_id='x')['error']['code'], 'ACCESS_DENIED') + r1 = s.invoke(instance_id=INST, capability_id='lid.open', arguments={}, request_id='o') + self.assertEqual(r1['status'], 'succeeded') + self.assertEqual(s.invoke(instance_id=INST, capability_id='lid.open', arguments={}, request_id='o'), r1) + self.assertEqual(s.invoke(instance_id=INST, capability_id='lid.close', arguments={}, request_id='o')['error']['code'], 'REQUEST_CONFLICT') + h.step(7.0) + s.invoke(instance_id=INST, capability_id='plate.prepare', arguments=dict(plate_id='mine', plate_type='white_lowprofile_96', seal='optical_film', + wells=[W('A1', ['hs_gapdh'])]), request_id='p') + self.assertEqual(s2.invoke(instance_id=INST, capability_id='plate.load', arguments=dict(plate_id='mine'), request_id='l')['error']['code'], 'ACCESS_DENIED') + s.invoke(instance_id=INST, capability_id='plate.load', arguments=dict(plate_id='mine'), request_id='l') + s.invoke(instance_id=INST, capability_id='lid.close', arguments={}, request_id='c') + h.step(7.0) + s.invoke(instance_id=INST, capability_id='protocol.set', arguments=rt.PROTOCOL_EXAMPLE, request_id='pr') + st = s.invoke(instance_id=INST, capability_id='run.start', arguments=dict(scan_mode='sybr_fam'), request_id='r') + self.assertEqual(st['status'], 'accepted') + h.step(300.0) + self.assertEqual(s2.invoke(instance_id=INST, capability_id='run.pause', arguments={}, request_id='z')['error']['code'], 'ACCESS_DENIED') + self.assertEqual(s2.invoke(instance_id=INST, capability_id='analysis.cq', arguments={}, request_id='q')['error']['code'], 'ACCESS_DENIED') + self.assertEqual(s.poll(st['operation_id'])['status'], 'running') + with self.assertRaises(rt.ActionRejected): + s2.poll(st['operation_id']) + c = s.cancel(st['operation_id'], 'cx') + self.assertEqual(c['result']['phase'], 'cancelled') # protocol.md operation status + self.assertEqual(s.poll(st['operation_id'])['status'], 'cancelled') + self.assertEqual(h.read()['run.state'], 'stopped') + self.assertEqual(s.invoke(instance_id=INST, capability_id='user.login', arguments={}, request_id='u')['status'], 'unsupported') + check('isolation') + + def test_switch_lamps_skip_and_screen(self): + h = powered() + self.assertTrue(h.read()['power.enabled']) + h.invoke('power.press_switch') + self.assertFalse(h.read()['power.enabled']) + self.assertIsNone(h.read()['display.block_temperature_c']) + h.invoke('power.press_switch') + out = h.invoke('screen.tilt', angle_rad=40 * math.pi / 180) + self.assertAlmostEqual(h.read()['screen.tilt_rad'], 28 * math.pi / 180, places=9) + self.assertAlmostEqual(out['tilt_from_reference_rad'], h.read()['screen.tilt_rad'], places=12) + open_lid(h) + self.assertEqual(h.read()['lid.state'], 'open') + self.assertAlmostEqual(h.read()['lid.position_m'], rt.LID_TRAVEL) + close_lid(h) + protocol(h, extra=[dict(kind='temperature', temperature_k=368.15, hold_s=5.0), dict(kind='temperature', temperature_k=277.15)]) + h.invoke('run.start', scan_mode='sybr_fam') + while h.run['state'] == 'lid_heating': + h.step(1.0) + self.assertTrue(h.read()['lamp.status_green']) + h.invoke('run.pause') + self.assertTrue(h.read()['status_bar.flashing']) + h.invoke('run.resume') + h.step(120.0) + self.assertEqual(h.read()['run.step'], 2) # infinite hold at 4 C + self.assertIsNone(h.read()['run.remaining_s']) + h.invoke('run.skip_step') + self.assertEqual(h.read()['run.state'], 'completed') + self.assertTrue(h.read()['lamp.status_blue']) + open_lid(h) + self.assertFalse(h.read()['lamp.status_blue']) # blue until the lid is opened + self.assertEqual(len(h.invoke('runs.list')['runs']), 1) + self.assertTrue(h.invoke('events.read', since_s=0.0)['events']) + self.assertEqual(len(h.invoke('provenance.read')['libraries']), 3) + check('switch_lamps') + + +# ---------------------------------------------------------------- review round 1 (findings F-01..F-16, C-09) +class ReviewRound1(unittest.TestCase): + def test_reporters_need_spectra_and_empty_wells_and_end_point_runs(self): + h = powered() + open_lid(h) + with self.assertRaises(rt.ActionRejected) as e: # F-01: VIC has no FPbase spectra -> no channel response + h.invoke('plate.prepare', plate_id='v', plate_type='white_lowprofile_96', seal='optical_film', wells=[W('A1', ['hs_actb'], chem='probe', rep=['vic'])]) + self.assertEqual(str(e.exception), 'INVALID_REPORTERS') + h.invoke('sample.provide', sample_id='s', kind='template', copies_per_m3={'hs_gapdh': 5e13}) + out = h.invoke('plate.prepare', plate_id='p', plate_type='white_lowprofile_96', seal='none', + wells=[W('A1', []), W('A2', ['hs_gapdh'], sample='s'), W('A3', [], chem='probe')]) + self.assertEqual(out['warnings'], ['unsealed_plate_evaporation']) + h.invoke('plate.load', plate_id='p') + close_lid(h) + h.invoke('protocol.set', name='endpoint', sample_volume_m3=2e-8, steps=[dict(kind='temperature', temperature_k=368.15, hold_s=30.0), + dict(kind='temperature', temperature_k=368.15, hold_s=10.0), dict(kind='temperature', temperature_k=333.15, hold_s=30.0), dict(kind='goto', goto_step=2, cycles=9)]) + h.invoke('run.start', scan_mode='all_channels') + while h.run['state'] in ('lid_heating', 'running'): + h.step(60.0) # F-16: wells without assays do not break the reads + self.assertEqual(h.invoke('analysis.cq')['results'], []) # F-15: no amplification read -> empty results, no exception + self.assertEqual(h.invoke('data.amplification')['curves'], []) + self.assertEqual(h.invoke('analysis.standard_curve')['curves'], []) + self.assertEqual(h.invoke('data.export', kind='cq_csv')['rows'], 0) + k = powered() + open_lid(k) + k.invoke('plate.prepare', plate_id='q', plate_type='white_lowprofile_96', seal='optical_film', wells=[W('A1', []), W('B1', ['hs_gapdh'])]) + k.invoke('plate.load', plate_id='q') + close_lid(k) + protocol(k, cycles=3, melt=False) + k.invoke('run.start', scan_mode='sybr_fam') + while k.run['state'] in ('lid_heating', 'running'): + k.step(60.0) + amp = {c['well']: c for c in k.invoke('data.amplification')['curves']} + self.assertEqual(set(amp), {'A1', 'B1'}) # a SYBR well without primers still shows the dye background + self.assertAlmostEqual(amp['A1']['rfu'][0], amp['B1']['rfu'][0], delta=30.0) + check('robust_wells_and_reads') + + def test_operation_statuses_lid_idle_and_progress(self): + h = powered() + h.register_principal('ag', 'agent') + s = h.session('ag') + open_lid(h) + close_lid(h) + protocol(h, extra=[dict(kind='temperature', temperature_k=368.15, hold_s=5.0), dict(kind='temperature', temperature_k=277.15)]) + op = s.invoke(instance_id=INST, capability_id='run.start', arguments=dict(scan_mode='sybr_fam'), request_id='r')['operation_id'] + h.step(400.0) + v = h.read() + self.assertEqual((v['run.step'], v['run.remaining_s'], v['operation.progress']), (2, None, 1.0)) # F-11: waiting in the final infinite hold + self.assertEqual(v['setpoint.lid_k'], rt.LID_IDLE_K) # F-03: guide p.102, 31 C during an infinite hold below 30 C + self.assertAlmostEqual(v['sensor.lid_temperature_k'], rt.LID_IDLE_K, delta=0.5) + self.assertEqual(s.poll(op)['status'], 'running') + h.invoke('run.skip_step') + self.assertEqual(s.poll(op)['status'], 'succeeded') # F-02: protocol.md statuses + check('statuses_lid_idle_progress') + + def test_estimates_follow_the_thermal_path(self): + for prot, scan in ((rt.PROTOCOL_EXAMPLE, 'sybr_fam'), (dict(name='g', sample_volume_m3=0.0, steps=[dict(kind='temperature', temperature_k=368.15, hold_s=120.0), + dict(kind='temperature', temperature_k=368.15, hold_s=10.0), dict(kind='gradient', lower_k=328.15, upper_k=341.15, hold_s=30.0, plate_read=True), + dict(kind='goto', goto_step=2)]), 'all_channels')): + h = powered() + open_lid(h) + close_lid(h) + est = h.invoke('protocol.set', **prot)['estimated_duration_s'] + est = h._estimate(h.protocol, scan) + t0 = h.t + h.invoke('run.start', scan_mode=scan) + h.step(1500.0) + rem = h.read()['run.remaining_s'] + while h.run['state'] in ('lid_heating', 'running'): + h.step(30.0) + act = h.run['finished_s'] - t0 + self.assertLess(abs(est - act) / act, 0.02, (est, act)) # F-07: within 2 % + self.assertLess(abs(1500.0 + rem - act) / act, 0.02, (rem, act)) + check('estimates') + + def test_skip_in_a_goto_loop_and_protocol_editor(self): + h = powered() + open_lid(h) + close_lid(h) + p = h.invoke('protocol.set', name='defaults', sample_volume_m3=2e-8, steps=[dict(kind='temperature', temperature_k=368.15, hold_s=5.0), + dict(kind='temperature', temperature_k=333.149, hold_s=30.4, plate_read=True), dict(kind='temperature', temperature_k=345.15, hold_s=20.0), + dict(kind='goto', goto_step=1), dict(kind='gradient', lower_k=328.17, upper_k=335.13, hold_s=10.0)]) + st = h.protocol['steps'] + self.assertEqual((h.protocol['lid_temperature_k'], st[3]['cycles'], st[1]['temperature_k'], st[1]['hold_s']), (rt.LID_DEFAULT_K, 39, 333.15, 30.0)) + self.assertEqual((round(st[4]['lower_k'], 2), round(st[4]['upper_k'], 2)), (328.15, 335.15)) # F-10: 0.1 C rounding and the documented defaults + with self.assertRaises(rt.ActionRejected) as e: # Table 10: beep only on temperature steps + h.invoke('protocol.set', name='x', sample_volume_m3=0.0, steps=[dict(kind='gradient', lower_k=328.15, upper_k=335.15, hold_s=10.0, beep=True)]) + self.assertEqual(str(e.exception), 'INVALID_STEP') + with self.assertRaises(rt.ActionRejected) as e: + h.invoke('protocol.set', name='x', sample_volume_m3=5e-10, steps=[dict(kind='temperature', temperature_k=368.15, hold_s=5.0)]) + self.assertEqual(str(e.exception), 'INVALID_SAMPLE_VOLUME') + h.invoke('run.start', scan_mode='sybr_fam') + while not (h.run['state'] == 'running' and h.run['k'] == 1): + h.step(1.0) + h.invoke('run.skip_step') # guide p.122: inside a GOTO loop -> next cycle + self.assertEqual((h.run['k'], h.run['loops']), (0, {3: 1})) + self.assertEqual(len(h.run['reads']), 0) + check('skip_loop_editor') + + def test_primer_dimer_ntc_and_effective_melting(self): + h = powered() + dim = [a for a, v in rt.assays().items() if v['primer_dimer_score'] == 3][:3] + clean = [a for a, v in rt.assays().items() if v['primer_dimer_score'] == 1][:3] + run_plate(h, [W(f'A{c + 1}', [a], stype='ntc') for c, a in enumerate(dim + clean)], scan='sybr_fam') + cq = cq_of(h) + pk = {p['well']: p['peaks_k'] for p in h.invoke('analysis.melt_peaks')['peaks']} + late = [cq[(f'A{c + 1}', 'sybr_green')] for c in range(3)] # F-12: dimer-prone primers give a late NTC signal at the dimer Tm + self.assertGreaterEqual(sum(1 for x in late if x is not None and 35.0 < x < 40.5), 2, late) + for c in range(3): + self.assertTrue(pk[f'A{c + 1}'] and abs(pk[f'A{c + 1}'][0] - rt.CHEM['pd_tm_k']) < 3.0) + self.assertIsNone(cq[(f'A{c + 4}', 'sybr_green')]) + k = powered() + k.invoke('sample.provide', sample_id='s', kind='template', copies_per_m3={'hs_pou5f1': 5e13, 'hs_esr1': 5e13}) + run_plate(k, [W('A1', ['hs_pou5f1'], sample='s'), W('A2', ['hs_esr1'], sample='s'), W('A3', ['hs_esr1'], sample='s')], scan='sybr_fam') + cq = cq_of(k) + self.assertTrue(all(cq[(w, 'sybr_green')] is not None and cq[(w, 'sybr_green')] < 25.0 for w in ('A1', 'A2', 'A3'))) # F-06: GC-rich amplicons denature at 95 C + check('dimers_melting') + + +class ReviewRound2(unittest.TestCase): + def _run(self, h, prot, scan='sybr_fam'): + open_lid(h) + close_lid(h) + h.invoke('protocol.set', **prot) + h.invoke('run.start', scan_mode=scan) + + def test_outages_resume_the_interrupted_step(self): + prot = dict(name='p14', sample_volume_m3=2e-8, steps=[dict(kind='temperature', temperature_k=368.15, hold_s=30.0), dict(kind='temperature', temperature_k=368.15, hold_s=10.0), + dict(kind='temperature', temperature_k=333.15, hold_s=30.0, plate_read=True), dict(kind='goto', goto_step=2, cycles=13), + dict(kind='melt', start_k=338.15, end_k=343.15, melt_increment_k=0.5, hold_s=5.0)]) + h = powered() + self._run(h, prot) + while h.run['protocol']['steps'][h.run['k']]['kind'] != 'melt' if h.run['k'] < 5 else True: + h.step(10.0) + h.step(12.0) + h.invoke('fault.inject', fault='power_loss', active=True) + h.step(60.0) + h.invoke('fault.inject', fault='power_loss', active=False) + h.step(20.0) # still re-heating the lid ... + self.assertEqual(h.read()['run.state'], 'lid_heating') + h.invoke('fault.inject', fault='power_loss', active=True) # F2-01: ... when the second outage comes + h.step(60.0) + h.invoke('fault.inject', fault='power_loss', active=False) + while h.run['state'] in ('lid_heating', 'running'): + h.step(30.0) + amp = [x for x in h.run['reads'] if x['kind'] == 'amp'] + melt = [x for x in h.run['reads'] if x['kind'] == 'melt'] + self.assertEqual((h.run['state'], len(amp), len(melt), h.run['warnings']), ('completed', 14, 11, ['POWER_FAILURE', 'POWER_FAILURE'])) + k = powered() + self._run(k, prot) + k.step(500.0) + k.invoke('fault.inject', fault='power_loss', active=True) + k.invoke('power.press_switch') # F2-05: switched off during the outage -> the run ends + self.assertEqual(k.read('evaluator')['run.state'], 'stopped') + check('double_outage') + + def test_drifted_sensor_and_large_panels_and_export_guard(self): + h = powered() + h.invoke('fault.inject', fault='block_sensor_drift', active=True) # F2-02: calculated mode follows the (drifted) sensor - the run completes + self._run(h, dict(name='d', sample_volume_m3=2e-8, steps=[dict(kind='temperature', temperature_k=368.15, hold_s=10.0), + dict(kind='temperature', temperature_k=333.15, hold_s=10.0), dict(kind='goto', goto_step=1, cycles=2)])) + while h.run['state'] in ('lid_heating', 'running') and h.t < 3000.0: + h.step(30.0) + self.assertEqual(h.run['state'], 'completed') + k = powered() + open_lid(k) + targets = list(rt.assays())[:64] + k.invoke('sample.provide', sample_id='s', kind='standard', copies_per_m3={'hs_gapdh': 1.0}) + wells = [W(w, [a], stype='standard', sample='s', q=1.0) for w, a in zip(rt.WELLS, targets)] + k.invoke('plate.prepare', plate_id='panel', plate_type='white_lowprofile_96', seal='optical_film', wells=wells) + k.invoke('plate.load', plate_id='panel') + close_lid(k) + protocol(k, cycles=3, melt=False) + k.invoke('run.start', scan_mode='sybr_fam') + while k.run['state'] in ('lid_heating', 'running'): + k.step(60.0) + self.assertEqual(len(k.invoke('analysis.standard_curve')['curves']), 64) # F2-03: the schema allows one curve per target (validated by the wrapper) + m = powered() + m.register_principal('a1', 'agent') + m.register_principal('a2', 'agent') + s1, s2 = m.session('a1'), m.session('a2') + open_lid(m) + close_lid(m) + s1.invoke(instance_id=INST, capability_id='protocol.set', arguments=dict(name='t', sample_volume_m3=0.0, steps=[dict(kind='temperature', temperature_k=333.15, + hold_s=5.0, plate_read=True)]), request_id='p1') + s1.invoke(instance_id=INST, capability_id='run.start', arguments=dict(scan_mode='sybr_fam'), request_id='r1') + m.step(300.0) + s2.invoke(instance_id=INST, capability_id='run.start', arguments=dict(scan_mode='sybr_fam'), request_id='r2') + m.step(5.0) + out = s1.invoke(instance_id=INST, capability_id='data.export', arguments=dict(kind='cq_csv', run_id='R001'), request_id='x1') + self.assertEqual(out['status'], 'succeeded') # F2-06: exporting one's own finished run is not run control + check('drift_panels_export') + + def test_touchdown_after_a_skip_keeps_the_cycle_index(self): + h = powered() + self._run(h, dict(name='td', sample_volume_m3=0.0, steps=[dict(kind='temperature', temperature_k=368.15, hold_s=5.0), + dict(kind='temperature', temperature_k=343.15, hold_s=5.0, increment_k=-1.0, plate_read=True), dict(kind='temperature', temperature_k=345.15, hold_s=5.0), + dict(kind='goto', goto_step=1, cycles=3)])) + seen = [] + skipped = False + while h.run['state'] in ('lid_heating', 'running'): + h.step(0.1) + if h.run['state'] == 'running' and h.run['k'] == 1 and h.run['phase'] == 'hold' and (not seen or seen[-1][1] != h.run['loops'].get(3, 0)): + seen.append((float(h.run['target'][0]), h.run['loops'].get(3, 0))) + if len(seen) == 2 and not skipped: + h.invoke('run.skip_step') # skip the rest of cycle 2 + skipped = True + self.assertEqual([round(t, 2) for t, _ in seen], [343.15, 342.15, 341.15, 340.15]) # F2-04: increments follow the GOTO pass number + check('touchdown_skip') + + +class ReviewRound3(unittest.TestCase): + def test_calculated_temperature_restarts_after_an_outage(self): + h = powered() + open_lid(h) + close_lid(h) + h.invoke('protocol.set', name='c', sample_volume_m3=2e-8, steps=[dict(kind='temperature', temperature_k=368.15, hold_s=10.0), + dict(kind='temperature', temperature_k=333.15, hold_s=60.0, plate_read=True), dict(kind='goto', goto_step=1, cycles=1)]) + h.invoke('run.start', scan_mode='sybr_fam') + while not (h.run['state'] == 'running' and h.run['k'] == 1 and h.run['phase'] == 'hold'): + h.step(0.1) + h.step(5.0) + h.invoke('fault.inject', fault='power_loss', active=True) + h.step(7200.0) # 2 h outage: the block cools to the room + h.invoke('fault.inject', fault='power_loss', active=False) + self.assertAlmostEqual(h.read()['display.block_temperature_c'], rt.PLANT_EXAMPLE['room_k'] - 273.15, delta=0.3) # F3-01: not frozen at 60 C + while not (h.run['state'] == 'running' and h.run['phase'] == 'hold'): + h.step(0.1) + self.assertLess(abs(float(np.mean(h.run['calc_T'])) - 333.15), 0.3) # the resumed step waits for the modelled sample + self.assertLess(abs(float(np.mean(h.T_row)) - 333.15), 0.5) + while h.run['state'] in ('lid_heating', 'running'): + h.step(10.0) + self.assertEqual(h.run['state'], 'completed') + check('calc_restart') + + def test_foreign_agents_cannot_switch_off_during_an_outage_and_other_editor_rules(self): + h = powered() + h.register_principal('a1', 'agent') + h.register_principal('a2', 'agent') + s1, s2 = h.session('a1'), h.session('a2') + open_lid(h) + close_lid(h) + s1.invoke(instance_id=INST, capability_id='protocol.set', arguments=rt.PROTOCOL_EXAMPLE, request_id='p') + op = s1.invoke(instance_id=INST, capability_id='run.start', arguments=dict(scan_mode='sybr_fam'), request_id='r')['operation_id'] + h.step(300.0) + h.invoke('fault.inject', fault='power_loss', active=True) + for cap, args in (('power.set', dict(enabled=False)), ('power.press_switch', {})): # F3-02: no switching OFF of another agent's run + self.assertEqual(s2.invoke(instance_id=INST, capability_id=cap, arguments=args, request_id='x' + cap)['error']['code'], 'ACCESS_DENIED') + self.assertEqual(s1.poll(op)['status'], 'running') + for st in ([dict(kind='temperature', temperature_k=368.15, hold_s=5.0), dict(kind='goto', goto_step=1, cycles=2, beep=True)], + [dict(kind='melt', start_k=338.15, end_k=348.15, melt_increment_k=0.5, beep=True)]): + with self.assertRaises(rt.ActionRejected) as e: # F3-03: beep only on temperature steps + powered().invoke('protocol.set', name='b', sample_volume_m3=0.0, steps=st) + self.assertEqual(str(e.exception), 'INVALID_STEP') + k = powered() + k.invoke('sample.provide', sample_id='s', kind='template', copies_per_m3={'hs_gapdh': 5e13}) + run_plate(k, [W('A1', ['hs_gapdh'], sample='s')], scan='sybr_fam', cycles=3) + open_lid(k) + k.step(1200.0) # F3-04: the film holds the water also with the lid open + self.assertEqual(k.invoke('well.inspect', well='A1')['truth']['volume_m3'], 2e-8) + check('foreign_switch_beep_seal') + + +# ---------------------------------------------------------------- declared effects over scenarios +_SC = {} + + +def _build(name): + if name == 'fresh': + h = rt.BioradCfxOpusRuntime() + h.invoke('plant.configure', **rt.PLANT_EXAMPLE) + return h + if name == 'idle': + return powered() + if name == 'off': + h = powered() + h.invoke('power.set', enabled=False) + return h + if name == 'lid_open': + h = powered() + open_lid(h) + h.invoke('sample.provide', sample_id='sb', kind='template', copies_per_m3={'hs_gapdh': 5e13}) + h.invoke('plate.prepare', plate_id='pb', plate_type='white_lowprofile_96', seal='optical_film', wells=[W('A1', ['hs_gapdh'], sample='sb'), W('A2', ['hs_gapdh'])]) + return h + if name == 'loaded_open': + h = _scenario('lid_open') + h.invoke('plate.load', plate_id='pb') + return h + if name == 'ready': + h = _scenario('loaded_open') + close_lid(h) + protocol(h, cycles=4) + return h + if name == 'lid_heating': + h = _scenario('ready') + h.invoke('run.start', scan_mode='sybr_fam') + h.step(5.0) + return h + if name == 'running': + h = _scenario('lid_heating') + h.step(400.0) + return h + if name == 'paused': + h = _scenario('running') + h.invoke('run.pause') + return h + if name == 'melting': + h = _scenario('running') + while h.run['state'] == 'running' and h.run['protocol']['steps'][h.run['k']]['kind'] != 'melt': + h.step(10.0) + h.step(30.0) + return h + if name == 'completed': + h = _scenario('melting') + while h.run['state'] == 'running': + h.step(30.0) + return h + if name == 'obstructed': + h = _scenario('lid_open') + h.invoke('fault.inject', fault='lid_obstructed', active=True) + h.invoke('lid.close') + h.step(8.0) + return h + raise KeyError(name) + + +def _scenario(name): + if name not in _SC: + _SC[name] = _build(name) + return copy.deepcopy(_SC[name]) + + +SCENARIOS = ['fresh', 'idle', 'off', 'lid_open', 'loaded_open', 'ready', 'lid_heating', 'running', 'paused', 'melting', 'completed', 'obstructed'] +STEP_DTS = (0.5, 5.0, 60.0) + + +def _variants(cap): + V = { + 'plant.configure': [dict(rt.PLANT_EXAMPLE), dict(rt.PLANT_EXAMPLE, mains_voltage_v=60.0), dict(rt.PLANT_EXAMPLE, room_k=300.15)], + 'power.set': [dict(enabled=True), dict(enabled=False)], 'power.press_switch': [{}], 'lid.open': [{}], 'lid.close': [{}], + 'screen.tilt': [dict(angle_rad=0.6)], 'sample.provide': [dict(sample_id='sx', kind='template', copies_per_m3={'hs_actb': 1e12})], + 'plate.prepare': [dict(plate_id='px', plate_type='clear_lowprofile_96', seal='heat_seal', wells=[W('H12', ['hs_actb'])])], + 'plate.load': [dict(plate_id='pb')], 'plate.remove': [{}], 'protocol.set': [rt.PROTOCOL_EXAMPLE], + 'run.start': [dict(scan_mode='all_channels')], 'run.pause': [{}], 'run.resume': [{}], 'run.skip_step': [{}], + 'fault.inject': [dict(fault='lid_obstructed', active=True), dict(fault='power_loss', active=True), dict(fault='led_failure_channel_1', active=True), + dict(fault='fan_failure', active=True), dict(fault='block_sensor_drift', active=True), dict(fault='lid_obstructed', active=False)], + 'sim.step': [dict(dt_s=1.0)], + } + return V.get(cap, [copy.deepcopy(rt.CAPS[cap]['example_arguments'])]) + + +def _num(x): + return isinstance(x, (int, float)) and not isinstance(x, bool) + + +def _flat(v, prefix=''): + out = {} + if isinstance(v, dict): + for k, x in v.items(): + out.update(_flat(x, f'{prefix}.{k}')) + elif isinstance(v, list) and len(v) <= 128: + for i, x in enumerate(v): + out.update(_flat(x, f'{prefix}[{i}]')) + else: + out[prefix] = json.dumps(v, sort_keys=True, default=str) if isinstance(v, list) else v + return out + + +def _rel_changed(a, b, scale=None): + if _num(a) and _num(b): + return abs(a - b) > 1e-9 * (max(abs(a), abs(b)) if scale is None else scale) + 1e-300 + return _changed(a, b) + + +def _leaf_changed(a, b): + fa, fb = _flat(a), _flat(b) + return any(_rel_changed(fa.get(k, ''), fb.get(k, '')) for k in set(fa) | set(fb)) + + +def _step_differs(v1, a2, v0, b2): + f1, fa, f0, fb = _flat(v1), _flat(a2), _flat(v0), _flat(b2) + for leaf in set(f1) | set(fa) | set(f0) | set(fb): + x1, xa, x0, xb = (f.get(leaf, '') for f in (f1, fa, f0, fb)) + ca, cb = _rel_changed(x1, xa), _rel_changed(x0, xb) + if not (ca or cb): + continue + if ca and cb and all(_num(x) for x in (x1, xa, x0, xb)) and not _rel_changed(xa - x1, xb - x0, max(abs(x1), abs(xa), abs(x0), abs(xb))): + continue + if ca and cb and (x1, xa) == (x0, xb): + continue + if ca and cb and x1 == x0 and not _rel_changed(xa, xb): + continue + return True + return False + + +def _executable(cap): + return cap not in rt.UNSUPPORTED and rt.CAPS[cap]['kind'] not in ('query',) + + +class ZDeclaredEffects(unittest.TestCase): + def test_immediate_and_on_step_effects_are_declared(self): + missing_imm, missing_step = {}, {} + states = {n: _scenario(n) for n in SCENARIOS} + for cap in rt.CAPS: + if not _executable(cap): + continue + for sname, S in states.items(): + for args in _variants(cap): + A = copy.deepcopy(S) + v0 = A.read('evaluator') + try: + _orig_invoke(A, cap, **args) + except rt.ActionRejected: + continue + v1 = A.read('evaluator') + if cap == 'sim.step': + for k in v0: + if _leaf_changed(v0[k], v1[k]) and k not in rt.ON_STEP['sim.step'] + rt.EFFECTS['sim.step']: + missing_step.setdefault('sim.step', set()).add((sname, k)) + continue + for k in v0: + if _leaf_changed(v0[k], v1[k]) and k not in rt.EFFECTS.get(cap, []): + missing_imm.setdefault(cap, set()).add((sname, k)) + for dt in STEP_DTS: + A2, B2 = copy.deepcopy(A), copy.deepcopy(S) + A2.step(dt) + B2.step(dt) + a2, b2 = A2.read('evaluator'), B2.read('evaluator') + for k in v0: + if k not in rt.ON_STEP.get(cap, []) and _step_differs(v1[k], a2[k], v0[k], b2[k]): + missing_step.setdefault(cap, set()).add((sname, k)) + if k not in rt.ON_STEP['sim.step'] + ['clock.time_s'] and _leaf_changed(v0[k], b2[k]): + missing_step.setdefault('sim.step', set()).add((sname, k)) + self.maxDiff = None + self.assertEqual(missing_imm, {}) + self.assertEqual(missing_step, {}) + check('declared_effects_scenarios') + + def test_every_device_capability_is_accepted_in_some_scenario(self): + accepted = set() + for n in SCENARIOS: + S = _scenario(n) + for cap in rt.CAPS: + if not _executable(cap) or cap in accepted: + continue + for args in _variants(cap): + try: + _orig_invoke(copy.deepcopy(S), cap, **args) + accepted.add(cap) + break + except rt.ActionRejected: + pass + self.assertEqual({c for c in rt.CAPS if _executable(c)} - accepted, set()) + + +class ZZRejectionCodes(unittest.TestCase): + def test_every_observed_rejection_code_is_declared(self): + undeclared = {k: sorted(v - set(rt.CAP_ERRORS.get(k, [])) - {'INVALID_ARGUMENT', 'UNSUPPORTED', 'UNKNOWN_CAPABILITY'}) for k, v in REJECTIONS.items()} + self.assertEqual({k: v for k, v in undeclared.items() if v}, {}) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_asset_biorad_miniprotean.py b/tests/test_asset_biorad_miniprotean.py new file mode 100644 index 0000000000000000000000000000000000000000..175e1422fdf6df653b5e1cf329e36c313f1b712c --- /dev/null +++ b/tests/test_asset_biorad_miniprotean.py @@ -0,0 +1,1174 @@ +"""tests for CHEM-164 biorad_miniprotean: python3 -m unittest tests/test_asset_biorad_miniprotean.py + +Topics (pipeline.md): set points only write targets, read/describe are pure, rejected preconditions leave the state unchanged, two instances are +isolated, agent/evaluator truth isolation, conservation (charge, electrical energy -> heat, buffer volume, protein mass), real return values validated +against the declared schemas (asset_tool validate_value), asynchronous completion and cancellation, host-step independence, declared immediate and +on_step effects over scenario states; plus the electrophoresis physics against the manufacturer data: TGX SDS-PAGE start / final current per gel, run +time and buffer temperature at 100 / 200 / 300 V (bulletin 1658100 Tables 3.1-3.2), 200 V hand-cast Tris-HCl runs of 35-45 min (Tetra manual), +Precision Plus bands at the chart positions (TGX gels), 700 / 1000 mL buffer for 2 / 4 gels; PowerPac regulation (CV, CC crossover, 75 W limit), timer, +keys, display accuracy, error codes E1 / E2 / E7 / E9 / E5; cell circuit rules (lid interlock, leads, tape, buffer dam, companion module overheating), +reducing vs non-reducing samples, run-off, reversed polarity, overload broadening, smile, native PAGE of basic proteins, well overflow, dye-front +observation and prestained markers. +""" +import copy +import json +import math +import sys +import unittest +from pathlib import Path + +import numpy as np + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / 'scripts')) +sys.path.insert(0, str(ROOT / 'skills/chemistry-lab-assets/scripts')) +from asset_runtime import biorad_miniprotean as rt # noqa: E402 +import asset_tool # noqa: E402 + +CHECKS, PROCESS_EVIDENCE, REJECTIONS = [], {}, {} +_META = {} +INST = 'electrophoresis_01' +SDS = 'tris_glycine_sds_1x' +TGX = 'tgx_4_20_10w_30ul' + + +def _meta(): + if not _META: + _META.update(rt.export_biorad_miniprotean_contract_metadata()) + return _META + + +def _changed(a, b): + return json.dumps(a, sort_keys=True, default=str) != json.dumps(b, sort_keys=True, default=str) + + +_orig_invoke = rt.BioradMiniproteanRuntime.invoke + + +def _instrumented_invoke(self, capability_id, **a): + """Every successful call is checked against its declared output schema and immediate state effects (a call does not advance time); every + rejection code is recorded for the declaration check.""" + before = self.read('evaluator') if capability_id != 'sim.step' else None + t0 = self.t + try: + out = _orig_invoke(self, capability_id, **a) + except rt.ActionRejected as exc: + REJECTIONS.setdefault(capability_id, set()).add(str(exc)) + raise + meta = _meta()['capabilities'][capability_id] + errs = asset_tool.validate_value(out, meta['output_schema']) + if errs: + raise AssertionError(f'{capability_id} output violates its schema: {errs[:3]}') + if before is not None: + assert self.t == t0, capability_id + after = self.read('evaluator') + undeclared = {k for k in after if _changed(before[k], after[k])} - set(rt.EFFECTS.get(capability_id, [])) + if undeclared: + raise AssertionError(f'{capability_id} changed undeclared state immediately: {sorted(undeclared)}') + PROCESS_EVIDENCE.setdefault(capability_id, []).append(dict(arguments=copy.deepcopy(a), result_keys=sorted(out))) + return out + + +rt.BioradMiniproteanRuntime.invoke = _instrumented_invoke + + +def check(cid, **detail): + CHECKS.append(dict(check=cid, status='passed', **detail)) + + +def configured(seed=1, **plant): + h = rt.BioradMiniproteanRuntime() + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, noise_seed=seed, **plant)) + return h + + +def assembled(gel=TGX, n=2, buffer=SDS, outer=None, inner=None, samples=True, tape=False, dam=False, seed=1, temperature_k=295.15, **plant): + """Cell with n gels (positions 1..n; companion module for n > 2), buffer, marker in lane 1 and a test sample in lane 2 of gel 1, lid on, + leads connected, supply on and programmed 200 V / 400 mA untimed.""" + h = configured(seed, **plant) + h.invoke('leads.disconnect') + h.invoke('lid.remove') + if n > 2: + h.invoke('companion.install') + for i in range(n): + gid = f'g{i + 1}' + h.invoke('gel.provide', gel_id=gid, gel_type=gel) + h.invoke('gel.prepare', gel_id=gid, remove_comb=True, remove_tape=not tape, rinse_wells=True) + h.invoke('gel.install', item=gid, position=i + 1) + if dam: + h.invoke('gel.install', item='buffer_dam', position=n + 1) + mods = 2 if n > 2 else 1 + h.invoke('buffer.fill', chamber='inner', buffer_id=buffer, volume_m3=inner or 150e-6 * mods, temperature_k=temperature_k) + h.invoke('buffer.fill', chamber='outer', buffer_id=buffer, volume_m3=outer or (680e-6 if n > 2 else 550e-6), temperature_k=temperature_k) + if samples: + h.invoke('sample.prepare', sample_id='marker', proteins_kg={}, marker='precision_plus_unstained', marker_volume_m3=10e-9, sample_buffer='laemmli_2x_reducing', + heat='95C_5min', volume_m3=20e-9) + h.invoke('sample.load', sample_id='marker', position=1, lane=1, volume_m3=10e-9) + h.invoke('sample.prepare', sample_id='s', proteins_kg=dict(bsa=2e-09, insulin_bovine=2e-09, lysozyme_hen=1e-09), marker=None, marker_volume_m3=0.0, + sample_buffer='laemmli_2x_reducing', heat='95C_5min', volume_m3=20e-9) + h.invoke('sample.load', sample_id='s', position=1, lane=2, volume_m3=10e-9) + h.invoke('lid.place') + h.invoke('leads.connect', polarity='normal') + h.invoke('power.set', enabled=True) + h.invoke('psu.program', constant='voltage', voltage_v=200.0, current_a=0.400, time_s=0.0, power_failure_detection=False) + return h + + +def run_to_front(h, gel='g1', dt=5.0, tmax=4 * 3600.0): + """Start and run until the dye front of `gel` reaches the reference line; returns (start current per gel A, final, run time s).""" + n = len(h._installed_gels()) + h.invoke('psu.start') + t0 = h.t + h.step(dt) + I0 = h.I / n + while h.gels[gel]['s'] < h.gels[gel]['L_run'] - 1e-6 and h.t - t0 < tmax and h.running: + h.step(dt) + return I0, h.I / n, h.t - t0 + + +class ContractAndLibraries(unittest.TestCase): + def test_module_identity_and_export(self): + meta = rt.export_biorad_miniprotean_contract_metadata() + self.assertEqual((rt.ASSET_TYPE_ID, rt.CATALOG_ID), ('instrument.biorad_miniprotean', 'CHEM-164')) + for k, c in meta['capabilities'].items(): + for sname in ('input_schema', 'output_schema'): + self.assertEqual(asset_tool.lint_schema(c[sname]) if hasattr(asset_tool, 'lint_schema') else [], [], (k, sname)) + self.assertEqual(asset_tool.validate_value(c['example_arguments'], c['input_schema']), [], k) + self.assertEqual(set(meta['state_slots']), set(rt.SLOTS)) + for k, v in rt.SLOTS.items(): + self.assertFalse(v['origin'] == 'process_truth' and v['visibility'] == 'agent', k) + check('export', capabilities=len(meta['capabilities']), slots=len(meta['state_slots'])) + + def test_template_libraries(self): + lib = rt.protein_lib() + prot = {k: v for k, v in lib['substances'].items() if v['kind'] == 'protein'} + self.assertGreaterEqual(len(prot), 50) + self.assertAlmostEqual(prot['bsa']['mass_da'] / 1000, 66.43, delta=0.05) # mature BSA (UniProt P02769 25-607) + self.assertAlmostEqual(prot['lysozyme_hen']['mass_da'] / 1000, 14.31, delta=0.02) + self.assertEqual(prot['insulin_bovine']['n_chains'], 2) + self.assertEqual(prot['insulin_bovine']['interchain_disulfides'], 2) + self.assertTrue(all(v['source'].startswith('UniProtKB') for v in prot.values())) + self.assertGreaterEqual(len(rt.gel_lib()['gels']), 100) + f = rt.model()['ferguson'] + self.assertLess(f['rms_mm'], 1.5) + self.assertEqual(f['n_bands'], 53) # Precision Plus bands of the six chart lanes + check('libraries', proteins=len(prot), gels=len(rt.gel_lib()['gels']), ferguson_rms_mm=f['rms_mm']) + + +class Electrophoresis(unittest.TestCase): + def test_manufacturer_run_conditions_tgx(self): + """bulletin 1658100 Tables 3.1 / 3.2: per gel start / final current, run time, temperature at 100, 200 and 300 V (tolerance 10 %).""" + rows = {} + for V, outer, I0r, I1r, tr, Tr in ((100.0, 550e-6, (15, 20), (5, 10), (85, 95), (23, 27)), (200.0, 550e-6, (25, 50), (20, 31), (30, 40), (25, 35)), + (300.0, 680e-6, (55, 75), (45, 70), (15, 20), None)): + h = assembled(outer=outer) + h.invoke('psu.program', constant='voltage', voltage_v=V, current_a=0.400, time_s=0.0, power_failure_detection=False) + I0, I1, t = run_to_front(h) + rows[V] = dict(I0_mA=I0 * 1e3, I1_mA=I1 * 1e3, t_min=t / 60, T_C=h.Tb - 273.15) + self.assertTrue(0.9 * I0r[0] <= I0 * 1e3 <= 1.1 * I0r[1], (V, rows[V])) + self.assertTrue(0.9 * I1r[0] <= I1 * 1e3 <= 1.1 * I1r[1], (V, rows[V])) + self.assertTrue(0.9 * tr[0] <= t / 60 <= 1.1 * tr[1], (V, rows[V])) + if Tr: + self.assertTrue(Tr[0] - 1 <= h.Tb - 273.15 <= Tr[1], (V, rows[V])) + check('manufacturer_tables', **{f'{int(k)}V': v for k, v in rows.items()}) + + def test_handcast_tris_hcl_200V_35_to_45_min(self): + """Tetra manual p.13: 35-45 min at 200 V for Tris-HCl gels, depending on the acrylamide percentage (every thickness).""" + mins = {} + for T in (4, 12, 17): + for th in ('0p75', '1p00', '1p50'): + h = assembled(gel=f'handcast_trishcl_{T}pct_{th}mm_10w') + I0, I1, t = run_to_front(h) + mins[f'{T}pct_{th}'] = t / 60 + self.assertTrue(35 <= t / 60 <= 45, (T, th, t / 60)) + self.assertLess(mins['4pct_1p00'], mins['12pct_1p00']) + self.assertLess(mins['12pct_1p00'], mins['17pct_1p00']) + check('handcast_200V', minutes=mins) + + def test_buffer_volumes_2_and_4_gels(self): + two, four = assembled(n=2), assembled(n=4) + self.assertAlmostEqual(two.read()['buffer.inner_m3'] + two.read()['buffer.outer_m3'], 700e-6, delta=1e-12) + self.assertAlmostEqual(four.read()['buffer.inner_m3'] + four.read()['buffer.outer_m3'], 980e-6, delta=30e-6) + I0, _, _ = run_to_front(four, gel='g3') + self.assertTrue(25e-3 <= I0 <= 55e-3, I0) # the per-gel current stays the same with 4 gels (manual: multiply) + check('buffer_volumes', four_gel_current_per_gel_mA=I0 * 1e3) + + def test_precision_plus_bands_at_the_chart_positions(self): + dig = json.loads((ROOT / 'outputs/expansion_batch03/t4_measure/biorad_miniprotean/migration_chart_digitized.json').read_text()) + worst = {} + for gel, key in (('tgx_4_20_10w_30ul', '4–20%'), ('tgx_7.5_10w_30ul', '7.5%'), ('tgx_12_10w_30ul', '12%'), ('tgx_any_kd_10w_30ul', 'Any kD')): + h = assembled(gel=gel) + run_to_front(h) + bands = {round(b['apparent_molar_mass_kg_mol'], 3): b for b in h.invoke('gel.inspect', gel_id='g1')['lanes'][0]['bands']} + lane = next(x for x in dig['sets']['precision_plus_unstained'] if x['gel'] == key) + err = [abs(bands[round(b['mw_kda'], 3)]['distance_m'] - (rt.STACK_LEN_M + b['rf'] * 0.062)) * 1e3 for b in lane['bands']] # mm + worst[key] = max(err) + self.assertLess(max(err), 3.5, key) + check('chart_positions', max_error_m={k: v * 1e-3 for k, v in worst.items()}) + + def test_reducing_splits_disulfide_linked_chains(self): + h = assembled(samples=False) + for sid, buf, lane in (('red', 'laemmli_2x_reducing', 1), ('nonred', 'laemmli_2x_nonreducing', 2)): + h.invoke('sample.prepare', sample_id=sid, proteins_kg=dict(insulin_bovine=3e-09, chymotrypsinogen_a_bovine=3e-09, concanavalin_a=3e-09), marker=None, + marker_volume_m3=0.0, sample_buffer=buf, heat='95C_5min', volume_m3=10e-9) + h.invoke('leads.disconnect') + h.invoke('lid.remove') + h.invoke('sample.load', sample_id='red', position=1, lane=1, volume_m3=10e-9) + h.invoke('sample.load', sample_id='nonred', position=1, lane=2, volume_m3=10e-9) + h.invoke('lid.place') + h.invoke('leads.connect', polarity='normal') + run_to_front(h, dt=5.0) + h.invoke('psu.stop') + lanes = h.invoke('gel.inspect', gel_id='g1')['lanes'] + red = {b['species']: b for b in lanes[0]['bands']} + nonred = {b['species']: b for b in lanes[1]['bands']} + self.assertEqual(sorted(k for k in red if k.startswith('insulin')), ['insulin_bovine:Insulin A chain', 'insulin_bovine:Insulin B chain']) # split + self.assertEqual([k for k in nonred if k.startswith('insulin')], ['insulin_bovine']) # held together by two disulfides + for pid in ('chymotrypsinogen_a_bovine', 'concanavalin_a'): # single chains: one ~25.6 kDa band either way + self.assertIn(pid, red) + self.assertIn(pid, nonred) + self.assertAlmostEqual(red[pid]['apparent_molar_mass_kg_mol'], 25.6, delta=0.2) + check('reducing', reduced=sorted(red), nonreduced=sorted(nonred)) + + def test_overrun_runs_small_proteins_off_and_peptides_ride_the_front(self): + h = assembled() + run_to_front(h) + lane2 = {b['species']: b for b in h.invoke('gel.inspect', gel_id='g1')['lanes'][1]['bands']} + self.assertGreater(lane2['insulin_bovine:Insulin A chain']['distance_m'], 0.95 * (rt.STACK_LEN_M + 0.062)) # at the dye front + h.step(40 * 60.0) # keep running 40 min past the front + lane2 = {b['species']: b for b in h.invoke('gel.inspect', gel_id='g1')['lanes'][1]['bands']} + self.assertEqual(lane2['lysozyme_hen']['state'], 'ran_off') + self.assertEqual(lane2['bsa']['state'], 'resolving') + self.assertGreater(h.ledger()['protein_run_off_kg'], 0.0) + check('run_off', run_off_kg=h.ledger()['protein_run_off_kg']) + + def test_reversed_polarity_loses_the_proteins_upward(self): + h = assembled() + h.invoke('leads.disconnect') + h.invoke('leads.connect', polarity='reversed') + h.invoke('psu.start') + h.step(600.0) + g = h.gels['g1'] + self.assertEqual(g['s'], 0.0) + self.assertTrue(all(b['state'] == 'upper_buffer' for bands in g['lanes'].values() for b in bands)) + self.assertGreater(h.ledger()['protein_upper_buffer_kg'], 0.0) + check('reversed') + + def test_overload_broadens_and_smile_grows_with_power(self): + light, heavy = assembled(samples=False), assembled(samples=False) + for h, ug in ((light, 1.0), (heavy, 40.0)): + h.invoke('leads.disconnect') + h.invoke('lid.remove') + h.invoke('sample.prepare', sample_id='x', proteins_kg=dict(bsa=ug * 1e-9), marker=None, marker_volume_m3=0.0, sample_buffer='laemmli_2x_reducing', heat='95C_5min', volume_m3=10e-9) + h.invoke('sample.load', sample_id='x', position=1, lane=5, volume_m3=10e-9) + h.invoke('lid.place') + h.invoke('leads.connect', polarity='normal') + run_to_front(h) + s1 = light.invoke('gel.inspect', gel_id='g1')['lanes'][4]['bands'][0]['sigma_m'] + s2 = heavy.invoke('gel.inspect', gel_id='g1')['lanes'][4]['bands'][0]['sigma_m'] + self.assertGreater(s2, 1.5 * s1) + cool, hot = assembled(), assembled(buffer='tris_glycine_sds_2x') + hot.invoke('psu.program', constant='voltage', voltage_v=300.0, current_a=0.400, time_s=0.0, power_failure_detection=False) + run_to_front(cool) + run_to_front(hot) + self.assertGreater(hot.gels['g1']['smile'], 5 * cool.gels['g1']['smile']) + self.assertGreater(hot.Tb, cool.Tb) + check('overload_smile', sigma_1ug_m=s1, sigma_40ug_m=s2, smile_cool=cool.gels['g1']['smile'], smile_hot=hot.gels['g1']['smile']) + + def test_native_page_basic_protein_needs_reversed_leads(self): + """bulletin p.12: strongly basic proteins do not enter a native TGX gel; reversing the jacks lets them migrate in; SDS-treated samples keep the + SDS mobility in a native buffer.""" + res = {} + for pol in ('normal', 'reversed'): + h = assembled(buffer='tris_glycine_native_1x', samples=False) + h.invoke('leads.disconnect') + h.invoke('lid.remove') + h.invoke('sample.prepare', sample_id='n', proteins_kg=dict(bsa=2e-09, lysozyme_hen=2e-09), marker=None, marker_volume_m3=0.0, sample_buffer='native_sample_buffer', + heat='none', volume_m3=10e-9) + h.invoke('sample.load', sample_id='n', position=1, lane=1, volume_m3=10e-9) + h.invoke('sample.prepare', sample_id='d', proteins_kg=dict(lysozyme_hen=2e-09), marker=None, marker_volume_m3=0.0, sample_buffer='laemmli_2x_reducing', + heat='95C_5min', volume_m3=10e-9) + h.invoke('sample.load', sample_id='d', position=1, lane=2, volume_m3=10e-9) + h.invoke('lid.place') + h.invoke('leads.connect', polarity=pol) + if pol == 'normal': + run_to_front(h) + else: + h.invoke('psu.start') + h.step(1800.0) + lanes = h.invoke('gel.inspect', gel_id='g1')['lanes'] + res[pol] = ({x['species']: x['state'] for x in lanes[0]['bands']}, {x['species']: x['state'] for x in lanes[1]['bands']}) + self.assertEqual(res['normal'][0]['lysozyme_hen'], 'upper_buffer') # pI 9.2: positive at pH 8.8, leaves toward the cathode, not into the gel + self.assertEqual(res['normal'][0]['bsa'], 'resolving') + self.assertEqual(res['normal'][1]['lysozyme_hen'], 'resolving') # SDS-treated: an anion whatever the running buffer + self.assertEqual(res['reversed'][0]['lysozyme_hen'], 'resolving') # reversed jacks: the cation migrates into the gel + self.assertEqual(res['reversed'][0]['bsa'], 'upper_buffer') + check('native', states=res) + + def test_well_overflow_contaminates_neighbours(self): + h = assembled(samples=False) + h.invoke('leads.disconnect') + h.invoke('lid.remove') + h.invoke('sample.prepare', sample_id='big', proteins_kg=dict(ovalbumin=5e-09), marker=None, marker_volume_m3=0.0, sample_buffer='laemmli_2x_reducing', heat='95C_5min', volume_m3=60e-9) + out = h.invoke('sample.load', sample_id='big', position=1, lane=5, volume_m3=50e-9) + self.assertAlmostEqual(out['loaded_m3'], 30e-9, delta=1e-18) # 10-well 30 uL comb + self.assertAlmostEqual(out['spilled_m3'], 20e-9, delta=1e-18) + self.assertTrue(h.gels['g1']['lanes'][4] and h.gels['g1']['lanes'][6]) + check('overflow') + + def test_observe_dye_front_and_prestained_markers(self): + h = assembled(samples=False) + h.invoke('leads.disconnect') + h.invoke('lid.remove') + h.invoke('sample.prepare', sample_id='pre', proteins_kg=dict(bsa=2e-09), marker='precision_plus_prestained', marker_volume_m3=10e-9, sample_buffer='laemmli_2x_reducing', + heat='95C_5min', volume_m3=20e-9) + h.invoke('sample.load', sample_id='pre', position=1, lane=1, volume_m3=20e-9) + h.invoke('lid.place') + h.invoke('leads.connect', polarity='normal') + h.invoke('psu.start') + h.step(900.0) + ob = h.invoke('gel.observe', position=1) + self.assertAlmostEqual(ob['dye_front_m'], h.gels['g1']['s'], delta=2.5e-3) + self.assertEqual(len(ob['visible_bands']), 10) # 10 prestained bands, BSA (unstained) invisible + check('observe', dye_front_m=ob['dye_front_m']) + + +class PowerSupplyAndCell(unittest.TestCase): + def test_regulation_cv_cc_and_power_limit(self): + h = assembled() + h.invoke('psu.program', constant='current', voltage_v=300.0, current_a=0.040, time_s=0.0, power_failure_detection=False) + h.invoke('psu.start') + h.step(10.0) + self.assertEqual(h.psu['active'], 'CC') + self.assertAlmostEqual(h.I, 0.040, delta=1e-12) + h.invoke('psu.stop') + h.invoke('psu.program', constant='voltage', voltage_v=300.0, current_a=0.050, time_s=0.0, power_failure_detection=False) + h.invoke('psu.start') + h.step(10.0) + self.assertEqual(h.psu['active'], 'CC') # crossover at the 50 mA limit + h.invoke('psu.stop') + k = assembled(buffer='tris_glycine_sds_10x', n=4) + k.invoke('psu.program', constant='voltage', voltage_v=300.0, current_a=0.400, time_s=0.0, power_failure_detection=False) + k.invoke('psu.start') + k.step(10.0) + self.assertEqual(k.psu['active'], 'CP') + self.assertAlmostEqual(k.V * k.I, rt.P_MAX_W, delta=1e-9) + check('regulation', cp_voltage=k.V, cp_current=k.I) + + def test_timer_keys_display_and_accuracy(self): + h = assembled() + h.invoke('psu.program', constant='voltage', voltage_v=200.0, current_a=0.400, time_s=120.0, power_failure_detection=False) + self.assertEqual(h.invoke('psu.press_key', key='display_mode')['display_mode'], 'mA') + h.invoke('psu.press_key', key='display_mode') + self.assertEqual(h.invoke('psu.press_key', key='up')['display_value'], 3) + h.invoke('psu.press_key', key='down') + h.invoke('psu.press_key', key='display_mode') # back to V + st = h.invoke('psu.press_key', key='run_pause') + self.assertEqual(st['state'], 'running') + h.step(30.0) + v = h.read()['display.value'] + self.assertLessEqual(abs(v - h.V), max(0.02 * h.V, 3.0) + 0.5) # displayed within the specified accuracy + h.invoke('psu.press_key', key='run_pause') + s0 = h.gels['g1']['s'] + h.step(60.0) + self.assertEqual(h.gels['g1']['s'], s0) # paused: no field + h.invoke('psu.press_key', key='run_pause') + h.step(200.0) + rec = h.records['EP0001'] + self.assertEqual(rec['status'], 'completed') + self.assertAlmostEqual(rec['run_time_s'], 120.0, delta=0.5) + check('timer_keys_display', displayed_v=v, true_v=h.V) + + def test_error_codes(self): + h = assembled() + h.invoke('fault.inject', fault='lead_break', active=True) + h.invoke('psu.start') + self.assertEqual(h.psu['error'], 'E1') # no load at the start + h.invoke('fault.inject', fault='lead_break', active=False) + h.invoke('psu.start') + h.step(5.0) + h.invoke('fault.inject', fault='lead_break', active=True) + h.step(1.0) + self.assertEqual(h.psu['error'], 'E9') # sudden change of the load + h.invoke('fault.inject', fault='lead_break', active=False) + h.invoke('psu.press_key', key='stop') + h.invoke('fault.inject', fault='short_circuit', active=True) + h.invoke('psu.start') + h.step(1.0) + self.assertEqual(h.psu['error'], 'E2') + h.invoke('fault.inject', fault='short_circuit', active=False) + h.invoke('psu.stop') + h.invoke('psu.start') + h.step(5.0) + h.invoke('power.press_switch') # switch off mid untimed run + h.invoke('power.press_switch') + self.assertEqual(h.psu['error'], 'E7') + k = assembled() + k.invoke('psu.program', constant='voltage', voltage_v=200.0, current_a=0.400, time_s=180.0, power_failure_detection=True) + k.invoke('psu.start') + k.step(30.0) + k.invoke('fault.inject', fault='power_loss', active=True) + k.step(30.0) + k.invoke('fault.inject', fault='power_loss', active=False) + k.step(200.0) + rec = k.records['EP0001'] + self.assertEqual((rec['status'], rec['error_codes']), ('completed', ['E5'])) # power failure detection: the timed run completed + check('error_codes') + + def test_circuit_rules_tape_dam_and_companion(self): + taped = assembled(tape=True) + taped.invoke('psu.start') + self.assertEqual(taped.psu['error'], 'E1') # the bottom tape of a precast cassette blocks the current + one = assembled(n=1, samples=False) # one gel without the buffer dam: the inner chamber drains + one.step(120.0) + self.assertLess(one.inner['electrode'], rt.INNER_CONTACT_M3) + one.invoke('psu.start') + self.assertEqual(one.psu['error'], 'E1') + dam = assembled(n=1, dam=True, samples=False) + dam.step(120.0) + dam.invoke('psu.start') + self.assertEqual(dam.psu['state'], 'running') + hot = assembled(samples=False) + hot.invoke('leads.disconnect') + hot.invoke('lid.remove') + hot.invoke('companion.install') # 2 gels with the companion module in the tank + hot.invoke('lid.place') + hot.invoke('leads.connect', polarity='normal') + ref = assembled(samples=False) + for x in (hot, ref): + x.invoke('psu.start') + x.step(600.0) + self.assertGreater(hot.I, 3 * ref.I) # the open companion module is a buffer path between its electrodes + self.assertGreater(hot.Tb, ref.Tb + 2.0) # excessive heat (manual caution) + self.assertGreater(hot.V * hot.I, 3 * ref.V * ref.I) + with self.assertRaises(rt.ActionRejected): + ref.invoke('lid.remove') # leads still in the supply + hot.invoke('psu.stop') + hot.invoke('leads.disconnect') + hot.invoke('lid.remove') + self.assertFalse(hot.invoke('companion.remove')['companion']) + check('circuit_rules', companion_current_A=hot.I, ref_current_A=ref.I) + + def test_cold_buffer_and_room_cooling(self): + h = assembled(temperature_k=277.15, samples=False) + Ct, Cb = rt.M_TANK_KG * rt.CP_PC, 700e-6 * rt.RHO_W * rt.CP_W + self.assertAlmostEqual(h.Tb, (Ct * 295.15 + Cb * 277.15) / (Ct + Cb), delta=1e-9) # pre-chilled buffer mixes with the room-temperature tank + h.step(3600.0) + self.assertGreater(h.Tb, 277.15) + self.assertLess(h.Tb, 295.15) + check('cold_buffer', T_after_1h=h.Tb) + + +class ReviewFindings(unittest.TestCase): + """Behaviour fixed after the independent runtime review round 1 (F-01 ... F-M13).""" + + def test_power_loss_holds_the_supply_off_and_e5_is_displayed(self): + h = assembled() + h.register_principal('ag', 'agent') + s = h.session('ag') + h.invoke('psu.program', constant='voltage', voltage_v=200.0, current_a=0.400, time_s=600.0, power_failure_detection=True) + h.invoke('psu.start') + h.step(100.0) + h.invoke('fault.inject', fault='power_loss', active=True) + r = s.invoke(instance_id=INST, capability_id='power.set', arguments=dict(enabled=True), request_id='on') + self.assertEqual((r['status'], r['error']['code']), ('rejected', 'MAINS_OUT_OF_RANGE')) # no mains: the supply cannot be switched on + ev = s.invoke(instance_id=INST, capability_id='events.read', arguments=dict(since_s=0.0), request_id='ev')['result']['events'] + self.assertEqual([e['code'] for e in ev if e['kind'] == 'power'][-1], 'POWER_OFF') # the agent sees a dark panel, not the cause + self.assertIsNone(h.read()['psu.active_mode']) + s_out = h.gels['g1']['s'] + h.step(50.0) + self.assertEqual(h.gels['g1']['s'], s_out) # no field during the outage + h.invoke('fault.inject', fault='power_loss', active=False) # mains back, switch still on: automatic restart + self.assertTrue(h.power) + h.step(700.0) + rec = h.records['EP0001'] + self.assertEqual((rec['status'], rec['error_codes'], rec['run_time_s']), ('completed', ['E5'], 600.0)) + self.assertEqual(h.read()['display.error_code'], 'E5') # manual 4.2: E5 displayed, run completed + self.assertIsNone(h.read()['display.value']) + h.invoke('psu.press_key', key='display_mode') # any key clears the code + self.assertIsNone(h.read()['display.error_code']) + self.assertFalse(h.psu['pfd']) # Pfd is de-activated after the run + check('power_loss_e5') + + def test_e9_hold_resumes_the_interrupted_run(self): + h = assembled() + h.invoke('psu.program', constant='voltage', voltage_v=200.0, current_a=0.400, time_s=1800.0, power_failure_detection=False) + h.invoke('psu.start') + h.step(1500.0) + h.invoke('fault.inject', fault='lead_break', active=True) + h.step(10.0) + self.assertEqual((h.psu['state'], h.read()['display.error_code']), ('error', 'E9')) + self.assertEqual(h.records['EP0001']['status'], 'running') # held, not ended + h.invoke('fault.inject', fault='lead_break', active=False) + st = h.invoke('psu.press_key', key='run_pause') # manual 4.2: run/pause resumes the run + self.assertEqual((st['state'], st['operation_id']), ('running', 'op0001')) + h.step(400.0) + rec = h.records['EP0001'] + self.assertEqual(list(h.records), ['EP0001']) + self.assertEqual((rec['status'], rec['run_time_s'], rec['error_codes']), ('completed', 1800.0, ['E9'])) + k = assembled() + k.invoke('psu.start') + k.step(60.0) + k.invoke('fault.inject', fault='short_circuit', active=True) + k.step(1.0) + self.assertEqual(k.read()['display.error_code'], 'E2') + k.invoke('fault.inject', fault='short_circuit', active=False) + k.invoke('psu.press_key', key='up') # any other key clears the code and ends the run + self.assertEqual((k.psu['state'], k.records['EP0001']['status'], k.records['EP0001']['error_codes']), ('stopped', 'error', ['E2'])) + check('e9_resume') + + def test_standard_300V_smile_is_small_and_lanes_stay_in_the_gel(self): + h = assembled(n=4, outer=680e-6) + h.invoke('psu.program', constant='voltage', voltage_v=300.0, current_a=0.400, time_s=0.0, power_failure_detection=False) + h.invoke('leads.disconnect') + h.invoke('lid.remove') + h.invoke('sample.prepare', sample_id='m5', proteins_kg={}, marker='precision_plus_unstained', marker_volume_m3=10e-9, sample_buffer='laemmli_2x_reducing', + heat='95C_5min', volume_m3=10e-9) + h.invoke('sample.load', sample_id='m5', position=1, lane=5, volume_m3=10e-9) + h.invoke('lid.place') + h.invoke('leads.connect', polarity='normal') + run_to_front(h) + h.invoke('psu.stop') + ins = h.invoke('gel.inspect', gel_id='g1') + self.assertLess(ins['smile_fraction'], 0.015) + res = ins['resolving_height_m'] + front = ins['dye_front_m'] + for lane in ins['lanes']: + inside = [b for b in lane['bands'] if b['state'] == 'resolving'] + for b in inside: + self.assertLess(b['distance_m'], rt.STACK_LEN_M + res) # no band below the gel bottom + # the profile holds every band that is not cut by the gel end (bands riding the front at the bottom lose their tail only) + clear = [b for b in inside if b['distance_m'] - rt.STACK_LEN_M < res - 3 * b['sigma_m']] + mass = sum(b['amount_kg'] for b in clear) + if clear and len(clear) == len(inside): + self.assertGreater(sum(lane['profile']) / mass, 0.99, lane['lane']) + self.assertLessEqual(front, rt.STACK_LEN_M + res + 1e-12) + check('smile_300V', smile=ins['smile_fraction']) + + def test_overheating_is_bounded_and_flagged(self): + h = assembled(n=4, outer=680e-6) + h.invoke('psu.program', constant='voltage', voltage_v=300.0, current_a=0.400, time_s=0.0, power_failure_detection=False) + h.invoke('psu.start') + h.step(3 * 3600.0) + self.assertLessEqual(h.Tb, rt.BOIL_K + 1e-9) + self.assertLessEqual(max(g['T'] for g in h._installed_gels()), rt.BOIL_K + 1e-9) + rec = h.records['EP0001'] + self.assertIn('buffer_boiling', rec['warnings']) # visible to the operator + self.assertNotIn('buffer_hot', rec['warnings']) + codes = {e['code'] for e in h.invoke('events.read', since_s=0.0)['events']} + self.assertTrue({'BUFFER_HOT', 'GEL_OVERHEATED'} <= codes) # evaluator view + h.register_principal('ag', 'agent') + seen = {e['code'] for e in h.session('ag').invoke(instance_id=INST, capability_id='events.read', arguments=dict(since_s=0.0), request_id='e')['result']['events']} + self.assertFalse({'BUFFER_HOT', 'GEL_OVERHEATED'} & seen) # temperatures are not displayed to the agent + ins = h.invoke('gel.inspect', gel_id='g1') + self.assertTrue(ins['heat_damaged']) + L = h.ledger() + C = h._heat_capacity() + self.assertGreater(L['output_energy_j'], L['heat_to_room_j']) + check('overheat', T_buffer_C=h.Tb - 273.15, warnings=rec['warnings'], evaporated_m3=L['buffer_evaporated_m3'], C=C) + + def test_native_table_4_1_both_rows(self): + rows = {} + for gel, (I0r, I1r, tr, Tr) in (('tgx_7.5_10w_30ul', ((35, 37), (17, 20), (38, 40), (28, 30))), ('tgx_4_20_10w_30ul', ((50, 55), (25, 28), (30, 34), (30, 33))), + ('tgx_any_kd_10w_30ul', ((50, 55), (25, 28), (30, 34), (30, 33)))): + h = assembled(gel=gel, n=1, dam=True, buffer='tris_glycine_native_1x', samples=False) + I0, I1, t = run_to_front(h, dt=2.0) + Tg = h.gels['g1']['T'] - 273.15 + rows[gel] = dict(I0_mA=I0 * 1e3, I1_mA=I1 * 1e3, t_min=t / 60, T_gel_C=Tg) + self.assertTrue(0.97 * I0r[0] <= I0 * 1e3 <= 1.03 * I0r[1], rows[gel]) + self.assertTrue(0.95 * I1r[0] <= I1 * 1e3 <= 1.05 * I1r[1], rows[gel]) + self.assertTrue(tr[0] - 1 <= t / 60 <= tr[1] + 1, rows[gel]) + self.assertTrue(Tr[0] - 1 <= Tg <= Tr[1] + 1, rows[gel]) + check('native_table_4_1', rows=rows) + + def test_tgx_formats_share_the_manufacturer_tables(self): + t = {} + for gel in ('tgx_4_20_10w_30ul', 'tgx_4_20_10w_50ul'): + h = assembled(gel=gel) + h.invoke('psu.program', constant='voltage', voltage_v=100.0, current_a=0.400, time_s=0.0, power_failure_detection=False) + I0, I1, tt = run_to_front(h) + t[gel] = tt / 60 + self.assertTrue(85 * 0.97 <= tt / 60 <= 95, (gel, tt / 60)) + k = assembled(gel='tgx_4_20_10w_50ul', n=4, outer=680e-6) + k.invoke('psu.program', constant='voltage', voltage_v=300.0, current_a=0.400, time_s=0.0, power_failure_detection=False) + k.invoke('psu.start') + k.step(2.0) + self.assertTrue(55e-3 <= k.I / 4 <= 75e-3, k.I / 4) + check('tgx_formats', run_min_100V=t, start_300V_per_gel_A=k.I / 4) + + def test_protein_ledger_on_reinstall_and_edge_overflow(self): + h = assembled(samples=False) + h.invoke('leads.disconnect') + h.invoke('lid.remove') + h.invoke('sample.prepare', sample_id='e', proteins_kg=dict(bsa=6e-09), marker=None, marker_volume_m3=0.0, sample_buffer='laemmli_2x_reducing', heat='95C_5min', volume_m3=60e-9) + out = h.invoke('sample.load', sample_id='e', position=1, lane=1, volume_m3=60e-9) # 30 uL well at the gel edge + self.assertAlmostEqual(out['spilled_m3'], 30e-9, delta=1e-18) + L = h.ledger() + self.assertAlmostEqual(L['protein_loaded_kg'], L['protein_in_gels_kg'] + L['protein_spilled_kg'], delta=1e-21) + self.assertAlmostEqual(L['protein_spilled_kg'], 1.5e-9, delta=1e-21) # half over the gel edge into the buffer + h.invoke('lid.place') + h.invoke('leads.connect', polarity='normal') + h.invoke('psu.start') + h.step(600.0) + h.invoke('psu.stop') + h.invoke('leads.disconnect') + h.invoke('lid.remove') + h.invoke('buffer.drain') + h.invoke('gel.remove', position=1) + h.invoke('gel.install', item='g1', position=1) # the same gel back in + L = h.ledger() + sinks = L['protein_in_gels_kg'] + L['protein_on_bench_gels_kg'] + L['protein_run_off_kg'] + L['protein_upper_buffer_kg'] + L['protein_spilled_kg'] + self.assertAlmostEqual(L['protein_loaded_kg'], sinks, delta=1e-21) + self.assertEqual(L['protein_on_bench_gels_kg'], 0.0) + check('protein_ledger', ledger={k: v for k, v in L.items() if k.startswith('protein')}) + + def test_power_record_uses_displayed_readings(self): + vals = {} + for seed in (1, 3): + h = assembled(seed=seed) + h.invoke('psu.start') + h.step(60.0) + h.invoke('psu.stop') + r = h.records['EP0001'] + self.assertAlmostEqual(r['max_power_w'], round(r['max_voltage_v'] * r['max_current_a'], 1), delta=1e-9) + vals[seed] = r['max_power_w'] + self.assertNotEqual(vals[1], vals[3]) # carries the per-instrument display bias + check('power_record', max_power_w=vals) + + def test_step_partition_with_the_run_ending_inside_a_step(self): + a, b = assembled(seed=3), assembled(seed=3) + for h in (a, b): + h.invoke('psu.program', constant='voltage', voltage_v=200.0, current_a=0.400, time_s=600.0, power_failure_detection=False) + h.invoke('psu.start') + a.step(1200.0) + b.step(599.75) + b.step(600.25) + self.assertEqual(json.dumps(a.read('evaluator'), sort_keys=True), json.dumps(b.read('evaluator'), sort_keys=True)) + self.assertEqual(json.dumps(a.ledger(), sort_keys=True), json.dumps(b.ledger(), sort_keys=True)) + self.assertEqual(json.dumps(a.records, sort_keys=True), json.dumps(b.records, sort_keys=True)) + self.assertEqual(a.records['EP0001']['finished_s'], 600.0) # the tick time, not the step end + check('partition_run_end') + + def test_constant_change_needs_pause_and_key_started_runs_are_owned(self): + h = assembled() + h.register_principal('a1', 'agent') + h.register_principal('a2', 'agent') + s1, s2 = h.session('a1'), h.session('a2') + r = s1.invoke(instance_id=INST, capability_id='psu.press_key', arguments=dict(key='run_pause'), request_id='k') + oid = r['result']['operation_id'] + self.assertEqual(s1.poll(oid)['status'], 'running') + with self.assertRaises(rt.ActionRejected): + s2.poll(oid) + with self.assertRaises(rt.ActionRejected): + h.invoke('psu.program', constant='current', voltage_v=200.0, current_a=0.400, time_s=0.0, power_failure_detection=False) + s1.cancel(oid, 'c') + w = assembled(buffer='deionized_water') + w.register_principal('a1', 'agent') + w.register_principal('a2', 'agent') + w.session('a1').invoke(instance_id=INST, capability_id='psu.press_key', arguments=dict(key='run_pause'), request_id='k') + self.assertEqual(w.records['EP0001']['error_codes'], ['E1']) + lst = w.session('a2').invoke(instance_id=INST, capability_id='records.list', arguments={}, request_id='l')['result']['records'] + self.assertEqual(lst, []) # an immediate-E1 record still belongs to its caller + check('ownership') + + def test_first_tick_current_and_cold_buffer(self): + warm, cold = assembled(), assembled(temperature_k=277.15) + for h in (warm, cold): + h.invoke('psu.start') + h.step(0.5) + self.assertLess(cold.I, 0.8 * warm.I) # a gel in 4 C buffer conducts less + k = assembled(n=4, outer=680e-6) + k.invoke('psu.program', constant='voltage', voltage_v=300.0, current_a=0.400, time_s=0.0, power_failure_detection=False) + k.invoke('psu.start') + k.step(0.5) + self.assertTrue(55e-3 <= k.I / 4 <= 75e-3, k.I / 4) # Table 3.1 start current from the first tick + check('first_tick', warm_A=warm.I, cold_A=cold.I, start_300V_per_gel_A=k.I / 4) + + def test_comb_on_installed_gel_and_unrinsed_wells(self): + h = assembled(samples=False) + h.invoke('psu.start') + with self.assertRaises(rt.ActionRejected): + h.invoke('gel.prepare', gel_id='g1', remove_comb=True, remove_tape=False, rinse_wells=False) # installed, lid on, running + sig = {} + for rinse in (True, False): + k = configured() + k.invoke('leads.disconnect') + k.invoke('lid.remove') + for q in (1, 2): + k.invoke('gel.provide', gel_id=f'g{q}', gel_type=TGX) + k.invoke('gel.prepare', gel_id=f'g{q}', remove_comb=False, remove_tape=True, rinse_wells=False) + k.invoke('gel.install', item=f'g{q}', position=q) + k.invoke('buffer.fill', chamber='inner', buffer_id=SDS, volume_m3=150e-6, temperature_k=295.15) + k.invoke('buffer.fill', chamber='outer', buffer_id=SDS, volume_m3=550e-6, temperature_k=295.15) + k.invoke('lid.place') + with self.assertRaises(rt.ActionRejected): + k.invoke('gel.prepare', gel_id='g1', remove_comb=True, remove_tape=False, rinse_wells=False) # lid on + k.invoke('lid.remove') + for q in (1, 2): + k.invoke('gel.prepare', gel_id=f'g{q}', remove_comb=True, remove_tape=False, rinse_wells=rinse) + k.invoke('sample.prepare', sample_id='b', proteins_kg=dict(bsa=1e-09), marker=None, marker_volume_m3=0.0, sample_buffer='laemmli_2x_reducing', heat='95C_5min', volume_m3=10e-9) + k.invoke('sample.load', sample_id='b', position=1, lane=3, volume_m3=10e-9) + k.invoke('lid.place') + k.invoke('leads.connect', polarity='normal') + k.invoke('power.set', enabled=True) + k.invoke('psu.program', constant='voltage', voltage_v=200.0, current_a=0.400, time_s=0.0, power_failure_detection=False) + run_to_front(k) + sig[rinse] = k.invoke('gel.inspect', gel_id='g1')['lanes'][2]['bands'][0]['sigma_m'] + self.assertGreater(sig[False], 1.04 * sig[True]) # sigma0 x 1.2 at the start, diluted by the diffusion of the run + check('comb_rinse', sigma_m=sig) + + def test_companion_bypass_starves_the_gels(self): + ref = assembled() + hot = assembled() + hot.invoke('leads.disconnect') + hot.invoke('lid.remove') + hot.invoke('companion.install') + hot.invoke('lid.place') + hot.invoke('leads.connect', polarity='normal') + for x in (hot, ref): + x.invoke('psu.start') + x.step(1800.0) + self.assertLess(hot.gels['g1']['s'], 0.9 * ref.gels['g1']['s']) # the supply limits: less field across the gels + self.assertGreater(hot.Tb, ref.Tb + 10.0) + self.assertIn('companion_module_bypass', hot.records['EP0001']['warnings']) + check('bypass', front_hot_m=hot.gels['g1']['s'], front_ref_m=ref.gels['g1']['s'], T_hot_C=hot.Tb - 273.15) + + def test_observe_is_stable_for_an_unchanged_gel(self): + h = assembled() + h.invoke('psu.start') + h.step(600.0) + h.invoke('psu.stop') + reads = [] + for _ in range(20): + reads.append(h.invoke('gel.observe', position=1)['dye_front_m']) + h.step(10.0) + self.assertEqual(len(set(reads)), 1) # averaging repeated reads gains nothing + check('observe_stable', front_m=reads[0]) + + def test_round2_hold_ownership_rinse_profile_and_power_loss(self): + h = assembled() + h.register_principal('ag', 'agent') + h.register_principal('ev', 'evaluator') + a, e = h.session('ag'), h.session('ev') + r = a.invoke(instance_id=INST, capability_id='psu.start', arguments={}, request_id='s') + h.step(60.0) + h.invoke('fault.inject', fault='lead_break', active=True) + h.step(1.0) + h.invoke('fault.inject', fault='lead_break', active=False) + h.invoke('leads.disconnect') + h.invoke('lid.remove') + for cap, args in (('buffer.drain', {}), ('gel.remove', dict(position=2)), ('sample.load', dict(sample_id='s', position=1, lane=5, volume_m3=2e-9))): + with self.assertRaises(rt.ActionRejected): + h.invoke(cap, **args) # the held run is still open (F2-01) + h.invoke('lid.place') + h.invoke('leads.connect', polarity='normal') + e.invoke(instance_id=INST, capability_id='psu.start', arguments={}, request_id='resume') # the evaluator resumes the agent's run + self.assertEqual(a.poll(r['operation_id'])['status'], 'running') # the owner keeps poll / cancel (F2-02) + h.step(600.0) + h.invoke('fault.inject', fault='lead_break', active=True) + h.step(1.0) + h.invoke('power.set', enabled=False) # power lost during the E9 hold (F2-08) + h.invoke('fault.inject', fault='lead_break', active=False) + h.invoke('power.set', enabled=True) + self.assertEqual(h.read()['display.error_code'], 'E7') + self.assertEqual(h.records['EP0001']['status'], 'power_failed') + self.assertIn('power_failure_during_run', h.records['EP0001']['warnings']) + k = assembled(samples=True) + k.invoke('leads.disconnect') + k.invoke('lid.remove') + with self.assertRaises(rt.ActionRejected): + k.invoke('gel.prepare', gel_id='g1', remove_comb=False, remove_tape=False, rinse_wells=True) # samples loaded (F2-04) + k.invoke('lid.place') + k.invoke('leads.connect', polarity='normal') + k.invoke('psu.program', constant='voltage', voltage_v=300.0, current_a=0.400, time_s=0.0, power_failure_detection=False) + run_to_front(k) + k.invoke('psu.stop') + for lane in k.invoke('gel.inspect', gel_id='g1')['lanes']: + inside = sum(b['amount_kg'] for b in lane['bands'] if b['state'] == 'resolving') + self.assertAlmostEqual(sum(lane['profile']), inside, delta=1e-9 * max(inside, 1e-18)) # the profile holds every in-gel band (F2-05) + check('round2') + + def test_contract_review_power_codes_mains_bands_and_poll(self): + """PowerPac manual 4.2: E6 = mains failure in a timed run, E7 = untimed run or the switch turned off before stop; input 90-132 / 198-264 VAC.""" + for cause, code in (('mains', 'E6'), ('switch', 'E7')): + h = assembled() + h.invoke('psu.program', constant='voltage', voltage_v=200.0, current_a=0.400, time_s=600.0, power_failure_detection=False) + h.invoke('psu.start') + h.step(60.0) + if cause == 'mains': + h.invoke('fault.inject', fault='power_loss', active=True) + h.invoke('fault.inject', fault='power_loss', active=False) + else: + h.invoke('power.press_switch') + h.invoke('power.press_switch') + self.assertEqual(h.read()['display.error_code'], code, cause) + for v, ok in ((120.0, True), (133.0, False), (150.0, False), (198.0, True), (230.0, True), (60.0, False)): + k = configured(mains_voltage_v=v) + if ok: + self.assertTrue(k.invoke('power.set', enabled=True)['enabled']) + else: + with self.assertRaises(rt.ActionRejected): + k.invoke('power.set', enabled=True) + h = assembled(n=4, outer=680e-6) + h.register_principal('ag', 'agent') + a = h.session('ag') + h.invoke('psu.program', constant='voltage', voltage_v=300.0, current_a=0.400, time_s=0.0, power_failure_detection=False) + r = a.invoke(instance_id=INST, capability_id='psu.start', arguments={}, request_id='s') + h.step(3600.0) + res = a.poll(r['operation_id'])['result'] + self.assertFalse([k for k in res if k.startswith('_')]) # no evaluator-only flags in the agent's poll + self.assertEqual(asset_tool.validate_value(res, _meta()['capabilities']['measurement.result']['output_schema']), []) + check('power_codes_mains_poll') + + def test_reversed_field_moves_sds_bands_back(self): + h = assembled() + h.invoke('psu.start') + h.step(900.0) + h.invoke('psu.stop') + d0 = {b['species']: b['distance_m'] for b in h.invoke('gel.inspect', gel_id='g1')['lanes'][1]['bands'] if b['state'] == 'resolving'} + h.invoke('leads.disconnect') + h.invoke('leads.connect', polarity='reversed') + h.invoke('psu.start') + h.step(300.0) + h.invoke('psu.stop') + d1 = {b['species']: (b['distance_m'], b['state']) for b in h.invoke('gel.inspect', gel_id='g1')['lanes'][1]['bands']} + self.assertTrue(all(d1[k][1] == 'upper_buffer' or d1[k][0] < d0[k] for k in d0)) + check('reverse_back', before=d0) + + +class Framework(unittest.TestCase): + def test_read_describe_pure_and_clock(self): + h = assembled() + h.register_principal('ag', 'agent') + v0 = h.read('evaluator') + h.session('ag').describe(instance_id=INST) + h.session('ag').read(instance_id=INST) + self.assertEqual(json.dumps(h.read('evaluator'), sort_keys=True), json.dumps(v0, sort_keys=True)) + t = h.invoke('sim.step', dt_s=2.25)['time_s'] + self.assertEqual(t, h.t) + check('pure_reads') + + def test_step_partition_independent(self): + a, b = assembled(seed=3), assembled(seed=3) + for h in (a, b): + h.invoke('psu.start') + a.step(600.0) + for _ in range(240): + b.step(2.5) + ra, rb = a.read('evaluator'), b.read('evaluator') + for k in ra: + if isinstance(ra[k], float): + self.assertAlmostEqual(ra[k], rb[k], delta=1e-9 * max(1.0, abs(ra[k])), msg=k) + else: + self.assertEqual(ra[k], rb[k], k) + ia, ib = a.invoke('gel.inspect', gel_id='g1'), b.invoke('gel.inspect', gel_id='g1') + self.assertEqual(json.dumps(ia, sort_keys=True), json.dumps(ib, sort_keys=True)) + check('step_partition') + + def test_conservation(self): + h = assembled() + e0 = h.ledger() + run_to_front(h) + h.invoke('psu.stop') + L = h.ledger() + led_t0 = sum(len(g['runs']) for g in h.gels.values()) + self.assertGreater(L['charge_c'], 0) + rec = h.records['EP0001'] + self.assertTrue(0.3 * rec['max_current_a'] < L['charge_c'] / rec['run_time_s'] <= rec['max_current_a'] * 1.03) # mean current below the start maximum + C = h._heat_capacity() + self.assertAlmostEqual(L['output_energy_j'] - L['heat_to_room_j'], C * (h.Tb - 295.15), delta=1e-6 * L['output_energy_j'] + 1e-6) # Joule heat -> buffer + room + self.assertAlmostEqual(L['protein_loaded_kg'], L['protein_in_gels_kg'] + L['protein_run_off_kg'] + L['protein_upper_buffer_kg'] + L['protein_on_bench_gels_kg'], delta=1e-18) + self.assertAlmostEqual(L['buffer_added_m3'], 700e-6, delta=1e-12) + self.assertEqual(h.invoke('ledger.read')['ledger'], h.ledger()) + h.step(3600.0) + L2 = h.ledger() + self.assertEqual(L2['output_energy_j'], L['output_energy_j']) + self.assertAlmostEqual(L2['output_energy_j'] - L2['heat_to_room_j'], h._heat_capacity() * (h.Tb - 295.15), delta=1e-6 * L2['output_energy_j']) + self.assertTrue(led_t0 >= 2 and e0['charge_c'] == 0.0) + check('conservation', charge_c=L['charge_c'], energy_j=L['output_energy_j']) + + def test_rejections_leave_state_unchanged(self): + h = assembled() + v0 = json.dumps(h.read('evaluator'), sort_keys=True, default=str) + for cap, args in [('lid.remove', {}), ('gel.install', dict(item='g1', position=3)), ('sample.load', dict(sample_id='marker', position=1, lane=1, volume_m3=1e-9)), + ('buffer.fill', dict(chamber='outer', buffer_id=SDS, volume_m3=10e-6, temperature_k=295.15)), ('companion.install', {}), + ('psu.program', dict(constant='voltage', voltage_v=200.5, current_a=0.400, time_s=0.0, power_failure_detection=False)), + ('gel.provide', dict(gel_id='g1', gel_type=TGX)), ('sample.prepare', dict(rt.SAMPLE_EXAMPLE, proteins_kg=dict(nope=1e-09)))]: + with self.assertRaises(rt.ActionRejected): + h.invoke(cap, **args) + self.assertEqual(json.dumps(h.read('evaluator'), sort_keys=True, default=str), v0) + check('rejections_pure') + + def test_cancellation_and_gel_removal(self): + h = assembled() + h.register_principal('ag', 'agent') + s = h.session('ag') + r = s.invoke(instance_id=INST, capability_id='psu.start', arguments={}, request_id='run') + self.assertEqual(r['status'], 'accepted') + h.step(300.0) + s0 = h.gels['g1']['s'] + s.cancel(r['operation_id'], 'c') + self.assertEqual(s.poll(r['operation_id'])['status'], 'cancelled') + self.assertEqual(h.records['EP0001']['status'], 'stopped') + self.assertEqual(h.gels['g1']['s'], s0) # the migration so far is kept + h.invoke('leads.disconnect') + h.invoke('lid.remove') + with self.assertRaises(rt.ActionRejected): + h.invoke('gel.remove', position=1) # pour off the buffer first + h.invoke('buffer.drain') + h.invoke('gel.remove', position=1) + self.assertIn('g1', h.read()['gel.bench_ids']) + check('cancel_remove') + + def test_two_instances_isolated(self): + a, b = assembled(), assembled() + run_to_front(a) + self.assertEqual(b.records, {}) + self.assertEqual(b.gels['g1']['s'], 0.0) + check('isolation') + + def test_agent_truth_isolation_and_idempotence(self): + h = assembled() + h.register_principal('a1', 'agent') + h.register_principal('a2', 'agent') + h.register_principal('ev', 'evaluator') + s1, s2, e = h.session('a1'), h.session('a2'), h.session('ev') + obs = s1.read(instance_id=INST)['observations'] + self.assertFalse([k for k in obs if k.startswith('truth.') or k.startswith('psu.output')]) + self.assertIn('truth.buffer_temperature_k', e.read(instance_id=INST)['observations']) + self.assertEqual(s1.invoke(instance_id=INST, capability_id='gel.inspect', arguments=dict(gel_id='g1'), request_id='i')['error']['code'], 'ACCESS_DENIED') + r1 = s1.invoke(instance_id=INST, capability_id='psu.start', arguments={}, request_id='r') + self.assertEqual(s1.invoke(instance_id=INST, capability_id='psu.start', arguments={}, request_id='r'), r1) + self.assertEqual(s1.invoke(instance_id=INST, capability_id='psu.stop', arguments={}, request_id='r')['error']['code'], 'REQUEST_CONFLICT') + self.assertEqual(s2.invoke(instance_id=INST, capability_id='psu.stop', arguments={}, request_id='x')['error']['code'], 'ACCESS_DENIED') + h.step(60.0) + s1.invoke(instance_id=INST, capability_id='psu.stop', arguments={}, request_id='stop') + self.assertEqual(s2.invoke(instance_id=INST, capability_id='measurement.result', arguments=dict(record_id='EP0001'), request_id='m')['error']['code'], 'ACCESS_DENIED') + self.assertEqual(s1.read(instance_id=INST)['observations']['result.last_record_id']['value'], 'EP0001') + check('truth_isolation_idempotence') + + def test_queries_and_unsupported(self): + h = assembled() + run_to_front(h) + h.invoke('psu.stop') + self.assertEqual(h.invoke('records.list')['records'], ['EP0001']) + r = h.invoke('measurement.result', record_id='EP0001') + self.assertEqual(r['status'], 'stopped') + self.assertGreater(r['max_current_a'], 0) + self.assertTrue(h.invoke('events.read', since_s=0.0)['events']) + p = h.invoke('provenance.read') + self.assertEqual(len(p['libraries']), 3) + ins = h.invoke('gel.inspect', gel_id='g1') + self.assertEqual(len(ins['lanes']), 10) + self.assertEqual(len(ins['lanes'][0]['profile']), 200) + for k in rt.UNSUPPORTED: + with self.assertRaises(rt.ActionRejected): + h.invoke(k) + check('queries') + + +# ---------------------------------------------------------------- declared effects over scenario states +_SC = {} + + +def _build(name): + if name == 'fresh': + return rt.BioradMiniproteanRuntime() + if name == 'off': + return configured() + if name == 'open': + h = assembled() + h.invoke('leads.disconnect') + h.invoke('lid.remove') + return h + if name == 'ready': + return assembled() + if name == 'running': + h = assembled() + h.invoke('psu.start') + h.step(30.0) + return h + if name == 'paused': + h = _scenario('running') + h.invoke('psu.press_key', key='run_pause') + return h + if name == 'timed': + h = assembled() + h.invoke('psu.program', constant='voltage', voltage_v=200.0, current_a=0.400, time_s=60.0, power_failure_detection=True) + h.invoke('psu.start') + h.step(20.0) + return h + if name == 'done': + h = assembled() + run_to_front(h) + h.invoke('psu.stop') + return h + if name == 'error': + h = assembled() + h.invoke('fault.inject', fault='lead_break', active=True) + h.invoke('psu.start') + return h + if name == 'one_gel': + return assembled(n=1, samples=False) + if name == 'open_one': + h = assembled(n=1, samples=False) + h.invoke('leads.disconnect') + h.invoke('lid.remove') + return h + if name == 'drained': + h = _scenario('open') + h.invoke('buffer.drain') + return h + if name == 'open_companion': + h = _scenario('open') + h.invoke('companion.install') + return h + if name == 'unplugged': + h = assembled() + h.invoke('leads.disconnect') + return h + raise KeyError(name) + + +def _scenario(name): + if name not in _SC: + _SC[name] = _build(name) + return copy.deepcopy(_SC[name]) + + +SCENARIOS = ['fresh', 'off', 'open', 'ready', 'running', 'paused', 'timed', 'done', 'error', 'one_gel', 'open_one', 'unplugged', 'drained', 'open_companion'] +STEP_DTS = (0.5, 5.0, 60.0) + + +def _variants(cap): + V = { + 'plant.configure': [dict(rt.PLANT_EXAMPLE), dict(rt.PLANT_EXAMPLE, mains_voltage_v=60.0)], + 'power.set': [dict(enabled=True), dict(enabled=False)], 'power.press_switch': [{}], + 'psu.program': [dict(rt.PSU_EXAMPLE), dict(rt.PSU_EXAMPLE, constant='current', current_a=0.030, time_s=0.0)], + 'psu.press_key': [dict(key=k) for k in rt.PANEL_KEYS], 'psu.start': [{}], 'psu.stop': [{}], + 'lid.place': [{}], 'lid.remove': [{}], 'leads.connect': [dict(polarity='normal'), dict(polarity='reversed')], 'leads.disconnect': [{}], + 'companion.install': [{}], 'companion.remove': [{}], 'gel.provide': [dict(gel_id='new', gel_type=TGX)], + 'gel.prepare': [dict(gel_id='g1', remove_comb=True, remove_tape=True, rinse_wells=True), dict(gel_id='g1', remove_comb=True, remove_tape=False, rinse_wells=True)], + 'gel.install': [dict(item='buffer_dam', position=2), dict(item='buffer_dam', position=3)], 'gel.remove': [dict(position=1)], + 'buffer.fill': [dict(chamber='outer', buffer_id=SDS, volume_m3=50e-6, temperature_k=280.0), dict(chamber='inner', buffer_id=SDS, volume_m3=20e-6, temperature_k=295.15)], + 'buffer.drain': [{}], 'sample.prepare': [dict(rt.SAMPLE_EXAMPLE, sample_id='new')], + 'sample.load': [dict(sample_id='marker', position=1, lane=3, volume_m3=5e-9), dict(sample_id='s', position=1, lane=4, volume_m3=5e-9)], + 'fault.inject': [dict(fault=f, active=True) for f in ('power_loss', 'lead_break', 'inner_leak', 'short_circuit')] + [dict(fault='lead_break', active=False)], + 'sim.step': [dict(dt_s=0.5), dict(dt_s=30.0)], + } + return V.get(cap, []) + + +def _num(x): + return isinstance(x, (int, float)) and not isinstance(x, bool) + + +def _flat(v, prefix=''): + out = {} + if isinstance(v, dict): + for k, x in v.items(): + out.update(_flat(x, f'{prefix}.{k}')) + elif isinstance(v, list) and len(v) <= 128: + for i, x in enumerate(v): + out.update(_flat(x, f'{prefix}[{i}]')) + else: + out[prefix] = json.dumps(v, sort_keys=True, default=str) if isinstance(v, list) else v + return out + + +def _rel_changed(a, b, scale=None): + if _num(a) and _num(b): + return abs(a - b) > 1e-9 * (max(abs(a), abs(b)) if scale is None else scale) + 1e-300 + return _changed(a, b) + + +def _leaf_changed(a, b): + fa, fb = _flat(a), _flat(b) + return any(_rel_changed(fa.get(k, ''), fb.get(k, '')) for k in set(fa) | set(fb)) + + +def _step_differs(v1, a2, v0, b2): + f1, fa, f0, fb = _flat(v1), _flat(a2), _flat(v0), _flat(b2) + for leaf in set(f1) | set(fa) | set(f0) | set(fb): + x1, xa, x0, xb = (f.get(leaf, '') for f in (f1, fa, f0, fb)) + ca, cb = _rel_changed(x1, xa), _rel_changed(x0, xb) + if not (ca or cb): + continue + if ca and cb and all(_num(x) for x in (x1, xa, x0, xb)) and not _rel_changed(xa - x1, xb - x0, max(abs(x1), abs(xa), abs(x0), abs(xb))): + continue + if ca and cb and (x1, xa) == (x0, xb): + continue + if ca and cb and x1 == x0 and not _rel_changed(xa, xb): + continue + return True + return False + + +def _executable(cap): + return cap not in rt.UNSUPPORTED and rt.CAPS[cap]['kind'] not in ('query', 'analysis') + + +class ZDeclaredEffects(unittest.TestCase): + def test_immediate_and_on_step_effects_are_declared(self): + missing_imm, missing_step = {}, {} + states = {n: _scenario(n) for n in SCENARIOS} + for cap in rt.CAPS: + if not _executable(cap): + continue + for sname, S in states.items(): + for args in _variants(cap): + A = copy.deepcopy(S) + v0 = A.read('evaluator') + try: + _orig_invoke(A, cap, **args) + except rt.ActionRejected: + continue + v1 = A.read('evaluator') + if cap == 'sim.step': + for k in v0: + if _leaf_changed(v0[k], v1[k]) and k not in rt.ON_STEP['sim.step'] + rt.EFFECTS['sim.step']: + missing_step.setdefault('sim.step', set()).add((sname, k)) + continue + for k in v0: + if _leaf_changed(v0[k], v1[k]) and k not in rt.EFFECTS.get(cap, []): + missing_imm.setdefault(cap, set()).add((sname, k)) + for dt in STEP_DTS: + A2, B2 = copy.deepcopy(A), copy.deepcopy(S) + A2.step(dt) + B2.step(dt) + a2, b2 = A2.read('evaluator'), B2.read('evaluator') + for k in v0: + if k not in rt.ON_STEP.get(cap, []) and _step_differs(v1[k], a2[k], v0[k], b2[k]): + missing_step.setdefault(cap, set()).add((sname, k)) + if k not in rt.ON_STEP['sim.step'] + ['clock.time_s'] and _leaf_changed(v0[k], b2[k]): + missing_step.setdefault('sim.step', set()).add((sname, k)) + self.assertEqual(missing_imm, {}) + self.maxDiff = None + self.assertEqual(missing_step, {}) + check('declared_effects_scenarios') + + def test_every_device_capability_is_accepted_in_some_scenario(self): + accepted = set() + for n in SCENARIOS: + S = _scenario(n) + for cap in rt.CAPS: + if not _executable(cap) or cap in accepted: + continue + for args in _variants(cap): + try: + _orig_invoke(copy.deepcopy(S), cap, **args) + accepted.add(cap) + break + except rt.ActionRejected: + pass + self.assertEqual({c for c in rt.CAPS if _executable(c)} - accepted, set()) + + +class ZZRejectionCodes(unittest.TestCase): + def test_every_observed_rejection_code_is_declared(self): + undeclared = {k: sorted(v - set(rt.CAP_ERRORS.get(k, [])) - {'INVALID_ARGUMENT', 'UNSUPPORTED', 'UNKNOWN_CAPABILITY'}) for k, v in REJECTIONS.items()} + self.assertEqual({k: v for k, v in undeclared.items() if v}, {}) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_asset_biotek_405ts.py b/tests/test_asset_biotek_405ts.py new file mode 100644 index 0000000000000000000000000000000000000000..4e95a9d27ab5c3be1793bf44a535ee297091184a --- /dev/null +++ b/tests/test_asset_biotek_405ts.py @@ -0,0 +1,764 @@ +"""tests for CHEM-163 biotek_405ts: python3 -m unittest tests/test_asset_biotek_405ts.py + +Topics (pipeline.md): set points only write targets, read/describe are pure, rejected preconditions leave the state unchanged, two instances are +isolated, agent/evaluator truth isolation, conservation (liquid volume: bottles -> dispensed -> wells / waste; electrical energy), real return values +validated against the declared schemas (asset_tool validate_value), asynchronous completion and cancellation remnants, host-step independence, +declared immediate and on_step effects over scenario states; plus the washer physics against the manufacturer statements: residual <= 2 uL/well after +a 3-cycle 300 uL wash with 0.1 % Tween 20 water on a Costar flat plate at the default 29 steps, about 100 uL at 50 steps, dispense precision <= 3 % CV +at 300 uL, 3 cycles of 300 uL within 30 s, a 300 mL prime giving >= 95 % buffer purity; the cell-wash option (rates 1-2, CW travel) protecting an +adherent monolayer, vacuum-skimmed overfill vs overflow cross-contamination, clogged tubes (flow sensor, full wells), sensors (waste, vacuum, fluid), +idle-manifold clogging with a salt buffer vs a water rinse, liquid properties changing the wall film, carrier home for soaks longer than 1 min. +""" +import copy +import json +import math +import sys +import unittest +from pathlib import Path + +import numpy as np + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / 'scripts')) +sys.path.insert(0, str(ROOT / 'skills/chemistry-lab-assets/scripts')) +from asset_runtime import biotek_405ts as rt # noqa: E402 +import asset_tool # noqa: E402 + +CHECKS, PROCESS_EVIDENCE, REJECTIONS = [], {}, {} +_META = {} +INST = 'washer_01' + + +def _meta(): + if not _META: + _META.update(rt.export_biotek_405ts_contract_metadata()) + return _META + + +def _changed(a, b): + return json.dumps(a, sort_keys=True, default=str) != json.dumps(b, sort_keys=True, default=str) + + +_orig_invoke = rt.Biotek405tsRuntime.invoke + + +def _instrumented_invoke(self, capability_id, **a): + """Every successful call is checked against its declared output schema and immediate state effects (a call does not advance time); every + rejection code is recorded for the declaration check.""" + before = self.read('evaluator') if capability_id != 'sim.step' else None + t0 = self.t + try: + out = _orig_invoke(self, capability_id, **a) + except rt.ActionRejected as exc: + REJECTIONS.setdefault(capability_id, set()).add(str(exc)) + raise + meta = _meta()['capabilities'][capability_id] + errs = asset_tool.validate_value(out, meta['output_schema']) + if errs: + raise AssertionError(f'{capability_id} output violates its schema: {errs[:3]}') + if before is not None: + assert self.t == t0, capability_id + after = self.read('evaluator') + undeclared = {k for k in after if _changed(before[k], after[k])} - set(rt.EFFECTS.get(capability_id, [])) + if undeclared: + raise AssertionError(f'{capability_id} changed undeclared state immediately: {sorted(undeclared)}') + PROCESS_EVIDENCE.setdefault(capability_id, []).append(dict(arguments=copy.deepcopy(a), result_keys=sorted(out))) + return out + + +rt.Biotek405tsRuntime.invoke = _instrumented_invoke +TWEEN = 'water_0_1pct_tween20' +ELISA = dict(rt.PLATE_EXAMPLE) +TEST_PLATE = dict(ELISA, plate_id='test_plate', liquid_id=TWEEN, fill_volume_m3=300e-9, unbound_mol=1e-12) +CELL_PLATE = dict(ELISA, plate_id='cell_plate', liquid_id='dpbs_ca_mg', fill_volume_m3=100e-9, unbound_mol=0.0, nonspecific_mol=0.0, specific_mol=0.0, + cells_per_well=5e4, cell_adhesion='weak') +CW = dict(rt.WASH_EXAMPLE, dispense_rate=1, travel_rate='6CW', aspirate_z_steps=50, dispense_volume_m3=200e-9) + + +def configured(seed=1, **plant): + h = rt.Biotek405tsRuntime() + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, noise_seed=seed, **plant)) + return h + + +def ready(seed=1, liquid=TWEEN, prime=True, **plant): + h = configured(seed, **plant) + h.invoke('power.set', enabled=True) + h.invoke('buffer.load', bottle='A', liquid_id=liquid, volume_m3=0.008) + if prime: + h.invoke('prime.run', buffer='A', volume_m3=300e-6, rate=9) + run(h) + return h + + +def loaded(plate=TEST_PLATE, seed=1, **kw): + h = ready(seed, **kw) + h.invoke('plate.provide', **plate) + h.invoke('plate.load', plate_id=plate['plate_id']) + return h + + +def run(h, dt=0.25, tmax=36000.0): + t0 = h.t + while h.op is not None and h.t - t0 < tmax: + h.step(dt) + return h + + +def wash(h, **proto): + oid = h.invoke('wash.run', protocol=dict(rt.WASH_EXAMPLE, **proto))['operation_id'] + t0 = h.t + run(h) + return h.records[h.operations[oid]['record_id']], h.t - t0 + + +def check(cid, **detail): + CHECKS.append(dict(check=cid, status='passed', **detail)) + + +class ContractAndLibraries(unittest.TestCase): + def test_module_identity_and_export(self): + m = _meta() + self.assertEqual((rt.ASSET_TYPE_ID, rt.CATALOG_ID), ('instrument.biotek_405ts', 'CHEM-163')) + self.assertEqual(set(m['capabilities']), set(rt.CAPS)) + self.assertEqual(set(m['state_slots']), set(rt.SLOTS)) + for k, c in m['capabilities'].items(): + self.assertTrue(c['errors'], k) + self.assertEqual(asset_tool.validate_value(c['example_arguments'], c['input_schema']), [], k) + for k, v in list(rt.EFFECTS.items()) + list(rt.ON_STEP.items()): + self.assertTrue(set(v) <= set(rt.SLOTS), k) + check('contract_export_consistent') + + def test_template_libraries(self): + lib = rt.liquid_lib() + self.assertGreaterEqual(lib['count'], 50) + rho, mu, sig = rt.liquid_props('water', 298.15) + self.assertAlmostEqual(rho, 997.05, delta=1.0) + self.assertAlmostEqual(mu, 0.890e-3, delta=0.02e-3) + self.assertAlmostEqual(sig, 0.0720, delta=0.0015) + self.assertAlmostEqual(rt.liquid_props('pbs_1x', 298.15)[0], 1004.5, delta=1.5) # 1x PBS density + pl = rt.plate_lib()['plates'] + self.assertAlmostEqual(pl['costar_3590']['well_bottom_elevation_m'], 0.01435 - 0.01067, delta=1e-9) + self.assertAlmostEqual(pl['costar_3590']['well_bottom_elevation_m'], rt.ASP_Z_DEFAULT * rt.Z_STEP_M, delta=5e-5) # the default aspirate height meets the bottom + self.assertFalse(pl['costar_3575']['compatible_with_96_tube_single_manifold']) + check('template_libraries', water=(rho, mu, sig)) + + +class ManufacturerStatements(unittest.TestCase): + def test_residual_volume_default_and_cell_wash_height(self): + h = loaded() + rec, dt = wash(h) + V = np.array(h.plates['test_plate']['V']) + self.assertEqual(rec['status'], 'completed') + self.assertLessEqual(V.mean(), rt.RESIDUAL_SPEC_M3) # <= 2 uL/well average after 3 cycles (guide p.105) + self.assertGreater(V.mean(), 0.5e-9) + self.assertLessEqual(dt, 30.0) # 96-well 300 uL three cycles <= 30 s (workbook) + g = loaded() + wash(g, aspirate_z_steps=50, dispense_volume_m3=200e-9) + V50 = np.array(g.plates['test_plate']['V']).mean() + self.assertGreater(V50, 70e-9) + self.assertLess(V50, 110e-9) # guide: 50 steps -> approximately 100 uL + check('residual_and_timing', residual_uL=V.mean() * 1e9, time_s=dt, residual_50_steps_uL=V50 * 1e9) + + def test_dispense_precision_and_1ul_steps(self): + h = loaded(dict(TEST_PLATE, fill_volume_m3=0.0)) + h.invoke('plate.unload', plate_id='test_plate') + h.invoke('plate.provide', **dict(TEST_PLATE, plate_id='empty', fill_volume_m3=0.0, unbound_mol=0.0)) + h.invoke('plate.load', plate_id='empty') + oid = h.invoke('wash.run', protocol=dict(rt.WASH_EXAMPLE, cycles=1, final_aspirate=False, dispense_rate=6))['operation_id'] + run(h) + V = np.array(h.plates['empty']['V']) + res = V - 0.0 + cv = float(res.std() / res.mean()) + self.assertLess(cv, rt.CV_SPEC) # <= 3 % CV at 300 uL/well, rate 6 (guide) + self.assertGreater(cv, 0.005) + with self.assertRaises(rt.ActionRejected): + h.invoke('wash.run', protocol=dict(rt.WASH_EXAMPLE, dispense_volume_m3=300.5e-9)) + check('dispense_precision', cv=cv) + + def test_prime_purity_and_buffer_switching(self): + h = ready(liquid='pbs_1x', prime=False) + h.invoke('prime.run', buffer='A', volume_m3=rt.PRIME_FOR_CHANGE_M3, rate=9) + run(h) + purity = h.line.get('pbs_1x', 0.0) + self.assertGreaterEqual(purity, 0.95) # 300 mL prime -> >= 95 % (guide p.38) + h.invoke('buffer.load', bottle='B', liquid_id=TWEEN, volume_m3=0.004) + h.invoke('prime.run', buffer='B', volume_m3=rt.MANIFOLD_PRIME_M3, rate=9) + run(h) + self.assertLess(h.line.get(TWEEN, 0.0), 0.7) # a 50 mL manifold prime does not change the buffer + self.assertAlmostEqual(h.ledger()['primed_m3'], 350e-6, delta=1e-12) + self.assertAlmostEqual(h.waste, 350e-6, delta=1e-12) + check('prime_purity', purity=purity) + + +class WashPhysics(unittest.TestCase): + def test_washing_removes_unbound_keeps_specific(self): + h = loaded() + p = h.plates['test_plate'] + n0, s0 = float(np.mean(p['unbound'])), float(np.mean(p['spec'])) + wash(h) + self.assertLess(np.mean(p['unbound']) / n0, 2e-3) + self.assertGreater(np.mean(p['spec']) / s0, 0.999) + g = loaded() + wash(g, cycles=1) + self.assertGreater(np.mean(g.plates['test_plate']['unbound']), 3 * np.mean(p['unbound'])) # more cycles wash better (desorption floor) + k = loaded() + wash(k, shake_s=10.0, shake_intensity='fast') + tot = lambda q: float(np.mean(q['unbound'] + q['ns'])) # shaking desorbs more of the non-specific load + self.assertLess(tot(k.plates['test_plate']), tot(p)) + check('wash_efficiency', unbound_left=float(np.mean(p['unbound']) / n0)) + + def test_surfactant_desorbs_nonspecific(self): + a, b = loaded(liquid='pbs_1x'), loaded(liquid='pbst_0_05pct_tween20') + wash(a, soak_s=30.0) + wash(b, soak_s=30.0) + self.assertLess(np.mean(b.plates['test_plate']['ns']), np.mean(a.plates['test_plate']['ns'])) + check('surfactant_desorption') + + def test_liquid_properties_change_the_residual(self): + a, b = loaded(liquid='water'), loaded(liquid='glycerol') + wash(a) + wash(b) + self.assertGreater(np.mean(b.plates['test_plate']['V']), 3 * np.mean(a.plates['test_plate']['V'])) # viscous film + check('liquid_film', water_uL=float(np.mean(a.plates['test_plate']['V']) * 1e9), glycerol_uL=float(np.mean(b.plates['test_plate']['V']) * 1e9)) + + def test_cell_wash_option_protects_the_monolayer(self): + h = loaded(CELL_PLATE) + with self.assertRaises(rt.ActionRejected): + h.invoke('wash.run', protocol=CW) # cell-wash rates need the option + wash(h) + std_left = float(np.mean(h.plates['cell_plate']['cells']) / 5e4) + g = loaded(CELL_PLATE, cell_wash_installed=True) + rec, dt = wash(g, **{k: v for k, v in CW.items() if k != 'buffer'}) + cw_left = float(np.mean(g.plates['cell_plate']['cells']) / 5e4) + self.assertLess(std_left, 0.3) + self.assertGreater(cw_left, 0.9) + self.assertGreater(np.mean(g.plates['cell_plate']['V']), 50e-9) # the raised aspirate height keeps a liquid cover + check('cell_wash', standard_left=std_left, cell_wash_left=cw_left, time_s=dt) + + def test_overfill_is_skimmed_but_spills_without_vacuum_skim(self): + h = loaded() + rec, _ = wash(h, dispense_volume_m3=1000e-9, cycles=1, final_aspirate=False) + self.assertNotIn('overflow_observed', rec['warnings']) # tips at 121 steps skim the liquid above the rim + pt = rt.plate_lib()['plates']['costar_3590'] + A = math.pi * pt['mean_well_radius_m'] ** 2 + self.assertLessEqual(max(h.plates['test_plate']['V']), pt['well_volume_m3'] + A * rt.MENISCUS_M * 0.5 + 1e-12) # the pinned meniscus up to the tip + k = loaded() # tips 3 mm below the rim: the level stops at the tip (S1) + z = int(round((pt['height_m'] - 3e-3) / rt.Z_STEP_M)) + rec, _ = wash(k, dispense_volume_m3=1000e-9, cycles=1, final_aspirate=False, dispense_z_steps=z) + tipz = z * rt.Z_STEP_M + self.assertLessEqual(max(k.plates['test_plate']['V'] - A * (tipz - k.plates['test_plate']['wbe'])), 1e-12) + c = loaded() # a blocked aspirate tube cannot skim: its well runs over (S2) + c.invoke('fault.inject', fault='aspirate_tube_clog', tube=40, active=True) + rec, _ = wash(c, dispense_volume_m3=1000e-9, cycles=1, final_aspirate=False) + self.assertIn('overflow_observed', rec['warnings']) + self.assertGreater(c.ledger()['overflow_m3'], 0.0) + g = loaded() + rec, _ = wash(g, dispense_volume_m3=1000e-9, cycles=1, final_aspirate=False, dispense_z_steps=200, vacuum_delay_m3=10e-9) + self.assertIn('overflow_observed', rec['warnings']) + self.assertGreater(g.ledger()['overflow_m3'], 0.0) + self.assertGreater(float(np.sum(g.plates['test_plate']['contamination'])), 0.0) + check('overflow_and_skimming') + + def test_clogged_tubes_and_flow_sensor(self): + h = loaded() + h.invoke('fault.inject', fault='aspirate_tube_clog', tube=10, active=True) + for t in range(12): + h.invoke('fault.inject', fault='dispense_tube_clog', tube=20 + t, active=True) + rec, _ = wash(h) + V = h.plates['test_plate']['V'] + self.assertGreater(V[10], 200e-9) # the clogged aspirate tube leaves its well full + self.assertIn('FLOW_ERROR', rec['alarms']) # 12 blocked dispense tubes: > 10 % flow deficit + self.assertFalse(h.flow_ok) + oid = h.invoke('maintenance.clean_tubes')['operation_id'] + run(h, dt=10.0) + self.assertEqual((h.clog_a, h.clog_d), (set(), {})) + check('clogs_and_flow_sensor') + + def test_idle_clogging_depends_on_the_liquid_left_in_the_tubes(self): + salt, water = ready(liquid='high_salt_1m_nacl'), ready(liquid='water') + for h in (salt, water): + h.step(3 * 86400.0) + self.assertGreater(len(salt.clog_a) + len(salt.clog_d), 5) + self.assertEqual(len(water.clog_a) + len(water.clog_d), 0) + check('idle_clogging', salt_clogs=len(salt.clog_a) + len(salt.clog_d)) + + def test_review_round1_physics(self): + a, b = ready(liquid='high_salt_1m_nacl'), ready(liquid='high_salt_1m_nacl') # idle clogging does not depend on the step size + a.step(2 * 86400.0) + for _ in range(48): + b.step(3600.0) + self.assertEqual((a.clog_a, a.clog_d), (b.clog_a, b.clog_d)) + h = loaded() # a bottle that runs dry delivers its rest and alarms + h.bottles['A']['volume'] = 96 * 300e-9 * 0.5 + rec, _ = wash(h, cycles=1) + self.assertIn('BUFFER_EMPTY', rec['alarms']) + self.assertEqual(rec['status'], 'failed') + self.assertAlmostEqual(h.bottles['A']['volume'], 0.0, delta=1e-15) + self.assertAlmostEqual(h.ledger()['dispensed_m3'], 96 * 300e-9 * 0.5, delta=1e-12) + w = loaded(waste_capacity_m3=0.004) # the plate's liquid must fit into the waste bottles + w.waste = 0.9 * 0.004 - 1e-6 # sensor not yet tripped, headroom 0.4 mL + rec, _ = wash(w, cycles=1) + self.assertIn('WASTE_FULL', rec['alarms']) + self.assertLessEqual(w.waste, 0.004 + 1e-15) + pt = rt.plate_lib()['plates']['costar_3590'] # the aspirate delay drains the wall film + r0 = rt.residual_volume(300e-9, 0.0, pt, 1000.0, 1e-3, 0.072, 4e-3) + r1 = rt.residual_volume(300e-9, 0.0, pt, 1000.0, 1e-3, 0.072, 4e-3, 5.0) + self.assertLess(r1, r0) + s = h.read('evaluator') + for k in ('sensor.vacuum_ok', 'sensor.waste_full', 'sensor.fluid_ok', 'sensor.flow_ok'): + self.assertIs(type(s[k]), bool, k) + check('review_round1_physics', residual_no_delay_uL=r0 * 1e9, residual_5s_delay_uL=r1 * 1e9) + + def test_review_round2_wash_volume_drips_and_homing(self): + left = {} + for v in (50e-9, 300e-9, 1000e-9): # more buffer per cycle washes better, near the well-mixed limit + h = loaded() + n0 = float(np.sum(h.plates['test_plate']['unbound'])) + wash(h, dispense_volume_m3=v, cycles=1) + left[v] = float(np.sum(h.plates['test_plate']['unbound'])) / n0 + self.assertGreater(left[50e-9], left[300e-9]) + self.assertGreater(left[300e-9], left[1000e-9]) + self.assertLess(left[300e-9], 0.05) + h = loaded() # drips are finite and booked + wash(h, cycles=1, final_aspirate=False) + h.carrier = -rt.CARRIER_TRAVEL_M + V0 = float(np.sum(h.plates['test_plate']['V'])) + h.step(60 * 86400.0) + self.assertLessEqual(float(np.sum(h.plates['test_plate']['V'])) - V0, 96 * rt.DROPS_PER_TIP * rt.DROP_M3 + 1e-15) + self.assertAlmostEqual(float(np.sum(h.plates['test_plate']['V'])) - V0, h.ledger()['dripped_m3'], delta=1e-15) + g = loaded() # a vacuum fault homes both axes (booked) + oid = g.invoke('wash.run', protocol=rt.WASH_EXAMPLE)['operation_id'] + g.step(5.0) + g.invoke('fault.inject', fault='vacuum_leak', tube=0, active=True) + run(g) + self.assertEqual((g.carrier, g.manifold), (0.0, 0.0)) + self.assertNotIn('buffer.a.volume_m3', g.read('agent')) # the bottle level is host truth, not an instrument reading + self.assertIn('buffer.a.volume_m3', g.read('evaluator')) + check('review_round2', left_50uL=left[50e-9], left_300uL=left[300e-9], left_1000uL=left[1000e-9]) + + def test_overflow_neighbours_get_ten_percent_of_what_ran_over(self): + h = loaded() + h.invoke('fault.inject', fault='aspirate_tube_clog', tube=40, active=True) + p = h.plates['test_plate'] + p['ns'][:] = 0.0 # soluble species only: no desorption during the dispense + p['spec'][:] = 0.0 + n0 = float(p['unbound'][40] + p['contamination'][40]) + nb = [32, 48, 39, 41] + c0 = float(sum(p['contamination'][j] for j in nb)) + wash(h, dispense_volume_m3=3000e-9, cycles=1, final_aspirate=False) + lost = n0 - float(p['unbound'][40] + p['contamination'][40]) + gained = float(sum(p['contamination'][j] for j in nb)) - c0 + self.assertGreater(lost, 0.0) + self.assertAlmostEqual(gained, 0.1 * lost, delta=1e-9 * lost) # 10 % of what ran over the rim reaches the four neighbours + check('overflow_neighbour_rule', lost_mol=lost, gained_mol=gained) + + def test_contract_review_manifold_stays_inside_the_joint(self): + h = loaded() # the highest programmable heights keep the manifold at or below the park position + oid = h.invoke('wash.run', protocol=dict(rt.WASH_EXAMPLE, cycles=1, dispense_z_steps=250, aspirate_z_steps=250, secondary_aspirate_z_steps=250))['operation_id'] + zmax = -1.0 + while h.op is not None: + h.step(0.25) + zmax = max(zmax, h.manifold) + self.assertLessEqual(zmax, 1e-12) + self.assertGreaterEqual(min(h.manifold, 0.0), -rt.PARK_TIP_M) + check('manifold_inside_joint', z_max_m=zmax) + + def test_review_round3_overflow_drips_and_waste_reading(self): + c = loaded() # drops onto a full well run over and are booked + c.invoke('fault.inject', fault='aspirate_tube_clog', tube=40, active=True) + wash(c, dispense_volume_m3=1000e-9, cycles=1, final_aspirate=False) + c.carrier = -rt.CARRIER_TRAVEL_M + o0, cont0 = c.ledger()['overflow_m3'], float(np.sum(c.plates['test_plate']['contamination'])) + c.step(30 * 86400.0) + pt = rt.plate_lib()['plates']['costar_3590'] + cap = pt['well_volume_m3'] + math.pi * pt['mean_well_radius_m'] ** 2 * rt.MENISCUS_M * 0.5 + self.assertLessEqual(max(c.plates['test_plate']['V']), cap + 1e-15) + self.assertGreater(c.ledger()['overflow_m3'], o0) + d = loaded() # clean drops add no analyte to wells that do not run over + wash(d, cycles=1) + d.carrier = -rt.CARRIER_TRAVEL_M + cd0, v0 = float(np.sum(d.plates['test_plate']['contamination'])), float(np.sum(d.plates['test_plate']['V'])) + d.step(30 * 86400.0) + self.assertGreater(float(np.sum(d.plates['test_plate']['V'])), v0) + self.assertAlmostEqual(float(np.sum(d.plates['test_plate']['contamination'])), cd0, delta=1e-30 + 1e-12 * cd0) + big = {} + for v in (1000e-9, 3000e-9): # a larger skimmed overfill washes out more (continuous overflow) + k = loaded() + k.plates['test_plate']['ns'][:] = 0.0 # soluble species only (no desorption floor) + k.plates['test_plate']['spec'][:] = 0.0 + n0 = float(np.sum(k.plates['test_plate']['unbound'])) + wash(k, dispense_volume_m3=v, cycles=1) + big[v] = float(np.sum(k.plates['test_plate']['unbound'])) / n0 + self.assertLess(big[3000e-9], 0.5 * big[1000e-9]) + w = loaded() + wash(w) + out = w.invoke('waste.empty') + self.assertAlmostEqual(out['emptied_m3'] / 50e-6, round(out['emptied_m3'] / 50e-6), delta=1e-9) # read on 50 mL graduations + check('review_round3', skim_1000uL=big[1000e-9], skim_3000uL=big[3000e-9]) + + def test_sensors_and_failures(self): + h = loaded(waste_capacity_m3=0.004) + h.waste = 0.0037 + with self.assertRaises(rt.ActionRejected): + h.invoke('wash.run', protocol=rt.WASH_EXAMPLE) # waste sensor + h.invoke('waste.empty') + g = loaded() + g.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, vacuum_pump=False)) # pump unplugged from the accessory outlet + with self.assertRaises(rt.ActionRejected): + g.invoke('wash.run', protocol=rt.WASH_EXAMPLE) # vacuum sensor + k = loaded() + oid = k.invoke('wash.run', protocol=rt.WASH_EXAMPLE)['operation_id'] + k.step(6.0) + k.invoke('fault.inject', fault='vacuum_leak', tube=None, active=True) + run(k) + r = k.records[k.operations[oid]['record_id']] + self.assertEqual(r['status'], 'failed') + self.assertIn('VACUUM_LOW', r['alarms']) + self.assertEqual(k.manifold, 0.0) + m = loaded() + m.bottles['A']['volume'] = 0.0 + with self.assertRaises(rt.ActionRejected): + m.invoke('wash.run', protocol=rt.WASH_EXAMPLE) # fluid sensor + check('sensors') + + def test_long_soak_sends_the_carrier_home(self): + h = loaded() + oid = h.invoke('wash.run', protocol=dict(rt.WASH_EXAMPLE, cycles=1, soak_s=120.0))['operation_id'] + seen = [] + while h.op is not None: + h.step(0.5) + seen.append((h.phase, h.carrier)) + self.assertIn(('soak', 0.0), seen) # > 1 min: carrier home, no drips (guide p.46) + g = loaded() + g.invoke('wash.run', protocol=dict(rt.WASH_EXAMPLE, cycles=1, soak_s=30.0)) + s2 = [] + while g.op is not None: + g.step(0.5) + s2.append((g.phase, g.carrier)) + self.assertIn(('soak', -rt.CARRIER_TRAVEL_M), s2) + check('carrier_home_for_long_soaks') + + +class HostClockConservationSessions(unittest.TestCase): + def test_read_describe_pure_and_time(self): + h = loaded() + v0, t0 = h.read('evaluator'), h.t + h.register_principal('ag', 'agent') + h.session('ag').describe(instance_id=INST) + h.session('ag').read(instance_id=INST) + self.assertEqual(json.dumps(h.read('evaluator'), sort_keys=True), json.dumps(v0, sort_keys=True)) + oid = h.invoke('wash.run', protocol=rt.WASH_EXAMPLE)['operation_id'] + self.assertEqual(h.t, t0) + self.assertEqual(h.operations[oid]['phase'], 'running') + h.step(0.5) + self.assertEqual(h.carrier, -rt.CARRIER_TRAVEL_M) + run(h) + self.assertEqual(h.operations[oid]['phase'], 'completed') + self.assertEqual((h.carrier, h.manifold), (0.0, 0.0)) + check('host_clock') + + def test_step_partition_independent(self): + a, b = loaded(seed=3), loaded(seed=3) + for h in (a, b): + h.invoke('wash.run', protocol=rt.WASH_EXAMPLE) + a.step(100.0) + for _ in range(400): + b.step(0.25) + self.assertEqual(json.dumps(a.read('evaluator'), sort_keys=True, default=str), json.dumps(b.read('evaluator'), sort_keys=True, default=str)) + self.assertAlmostEqual(a.ledger()['electrical_energy_j'], b.ledger()['electrical_energy_j'], delta=1e-6) + check('step_partition') + + def test_volume_and_energy_conservation(self): + h = loaded() + bottle0 = h.bottles['A']['volume'] + wells0 = float(np.sum(h.plates['test_plate']['V'])) + waste0 = h.waste + wash(h) + L = h.ledger() + wells1 = float(np.sum(h.plates['test_plate']['V'])) + self.assertAlmostEqual(bottle0 - h.bottles['A']['volume'], L['dispensed_m3'] + L['dripped_m3'], delta=1e-12) # drawn = delivered + drips + self.assertAlmostEqual(wells0 + L['dispensed_m3'] + L['dripped_m3'] - (h.waste - waste0) - L['overflow_m3'], wells1, delta=1e-12) # the prime went to the trough before + self.assertAlmostEqual(L['aspirated_m3'] + L['primed_m3'], L['waste_added_m3'], delta=1e-12) + e0 = h.ledger()['electrical_energy_j'] + h.step(100.0) + self.assertAlmostEqual(h.ledger()['electrical_energy_j'] - e0, rt.IDLE_W * 100.0, delta=1e-6) + h.invoke('power.set', enabled=False) + e1 = h.ledger()['electrical_energy_j'] + h.step(50.0) + self.assertEqual(h.ledger()['electrical_energy_j'], e1) + check('conservation') + + def test_rejections_leave_state_unchanged(self): + h = loaded() + v0 = json.dumps(h.read('evaluator'), sort_keys=True, default=str) + for cap, args in [('plate.load', dict(plate_id='test_plate')), ('plate.provide', dict(TEST_PLATE, plate_type='costar_3575', plate_id='x')), + ('prime.run', dict(buffer='A', volume_m3=50e-6, rate=9)), ('wash.run', dict(protocol=dict(rt.WASH_EXAMPLE, buffer='C'))), + ('buffer.load', dict(bottle='A', liquid_id='nope', volume_m3=0.001)), ('plate.unload', dict(plate_id='nope'))]: + with self.assertRaises(rt.ActionRejected): + h.invoke(cap, **args) + self.assertEqual(json.dumps(h.read('evaluator'), sort_keys=True, default=str), v0) + check('rejections_pure') + + def test_cancellation(self): + h = loaded() + h.register_principal('ag', 'agent') + s = h.session('ag') + r = s.invoke(instance_id=INST, capability_id='wash.run', arguments=dict(protocol=rt.WASH_EXAMPLE), request_id='w') + h.step(12.0) + done = h.records['WS0001']['cycles_done'] + s.cancel(r['operation_id'], 'c1') + self.assertEqual(h.records['WS0001']['status'], 'cancelled') + self.assertEqual((h.carrier, h.manifold, h.op), (0.0, 0.0, None)) + self.assertGreaterEqual(done, 1) + self.assertEqual(s.poll(r['operation_id'])['status'], 'cancelled') + check('cancellation') + + def test_two_instances_isolated(self): + a, b = loaded(), loaded() + wash(a) + self.assertEqual(sorted(b.records), ['PR0001']) + self.assertEqual(b.ledger()['cycles'], 0.0) + check('isolation') + + def test_agent_truth_isolation_and_idempotence(self): + h = loaded() + h.register_principal('a1', 'agent') + h.register_principal('a2', 'agent') + h.register_principal('ev', 'evaluator') + s1, s2, e = h.session('a1'), h.session('a2'), h.session('ev') + obs = s1.read(instance_id=INST)['observations'] + self.assertFalse([k for k in obs if k.startswith('truth.')]) + self.assertIn('truth.residual_m3', e.read(instance_id=INST)['observations']) + self.assertEqual(s1.invoke(instance_id=INST, capability_id='plate.inspect', arguments=dict(plate_id='test_plate'), request_id='i')['error']['code'], 'ACCESS_DENIED') + r1 = s1.invoke(instance_id=INST, capability_id='wash.run', arguments=dict(protocol=rt.WASH_EXAMPLE), request_id='w') + self.assertEqual(s1.invoke(instance_id=INST, capability_id='wash.run', arguments=dict(protocol=rt.WASH_EXAMPLE), request_id='w'), r1) + self.assertEqual(s1.invoke(instance_id=INST, capability_id='waste.empty', arguments={}, request_id='w')['error']['code'], 'REQUEST_CONFLICT') + self.assertEqual(s2.invoke(instance_id=INST, capability_id='buffer.load', arguments=dict(bottle='B', liquid_id='water', volume_m3=0.001), + request_id='b')['error']['code'], 'ACCESS_DENIED') + run(h) + self.assertEqual(s2.invoke(instance_id=INST, capability_id='records.list', arguments={}, request_id='r')['result']['records'], ['PR0001']) # the host's own prime has no owner + self.assertEqual(s1.poll(r1['operation_id'])['status'], 'succeeded') + self.assertEqual(s1.read(instance_id=INST)['observations']['result.last_record_id']['value'], 'WS0001') + check('truth_isolation_idempotence') + + def test_switch_record_ledger_and_clock(self): + h = configured() + self.assertTrue(h.invoke('power.press_switch')['enabled']) + self.assertFalse(h.invoke('power.press_switch')['enabled']) + g = loaded() + rec, _ = wash(g, cycles=2) + r = g.invoke('measurement.result', record_id=rec['record_id']) + self.assertEqual((r['kind'], r['cycles_done'], r['status']), ('wash', 2, 'completed')) + self.assertAlmostEqual(r['programmed_dispense_m3'], 2 * 96 * 300e-9, delta=1e-15) + self.assertNotIn('_dispensed_m3', r) + L = g.invoke('ledger.read')['ledger'] + self.assertEqual(L['cycles'], 2.0) + t = g.invoke('sim.step', dt_s=12.5)['time_s'] + self.assertAlmostEqual(t, g.t, delta=0.0) + check('switch_record_ledger_clock') + + def test_queries_and_unsupported(self): + h = loaded() + wash(h) + self.assertEqual(h.invoke('records.list')['records'], ['PR0001', 'WS0001']) + self.assertEqual(h.invoke('log.read')['entries'][-1]['cycles_done'], 3) + self.assertTrue(h.invoke('events.read', since_s=0.0)['events']) + p = h.invoke('provenance.read') + self.assertEqual(len(p['libraries']), 2) + self.assertGreaterEqual(p['libraries'][0]['count'], 50) + ins = h.invoke('plate.inspect', plate_id='test_plate') + self.assertEqual(len(ins['volume_m3']), 96) + for k in rt.UNSUPPORTED: + with self.assertRaises(rt.ActionRejected): + h.invoke(k) + with self.assertRaises(rt.ActionRejected): + h.invoke('measurement.result', record_id='nope') + check('queries') + + +# ---------------------------------------------------------------- declared effects over scenario states +_SC = {} + + +def _build(name): + if name == 'fresh': + return rt.Biotek405tsRuntime() + if name == 'off': + return configured() + if name == 'ready': + h = ready() + h.invoke('plate.provide', **TEST_PLATE) + h.invoke('plate.provide', **CELL_PLATE) + return h + if name == 'loaded': + h = _scenario('ready') + h.invoke('plate.load', plate_id='test_plate') + return h + if name == 'washing': + h = _scenario('loaded') + h.invoke('wash.run', protocol=rt.WASH_EXAMPLE) + h.step(5.0) + return h + if name == 'priming': + h = _scenario('ready') + h.invoke('prime.run', buffer='A', volume_m3=50e-6, rate=9) + h.step(0.2) + return h + if name == 'cleaning': + h = _scenario('ready') + h.invoke('maintenance.clean_tubes') + return h + if name == 'washed': + h = _scenario('loaded') + wash(h) + return h + if name == 'vacuum_fault': + h = _scenario('loaded') + h.invoke('fault.inject', fault='vacuum_leak', tube=None, active=True) + return h + if name == 'mains_fault': + h = _scenario('loaded') + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, mains_voltage_v=60.0)) + return h + raise KeyError(name) + + +def _scenario(name): + if name not in _SC: + _SC[name] = _build(name) + return copy.deepcopy(_SC[name]) + + +SCENARIOS = ['fresh', 'off', 'ready', 'loaded', 'washing', 'priming', 'cleaning', 'washed', 'vacuum_fault', 'mains_fault'] +STEP_DTS = (0.02, 1.0, 5.0, 60.0) + + +def _variants(cap): + V = { + 'plant.configure': [dict(rt.PLANT_EXAMPLE), dict(rt.PLANT_EXAMPLE, mains_voltage_v=60.0), dict(rt.PLANT_EXAMPLE, vacuum_pump=False)], + 'power.set': [dict(enabled=True), dict(enabled=False)], 'power.press_switch': [{}], + 'buffer.load': [dict(bottle='B', liquid_id='water', volume_m3=0.002), dict(bottle='A', liquid_id='pbs_1x', volume_m3=0.004)], 'waste.empty': [{}], + 'plate.provide': [dict(TEST_PLATE, plate_id='new')], 'plate.load': [dict(plate_id='test_plate'), dict(plate_id='cell_plate')], + 'plate.unload': [dict(plate_id='test_plate')], 'prime.run': [dict(buffer='A', volume_m3=20e-6, rate=9)], + 'wash.run': [dict(protocol=rt.WASH_EXAMPLE), dict(protocol=dict(rt.WASH_EXAMPLE, cycles=1, soak_s=5.0, shake_s=3.0, bottom_wash=True))], + 'maintenance.clean_tubes': [{}], + 'fault.inject': [dict(fault=f, tube=3, active=True) for f in ('vacuum_leak', 'buffer_line_air', 'dispense_tube_clog', 'aspirate_tube_clog', 'waste_sensor_stuck', 'power_loss')] + + [dict(fault=f, tube=3, active=False) for f in ('vacuum_leak', 'dispense_tube_clog')], + 'sim.step': [dict(dt_s=0.5), dict(dt_s=30.0)], + } + return V.get(cap, []) + + +def _num(x): + return isinstance(x, (int, float)) and not isinstance(x, bool) + + +def _flat(v, prefix=''): + out = {} + if isinstance(v, dict): + for k, x in v.items(): + out.update(_flat(x, f'{prefix}.{k}')) + elif isinstance(v, list) and len(v) <= 128: + for i, x in enumerate(v): + out.update(_flat(x, f'{prefix}[{i}]')) + else: + out[prefix] = json.dumps(v, sort_keys=True, default=str) if isinstance(v, list) else v + return out + + +def _rel_changed(a, b, scale=None): + if _num(a) and _num(b): + return abs(a - b) > 1e-9 * (max(abs(a), abs(b)) if scale is None else scale) + 1e-300 + return _changed(a, b) + + +def _leaf_changed(a, b): + fa, fb = _flat(a), _flat(b) + return any(_rel_changed(fa.get(k, ''), fb.get(k, '')) for k in set(fa) | set(fb)) + + +def _step_differs(v1, a2, v0, b2): + f1, fa, f0, fb = _flat(v1), _flat(a2), _flat(v0), _flat(b2) + for leaf in set(f1) | set(fa) | set(f0) | set(fb): + x1, xa, x0, xb = (f.get(leaf, '') for f in (f1, fa, f0, fb)) + ca, cb = _rel_changed(x1, xa), _rel_changed(x0, xb) + if not (ca or cb): + continue + if ca and cb and all(_num(x) for x in (x1, xa, x0, xb)) and not _rel_changed(xa - x1, xb - x0, max(abs(x1), abs(xa), abs(x0), abs(xb))): + continue + if ca and cb and (x1, xa) == (x0, xb): + continue + if ca and cb and x1 == x0 and not _rel_changed(xa, xb): + continue + return True + return False + + +def _executable(cap): + return cap not in rt.UNSUPPORTED and rt.CAPS[cap]['kind'] not in ('query', 'analysis') + + +class ZDeclaredEffects(unittest.TestCase): + def test_immediate_and_on_step_effects_are_declared(self): + missing_imm, missing_step = {}, {} + states = {n: _scenario(n) for n in SCENARIOS} + for cap in rt.CAPS: + if not _executable(cap): + continue + for sname, S in states.items(): + for args in _variants(cap): + A = copy.deepcopy(S) + v0 = A.read('evaluator') + try: + _orig_invoke(A, cap, **args) + except rt.ActionRejected: + continue + v1 = A.read('evaluator') + if cap == 'sim.step': + for k in v0: + if _leaf_changed(v0[k], v1[k]) and k not in rt.ON_STEP['sim.step'] + rt.EFFECTS['sim.step']: + missing_step.setdefault('sim.step', set()).add((sname, k)) + continue + for k in v0: + if _leaf_changed(v0[k], v1[k]) and k not in rt.EFFECTS.get(cap, []): + missing_imm.setdefault(cap, set()).add((sname, k)) + for dt in STEP_DTS: + A2, B2 = copy.deepcopy(A), copy.deepcopy(S) + A2.step(dt) + B2.step(dt) + a2, b2 = A2.read('evaluator'), B2.read('evaluator') + for k in v0: + if k not in rt.ON_STEP.get(cap, []) and _step_differs(v1[k], a2[k], v0[k], b2[k]): + missing_step.setdefault(cap, set()).add((sname, k)) + if k not in rt.ON_STEP['sim.step'] + ['clock.time_s'] and _leaf_changed(v0[k], b2[k]): + missing_step.setdefault('sim.step', set()).add((sname, k)) + self.assertEqual(missing_imm, {}) + self.assertEqual(missing_step, {}) + check('declared_effects_scenarios') + + def test_every_device_capability_is_accepted_in_some_scenario(self): + accepted = set() + for n in SCENARIOS: + S = _scenario(n) + for cap in rt.CAPS: + if not _executable(cap) or cap in accepted: + continue + for args in _variants(cap): + try: + _orig_invoke(copy.deepcopy(S), cap, **args) + accepted.add(cap) + break + except rt.ActionRejected: + pass + self.assertEqual({c for c in rt.CAPS if _executable(c)} - accepted, set()) + + +class ZZRejectionCodes(unittest.TestCase): + def test_every_observed_rejection_code_is_declared(self): + undeclared = {k: sorted(v - set(rt.CAP_ERRORS.get(k, [])) - {'INVALID_ARGUMENT', 'UNSUPPORTED', 'UNKNOWN_CAPABILITY'}) for k, v in REJECTIONS.items()} + self.assertEqual({k: v for k, v in undeclared.items() if v}, {}) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_asset_bmg_clariostarplus.py b/tests/test_asset_bmg_clariostarplus.py new file mode 100644 index 0000000000000000000000000000000000000000..43ad05815c5964be9ccc942448ea96f14bd260c0 --- /dev/null +++ b/tests/test_asset_bmg_clariostarplus.py @@ -0,0 +1,780 @@ +"""tests for CHEM-173 bmg_clariostarplus (BMG LABTECH CLARIOstar Plus multi-mode microplate reader): python3 -m unittest tests/test_asset_bmg_clariostarplus.py + +Themes: contract consistency (slots, effects, errors raised vs declared); agent / evaluator truth isolation and foreign-agent ownership of plates and +samples; idempotent request ids; two instances isolated; step-partition independence; rejected calls leave the state unchanged; every output +validated against its schema and every success changes only declared slots; ANSI/SLAS well positions; Beer-Lambert linearity with the well path +length and the 1 cm path-length correction; 0-4 OD range with stray-light saturation; photometric precision at 1 and 2 OD; polystyrene UV cut-off +vs UV-transparent plates; absorbance spectrum maximum; documented read times (8 / 15 / 28 s flying, 19 / 57 / 184 s with 10 flashes); +fluorescence linearity over decades (EDR), inner filter, focus, bottom vs top, bandwidth overlap, fixed-gain overflow and auto gain; +fluorescence polarisation binding curve and precision; ATP luminescence (glow decay, flash after injection); injectors (prime, back-flush, clog, +consumption); incubation and Arrhenius kinetics; evaporation (edge, seal); kinetic cycle budget; drawer / lid interlocks; MARS-like analysis +(standard curve, Z'); power cycle; events, provenance and ledger.""" +import json +import math +import re +import sys +import unittest +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / 'scripts')) +from asset_runtime import bmg_clariostarplus as rt # noqa: E402 + +INST = 'bmg_clariostarplus_01' +CHECKS = [] +SEEN_CAPS = set() +PROCESS_EVIDENCE = {} +FL = 'fluorescein_in_basic_ethanol' +RB = 'rhodamine_b_in_ethanol' + + +def _differ(x, y): + if isinstance(x, float) and isinstance(y, float): + return abs(x - y) > 1e-12 * max(1.0, abs(x), abs(y)) + return x != y + + +class Rig: + def __init__(self, seed=1, room=295.15, mains=230.0, instance=INST): + self.h = rt.BmgClariostarplusRuntime(instance) + self.h.register_principal('agent', 'agent') + self.h.register_principal('eval', 'evaluator') + self.A = self.h.session('agent') + self.E = self.h.session('eval') + self.n = 0 + self.inst = instance + self.call(self.E, 'plant.configure', room_k=room, mains_voltage_v=mains, noise_seed=seed) + + def call(self, sess, cap, expect='succeeded', **args): + """Instrumented call: outputs validated against the declared schema; a success changes only declared immediate slots and never the clock; + a rejection leaves every slot unchanged and returns a declared error code.""" + self.n += 1 + before, t0 = self.h.read('evaluator'), self.h.t + r = sess.invoke(instance_id=self.inst, capability_id=cap, arguments=args, request_id=f'r{self.n}') + after = self.h.read('evaluator') + changed = {k for k in after if _differ(after[k], before[k])} - {'clock.time_s'} + if expect == 'succeeded': + assert r['status'] == 'succeeded', (cap, r['error']) + rt.validate(rt.CAPS[cap]['output_schema'], r['result']) + if cap != 'sim.step': + extra = changed - set(rt.EFFECTS.get(cap, [])) + assert not extra, (cap, sorted(extra)) + assert self.h.t == t0, cap + SEEN_CAPS.add(cap) + PROCESS_EVIDENCE.setdefault(cap, []).append(dict(arguments=json.dumps(args, sort_keys=True, default=str)[:200], time_s=t0, status=r['status'])) + return r['result'] + assert r['status'] in ('rejected', 'unsupported'), (cap, r['status'], r.get('result')) + assert r['error']['code'] == expect, (cap, r['error']['code'], expect) + assert not changed, (cap, 'rejected call changed', sorted(changed)) + assert expect in [e['code'] for e in rt.export_bmg_clariostarplus_contract_metadata()['capabilities'][cap]['errors']], (cap, expect) + return r + + def step(self, s): + self.call(self.E, 'sim.step', dt_s=float(s)) + + def read(self, *ids, who=None): + sess = who or self.E + o = sess.read(instance_id=self.inst, state_ids=list(ids) if ids else None)['observations'] + return {k: v['value'] for k, v in o.items()} if not ids or len(ids) > 1 else o[ids[0]]['value'] + + def on(self, kits=True): + self.call(self.A, 'power.set', on=True) + self.step(rt.ENG['initialisation_s'] + 0.5) + if kits: + for k in rt.KITS: + self.call(self.E, 'kit.provide', kit=k, volume_m3=1e-3) + + def provide(self, sid, comp, volume=1e-4, **kw): + self.call(self.E, 'sample.provide', sample_id=sid, volume_m3=volume, composition=comp, **kw) + + def plate(self, pid='p', fmt='96', ptype='clear'): + self.call(self.A, 'plate.prepare', plate_id=pid, format=fmt, type=ptype) + return pid + + def fill(self, pid, wells, source, volume, diluent=None, total=None): + if volume > 0: + self.call(self.A, 'well.dispense', plate_id=pid, wells=wells, source_id=source, volume_m3=volume) + if diluent and total and total - volume > 1e-12: + self.call(self.A, 'well.dispense', plate_id=pid, wells=wells, source_id=diluent, volume_m3=total - volume) + + def load(self, pid): + self.call(self.A, 'drawer.set', open=True) + self.step(rt.ENG['carrier_motion_s'] + 0.2) + self.call(self.A, 'plate.load', plate_id=pid) + self.call(self.A, 'drawer.set', open=False) + self.step(rt.ENG['carrier_motion_s'] + 0.2) + + def unload(self): + self.call(self.A, 'drawer.set', open=True) + self.step(rt.ENG['carrier_motion_s'] + 0.2) + return self.call(self.A, 'plate.unload') + + def measure(self, **protocol): + self.call(self.A, 'protocol.configure', **protocol) + out = self.call(self.A, 'run.start') + for _ in range(100000): + if self.read('run.status')['state'] != 'running': + break + self.step(1.0) + return out, self.call(self.A, 'data.read') + + def values(self, data, wl=None): + out = {} + for r in data['rows']: + if wl is None or r['wavelength_m'] == wl: + out.setdefault(r['well'], []).append(r['value']) + return {k: v[-1] for k, v in out.items()} + + +def _raised_codes(): + src = Path(rt.__file__).read_text() + funcs = {} + for m in re.finditer(r'\n def (\w+)\(self[^\n]*\n(.*?)(?=\n def |\n# ----|\nclass |\n _NOCOPY)', src, re.S): + funcs[m.group(1)] = m.group(2) + own = {k: set(re.findall(r"ActionRejected\('([A-Z_]+)'\)", v)) for k, v in funcs.items()} + calls = {k: set(re.findall(r'self\.(_\w+)\(', v)) & set(funcs) for k, v in funcs.items()} + module_level = set(re.findall(r"ActionRejected\('([A-Z_]+)'\)", src[:src.index('class BmgClariostarplusRuntime')])) + out = {} + for k in funcs: + if not k.startswith('_cmd_'): + continue + seen, todo, codes = set(), [k], set() + while todo: + f = todo.pop() + if f in seen: + continue + seen.add(f) + codes |= own.get(f, set()) + todo += [g for g in calls.get(f, ()) if g not in ('_cmd_sim_step', 'step', '_tick')] + if 'expand_wells(' in funcs[k] or '_cmd_well' in k: + codes |= {'INVALID_WELL'} & module_level + out[k[5:].replace('_', '.', 1)] = codes + return out + + +class Contract(unittest.TestCase): + def test_metadata_slots_effects_and_mirrors_consistent(self): + meta = rt.export_bmg_clariostarplus_contract_metadata() + slots = set(meta['state_slots']) + self.assertEqual(slots, set(rt.SLOTS)) + for k, c in meta['capabilities'].items(): + for e in c['state_effects']: + self.assertIn(e['state_id'], slots, k) + for x in c['observes']: + self.assertIn(x, slots, k) + for pre in c['preconditions']: + self.assertTrue(set(pre['state_ids']) <= slots, k) + self.assertTrue({'INVALID_ARGUMENT', 'REQUEST_CONFLICT', 'UNKNOWN_INSTANCE'} <= {e['code'] for e in c['errors']}, k) + self.assertIn(c['kind'], ('query', 'device_command', 'robot_skill', 'simulation', 'analysis', 'configuration')) + self.assertIn(c['model_effects']['mode'], ('none', 'direct', 'coupled', 'host_required')) + self.assertTrue(rt.SCENE_MIRRORED <= slots) + for name, p in meta['mechanisms']['microplate_reader_process']['parameters'].items(): + self.assertEqual(name, name.lower()) + self.assertIn(p['evidence'], ('documented', 'assumption'), name) + + def test_declared_errors_cover_raised_codes(self): + meta = rt.export_bmg_clariostarplus_contract_metadata() + for cap, codes in _raised_codes().items(): + if cap not in meta['capabilities']: + cap = next(k for k in meta['capabilities'] if k.replace('.', '_') == cap.replace('.', '_')) + declared = {e['code'] for e in meta['capabilities'][cap]['errors']} + self.assertTrue(codes <= declared, (cap, sorted(codes - declared))) + + def test_unsupported_capabilities(self): + g = Rig() + for k in rt.UNSUPPORTED: + r = g.A.invoke(instance_id=INST, capability_id=k, arguments={}, request_id='u-' + k) + self.assertEqual((r['status'], r['error']['code']), ('unsupported', 'UNSUPPORTED')) + + def test_agent_truth_isolation(self): + g = Rig() + d = g.A.describe(instance_id=INST) + self.assertFalse(any(k.startswith('truth.') for k in d['state_slots'])) + with self.assertRaises(rt.ActionRejected): + g.A.read(instance_id=INST, state_ids=['truth.plates']) + for cap, args in (('truth.inspect', {}), ('sim.step', dict(dt_s=1.0)), ('kit.provide', dict(kit='water')), + ('sample.provide', dict(sample_id='x', volume_m3=1e-5, composition={}))): + r = g.A.invoke(instance_id=INST, capability_id=cap, arguments=args, request_id='x-' + cap) + self.assertEqual(r['error']['code'], 'ACCESS_DENIED', cap) + g.call(g.E, 'fault.inject', fault='lamp_aging', active=True) + self.assertFalse(any(e['kind'] == 'fault' for e in g.call(g.A, 'events.read', since_s=0.0)['events'])) + + def test_foreign_agent_ownership(self): + g = Rig() + g.h.register_principal('agent2', 'agent') + B = g.h.session('agent2') + g.on() + g.plate('mine') + g.fill('mine', ['A1'], 'water', 1e-7) + for cap, args in (('well.dispense', dict(plate_id='mine', wells=['A2'], source_id='water', volume_m3=1e-7)), ('plate.seal', dict(plate_id='mine', sealed=True))): + r = B.invoke(instance_id=INST, capability_id=cap, arguments=args, request_id='b-' + cap) + self.assertEqual(r['error']['code'], 'ACCESS_DENIED', cap) + self.assertNotIn('mine', B.read(instance_id=INST, state_ids=['plates.available'])['observations']['plates.available']['value']) + g.load('mine') + r = B.invoke(instance_id=INST, capability_id='run.start', arguments={}, request_id='b-run') + self.assertEqual(r['error']['code'], 'ACCESS_DENIED') + r = B.invoke(instance_id=INST, capability_id='plate.prepare', arguments=dict(plate_id='theirs', format='384', type='black'), request_id='b-own') + self.assertEqual(r['status'], 'succeeded') + r = B.invoke(instance_id=INST, capability_id='plate.prepare', arguments=dict(plate_id='mine', format='96', type='clear'), request_id='b-same-id') + self.assertEqual(r['error']['code'], 'ACCESS_DENIED') + self.assertIn('ACCESS_DENIED', [e['code'] for e in rt.export_bmg_clariostarplus_contract_metadata()['capabilities']['plate.prepare']['errors']]) + g.call(g.A, 'protocol.configure', mode='abs_endpoint', format='96', wells=['A1'], wavelengths_m=[450e-9]) + g.call(g.A, 'run.start') + r = B.invoke(instance_id=INST, capability_id='run.stop', arguments={}, request_id='b-stop') + self.assertEqual(r['error']['code'], 'ACCESS_DENIED') + self.assertEqual(g.read('run.status')['state'], 'running') + + def test_idempotent_request_ids(self): + g = Rig() + g.on() + g.plate('p') + args = dict(plate_id='p', wells=['A1'], source_id='water', volume_m3=1e-7) + r1 = g.A.invoke(instance_id=INST, capability_id='well.dispense', arguments=args, request_id='same') + snap = g.h.read('evaluator') + r2 = g.A.invoke(instance_id=INST, capability_id='well.dispense', arguments=args, request_id='same') + self.assertEqual(r1, r2) + self.assertEqual(json.dumps(snap, sort_keys=True, default=str), json.dumps(g.h.read('evaluator'), sort_keys=True, default=str)) + r3 = g.A.invoke(instance_id=INST, capability_id='well.dispense', arguments=dict(args, wells=['A2']), request_id='same') + self.assertEqual(r3['error']['code'], 'REQUEST_CONFLICT') + + def test_two_instances_isolated(self): + a, b = Rig(instance='r_a'), Rig(instance='r_b', room=298.15) + a.call(a.A, 'power.set', on=True) + self.assertFalse(b.read('power.on')) + r = a.A.invoke(instance_id='r_b', capability_id='power.set', arguments=dict(on=True), request_id='z') + self.assertEqual(r['error']['code'], 'UNKNOWN_INSTANCE') + + def test_step_partition_independence(self): + def run(steps): + g = Rig(seed=5) + g.on() + g.call(g.A, 'incubator.set', temperature_k=310.15) + g.provide('rx', {FL: 0.0, RB: 1e-3}, reactions=[dict(source=RB, product=FL, k_per_s=2e-3, ea_j_mol=5e4)]) + g.plate('p') + g.fill('p', ['A1:A6'], 'rx', 1e-7) + g.load('p') + for s in steps: + g.step(s) + r = g.read() + return r['chamber.temperature_k'], json.dumps(r['truth.plates'], sort_keys=True) + a = run([1200.0]) + b = run([0.05] * 400 + [0.37, 13.11, 1166.52]) + c = run([40.0] * 30) + self.assertEqual(a, b) + self.assertEqual(a, c) + + def test_rejections_change_nothing(self): + g = Rig() + r = rt.BmgClariostarplusRuntime('fresh') + r.register_principal('e', 'evaluator') + self.assertEqual(r.session('e').invoke(instance_id='fresh', capability_id='power.set', arguments=dict(on=True), request_id='p')['error']['code'], 'PLANT_REQUIRED') + g.call(g.E, 'plant.configure', expect='SEED_FIXED', room_k=295.15, mains_voltage_v=230.0, noise_seed=2) + g.call(g.A, 'drawer.set', expect='POWER_OFF', open=True) + g.call(g.E, 'sample.provide', expect='UNKNOWN_SPECIES', sample_id='s', volume_m3=1e-5, composition={'unobtainium': 1.0}) + g.on() + g.call(g.A, 'drawer.set', open=True) + g.call(g.A, 'plate.load', expect='UNKNOWN_PLATE', plate_id='nope') + g.plate('p') + g.call(g.A, 'plate.prepare', expect='PLATE_EXISTS', plate_id='p', format='96', type='clear') + g.call(g.A, 'well.dispense', expect='INVALID_WELL', plate_id='p', wells=['Q1'], source_id='water', volume_m3=1e-7) + g.call(g.A, 'well.dispense', expect='UNKNOWN_ITEM', plate_id='p', wells=['A1'], source_id='nope', volume_m3=1e-7) + g.call(g.A, 'well.dispense', expect='WELL_OVERFLOW', plate_id='p', wells=['A1'], source_id='water', volume_m3=1e-5) + g.call(g.A, 'plate.load', expect='DRAWER_CLOSED', plate_id='p') + g.step(3.0) + g.call(g.A, 'plate.unload', expect='CARRIER_EMPTY') + g.call(g.A, 'plate.load', plate_id='p') + g.call(g.A, 'well.dispense', expect='PLATE_IN_READER', plate_id='p', wells=['A1'], source_id='water', volume_m3=1e-7) + g.call(g.A, 'run.start', expect='DRAWER_OPEN') + g.call(g.A, 'drawer.set', open=False) + g.step(3.0) + g.call(g.A, 'run.start', expect='NO_PROTOCOL') + g.call(g.A, 'protocol.configure', expect='MISSING_SETTING', mode='abs_endpoint', format='96', wells=['A1']) + g.call(g.A, 'protocol.configure', expect='BANDWIDTH_OVERLAP', mode='fi_endpoint', format='96', wells=['A1'], excitation_m=485e-9, emission_m=495e-9) + g.call(g.A, 'protocol.configure', expect='WAVELENGTH_OUT_OF_RANGE', mode='fi_endpoint', format='96', wells=['A1'], excitation_m=250e-9, emission_m=520e-9) + g.call(g.A, 'protocol.configure', expect='CYCLE_TOO_SHORT', mode='abs_endpoint', format='96', wells=['all'], wavelengths_m=[4.5e-7], cycles=5, cycle_time_s=5.0) + g.call(g.A, 'protocol.configure', mode='abs_endpoint', format='384', wells=['A1'], wavelengths_m=[4.5e-7]) + g.call(g.A, 'run.start', expect='FORMAT_MISMATCH') + g.call(g.A, 'focus.adjust', expect='EMPTY_WELL', well='A1') + g.call(g.A, 'incubator.set', expect='TEMPERATURE_TOO_LOW', temperature_k=296.15) + g.call(g.A, 'injector.load_reagent', expect='LID_CLOSED', pump='A', source_id='water', volume_m3=1e-6) + g.call(g.A, 'injector.prime', expect='NO_REAGENT', pump='A', volume_m3=1e-6) + g.call(g.A, 'lid.set', open=True) + g.call(g.A, 'run.start', expect='LID_OPEN') + g.call(g.A, 'injector.load_reagent', pump='A', source_id='water', volume_m3=1e-6) + g.call(g.A, 'injector.load_reagent', expect='REAGENT_MISMATCH', pump='A', source_id='pbs_buffer', volume_m3=1e-6) + g.call(g.A, 'run.stop', expect='NO_RUN') + g.call(g.A, 'data.spectrum', expect='NO_DATA', well='A1') + g.call(g.E, 'fault.inject', expect='INVALID_ARGUMENT', fault='injector_clog', active=True) + g.call(g.E, 'plant.configure', room_k=295.15, mains_voltage_v=180.0, noise_seed=1) + self.assertFalse(g.read('power.on')) + g.call(g.A, 'power.set', expect='MAINS_OUT_OF_RANGE', on=True) + + +def _rb_conc(od, vol=2e-7, area=3.2e-5): + l = vol / area - rt.ENG['meniscus_m'] + return (od - 0.045) / (rt.eps_at(RB, 543e-9) * l) + + +class Physics(unittest.TestCase): + def test_slas_well_positions(self): + x, y = rt.well_xy('96', 'A1') + self.assertAlmostEqual(x, 0.01438) + self.assertAlmostEqual(y, 0.01124) + x2, y2 = rt.well_xy('96', 'H12') + self.assertAlmostEqual(x2 - x, 11 * 0.009) + self.assertAlmostEqual(y2 - y, 7 * 0.009) + self.assertEqual(len(rt.well_names('384')), 384) + self.assertEqual(rt.well_names('1536')[-1], 'AF48') + self.assertAlmostEqual(rt.well_xy('384', 'B2')[0] - rt.well_xy('384', 'B1')[0], 0.0045) + self.assertEqual(rt.expand_wells('96', ['A1:B2']), ['A1', 'A2', 'B1', 'B2']) + + def test_beer_lambert_linearity_and_pathlength_correction(self): + g = Rig(seed=11) + g.on() + g.provide('rb', {RB: _rb_conc(2.0)}) + g.plate('p') + fr = [0.0, 0.125, 0.25, 0.5, 0.75, 1.0] + for j, f in enumerate(fr): + g.fill('p', [f'A{j + 1}'], 'rb', 2e-7 * f, 'water', 2e-7) + g.load('p') + _, d = g.measure(mode='abs_endpoint', format='96', wells=['A1:A6'], wavelengths_m=[543e-9], flashes=22) + v = g.values(d) + a = [v[f'A{j + 1}'] - v['A1'] for j in range(6)] + for f, x in zip(fr[1:], a[1:]): + self.assertAlmostEqual(x / (f * a[-1]), 1.0, delta=0.025) # photometric noise of two reads + self.assertAlmostEqual(v['A6'], 2.0, delta=0.04) # accuracy < 1 % at 2 OD (+ noise) + _, d = g.measure(mode='abs_endpoint', format='96', wells=['A6'], wavelengths_m=[543e-9], flashes=22, pathlength_correction=True) + r = d['rows'][0] + self.assertIn('PATHLENGTH_CORRECTED_1CM', r['flags']) + self.assertAlmostEqual(r['value'] / (rt.eps_at(RB, 543e-9) * _rb_conc(2.0) * 0.01), 1.0, delta=0.04) + + def test_od_range_and_precision(self): + res = {} + for od in (1.0, 2.0): + g = Rig(seed=12 + int(od)) + g.on() + g.provide('rb', {RB: _rb_conc(od)}) + g.plate('p') + g.fill('p', ['A1:A12'], 'rb', 2e-7) + g.load('p') + _, d = g.measure(mode='abs_endpoint', format='96', wells=['A1:A12'], wavelengths_m=[543e-9], flashes=22) + v = list(g.values(d).values()) + m = sum(v) / len(v) + sd = math.sqrt(sum((x - m) ** 2 for x in v) / (len(v) - 1)) + res[od] = sd / m + self.assertLess(res[1.0], 0.005) + self.assertLess(res[2.0], 0.008) + g = Rig(seed=14) + g.on() + g.provide('rb', {RB: _rb_conc(6.0)}) + g.plate('p') + g.fill('p', ['A1'], 'rb', 2e-7) + g.load('p') + _, d = g.measure(mode='abs_endpoint', format='96', wells=['A1'], wavelengths_m=[543e-9]) + self.assertIn('OUT_OF_RANGE', d['rows'][0]['flags']) + self.assertLess(d['rows'][0]['value'], 5.4) # stray light (1e-5) caps the reading near 5 OD + + def test_polystyrene_uv_cutoff_and_uv_plate(self): + out = {} + for ptype in ('clear', 'uv_transparent'): + g = Rig(seed=15) + g.on() + g.plate('p', '96', ptype) + g.fill('p', ['A1'], 'water', 2e-7) + g.load('p') + _, d = g.measure(mode='abs_endpoint', format='96', wells=['A1'], wavelengths_m=[260e-9]) + out[ptype] = d['rows'][0]['value'] + self.assertGreater(out['clear'], 1.0) + self.assertLess(out['uv_transparent'], 0.2) + + def test_absorbance_spectrum_maximum(self): + g = Rig(seed=16) + g.on() + g.provide('rb', {RB: _rb_conc(1.0)}) + g.plate('p') + g.fill('p', ['A1'], 'rb', 2e-7) + g.load('p') + g.measure(mode='abs_spectrum', format='96', wells=['A1'], spectrum_range_m=[400e-9, 650e-9], resolution_m=2e-9) + s = g.call(g.A, 'data.spectrum', well='A1') + k = max(range(len(s['value'])), key=lambda i: s['value'][i]) + self.assertAlmostEqual(s['wavelength_m'][k], rt.spectra()[RB]['lambda_max_m'], delta=4e-9) + + def test_documented_read_times(self): + g = Rig(seed=17) + g.on() + for fmt, t1, t10 in (('96', 8.0, 19.0), ('384', 15.0, 57.0), ('1536', 28.0, 184.0)): + for n, ref in ((1, t1), (10, t10)): + out = g.call(g.A, 'protocol.configure', mode='abs_endpoint', format=fmt, wells=['all'], wavelengths_m=[4.5e-7], flashes=n) + self.assertAlmostEqual(out['plate_read_time_s'] - rt.ENG['read_overhead_s'], ref, places=6) + + def test_fluorescence_linearity_inner_filter_and_focus(self): + g = Rig(seed=18) + g.on() + g.plate('p', '96', 'black') + concs = [1e-6, 1e-5, 1e-4, 1e-3, 3e-2] + for j, c in enumerate(concs): + g.provide(f's{j}', {FL: c}) + g.fill('p', [f'A{j + 1}'], f's{j}', 2e-7) + g.fill('p', ['B1:B4'], 'pbs_buffer', 2e-7) + g.load('p') + prot = dict(mode='fi_endpoint', format='96', wells=['A1:A5', 'B1:B4'], excitation_m=485e-9, emission_m=528e-9, excitation_bandwidth_m=10e-9, emission_bandwidth_m=20e-9) + _, d0 = g.measure(**dict(prot, focal_height_m=0.0005)) + g.call(g.A, 'focus.adjust', well='A3') + g.step(rt.ENG['focus_scan_s'] + 0.2) + _, d = g.measure(**prot) + v, v0 = g.values(d), g.values(d0) + blank = sum(v[f'B{i}'] for i in range(1, 5)) / 4 + r = [(v[f'A{j + 1}'] - blank) / concs[j] for j in range(4)] + for x in r[1:]: + self.assertAlmostEqual(x / r[1], 1.0, delta=0.05) # linear over three decades (EDR) + self.assertLess((v['A5'] - blank) / concs[4], 0.7 * r[2]) # inner filter at high absorbance + self.assertGreater(v['A4'], 1.5 * v0['A4']) # autofocus beats a bad focal height + self.assertAlmostEqual(g.read('focus.height_m') * 1e4, round(g.read('focus.height_m') * 1e4), places=6) + + def test_fixed_gain_overflow_and_auto_gain(self): + g = Rig(seed=19) + g.on() + g.provide('f', {FL: 1e-3}) + g.plate('p', '96', 'black') + g.fill('p', ['A1:A2'], 'f', 2e-7) + g.load('p') + prot = dict(mode='fi_endpoint', format='96', wells=['A1:A2'], excitation_m=485e-9, emission_m=528e-9, gain=4000) + _, d = g.measure(**prot) + self.assertIn('OVERFLOW', d['rows'][0]['flags']) + g.call(g.A, 'protocol.configure', **dict(prot, gain=1000)) + out = g.call(g.A, 'gain.adjust', well='A1', target_fraction=0.5) + g.step(2.5) + self.assertEqual(g.read('protocol.current')['gain'], out['gain']) + g.call(g.A, 'run.start') + g.step(10.0) + v = g.call(g.A, 'data.read')['rows'][0]['value'] + self.assertAlmostEqual(v / rt.ENG['counts_full_scale'], 0.5, delta=0.05) + + def test_bottom_reading_lower_signal(self): + g = Rig(seed=20) + g.on() + g.provide('f', {FL: 1e-4}) + out = {} + for ptype in ('black_clear_bottom', 'black'): + g.plate(ptype, '96', ptype) + g.fill(ptype, ['A1'], 'f', 2e-7) + g.load(ptype) + _, d = g.measure(mode='fi_endpoint', format='96', wells=['A1'], excitation_m=485e-9, emission_m=528e-9, optic='bottom') + out[ptype] = d['rows'][0]['value'] + g.unload() + self.assertGreater(out['black_clear_bottom'], 10 * out['black']) + + def test_fp_binding_curve(self): + g = Rig(seed=21) + g.on() + g.plate('p', '384', 'black') + rec = [0.0, 1e-5, 1e-4, 1e-3, 1e-2] + for j, r in enumerate(rec): + g.provide(f't{j}', {FL: 1e-6}, binding=dict(tracer=FL, receptor_mol_m3=r, kd_mol_m3=1e-4)) + g.fill('p', [f'A{j + 1}'], f't{j}', 2e-8) + g.load('p') + _, d = g.measure(mode='fp_endpoint', format='384', wells=['A1:A5'], excitation_m=482e-9, emission_m=530e-9, excitation_bandwidth_m=16e-9, emission_bandwidth_m=30e-9) + v = [g.values(d)[f'A{j + 1}'] for j in range(5)] + self.assertTrue(all(b > a for a, b in zip(v, v[1:])), v) + self.assertAlmostEqual(v[0], 1000 * 3 * 0.02 / 2.02, delta=2.0) + f_mid = (v[2] - v[0]) / (v[4] - v[0]) + self.assertTrue(0.3 < f_mid < 0.7, f_mid) # half-bound near receptor = Kd + + def test_luminescence_glow_and_flash_injection(self): + g = Rig(seed=22) + g.on() + g.provide('atp', {'atp': 1e-4}) + g.plate('p', '96', 'white') + g.fill('p', ['A1:A3'], 'atp', 5e-8) + g.fill('p', ['A1:A2'], 'glow_luciferase_reagent', 5e-8) + g.load('p') + _, d1 = g.measure(mode='lum_endpoint', format='96', wells=['A1:A3'], integration_s=1.0) + g.step(3600.0) + _, d2 = g.measure(mode='lum_endpoint', format='96', wells=['A1:A3'], integration_s=1.0) + a1, a2 = g.values(d1), g.values(d2) + self.assertGreater(a1['A1'], 1000 * abs(a1['A3']) + 1e4) + self.assertAlmostEqual(a2['A1'] / a1['A1'], math.exp(-3600.0 / rt.ENG['glow_decay_s']), delta=0.03) + g.call(g.A, 'lid.set', open=True) + g.call(g.A, 'injector.load_reagent', pump='B', source_id='flash_luciferase_reagent', volume_m3=5e-6) + g.call(g.A, 'lid.set', open=False) + g.call(g.A, 'protocol.configure', mode='lum_endpoint', format='96', wells=['A3'], integration_s=0.5, cycles=12, cycle_time_s=2.0, + injections=[dict(pump='B', volume_m3=5e-8, cycle=2)]) + g.call(g.A, 'run.start', expect='INJECTOR_NOT_PRIMED') + g.call(g.A, 'injector.prime', pump='B', volume_m3=1e-6) + g.step(4.0) + _, d = g.measure(mode='lum_endpoint', format='96', wells=['A3'], integration_s=0.5, cycles=12, cycle_time_s=2.0, injections=[dict(pump='B', volume_m3=5e-8, cycle=2)]) + v = [r['value'] for r in d['rows']] + k = max(range(len(v)), key=lambda i: v[i]) + self.assertIn(k, (1, 2, 3)) + self.assertLess(v[-1], 0.5 * v[k]) # flash kinetics decay + led = g.call(g.E, 'ledger.read')['ledger'] + self.assertAlmostEqual(led['injected_m3'], 5e-8, delta=1e-12) + + def test_injector_backflush_and_clog(self): + g = Rig(seed=23) + g.on() + g.call(g.A, 'lid.set', open=True) + g.call(g.A, 'injector.load_reagent', pump='A', source_id='water', volume_m3=5e-6) + g.call(g.A, 'lid.set', open=False) + g.call(g.A, 'injector.prime', pump='A', volume_m3=1e-6) + g.call(g.A, 'injector.backflush', expect='BUSY', pump='A') + g.step(5.0) + self.assertTrue(g.read('injectors.status')['A']['primed']) + out = g.call(g.A, 'injector.backflush', pump='A') + self.assertAlmostEqual(out['returned_m3'], rt.ENG['line_volume_m3']) + g.step(3.0) + g.call(g.E, 'fault.inject', fault='injector_clog', active=True, pump='A') + g.call(g.A, 'injector.prime', expect='INJECTOR_BLOCKED', pump='A', volume_m3=1e-6) + + def test_incubation_and_arrhenius_kinetics(self): + def rate(T): + g = Rig(seed=24) + g.on() + if T: + g.call(g.A, 'incubator.set', temperature_k=T) + g.provide('rx', {RB: 1e-3}, reactions=[dict(source=RB, product=FL, k_per_s=1e-4, ea_j_mol=5e4)]) + g.plate('p', '96', 'clear') + g.fill('p', ['A1'], 'rx', 2e-7) + g.load('p') + g.step(3600.0) + tp = g.read('truth.plates')['p'] + c = tp['wells']['A1']['conc_mol_m3'] + return g.read('chamber.temperature_k'), c.get(FL, 0.0) / (c.get(FL, 0.0) + c.get(RB, 0.0)) + T0, f0 = rate(None) + T1, f1 = rate(310.15) + self.assertAlmostEqual(T1, 310.15, delta=0.3) + self.assertGreater(f1, f0 * 1.3) # Ea 50 kJ/mol: about 2.2 x faster at 37 C (plate warm-up included) + + def test_evaporation_edge_and_seal(self): + g = Rig(seed=25) + g.on() + g.call(g.A, 'incubator.set', temperature_k=310.15) + g.plate('o', '96', 'clear') + g.plate('s', '96', 'clear') + for pid in ('o', 's'): + g.fill(pid, ['all'], 'water', 2e-7) + g.call(g.A, 'plate.seal', plate_id='s', sealed=True) + g.load('o') + g.step(4 * 3600.0) + w = g.read('truth.plates') + lost_edge = 2e-7 - w['o']['wells']['A1']['volume_m3'] + lost_mid = 2e-7 - w['o']['wells']['D6']['volume_m3'] + lost_sealed = 2e-7 - w['s']['wells']['D6']['volume_m3'] + self.assertGreater(lost_edge, 1.5 * lost_mid) + self.assertLess(lost_sealed, 0.1 * lost_mid) + + def test_injection_triggered_reaction_kinetics(self): + g = Rig(seed=26) + g.on() + g.provide('sub', {RB: 1e-3}, reactions=[dict(source=RB, product=FL, k_per_s=0.02, trigger='atp')]) + g.provide('trig', {'atp': 1e-1}) + g.plate('p', '96', 'clear') + g.fill('p', ['A1'], 'sub', 1.5e-7) + g.load('p') + g.call(g.A, 'lid.set', open=True) + g.call(g.A, 'injector.load_reagent', pump='A', source_id='trig', volume_m3=5e-6) + g.call(g.A, 'lid.set', open=False) + g.call(g.A, 'injector.prime', pump='A', volume_m3=5e-7) + g.step(3.0) + _, d = g.measure(mode='abs_endpoint', format='96', wells=['A1'], wavelengths_m=[543e-9], cycles=20, cycle_time_s=10.0, + injections=[dict(pump='A', volume_m3=5e-8, cycle=3)], shake=dict(mode='orbital', duration_s=2.0, before_each_cycle=False)) + v = [r['value'] for r in d['rows']] + self.assertLess(abs(v[1] - v[0]), 0.03) # nothing before the injection + self.assertLess(v[-1], 0.6 * v[2]) # the dye is consumed after the trigger arrives + + def test_analysis_standard_curve_and_z_prime(self): + g = Rig(seed=27) + g.on() + g.plate('p', '96', 'black') + stds = {} + for j, c in enumerate([0.0, 1e-5, 2e-5, 5e-5, 1e-4]): + if c: + g.provide(f'c{j}', {FL: c}) + g.fill('p', [f'A{j + 1}'], f'c{j}', 2e-7) + else: + g.fill('p', [f'A{j + 1}'], 'pbs_buffer', 2e-7) + stds[f'A{j + 1}'] = c + g.provide('pos', {FL: 8e-5}) + g.fill('p', ['B1:B8'], 'pos', 2e-7) + g.fill('p', ['C1:C8'], 'pbs_buffer', 2e-7) + g.load('p') + g.measure(mode='fi_endpoint', format='96', wells=['A1:C8'], excitation_m=485e-9, emission_m=528e-9) + out = g.call(g.A, 'data.analyze', blank_wells=['C1:C8'], standards=stds, fit='linear', positive_wells=['B1:B8'], negative_wells=['C1:C8']) + self.assertGreater(out['fit']['r2'], 0.999) + self.assertAlmostEqual(out['concentrations']['B4'] / 8e-5, 1.0, delta=0.05) + self.assertGreater(out['z_prime'], 0.8) + out4 = g.call(g.A, 'data.analyze', standards=stds, fit='4pl') + self.assertEqual(out4['fit']['model'], '4pl') + + def test_power_cycle_interlocks_and_ledger(self): + g = Rig(seed=28) + g.call(g.A, 'power.press_switch') + self.assertTrue(g.read('lamp.busy')) + g.call(g.A, 'drawer.set', expect='BUSY', open=True) + g.step(rt.ENG['initialisation_s'] + 0.5) + g.call(g.A, 'drawer.set', open=True) + g.step(1.0) + self.assertTrue(0.0 < g.read('drawer.position_m') < 0.185) + g.step(2.0) + self.assertAlmostEqual(g.read('drawer.position_m'), 0.185) + g.call(g.A, 'lid.set', open=True) + self.assertAlmostEqual(g.read('lid.angle_rad'), 1.25) + g.step(0.2) + self.assertIn('LID_OPEN', g.read('warnings.active')) + g.call(g.A, 'lid.set', open=False) + for k in rt.KITS: + g.call(g.E, 'kit.provide', kit=k, volume_m3=1e-3) + g.plate('p', '384', 'black') + g.fill('p', ['all'], 'water', 2e-8) + g.call(g.A, 'plate.load', plate_id='p') + g.call(g.A, 'drawer.set', open=False) + g.step(3.0) + g.call(g.A, 'protocol.configure', mode='fi_endpoint', format='384', wells=['all'], excitation_m=485e-9, emission_m=528e-9) + g.call(g.A, 'run.start') + g.call(g.A, 'lid.set', expect='RUN_ACTIVE', open=True) + g.step(2.0) + self.assertEqual(g.call(g.A, 'run.stop')['state'], 'stopped') + g.call(g.A, 'run.start') + g.step(2.0) + g.call(g.A, 'power.press_switch') + self.assertEqual(g.read('run.status')['state'], 'stopped') + self.assertFalse(g.read('lamp.power')) + codes = {e['code'] for e in g.call(g.A, 'events.read', since_s=0.0)['events']} + self.assertTrue({'POWER_ON', 'RUN_START', 'POWER_OFF'} <= codes) + prov = g.call(g.A, 'provenance.read') + self.assertGreaterEqual(len(prov['species']), 150) + led = g.call(g.E, 'ledger.read')['ledger'] + self.assertAlmostEqual(led['dispensed_m3'], 384 * 2e-8, delta=1e-12) + out = g.call(g.E, 'truth.inspect', plate_id='p') + self.assertIn('p', out['state']['plates']) + g.call(g.A, 'run.stop', expect='NO_RUN') + + +class ReviewRegressions(unittest.TestCase): + def test_injection_mass_balance(self): + g = Rig(seed=31) + g.on() + g.plate('p') + g.fill('p', ['A1:H12'], 'water', 1e-7) + g.call(g.A, 'lid.set', open=True) + g.call(g.A, 'injector.load_reagent', pump='A', source_id='water', volume_m3=2e-5) + g.call(g.A, 'lid.set', open=False) + g.call(g.A, 'injector.prime', pump='A', volume_m3=1e-6) + g.step(5.0) + g.load('p') + g.measure(mode='abs_endpoint', format='96', wells=['A1:H12'], wavelengths_m=[450e-9], injections=[dict(pump='A', volume_m3=1e-7, cycle=1)]) + led = g.call(g.E, 'ledger.read')['ledger'] + st = g.read('injectors.status')['A'] + held = st['bottle_m3'] + st['line_m3'] + self.assertAlmostEqual(led['injected_m3'], 96 * 1e-7, delta=1e-12) + self.assertAlmostEqual(led['reagent_loaded_m3'], held + led['primed_to_waste_m3'] + led['injected_m3'] + led['plate_waste_m3'], delta=1e-12) + + def test_luminescence_noise_scales_with_integration_and_blanks_positive(self): + sds = {} + for integ in (1.0, 10.0): + g = Rig(seed=32) + g.on() + g.plate('p', '96', 'white') + g.fill('p', ['A1:D12'], 'pbs_buffer', 1e-7) + g.load('p') + _, d = g.measure(mode='lum_endpoint', format='96', wells=['A1:D12'], integration_s=integ) + v = list(g.values(d).values()) + self.assertTrue(all(x >= 0 for x in v)) + m = sum(v) / len(v) + sds[integ] = math.sqrt(sum((x - m) ** 2 for x in v) / (len(v) - 1)) + self.assertTrue(2.0 < sds[10.0] / sds[1.0] < 4.5, sds) # ~sqrt(10): the dark variance grows with the integration time + + def test_fixed_low_gain_blanks_not_negative(self): + g = Rig(seed=33) + g.on() + g.plate('p', '96', 'black') + g.fill('p', ['A1:A12'], 'pbs_buffer', 2e-7) + g.load('p') + _, d = g.measure(mode='fi_endpoint', format='96', wells=['A1:A12'], excitation_m=485e-9, emission_m=528e-9, gain=800, flashes=1) + self.assertTrue(all(v >= 0 for v in g.values(d).values())) + + def test_degenerate_standards_rejected(self): + g = Rig(seed=34) + g.on() + g.plate('p') + g.fill('p', ['A1:B5'], 'water', 2e-7) + g.load('p') + g.measure(mode='abs_endpoint', format='96', wells=['A1:B5'], wavelengths_m=[450e-9]) + g.call(g.A, 'data.analyze', expect='INSUFFICIENT_STANDARDS', standards={'A1': 0.0, 'A2': 0.0}, fit='linear') + + def test_kinetic_cycles_do_not_overlap_with_first_cycle_shake(self): + g = Rig(seed=35) + g.on() + g.plate('p') + g.fill('p', ['A1:H12'], 'water', 2e-7) + g.load('p') + _, d = g.measure(mode='abs_endpoint', format='96', wells=['all'], wavelengths_m=[543e-9], flashes=10, cycles=2, cycle_time_s=20.5, + shake=dict(mode='orbital', duration_s=60.0, before_each_cycle=False)) + t1 = max(r['time_s'] for r in d['rows'] if r['cycle'] == 1) + t2 = min(r['time_s'] for r in d['rows'] if r['cycle'] == 2) + self.assertGreater(t2, t1) + _, d = g.measure(mode='abs_endpoint', format='96', wells=['all'], wavelengths_m=[543e-9], flashes=10, cycles=3, cycle_time_s=20.5, + shake=dict(mode='orbital', duration_s=60.0, before_each_cycle=False)) + first = {c: min(r['time_s'] for r in d['rows'] if r['cycle'] == c) for c in (1, 2, 3)} + self.assertAlmostEqual(first[3] - first[2], 20.5, delta=0.11) # after an overrun the configured cycle time is kept + g.unload() + g.plate('q') + g.fill('q', ['A1'], 'water', 2e-7) + g.load('q') + _, d = g.measure(mode='abs_endpoint', format='96', wells=['A1:A2'], wavelengths_m=[450e-9], pathlength_correction=True) + fl = {r['well']: r['flags'] for r in d['rows']} + self.assertIn('PATHLENGTH_CORRECTED_1CM', fl['A1']) + self.assertIn('PATHLENGTH_NOT_APPLICABLE', fl['A2']) + self.assertIn('EMPTY', fl['A2']) + + def test_fp_blank_wells_undefined_and_opaque_pathlength(self): + g = Rig(seed=36) + g.on() + g.plate('p', '96', 'black') + g.fill('p', ['A1:A3'], 'pbs_buffer', 2e-7) + g.load('p') + _, d = g.measure(mode='fp_endpoint', format='96', wells=['A1:A6'], excitation_m=485e-9, emission_m=528e-9) + for r in d['rows']: + self.assertTrue(r['value'] is None and 'LOW_SIGNAL' in r['flags'] or -1000.0 <= r['value'] <= 1000.0, r) + _, d = g.measure(mode='abs_endpoint', format='96', wells=['A1:A3'], wavelengths_m=[450e-9], pathlength_correction=True) + self.assertIn('OPAQUE_PLATE', g.read('warnings.active')) + for r in d['rows']: + self.assertIn('PATHLENGTH_NOT_APPLICABLE', r['flags']) + self.assertGreater(r['value'], 0.0) + + def test_grid_anchored_before_plant(self): + h = rt.BmgClariostarplusRuntime('grid_probe') + h.step(0.05) + self.assertEqual(h.t_grid, 0.0) + h.step(0.07) + self.assertAlmostEqual(h.t_grid, 0.1) + + +class Settings(unittest.TestCase): + def test_read_order_and_dual_emission(self): + g = Rig(seed=29) + g.on() + g.provide('mix', {FL: 1e-4, RB: 1e-4}) + g.plate('p', '96', 'black') + g.fill('p', ['A1:B3'], 'mix', 2e-7) + g.load('p') + _, d = g.measure(mode='fi_endpoint', format='96', wells=['A1:B3'], excitation_m=485e-9, emission_m=528e-9, emission2_m=580e-9, read_order='serpentine') + first = [r['well'] for r in d['rows'] if 'EMISSION_2' not in r['flags']] + self.assertEqual(first, ['A1', 'A2', 'A3', 'B3', 'B2', 'B1']) + t = {r['well']: r['time_s'] for r in d['rows'] if 'EMISSION_2' not in r['flags']} + self.assertLess(t['B3'], t['B1']) + second = [r for r in d['rows'] if 'EMISSION_2' in r['flags']] + self.assertEqual(len(second), 6) + self.assertTrue(all(r['wavelength_m'] == 580e-9 for r in second)) + + +class ZCoverage(unittest.TestCase): + def test_all_capabilities_exercised(self): + implemented = {k for k in rt.CAPS if k not in rt.UNSUPPORTED} + missing = implemented - SEEN_CAPS + if len(SEEN_CAPS) > 5: + self.assertFalse(missing, sorted(missing)) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_asset_bronkhorst_cemw.py b/tests/test_asset_bronkhorst_cemw.py new file mode 100644 index 0000000000000000000000000000000000000000..da5beb4eb901329bd642a1a5a7b88ae89049af28 --- /dev/null +++ b/tests/test_asset_bronkhorst_cemw.py @@ -0,0 +1,643 @@ +"""tests for CHEM-183 bronkhorst_cemw (Bronkhorst CEM W-202A-NN0-K controlled evaporator and mixer): python3 -m unittest tests/test_asset_bronkhorst_cemw.py + +Themes: contract consistency (slots, effects, errors raised vs declared); agent / evaluator truth isolation; idempotent request ids; two instances +isolated; step-partition independence; rejected calls leave the state unchanged; every output validated against its schema and every success +changes only declared slots; NIST Antoine data reproduce the normal boiling points and the Clausius-Clapeyron enthalpy of vaporization agrees with +the NIST tables; Bronkhorst normal litres (0 C, 1 atm); complete evaporation with species mass balance; the documented W-202A capacity (water +about 120 g/h at 10 ln/min, 100 W) and the incomplete evaporation above it; temperature set point too low and downstream condensation below the +dew point; process pressure raises the dew point; FLUIDAT-like calculation agrees with the process; heater without cooling and the 200 C safety +switch; stopping the heater before the liquid floods the exchanger; bleeding the mixing valve; liquid without carrier gas pushed into the gas line +and purged; power off closes the valves; faults (heater, PT100, clogging, pressure fluctuation); supply pressure too low; documented capacity +window alarms; liquid mixtures.""" +import json +import math +import re +import sys +import unittest +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / 'scripts')) +from asset_runtime import bronkhorst_cemw as rt # noqa: E402 + +INST = 'bronkhorst_cemw_01' +CHECKS = [] +SEEN_CAPS = set() +PROCESS_EVIDENCE = {} +LN = rt.LN_MIN +GH = 1.0 / 3.6e6 # 1 g/h in kg/s + + +def _differ(x, y): + if isinstance(x, float) and isinstance(y, float): + return abs(x - y) > 1e-12 * max(1.0, abs(x), abs(y)) + return json.dumps(x, sort_keys=True, default=str) != json.dumps(y, sort_keys=True, default=str) + + +class Rig: + def __init__(self, seed=1, ambient=295.15, pressure=101325.0, line=295.15, instance=INST): + self.h = rt.BronkhorstCemwRuntime(instance) + self.h.register_principal('agent', 'agent') + self.h.register_principal('eval', 'evaluator') + self.A = self.h.session('agent') + self.E = self.h.session('eval') + self.n = 0 + self.inst = instance + self.call(self.E, 'plant.configure', ambient_k=ambient, process_pressure_pa=pressure, line_temperature_k=line, noise_seed=seed) + + def call(self, sess, cap, expect='succeeded', **args): + """Instrumented call: outputs validated against the declared schema; a success changes only declared immediate slots and never the clock; + a rejection leaves every slot unchanged and returns a declared error code.""" + self.n += 1 + before, t0 = self.h.read('evaluator'), self.h.t + r = sess.invoke(instance_id=self.inst, capability_id=cap, arguments=args, request_id=f'r{self.n}') + after = self.h.read('evaluator') + changed = {k for k in after if _differ(after[k], before[k])} - {'clock.time_s'} + if expect == 'succeeded': + assert r['status'] == 'succeeded', (cap, r['error']) + rt.validate(rt.CAPS[cap]['output_schema'], r['result']) + if cap != 'sim.step': + extra = changed - set(rt.EFFECTS.get(cap, [])) + assert not extra, (cap, sorted(extra)) + assert self.h.t == t0, cap + SEEN_CAPS.add(cap) + PROCESS_EVIDENCE.setdefault(cap, []).append(dict(arguments=json.dumps(args, sort_keys=True, default=str)[:200], time_s=t0, status=r['status'])) + return r['result'] + assert r['status'] in ('rejected', 'unsupported'), (cap, r['status'], r.get('result')) + assert r['error']['code'] == expect, (cap, r['error']['code'], expect) + assert not changed, (cap, 'rejected call changed', sorted(changed)) + assert expect in [e['code'] for e in rt.export_bronkhorst_cemw_contract_metadata()['capabilities'][cap]['errors']], (cap, expect) + return r + + def step(self, s): + self.call(self.E, 'sim.step', dt_s=float(s)) + + def read(self, *ids, who=None): + sess = who or self.E + o = sess.read(instance_id=self.inst, state_ids=list(ids) if ids else None)['observations'] + return {k: v['value'] for k, v in o.items()} if not ids or len(ids) > 1 else o[ids[0]]['value'] + + def connect(self, liquid=None, gas='nitrogen', p_liq=3.0e5, p_gas=4.0e5, bleed=True): + P = self.h.plant['process_pressure_pa'] + self.call(self.A, 'supply.connect_liquid', composition=liquid or {'water': 1.0}, pressure_pa=P + p_liq) + self.call(self.A, 'supply.connect_gas', gas=gas, pressure_pa=P + p_gas) + self.call(self.A, 'power.set', on=True) + self.call(self.A, 'controllers.configure', gas_full_scale_m3_s=rt.GAS_FS_MAX, liquid_full_scale_kg_s=rt.LIQ_FS_MAX) + if bleed: + self.call(self.A, 'bleed.set', open=True) + self.step(rt.ENG['bleed_clear_s'] + 3.0) + self.call(self.A, 'bleed.set', open=False) + self.step(3.0) + + def start(self, g_h=100.0, ln=10.0, T=423.15, warm=500.0, run=900.0): + self.call(self.A, 'heater.set_temperature', setpoint_k=T) + self.call(self.A, 'gas.set_flow', setpoint_m3_s=ln * LN) + self.step(warm) + self.call(self.A, 'liquid.set_flow', setpoint_kg_s=g_h * GH) + self.step(run) + return self.read() + + def ledger(self): + return self.call(self.E, 'ledger.read')['ledger'] + + +def _raised_codes(): + src = Path(rt.__file__).read_text() + funcs = {} + for m in re.finditer(r'\n def (\w+)\(self[^\n]*\n(.*?)(?=\n def |\n# ----|\nclass |\ndef )', src, re.S): + funcs[m.group(1)] = m.group(2) + own = {k: set(re.findall(r"ActionRejected\('([A-Z_]+)'\)", v)) for k, v in funcs.items()} + calls = {k: set(re.findall(r'self\.(_\w+)\(', v)) & set(funcs) for k, v in funcs.items()} + out = {} + for k in funcs: + if not k.startswith('_cmd_'): + continue + seen, todo, codes = set(), [k], set() + while todo: + f = todo.pop() + if f in seen: + continue + seen.add(f) + codes |= own.get(f, set()) + todo += [g for g in calls.get(f, ()) if g not in ('_cmd_sim_step', 'step', '_tick')] + out[k[5:].replace('_', '.', 1)] = codes + return out + + +def _balance(test, led, tol=1e-9): + for s, d in led.items(): + fed = d.get('fed_kg', 0.0) + acc = sum(d.get(k, 0.0) for k in ('bled_kg', 'into_gas_line_kg', 'purged_from_gas_line_kg', 'evaporated_kg', 'pooled_kg', 'carried_over_kg')) + test.assertAlmostEqual(fed, acc, delta=tol + 1e-9 * fed, msg=(s, d)) + ev = d.get('evaporated_kg', 0.0) + test.assertAlmostEqual(ev, d.get('delivered_kg', 0.0) + d.get('condensed_in_line_kg', 0.0) + d['outlet_holdup_kg'], delta=tol + 1e-9 * ev, msg=(s, d)) + test.assertGreaterEqual(d['outlet_holdup_kg'], -1e-12) + + +class Contract(unittest.TestCase): + def test_metadata_slots_effects_and_mirrors_consistent(self): + meta = rt.export_bronkhorst_cemw_contract_metadata() + slots = set(meta['state_slots']) + self.assertEqual(slots, set(rt.SLOTS)) + for k, c in meta['capabilities'].items(): + for e in c['state_effects']: + self.assertIn(e['state_id'], slots, k) + for x in c['observes']: + self.assertIn(x, slots, k) + for pre in c['preconditions']: + self.assertTrue(set(pre['state_ids']) <= slots, k) + self.assertTrue({'INVALID_ARGUMENT', 'REQUEST_CONFLICT', 'UNKNOWN_INSTANCE'} <= {e['code'] for e in c['errors']}, k) + self.assertIn(c['kind'], ('query', 'device_command', 'robot_skill', 'simulation', 'analysis', 'configuration')) + self.assertIn(c['model_effects']['mode'], ('none', 'direct', 'coupled', 'host_required')) + self.assertTrue(rt.SCENE_MIRRORED <= slots) + for name, p in meta['mechanisms']['controlled_evaporation_mixing']['parameters'].items(): + self.assertEqual(name, name.lower()) + self.assertIn(p['evidence'], ('documented', 'assumption'), name) + + def test_declared_errors_cover_raised_codes(self): + meta = rt.export_bronkhorst_cemw_contract_metadata() + for cap, codes in _raised_codes().items(): + declared = {e['code'] for e in meta['capabilities'][cap]['errors']} + self.assertTrue(codes <= declared, (cap, sorted(codes - declared))) + + def test_unsupported_capabilities(self): + g = Rig() + for k in rt.UNSUPPORTED: + r = g.A.invoke(instance_id=INST, capability_id=k, arguments={}, request_id='u-' + k) + self.assertEqual((r['status'], r['error']['code']), ('unsupported', 'UNSUPPORTED')) + + def test_agent_truth_isolation(self): + g = Rig() + d = g.A.describe(instance_id=INST) + self.assertFalse(any(k.startswith('truth.') for k in d['state_slots'])) + with self.assertRaises(rt.ActionRejected): + g.A.read(instance_id=INST, state_ids=['truth.stream']) + for cap, args in (('truth.inspect', {}), ('sim.step', dict(dt_s=1.0)), ('ledger.read', {}), ('fault.inject', dict(fault='clogging', active=True)), + ('plant.configure', dict(ambient_k=295.15, process_pressure_pa=101325.0, line_temperature_k=295.15, noise_seed=1))): + r = g.A.invoke(instance_id=INST, capability_id=cap, arguments=args, request_id='x-' + cap) + self.assertEqual(r['error']['code'], 'ACCESS_DENIED', cap) + g.call(g.E, 'fault.inject', fault='heater_failure', active=True) + self.assertFalse(any(e['kind'] == 'fault' for e in g.call(g.A, 'events.read', since_s=0.0)['events'])) + self.assertTrue(any(e['kind'] == 'fault' for e in g.call(g.E, 'events.read', since_s=0.0)['events'])) + + def test_idempotent_request_ids(self): + g = Rig() + g.connect(bleed=False) + args = dict(setpoint_m3_s=5 * LN) + r1 = g.A.invoke(instance_id=INST, capability_id='gas.set_flow', arguments=args, request_id='same') + snap = g.h.read('evaluator') + r2 = g.A.invoke(instance_id=INST, capability_id='gas.set_flow', arguments=args, request_id='same') + self.assertEqual(r1, r2) + self.assertEqual(json.dumps(snap, sort_keys=True, default=str), json.dumps(g.h.read('evaluator'), sort_keys=True, default=str)) + r3 = g.A.invoke(instance_id=INST, capability_id='gas.set_flow', arguments=dict(setpoint_m3_s=6 * LN), request_id='same') + self.assertEqual(r3['error']['code'], 'REQUEST_CONFLICT') + + def test_two_instances_isolated(self): + a, b = Rig(instance='c_a'), Rig(instance='c_b', ambient=298.15) + a.call(a.A, 'power.set', on=True) + self.assertFalse(b.read('power.on')) + r = a.A.invoke(instance_id='c_b', capability_id='power.set', arguments=dict(on=True), request_id='z') + self.assertEqual(r['error']['code'], 'UNKNOWN_INSTANCE') + + def test_step_partition_independence(self): + def run(steps): + g = Rig(seed=5) + g.connect() + g.call(g.A, 'heater.set_temperature', setpoint_k=413.15) + g.call(g.A, 'gas.set_flow', setpoint_m3_s=5 * LN) + g.call(g.A, 'liquid.set_flow', setpoint_kg_s=60 * GH) + for s in steps: + g.step(s) + r = g.read() + return json.dumps({k: r[k] for k in r if k.startswith(('truth.', 'measured.', 'heater.'))}, sort_keys=True), json.dumps(g.ledger(), sort_keys=True) + a = run([300.0]) + b = run([0.05] * 400 + [0.37, 13.11, 266.52]) + c = run([10.0] * 30) + self.assertEqual(a, b) + self.assertEqual(a, c) + + def test_rejections_change_nothing(self): + g = Rig() + r = rt.BronkhorstCemwRuntime('fresh') + r.register_principal('e', 'evaluator') + self.assertEqual(r.session('e').invoke(instance_id='fresh', capability_id='power.set', arguments=dict(on=True), request_id='p')['error']['code'], 'PLANT_REQUIRED') + g.call(g.E, 'plant.configure', expect='SEED_FIXED', ambient_k=295.15, process_pressure_pa=101325.0, line_temperature_k=295.15, noise_seed=2) + g.call(g.A, 'gas.set_flow', expect='POWER_OFF', setpoint_m3_s=LN) + g.call(g.A, 'heater.set_temperature', expect='POWER_OFF', setpoint_k=373.15) + g.call(g.A, 'supply.connect_liquid', expect='UNKNOWN_LIQUID', composition={'unobtainium': 1.0}, pressure_pa=4e5) + g.call(g.A, 'supply.connect_liquid', expect='INVALID_COMPOSITION', composition={'water': 0.5, 'ethanol': 0.4}, pressure_pa=4e5) + g.call(g.A, 'supply.connect_liquid', expect='PRESSURE_ABOVE_RATING', composition={'water': 1.0}, pressure_pa=1.2e7) + g.call(g.A, 'supply.connect_gas', expect='PRESSURE_ABOVE_RATING', gas='nitrogen', pressure_pa=1.5e7) + g.call(g.A, 'mixture.calculate', expect='NO_LIQUID_SUPPLY') + g.call(g.A, 'power.set', on=True) + g.call(g.A, 'gas.set_flow', expect='NO_GAS_SUPPLY', setpoint_m3_s=LN) + g.call(g.A, 'liquid.set_flow', expect='NO_LIQUID_SUPPLY', setpoint_kg_s=10 * GH) + g.call(g.A, 'supply.connect_liquid', composition={'water': 1.0}, pressure_pa=4e5) + g.call(g.A, 'mixture.calculate', expect='NO_GAS_SUPPLY') + g.call(g.A, 'supply.connect_gas', gas='nitrogen', pressure_pa=5e5) + g.call(g.A, 'controllers.configure', gas_full_scale_m3_s=5 * LN, liquid_full_scale_kg_s=60 * GH) + g.call(g.A, 'gas.set_flow', expect='SETPOINT_ABOVE_FULL_SCALE', setpoint_m3_s=6 * LN) + g.call(g.A, 'liquid.set_flow', expect='SETPOINT_ABOVE_FULL_SCALE', setpoint_kg_s=70 * GH) + g.call(g.A, 'gas.set_flow', setpoint_m3_s=2 * LN) + g.call(g.A, 'controllers.configure', expect='FLOW_ACTIVE', gas_full_scale_m3_s=rt.GAS_FS_MAX, liquid_full_scale_kg_s=rt.LIQ_FS_MAX) + g.call(g.A, 'supply.connect_gas', expect='GAS_FLOWING', gas='argon', pressure_pa=5e5) + g.call(g.A, 'liquid.set_flow', setpoint_kg_s=20 * GH) + g.call(g.A, 'supply.connect_liquid', expect='LIQUID_FLOWING', composition={'ethanol': 1.0}, pressure_pa=4e5) + g.call(g.A, 'bleed.set', expect='LIQUID_SETPOINT_NOT_ZERO', open=True) + g.call(g.A, 'liquid.set_flow', setpoint_kg_s=0.0) + g.call(g.A, 'bleed.set', open=True) + g.call(g.A, 'liquid.set_flow', expect='BLEED_OPEN', setpoint_kg_s=20 * GH) + g.call(g.E, 'fault.inject', expect='INVALID_ARGUMENT', fault='alien', active=True) + g.call(g.A, 'heater.set_temperature', expect='INVALID_ARGUMENT', setpoint_k=500.0) + + +class Library(unittest.TestCase): + def test_antoine_reproduces_normal_boiling_points(self): + ok, n = 0, 0 + for s, e in rt.liquids().items(): + tb = e.get('boiling_point_K') + if not tb: + continue + n += 1 + p = rt.psat(s, tb) + if abs(p / 101325.0 - 1.0) < 0.05: + ok += 1 + if s == 'water': + self.assertAlmostEqual(rt.dew_point({'water': 1.0}, 101325.0), 373.15, delta=0.3) + self.assertGreaterEqual(n, 50) + self.assertGreaterEqual(ok / n, 0.9, (ok, n)) + CHECKS.append(dict(id='antoine_normal_boiling_points', status='passed', layer='process', within_5pct=ok, compounds=n)) + + def test_clausius_clapeyron_dhvap_against_nist_tables(self): + errs = [] + for s, e in rt.liquids().items(): + for row in e['dhvap_table']: + if 250.0 < row['T_K'] < 0.85 * 650: + errs.append(abs(rt.dhvap(s, row['T_K']) / row['value_J_mol'] - 1.0)) + errs.sort() + med = errs[len(errs) // 2] + self.assertGreater(len(errs), 300) + self.assertLess(med, 0.06, med) + CHECKS.append(dict(id='dhvap_vs_nist_tables', status='passed', layer='process', rows=len(errs), median_rel_error=med)) + + def test_gas_properties_and_normal_litre(self): + self.assertAlmostEqual(rt.cp_gas_pure('nitrogen', 298.15), 29.12, delta=0.05) + self.assertAlmostEqual(rt.cp_gas_pure('argon', 400.0), 20.786, delta=0.01) + self.assertAlmostEqual(rt.cp_gas_pure('air', 298.15), 29.1, delta=0.2) + self.assertAlmostEqual(LN * rt.P_N / (rt.R_GAS * rt.T_N), 7.436e-4, delta=2e-7) # 1 ln/min of an ideal gas in mol/s + CHECKS.append(dict(id='gas_cp_and_normal_litre', status='passed', layer='process')) + + +class Physics(unittest.TestCase): + def test_complete_evaporation_and_species_balance(self): + g = Rig(line=433.15) + g.connect() + r = g.start(g_h=100.0, ln=10.0, T=423.15) + st = r['truth.stream'] + self.assertAlmostEqual(st['evaporated_fraction'], 1.0, places=6) + self.assertAlmostEqual(st['line_saturation_fraction'], 1.0, places=6) + self.assertNotIn('INCOMPLETE_EVAPORATION', st['conditions']) + n_w = st['vapour_mol_s']['water'] * rt.molar_mass('water') + self.assertAlmostEqual(n_w / (100.0 * GH), 1.0, delta=0.01) + self.assertAlmostEqual(r['measured.liquid_kg_s'] / (100 * GH), 1.0, delta=0.02) + led = g.ledger() + _balance(self, led) + self.assertGreater(led['water']['bled_kg'], 0.0) + y = st['mole_fraction_at_exchanger']['water'] + n_g = 10 * LN * rt.P_N / (rt.R_GAS * rt.T_N) + self.assertAlmostEqual(y, (100 * GH / rt.molar_mass('water')) / ((100 * GH / rt.molar_mass('water')) + n_g), delta=1e-6) + calc = g.call(g.A, 'mixture.calculate') + self.assertAlmostEqual(calc['vapour_mole_fraction']['water'], y, delta=1e-6) + self.assertAlmostEqual(calc['dew_point_k'], st['dew_point_k'], delta=0.05) + g.call(g.A, 'provenance.read') + CHECKS.append(dict(id='complete_evaporation_species_balance', status='passed', layer='process', dew_point_k=st['dew_point_k'])) + + def test_documented_capacity_120_g_h_water(self): + res = {} + for g_h in (110.0, 140.0): + g = Rig(line=473.15) + g.connect() + r = g.start(g_h=g_h, ln=10.0, T=473.15, warm=600.0, run=1500.0) + res[g_h] = (r['truth.stream']['evaporated_fraction'], sum(r['truth.lines']['pool_kg'].values()), r['truth.stream']['conditions'] + r['alarms.active'], g.ledger()) + self.assertGreater(res[110.0][0], 0.999) + self.assertLess(res[140.0][0], 0.97) + self.assertIn('INCOMPLETE_EVAPORATION', res[140.0][2]) + self.assertIn('WINDOW_LIQUID_ABOVE_WINDOW', res[140.0][2]) + self.assertGreater(res[140.0][3]['water'].get('carried_over_kg', 0.0) + res[140.0][1], 1e-4) + _balance(self, res[140.0][3]) + CHECKS.append(dict(id='capacity_water_120_g_h', status='passed', layer='process', evaporated_110=res[110.0][0], evaporated_140=res[140.0][0])) + + def test_low_setpoint_and_downstream_condensation(self): + g = Rig(line=295.15) + g.connect() + r = g.start(g_h=100.0, ln=2.0, T=333.15, warm=600.0, run=600.0) + self.assertLess(r['truth.stream']['evaporated_fraction'], 0.9) + self.assertIn('INCOMPLETE_EVAPORATION', r['truth.stream']['conditions']) + self.assertIn('CONDENSATION_DOWNSTREAM', r['truth.stream']['conditions']) + self.assertFalse({'INCOMPLETE_EVAPORATION', 'CONDENSATION_DOWNSTREAM'} & set(r['alarms.active'])) # no sensor sees them: evaluator truth only + led = g.ledger() + self.assertGreater(led['water']['condensed_in_line_kg'], 0.0) + _balance(self, led) + dp = r['truth.stream']['dew_point_line_k'] + self.assertGreater(dp, 295.15) + CHECKS.append(dict(id='low_setpoint_incomplete_and_line_condensation', status='passed', layer='process')) + + def test_process_pressure_raises_dew_point(self): + g = Rig() + g.connect(bleed=False) + a = g.call(g.A, 'mixture.calculate', liquid_kg_s=60 * GH, gas_m3_s=5 * LN, pressure_pa=1.0e5) + b = g.call(g.A, 'mixture.calculate', liquid_kg_s=60 * GH, gas_m3_s=5 * LN, pressure_pa=5.0e5) + self.assertGreater(b['dew_point_k'], a['dew_point_k'] + 30.0) + self.assertAlmostEqual(a['vapour_mole_fraction']['water'], b['vapour_mole_fraction']['water'], places=9) + c = g.call(g.A, 'mixture.calculate', liquid_kg_s=60 * GH, gas_m3_s=0.1 * LN) + self.assertFalse(c['within_documented_window']) + CHECKS.append(dict(id='pressure_raises_dew_point', status='passed', layer='process', dew_1bar=a['dew_point_k'], dew_5bar=b['dew_point_k'])) + + def test_heater_no_cooling_and_safety_switch(self): + g = Rig() + g.connect(bleed=False) + g.call(g.A, 'heater.set_temperature', setpoint_k=433.15) + g.step(900.0) + T1 = g.read('measured.temperature_k') + self.assertAlmostEqual(T1, 433.15, delta=1.0) + g.call(g.A, 'heater.set_temperature', setpoint_k=353.15) + g.step(60.0) + self.assertEqual(g.read('heater.output_fraction'), 0.0) + self.assertLess(g.read('measured.temperature_k'), T1) + self.assertGreater(g.read('measured.temperature_k'), 400.0) # no cooling: only the slow loss to ambient + g.h.T_hx = 474.0 # white-box: overshoot past the 200 C switch + g.h.T_meas = 474.0 # (PT100 settled on the overshoot) + g.call(g.A, 'heater.set_temperature', setpoint_k=473.15) + g.step(1.0) + self.assertIn('OVER_TEMPERATURE', g.read('alarms.active')) + self.assertIn('SETPOINT_AT_SAFETY_LIMIT', g.read('alarms.active')) + self.assertTrue(g.read('truth.thermal')['safety_switch_tripped']) + self.assertEqual(g.read('heater.output_fraction'), 0.0) + CHECKS.append(dict(id='heater_no_cooling_safety_switch', status='passed', layer='process')) + + def test_heater_off_before_liquid_floods(self): + g = Rig(line=433.15) + g.connect() + g.start(g_h=100.0, ln=5.0, T=423.15, warm=500.0, run=300.0) + g.call(g.A, 'heater.set_temperature', setpoint_k=273.15) + g.step(1800.0) + r = g.read() + self.assertIn('INCOMPLETE_EVAPORATION', r['truth.stream']['conditions']) + self.assertIn('LIQUID_ACCUMULATING', r['truth.stream']['conditions']) + led = g.ledger() + self.assertGreater(led['water'].get('carried_over_kg', 0.0), 0.0) + _balance(self, led) + CHECKS.append(dict(id='heater_off_before_liquid_floods', status='passed', layer='process')) + + def test_bleed_procedure(self): + g = Rig() + g.connect(bleed=False) + self.assertIn('BLEED_RECOMMENDED', g.read('alarms.active')) + self.assertTrue(g.read('truth.lines')['gas_in_liquid_line']) + g.call(g.A, 'bleed.set', open=True) + self.assertNotIn('BLEED_RECOMMENDED', g.read('alarms.active')) + g.step(1.0) + self.assertGreater(g.read('bleed.screw_angle_rad'), 0.0) + g.step(rt.ENG['bleed_clear_s'] + 3.0) + self.assertAlmostEqual(g.read('bleed.screw_angle_rad'), rt.BLEED_TURNS_RAD, places=6) + self.assertFalse(g.read('truth.lines')['gas_in_liquid_line']) + self.assertGreater(g.ledger()['water']['bled_kg'], 0.0) + g.call(g.A, 'bleed.set', open=False) + g.step(3.0) + self.assertEqual(g.read('bleed.screw_angle_rad'), 0.0) + CHECKS.append(dict(id='bleed_procedure', status='passed', layer='process')) + + def test_unbled_line_makes_liquid_flow_unstable(self): + vals = {} + for bleed in (False, True): + g = Rig(seed=9) + g.connect(bleed=bleed) + g.start(g_h=60.0, ln=5.0, T=413.15, warm=300.0, run=60.0) + xs = [] + for _ in range(60): + g.step(1.0) + xs.append(g.read('truth.lines')['liquid_flow_kg_s']) + m = sum(xs) / len(xs) + vals[bleed] = math.sqrt(sum((x - m) ** 2 for x in xs) / len(xs)) / m + self.assertGreater(vals[False], 3 * vals[True] + 1e-4) + CHECKS.append(dict(id='unbled_line_unstable', status='passed', layer='process', rel_sd=vals)) + + def test_liquid_without_gas_pushed_into_gas_line_and_purged(self): + g = Rig() + g.connect(p_liq=5.0e5, p_gas=3.0e5) + g.call(g.A, 'heater.set_temperature', setpoint_k=413.15) + g.call(g.A, 'liquid.set_flow', setpoint_kg_s=30 * GH) + g.step(60.0) + al = g.read('alarms.active') + self.assertIn('LIQUID_WITHOUT_GAS', al) + self.assertIn('LIQUID_PRESSURE_ABOVE_GAS', al) + self.assertGreater(g.read('truth.lines')['liquid_in_gas_line_kg'], 0.0) + self.assertGreater(g.ledger()['water']['into_gas_line_kg'], 0.0) + g.call(g.A, 'liquid.set_flow', setpoint_kg_s=0.0) + g.call(g.A, 'gas.set_flow', setpoint_m3_s=rt.GAS_FS_MAX) + g.step(rt.PURGE_CLEAR_S + 30.0) + self.assertEqual(g.read('truth.lines')['liquid_in_gas_line_kg'], 0.0) + self.assertGreater(g.ledger()['water']['purged_from_gas_line_kg'], 0.0) + _balance(self, g.ledger()) + CHECKS.append(dict(id='liquid_into_gas_line_and_purge', status='passed', layer='process')) + + def test_power_off_closes_valves(self): + g = Rig() + g.connect() + g.start(g_h=60.0, ln=5.0, T=413.15, warm=300.0, run=120.0) + g.call(g.A, 'power.set', on=False) + self.assertIsNone(g.read('measured.temperature_k')) + g.step(30.0) + tl = g.read('truth.lines') + self.assertLess(tl['gas_flow_m3_s'], 1e-9) + self.assertLess(tl['liquid_flow_kg_s'], 1e-9) + self.assertEqual(g.read('truth.thermal')['heater_power_w'], 0.0) + CHECKS.append(dict(id='power_off_closes_valves', status='passed', layer='process')) + + def test_faults_and_supply_pressure(self): + g = Rig() + g.connect(p_gas=0.05e5) + g.call(g.A, 'heater.set_temperature', setpoint_k=413.15) + g.call(g.A, 'gas.set_flow', setpoint_m3_s=5 * LN) + g.step(30.0) + self.assertIn('GAS_FLOW_DEVIATION', g.read('alarms.active')) + self.assertLess(g.read('truth.lines')['gas_flow_m3_s'], 0.5 * 5 * LN) + g.call(g.E, 'fault.inject', fault='heater_failure', active=True) + g.step(20.0) + self.assertEqual(g.read('truth.thermal')['heater_power_w'], 0.0) + g.call(g.E, 'fault.inject', fault='heater_failure', active=False) + g.call(g.E, 'fault.inject', fault='pt100_open', active=True) + self.assertIsNone(g.read('measured.temperature_k')) + g.step(5.0) + self.assertIn('SENSOR_FAILURE', g.read('alarms.active')) + self.assertEqual(g.read('heater.output_fraction'), 0.0) + g.call(g.A, 'power.set', on=False) + self.assertEqual(g.read('heater.output_fraction'), 0.0) + g.call(g.A, 'power.set', on=True) + g.call(g.E, 'fault.inject', fault='pt100_open', active=False) + g.call(g.E, 'fault.inject', fault='clogging', active=True) + g.step(300.0) + self.assertLess(g.read('truth.lines')['clog_factor'], 0.95) + g.call(g.E, 'fault.inject', fault='clogging', active=False) + g.call(g.E, 'fault.inject', fault='pressure_fluctuation', active=True) + g.call(g.E, 'fault.inject', fault='gas_inclusion', active=True) + self.assertEqual(g.call(g.E, 'truth.inspect')['faults'], ['gas_inclusion', 'pressure_fluctuation']) + CHECKS.append(dict(id='faults_and_supply_pressure', status='passed', layer='process')) + + def test_window_alarms_and_mixture(self): + g = Rig(line=453.15) + g.connect(liquid={'water': 0.5, 'ethanol': 0.5}) + g.call(g.A, 'heater.set_temperature', setpoint_k=433.15) + g.call(g.A, 'gas.set_flow', setpoint_m3_s=0.1 * LN) + g.call(g.A, 'liquid.set_flow', setpoint_kg_s=40 * GH) + self.assertIn('WINDOW_GAS_BELOW_WINDOW', g.read('alarms.active')) + g.call(g.A, 'gas.set_flow', setpoint_m3_s=5 * LN) + g.step(900.0) + st = g.read('truth.stream') + y = st['mole_fraction_at_exchanger'] + self.assertEqual(set(y), {'water', 'ethanol'}) + n_w, n_e = 0.5 / rt.molar_mass('water'), 0.5 / rt.molar_mass('ethanol') + self.assertAlmostEqual(y['water'] / y['ethanol'], n_w / n_e, delta=1e-3) + d_mix = st['dew_point_k'] + self.assertGreater(d_mix, rt.dew_point({'ethanol': y['ethanol'] + y['water']}, 101325.0) - 30) + _balance(self, g.ledger()) + CHECKS.append(dict(id='window_alarms_and_mixture', status='passed', layer='process', dew_mix_k=d_mix)) + + +class ReviewRegressions(unittest.TestCase): + def test_outlet_inventory_never_negative_after_shutdown(self): + g = Rig(line=473.15) + g.connect() + g.start(g_h=110.0, ln=10.0, T=453.15, warm=300.0, run=300.0) + g.call(g.A, 'liquid.set_flow', setpoint_kg_s=0.0) + g.call(g.A, 'gas.set_flow', setpoint_m3_s=0.0) + for _ in range(12): + g.step(50.0) + led = g.ledger() + for s, d in led.items(): + self.assertGreaterEqual(d['outlet_holdup_kg'], 0.0, (s, d)) + self.assertLessEqual(d.get('delivered_kg', 0.0) + d.get('condensed_in_line_kg', 0.0), d.get('evaporated_kg', 0.0) + 1e-15, (s, d)) + _balance(self, g.ledger()) + + def test_bleed_at_sub_atmospheric_process_books_no_negative_mass(self): + g = Rig(pressure=1.0e4) + g.call(g.A, 'supply.connect_liquid', composition={'water': 1.0}, pressure_pa=5.0e4) + g.call(g.A, 'supply.connect_gas', gas='nitrogen', pressure_pa=2.0e5) + g.call(g.A, 'bleed.set', open=True) + g.step(10.0) + led = g.ledger() + self.assertTrue(all(v >= 0.0 for v in led.get('water', {'fed_kg': 0.0}).values()), led) + + def test_every_library_liquid_survives_calculation_and_reads(self): + g = Rig(line=473.15) + g.connect(bleed=False) + for sp in rt.liquids(): + r = g.call(g.A, 'mixture.calculate', composition={sp: 1.0}, liquid_kg_s=50 * GH, gas_m3_s=5 * LN) + self.assertTrue(r['dew_point_k'] is None or 150.0 < r['dew_point_k'] < 700.0, (sp, r)) + for sp in ('methyl_formate', 'methyl_benzoate', 'methyl_methacrylate'): + h = Rig(seed=7) + h.call(h.A, 'supply.connect_liquid', composition={sp: 1.0}, pressure_pa=4e5) + h.call(h.A, 'supply.connect_gas', gas='nitrogen', pressure_pa=5e5) + h.call(h.A, 'power.set', on=True) + h.call(h.A, 'heater.set_temperature', setpoint_k=413.15) + h.call(h.A, 'gas.set_flow', setpoint_m3_s=5 * LN) + h.call(h.A, 'liquid.set_flow', setpoint_kg_s=30 * GH) + h.step(60.0) + h.call(h.E, 'truth.inspect') + + def test_downstream_condensation_fractionates_a_mixture(self): + g = Rig(line=298.15) + g.connect(liquid={'water': 0.5, 'ethanol': 0.5}) + g.start(g_h=60.0, ln=5.0, T=423.15, warm=500.0, run=600.0) + st = g.read('truth.stream') + n_in = st['vapour_mol_s'] + y = st['mole_fraction_delivered'] + self.assertGreater(y['ethanol'] / y['water'], 1.2 * n_in['ethanol'] / n_in['water']) # the less volatile water condenses preferentially + P = 101325.0 + K = {s: rt.psat(s, 298.15) / P for s in ('water', 'ethanol')} + self.assertAlmostEqual(y['water'] / K['water'] + y['ethanol'] / K['ethanol'], 1.0, delta=1e-6) # the delivered vapour is saturated at the line temperature + + def test_window_uses_the_calculation_pressure_and_needs_no_plant(self): + h = rt.BronkhorstCemwRuntime('calc_only') + h.register_principal('a', 'agent') + a = h.session('a') + r = a.invoke(instance_id='calc_only', capability_id='mixture.calculate', arguments=dict(composition={'water': 1.0}, gas='nitrogen', liquid_kg_s=60 * GH, gas_m3_s=5 * LN, + pressure_pa=5e5), request_id='c1') + self.assertEqual(r['status'], 'succeeded') + self.assertFalse(r['result']['within_documented_window']) + self.assertTrue(any('PRESSURE_NOT_CHARACTERISED' in n for n in r['result']['notes'])) + + def test_evaporated_fraction_is_relative_to_the_feed(self): + g = Rig(line=473.15) + g.connect() + r = g.start(g_h=130.0, ln=10.0, T=473.15, warm=600.0, run=1500.0) + st = r['truth.stream'] + self.assertAlmostEqual(st['evaporated_fraction'], min(1.0, st['evaporation_kg_s'] / st['liquid_feed_kg_s']), places=9) + self.assertGreater(st['evaporated_fraction'], 0.8) + + def test_gas_line_purge_books_each_species_it_received(self): # round-2 R2-01 + g = Rig(seed=11) + g.call(g.A, 'supply.connect_gas', gas='nitrogen', pressure_pa=2e5) + g.call(g.A, 'supply.connect_liquid', composition={'water': 1.0}, pressure_pa=3e5) + g.call(g.A, 'power.set', on=True) + g.call(g.A, 'liquid.set_flow', setpoint_kg_s=60 * GH) + g.step(60.0) + g.call(g.A, 'liquid.set_flow', setpoint_kg_s=0.0) + g.step(5.0) + g.call(g.A, 'supply.connect_liquid', composition={'ethanol': 1.0}, pressure_pa=3e5) + g.call(g.A, 'bleed.set', open=True) + g.step(rt.ENG['bleed_clear_s'] + 5.0) + g.call(g.A, 'bleed.set', open=False) + g.step(3.0) + g.call(g.A, 'liquid.set_flow', setpoint_kg_s=60 * GH) + g.step(30.0) + g.call(g.A, 'liquid.set_flow', setpoint_kg_s=0.0) + g.step(5.0) + before = g.ledger() + into = {s: before[s].get('into_gas_line_kg', 0.0) for s in ('water', 'ethanol')} + self.assertTrue(all(v > 0.0 for v in into.values()), into) + g.call(g.A, 'gas.set_flow', setpoint_m3_s=10 * LN) + g.step(400.0) + led = g.ledger() + for s in ('water', 'ethanol'): + self.assertAlmostEqual(led[s].get('into_gas_line_kg', 0.0), 0.0, delta=1e-12, msg=(s, led[s])) + self.assertAlmostEqual(led[s]['purged_from_gas_line_kg'], into[s], delta=1e-12, msg=(s, led[s])) + _balance(self, led) + + def test_narrow_degenerate_fit_continues_with_watson_enthalpy(self): # round-2 R2-02 + sp = 'methyl_formate' + lo, hi = rt.liquids()[sp]['antoine_fit']['t_range_K'] + self.assertLess(hi - lo, 25.0) + for te in (lo, hi): + self.assertAlmostEqual(rt.psat(sp, te - 1e-6) / rt.psat(sp, te + 1e-6), 1.0, delta=1e-5) + v = [rt.psat(sp, 150.0 + 0.5 * i) for i in range(1101)] # round-3 R3-01: monotonic up to 700 K (capped at Tc) + self.assertTrue(all(b_ > a_ for a_, b_ in zip(v, v[1:]))) + for T in (250.0, 340.0, 400.0, 460.0): # local Clausius-Clapeyron slope = Watson enthalpy of vaporization + d = 1e-3 + slope = -(math.log(rt.psat(sp, T + d)) - math.log(rt.psat(sp, T - d))) / (1.0 / (T + d) - 1.0 / (T - d)) * rt.R_GAS + self.assertAlmostEqual(slope / rt.dhvap(sp, T), 1.0, delta=0.15, msg=T) + g = Rig(seed=12) + g.call(g.A, 'supply.connect_liquid', composition={sp: 1.0}, pressure_pa=4e5) + prov = g.call(g.A, 'provenance.read') + self.assertEqual(prov['liquids'][sp]['vapour_pressure_quality'], 'inconsistent') + + def test_watson_anchor_follows_the_non_derived_nist_rows(self): # round-2 R2-03 + L = rt.liquids() + for sp in ('glycerol', 'propanoic_acid'): + rows = [r for r in L[sp]['dhvap_table'] if r.get('method') != 'A' and r['T_K'] < L[sp]['critical_temperature_K'] - 5.0] + errs = sorted(abs(rt.dhvap(sp, r['T_K']) / r['value_J_mol'] - 1.0) for r in rows) + self.assertLess(errs[len(errs) // 2], 0.06, (sp, errs)) + gc = [r for r in L['glycerol']['dhvap_table'] if r.get('method') == 'GC'] + self.assertTrue(gc and all(abs(rt.dhvap('glycerol', r['T_K']) / r['value_J_mol'] - 1.0) < 0.05 for r in gc)) + + +class ZCoverage(unittest.TestCase): + def test_all_capabilities_exercised(self): + implemented = {k for k in rt.CAPS if k not in rt.UNSUPPORTED} + missing = implemented - SEEN_CAPS + if len(SEEN_CAPS) > 5: + self.assertFalse(missing, sorted(missing)) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_asset_bruker_x4poseidon.py b/tests/test_asset_bruker_x4poseidon.py new file mode 100644 index 0000000000000000000000000000000000000000..5576be5fdfc31ace3268d0a1d16b399f07e3379c --- /dev/null +++ b/tests/test_asset_bruker_x4poseidon.py @@ -0,0 +1,1936 @@ +"""tests for CHEM-156 bruker_x4poseidon: python3 -m unittest tests/test_asset_bruker_x4poseidon.py + +Topics (pipeline.md): set points only write targets, read/describe are pure, rejected preconditions leave the state unchanged, two instances +are isolated, agent/evaluator truth isolation, conservation (X-ray energy: every emitted joule ends in the target, window, filter, air, +sample (absorbed / scattered), detector (deposited / passed) or the shielding; travel, projection and frame ledgers), real return values +validated against the declared schemas (asset_tool lint_schema / validate_value), asynchronous completion and cancellation remnants, +host-step independence (energy ledger, dose, records), declared immediate and on_step effects (scenario states, short and long windows); +plus the instrument (boot, warm-up after every power-up, kV / current ramps, door interlock, light curtain, emergency stop latch, interlock +sensor, tube arc, mains fault, rotation stall, collision keep-out of the source head, filter slide, detector and ceiling, loading at the +door) and the physics: Kramers spectrum energy and W lines, filter hardening, focal spot growth, polychromatic Beer-Lambert transmission of +an aluminium rod against the NIST attenuation library, flat-field validity and saturation, edge spread against the focal spot, projection +count / duration / magnification / voxel size, geometry calibration against the hidden axis offset, auto-alignment, porosity / pores / +cracks against the phantom truth, beam-hardening cupping and its linearisation, ring artefacts of dead columns with ring correction and +random movement, dose. +""" +import copy +import json +import math +import sys +import unittest +from pathlib import Path + +import numpy as np + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / 'scripts')) +sys.path.insert(0, str(ROOT / 'skills/chemistry-lab-assets/scripts')) +from asset_runtime import bruker_x4poseidon as rt # noqa: E402 +import asset_tool # noqa: E402 + +CHECKS, PROCESS_EVIDENCE, REJECTIONS = [], {}, {} +_META = {} +_SC = {} + + +def _meta(): + if not _META: + _META.update(rt.export_bruker_x4poseidon_contract_metadata()) + return _META + + +def _changed(a, b): + return json.dumps(a, sort_keys=True, default=str) != json.dumps(b, sort_keys=True, default=str) + + +_orig_invoke = rt.BrukerX4PoseidonRuntime.invoke + + +def _instrumented_invoke(self, capability_id, **a): + """Every successful call is checked against its declared output schema and immediate state effects (a call does not advance time); every + rejection code is recorded for the declaration check.""" + before = self.read('evaluator') if capability_id != 'sim.step' else None + t0 = self.t + try: + out = _orig_invoke(self, capability_id, **a) + except rt.ActionRejected as exc: + REJECTIONS.setdefault(capability_id, set()).add(str(exc)) + raise + meta = _meta()['capabilities'][capability_id] + errs = asset_tool.validate_value(out, meta['output_schema']) + if errs: + raise AssertionError(f'{capability_id} output violates its schema: {errs[:3]}') + if before is not None: + assert self.t == t0, capability_id + after = self.read('evaluator') + undeclared = {k for k in after if _changed(before[k], after[k])} - set(rt.EFFECTS.get(capability_id, [])) + if undeclared and len(rt.EFFECTS) > 1: + raise AssertionError(f'{capability_id} changed undeclared state immediately: {sorted(undeclared)}') + PROCESS_EVIDENCE.setdefault(capability_id, []).append(dict(arguments=copy.deepcopy(a), result_keys=sorted(out))) + return out + + +rt.BrukerX4PoseidonRuntime.invoke = _instrumented_invoke + +NOP = dict(count=0, median_radius_m=1.0e-4, sigma_ln=0.0, layer=0, seed=1) +PIN = dict(substance_id='al', diameter_m=0.003, length_m=0.035) +PELLET = copy.deepcopy(rt.SAMPLE_EXAMPLE) # alumina 6 x 6 mm, 120 pores, one crack, Al pin 35 mm +CAL = dict(sample_id='cal_phantom', kind='calibration_phantom', diameter_m=0.010, height_m=0.010, layers=[], pores=NOP, cracks=[], inclusions=[], + container=None, pin=PIN) +EDGE = dict(sample_id='w_edge', kind='edge_phantom', diameter_m=0.004, height_m=0.004, layers=[], pores=NOP, cracks=[], inclusions=[], container=None, + pin=PIN) +ROD = dict(sample_id='al_rod', kind='cylinder', diameter_m=0.004, height_m=0.006, layers=[dict(thickness_m=0.006, materials=[dict(substance_id='al', + volume_fraction=1.0)])], + pores=NOP, cracks=[], inclusions=[], container=None, pin=PIN) +DENSE = dict(PELLET, sample_id='dense_alumina', pores=NOP, cracks=[]) +CRACKED = dict(PELLET, sample_id='cracked_alumina', pores=NOP, + cracks=[dict(center_m=[0.0, 0.0, 0.003], normal=[1.0, 0.0, 0.0], radius_m=0.0022, aperture_m=150e-6)]) +FAST = dict(range_deg='180', step_rad=math.radians(2.0), exposure_s=0.02, averaging=1, binning='4x4', random_movement=False) +FINE = dict(range_deg='180', step_rad=math.radians(0.4), exposure_s=0.3, averaging=2, binning='2x2', random_movement=True) +RECON_FAST = dict(record_id='PJ0001', grid='48', filter='shepp_logan', beam_hardening=0.0, bh_material=None, ring_correction=0.0, smoothing_vox=0.0, + post_alignment=0.0, auto_alignment=False, voi=None) +SOD_SCAN = 0.045 + + +def centred_cz(s): + """Chuck height that puts the middle of the sample body on the beam.""" + return rt.SOURCE_XYZ_M[2] - (s['pin']['length_m'] if s['pin'] else 0.0) - s['height_m'] / 2 + + +def configured(seed=1, **plant): + h = rt.BrukerX4PoseidonRuntime() + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, noise_seed=seed, **plant)) + return h + + +def ready(seed=1, **plant): + h = configured(seed, **plant) + h.invoke('power.set', enabled=True) + h.step(rt.BOOT_S + 1.0) + return h + + +def busy(h): + return h._stage_moving() or h._filter_moving() or h._door_moving() or h.op is not None + + +def settle(h, limit=3600.0, dt=0.5): + t = 0.0 + while busy(h) and t < limit: + h.step(dt) + t += dt + assert not busy(h) + return h + + +def wait(h, op, tmax=7200.0, dt=0.5): + t0 = h.t + while h.operations[op]['phase'] == 'running' and h.t - t0 < tmax: + h.step(dt) + return h.operations[op]['phase'] + + +def loaded(sample=PELLET, seed=1, extra=()): + h = ready(seed) + for s in (sample,) + tuple(extra): + h.invoke('sample.provide', **s) + h.invoke('door.open') + settle(h) + h.invoke('sample.place', sample_id=sample['sample_id'], offset_x_m=0.0, offset_y_m=0.0) + h.invoke('door.close') + return settle(h) + + +def beam(h, kv=60e3, ia=150e-6): + h.invoke('xray.set', voltage_v=kv, current_a=ia) + h.invoke('xray.enable', enabled=True) + t = 0.0 + while not h._xray_ready() and t < rt.WARMUP_S + 60.0: + h.step(1.0) + t += 1.0 + assert h._xray_ready() + return h + + +def flat(h): + op = h.invoke('calibration.flat_field')['operation_id'] + assert wait(h, op) == 'completed', h.operations[op] + return h + + +def prepared(sample=PELLET, scan=FAST, kv=60e3, ia=150e-6, seed=1, sod=SOD_SCAN, cz=None, extra=()): + """Sample on the chuck, beam on and warmed up, scan settings, flat field at the load position (sample out of the beam), sample moved to + the scan position with its body centred on the beam.""" + h = loaded(sample, seed, extra) + h.invoke('scan.configure', **scan) + beam(h, kv, ia) + flat(h) + h.invoke('stage.move', sod_m=sod, chuck_z_m=centred_cz(sample) if cz is None else cz) + return settle(h) + + +def scan(h): + op = h.invoke('scan.start')['operation_id'] + assert wait(h, op) == 'completed', h.operations[op] + return h.operations[op]['record_id'] + + +def recon(h, rid, **kw): + op = h.invoke('recon.start', **dict(RECON_FAST, record_id=rid, **kw))['operation_id'] + assert wait(h, op) == 'completed', h.operations[op] + return h.operations[op]['record_id'] + + +def rejected(h, cap, code, **a): + before = h.read('evaluator') + rev = h.revision + led = h.ledger() + try: + h.invoke(cap, **a) + except rt.ActionRejected as exc: + assert str(exc) == code, (cap, str(exc), code) + assert not _changed(h.read('evaluator'), before), cap + assert h.revision == rev, cap + assert not _changed(h.ledger(), led), cap + return True + raise AssertionError(f'{cap} was not rejected (expected {code})') + + +def fine_transmission(kv, fpos, sid, L): + """Detected-energy weighted transmission of a path L through one library material, from the 0.5 keV spectrum (no energy groups).""" + e, ph = rt.beam_spectrum(kv, fpos) + ph = ph * rt.air_transmission(e, rt.SDD_M) + _, edep = rt.detector_response(tuple(e)) + w = ph * edep + mu, _ = rt.linear_mu(sid, e) + return float((w * np.exp(-mu * L)).sum() / w.sum()) + + +def cylinder_mask(d, radius, z_half=None): + xs, ys, zs = rt.BrukerX4PoseidonRuntime._grids(d) + Z, Y, X = np.meshgrid(zs, ys, xs, indexing='ij') + m = np.hypot(X, Y) < radius + if z_half is not None: + m &= np.abs(Z) < z_half + return m, np.hypot(X, Y) + + +class ContractAndSchemas(unittest.TestCase): + def test_module_identity(self): + self.assertEqual(rt.ASSET_TYPE_ID, 'instrument.bruker_x4poseidon') + self.assertEqual(rt.CATALOG_ID, 'CHEM-156') + + def test_schemas_lint_and_examples_validate(self): + m = _meta() + for k, c in m['capabilities'].items(): + for part in ('input_schema', 'output_schema'): + self.assertEqual(asset_tool.lint_schema(c[part]), [], (k, part)) + ex = rt.CAPS[k].get('example_arguments') + if ex is not None: + self.assertEqual(asset_tool.validate_value(ex, c['input_schema']), [], k) + for k, s in m['state_slots'].items(): + self.assertEqual(asset_tool.lint_schema(s['value_schema']), [], k) + for name in ('fresh', 'ready', 'scanning', 'reconstructed'): + v = _scenario(name).read('evaluator') + for k, x in v.items(): + self.assertEqual(asset_tool.validate_value(x, m['state_slots'][k]['value_schema']), [], (name, k)) + + def test_metadata_references_are_consistent(self): + m = _meta() + slots = set(m['state_slots']) + for k, c in m['capabilities'].items(): + for e in c['state_effects']: + self.assertIn(e['state_id'], slots, (k, e)) + for x in c['observes']: + self.assertIn(x, slots, (k, x)) + for pre in c['preconditions']: + for x in pre['state_ids']: + self.assertIn(x, slots, (k, x)) + for x in c['execution']['completion_state_ids']: + self.assertIn(x, slots, (k, x)) + self.assertEqual([e['code'] for e in c['errors']], sorted(set(e['code'] for e in c['errors']), key=[e['code'] for e in c['errors']].index), k) + for k in rt.CAPS: + self.assertIn(k, rt.CAP_SOURCES, k) + self.assertEqual(set(rt.PRECONDITIONS) - set(rt.CAPS), set()) + for k, v in rt.EFFECTS.items(): + self.assertIn(k, rt.CAPS) + self.assertEqual(set(v) - slots, set(), k) + for k, v in rt.ON_STEP.items(): + self.assertIn(k, rt.CAPS) + self.assertEqual(set(v) - slots, set(), k) + for mech in m['mechanisms'].values(): + self.assertEqual(set(mech['state_ids']) - slots, set()) + + def test_unsupported_capabilities_report_unsupported(self): + h = ready() + for k in rt.UNSUPPORTED: + with self.assertRaises(rt.ActionRejected) as cm: + _orig_invoke(h, k, **(rt.CAPS[k].get('example_arguments') or {})) + self.assertEqual(str(cm.exception), 'UNSUPPORTED') + self.assertEqual(_meta()['capabilities'][k]['availability'], 'unsupported') + h.register_principal('agent', 'agent') + s = h.session('agent') + r = s.invoke(instance_id=h.instance_id, capability_id='export.dataset', arguments={}, request_id='u1') + self.assertEqual(r['status'], 'unsupported') + self.assertEqual(r['error']['code'], 'UNSUPPORTED') + + +class HostClockAndPurity(unittest.TestCase): + def test_read_and_describe_do_not_advance_time(self): + h = _scenario('scanning') + h.register_principal('agent', 'agent') + s = h.session('agent') + t, rev, led = h.t, h.revision, h.ledger() + for _ in range(3): + h.read('evaluator'); s.read(instance_id=h.instance_id); s.describe(instance_id=h.instance_id) + s.invoke(instance_id=h.instance_id, capability_id='events.read', arguments=dict(since_s=0.0), request_id=f'e{_}') + self.assertEqual((h.t, h.revision), (t, rev)) + self.assertFalse(_changed(h.ledger(), led)) + + def test_step_zero_and_negative(self): + h = ready() + v = h.read('evaluator') + h.step(0.0) + self.assertFalse(_changed(h.read('evaluator'), v)) + for bad in (-1.0, float('nan'), float('inf')): + with self.assertRaises(rt.ActionRejected): + h.step(bad) + self.assertEqual(h.invoke('sim.step', dt_s=2.5)['time_s'], v['clock.time_s'] + 2.5) + + def test_host_step_chopping_does_not_change_the_result(self): + """Warm-up, a kV / current ramp with the beam on, stage travel, a flat field and a scan advanced in single host steps and in irregular + small steps give identical records, positions, doses and energy ledgers (rate cells and exact V^2 I integration).""" + def run(chunks): + h = loaded(PELLET) + h.invoke('scan.configure', **dict(FAST, random_movement=True)) + + def adv(T): + if chunks: + t, i = 0.0, 0 + while t < T - 1e-12: + d = min((0.037, 0.211, 0.0043, 0.5, 1.7)[i % 5], T - t) + h.step(d) + t += d + i += 1 + else: + h.step(T) + h.invoke('xray.enable', enabled=True) + adv(rt.WARMUP_S + 5.0) + h.invoke('xray.set', voltage_v=70e3, current_a=100e-6) + adv(3.0) + h.invoke('xray.set', voltage_v=60e3, current_a=150e-6) + adv(3.0) + h.invoke('calibration.flat_field') + adv(3.0) + h.invoke('stage.move', sod_m=SOD_SCAN, chuck_z_m=centred_cz(PELLET)) + adv(15.0) + op = h.invoke('scan.start')['operation_id'] + adv(h.op['duration_s'] + 1.0) + self.assertEqual(h.operations[op]['phase'], 'completed') + return h, h.records[h.operations[op]['record_id']] + a, ra = run(False) + b, rb = run(True) + self.assertEqual(ra['preview'], rb['preview']) + self.assertEqual(ra['transmission'], rb['transmission']) + self.assertAlmostEqual(ra['dose_gy'], rb['dose_gy'], delta=1e-10 * ra['dose_gy']) + self.assertTrue(np.array_equal(a._data[ra['record_id']]['q'], b._data[rb['record_id']]['q'])) + self.assertAlmostEqual(a.rot, b.rot, places=12) + self.assertAlmostEqual(a.sod, b.sod, places=12) + for k, v in a.ledger().items(): + if k == 'energy_residual_j': + continue + self.assertAlmostEqual(v, b.ledger()[k], delta=1e-9 * max(1.0, abs(v)), msg=k) + + def test_reads_do_not_change_later_results(self): + def run(reads): + h = prepared(PELLET) + op = h.invoke('scan.start')['operation_id'] + for i in range(20): + if reads: + h.read('evaluator'); h.invoke('events.read', since_s=0.0); h.invoke('records.list'); h.invoke('ledger.read') + h.invoke('measurement.result', record_id='FF0001') + h.step(0.7) + wait(h, op) + return h.records[h.operations[op]['record_id']]['preview'], h.ledger() + self.assertEqual(run(False), run(True)) + + def test_set_points_only_write_targets(self): + h = _scenario('positioned') + s0 = h.sod + out = h.invoke('stage.move', sod_m=s0 + 0.030, chuck_z_m=h.cz - 0.005) + self.assertEqual(h.sod, s0) + self.assertEqual(h.read()['stage.sod_target_m'], s0 + 0.030) + self.assertAlmostEqual(out['duration_s'], 0.030 / rt.CARRIAGE_SPEED_M_S) + self.assertAlmostEqual(out['magnification'], rt.SDD_M / (s0 + 0.030)) + h.step(0.5) + self.assertAlmostEqual(h.sod, s0 + 0.5 * rt.CARRIAGE_SPEED_M_S, places=12) + self.assertTrue(h.read()['stage.moving']) + settle(h) + r0 = h.rot + out = h.invoke('stage.rotate', angle_rad=(r0 - 0.6) % (2 * math.pi)) + self.assertEqual(h.rot, r0) + self.assertAlmostEqual(out['duration_s'], 0.6 / rt.ROTATION_SPEED_RAD_S) + h.step(0.25) + self.assertAlmostEqual(rt._rot_delta(r0, h.rot), -0.25 * rt.ROTATION_SPEED_RAD_S, places=9) # shortest direction + settle(h) + out = h.invoke('filter.select', position=3) + self.assertEqual(h.slide, 0.0) + self.assertEqual(h.read()['filter.position'], 3) + self.assertAlmostEqual(out['duration_s'], 3 * rt.FILTER_S_PER_STEP) + h.step(0.5) + self.assertAlmostEqual(h.slide, rt.FILTER_PITCH_M, places=12) + self.assertTrue(h.read()['filter.moving']) + settle(h) + v0 = h.xv + h.invoke('xray.set', voltage_v=70e3, current_a=150e-6) + self.assertEqual(h.xv, v0) + self.assertFalse(h.read()['xray.ready']) + h.step(0.5) + self.assertAlmostEqual(h.xv, v0 + 0.5 * rt.KV_RAMP_V_S, places=6) + h.step(0.6) + self.assertEqual(h.xv, 70e3) + self.assertTrue(h.read()['xray.ready']) + self.assertFalse(h.read()['calibration.flat_field']['valid']) # new voltage and filter: the flat field no longer matches + + +class PowerSafetyAndInterlocks(unittest.TestCase): + def test_boot_and_warm_up_after_every_power_up(self): + h = configured() + rejected(h, 'door.open', 'POWER_OFF') + h.invoke('power.set', enabled=True) + self.assertEqual(h.read()['system.state'], 'booting') + rejected(h, 'xray.enable', 'NOT_READY', enabled=True) + h.step(rt.BOOT_S - 0.01) + self.assertEqual(h.read()['system.state'], 'booting') + h.step(0.02) + self.assertEqual(h.read()['system.state'], 'ready') + self.assertEqual(h.invoke('xray.enable', enabled=True)['warmup_s'], rt.WARMUP_S) + h.step(rt.WARMUP_S / 2) + v = h.read() + self.assertAlmostEqual(v['xray.voltage_v'], 0.5 * h.xv_set, delta=1e-6) # conditioning: linear from zero to the set point + self.assertAlmostEqual(v['xray.current_a'], 0.5 * h.xi_set, delta=1e-15) + self.assertFalse(v['xray.ready']) + self.assertTrue(v['panel.status_orange']) + h.step(rt.WARMUP_S / 2 + 0.01) + self.assertTrue(h.read()['xray.ready']) + h.invoke('xray.enable', enabled=False) + self.assertFalse(h.read()['xray.on']) + out = h.invoke('xray.enable', enabled=True) # same boot: no second warm-up, a ramp from zero + self.assertEqual(out['warmup_s'], 0.0) + self.assertAlmostEqual(out['ramp_s'], max(h.xv_set / rt.KV_RAMP_V_S, h.xi_set / rt.CURRENT_RAMP_A_S)) + h.step(out['ramp_s'] + 0.01) + self.assertTrue(h.read()['xray.ready']) + h.invoke('power.set', enabled=False) + self.assertEqual(h.read()['xray.voltage_v'], 0.0) + h.invoke('power.set', enabled=True) + h.step(rt.BOOT_S + 0.1) + self.assertEqual(h.invoke('xray.enable', enabled=True)['warmup_s'], rt.WARMUP_S) + + def test_door_interlock_and_light_curtain(self): + h = beam(loaded()) + rejected(h, 'door.open', 'XRAY_ON') + h.invoke('xray.enable', enabled=False) + h.invoke('door.open') + h.step(0.1) + self.assertFalse(h.read()['door.closed']) + self.assertFalse(h.read()['interlock.ok']) + rejected(h, 'xray.enable', 'DOOR_OPEN', enabled=True) + settle(h) + self.assertAlmostEqual(h.door, rt.DOOR_TRAVEL_M) + h.invoke('door.close') + h.step(1.0) + d = h.door + h.invoke('fault.inject', fault='light_curtain_blocked', active=True) # closing door stops and reopens + self.assertEqual(h.door_target, rt.DOOR_TRAVEL_M) + h.step(0.5) + self.assertGreater(h.door, d) + rejected(h, 'door.close', 'LIGHT_CURTAIN_BLOCKED') + h.invoke('fault.inject', fault='light_curtain_blocked', active=False) + settle(h) + h.invoke('door.close') + settle(h) + self.assertTrue(h.read()['interlock.ok']) + self.assertEqual(h.ledger()['door_cycles'], 2.5) # five arrivals x 0.5: open, close (loading), open, reopen after the curtain, close + codes = [e['code'] for e in h.invoke('events.read', since_s=0.0)['events']] + for c in ('DOOR_OPEN', 'DOOR_CLOSED', 'LIGHT_CURTAIN'): + self.assertIn(c, codes) + + def test_emergency_stop_latches_and_needs_release_and_acknowledge(self): + h = prepared(PELLET) + op = h.invoke('scan.start')['operation_id'] + h.step(3.0) + rot = h.rot + out = h.invoke('emergency.stop') + self.assertTrue(out['stopped']) + self.assertEqual(h.operations[op]['phase'], 'failed') + self.assertEqual(h.operations[op]['reason'], 'EMERGENCY_STOP') + self.assertEqual(h.records[h.operations[op]['record_id']]['status'], 'failed') + v = h.read() + self.assertFalse(v['xray.on']) + self.assertTrue(v['panel.status_red']) + self.assertEqual(v['system.error_code'], 'EMERGENCY_STOP') + h.step(5.0) + self.assertEqual(h.rot, rot) + rejected(h, 'system.acknowledge', 'CAUSE_PERSISTS') + rejected(h, 'xray.enable', 'EMERGENCY_STOP', enabled=True) + rejected(h, 'stage.go_to', 'EMERGENCY_STOP', position='load') + h.invoke('emergency.release') + rejected(h, 'xray.enable', 'ERROR_PENDING', enabled=True) + self.assertEqual(h.invoke('system.acknowledge')['cleared'], 'EMERGENCY_STOP') + self.assertTrue(h.read()['panel.status_green']) + out = h.invoke('xray.enable', enabled=True) + self.assertEqual(out['warmup_s'], 0.0) # the boot's warm-up was done already + h.step(out['ramp_s'] + 0.01) + self.assertTrue(h.read()['xray.ready']) + + def test_interlock_sensor_and_arc_faults(self): + h = beam(loaded()) + h.invoke('fault.inject', fault='door_sensor', active=True) + v = h.read() + self.assertFalse(v['xray.on']) + self.assertFalse(v['interlock.ok']) + self.assertEqual(v['system.error_code'], 'INTERLOCK_FAULT') + rejected(h, 'system.acknowledge', 'CAUSE_PERSISTS') + h.invoke('fault.inject', fault='door_sensor', active=False) + h.invoke('system.acknowledge') + h.invoke('scan.configure', **FAST) + out = h.invoke('xray.enable', enabled=True) + self.assertEqual(out['warmup_s'], 0.0) + self.assertAlmostEqual(out['ramp_s'], 60e3 / rt.KV_RAMP_V_S) + h.step(out['ramp_s'] + 0.01) + flat(h) + h.invoke('stage.move', sod_m=SOD_SCAN, chuck_z_m=centred_cz(PELLET)) + settle(h) + op = h.invoke('scan.start')['operation_id'] + h.step(2.0) + h.invoke('fault.inject', fault='xray_arc', active=True) + self.assertEqual(h.operations[op]['reason'], 'XRAY_ARC') + self.assertFalse(h.read()['xray.enabled']) + rejected(h, 'xray.enable', 'ERROR_PENDING', enabled=True) + rejected(h, 'system.acknowledge', 'CAUSE_PERSISTS') + h.invoke('fault.inject', fault='xray_arc', active=False) + h.invoke('system.acknowledge') + h.invoke('xray.enable', enabled=True) + h.step(60e3 / rt.KV_RAMP_V_S + 0.01) + self.assertTrue(h.read()['xray.ready']) + + def test_mains_fault_and_power_loss_during_a_scan(self): + h = prepared(PELLET) + op = h.invoke('scan.start')['operation_id'] + h.step(2.0) + sod, rot = h.sod, h.rot + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, mains_voltage_v=60.0)) + v = h.read() + self.assertFalse(v['power.enabled']) + self.assertEqual(v['system.error_code'], 'MAINS_FAULT') + self.assertEqual(h.operations[op]['reason'], 'POWER_OFF') + h.step(10.0) + self.assertEqual((h.sod, h.rot), (sod, rot)) + rejected(h, 'power.set', 'MAINS_OUT_OF_RANGE', enabled=True) + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE)) + h.invoke('power.set', enabled=True) + self.assertIsNone(h.read()['system.error_code']) + h.step(rt.BOOT_S + 0.1) + self.assertEqual(h.read()['system.state'], 'ready') + rejected(h, 'plant.configure', 'SEED_FIXED', **dict(rt.PLANT_EXAMPLE, noise_seed=99)) + + def test_power_button_toggles(self): + h = configured() + self.assertTrue(h.invoke('power.press_button')['enabled']) + self.assertFalse(h.invoke('power.press_button')['enabled']) + self.assertEqual(h.read()['system.state'], 'off') + + +class MotionAndCollision(unittest.TestCase): + def test_keep_out_of_source_filter_detector_and_ceiling(self): + h = _scenario('flat_done') + cz = centred_cz(PELLET) # 0.362: the stage housing stays below the source head + rejected(h, 'stage.move', 'COLLISION_RISK', sod_m=0.020, chuck_z_m=cz) # chuck (r 12 mm) against the filter changer face + self.assertTrue(h._geometry_ok(0.0281, cz)) # chuck radius 12 mm + filter face 14 mm + margin 2 mm + self.assertFalse(h._geometry_ok(0.0279, cz)) + rejected(h, 'stage.move', 'COLLISION_RISK', sod_m=0.060, chuck_z_m=0.387) # stage housing (r 56.6 mm) in the source keep-out + self.assertTrue(h._geometry_ok(0.0727, 0.387)) + rejected(h, 'stage.move', 'COLLISION_RISK', sod_m=0.395, chuck_z_m=cz) # detector side + h.invoke('stage.move', sod_m=0.395, chuck_z_m=0.200) # everything below the detector housing + settle(h) + tall = dict(DENSE, sample_id='tall', height_m=0.250, layers=[dict(thickness_m=0.250, materials=[dict(substance_id='alumina', volume_fraction=1.0)])]) + h2 = _scenario('door_open') + h2.invoke('sample.provide', **tall) + h2.invoke('sample.place', sample_id='tall', offset_x_m=0.0, offset_y_m=0.0) + h2.invoke('door.close') + settle(h2) + rejected(h2, 'stage.move', 'COLLISION_RISK', sod_m=0.250, chuck_z_m=0.399) # ceiling + self.assertTrue(h2._geometry_ok(0.250, rt.CHAMBER_CEILING_M - rt.COLLISION_MARGIN_M - 0.285 - 1e-6)) + + def test_loading_needs_the_open_door_and_the_load_position(self): + h = _scenario('ready') + rejected(h, 'sample.place', 'DOOR_CLOSED', sample_id='alumina_pellet', offset_x_m=0.0, offset_y_m=0.0) + h.invoke('door.open') + h.step(1.0) + rejected(h, 'sample.place', 'DOOR_CLOSED', sample_id='alumina_pellet', offset_x_m=0.0, offset_y_m=0.0) + settle(h) + h.invoke('stage.move', sod_m=SOD_SCAN, chuck_z_m=0.300) + rejected(h, 'sample.place', 'MOTION_IN_PROGRESS', sample_id='alumina_pellet', offset_x_m=0.0, offset_y_m=0.0) + settle(h) + rejected(h, 'sample.place', 'NOT_ACCESSIBLE', sample_id='alumina_pellet', offset_x_m=0.0, offset_y_m=0.0) + out = h.invoke('stage.go_to', position='load') + self.assertAlmostEqual(out['duration_s'], max((rt.LOAD_POSITION['sod'] - SOD_SCAN) / rt.CARRIAGE_SPEED_M_S, 0.05 / rt.LIFT_SPEED_M_S)) + settle(h) + self.assertEqual(h.read()['stage.position_label'], 'load') + rejected(h, 'sample.place', 'UNKNOWN_SAMPLE', sample_id='nothing', offset_x_m=0.0, offset_y_m=0.0) + h.invoke('sample.place', sample_id='alumina_pellet', offset_x_m=0.002, offset_y_m=-0.001) + rejected(h, 'sample.place', 'SAMPLE_NOT_ON_BENCH', sample_id='alumina_pellet', offset_x_m=0.0, offset_y_m=0.0) + rejected(h, 'sample.place', 'STAGE_OCCUPIED', sample_id='cal_phantom', offset_x_m=0.0, offset_y_m=0.0) + self.assertEqual(h.read()['sample.on_stage'], dict(sample_id='alumina_pellet', offset_x_m=0.002, offset_y_m=-0.001)) + rejected(h, 'sample.remove', 'SAMPLE_NOT_ON_STAGE', sample_id='cal_phantom') + h.invoke('sample.remove', sample_id='alumina_pellet') + self.assertIn('alumina_pellet', h.read()['sample.bench_ids']) + + def test_sample_definitions_are_checked(self): + h = configured() + bad = [dict(DENSE, sample_id='b1', height_m=0.005), # layers do not add up + dict(DENSE, sample_id='b2', layers=[dict(thickness_m=0.006, materials=[dict(substance_id='alumina', volume_fraction=0.7)])]), + dict(CAL, sample_id='b3', pores=dict(NOP, count=5)), # phantoms have no pores + dict(DENSE, sample_id='b4', cracks=[dict(center_m=[0.0025, 0.0, 0.003], normal=[1.0, 0.0, 0.0], radius_m=0.001, aperture_m=1e-5)]), + dict(DENSE, sample_id='b5', pores=dict(count=400, median_radius_m=0.9e-3, sigma_ln=0.0, layer=0, seed=1))] # too dense + for s in bad: + rejected(h, 'sample.provide', 'INVALID_SAMPLE', **s) + rejected(h, 'sample.provide', 'UNKNOWN_SUBSTANCE', **dict(DENSE, sample_id='b6', layers=[dict(thickness_m=0.006, materials=[ + dict(substance_id='unobtainium', volume_fraction=1.0)])])) + out = h.invoke('sample.provide', **PELLET) + pores = h.samples['alumina_pellet']['_pores'] + self.assertEqual(len(pores), 120) + crack = PELLET['cracks'][0] + vol = (math.pi * 0.003 ** 2 * 0.006 - sum(4 / 3 * math.pi * p['radius_m'] ** 3 for p in pores) - math.pi * crack['radius_m'] ** 2 * crack['aperture_m']) + self.assertAlmostEqual(out['mass_kg'], vol * rt.density('alumina'), delta=1e-12) + rejected(h, 'sample.provide', 'SAMPLE_EXISTS', **PELLET) + for i in range(rt.MAX_SAMPLES - 1): + h.invoke('sample.provide', **dict(ROD, sample_id=f'r{i}')) + rejected(h, 'sample.provide', 'TOO_MANY_SAMPLES', **dict(ROD, sample_id='one_more')) + + def test_rotation_stall_stops_the_scan_and_the_stage(self): + h = prepared(PELLET) + op = h.invoke('scan.start')['operation_id'] + h.step(2.0) + h.invoke('fault.inject', fault='rotation_stall', active=True) + self.assertEqual(h.operations[op]['reason'], 'STAGE_FAULT') + self.assertEqual(h.read()['system.error_code'], 'STAGE_FAULT') + rot = h.rot + h.step(3.0) + self.assertEqual(h.rot, rot) + h.invoke('fault.inject', fault='rotation_stall', active=False) + h.invoke('system.acknowledge') + h.invoke('stage.rotate', angle_rad=0.0) + settle(h) + self.assertEqual(h.rot, 0.0) + + +class XrayPhysics(unittest.TestCase): + def test_kramers_spectrum_energy_and_tungsten_lines(self): + for kv in (30e3, 60e3, 100e3): + e, ph = rt.unabsorbed_spectrum(kv) + energy = 4 * math.pi * float((ph * e).sum()) * 0.5 * rt.KEV + self.assertAlmostEqual(energy / (rt.KRAMERS_K_PER_V * 74 * kv * kv * 1.602176634e-19), 1.0, places=9) # eta V e per electron + self.assertLess(e.max(), kv / 1e3) + e, ph = rt.emitted_spectrum(100e3) + j = int(np.argmin(np.abs(e - 59.32))) + self.assertGreater(ph[j] / (0.5 * (ph[j - 2] + ph[j + 2])), 3.0) # W K-alpha above the K edge (69.5 kV) + e, ph = rt.emitted_spectrum(60e3) + j = int(np.argmin(np.abs(e - 58.5))) + self.assertLess(ph[j] / ph[j - 2], 1.0) # below the K edge: bremsstrahlung only + k = int(np.argmin(np.abs(e - 8.40))) + self.assertGreater(ph[k] / (0.5 * (ph[k - 1] + ph[k + 1])), 2.0) # W L-alpha (L-beta sits two bins higher) + e2, ph2 = rt.emitted_spectrum(10.5e3) + self.assertAlmostEqual(4 * math.pi * float((rt.unabsorbed_spectrum(10.5e3)[1] * e2).sum()) * 0.5 * rt.KEV / + (rt.KRAMERS_K_PER_V * 74 * 10.5e3 ** 2 * 1.602176634e-19), 1.0, places=9) # lines above the voltage are not excited + + def test_filters_harden_the_beam_and_power_sets_the_spot(self): + def mean_e(pos): + e, ph = rt.beam_spectrum(60e3, pos) + return float((ph * e * e).sum() / (ph * e).sum()) + m = [mean_e(p) for p in range(rt.FILTER_POSITIONS)] + self.assertTrue(m[0] < m[1] < m[2] < m[3]) + self.assertTrue(m[4] < m[5]) + self.assertGreater(m[6], max(m[3], m[4])) + e, ph = rt.emitted_spectrum(60e3) + _, pb = rt.beam_spectrum(60e3, 0) + self.assertLess(pb[int(np.argmin(np.abs(e - 3.0)))] / ph[int(np.argmin(np.abs(e - 3.0)))], pb[-10] / ph[-10]) # Be window + h = configured() + self.assertAlmostEqual(h.invoke('xray.set', voltage_v=100e3, current_a=0.2e-3)['focal_spot_m'], 25e-6) + self.assertAlmostEqual(h.invoke('xray.set', voltage_v=40e3, current_a=0.1e-3)['focal_spot_m'], 5e-6) + self.assertAlmostEqual(h.invoke('xray.set', voltage_v=20e3, current_a=0.1e-3)['focal_spot_m'], 5e-6) + rejected(h, 'xray.set', 'POWER_LIMIT', voltage_v=100e3, current_a=0.25e-3) + + def test_radiograph_transmission_follows_polychromatic_beer_lambert(self): + """Transmission profile of a 4 mm aluminium rod against the fine-spectrum prediction with the NIST attenuation of Al: the chord of + each ray through the rod follows from the cone-beam geometry and the hidden axis offset.""" + h = prepared(ROD, dict(FAST, exposure_s=0.3, averaging=4, binning='2x2')) + op = h.invoke('xray.radiograph', roi=None)['operation_id'] + self.assertEqual(wait(h, op), 'completed') + d = h._data['RG0001'] + t, w = d['image'].astype(float), d['window'] + us = w['u0'] + (np.arange(w['nu']) + 0.5) * w['pitch'] + vs = w['v1'] - (np.arange(w['nv']) + 0.5) * w['pitch'] + rows = np.abs(vs) < 0.2 * 0.006 * rt.SDD_M / SOD_SCAN + prof = t[rows].mean(0) + a = h.truth['axis_offset'] + th = np.arctan(us / rt.SDD_M) + dist = np.abs(SOD_SCAN * np.sin(th) - a * np.cos(th)) + L = 2 * np.sqrt(np.clip(0.002 ** 2 - dist ** 2, 0.0, None)) + sel = L > 1.0e-3 + self.assertGreater(sel.sum(), 5) + pred = np.array([fine_transmission(60e3, 0, 'al', x) for x in L[sel]]) + rel = np.abs(prof[sel] / pred - 1) + self.assertLess(float(rel.mean()), 0.03, (prof[sel], pred)) + self.assertLess(float(rel.max()), 0.06) + outside = L == 0 + self.assertAlmostEqual(float(prof[outside].mean()), 1.0, delta=0.01) + mu_thin = -math.log(fine_transmission(60e3, 0, 'al', 1e-3)) / 1e-3 + mu_thick = -math.log(fine_transmission(60e3, 0, 'al', 4e-3)) / 4e-3 + self.assertGreater(mu_thin, 1.3 * mu_thick) # polychromatic beam: hardening with path length + self.assertIn('RG0001', h.invoke('records.list')['records']) + + def test_flat_field_validity_and_saturation(self): + h = _scenario('positioned') + self.assertTrue(h.read()['calibration.flat_field']['valid']) + h.invoke('xray.set', voltage_v=70e3, current_a=150e-6) + rejected(h, 'xray.radiograph', 'XRAY_NOT_READY', roi=None) + h.step(1.5) + rejected(h, 'xray.radiograph', 'FLAT_FIELD_REQUIRED', roi=None) + rejected(h, 'calibration.flat_field', 'SAMPLE_IN_BEAM') + h.invoke('xray.set', voltage_v=60e3, current_a=150e-6) + h.step(1.5) + h.invoke('xray.radiograph', roi=None) + settle(h) + h.invoke('filter.select', position=2) + rejected(h, 'xray.radiograph', 'MOTION_IN_PROGRESS', roi=None) + settle(h) + rejected(h, 'xray.radiograph', 'FLAT_FIELD_REQUIRED', roi=None) + h.invoke('filter.select', position=0) + settle(h) + h.invoke('scan.configure', **dict(FAST, binning='2x2')) + rejected(h, 'scan.start', 'FLAT_FIELD_REQUIRED') + h2 = _scenario('beam') + h2.invoke('xray.set', voltage_v=50e3, current_a=0.4e-3) + h2.invoke('scan.configure', **dict(FAST, exposure_s=10.0)) + h2.step(3.0) + op = h2.invoke('calibration.flat_field')['operation_id'] + wait(h2, op) + r = h2.records[h2.operations[op]['record_id']] + self.assertEqual(r['flat_field']['mean_bright_adu'], rt.FULL_SCALE_ADU) + self.assertTrue([x for x in r['warnings'] if '饱和' in x]) + op = h2.invoke('xray.radiograph', roi=None)['operation_id'] + wait(h2, op) + self.assertGreater(h2.records[h2.operations[op]['record_id']]['saturated_fraction'], 0.5) + + def test_edge_resolution_follows_the_focal_spot(self): + """Tungsten edge at magnification 10 in a native-pixel ROI: the 10-90 % width of the edge spread function follows the penumbra of the + focal spot (5 um at 4 W, 25 um at 20 W) combined with the scintillator spread.""" + widths = {} + for P in (4.0, 20.0): + h = prepared(EDGE, dict(FAST, exposure_s=0.5, averaging=4, binning='1x1'), kv=80e3, ia=P / 80e3) + u_edge = h.truth['axis_offset'] * rt.SDD_M / SOD_SCAN + op = h.invoke('xray.radiograph', roi=dict(center_u_m=u_edge, center_v_m=0.0, size_px=128))['operation_id'] + wait(h, op) + e = h.invoke('data.edge_resolution', record_id=h.operations[op]['record_id']) + M = rt.SDD_M / SOD_SCAN + sig = math.hypot(rt.focal_spot_m(P) / 2.355 * (M - 1) / rt.PIXEL_PITCH_M, rt.DETECTOR_PSF_PX) + self.assertAlmostEqual(e['width_detector_px'] / (2.563 * sig), 1.0, delta=0.2, msg=(P, e)) + self.assertAlmostEqual(e['width_10_90_m'], e['width_detector_px'] * rt.PIXEL_PITCH_M / M, delta=1e-12) + self.assertLess(abs(e['edge_angle_rad']), 0.01) + widths[P] = e['width_10_90_m'] + self.assertGreater(widths[20.0] / widths[4.0], 1.8) + h = _scenario('radiographed') + res = h.invoke('data.edge_resolution', record_id='RG0001') # a porous pellet is no straight edge + self.assertIsNone(res['width_10_90_m']) + + +class CTWorkflowPhysics(unittest.TestCase): + def test_projection_count_duration_and_geometry(self): + h = _scenario('flat_done') + out = h.invoke('scan.configure', **dict(FAST, step_rad=math.radians(1.0))) + half_fan = math.atan(rt.DETECTOR_PIXELS[0] * rt.PIXEL_PITCH_M / 2 / rt.SDD_M) + n = int(math.floor((math.pi + 2 * half_fan) / math.radians(1.0) + 1e-9)) + 1 + self.assertEqual(out['projections'], n) + self.assertAlmostEqual(out['duration_s'], n * (1 * (0.02 + rt.FRAME_OVERHEAD_S) + rt.STEP_OVERHEAD_S)) + out = h.invoke('scan.configure', **dict(FAST, range_deg='360', step_rad=math.radians(1.0), averaging=3)) + self.assertEqual(out['projections'], 360) + self.assertAlmostEqual(out['duration_s'], 360 * (3 * (0.02 + rt.FRAME_OVERHEAD_S) + rt.STEP_OVERHEAD_S)) + h.invoke('scan.configure', **FAST) + h.invoke('calibration.flat_field') + settle(h) + h.invoke('stage.move', sod_m=0.050, chuck_z_m=centred_cz(PELLET)) + settle(h) + v = h.read() + self.assertAlmostEqual(v['geometry.magnification'], 9.0) + self.assertAlmostEqual(v['geometry.voxel_size_m'], rt.PIXEL_PITCH_M * 4 / 9.0) + self.assertAlmostEqual(v['geometry.fov_m'][0], 0.1386 / 9.0) + self.assertAlmostEqual(v['geometry.fov_m'][1], 0.1188 / 9.0) + led0 = h.ledger() + rot0 = h.rot + op = h.invoke('scan.start')['operation_id'] + dur = h.op['duration_s'] + self.assertAlmostEqual(dur, v['scan.duration_s']) + h.step(dur - 0.01) + self.assertEqual(h.operations[op]['phase'], 'running') + self.assertAlmostEqual(h.read()['measurement.progress'], (dur - 0.01) / dur) + h.step(0.02) + self.assertEqual(h.operations[op]['phase'], 'completed') + span = math.pi + 2 * half_fan + self.assertAlmostEqual(rt._rot_delta(rot0, h.rot), rt._rot_delta(0.0, span), places=9) + r = h.records[h.operations[op]['record_id']] + self.assertEqual(r['projections_nominal'], v['scan.projections']) + self.assertAlmostEqual(r['magnification'], 9.0) + self.assertAlmostEqual(r['voxel_size_nominal_m'], rt.PIXEL_PITCH_M * 4 / 9.0) + L = h.ledger() + self.assertEqual(L['projections'] - led0['projections'], r['projections_nominal']) + self.assertEqual(L['frames'] - led0['frames'], r['projections_nominal'] * FAST['averaging']) + self.assertAlmostEqual(L['rotation_rad'] - led0['rotation_rad'], span, places=9) + + def test_geometry_calibration_recovers_the_hidden_axis_offset(self): + found = {} + for seed in (1, 2): + h = prepared(CAL, seed=seed, sod=0.050) + op = h.invoke('calibration.geometry')['operation_id'] + self.assertEqual(wait(h, op), 'completed') + g = h.records[h.operations[op]['record_id']]['geometry'] + self.assertEqual(g['balls'], rt.CAL_BALLS) + self.assertAlmostEqual(g['axis_offset_m'], h.truth['axis_offset'], delta=2.0e-6) + self.assertEqual(h.read()['calibration.geometry']['axis_offset_m'], g['axis_offset_m']) + found[seed] = (g['axis_offset_m'], h.truth['axis_offset']) + self.assertGreater(abs(found[1][1] - found[2][1]), 5e-6) + h = _scenario('positioned') + rejected(h, 'calibration.geometry', 'PHANTOM_REQUIRED') + + def test_axis_alignment_calibrated_manual_and_automatic(self): + h = _scenario('scanned') + a = h.truth['axis_offset'] + vid = recon(h, 'PJ0001', post_alignment=None, auto_alignment=False) + self.assertTrue([w for w in h.records[vid]['warnings'] if '未做几何标定' in w]) + self.assertEqual(h.records[vid]['volume']['axis_offset_used_m'], 0.0) + vid = recon(h, 'PJ0001', post_alignment=a + 1e-6, auto_alignment=False) + self.assertAlmostEqual(h.records[vid]['volume']['axis_offset_used_m'], a + 1e-6, delta=1e-15) + vid = recon(h, 'PJ0001', post_alignment=None, auto_alignment=True, grid='48') + self.assertAlmostEqual(h.records[vid]['volume']['axis_offset_used_m'], a, delta=0.35 * rt.PIXEL_PITCH_M * 4 * SOD_SCAN / rt.SDD_M + 5e-6) + h.geo_cal = dict(axis_offset_m=a - 2e-6, calibrated_s=h.t) + vid = recon(h, 'PJ0001', post_alignment=None, auto_alignment=False) + self.assertAlmostEqual(h.records[vid]['volume']['axis_offset_used_m'], a - 2e-6, delta=1e-15) + self.assertEqual(h.records[vid]['warnings'], []) + + def test_porosity_and_cracks_against_the_phantom_truth(self): + h = prepared(PELLET, FINE) + pj = scan(h) + vid = recon(h, pj, grid='96', filter='shepp_logan', beam_hardening=0.5, bh_material='alumina', post_alignment=None, auto_alignment=True, + voi=dict(center_m=[0.0, 0.0, 0.0], size_m=[0.0066, 0.0066, 0.0066])) + p = h.invoke('data.porosity', record_id=vid, region=None, threshold_1_m=None, min_pore_voxels=2) + tr = rt.sample_truth(h.samples['alumina_pellet']) + self.assertAlmostEqual(p['porosity'] / tr['porosity'], 1.0, delta=0.25, msg=(p, tr['porosity'])) + self.assertAlmostEqual(p['pore_count'] / tr['pore_count'], 1.0, delta=0.15) + d50 = float(np.median(tr['pore_equivalent_diameters_m'])) + self.assertAlmostEqual(p['equivalent_diameter_m']['d50'] / d50, 1.0, delta=0.25) + self.assertAlmostEqual(p['open_porosity'] + p['closed_porosity'], p['porosity'], delta=1e-12) + self.assertEqual(h.read()['result.last_porosity'], p['porosity']) + att = h.invoke('data.attenuation', record_id=vid, region=None) + self.assertGreater(att['mean_1_m'], 300.0) + sl = h.invoke('data.slice', record_id=vid, axis='z', position_m=0.0, size_px=32) + self.assertEqual(len(sl['mu_1_m']), 32) + rejected(h, 'data.slice', 'OUT_OF_VOLUME', record_id=vid, axis='z', position_m=0.01, size_px=32) + rejected(h, 'data.porosity', 'INVALID_REGION', record_id=vid, region=dict(center_m=[0.0, 0.0, 0.0], radius_m=0.001, z_min_m=0.001, z_max_m=0.0), + threshold_1_m=None, min_pore_voxels=2) + rejected(h, 'data.porosity', 'RECORD_NOT_SUITABLE', record_id=pj, region=None, threshold_1_m=None, min_pore_voxels=2) + h2 = prepared(CRACKED, FINE) + pj2 = scan(h2) + vid2 = recon(h2, pj2, grid='96', beam_hardening=0.5, bh_material='alumina', post_alignment=None, auto_alignment=True, + voi=dict(center_m=[0.0, 0.0, 0.0], size_m=[0.0066, 0.0066, 0.0066])) + c = h2.invoke('data.cracks', record_id=vid2, region=None, threshold_1_m=None, min_voxels=20) + self.assertGreaterEqual(c['crack_count'], 1, c) + big = c['cracks'][0] + self.assertGreater(abs(big['normal'][0]), 0.9) + self.assertAlmostEqual(big['area_m2'] / (math.pi * 0.0022 ** 2), 1.0, delta=0.5) + c0 = h.invoke('data.cracks', record_id=vid, region=None, threshold_1_m=None, min_voxels=20) + self.assertEqual(c0['crack_count'], 0) # the 30 um crack of the pellet is below the 69 um voxels + + def test_beam_hardening_cupping_and_its_linearisation(self): + h = prepared(DENSE, dict(FAST, step_rad=math.radians(1.0), exposure_s=0.1, binning='2x2')) + pj = scan(h) + a = h.truth['axis_offset'] + out = {} + for bh in (0.0, 1.0): + vid = recon(h, pj, grid='64', beam_hardening=bh, bh_material='alumina' if bh else None, post_alignment=a, + voi=dict(center_m=[0.0, 0.0, 0.0], size_m=[0.0068, 0.0068, 0.002])) + d = h._data[vid] + _, rr = cylinder_mask(d, 1.0) + v = d['volume'] + out[bh] = (float(v[rr < 0.0008].mean()), float(v[(rr > 0.0022) & (rr < 0.0027)].mean())) + cup0 = (out[0.0][1] - out[0.0][0]) / out[0.0][1] + cup1 = (out[1.0][1] - out[1.0][0]) / out[1.0][1] + self.assertGreater(cup0, 0.10) + self.assertLess(abs(cup1), 0.02) + e_mean = h._data[pj]['grp']['mean_e'] + self.assertAlmostEqual(out[1.0][0] / float(rt.linear_mu('alumina', [e_mean])[0][0]), 1.0, delta=0.03) + rejected(h, 'recon.start', 'UNKNOWN_SUBSTANCE', **dict(RECON_FAST, record_id=pj, beam_hardening=1.0, bh_material='kryptonite')) + + def test_ring_artefacts_dead_columns_ring_correction_and_random_movement(self): + def run(fault, rm, ring): + h = prepared(ROD, dict(FAST, range_deg='360', step_rad=math.radians(1.0), exposure_s=0.1, binning='2x2', random_movement=rm)) + if fault: + h.invoke('fault.inject', fault='detector_defects', active=True) + pj = scan(h) + vid = recon(h, pj, grid='64', ring_correction=ring, post_alignment=h.truth['axis_offset'], + voi=dict(center_m=[0.0, 0.0, 0.0], size_m=[0.005, 0.005, 0.002])) + d = h._data[vid] + m, _ = cylinder_mask(d, 0.0017) + return float(d['volume'][m].std()) + clean, dead, corrected, moved = run(False, False, 0.0), run(True, False, 0.0), run(True, False, 1.0), run(True, True, 0.0) + self.assertGreater(dead, 4 * clean) + self.assertLess(corrected, 1.5 * clean) + self.assertLess(moved, 0.9 * dead) + + def test_dose_and_energy_ledger_close(self): + h = _scenario('scanned') + L = h.ledger() + sinks = sum(L[k] for k in rt.ENERGY_SINKS) + self.assertLess(abs(L['energy_residual_j']), 1e-12 * L['xray_emitted_j']) + self.assertAlmostEqual(sinks / L['xray_emitted_j'], 1.0, places=12) + for k in rt.ENERGY_SINKS: + self.assertGreaterEqual(L[k], 0.0, k) + for k in ('sample_absorbed_j', 'sample_scattered_j', 'detector_absorbed_j', 'detector_passed_j', 'air_absorbed_j', 'target_absorbed_j'): + self.assertGreater(L[k], 0.0, k) + self.assertLess(L['xray_emitted_j'] / L['electrical_energy_j'], rt.KRAMERS_K_PER_V * 74 * 60e3 * 1.0000001) # efficiency eta = K Z V + s = h.samples['alumina_pellet'] + self.assertAlmostEqual(L['sample_dose_gy'], s['dose_gy'], delta=1e-12 * s['dose_gy']) + r = h.records['PJ0001'] + self.assertGreater(r['dose_gy'], 0.0) + g = copy.deepcopy(h) # steady beam: dE/dt = K Z V^2 I, electrical V I + L0 = g.ledger() + g.step(10.0) + L1 = g.ledger() + self.assertAlmostEqual(L1['electrical_energy_j'] - L0['electrical_energy_j'], 60e3 * 150e-6 * 10.0, delta=1e-9) + self.assertAlmostEqual(L1['xray_emitted_j'] - L0['xray_emitted_j'], rt.KRAMERS_K_PER_V * 74 * 60e3 ** 2 * 150e-6 * 10.0, delta=1e-12) + self.assertAlmostEqual(L1['xray_on_s'] - L0['xray_on_s'], 10.0, delta=1e-9) + + +class FaultsCancelAndData(unittest.TestCase): + def test_cancel_scan_and_recon_keep_the_remnants(self): + h = _scenario('positioned') + h.register_principal('a1', 'agent') + s = h.session('a1') + r = s.invoke(instance_id=h.instance_id, capability_id='scan.start', arguments={}, request_id='s1') + self.assertEqual(r['status'], 'accepted') + h.step(4.0) + rot = h.rot + c = s.cancel(r['operation_id'], 'c1') + self.assertEqual(c['result']['phase'], 'cancelled') + self.assertEqual(s.cancel(r['operation_id'], 'c1'), c) + with self.assertRaises(rt.ActionRejected): + s.cancel(r['operation_id'], 'c2') + rid = h.operations[r['operation_id']]['record_id'] + self.assertEqual(h.records[rid]['status'], 'cancelled') + self.assertEqual(h.records[rid]['reason'], 'USER_CANCEL') + self.assertNotIn(rid, h._data) + h.step(2.0) + self.assertEqual(h.rot, rot) + self.assertEqual(s.poll(r['operation_id'])['status'], 'cancelled') + h = _scenario('scanned') + h.register_principal('a1', 'agent') + s = h.session('a1') + r = s.invoke(instance_id=h.instance_id, capability_id='recon.start', arguments=RECON_FAST, request_id='r1') + h.step(1.0) + s.cancel(r['operation_id'], 'c1') + self.assertIsNone(h.read()['recon.id']) + self.assertEqual(h.records[h.operations[r['operation_id']]['record_id']]['status'], 'cancelled') + + def test_data_eviction_fails_a_pending_reconstruction(self): + h = _scenario('scanned') + op = h.invoke('recon.start', **RECON_FAST)['operation_id'] + for _ in range(8): + o = h.invoke('xray.radiograph', roi=None)['operation_id'] + wait(h, o, dt=0.01) + self.assertNotIn('PJ0001', h._data) + wait(h, op) + self.assertEqual(h.operations[op]['reason'], 'DATA_EVICTED') + self.assertEqual(h.records[h.operations[op]['record_id']]['status'], 'failed') + rejected(h, 'data.porosity', 'RECORD_NOT_SUITABLE', record_id=h.operations[op]['record_id'], region=None, threshold_1_m=None, min_pore_voxels=2) + + def test_scan_and_reconstruction_run_in_parallel(self): + h = _scenario('scanned') + op_r = h.invoke('recon.start', **RECON_FAST)['operation_id'] + rejected(h, 'recon.start', 'RECON_BUSY', **RECON_FAST) + op_s = h.invoke('scan.start')['operation_id'] + v = h.read() + self.assertEqual(v['measurement.kind'], 'projections') + self.assertEqual(v['recon.id'], h.operations[op_r]['record_id']) + self.assertGreater(v['recon.remaining_s'], 0.0) + self.assertEqual(wait(h, op_r), 'completed') + self.assertEqual(h.operations[op_s]['phase'], 'running') + self.assertEqual(wait(h, op_s), 'completed') + self.assertEqual(h.read()['result.last_record_id'], h.operations[op_s]['record_id']) + + def test_records_full(self): + h = _scenario('scanned') + r = h.records['PJ0001'] + for i in range(rt.MAX_RECORDS - len(h.records)): + h.records[f'X{i:04d}'] = dict(copy.deepcopy(r), record_id=f'X{i:04d}', finished_s=0.0) + rejected(h, 'scan.start', 'RECORDS_FULL') + rejected(h, 'xray.radiograph', 'RECORDS_FULL', roi=None) + rejected(h, 'recon.start', 'RECORDS_FULL', **RECON_FAST) + + +class LedgersIsolationSessions(unittest.TestCase): + def test_two_instances_are_isolated(self): + a, b = _scenario('positioned'), _scenario('positioned') + b2 = copy.deepcopy(b.read('evaluator')) + a.invoke('stage.rotate', angle_rad=1.0) + a.step(3.0) + a.invoke('fault.inject', fault='xray_arc', active=True) + self.assertFalse(_changed(b.read('evaluator'), b2)) + c = configured(seed=2) + self.assertNotEqual(c.truth['axis_offset'], a.truth['axis_offset']) + + def test_agent_does_not_see_truth_faults_or_templates(self): + h = _scenario('positioned') + h.register_principal('agent', 'agent') + h.register_principal('judge', 'evaluator') + s, e = h.session('agent'), h.session('judge') + obs = s.read(instance_id=h.instance_id)['observations'] + self.assertFalse([k for k in obs if k.startswith('truth.')]) + self.assertTrue([k for k in e.read(instance_id=h.instance_id)['observations'] if k.startswith('truth.')]) + with self.assertRaises(rt.ActionRejected): + s.read(instance_id=h.instance_id, state_ids=['truth.axis_offset_m']) + d = s.describe(instance_id=h.instance_id) + for k in ('fault.inject', 'ledger.read', 'plant.configure', 'sample.provide', 'sim.step'): + self.assertNotIn(k, d['capabilities']) + self.assertNotIn('truth.samples', d['state_slots']) + for k in ('fault.inject', 'ledger.read'): + r = s.invoke(instance_id=h.instance_id, capability_id=k, arguments=rt.CAPS[k]['example_arguments'], request_id='x' + k) + self.assertEqual(r['error']['code'], 'ACCESS_DENIED') + e.invoke(instance_id=h.instance_id, capability_id='fault.inject', arguments=dict(fault='detector_defects', active=True), request_id='f1') + ev = s.invoke(instance_id=h.instance_id, capability_id='events.read', arguments=dict(since_s=0.0), request_id='e1')['result']['events'] + self.assertFalse([x for x in ev if x['kind'] == 'fault']) + r = s.invoke(instance_id=h.instance_id, capability_id='scan.start', arguments={}, request_id='m1') + wait(h, r['operation_id']) + rid = h.operations[r['operation_id']]['record_id'] + res = s.invoke(instance_id=h.instance_id, capability_id='measurement.result', arguments=dict(record_id=rid), request_id='r1')['result'] + self.assertEqual(res['template_source']['substances'], []) + self.assertIsNone(res['dose_gy']) # the dose follows the true sample mass + self.assertEqual(s.poll(r['operation_id'])['result']['template_source']['substances'], []) + self.assertIsNone(s.poll(r['operation_id'])['result']['dose_gy']) + full = e.invoke(instance_id=h.instance_id, capability_id='measurement.result', arguments=dict(record_id=rid), request_id='r2')['result'] + self.assertEqual(full['template_source']['substances'], ['al', 'alumina']) + self.assertGreater(full['dose_gy'], 0.0) + self.assertEqual(e.poll(r['operation_id'])['status'], 'completed') # evaluators observe every operation + self.assertEqual(s.read(instance_id=h.instance_id)['observations']['result.last_record_id']['value'], rid) + + def test_records_and_control_belong_to_their_agent(self): + h = _scenario('positioned') + h.register_principal('a1', 'agent') + h.register_principal('a2', 'agent') + s1, s2 = h.session('a1'), h.session('a2') + r = s1.invoke(instance_id=h.instance_id, capability_id='scan.start', arguments={}, request_id='m1') + h.step(0.5) + o2 = s2.read(instance_id=h.instance_id)['observations'] + self.assertTrue(o2['measurement.started_by_other_agent']['value']) + self.assertIsNone(o2['measurement.id']['value']) + x = s2.invoke(instance_id=h.instance_id, capability_id='stage.rotate', arguments=dict(angle_rad=0.1), request_id='s1') + self.assertEqual(x['error']['code'], 'ACCESS_DENIED') + with self.assertRaises(rt.ActionRejected): + s2.poll(r['operation_id']) + with self.assertRaises(rt.ActionRejected): + s2.cancel(r['operation_id'], 'c1') + wait(h, r['operation_id']) + rid = h.operations[r['operation_id']]['record_id'] + v = s1.invoke(instance_id=h.instance_id, capability_id='recon.start', arguments=dict(RECON_FAST, record_id=rid), request_id='v1') + wait(h, v['operation_id']) + vid = h.operations[v['operation_id']]['record_id'] + for cap, args in (('measurement.result', dict(record_id=rid)), ('recon.start', dict(RECON_FAST, record_id=rid)), + ('data.porosity', dict(record_id=vid, region=None, threshold_1_m=None, min_pore_voxels=2))): + self.assertEqual(s2.invoke(instance_id=h.instance_id, capability_id=cap, arguments=args, request_id='q' + cap)['error']['code'], 'ACCESS_DENIED') + self.assertNotIn(rid, s2.invoke(instance_id=h.instance_id, capability_id='records.list', arguments={}, request_id='l1')['result']['records']) + self.assertEqual(s2.read(instance_id=h.instance_id)['observations']['result.last_record_id']['value'], 'FF0001') # the host's record only + s1.invoke(instance_id=h.instance_id, capability_id='data.porosity', arguments=dict(record_id=vid, region=None, threshold_1_m=None, min_pore_voxels=2), + request_id='p1') + self.assertIsNotNone(s1.read(instance_id=h.instance_id)['observations']['result.last_porosity']['value']) + self.assertIsNone(s2.read(instance_id=h.instance_id)['observations']['result.last_porosity']['value']) + a = s1.invoke(instance_id=h.instance_id, capability_id='stage.rotate', arguments=dict(angle_rad=0.2), request_id='s9') + self.assertEqual(s1.invoke(instance_id=h.instance_id, capability_id='stage.rotate', arguments=dict(angle_rad=0.2), request_id='s9'), a) + c = s1.invoke(instance_id=h.instance_id, capability_id='stage.rotate', arguments=dict(angle_rad=0.3), request_id='s9') + self.assertEqual(c['error']['code'], 'REQUEST_CONFLICT') + self.assertEqual(s1.invoke(instance_id='other', capability_id='records.list', arguments={}, request_id='z')['error']['code'], 'UNKNOWN_INSTANCE') + r = s1.invoke(instance_id=h.instance_id, capability_id='scan.start', arguments={}, request_id='m2') + h.step(0.5) + self.assertTrue(s2.invoke(instance_id=h.instance_id, capability_id='emergency.stop', arguments={}, request_id='es')['result']['stopped']) # always works + with self.assertRaises(rt.ActionRejected): + s1.write(instance_id=h.instance_id, state_id='xray.voltage_set_v', value=50e3, request_id='w1') + + def test_queries_and_bookkeeping(self): + h = _scenario('scanned') + p = h.invoke('provenance.read') + self.assertEqual(p['substances'], len(rt.library()['substances'])) + self.assertEqual(len(p['library_sha256']), 64) + codes = [e['code'] for e in h.invoke('events.read', since_s=0.0)['events']] + for c in ('POWER_ON', 'READY', 'SAMPLE_PROVIDED', 'SAMPLE_PLACED', 'DOOR_OPEN', 'DOOR_CLOSED', 'WARMUP', 'XRAY_ON', 'WARMUP_DONE', 'OP_DONE'): + self.assertIn(c, codes) + self.assertEqual(h.invoke('events.read', since_s=h.t + 1.0)['events'], []) + self.assertEqual(h.invoke('records.list')['records'], ['FF0001', 'PJ0001']) + rejected(h, 'measurement.result', 'UNKNOWN_RECORD', record_id='PJ9999') + rejected(h, 'recon.start', 'UNKNOWN_RECORD', **dict(RECON_FAST, record_id='PJ9999')) + rejected(h, 'recon.start', 'RECORD_NOT_SUITABLE', **dict(RECON_FAST, record_id='FF0001')) + rejected(h, 'recon.start', 'INVALID_VOI', **dict(RECON_FAST, voi=dict(center_m=[0.02, 0.0, 0.0], size_m=[0.001, 0.001, 0.001]))) + rejected(h, 'data.edge_resolution', 'RECORD_NOT_SUITABLE', record_id='PJ0001') + r = h.invoke('measurement.result', record_id='FF0001') + self.assertEqual(r['kind'], 'flat_field') + self.assertEqual(r['flat_field']['frames'], rt.FLAT_FIELD_FRAMES) + + def test_go_to_rotate_and_host_step(self): + h = _scenario('flat_done') + out = h.invoke('stage.go_to', position='center') + settle(h) + self.assertEqual((h.sod, h.cz), (rt.CENTER_POSITION['sod'], rt.CENTER_POSITION['cz'])) + self.assertEqual(h.read()['stage.position_label'], 'center') + self.assertAlmostEqual(out['duration_s'], max(abs(rt.CENTER_POSITION['sod'] - rt.LOAD_POSITION['sod']) / rt.CARRIAGE_SPEED_M_S, + abs(rt.CENTER_POSITION['cz'] - rt.LOAD_POSITION['cz']) / rt.LIFT_SPEED_M_S)) + h.invoke('stage.move', sod_m=0.2, chuck_z_m=0.31) + self.assertIsNone(h.read()['stage.position_label']) + h.invoke('stage.rotate', angle_rad=6.0) # the shortest way from 0 is backwards + h.step(0.1) + self.assertGreater(h.rot, 6.0) + t = h.t + self.assertAlmostEqual(h.invoke('sim.step', dt_s=4.0)['time_s'], t + 4.0) + + +class RuntimeReviewRound1Regressions(unittest.TestCase): + def test_F01_short_scan_parker_weights_give_a_uniform_disc(self): + """Exact line integrals of a 16 mm disc (mu 100 1/m): the 180 deg + fan reconstruction is as uniform as the 360 deg one.""" + h = rt.BrukerX4PoseidonRuntime() + sod, R, mu = 0.10, 0.008, 100.0 + span = math.pi + 2 * math.atan(rt.DETECTOR_PIXELS[0] * rt.PIXEL_PITCH_M / 2 / rt.SDD_M) + for full in (False, True): + n_p = 360 + angles = np.array([2 * math.pi * k / n_p for k in range(n_p)]) if full else np.array([span * k / (n_p - 1) for k in range(n_p)]) + nu, nv = 192, 6 + pitch = 2 * R * rt.SDD_M / sod * 1.2 / nu + w = dict(u0=-nu / 2 * pitch, v1=nv / 2 * pitch, pitch=pitch, nu=nu, nv=nv, binning=1) + D, _, _, _ = h._window_rays(w) + q = [] + for b in angles: + S, Ds = h._to_sample(dict(pin=None), D, sod, rt.SOURCE_XYZ_M[2], b, 0.0, 0.0, 0.0) + c1, c2 = rt._cyl(S, Ds, R) + q.append((mu * np.clip(c2 - c1, 0.0, None)).reshape(nv, nu)) + vol, origin, voxel = h._fdk(np.array(q), angles, full, 2 * math.pi if full else span, sod, w, 0.0, 48, 'ram_lak', + dict(center_m=[0.0, 0.0, 0.0], size_m=[0.012, 0.012, 0.0005])) + xs = origin[0] + np.arange(vol.shape[2]) * voxel + ys = origin[1] + np.arange(vol.shape[1]) * voxel + Y, X = np.meshgrid(ys, xs, indexing='ij') + sl = vol[vol.shape[0] // 2] / mu + inside = np.hypot(X, Y) < 0.8 * R + self.assertLess(float(np.abs(sl[inside] - 1).max()), 0.005, full) + self.assertAlmostEqual(float(sl[inside & (Y > 0.001)].mean()), float(sl[inside & (Y < -0.001)].mean()), delta=0.002) + + def test_F02_the_swept_path_of_carriage_and_lift_is_checked(self): + tall = dict(DENSE, sample_id='tall_rod', diameter_m=0.040, height_m=0.100, pin=None, + layers=[dict(thickness_m=0.100, materials=[dict(substance_id='nist_pmma', volume_fraction=1.0)])]) + h = loaded(tall) + h.invoke('stage.move', sod_m=0.250, chuck_z_m=0.399) + settle(h) + self.assertTrue(h._geometry_ok(0.030, 0.160)) # the target itself is clear ... + rejected(h, 'stage.move', 'COLLISION_RISK', sod_m=0.030, chuck_z_m=0.160) # ... but the path crosses the source keep-out + h.invoke('stage.move', sod_m=0.250, chuck_z_m=0.160) # lower first, then approach + settle(h) + h.invoke('stage.move', sod_m=0.030, chuck_z_m=0.160) + while busy(h): + self.assertTrue(h._geometry_ok(h.sod, h.cz), (h.sod, h.cz)) + h.step(0.1) + self.assertEqual((h.sod, h.cz), (0.030, 0.160)) + + def test_F03_integral_floats_in_nested_integer_fields(self): + a, b = configured(), configured() + a.invoke('sample.provide', **dict(PELLET, sample_id='p', pores=dict(PELLET['pores'], count=120.0, seed=7.0))) + b.invoke('sample.provide', **dict(PELLET, sample_id='p')) + self.assertEqual(a.samples['p']['_pores'], b.samples['p']['_pores']) + h = prepared(PELLET) + op = h.invoke('xray.radiograph', roi=dict(center_u_m=0.0, center_v_m=0.0, size_px=64.0))['operation_id'] + self.assertEqual(wait(h, op), 'completed') + + def test_F04_only_the_pin_in_the_field_is_not_a_scan(self): + high = dict(DENSE, sample_id='high_body', pin=dict(substance_id='al', diameter_m=0.003, length_m=0.060)) + h = prepared(high, cz=0.348) # body 8-14 mm above the beam, field +-5.9 mm at the axis + rejected(h, 'scan.start', 'SAMPLE_NOT_IN_FIELD') + + def test_F05_dose_counts_only_the_sample_body(self): + def rate(s): + h = loaded(s) + h.invoke('stage.move', sod_m=SOD_SCAN, chuck_z_m=centred_cz(s)) + settle(h) + beam(h) + d0 = h.samples[s['sample_id']].get('dose_gy', 0.0) + h.step(20.0) + return (h.samples[s['sample_id']]['dose_gy'] - d0) / 20.0, h + al, h = rate(DENSE) + pb, _ = rate(dict(DENSE, sample_id='pb_pin', pin=dict(substance_id='pb', diameter_m=0.003, length_m=0.035))) + cont, hc = rate(dict(DENSE, sample_id='pb_cont', container=dict(substance_id='pb', wall_m=0.3e-3))) + self.assertAlmostEqual(pb / al, 1.0, delta=0.01) + self.assertLess(cont, 0.2 * al) + self.assertGreater(hc.ledger()['holder_absorbed_j'], hc.ledger()['sample_absorbed_j']) + + def test_F06_small_sample_absorbed_power_follows_the_inverse_square_law(self): + tiny = dict(DENSE, sample_id='tiny', diameter_m=0.001, height_m=0.001, layers=[dict(thickness_m=0.001, materials=[dict(substance_id='alumina', volume_fraction=1.0)])]) + h = loaded(tiny) + beam(h) + out = {} + for sod in (0.10, 0.20): + h.invoke('stage.move', sod_m=sod, chuck_z_m=centred_cz(tiny)) + settle(h) + out[sod] = h._energy_rates()['sample_absorbed_j'] + self.assertGreater(out[0.10], 0.0) + self.assertAlmostEqual(out[0.10] / out[0.20], (0.20 / 0.10) ** 2 * math.exp(0.0), delta=0.3) + + def test_F07_set_point_change_during_the_warm_up(self): + base = loaded(PELLET) + base.invoke('stage.move', sod_m=SOD_SCAN, chuck_z_m=centred_cz(PELLET)) + settle(base) + base.invoke('xray.set', voltage_v=20e3, current_a=150e-6) + base.invoke('xray.enable', enabled=True) + base.step(162.0) + v0 = base.xv + base.invoke('xray.set', voltage_v=100e3, current_a=150e-6) + base.step(1e-6) + self.assertLess(abs(base.xv - v0), 1.0) # the program keeps its end point: no jump + a, b = copy.deepcopy(base), copy.deepcopy(base) + a.step(30.0) + for _ in range(3000): + b.step(0.01) + for k, v in a.ledger().items(): + if k != 'energy_residual_j': + self.assertAlmostEqual(v, b.ledger()[k], delta=1e-9 * max(1.0, abs(v)), msg=k) + self.assertAlmostEqual(a.xv, min(100e3, 20e3 + (30.0 - (rt.WARMUP_S - 162.0 - 1e-6)) * rt.KV_RAMP_V_S), delta=1.0) + + def test_F09_F10_F11_detector_field_and_region_limits(self): + h = _scenario('positioned') + rejected(h, 'xray.radiograph', 'ROI_OUTSIDE_DETECTOR', roi=dict(center_u_m=0.07, center_v_m=0.06, size_px=256)) + h.invoke('xray.radiograph', roi=dict(center_u_m=0.05, center_v_m=0.04, size_px=64)) + h2 = _scenario('scanned') + for voi in (dict(center_m=[0.0, 0.0, 0.15], size_m=[0.002, 0.002, 0.002]), dict(center_m=[0.0, 0.0, -0.15], size_m=[0.01, 0.01, 0.2])): + rejected(h2, 'recon.start', 'INVALID_VOI', **dict(RECON_FAST, voi=voi)) + h3 = prepared(CAL, sod=0.030) + rejected(h3, 'calibration.geometry', 'PHANTOM_NOT_IN_FIELD') + + def test_F12_auto_alignment_needs_the_central_plane(self): + h = prepared(DENSE, dict(FAST, step_rad=math.radians(1.0), exposure_s=0.1, binning='2x2'), cz=centred_cz(DENSE) - 0.004, seed=3) + pj = scan(h) + vid = recon(h, pj, post_alignment=None, auto_alignment=True) + self.assertEqual(h.records[vid]['volume']['axis_offset_used_m'], 0.0) + self.assertTrue([w for w in h.records[vid]['warnings'] if '中心平面' in w]) + + def test_F13_the_brass_chuck_attenuates(self): + nopin = dict(DENSE, sample_id='nopin', pin=None) + h = loaded(nopin) + h.invoke('scan.configure', **dict(FAST, binning='2x2', exposure_s=0.1)) + beam(h) + flat(h) + h.invoke('stage.move', sod_m=0.080, chuck_z_m=0.397) + settle(h) + rejected(h, 'calibration.flat_field', 'SAMPLE_IN_BEAM') + op = h.invoke('xray.radiograph', roi=None)['operation_id'] + wait(h, op) + self.assertLess(h.records[h.operations[op]['record_id']]['transmission']['min'], 0.01) # chuck and housing are opaque + + def test_F14_safety_button_pressed_while_switched_off(self): + h = configured() + h.invoke('emergency.stop') + h.invoke('power.set', enabled=True) + h.step(rt.BOOT_S + 1.0) + self.assertEqual(h.read()['system.error_code'], 'EMERGENCY_STOP') + h.invoke('emergency.release') + rejected(h, 'door.open', 'ERROR_PENDING') + self.assertEqual(h.invoke('system.acknowledge')['cleared'], 'EMERGENCY_STOP') + h.invoke('door.open') + + def test_F15_F17_latched_errors_are_deterministic_and_not_overwritten(self): + h = configured() + for f in ('rotation_stall', 'xray_arc', 'door_sensor'): + h.invoke('fault.inject', fault=f, active=True) + h.invoke('power.set', enabled=True) + self.assertEqual(h.read()['system.error_code'], 'INTERLOCK_FAULT') + h.invoke('fault.inject', fault='door_sensor', active=False) + h.invoke('system.acknowledge') + self.assertEqual(h.read()['system.error_code'], 'XRAY_ARC') # the next persisting cause latches its own error + h.invoke('fault.inject', fault='xray_arc', active=False) + h.invoke('fault.inject', fault='rotation_stall', active=False) + h.invoke('system.acknowledge') + h2 = _scenario('beam') + h2.invoke('fault.inject', fault='xray_arc', active=True) + h2.invoke('fault.inject', fault='xray_arc', active=False) + h2.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, mains_voltage_v=60.0)) + h2.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE)) + h2.invoke('power.set', enabled=True) + h2.step(rt.BOOT_S + 1.0) + self.assertEqual(h2.read()['system.error_code'], 'XRAY_ARC') + rejected(h2, 'xray.enable', 'ERROR_PENDING', enabled=True) + + def test_F16_the_target_absorbs_the_back_half_and_its_self_absorption(self): + h = _scenario('positioned') + L0 = h.ledger() + h.step(20.0) + L1 = h.ledger() + em = L1['xray_emitted_j'] - L0['xray_emitted_j'] + self.assertGreater((L1['target_absorbed_j'] - L0['target_absorbed_j']) / em, 0.5) + self.assertLess((L1['shielding_j'] - L0['shielding_j']) / em, 0.5) + self.assertLess(abs(L1['energy_residual_j'] - L0['energy_residual_j']), 1e-12 * em) + + def test_F19_mass_is_consistent_with_the_ray_traced_geometry(self): + h = configured() + incl = dict(DENSE, sample_id='incl', inclusions=[dict(substance_id='w', center_m=[0.0, 0.0, 0.003], radius_m=0.0015)]) + crk = dict(DENSE, sample_id='crk', cracks=[dict(center_m=[0.0, 0.0, 0.003], normal=[1.0, 0.0, 0.0], radius_m=0.0025, aperture_m=1e-3)]) + body = math.pi * 0.003 ** 2 * 0.006 + vi = 4 / 3 * math.pi * 0.0015 ** 3 + vc = math.pi * 0.0025 ** 2 * 1e-3 + self.assertAlmostEqual(h.invoke('sample.provide', **incl)['mass_kg'], (body - vi) * rt.density('alumina') + vi * rt.density('w'), delta=1e-12) + self.assertAlmostEqual(h.invoke('sample.provide', **crk)['mass_kg'], (body - vc) * rt.density('alumina'), delta=1e-12) + + def test_F20_F21_empty_region_and_evicted_projection_data(self): + h = _scenario('reconstructed') + rejected(h, 'data.attenuation', 'INVALID_REGION', record_id='VO0001', region=dict(center_m=[0.19, 0.19, 0.0], radius_m=0.001, z_min_m=0.15, z_max_m=0.2)) + for _ in range(8): + o = h.invoke('xray.radiograph', roi=None)['operation_id'] + wait(h, o, dt=0.01) + rejected(h, 'recon.start', 'DATA_NOT_CACHED', **RECON_FAST) + + def test_F22_saturated_and_starved_bright_fields(self): + h = _scenario('beam') + h.invoke('stage.move', sod_m=0.25, chuck_z_m=0.16) + settle(h) + h.invoke('xray.set', voltage_v=60e3, current_a=150e-6) + h.invoke('scan.configure', **dict(FAST, exposure_s=0.1)) + h.step(1.0) + op = h.invoke('calibration.flat_field')['operation_id'] + wait(h, op) + self.assertEqual(h.records[h.operations[op]['record_id']]['flat_field']['mean_bright_adu'], rt.FULL_SCALE_ADU) + op = h.invoke('xray.radiograph', roi=dict(center_u_m=0.05, center_v_m=0.045, size_px=32))['operation_id'] + wait(h, op) + self.assertAlmostEqual(h.records[h.operations[op]['record_id']]['transmission']['mean'], 1.0, delta=0.02) # air, clipped bright field + h.invoke('xray.set', voltage_v=20e3, current_a=1e-6) + h.invoke('filter.select', position=5) + h.invoke('scan.configure', **dict(FAST, binning='1x1')) + settle(h) + h.step(3.0) + op = h.invoke('calibration.flat_field')['operation_id'] + wait(h, op) + self.assertTrue([w for w in h.records[h.operations[op]['record_id']]['warnings'] if '亮场信号不足' in w]) + self.assertFalse(h.read()['calibration.flat_field']['valid']) + rejected(h, 'xray.radiograph', 'FLAT_FIELD_REQUIRED', roi=None) + + def test_F23_records_can_be_deleted(self): + h = _scenario('scanned') + r = h.records['PJ0001'] + for i in range(rt.MAX_RECORDS - len(h.records)): + h.records[f'X{i:04d}'] = dict(copy.deepcopy(r), record_id=f'X{i:04d}', finished_s=0.0) + rejected(h, 'xray.radiograph', 'RECORDS_FULL', roi=None) + op = h.invoke('recon.start', **RECON_FAST)['operation_id'] if len(h.records) < rt.MAX_RECORDS else None + self.assertIsNone(op) + self.assertEqual(h.invoke('records.delete', record_id='X0000')['remaining'], rt.MAX_RECORDS - 1) + op = h.invoke('recon.start', **RECON_FAST)['operation_id'] + rejected(h, 'records.delete', 'RECORD_IN_USE', record_id='PJ0001') + rejected(h, 'records.delete', 'UNKNOWN_RECORD', record_id='X0000') + wait(h, op) + h.invoke('records.delete', record_id='PJ0001') + self.assertNotIn('PJ0001', h.invoke('records.list')['records']) + + def test_F25_porosity_belongs_to_the_agent_that_ran_it(self): + h = _scenario('reconstructed') + h.register_principal('a1', 'agent') + h.register_principal('a2', 'agent') + s1, s2 = h.session('a1'), h.session('a2') + r = s1.invoke(instance_id=h.instance_id, capability_id='data.porosity', arguments=dict(record_id='VO0001', region=None, threshold_1_m=None, min_pore_voxels=2), + request_id='p1') + self.assertEqual(r['status'], 'succeeded') + self.assertIsNotNone(s1.read(instance_id=h.instance_id)['observations']['result.last_porosity']['value']) + self.assertIsNone(s2.read(instance_id=h.instance_id)['observations']['result.last_porosity']['value']) + + def test_F26_F27_units_are_si_and_no_inert_gain_pattern(self): + si = {'1', 'm', 's', 'V', 'A', 'W', 'J', 'K', 'kg', 'rad', 'Gy', '1/m', 'm2', 'rad/s', 'm/s', 'V/s', 'A/s', '1/s', '1/V', '1/J', 'kg/m3'} + bad = [] + + def walk(x, path=''): + if isinstance(x, dict): + for k, v in x.items(): + if k in ('x-unit', 'unit') and isinstance(v, str) and v not in si: + bad.append((path + '.' + k, v)) + walk(v, path + '.' + k) + elif isinstance(x, list): + for i, v in enumerate(x): + walk(v, f'{path}[{i}]') + walk(_meta()) + self.assertEqual(bad, []) + self.assertNotIn('gain', configured().truth) + + + +def _ordered_reference(h, pose, n=120, nu=None, nv=None, chunk=6000): + """Independent reference for the ledger's sample-body absorption: a dense grid (nu x nv, default n x n) over the projection box of the + body's rotation envelope at all angles (its own box, not the runtime's), every object's entry / exit parameters along each ray (stage + housing, chuck, pin, container near and far wall, body), sorted by entry, sequential attenuation; each object absorbs the mu_en / mu share + of what it removes from the beam reaching it (J per electron).""" + key = h._rate_key(pose) + kv, fpos = key[0] * rt.RATE_KV_CELL_V, key[1] + sod, cz, rot = key[4] * rt.RATE_POS_CELL_M, key[5] * rt.RATE_POS_CELL_M, key[6] * rt.RATE_ROT_CELL_RAD + s = h.samples[h.on_stage] + e, _ = rt.unabsorbed_spectrum(kv) + _, ph = rt.beam_spectrum(kv, fpos) + c = rt.SDD_M * math.tan(rt.CONE_HALF_ANGLE_RAD) + renv = rt.sample_radius_total(s) + math.hypot(s['offset_x_m'], s['offset_y_m']) + uc, uh = rt.SDD_M * h.truth['axis_offset'] / sod, rt.SDD_M * renv / math.sqrt(sod * sod - renv * renv) * 1.02 + 2 * rt.PIXEL_PITCH_M + z0 = cz - rt.SOURCE_XYZ_M[2] + (s['pin']['length_m'] if s['pin'] else 0.0) + vv = [rt.SDD_M * z / (sod + sg * renv) for z in (z0, z0 + s['height_m']) for sg in (-1, 1)] + pad = 0.02 * (max(vv) - min(vv)) + 2 * rt.PIXEL_PITCH_M + u0, u1, v0, v1 = max(uc - uh, -c), min(uc + uh, c), max(min(vv) - pad, -c), min(max(vv) + pad, c) + nu, nv = nu or n, nv or n + pu, pv = (u1 - u0) / nu, (v1 - v0) / nv + U, V = np.meshgrid(u0 + (np.arange(nu) + 0.5) * pu, v0 + (np.arange(nv) + 0.5) * pv) + U, V = U.ravel(), V.ravel() + mu_air = rt.linear_mu('nist_air', e)[0] + coef = {} + + def mu(m): + if m not in coef: + coef[m] = rt.linear_mu(m, e) + return coef[m] + + def inter(t1, t2, lo, hi): + return np.maximum(t1, lo), np.minimum(t2, hi) + body = 0.0 + for k0 in range(0, len(U), chunk): + P = np.stack([np.full(len(U[k0:k0 + chunk]), rt.SDD_M), U[k0:k0 + chunk], V[k0:k0 + chunk]], -1) + r = np.linalg.norm(P, axis=1) + D, om = P / r[:, None], pu * pv * rt.SDD_M / r ** 3 + S, Ds, ax, ay, zt = h._frame(s, D, sod, cz, rot, h.truth['axis_offset']) + segs = [] # (entry, exit, {material: path} or material, is body) + for sid, rad, za, zb in (('cu', rt.CHUCK_R_M, zt - rt.CHUCK_H_M, zt), ('al', rt.STAGE_HOUSING_R_M, zt - rt.CHUCK_H_M - rt.STAGE_H_M, zt - rt.CHUCK_H_M)): + segs.append(inter(*rt._cyl(S, Ds, rad, ax, ay), *rt._slab(S, Ds, za, zb, 2)) + (sid, False)) + if s['pin']: + segs.append(inter(*rt._cyl(S, Ds, s['pin']['diameter_m'] / 2), *rt._slab(S, Ds, -s['pin']['length_m'], 0.0, 2)) + (s['pin']['substance_id'], False)) + R = s['diameter_m'] / 2 + zl, zh = rt._slab(S, Ds, 0.0, s['height_m'], 2) + il, ih = inter(*rt._cyl(S, Ds, R), zl, zh) + segs.append((il, ih, rt.body_paths(s, S, Ds), True)) + if s['container']: + ol, oh = inter(*rt._cyl(S, Ds, R + s['container']['wall_m']), zl, zh) + has = ih > il + segs.append((ol, np.where(has, il, oh), s['container']['substance_id'], False)) + segs.append((np.where(has, ih, oh), oh, s['container']['substance_id'], False)) + MT, ME, entry = [], [], [] + for lo, hi, mat, _ in segs: + with np.errstate(invalid='ignore'): + L = np.clip(hi - lo, 0.0, None) + L = np.where(np.isfinite(L), L, 0.0) + paths = mat if isinstance(mat, dict) else {mat: L} + MT.append(sum((np.outer(v, mu(m)[0]) for m, v in paths.items()), np.zeros((len(om), len(e))))) + ME.append(sum((np.outer(v, mu(m)[1]) for m, v in paths.items()), np.zeros((len(om), len(e))))) + entry.append(np.where(L > 0, lo, np.inf)) + order = np.argsort(np.stack(entry, 1), 1) + MT, ME = np.stack(MT), np.stack(ME) + isbody = np.array([x[3] for x in segs]) + cur = ph[None, :] * np.exp(-np.outer(r, mu_air)) + rows = np.arange(len(om)) + for p_ in range(len(segs)): + k = order[:, p_] + mt, me = MT[k, rows], ME[k, rows] + Tk = np.exp(-mt) + A = np.divide(cur * (1 - Tk) * me, mt, out=np.zeros_like(cur), where=mt > 0) * e[None, :] + sel = isbody[k] + body += float((om[sel] @ A[sel]).sum()) * 0.5 * rt.KEV + cur = cur * Tk + return body + + +class RuntimeReviewRound2Regressions(unittest.TestCase): + """Regression tests for the findings of the second independent runtime review (F28-F32).""" + + def test_F28_objects_absorb_in_their_order_along_the_ray(self): + """The ledger follows each ray through the stage hardware, pin, container walls and body in their order (independent sorted-interval + reference); the body's dose does not depend on what lies behind it.""" + disc = dict(DENSE, sample_id='disc', pin=None, diameter_m=0.060, height_m=0.0005, + layers=[dict(thickness_m=0.0005, materials=[dict(substance_id='alumina', volume_fraction=1.0)])]) + cases = [(dict(DENSE, sample_id='on_chuck', pin=None), 0.045, 0.0), (dict(DENSE, sample_id='low_on_chuck', pin=None), 0.045, -0.002), + (dict(DENSE, sample_id='pb_tube', container=dict(substance_id='pb', wall_m=0.3e-3)), 0.045, 0.0), (disc, 0.200, 0.0)] + rates = {} + for s, sod, dz in cases: + h = loaded(s) + pose = dict(xv=60e3, rot=0.0, sod=sod, cz=centred_cz(s) + dz, slide=h.slide) + b, _ = h._base_rates(pose) + rates[s['sample_id']] = b['sample_absorbed_j'] + self.assertAlmostEqual(b['sample_absorbed_j'] / _ordered_reference(h, pose), 1.0, delta=0.03, msg=s['sample_id']) + self.assertLess(abs(b['xray_emitted_j'] - sum(b[k] for k in rt.ENERGY_SINKS)), 1e-12 * b['xray_emitted_j']) + self.assertTrue(all(b[k] >= 0.0 for k in rt.ENERGY_SINKS)) + h = loaded(DENSE) + b, _ = h._base_rates(dict(xv=60e3, rot=0.0, sod=0.045, cz=centred_cz(DENSE), slide=h.slide)) + self.assertAlmostEqual(rates['on_chuck'] / b['sample_absorbed_j'], 1.0, delta=0.005) # pin or chuck behind the body: same dose + + def test_F29_thin_tall_samples_get_enough_ledger_rays(self): + """Thin tall samples on and off the rotation axis: the fine ledger rays cover the body's projection at the cell's angle with at least + 16 rays across (a box over every angle left an off-axis fibre between the rays in some cells).""" + needle = dict(DENSE, sample_id='needle', diameter_m=0.0005, height_m=0.100, + layers=[dict(thickness_m=0.100, materials=[dict(substance_id='alumina', volume_fraction=1.0)])]) + h = loaded(needle) + pose = dict(xv=60e3, rot=0.0, sod=0.300, cz=centred_cz(needle), slide=h.slide) + b, _ = h._base_rates(pose) + self.assertAlmostEqual(b['sample_absorbed_j'] / _ordered_reference(h, pose, 160), 1.0, delta=0.04) + fibre = dict(DENSE, sample_id='fibre', diameter_m=0.0005, height_m=0.050, + layers=[dict(thickness_m=0.050, materials=[dict(substance_id='alumina', volume_fraction=1.0)])]) + h = ready() + h.invoke('sample.provide', **fibre) + h.invoke('door.open') + settle(h) + h.invoke('sample.place', sample_id='fibre', offset_x_m=0.005, offset_y_m=0.0) # 5 mm off the rotation axis + ratios = [] + for k in range(0, rt.RATE_ROT_CELLS, 4): + pose = dict(xv=60e3, rot=k * rt.RATE_ROT_CELL_RAD, sod=0.300, cz=centred_cz(fibre), slide=h.slide) + b, _ = h._base_rates(pose) + ratios.append(b['sample_absorbed_j'] / _ordered_reference(h, pose, nu=2400, nv=40)) + self.assertLess(max(abs(x - 1.0) for x in ratios), 0.06, ratios) + + def test_F30_moves_along_a_keep_out_boundary_are_accepted(self): + """The carriage reaches the chuck's source-side limit first and the lift then runs along it: the corner of the swept path lies exactly + on the carriage target, so rounding cannot put it inside the keep-out.""" + h = loaded(DENSE) + xb = rt.FILTER_CLEAR_M + rt.COLLISION_MARGIN_M + rt.CHUCK_R_M + self.assertTrue(h._geometry_ok(xb, 0.355)) + refused = [] + for k in range(400): + h.sod, h.cz = 0.0285 + k * 0.0375 / 400, 0.335 + if not h._path_ok(xb, 0.355): + refused.append(h.sod) + self.assertEqual(refused, []) + g = loaded(DENSE) + g.invoke('stage.move', sod_m=0.0413, chuck_z_m=0.335) + settle(g) + g.invoke('stage.move', sod_m=xb, chuck_z_m=0.355) + settle(g) + self.assertEqual((g.sod, g.cz), (xb, 0.355)) + rejected(g, 'stage.move', 'COLLISION_RISK', sod_m=xb - 1e-4, chuck_z_m=0.355) + + def test_F31_agents_delete_only_their_own_and_the_hosts_records(self): + h = _scenario('scanned') + h.register_principal('a1', 'agent') + h.register_principal('ev', 'evaluator') + a1, ev = h.session('a1'), h.session('ev') + op = ev.invoke(instance_id=h.instance_id, capability_id='xray.radiograph', arguments=dict(roi=None), request_id='r1')['operation_id'] + self.assertEqual(wait(h, op), 'completed') + rid = h.operations[op]['record_id'] + r = a1.invoke(instance_id=h.instance_id, capability_id='records.delete', arguments=dict(record_id=rid), request_id='d1') + self.assertEqual((r['status'], r['error']['code']), ('rejected', 'ACCESS_DENIED')) + self.assertIn(rid, h.records) + op2 = a1.invoke(instance_id=h.instance_id, capability_id='xray.radiograph', arguments=dict(roi=None), request_id='r2')['operation_id'] + self.assertEqual(wait(h, op2), 'completed') + own = h.operations[op2]['record_id'] + for i, x in enumerate((own, 'FF0001')): # its own record and a host record + r = a1.invoke(instance_id=h.instance_id, capability_id='records.delete', arguments=dict(record_id=x), request_id=f'd{i + 2}') + self.assertEqual(r['status'], 'succeeded', r['error']) + r = ev.invoke(instance_id=h.instance_id, capability_id='records.delete', arguments=dict(record_id=rid), request_id='d9') + self.assertEqual(r['status'], 'succeeded') + + def test_F32_deleting_the_analysed_volume_clears_the_porosity_result(self): + h = _scenario('analysed') + self.assertIsNotNone(h.read()['result.last_porosity']) + h.invoke('records.delete', record_id='VO0001') + self.assertIsNone(h.read()['result.last_porosity']) + self.assertIn('result.last_porosity', rt.EFFECTS['records.delete']) + self.assertIn('analysed', SCENARIOS) + self.assertIn(dict(record_id='VO0001'), _variants('records.delete')) + +# ---------------------------------------------------------------- declared effects (scenario states) +def _into(h, phase, frac=0.5): + """Advance event-exactly to the next programme item of the given phase and then to `frac` of its duration.""" + for _ in range(200): + o = h.op + assert o is not None, phase + end = o['ends'][o['i']] + if o['phase'] == phase: + h.step(max(0.0, (end - h.t) * frac)) + return h + h.step(max(0.0, end - h.t) + 1e-9) + raise AssertionError(phase) + + +def _build(name): + if name == 'fresh': + return rt.BrukerX4PoseidonRuntime() + if name == 'off': + h = configured() + for s in (PELLET, CAL, EDGE): + h.invoke('sample.provide', **s) + return h + if name == 'booting': + h = _scenario('off') + h.invoke('power.set', enabled=True) + h.step(5.0) + return h + if name == 'ready': + h = _scenario('booting') + h.step(rt.BOOT_S) + return h + if name == 'door_opening': + h = _scenario('ready') + h.invoke('door.open') + h.step(1.0) + return h + if name == 'door_open': + h = _scenario('ready') + h.invoke('door.open') + return settle(h) + if name == 'loaded_open': + h = _scenario('door_open') + h.invoke('sample.place', sample_id='alumina_pellet', offset_x_m=0.0, offset_y_m=0.0) + return h + if name == 'door_closing': + h = _scenario('loaded_open') + h.invoke('door.close') + h.step(1.0) + return h + if name == 'loaded': + h = _scenario('loaded_open') + h.invoke('door.close') + settle(h) + h.invoke('scan.configure', **FAST) + return h + if name == 'warming': + h = _scenario('loaded') + h.invoke('xray.enable', enabled=True) + h.step(20.0) + return h + if name == 'beam': + h = _scenario('warming') + h.step(rt.WARMUP_S) + assert h._xray_ready() + return h + if name == 'ramping': + h = _scenario('beam') + h.invoke('xray.set', voltage_v=70e3, current_a=100e-6) + h.step(0.3) + return h + if name == 'flat_running': + h = _scenario('beam') + h.invoke('calibration.flat_field') + h.step(0.1) + return h + if name == 'flat_bright': + return _into(_scenario('flat_running'), 'bright') + if name == 'flat_done': + h = _scenario('flat_running') + return settle(h) + if name == 'positioning': + h = _scenario('flat_done') + h.invoke('stage.move', sod_m=SOD_SCAN, chuck_z_m=centred_cz(PELLET)) + h.step(1.0) + return h + if name == 'positioned': + h = _scenario('positioning') + return settle(h) + if name == 'rotating': + h = _scenario('positioned') + h.invoke('stage.rotate', angle_rad=math.pi / 2) + h.step(0.5) + return h + if name == 'filter_moving': + h = _scenario('positioned') + h.invoke('filter.select', position=3) + h.step(0.2) + return h + if name == 'radiographing': + h = _scenario('positioned') + h.invoke('xray.radiograph', roi=None) + h.step(0.01) + return h + if name == 'radiographed': + return settle(_scenario('radiographing')) + if name == 'scanning': + h = _scenario('positioned') + h.invoke('scan.start') + h.step(5.0) + return h + if name == 'scanned': + return settle(_scenario('scanning')) + if name == 'reconstructing': + h = _scenario('scanned') + h.invoke('recon.start', **RECON_FAST) + h.step(1.0) + return h + if name == 'reconstructed': + h = _scenario('reconstructing') + while h.recon is not None: + h.step(0.5) + return h + if name == 'analysed': + h = _scenario('reconstructed') + h.invoke('data.porosity', record_id='VO0001', region=None, threshold_1_m=None, min_pore_voxels=2) + return h + if name == 'cal_positioned': + h = _scenario('door_open') + h.invoke('sample.place', sample_id='cal_phantom', offset_x_m=0.0, offset_y_m=0.0) + h.invoke('door.close') + settle(h) + h.invoke('scan.configure', **FAST) + beam(h) + flat(h) + h.invoke('stage.move', sod_m=0.050, chuck_z_m=centred_cz(CAL)) + return settle(h) + if name == 'geo_calibrating': + h = _scenario('cal_positioned') + h.invoke('calibration.geometry') + h.step(2.0) + return h + if name == 'estopped': + h = _scenario('positioned') + h.invoke('emergency.stop') + return h + if name == 'estop_released': + h = _scenario('estopped') + h.invoke('emergency.release') + return h + if name == 'arc_fault': + h = _scenario('beam') + h.invoke('fault.inject', fault='xray_arc', active=True) + return h + if name == 'door_sensor_fault': + h = _scenario('beam') + h.invoke('fault.inject', fault='door_sensor', active=True) + return h + if name == 'stall_fault': + h = _scenario('scanning') + h.invoke('fault.inject', fault='rotation_stall', active=True) + return h + if name == 'light_curtain': + h = _scenario('door_closing') + h.invoke('fault.inject', fault='light_curtain_blocked', active=True) + return h + if name == 'defects': + h = _scenario('positioned') + h.invoke('fault.inject', fault='detector_defects', active=True) + return h + if name == 'mains_fault': + h = _scenario('positioned') + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, mains_voltage_v=60.0)) + return h + if name == 'mains_restored': + h = _scenario('mains_fault') + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE)) + return h + if name == 'unpowered_loaded': + h = _scenario('loaded') + h.invoke('power.set', enabled=False) + return h + if name == 'door_just_opening': # the door target moved, the door has not (stop paths change door.closed) + h = _scenario('ready') + h.invoke('door.open') + return h + if name == 'beam_just_enabled': # the tube is enabled but has not emitted yet + h = _scenario('flat_done') + h.invoke('xray.enable', enabled=False) + h.invoke('xray.enable', enabled=True) + return h + if name == 'estopped_unpowered': # safety button pressed while switched off, then booted + h = _scenario('off') + h.invoke('emergency.stop') + h.invoke('power.set', enabled=True) + h.step(rt.BOOT_S + 1.0) + return h + raise KeyError(name) + + +def _scenario(name): + if name not in _SC: + _SC[name] = _build(name) + return copy.deepcopy(_SC[name]) + + +SCENARIOS = ['fresh', 'off', 'booting', 'ready', 'door_opening', 'door_open', 'loaded_open', 'door_closing', 'loaded', 'warming', 'beam', 'ramping', + 'flat_running', 'flat_bright', 'flat_done', 'positioning', 'positioned', 'rotating', 'filter_moving', 'radiographing', 'radiographed', + 'scanning', 'scanned', 'reconstructing', 'reconstructed', 'cal_positioned', 'geo_calibrating', 'estopped', 'estop_released', 'arc_fault', + 'door_sensor_fault', 'stall_fault', 'light_curtain', 'defects', 'mains_fault', 'mains_restored', 'unpowered_loaded', 'door_just_opening', + 'beam_just_enabled', 'estopped_unpowered', 'analysed'] +LONG_SCENARIOS = ['loaded', 'warming', 'positioned', 'scanning', 'reconstructed', 'cal_positioned', 'unpowered_loaded', 'beam_just_enabled'] +STEP_DTS = (0.4, 1.0, 3.0, 15.0, 120.0) + + +def _variants(cap): + V = { + 'plant.configure': [dict(rt.PLANT_EXAMPLE), dict(rt.PLANT_EXAMPLE, mains_voltage_v=60.0), dict(rt.PLANT_EXAMPLE, room_k=300.15)], + 'sample.provide': [dict(rt.SAMPLE_EXAMPLE, sample_id='new')], + 'sample.place': [dict(sample_id='alumina_pellet', offset_x_m=0.0, offset_y_m=0.0), dict(sample_id='cal_phantom', offset_x_m=0.001, offset_y_m=0.0)], + 'sample.remove': [dict(sample_id='alumina_pellet'), dict(sample_id='cal_phantom')], + 'power.set': [dict(enabled=True), dict(enabled=False)], 'power.press_button': [{}], + 'emergency.stop': [{}], 'emergency.release': [{}], 'system.acknowledge': [{}], + 'fault.inject': [dict(fault=f, active=True) for f in rt.FAULTS] + [dict(fault=f, active=False) for f in rt.FAULTS], + 'door.open': [{}], 'door.close': [{}], + 'xray.set': [dict(voltage_v=70e3, current_a=100e-6), dict(voltage_v=40e3, current_a=200e-6)], + 'xray.enable': [dict(enabled=True), dict(enabled=False)], + 'filter.select': [dict(position=3), dict(position=0)], + 'stage.move': [dict(sod_m=SOD_SCAN, chuck_z_m=centred_cz(PELLET)), dict(sod_m=0.250, chuck_z_m=0.250), dict(sod_m=0.020, chuck_z_m=0.387)], + 'stage.rotate': [dict(angle_rad=math.pi / 2), dict(angle_rad=0.0)], + 'stage.go_to': [dict(position='load'), dict(position='center')], + 'scan.configure': [dict(FAST), dict(FAST, range_deg='360', random_movement=True), dict(FAST, binning='2x2', exposure_s=0.05)], + 'calibration.flat_field': [{}], 'calibration.geometry': [{}], 'scan.start': [{}], + 'xray.radiograph': [dict(roi=None), dict(roi=dict(center_u_m=0.0, center_v_m=0.0, size_px=32))], + 'recon.start': [dict(RECON_FAST), dict(RECON_FAST, auto_alignment=True, post_alignment=None, beam_hardening=0.5, bh_material='alumina', + ring_correction=0.5, voi=dict(center_m=[0.0, 0.0, 0.0], size_m=[0.007, 0.007, 0.007]))], + 'data.porosity': [dict(record_id='VO0001', region=None, threshold_1_m=None, min_pore_voxels=2)], + 'data.cracks': [dict(record_id='VO0001', region=None, threshold_1_m=None, min_voxels=20)], + 'data.attenuation': [dict(record_id='VO0001', region=None)], + 'data.slice': [dict(record_id='VO0001', axis='z', position_m=0.0, size_px=32)], + 'data.edge_resolution': [dict(record_id='RG0001')], + 'records.delete': [dict(record_id='FF0001'), dict(record_id='PJ0001'), dict(record_id='RG0001'), dict(record_id='VO0001')], + 'sim.step': [dict(dt_s=0.5), dict(dt_s=30.0)], + } + return V.get(cap, []) + + +def _num(x): + return isinstance(x, (int, float)) and not isinstance(x, bool) + + +def _flat(v, prefix=''): + out = {} + if isinstance(v, dict): + for k, x in v.items(): + out.update(_flat(x, f'{prefix}.{k}')) + elif isinstance(v, list) and len(v) <= 64: + for i, x in enumerate(v): + out.update(_flat(x, f'{prefix}[{i}]')) + else: + out[prefix] = json.dumps(v, sort_keys=True, default=str) if isinstance(v, list) else v + return out + + +def _rel_changed(a, b, scale=None): + if _num(a) and _num(b): + return abs(a - b) > 1e-9 * (max(abs(a), abs(b)) if scale is None else scale) + 1e-300 + return _changed(a, b) + + +def _leaf_changed(a, b): + fa, fb = _flat(a), _flat(b) + return any(_rel_changed(fa.get(k, ''), fb.get(k, '')) for k in set(fa) | set(fb)) + + +def _step_differs(v1, a2, v0, b2): + """Does the step change the value differently with the call (v1 -> a2) than without it (v0 -> b2)? (leaf-wise, numeric increments)""" + f1, fa, f0, fb = _flat(v1), _flat(a2), _flat(v0), _flat(b2) + for leaf in set(f1) | set(fa) | set(f0) | set(fb): + x1, xa, x0, xb = (f.get(leaf, '') for f in (f1, fa, f0, fb)) + ca, cb = _rel_changed(x1, xa), _rel_changed(x0, xb) + if not (ca or cb): + continue + if ca and cb and all(_num(x) for x in (x1, xa, x0, xb)) and not _rel_changed(xa - x1, xb - x0, max(abs(x1), abs(xa), abs(x0), abs(xb))): + continue + if ca and cb and (x1, xa) == (x0, xb): + continue + if ca and cb and x1 == x0 and not _rel_changed(xa, xb): + continue + return True + return False + + +def _executable(cap): + return cap not in rt.UNSUPPORTED and rt.CAPS[cap]['kind'] != 'query' + + +class DeclaredEffects(unittest.TestCase): + def test_immediate_and_on_step_effects_are_declared(self): + """For every capability accepted in any scenario state: the slots it changes at once are declared effects, the slots whose change during the + following step differs from an identical run without the call are declared on_step effects, and the step itself only changes slots declared + as on_step effects of sim.step (the runtime noise is seeded by operation counters, so both runs draw identical noise).""" + missing_imm, missing_step = {}, {} + states = {n: _scenario(n) for n in SCENARIOS} + for cap in rt.CAPS: + if not _executable(cap): + continue + for sname, S in states.items(): + for args in _variants(cap): + A = copy.deepcopy(S) + v0 = A.read('evaluator') + try: + _orig_invoke(A, cap, **args) + except rt.ActionRejected: + continue + v1 = A.read('evaluator') + if cap == 'sim.step': + for k in v0: + if _leaf_changed(v0[k], v1[k]) and k not in rt.ON_STEP['sim.step'] + rt.EFFECTS['sim.step']: + missing_step.setdefault('sim.step', set()).add((sname, k)) + continue + for k in v0: + if _changed(v0[k], v1[k]) and _leaf_changed(v0[k], v1[k]) and k not in rt.EFFECTS.get(cap, []): + missing_imm.setdefault(cap, set()).add((sname, k)) + for dt in STEP_DTS: + A2, B2 = copy.deepcopy(A), copy.deepcopy(S) + A2.step(dt) + B2.step(dt) + a2, b2 = A2.read('evaluator'), B2.read('evaluator') + for k in v0: + if k not in rt.ON_STEP.get(cap, []) and _step_differs(v1[k], a2[k], v0[k], b2[k]): + missing_step.setdefault(cap, set()).add((sname, k)) + if k not in rt.ON_STEP['sim.step'] + ['clock.time_s'] and _leaf_changed(v0[k], b2[k]): + missing_step.setdefault('sim.step', set()).add((sname, k)) + self.assertEqual(missing_imm, {}) + self.assertEqual(missing_step, {}) + self.assertFalse([s for v in rt.ON_STEP.values() for s in v if rt.SLOTS[s]['origin'] == 'setpoint']) + + def test_every_executable_capability_is_accepted_in_some_scenario(self): + accepted = set() + for n in SCENARIOS: + S = _scenario(n) + for cap in rt.CAPS: + if not _executable(cap) or cap in accepted: + continue + for args in _variants(cap): + try: + _orig_invoke(copy.deepcopy(S), cap, **args) + accepted.add(cap) + break + except rt.ActionRejected: + pass + self.assertEqual({c for c in rt.CAPS if _executable(c)} - accepted, set()) + + def test_long_window_effects_of_operations_are_declared(self): + """Every accepted asynchronous call is followed until its operation has left 'running' (+ 5 s), every other call for 200 s (longer than + the 180 s warm-up), comparing with the identical run without the call every 0.05 s for the first 10 s and every 1 s after.""" + missing = {} + for sname in LONG_SCENARIOS: + S = _scenario(sname) + for cap in rt.CAPS: + if not _executable(cap) or cap == 'sim.step': + continue + for args in _variants(cap): + A = copy.deepcopy(S) + v0 = A.read('evaluator') + try: + res = _orig_invoke(A, cap, **args) + except rt.ActionRejected: + continue + oid = res.get('operation_id') if isinstance(res, dict) and cap in rt.ASYNC else None + v1 = A.read('evaluator') + B = copy.deepcopy(S) + t, t_end = 0.0, (3600.0 if oid else 200.0) + while t < t_end - 1e-9: + d = 0.05 if t < 10.0 - 1e-9 else 1.0 + A.step(d) + B.step(d) + t += d + a2, b2 = A.read('evaluator'), B.read('evaluator') + for k in v0: + if k not in rt.ON_STEP.get(cap, []) and _step_differs(v1[k], a2[k], v0[k], b2[k]): + missing.setdefault(cap, set()).add((sname, k)) + if oid and A.operations[oid]['phase'] != 'running' and t_end == 3600.0: + t_end = t + 5.0 + self.assertEqual(missing, {}) + + +class ZZRejectionCodes(unittest.TestCase): + def test_every_observed_rejection_code_is_declared(self): + """Runs last (class name): every code raised by a device call anywhere in this test module is declared for that capability.""" + undeclared = {k: sorted(v - set(rt.CAP_ERRORS.get(k, [])) - {'INVALID_ARGUMENT', 'UNSUPPORTED', 'UNKNOWN_CAPABILITY'}) + for k, v in REJECTIONS.items()} + self.assertEqual({k: v for k, v in undeclared.items() if v}, {}) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_asset_cytiva_biacoret200.py b/tests/test_asset_cytiva_biacoret200.py new file mode 100644 index 0000000000000000000000000000000000000000..06c4ea5ea624318bab11daa57930cae48de2d46d --- /dev/null +++ b/tests/test_asset_cytiva_biacoret200.py @@ -0,0 +1,1163 @@ +"""tests for CHEM-170 cytiva_biacoret200 (Biacore T200 SPR system): python3 -m unittest tests/test_asset_cytiva_biacoret200.py + +Themes: set-points only write targets; read / describe are pure; rejected calls leave the state unchanged; two instances are isolated; agent / +evaluator truth isolation and foreign-agent ownership; idempotent request ids; step-partition independence; start-up lamps, software connection and +the 5 K ~ 1 h temperature response; chip insert / dock / eject / reuse; standby consumption (65 mL / 24 h) and expiry; Prime and the gradual buffer +change; liquid conservation (bottles -> waste / spill); rack tray, door and clamp interlocks; bulk refractive index (1 % DMSO ~ 1200 RU) and its +temperature dependence; amine coupling (Getting Started > 8000 RU, pH trend), pH scouting and aim-for-level; 1:1 kinetics with mass transport +recovered by the evaluation; steady-state affinity, CFCA, regeneration and ligand damage, solvent correction, van 't Hoff / Eyring; NTA and SA +capture; normalization; System Check; maintenance and shutdown; manual-run queue; cancellation, power loss; every output validated against its +contract schema; declared state effects cover the observed changes.""" +import copy +import json +import math +import sys +import unittest +from pathlib import Path + +import numpy as np + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / 'scripts')) +from asset_runtime import cytiva_biacoret200 as rt # noqa: E402 + +UL, ULM = rt.UL, rt.UL_MIN +CHECKS = [] +INST = 'biacore_t200_01' +GS_L, GS_A = rt.GS_LIGAND, rt.GS_ANALYTE +SEEN_CAPS = set() +PROCESS_EVIDENCE = {} +_ALWAYS = {'operation.started_by_other_agent'} + + +def _differ(x, y): + if isinstance(x, float) and isinstance(y, float): + return abs(x - y) > 1e-12 * max(1.0, abs(x), abs(y)) + return x != y + + +class Rig: + def __init__(self, seed=1, room=298.15, instance=INST): + self.h = rt.CytivaBiacoret200Runtime(instance) + self.h.register_principal('agent', 'agent') + self.h.register_principal('eval', 'evaluator') + self.A = self.h.session('agent') + self.E = self.h.session('eval') + self.n = 0 + self.inst = instance + self.call(self.E, 'plant.configure', room_k=room, mains_voltage_v=230.0, noise_seed=seed) + + def call(self, sess, cap, expect='succeeded', **args): + """Instrumented call: outputs validated against the declared schema; a success changes only declared immediate slots and never the clock; + a rejection leaves every slot unchanged and returns a declared error code.""" + self.n += 1 + before, t0 = self.h.read('evaluator'), self.h.t + r = sess.invoke(instance_id=self.inst, capability_id=cap, arguments=args, request_id=f'r{self.n}') + after = self.h.read('evaluator') + changed = {k for k in after if _differ(after[k], before[k])} - {'clock.time_s'} + if expect in ('succeeded', 'accepted'): + assert r['status'] in ('succeeded', 'accepted'), (cap, r['error']) + rt.validate(rt.CAPS[cap]['output_schema'], r['result']) + if cap != 'sim.step': + extra = changed - set(rt.EFFECTS.get(cap, [])) - _ALWAYS + assert not extra, (cap, sorted(extra)) + assert self.h.t == t0, cap + SEEN_CAPS.add(cap) + PROCESS_EVIDENCE.setdefault(cap, []).append(dict(arguments=json.dumps(args, sort_keys=True, default=str)[:200], time_s=t0, status=r['status'])) + return r['result'] + assert r['status'] in ('rejected', 'unsupported'), (cap, r['status'], r.get('result')) + assert r['error']['code'] == expect, (cap, r['error']['code'], expect) + assert not changed, (cap, 'rejected call changed', sorted(changed)) + assert expect in [e['code'] for e in rt.export_cytiva_biacoret200_contract_metadata()['capabilities'][cap]['errors']] or expect == 'UNSUPPORTED', (cap, expect) + return r + + def step(self, s): + self.call(self.E, 'sim.step', dt_s=float(s)) + + def until(self, pred, limit=7200.0, dt=10.0): + t = 0.0 + while not pred() and t < limit: + self.step(dt) + t += dt + assert pred(), f'condition not reached in {limit} s' + + def read(self, *ids, who=None): + sess = who or self.E + o = sess.read(instance_id=self.inst, state_ids=list(ids) if ids else None)['observations'] + return {k: v['value'] for k, v in o.items()} if not ids or len(ids) > 1 else o[ids[0]]['value'] + + def ready(self, chip='CM5', chip_id='chip_1', buffer='hbs_ep_plus', prime=True): + A = self.A + self.call(A, 'power.set', enabled=True) + self.step(35) + self.call(A, 'solution.prepare', solution_id='run_buffer', volume_m3=1.0e-3, base=buffer) + self.call(A, 'solution.prepare', solution_id='dist_water', volume_m3=0.5e-3, base='water') + self.call(A, 'bottle.place', slot='buffer_a', solution_id='run_buffer', volume_m3=0.95e-3) + self.call(A, 'bottle.place', slot='water', solution_id='dist_water', volume_m3=0.45e-3) + self.call(A, 'bottle.empty_waste') + self.call(A, 'chip.open_port') + self.step(2) + self.call(A, 'chip.insert', chip_type=chip, chip_id=chip_id) + self.call(A, 'chip.close_cover') + self.step(2) + self.call(A, 'chip.dock') + self.step(50) + if prime: + self.call(A, 'flow.prime') + self.step(400) + self.until(lambda: self.h._stable(), 7200) + + def rack(self, config='sample_and_reagent_rack', plate='none', items=()): + A = self.A + if self.h.rack['state'] == 'inside': + self.call(A, 'rack.eject') + self.step(8) + if self.h.rack['config'] is None or self.h.rack['config']['config'] != config: + self.call(A, 'rack.configure', config=config, plate=plate) + for pos, sid, v in items: + if pos in self.h.rack['positions']: + self.call(A, 'rack.remove', position=pos) + self.call(A, 'rack.place', position=pos, solution_id=sid, volume_m3=v) + self.call(A, 'rack.retract') + self.step(8) + + def gs_kit(self): + self.call(self.E, 'kit.provide', kit='getting_started') + self.call(self.E, 'kit.provide', kit='amine_coupling') + + def amine(self, fc, ligand_sid, contact=420.0, flow=10 * ULM, run_id=None, mode='contact', target=None, wash=None): + items = [('R1A1', 'edc_0_4m', 150 * UL), ('R1A2', 'nhs_0_1m', 150 * UL), ('R1A4', 'ethanolamine_1m', 150 * UL), ('R1A5', ligand_sid, 400 * UL)] + if wash: + items.append(('R1A6', wash, 300 * UL)) + if 'R1A3' in self.h.rack['positions'] and self.h.rack['state'] == 'inside': + self.call(self.A, 'rack.eject') + self.step(8) + self.call(self.A, 'rack.remove', position='R1A3') + self.rack(items=items) + f = dict(fc=fc, chemistry='amine', mode=mode, ligand_position='R1A5', ligand_name=ligand_sid, flow_rate_m3_s=flow, edc_position='R1A1', nhs_position='R1A2', + mix_position='R1A3', ethanolamine_position='R1A4') + if mode == 'contact': + f['contact_s'] = contact + if mode == 'aim': + f.update(target_ru=target, wash_position='R1A6') + op = self.call(self.A, 'wizard.immobilization', run_id=run_id or f'immob_{fc}_{self.n}', flow_cells=[f])['operation_id'] + self.until(lambda: self.h.operations[op]['phase'] != 'running', 14400, 30.0) + return self.h.operations[op]['result'] + + def kinetics_method(self, run_id, concs_nm, path='3-4', ref='4-3', contact=120.0, diss=600.0, flow=30 * ULM, regen='glycine_2_5', stock='gs_analyte_b2m', mw=11800.0, + rate=1, startup=1, base='hbs_ep_plus'): + stock_c = self.h.solutions[stock]['label'][0]['concentration_mol_m3'] + items = [] + for i, c in enumerate(concs_nm): + sid = f'{run_id}_s{i}' + src = [dict(source_id=stock, volume_m3=c * 1e-6 * 600 * UL / stock_c)] if c else [] + self.call(self.A, 'solution.prepare', solution_id=sid, volume_m3=600 * UL, base=base, sources=src) + items.append((f'R1B{i + 1}', sid, 400 * UL)) + self.call(self.A, 'solution.prepare', solution_id=f'{run_id}_regen', volume_m3=3.0e-6, base=regen) + items.append(('R1A9', f'{run_id}_regen', 3.0e-6)) + self.rack(items=items) + cyc = [dict(purpose='startup', commands=[dict(type='sample', position='R1B1', contact_s=contact, dissociation_s=60.0, flow_rate_m3_s=flow), + dict(type='regeneration', position='R1A9', contact_s=30.0, flow_rate_m3_s=flow, stabilization_s=60.0)])] * startup + for i, c in enumerate(concs_nm): + cyc.append(dict(purpose='blank' if c == 0 else 'sample', keywords=dict(sample_name=f'{c} nM', concentration_mol_m3=c * 1e-6, mw_da=mw), + commands=[dict(type='sample', position=f'R1B{i + 1}', contact_s=contact, dissociation_s=diss, flow_rate_m3_s=flow), + dict(type='regeneration', position='R1A9', contact_s=30.0, flow_rate_m3_s=flow, stabilization_s=60.0)])) + op = self.call(self.A, 'method.run', run_id=run_id, data_rate_hz=rate, detection='dual' if '-' in path and len(path) == 3 else 'multi', flow_path=path, + reference_subtraction=ref, cycles=cyc)['operation_id'] + self.until(lambda: self.h.operations[op]['phase'] != 'running', 40000, 60.0) + return op + + +def truth(r): + return r.read(*[k for k, v in rt.SLOTS.items() if v['visibility'] == 'evaluator' or True]) + + +class ContractAndLibraries(unittest.TestCase): + def test_metadata_consistency(self): + m = rt.export_cytiva_biacoret200_contract_metadata() + self.assertEqual(len(m['capabilities']), len(rt.CAPS)) + for k, c in m['capabilities'].items(): + if k in rt.UNSUPPORTED: + self.assertEqual(c['availability'], 'unsupported') + continue + for e in c['state_effects']: + self.assertIn(e['state_id'], rt.SLOTS) + for e in c['errors']: + self.assertIn(e['code'], rt.ERROR_ZH) + if rt.CAPS[k]['kind'] not in ('query',) and k != 'sim.step': + self.assertTrue(c['preconditions'], k) + for k, v in rt.SLOTS.items(): + if v['origin'] == 'process_truth': + self.assertNotEqual(v['visibility'], 'agent', k) + CHECKS.append(dict(check='metadata_consistency', status='passed', capabilities=len(rt.CAPS), slots=len(rt.SLOTS))) + + def test_libraries(self): + lib = rt.interactions() + doc = [k for k, v in lib.items() if v['evidence'] == 'documented_literature'] + self.assertGreaterEqual(len(doc), 50) + self.assertGreaterEqual(len(rt.CRC), 50) + self.assertAlmostEqual(rt.n_water(293.15), 1.33211, places=4) + self.assertLess(rt.n_water(310.15), rt.n_water(298.15)) + dn, eta, I = rt.solution_optics(rt.library_composition('hbs_ep_plus_dmso_5')) + dn0, _, _ = rt.solution_optics(rt.library_composition('hbs_ep_plus')) + self.assertAlmostEqual((dn - dn0) * rt.S_BULK / 5.0, 1200.0, delta=1.0) + D = rt.diffusion_estimate(100000.0) + self.assertAlmostEqual(D, 6.9e-11, delta=0.3e-11) # Cytiva: ~6e-11 m2/s at 100 kDa + kt = rt.km_flow_cell(rt.diffusion_estimate(15000.0), 30 * ULM) * 15000.0 * 1e9 + self.assertTrue(5e7 < kt < 1e9, kt) # Software Handbook: proteins ~1e8 RU M^-1 s^-1 + CHECKS.append(dict(check='libraries', status='passed', interactions=len(doc), crc=len(rt.CRC), kt_15kDa=kt)) + + +class Basics(unittest.TestCase): + def test_read_pure_and_setpoint_only(self): + r = Rig(room=295.15) + r.call(r.A, 'power.set', enabled=True) + r.step(35) + a = r.read() + b = r.read() + self.assertEqual(a, b) + t0 = r.h.t + r.A.describe(instance_id=INST) + self.assertEqual(r.h.t, t0) + T0 = r.read('truth.analysis_temperature_k') + r.call(r.A, 'temperature.set', analysis_k=300.15) + self.assertEqual(r.read('temperature.analysis_setpoint_k'), 300.15) + self.assertEqual(r.read('truth.analysis_temperature_k'), T0) + r.step(60) + self.assertGreater(r.read('truth.analysis_temperature_k'), T0) + CHECKS.append(dict(check='read_pure_setpoint_only', status='passed')) + + def test_rejection_atomic_and_codes(self): + r = Rig() + before = copy.deepcopy(r.read()) + r.call(r.A, 'temperature.set', 'POWER_OFF', analysis_k=300.0) + r.call(r.A, 'chip.dock', 'POWER_OFF') + r.call(r.A, 'rack.place', 'RACK_NOT_EJECTED', position='R1A1', solution_id='x', volume_m3=1e-7) + r.call(r.A, 'solution.prepare', 'UNKNOWN_SOLUTION', solution_id='a', volume_m3=1e-6, base='water', sources=[dict(source_id='nope', volume_m3=1e-8)]) + r.call(r.A, 'clamp.set', 'DOOR_CLOSED', closed=False) + r.call(r.A, 'surface.inspect', 'ACCESS_DENIED') + r.call(r.A, 'sample.recovery', 'UNSUPPORTED') + self.assertEqual(before, r.read()) + r.call(r.A, 'power.set', enabled=True) + r.call(r.A, 'chip.open_port', 'NOT_CONNECTED') + r.step(35) + r.call(r.A, 'temperature.set', 'BELOW_AMBIENT_LIMIT', analysis_k=277.15) + r.call(r.A, 'flow.prime', 'CHIP_NOT_DOCKED') + CHECKS.append(dict(check='rejection_atomic', status='passed')) + + def test_two_instances_and_isolation(self): + r1, r2 = Rig(seed=3), Rig(seed=3, instance='biacore_t200_02') + r1.call(r1.A, 'power.set', enabled=True) + r1.step(40) + self.assertTrue(r1.read('power.enabled')) + self.assertFalse(r2.read('power.enabled')) + agent_view = r1.read(who=r1.A) + self.assertFalse(any(k.startswith('truth.') for k in agent_view)) + with self.assertRaises(rt.ActionRejected): + r1.A.read(instance_id=INST, state_ids=['truth.complexes_ru']) + with self.assertRaises(rt.ActionRejected): + r1.A.read(instance_id='biacore_t200_02') + r1.h.register_principal('agent2', 'agent') + B = r1.h.session('agent2') + r1.call(r1.A, 'solution.prepare', solution_id='mine', volume_m3=1e-5, base='water') + rr = B.invoke(instance_id=INST, capability_id='solution.prepare', arguments=dict(solution_id='b', volume_m3=1e-6, base='water', + sources=[dict(source_id='mine', volume_m3=1e-7)]), request_id='x1') + self.assertEqual(rr['error']['code'], 'ACCESS_DENIED') + self.assertNotIn('mine', B.read(instance_id=INST, state_ids=['solutions.available'])['observations']['solutions.available']['value']) + CHECKS.append(dict(check='instances_isolation', status='passed')) + + def test_idempotent_requests(self): + r = Rig() + a = r.A.invoke(instance_id=INST, capability_id='power.set', arguments=dict(enabled=True), request_id='same') + b = r.A.invoke(instance_id=INST, capability_id='power.set', arguments=dict(enabled=True), request_id='same') + self.assertEqual(a, b) + c = r.A.invoke(instance_id=INST, capability_id='power.set', arguments=dict(enabled=False), request_id='same') + self.assertEqual(c['error']['code'], 'REQUEST_CONFLICT') + self.assertTrue(r.read('power.enabled')) + CHECKS.append(dict(check='idempotent', status='passed')) + + def test_step_partition_independence(self): + out = [] + for split in (1, 7): + r = Rig(seed=5) + r.ready(prime=False) + r.gs_kit() + r.call(r.A, 'solution.prepare', solution_id='lig', volume_m3=400 * UL, base='acetate_5_0', sources=[dict(source_id='gs_ligand_anti_b2m', volume_m3=12 * UL)]) + r.rack(items=[('R1A5', 'lig', 300 * UL)]) + r.call(r.A, 'run.manual_start', run_id='m', flow_rate_m3_s=10 * ULM, flow_path='2', data_rate_hz=10) + r.call(r.A, 'run.command', command=dict(command='sample_injection', position='R1A5', contact_s=60.0)) + total = 120.0 + for k in range(split): + r.h.step(total / split) + out.append(r.read()) + for k in out[0]: + a, b = out[0][k], out[1][k] + if isinstance(a, float): + self.assertAlmostEqual(a, b, delta=1e-9 * max(1.0, abs(a)), msg=k) + else: + self.assertEqual(a, b, k) + CHECKS.append(dict(check='step_partition_independence', status='passed')) + + +class PowerTemperatureChip(unittest.TestCase): + def test_startup_lamps_connection(self): + r = Rig() + r.call(r.A, 'power.press_switch') + r.step(1) + L = r.read('lamp.ready', 'lamp.system', 'lamp.temperature', 'lamp.sensor_chip', 'lamp.run') + self.assertTrue(all(L.values())) + r.step(4) + self.assertTrue(r.read('lamp.ready')) + self.assertFalse(r.read('lamp.system')) + self.assertFalse(r.read('system.connected')) + r.step(30) + self.assertTrue(r.read('system.connected')) + r.call(r.A, 'power.press_switch') + self.assertFalse(r.read('power.enabled')) + CHECKS.append(dict(check='startup_lamps', status='passed')) + + def test_temperature_5k_about_one_hour(self): + r = Rig(room=298.15) + r.call(r.A, 'power.set', enabled=True) + r.step(40) + r.call(r.A, 'temperature.set', analysis_k=303.15) + flash = set() + t = 0.0 + while not r.read('temperature.analysis_stable'): + r.h.step(0.5) + t += 0.5 + flash.add(r.read('lamp.temperature')) + if t > 3 * 3600: + break + self.assertTrue(40 * 60 < t < 80 * 60, t) # Operating Instructions: "A temperature change of 5 C takes about 1 hour" + self.assertEqual(flash, {True, False}) + r.step(10) + self.assertTrue(r.read('lamp.temperature')) + CHECKS.append(dict(check='temperature_5k', status='passed', minutes=t / 60)) + + def test_chip_lifecycle_and_reuse(self): + r = Rig() + r.call(r.A, 'power.set', enabled=True) + r.step(35) + r.call(r.A, 'chip.insert', 'PORT_CLOSED', chip_type='CM5', chip_id='c1') + r.call(r.A, 'chip.open_port') + r.step(2) + self.assertGreater(r.read('chip.port_cover_angle_rad'), 1.1) + r.call(r.A, 'chip.insert', chip_type='CM5', chip_id='c1') + seen = set() + for _ in range(4): + r.h.step(0.5) + seen.add(r.read('lamp.sensor_chip')) + self.assertEqual(seen, {True, False}) + r.call(r.A, 'chip.dock', 'COVER_OPEN') + r.call(r.A, 'chip.close_cover') + r.step(2) + r.call(r.A, 'chip.dock', 'NO_BUFFER') if False else None + op = r.call(r.A, 'chip.dock')['operation_id'] + r.step(50) + self.assertEqual(r.read('chip.state'), 'docked') + self.assertTrue(r.read('lamp.sensor_chip')) + r.call(r.A, 'chip.open_port', 'CHIP_DOCKED') + r.call(r.A, 'chip.eject') + r.step(35) + self.assertEqual(r.read('chip.state'), 'ejected') + r.call(r.A, 'chip.remove') + r.call(r.A, 'chip.insert', 'CHIP_ID_EXISTS', chip_type='CM5', chip_id='c1') + r.call(r.A, 'chip.insert', 'CHIP_UNKNOWN', chip_type='CM5', chip_id='c9', reuse=True) + r.call(r.A, 'chip.insert', 'CHIP_TYPE_MISMATCH', chip_type='SA', chip_id='c1', reuse=True) + r.call(r.A, 'chip.insert', chip_type='CM5', chip_id='c1', reuse=True) + self.assertEqual(r.h._chip_obj()['docks'], 1) + CHECKS.append(dict(check='chip_lifecycle', status='passed')) + + def test_noise_and_docking_drift(self): + r = Rig(seed=11) + r.ready() + r.call(r.A, 'run.manual_start', run_id='n', flow_rate_m3_s=30 * ULM, flow_path='1-2-3-4', data_rate_hz=1) + r.step(600) + cyc = r.h.runs['n']['cycles'][0] + y = np.array(cyc['r']['2']) - np.array(cyc['r']['1']) + res = y - np.polyval(np.polyfit(cyc['t'], y, 2), cyc['t']) + rms = float(np.std(res)) + self.assertTrue(0.01 < rms < 0.06, rms) # 2-1 noise ~ sqrt(2) x 0.025 RU (data file: typically < 0.03 RU per curve) + raw = np.array(cyc['r']['2']) + slope_early = np.polyfit(cyc['t'][:120], raw[:120], 1)[0] * 60 + self.assertGreater(abs(slope_early), 0.3) # hydration drift after docking a new chip + r.call(r.A, 'run.stop') + CHECKS.append(dict(check='noise_drift', status='passed', rms_2_1=rms)) + + +class Fluidics(unittest.TestCase): + def test_standby_consumption_and_expiry(self): + r = Rig() + r.ready(prime=False) + self.assertEqual(r.read('flow.state'), 'standby') + b0 = r.read('truth.bottle_volumes_m3') + r.step(86400) + b1 = r.read('truth.bottle_volumes_m3') + used = (b0['buffer_a'] - b1['buffer_a']) + (b0['water'] - b1['water']) + self.assertAlmostEqual(used / 65e-6, 1.0, delta=0.05) # Operating Instructions: ~65 mL per 24 h + r.call(r.A, 'bottle.place', slot='buffer_a', solution_id='run_buffer', volume_m3=5e-5) # top-up (remaining bench volume) + led = r.call(r.E, 'ledger.read')['ledger'] + self.assertAlmostEqual(led['buffer_used_m3'] + led['water_used_m3'], led['waste_added_m3'] + led['waste_spilled_m3'], delta=1e-12) + CHECKS.append(dict(check='standby_65ml', status='passed', ml_per_day=used * 1e6)) + + def test_standby_expiry_7_days(self): + r = Rig() + r.ready(prime=False) + r.h.bottles['buffer_a']['V'] = 1.0e-3 + r.h.bottles['water']['V'] = 0.5e-3 + r.step(7 * 86400 + 60) + self.assertEqual(r.read('flow.state'), 'stopped') + self.assertIn('STANDBY_EXPIRED', r.read('warnings.active')) + CHECKS.append(dict(check='standby_expiry', status='passed')) + + def test_prime_and_gradual_buffer_change(self): + r = Rig(seed=4) + r.ready() + self.assertEqual(r.read('truth.system_buffer'), 'run_buffer') + r.call(r.A, 'solution.prepare', solution_id='pbs_run', volume_m3=1.0e-3, base='pbs') + r.call(r.A, 'bottle.place', slot='buffer_a', solution_id='pbs_run', volume_m3=0.9e-3) + r.step(20) + self.assertIn('PRIME_RECOMMENDED', r.read('warnings.active')) + R0 = r.read('response.ru')['1'] + r.step(1200) + R1 = r.read('response.ru')['1'] + self.assertGreater(abs(R1 - R0), 10.0) # baseline moves while the new buffer replaces the old one + r.call(r.A, 'flow.prime') + r.step(400) + self.assertEqual(r.read('truth.system_buffer'), 'pbs_run') + self.assertNotIn('PRIME_RECOMMENDED', r.read('warnings.active')) + CHECKS.append(dict(check='prime_buffer_change', status='passed', shift_ru=R1 - R0)) + + def test_buffer_empty_fails_run_and_waste_bottle(self): + r = Rig() + r.ready() + r.call(r.A, 'run.manual_start', run_id='e', flow_rate_m3_s=100 * ULM, flow_path='1') + r.h.bottles['buffer_a']['V'] = 5e-8 + r.step(120) + self.assertEqual(r.h.runs['e']['state'], 'failed') + self.assertIn('BUFFER_EMPTY', r.read('errors.active')) + r.h.bottles['buffer_a']['V'] = 5e-4 + r.call(r.A, 'bottle.remove', slot='waste') + r.call(r.A, 'run.manual_start', 'NO_WASTE_BOTTLE', run_id='e2', flow_rate_m3_s=10 * ULM, flow_path='1') + CHECKS.append(dict(check='buffer_empty', status='passed')) + + def test_clamp_door_interlock_and_air(self): + r = Rig() + r.ready() + r.call(r.A, 'clamp.set', 'DOOR_CLOSED', closed=False) + r.call(r.A, 'door.set', door='right_pump', open=True) + r.step(2) + r.call(r.A, 'clamp.set', closed=False) + r.step(2) + self.assertGreater(r.read('clamp.lever_angle_rad'), 1.3) + self.assertIn('CLAMP_OPEN', r.read('warnings.active')) + r.call(r.A, 'solution.prepare', solution_id='buf', volume_m3=1e-6, base='hbs_ep_plus') + r.rack(items=[('R1B1', 'buf', 300 * UL)]) + r.call(r.A, 'run.manual_start', run_id='air', flow_rate_m3_s=30 * ULM, flow_path='1-2') + r.call(r.A, 'run.command', command=dict(command='sample_injection', position='R1B1', contact_s=60.0)) + r.step(120) + inj = r.h.runs['air']['cycles'][0]['injections'][0] + self.assertTrue(inj['air']) + self.assertLess(min(r.h.runs['air']['cycles'][0]['r']['1']), r.h.runs['air']['cycles'][0]['r']['1'][0] - 5000) # air spike + r.call(r.A, 'run.stop') + CHECKS.append(dict(check='clamp_air', status='passed')) + + +class RackAndDoors(unittest.TestCase): + def test_rack_eject_retract_and_mounting(self): + r = Rig(seed=2) + r.call(r.A, 'plant.configure', 'ACCESS_DENIED', room_k=298.0, mains_voltage_v=230.0, noise_seed=2) + r.call(r.E, 'plant.configure', room_k=298.15, mains_voltage_v=230.0, noise_seed=2, rack_auto_retract_s=60.0) + r.call(r.A, 'power.set', enabled=True) + r.step(35) + r.call(r.A, 'rack.eject') + r.step(8) + self.assertAlmostEqual(r.read('rack.carriage_position_m'), 0.14, places=6) + r.call(r.A, 'rack.configure', config='tray_plate_type2', plate='96_deep', correctly_mounted=False) + r.call(r.A, 'rack.retract', 'RACK_NOT_SEATED') + r.step(120) + self.assertEqual(r.read('rack.state'), 'ejected') + r.call(r.A, 'rack.configure', config='tray_plate_type2', plate='96_deep') + r.call(r.A, 'rack.place', 'UNKNOWN_POSITION', position='R1A1', solution_id='x', volume_m3=1e-7) + r.call(r.A, 'solution.prepare', solution_id='s', volume_m3=2e-6, base='hbs_ep_plus') + r.call(r.A, 'rack.place', 'VOLUME_OUT_OF_RANGE', position='R2B1', solution_id='s', volume_m3=1.0e-6) + r.call(r.A, 'rack.place', position='P1A1', solution_id='s', volume_m3=0.2e-6) + r.step(70) + self.assertEqual(r.read('rack.state'), 'inside') # automatic retraction after the preset time + CHECKS.append(dict(check='rack', status='passed')) + + def test_sample_compartment_door(self): + r = Rig() + r.call(r.A, 'power.set', enabled=True) + r.step(35) + r.call(r.A, 'sample_compartment.open_door', 'POWER_ON') + r.call(r.A, 'power.set', enabled=False) + r.call(r.A, 'sample_compartment.open_door') + r.step(3) + self.assertGreater(r.read('sample_compartment.door_angle_rad'), 1.7) + r.call(r.A, 'sample_compartment.clean') + r.call(r.A, 'power.set', 'SAMPLE_COMPARTMENT_OPEN', enabled=True) + r.call(r.A, 'sample_compartment.close_door') + r.step(3) + r.call(r.A, 'power.set', enabled=True) + CHECKS.append(dict(check='sample_door', status='passed')) + + +class Optics(unittest.TestCase): + def test_dmso_bulk_and_temperature(self): + r = Rig(seed=8) + r.ready() + r.call(r.A, 'solution.prepare', solution_id='d1', volume_m3=1e-6, base='hbs_ep_plus', dmso_volume_fraction=0.01) + r.rack(items=[('R1B1', 'd1', 400 * UL)]) + r.call(r.A, 'run.manual_start', run_id='bulk', flow_rate_m3_s=30 * ULM, flow_path='1', data_rate_hz=1) + r.step(30) + r.call(r.A, 'run.command', command=dict(command='sample_injection', position='R1B1', contact_s=60.0)) + r.step(120) + rows = r.call(r.A, 'data.report_points', run_id='bulk')['rows'] + rel = next(x for x in rows if x['label'] == 'sample:binding' and x['curve'] == '1')['relative_ru'] + self.assertAlmostEqual(rel / 1200.0, 1.0, delta=0.03) # Software Handbook: 1 % DMSO ~ 1200 RU + r.call(r.A, 'run.stop') + r.step(4 * 3600) # docking drift of the new chip decays + R0 = r.read('response.ru')['1'] + r.call(r.A, 'temperature.set', analysis_k=299.15) + r.until(lambda: r.h._stable(), 7200) + R1 = r.read('response.ru')['1'] + self.assertTrue(-160 < R1 - R0 < -90, R1 - R0) # water dn/dT ~ -1.2e-4 /K + CHECKS.append(dict(check='dmso_bulk', status='passed', relative_ru=rel, per_K=R1 - R0)) + + +class Immobilization(unittest.TestCase): + def test_getting_started_amine_coupling(self): + r = Rig(seed=21) + r.ready() + r.gs_kit() + r.call(r.A, 'solution.prepare', solution_id='lig50', volume_m3=400 * UL, base='acetate_5_0', sources=[dict(source_id='gs_ligand_anti_b2m', volume_m3=12 * UL)]) + res = r.amine(4, 'lig50') + im = res['results']['immobilization'][0] + self.assertGreater(im['response_final_ru'], 8000.0) # Getting Started: > 8000 RU satisfactory + self.assertGreater(im['response_bound_ru'], 0.0) + ins = r.call(r.E, 'surface.inspect') + f4 = ins['flow_cells'][3] + self.assertEqual(f4['ligands'][0]['species'], GS_L) + self.assertAlmostEqual(f4['active_esters'], 0.0, delta=1e-3) + self.assertEqual(ins['flow_cells'][2]['ligands'], []) + CHECKS.append(dict(check='gs_amine', status='passed', final_ru=im['response_final_ru'])) + + def test_ph_trend_and_scouting(self): + finals = {} + for ph, base in ((4.0, 'acetate_4_0'), (5.0, 'acetate_5_0'), (5.5, 'acetate_5_5')): + r = Rig(seed=22) + r.ready() + r.gs_kit() + r.call(r.A, 'solution.prepare', solution_id='lig', volume_m3=400 * UL, base=base, sources=[dict(source_id='gs_ligand_anti_b2m', volume_m3=12 * UL)]) + finals[ph] = r.amine(2, 'lig')['results']['immobilization'][0]['response_final_ru'] + self.assertLess(finals[4.0], finals[5.0]) # Getting Started: pH 4.0 lowest immobilization level + self.assertLess(finals[5.0], finals[5.5]) # pH 5.5 higher than 5.0 + r = Rig(seed=23) + r.ready() + r.step(3 * 3600) # docking drift of the new chip decays + r.gs_kit() + items = [] + for i, base in enumerate(('acetate_5_5', 'acetate_5_0', 'acetate_4_5', 'acetate_4_0')): + r.call(r.A, 'solution.prepare', solution_id=f'p{i}', volume_m3=300 * UL, base=base, sources=[dict(source_id='gs_ligand_anti_b2m', volume_m3=9 * UL)]) + items.append((f'R1B{i + 1}', f'p{i}', 250 * UL)) + r.call(r.A, 'solution.prepare', solution_id='naoh', volume_m3=1e-6, base='naoh_50mm') + items.append(('R1A1', 'naoh', 600 * UL)) + r.rack(items=items) + op = r.call(r.A, 'wizard.ph_scouting', run_id='scout', fc=2, ligand_positions=['R1B1', 'R1B2', 'R1B3', 'R1B4'], wash_position='R1A1')['operation_id'] + r.until(lambda: r.h.operations[op]['phase'] != 'running', 7200, 30) + pc = [x['preconcentration_ru'] for x in r.h.operations[op]['result']['results']['ph_scouting']] + self.assertTrue(pc[0] < pc[1] < pc[2] < pc[3], pc) # attraction increases with decreasing pH + self.assertLess(max(abs(x['residual_ru']) for x in r.h.operations[op]['result']['results']['ph_scouting']), 50.0) # dissociates completely + CHECKS.append(dict(check='ph_trend', status='passed', finals=finals, preconc=pc)) + + def test_aim_for_level(self): + r = Rig(seed=24) + r.ready() + r.gs_kit() + r.call(r.A, 'solution.prepare', solution_id='lig10', volume_m3=400 * UL, base='acetate_5_0', sources=[dict(source_id='gs_ligand_anti_b2m', volume_m3=4 * UL)]) + r.call(r.A, 'solution.prepare', solution_id='naoh', volume_m3=1e-6, base='naoh_50mm') + res = r.amine(4, 'lig10', mode='aim', target=1200.0, wash='naoh') + im = res['results']['immobilization'][0] + self.assertTrue(im['target_reached'], im) + self.assertAlmostEqual(im['response_bound_ru'] / 1200.0, 1.0, delta=0.25) + lvl = r.call(r.E, 'surface.inspect')['flow_cells'][3]['ligands'][0]['level_ru'] + self.assertAlmostEqual(im['response_final_ru'] / lvl, 1.0, delta=0.06) # the reported final level is the immobilized ligand (no large docking drift) + CHECKS.append(dict(check='aim_level', status='passed', bound=im['response_bound_ru'], final=im['response_final_ru'], ligand=lvl)) + + +class Kinetics(unittest.TestCase): + @classmethod + def setUpClass(cls): + r = Rig(seed=31) + r.ready() + r.gs_kit() + r.call(r.A, 'solution.prepare', solution_id='lig10', volume_m3=400 * UL, base='acetate_5_0', sources=[dict(source_id='gs_ligand_anti_b2m', volume_m3=4 * UL)]) + r.call(r.A, 'solution.prepare', solution_id='naoh', volume_m3=1e-6, base='naoh_50mm') + r.amine(4, 'lig10', mode='aim', target=1200.0, wash='naoh') + r.kinetics_method('kin', [0, 2, 4, 8, 16, 32, 8, 0], path='3-4', ref='4-3') + cls.r = r + + def test_kinetics_recovered(self): + r = self.r + res = r.call(r.A, 'eval.kinetics', run_id='kin', cycles=[3, 4, 5, 6, 7, 8], subtraction='4-3', blank_cycles=[2, 9]) + p = r.h.pairs['gs_kit_anti_b2m'] + self.assertAlmostEqual(res['ka_m3_mol_s'] / p['ka'], 1.0, delta=0.15) + self.assertAlmostEqual(res['kd_s'] / p['kd'], 1.0, delta=0.15) + self.assertLess(res['chi2_ru2'], 2.0) + self.assertLess(res['u_value'], 15.0) + st = {q['item']: q['status'] for q in res['quality']} + self.assertEqual(st['kinetic_constants_range'], 'pass') + ins = r.call(r.E, 'surface.inspect') + lig = ins['flow_cells'][3]['ligands'][0] + rmax_true = lig['level_ru'] * rt.SHELF_MW(GS_A) / rt.SHELF_MW(GS_L) * 2 * lig['activity'] + self.assertAlmostEqual(res['rmax_ru'] / rmax_true, 1.0, delta=0.15) + self.assertTrue(10.0 < rmax_true < 80.0, rmax_true) # Getting Started: 1200 RU -> Rmax ~30 RU + CHECKS.append(dict(check='kinetics_recovered', status='passed', ka=res['ka_m3_mol_s'], kd=res['kd_s'], rmax=res['rmax_ru'], rmax_true=rmax_true)) + + def test_affinity_and_sensorgram(self): + r = self.r + aff = r.call(r.A, 'eval.affinity', run_id='kin', cycles=[3, 4, 5, 6, 7, 8], subtraction='4-3', blank_cycles=[2, 9]) + self.assertTrue(aff['points']) + sg = r.call(r.A, 'data.sensorgram', run_id='kin', cycle=7, curves=['4-3', '3', '4'], max_points=500) + self.assertEqual(sg['keywords']['concentration_mol_m3'], 32e-6) + self.assertGreater(max(sg['curves']['4-3']), 10.0) + runs = r.call(r.A, 'runs.list')['runs'] + self.assertTrue(any(x['run_id'] == 'kin' and x['state'] == 'completed' for x in runs)) + CHECKS.append(dict(check='affinity_sensorgram', status='passed', KD=aff['KD_mol_m3'])) + + +class MorePhysics(unittest.TestCase): + def test_cfca_concentration(self): + r = Rig(seed=41) + r.ready() + r.gs_kit() + r.call(r.A, 'solution.prepare', solution_id='lig50', volume_m3=400 * UL, base='acetate_5_0', sources=[dict(source_id='gs_ligand_anti_b2m', volume_m3=12 * UL)]) + r.amine(2, 'lig50') + stock_c = r.h.solutions['gs_analyte_b2m']['label'][0]['concentration_mol_m3'] + r.call(r.A, 'solution.prepare', solution_id='unk', volume_m3=1.5e-6, base='hbs_ep_plus', sources=[dict(source_id='gs_analyte_b2m', volume_m3=1.5e-6 * 5e-6 / stock_c)]) + true_c = r.h.solutions['unk']['comp']['species'][GS_A] + r.call(r.A, 'solution.prepare', solution_id='gly', volume_m3=2e-6, base='glycine_2_5') + r.rack(items=[('R1B1', 'unk', 1.4e-6), ('R1A9', 'gly', 2e-6)]) + cyc = [] + for f in (5 * ULM, 100 * ULM): + cyc.append(dict(purpose='sample', commands=[dict(type='sample', position='R1B1', contact_s=36.0, dissociation_s=30.0, flow_rate_m3_s=f), + dict(type='regeneration', position='R1A9', contact_s=30.0, flow_rate_m3_s=30 * ULM, stabilization_s=30.0)])) + op = r.call(r.A, 'method.run', run_id='cfca', data_rate_hz=10, detection='dual', flow_path='1-2', reference_subtraction='2-1', cycles=cyc)['operation_id'] + r.until(lambda: r.h.operations[op]['phase'] != 'running', 7200, 30) + res = r.call(r.A, 'eval.concentration', run_id='cfca', mode='cfca', subtraction='2-1', sample_cycles=[1, 2], mw_da=11800.0) + c = res['samples'][0]['concentration_mol_m3'] + self.assertIsNotNone(c, res) + self.assertAlmostEqual(c / true_c, 1.0, delta=0.25) + CHECKS.append(dict(check='cfca', status='passed', measured=c, true=true_c)) + + def test_regeneration_and_damage(self): + r = Rig(seed=42) + r.ready() + r.gs_kit() + r.call(r.A, 'solution.prepare', solution_id='lig50', volume_m3=400 * UL, base='acetate_5_0', sources=[dict(source_id='gs_ligand_anti_b2m', volume_m3=12 * UL)]) + r.amine(2, 'lig50') + stock_c = r.h.solutions['gs_analyte_b2m']['label'][0]['concentration_mol_m3'] + r.call(r.A, 'solution.prepare', solution_id='an', volume_m3=1.5e-6, base='hbs_ep_plus', sources=[dict(source_id='gs_analyte_b2m', volume_m3=1.5e-6 * 50e-6 / stock_c)]) + for sid, base in (('g30', 'glycine_3_0'), ('g25', 'glycine_2_5'), ('sds', 'sds_0_5')): + r.call(r.A, 'solution.prepare', solution_id=sid, volume_m3=1e-6, base=base) + r.rack(items=[('R1B1', 'an', 1.4e-6), ('R1A7', 'g30', 0.9e-6), ('R1A8', 'g25', 0.9e-6), ('R1A9', 'sds', 0.9e-6)]) + r.call(r.A, 'run.manual_start', run_id='reg', flow_rate_m3_s=30 * ULM, flow_path='1-2', reference_subtraction='2-1') + + def bound(): + return sum(v for k, v in r.read('truth.complexes_ru').items() if k.startswith('2:')) + out = {} + for pos in ('R1A7', 'R1A8'): + r.call(r.A, 'run.command', command=dict(command='sample_injection', position='R1B1', contact_s=60.0)) + r.call(r.A, 'run.command', command=dict(command='wait', wait_s=60.0)) + r.step(150) + b0 = bound() + r.call(r.A, 'run.command', command=dict(command='regeneration_injection', position=pos, contact_s=30.0)) + r.step(70) + out[pos] = bound() / b0 + self.assertGreater(out['R1A7'], 0.2) # glycine pH 3.0: too mild for the kit antibody (residual) + self.assertGreater(out['R1A7'], 5 * out['R1A8']) + self.assertLess(out['R1A8'], 0.05) # glycine pH 2.5 (Getting Started regeneration): complete + act0 = list(r.read('truth.ligand_activity').values())[0] + r.call(r.A, 'run.command', command=dict(command='regeneration_injection', position='R1A9', contact_s=30.0)) + r.step(70) + act1 = list(r.read('truth.ligand_activity').values())[0] + self.assertLess(act1, act0 * 0.999) # harsh SDS damages the ligand + r.call(r.A, 'run.stop') + CHECKS.append(dict(check='regeneration', status='passed', remaining=out, activity=[act0, act1])) + + def test_solvent_correction(self): + r = Rig(seed=43) + r.ready() + r.gs_kit() + r.call(r.A, 'solution.prepare', solution_id='lig50', volume_m3=400 * UL, base='acetate_5_0', sources=[dict(source_id='gs_ligand_anti_b2m', volume_m3=12 * UL)]) + r.amine(2, 'lig50', contact=600.0) + items = [] + for i, pct in enumerate((4.5, 4.8, 5.1, 5.4, 5.8, 5.2, 4.7)): + r.call(r.A, 'solution.prepare', solution_id=f'sc{i}', volume_m3=600 * UL, base='hbs_ep_plus', dmso_volume_fraction=pct / 100.0) + items.append((f'R1B{i + 1}', f'sc{i}', 400 * UL)) + r.call(r.A, 'solution.prepare', solution_id='rb5', volume_m3=1.0e-3, base='hbs_ep_plus_dmso_5') + r.call(r.A, 'bottle.place', slot='buffer_a', solution_id='rb5', volume_m3=0.95e-3) + r.call(r.A, 'flow.prime') + r.step(400) + r.rack(items=items) + cyc = [dict(purpose='solvent_correction' if i < 5 else 'sample', commands=[dict(type='sample', position=f'R1B{i + 1}', contact_s=30.0, dissociation_s=30.0, + flow_rate_m3_s=30 * ULM)]) for i in range(7)] + op = r.call(r.A, 'method.run', run_id='sc', data_rate_hz=1, detection='dual', flow_path='1-2', reference_subtraction='2-1', cycles=cyc)['operation_id'] + r.until(lambda: r.h.operations[op]['phase'] != 'running', 7200, 30) + res = r.call(r.A, 'eval.solvent_correction', run_id='sc', correction_cycles=[1, 2, 3, 4, 5], sample_cycles=[6, 7], active_fc=2, reference_fc=1) + self.assertLess(res['chi2_ru2'], 2.0) + for row in res['corrected']: + self.assertGreater(abs(row['uncorrected_ru']), 2.0 * abs(row['corrected_ru']), row) + CHECKS.append(dict(check='solvent_correction', status='passed', rows=res['corrected'])) + + def test_thermodynamics(self): + ent = [] + p = rt.LIB_PAIRS['gs_kit_anti_b2m'] + for T in (288.15, 298.15, 308.15): + ka, kd = rt.eyring(p['ka'], p['dHa'], p['T0'], T), rt.eyring(p['kd'], p['dHd'], p['T0'], T) + ent.append(dict(temperature_k=T, KD_mol_m3=kd / ka, ka_m3_mol_s=ka, kd_s=kd)) + r = Rig() + res = r.call(r.A, 'eval.thermodynamics', entries=ent) + self.assertAlmostEqual(res['dH_j_mol'], p['dHa'] - p['dHd'], delta=2000.0) + self.assertAlmostEqual(res['association']['dH_j_mol'], p['dHa'], delta=500.0) + self.assertAlmostEqual(res['dissociation']['dH_j_mol'], p['dHd'], delta=500.0) + CHECKS.append(dict(check='thermodynamics', status='passed', dH=res['dH_j_mol'])) + + def test_capture_nta_and_sa(self): + r = Rig(seed=44) + r.ready(chip='NTA', chip_id='nta1', buffer='hbs_n') # EDTA-free running buffer (EDTA strips the nickel) + r.call(r.E, 'species.define', species_id='his_ligand', name='His10-tagged receptor', mw_da=45000.0, isoelectric_point=6.0, tags=['his10']) + r.call(r.E, 'species.define', species_id='small_an', name='analyte', mw_da=20000.0, isoelectric_point=5.0) + r.call(r.E, 'interaction.define', interaction_id='hl', ligand='his_ligand', analyte='small_an', ka_m3_mol_s=500.0, kd_s=1e-3) + r.call(r.E, 'stock.provide', stock_id='hl_stock', volume_m3=1e-6, base='hbs_n', species=[dict(species_id='his_ligand', concentration_mol_m3=1e-3)]) + r.call(r.E, 'kit.provide', kit='his_capture') + r.call(r.A, 'solution.prepare', solution_id='hl', volume_m3=500 * UL, base='hbs_n', sources=[dict(source_id='hl_stock', volume_m3=10 * UL)]) + r.rack(items=[('R1B1', 'hl', 400 * UL), ('R1A1', 'nickel_0_5mm', 400 * UL), ('R1A2', 'edta_350mm', 600 * UL)]) + op = r.call(r.A, 'wizard.immobilization', run_id='cap', flow_cells=[dict(fc=2, chemistry='his_capture', mode='contact', ligand_position='R1B1', contact_s=120.0, + nickel_position='R1A1')])['operation_id'] + r.until(lambda: r.h.operations[op]['phase'] != 'running', 7200, 30) + lvl = r.call(r.E, 'surface.inspect')['flow_cells'][1]['ligands'][0]['level_ru'] + self.assertGreater(lvl, 100.0) + self.assertGreater(r.h.operations[op]['result']['results']['immobilization'][0]['response_final_ru'], 100.0) + r.step(1800) + lvl2 = r.call(r.E, 'surface.inspect')['flow_cells'][1]['ligands'][0]['level_ru'] + self.assertTrue(0.5 * lvl < lvl2 < lvl, (lvl, lvl2)) # His10 capture decays slowly + r.call(r.A, 'run.manual_start', run_id='strip', flow_rate_m3_s=10 * ULM, flow_path='2') + r.call(r.A, 'run.command', command=dict(command='regeneration_injection', position='R1A2', contact_s=60.0)) + r.step(120) + ligs = r.call(r.E, 'surface.inspect')['flow_cells'][1]['ligands'] + self.assertTrue(not ligs or ligs[0]['level_ru'] < 0.05 * lvl2) # EDTA strips nickel and the captured ligand + r.call(r.A, 'run.stop') + r.call(r.A, 'wizard.immobilization', 'CHEMISTRY_NOT_SUPPORTED', run_id='bad', flow_cells=[dict(fc=1, chemistry='amine', mode='blank', edc_position='R1A1', + nhs_position='R1A1', mix_position='R1C1', ethanolamine_position='R1A1')]) + CHECKS.append(dict(check='capture_nta', status='passed', levels=[lvl, lvl2])) + + +class Maintenance(unittest.TestCase): + def test_normalize_system_check_maintenance_shutdown(self): + r = Rig(seed=51) + r.ready() + c = r.h._chip_obj() + g0 = np.std(c['gains']) + r.call(r.E, 'kit.provide', kit='maintenance') + r.call(r.A, 'detector.normalize', 'POSITION_EMPTY', position='R2A1') + r.call(r.A, 'solution.prepare', solution_id='hbsn', volume_m3=1e-5, base='hbs_n') + r.rack(items=[('R1A1', 'bianormalizing', 1.0e-6), ('R1A2', 'biatest', 1.0e-6), ('R1A3', 'biadesorb_1', 1.0e-6), ('R1A4', 'biadesorb_2', 1.0e-6)]) + op = r.call(r.A, 'detector.normalize', position='R1A1')['operation_id'] + r.step(500) + self.assertEqual(r.h.operations[op]['phase'], 'succeeded') + self.assertTrue(r.read('chip.normalized')) + self.assertLess(np.std(r.h._chip_obj()['gains']), 0.2 * g0) + r.call(r.A, 'door.set', door='right_pump', open=True) + r.step(2) + r.call(r.A, 'clamp.set', closed=False) + op = r.call(r.A, 'system.check', position='R1A2')['operation_id'] + r.step(6100) # System Check about 100 min (Operating Instructions App. A) + res = r.read('system_check.last') + self.assertFalse(res['passed']) + self.assertIn('reagent_pump', res['failed_tests']) + self.assertIn('buffer_selector_b', res['failed_tests']) + r.call(r.A, 'clamp.set', closed=True) + r.call(r.A, 'temperature.set', analysis_k=291.15) + r.call(r.A, 'maintenance.run', 'DESORB_BELOW_20C', procedure='desorb', positions=dict(biadesorb_1='R1A3', biadesorb_2='R1A4')) + r.call(r.A, 'temperature.set', analysis_k=298.15) + r.h.contamination = 0.5 + op = r.call(r.A, 'maintenance.run', procedure='desorb', positions=dict(biadesorb_1='R1A3', biadesorb_2='R1A4'))['operation_id'] + r.step(1600) + self.assertEqual(r.h.operations[op]['phase'], 'succeeded') + self.assertLess(r.read('truth.contamination'), 0.2) + r.call(r.A, 'system.shutdown', 'RACK_NOT_REMOVED') + r.call(r.A, 'rack.eject') + r.step(8) + for pos in list(r.h.rack['positions']): + r.call(r.A, 'rack.remove', position=pos) + r.call(r.A, 'rack.configure', config='empty', plate='none') # take the racks off the tray + self.assertIsNone(r.read('rack.config')) + r.call(r.A, 'solution.prepare', solution_id='w2', volume_m3=0.6e-3, base='water') + r.call(r.A, 'solution.prepare', solution_id='et', volume_m3=0.25e-3, base='ethanol_70') + r.call(r.A, 'bottle.place', slot='buffer_a', solution_id='w2', volume_m3=0.5e-3) + r.call(r.A, 'bottle.place', slot='buffer_b', solution_id='et', volume_m3=0.2e-3) + op = r.call(r.A, 'system.shutdown')['operation_id'] + r.step(1300) + self.assertEqual(r.read('flow.state'), 'dry') + self.assertIn('CLAMP_RELEASE_REQUIRED', r.read('warnings.active')) + r.call(r.A, 'clamp.set', closed=False) + r.step(5) + self.assertNotIn('CLAMP_RELEASE_REQUIRED', r.read('warnings.active')) + CHECKS.append(dict(check='maintenance', status='passed')) + + +class ManualRun(unittest.TestCase): + def test_queue_commands(self): + r = Rig(seed=61) + r.ready() + r.call(r.A, 'solution.prepare', solution_id='b', volume_m3=1e-6, base='hbs_ep_plus') + r.rack(items=[('R1B1', 'b', 600 * UL)]) + r.call(r.A, 'run.command', 'NO_MANUAL_RUN', command=dict(command='wait', wait_s=10.0)) + r.call(r.A, 'run.manual_start', run_id='q', flow_rate_m3_s=10 * ULM, flow_path='1-2', reference_subtraction='2-1') + r.call(r.A, 'run.command', 'INJECTION_VOLUME_OUT_OF_RANGE', command=dict(command='sample_injection', position='R1B1', contact_s=6000.0)) + r.call(r.A, 'run.command', 'FLOW_PATH_NOT_ALLOWED', command=dict(command='flow_path', flow_path='1-2-3-4')) + r.call(r.A, 'run.command', command=dict(command='wait', wait_s=100.0)) + r.call(r.A, 'run.command', command=dict(command='sample_injection', position='R1B1', contact_s=60.0)) + r.call(r.A, 'run.command', command=dict(command='report_point', label='after')) + r.call(r.A, 'run.command', command=dict(command='new_cycle', flow_path='3-4', reference_subtraction='4-3')) + r.step(1) + self.assertEqual(r.read('run.queue_length'), 3) + r.call(r.A, 'run.queue_delete', index=3) + r.call(r.A, 'run.stop_command') + r.step(1) + self.assertEqual(r.read('run.current_command'), 'inject:sample') + r.call(r.A, 'run.pause') + r.step(200) + self.assertEqual(r.read('run.state'), 'paused') + r.call(r.A, 'run.resume') + r.step(100) + cyc = r.h.runs['q']['cycles'] + self.assertEqual(len(cyc), 1) + self.assertEqual(len(cyc[0]['injections']), 1) + self.assertEqual(cyc[0]['report_points'][0]['label'], 'after') + r.call(r.A, 'run.stop') + self.assertEqual(r.h.runs['q']['state'], 'completed') + self.assertEqual(r.read('flow.state'), 'standby') + CHECKS.append(dict(check='manual_queue', status='passed')) + + def test_cancel_and_power_loss(self): + r = Rig(seed=62) + r.ready() + r.call(r.A, 'solution.prepare', solution_id='pbs2', volume_m3=1e-3, base='pbs') + r.call(r.A, 'bottle.place', slot='buffer_a', solution_id='pbs2', volume_m3=0.9e-3) + op = r.call(r.A, 'flow.prime')['operation_id'] + r.step(60) + r.A.cancel(op, 'c1') + self.assertEqual(r.h.operations[op]['phase'], 'cancelled') + self.assertEqual(r.read('flow.state'), 'standby') + r.call(r.A, 'solution.prepare', solution_id='b', volume_m3=1e-6, base='hbs_ep_plus') + r.rack(items=[('R1B1', 'b', 600 * UL)]) + cyc = [dict(purpose='sample', commands=[dict(type='sample', position='R1B1', contact_s=60.0, dissociation_s=300.0, flow_rate_m3_s=10 * ULM)])] * 3 + op = r.call(r.A, 'method.run', run_id='mm', data_rate_hz=1, detection='single', flow_path='1', cycles=cyc, ignore_temperature=True)['operation_id'] + r.step(200) + r.call(r.E, 'fault.inject', fault='power_loss', active=True) + self.assertEqual(r.h.runs['mm']['state'], 'failed') + self.assertEqual(r.h.operations[op]['error'], 'POWER_OFF_INTERRUPT') + self.assertTrue(r.h.runs['mm']['cycles'][0]['t']) + CHECKS.append(dict(check='cancel_power_loss', status='passed')) + + +class Misc(unittest.TestCase): + def test_queries_light_buffer_select_standby_bottles(self): + r = Rig(seed=63) + r.ready() + r.call(r.A, 'sample_compartment.set_light', on=True) + self.assertTrue(r.read('sample_compartment.light')) + r.call(r.A, 'solution.prepare', solution_id='b2', volume_m3=0.3e-3, base='pbs') + r.call(r.A, 'bottle.place', slot='buffer_b', solution_id='b2', volume_m3=0.2e-3) + r.call(r.A, 'flow.select_buffer', tube='buffer_b') + self.assertEqual(r.read('flow.selected_tube'), 'buffer_b') + r.call(r.A, 'flow.stop_standby') + r.call(r.A, 'flow.standby') + self.assertEqual(r.read('flow.state'), 'standby') + r.call(r.A, 'bottle.remove', slot='buffer_b') + ev = r.call(r.A, 'events.read', since_s=0.0)['events'] + self.assertTrue(any(e['code'] == 'CHIP_DOCKED' for e in ev)) + pv = r.call(r.A, 'provenance.read') + self.assertGreaterEqual(len(pv['species']), 100) + self.assertNotIn('ka', json.dumps(pv['species'])) + CHECKS.append(dict(check='misc_queries', status='passed')) + + def test_calibrated_concentration(self): + r = Rig(seed=64) + r.ready() + r.gs_kit() + r.call(r.A, 'solution.prepare', solution_id='lig50', volume_m3=400 * UL, base='acetate_5_0', sources=[dict(source_id='gs_ligand_anti_b2m', volume_m3=12 * UL)]) + r.amine(2, 'lig50') + stock_c = r.h.solutions['gs_analyte_b2m']['label'][0]['concentration_mol_m3'] + items, std = [], [5, 10, 20, 40, 80] + for i, c in enumerate(std + [25]): + r.call(r.A, 'solution.prepare', solution_id=f'c{i}', volume_m3=600 * UL, base='hbs_ep_plus', + sources=[dict(source_id='gs_analyte_b2m', volume_m3=c * 1e-6 * 600 * UL / stock_c)]) + items.append((f'R1B{i + 1}', f'c{i}', 400 * UL)) + r.call(r.A, 'solution.prepare', solution_id='gly', volume_m3=3e-6, base='glycine_2_5') + items.append(('R1A9', 'gly', 3e-6)) + r.rack(items=items) + cyc = [dict(purpose='sample', commands=[dict(type='sample', position=f'R1B{i + 1}', contact_s=120.0, dissociation_s=30.0, flow_rate_m3_s=10 * ULM), + dict(type='regeneration', position='R1A9', contact_s=30.0, flow_rate_m3_s=30 * ULM, stabilization_s=30.0)]) for i in range(6)] + op = r.call(r.A, 'method.run', run_id='conc', data_rate_hz=1, detection='dual', flow_path='1-2', reference_subtraction='2-1', cycles=cyc)['operation_id'] + r.until(lambda: r.h.operations[op]['phase'] != 'running', 14400, 30) + res = r.call(r.A, 'eval.concentration', run_id='conc', mode='calibration', subtraction='2-1', standard_cycles=[1, 2, 3, 4, 5], + standard_concentrations_mol_m3=[c * 1e-6 for c in std], sample_cycles=[6]) + self.assertAlmostEqual(res['samples'][0]['concentration_mol_m3'] / 25e-6, 1.0, delta=0.12) + CHECKS.append(dict(check='calibrated_concentration', status='passed', measured=res['samples'][0]['concentration_mol_m3'])) + + +class ReviewRound1(unittest.TestCase): + """Regressions for the independent review round 1 (runtime F-01..F-12, contract C-01, C-02, C-05, C-06).""" + + def test_species_mw_isolated_between_instances(self): # F-01 + a, b = Rig(seed=71, instance='t200_a'), Rig(seed=71, instance='t200_b') + a.call(a.E, 'species.define', species_id='cmpd_q', name='compound Q', mw_da=300.0, kind='small_molecule') + a.call(a.E, 'stock.provide', stock_id='q_stock', volume_m3=1e-6, base='hbs_ep_plus', species=[dict(species_id='cmpd_q', concentration_mol_m3=1.0)]) + comp = a.h.solutions['q_stock']['comp'] + dn0 = rt.liquid_props(comp, a.h._mw)['dn'] + b.call(b.E, 'species.define', species_id='cmpd_q', name='compound Q', mw_da=30000.0) + self.assertEqual(rt.liquid_props(comp, a.h._mw)['dn'], dn0) # the other instance's definition does not leak + self.assertEqual((a.h._mw('cmpd_q'), b.h._mw('cmpd_q')), (300.0, 30000.0)) + self.assertEqual(rt.SHELF_MW('cmpd_q'), 50000.0) # module table holds library species only + CHECKS.append(dict(check='mw_isolation', status='passed')) + + def test_blank_immobilization_small_after_docking(self): # F-02 + r = Rig(seed=72) + r.ready() + r.gs_kit() + r.rack(items=[('R1A1', 'edc_0_4m', 150 * UL), ('R1A2', 'nhs_0_1m', 150 * UL), ('R1A4', 'ethanolamine_1m', 150 * UL)]) + op = r.call(r.A, 'wizard.immobilization', run_id='blank', flow_cells=[dict(fc=1, chemistry='amine', mode='blank', edc_position='R1A1', nhs_position='R1A2', + mix_position='R1A3', ethanolamine_position='R1A4')])['operation_id'] + r.until(lambda: r.h.operations[op]['phase'] != 'running', 14400, 30.0) + im = r.h.operations[op]['result']['results']['immobilization'][0] + self.assertLess(abs(im['response_final_ru']), 80.0, im) # activated + deactivated surface without ligand + CHECKS.append(dict(check='blank_immobilization', status='passed', final=im['response_final_ru'])) + + def test_sample_reaches_waste_and_ledger_closes(self): # F-03 + r = Rig(seed=73) + r.ready() + r.call(r.A, 'solution.prepare', solution_id='b', volume_m3=1e-6, base='hbs_ep_plus') + r.rack(items=[('R1B1', 'b', 600 * UL)]) + r.call(r.A, 'run.manual_start', run_id='w', flow_rate_m3_s=30 * ULM, flow_path='1-2') + r.call(r.A, 'run.command', command=dict(command='sample_injection', position='R1B1', contact_s=120.0)) + r.step(300) + r.call(r.A, 'run.stop') + led = r.call(r.E, 'ledger.read')['ledger'] + self.assertGreater(led['sample_aspirated_m3'], 50 * UL) + self.assertAlmostEqual(led['buffer_used_m3'] + led['water_used_m3'] + led['sample_aspirated_m3'], led['waste_added_m3'] + led['waste_spilled_m3'], delta=1e-12) + CHECKS.append(dict(check='sample_to_waste', status='passed')) + + def test_buffer_empty_cleared_by_refill(self): # F-04 + r = Rig(seed=74) + r.ready() + r.call(r.A, 'solution.prepare', solution_id='rb2', volume_m3=1e-3, base='hbs_ep_plus') + r.call(r.A, 'bottle.place', slot='buffer_a', solution_id='rb2', volume_m3=1e-5) + r.call(r.A, 'run.manual_start', run_id='e', flow_rate_m3_s=100 * ULM, flow_path='1') + r.step(7200) + self.assertIn('BUFFER_EMPTY', r.read('errors.active')) + r.call(r.A, 'bottle.place', slot='buffer_a', solution_id='rb2', volume_m3=0.9e-3) + self.assertNotIn('BUFFER_EMPTY', r.read('errors.active')) + r.call(r.A, 'flow.prime') + r.step(400) + self.assertEqual(r.read('flow.state'), 'standby') + CHECKS.append(dict(check='buffer_empty_cleared', status='passed')) + + def test_sensorgram_out_of_range_is_null(self): # F-05 + r = Rig(seed=75) + r.ready() + r.call(r.E, 'kit.provide', kit='maintenance') + r.rack(items=[('R1A1', 'bianormalizing', 1.0e-6)]) + r.call(r.A, 'run.manual_start', run_id='g', flow_rate_m3_s=10 * ULM, flow_path='1', data_rate_hz=1) + r.step(20) + r.call(r.A, 'run.command', command=dict(command='sample_injection', position='R1A1', contact_s=60.0)) + r.step(150) + r.call(r.A, 'run.stop') + ys = r.call(r.A, 'data.sensorgram', run_id='g', cycle=1, curves=['1'])['curves']['1'] + self.assertTrue(any(v is None for v in ys)) # 70 % glycerol: out of range + self.assertFalse(any(v == 0.0 for v in ys)) + CHECKS.append(dict(check='sensorgram_null', status='passed')) + + def test_tool_durations_from_the_manual(self): # F-06 + self.assertEqual((rt.MAINT_S['desorb'], rt.MAINT_S['desorb_and_sanitize'], rt.MAINT_S['wash_buffer_tubing'], rt.MAINT_S['flow_system_wash'], + rt.MAINT_S['system_check']), (1200.0, 3600.0, 1800.0, 240.0, 6000.0)) + CHECKS.append(dict(check='tool_durations', status='passed')) + + def test_system_error_blocks_and_aborts_runs(self): # F-07 + r = Rig(seed=76) + r.ready() + r.call(r.A, 'run.manual_start', run_id='m1', flow_rate_m3_s=10 * ULM, flow_path='1') + r.step(5) + r.call(r.E, 'fault.inject', fault='system_error', active=True) + self.assertEqual(r.h.runs['m1']['state'], 'failed') + self.assertIn('SYSTEM_ERROR', r.read('errors.active')) + r.call(r.A, 'run.manual_start', 'SYSTEM_ERROR', run_id='m2', flow_rate_m3_s=10 * ULM, flow_path='1') + r.call(r.A, 'flow.prime', 'SYSTEM_ERROR') + r.call(r.E, 'fault.inject', fault='system_error', active=False) + r.call(r.A, 'run.manual_start', run_id='m2', flow_rate_m3_s=10 * ULM, flow_path='1') + r.call(r.A, 'run.stop') + CHECKS.append(dict(check='system_error', status='passed')) + + def test_chip_lamp_flashes_with_an_ejected_chip_in_the_port(self): # F-08 + r = Rig() + r.ready(prime=False) + r.call(r.A, 'chip.eject') + r.step(35) + seen = set() + for _ in range(4): + r.h.step(0.5) + seen.add(r.read('lamp.sensor_chip')) + self.assertEqual(seen, {True, False}) # Operating Instructions 3.2: flashing when inserted but not docked + r.call(r.A, 'chip.remove') + r.step(1) + self.assertFalse(r.read('lamp.sensor_chip')) + CHECKS.append(dict(check='chip_lamp_ejected', status='passed')) + + def test_water_running_buffer_readable_at_45c(self): # F-09 + r = Rig(seed=77, room=298.15) + r.ready(buffer='water') + r.call(r.A, 'temperature.set', analysis_k=318.15) + r.until(lambda: r.read('temperature.analysis_stable'), 5 * 3600, 60.0) + self.assertIsNotNone(r.read('response.ru')['1']) + CHECKS.append(dict(check='water_45c', status='passed')) + + def test_power_loss_halts_tray_and_cover_and_blanks_response(self): # C-06, F-11, F-12 + r = Rig() + r.ready(prime=False) + r.call(r.A, 'rack.eject') + r.step(2) + self.assertEqual(r.read('rack.state'), 'ejecting') + x = r.read('rack.carriage_position_m') + r.call(r.E, 'fault.inject', fault='power_loss', active=True) + self.assertEqual(r.read('rack.state'), 'stopped') + self.assertTrue(all(v is None for v in r.read('response.ru').values())) + r.step(30) + self.assertEqual(r.read('rack.carriage_position_m'), x) # the tray stops where it is + self.assertTrue(r.h._idle()) # nothing moves without power: 10 s idle blocks + r.call(r.E, 'fault.inject', fault='power_loss', active=False) + r.step(35) + r.call(r.A, 'rack.retract') + r.step(8) + self.assertEqual(r.read('rack.state'), 'inside') + r.call(r.A, 'chip.eject') + r.step(35) + r.call(r.A, 'chip.remove') + r.call(r.A, 'chip.close_cover') + r.step(2) + r.call(r.A, 'chip.open_port') + r.h.step(0.3) + c = r.read('chip.port_cover_angle_rad') + self.assertTrue(0.0 < c < 1.2, c) + r.call(r.E, 'fault.inject', fault='power_loss', active=True) + r.step(5) + self.assertEqual(r.read('chip.port_cover_angle_rad'), c) # the cover motor stops + r.call(r.A, 'chip.close_cover') + r.step(2) + self.assertEqual(r.read('chip.port_cover_angle_rad'), 0.0) # closing by hand works without power + CHECKS.append(dict(check='power_loss_halts', status='passed')) + + def test_bottle_reading_is_a_graduation_reading(self): # C-02 + r = Rig() + r.ready(prime=False) + r.step(3600) + v, t = r.read('bottle.volumes_m3'), r.read('truth.bottle_volumes_m3') + for slot, step in rt.BOTTLE_GRADUATION_M3.items(): + if v[slot] is None: # no bottle in this position + self.assertEqual(t[slot], 0.0) + continue + self.assertAlmostEqual(v[slot] / step, round(v[slot] / step), places=6) + self.assertLessEqual(abs(v[slot] - t[slot]), 0.5 * step + 1e-12) + self.assertNotEqual(v['buffer_a'], t['buffer_a']) + CHECKS.append(dict(check='bottle_reading', status='passed')) + + +class ReviewRound2(unittest.TestCase): + """Regressions for the independent review round 2 (runtime F2-01, contract C2-01 / C2-02).""" + + def test_only_the_emptied_tube_clears_buffer_empty(self): # F2-01 + r = Rig(seed=81) + r.ready() + r.call(r.A, 'solution.prepare', solution_id='rb3', volume_m3=1e-3, base='hbs_ep_plus') + r.call(r.A, 'bottle.place', slot='buffer_a', solution_id='rb3', volume_m3=1e-5) + r.call(r.A, 'run.manual_start', run_id='e', flow_rate_m3_s=100 * ULM, flow_path='1') + r.step(7200) + self.assertIn('BUFFER_EMPTY', r.read('errors.active')) + r.call(r.A, 'bottle.place', slot='buffer_b', solution_id='rb3', volume_m3=2e-4) # another tube: tube A is still empty + self.assertIn('BUFFER_EMPTY', r.read('errors.active')) + r.call(r.A, 'flow.select_buffer', tube='buffer_b') + r.call(r.A, 'flow.prime') + r.step(400) + self.assertNotIn('BUFFER_EMPTY', r.read('errors.active')) # primed from tube B + CHECKS.append(dict(check='buffer_empty_tube', status='passed')) + + def test_power_loss_stops_an_opening_cover_later(self): # C2-01, C2-02 + meta = rt.export_cytiva_biacoret200_contract_metadata()['capabilities'] + for cap in ('power.set', 'power.press_switch', 'fault.inject', 'plant.configure'): + later = {e['state_id'] for e in meta[cap]['state_effects'] if e.get('timing') != 'immediate'} + self.assertIn('chip.port_cover_angle_rad', rt.ON_STEP[cap], cap) + self.assertNotIn('door.left_pump_angle_rad', rt.ON_STEP[cap], cap) + self.assertNotIn('rack.carriage_position_m', rt.EFFECTS['power.set']) + self.assertIn('chip.port_cover_angle_rad', later) + CHECKS.append(dict(check='power_cover_effect', status='passed')) + + +class ZDeclaredEffects(unittest.TestCase): + """Observed changes of the immediate call and of the following steps (compared with the same host without the call) are declared.""" + + def _pair(self, setup, call, steps=300.0): + a, b = Rig(seed=71), Rig(seed=71) + for r in (a, b): + setup(r) + before = a.read() + call(a) + after = a.read() + imm = {k for k in after if after[k] != before[k]} - {'clock.time_s'} + for r in (a, b): + r.h.step(steps) + ra, rb = a.read(), b.read() + + def differ(x, y): + if isinstance(x, float) and isinstance(y, float): + return abs(x - y) > 1e-9 * max(1.0, abs(x), abs(y)) + if isinstance(x, dict) and isinstance(y, dict): + return set(x) != set(y) or any(differ(x[k], y[k]) for k in x) + return x != y + later = {k for k in ra if differ(ra[k], rb[k])} - {'clock.time_s'} + return imm, later + + def test_declared_effects(self): + def ready(r): + r.ready() + cases = { + 'temperature.set': (ready, lambda r: r.call(r.A, 'temperature.set', analysis_k=300.15)), + 'flow.stop_standby': (ready, lambda r: r.call(r.A, 'flow.stop_standby')), + 'door.set': (ready, lambda r: r.call(r.A, 'door.set', door='left_pump', open=True)), + 'rack.eject': (ready, lambda r: r.call(r.A, 'rack.eject')), + 'chip.eject': (ready, lambda r: r.call(r.A, 'chip.eject')), + 'run.manual_start': (ready, lambda r: r.call(r.A, 'run.manual_start', run_id='x', flow_rate_m3_s=20 * ULM, flow_path='1-2')), + } + bad = {} + for cap, (setup, call) in cases.items(): + imm, later = self._pair(setup, call) + declared = set(rt.EFFECTS.get(cap, [])) | {'warnings.active', 'operations.running', 'errors.active'} + on = set(rt.ON_STEP.get(cap, [])) | declared + if imm - declared or later - on: + bad[cap] = dict(immediate=sorted(imm - declared), later=sorted(later - on)) + self.assertEqual(bad, {}) + CHECKS.append(dict(check='declared_effects', status='passed', cases=sorted(cases))) + + +class ZZOutputs(unittest.TestCase): + def test_every_capability_exercised_or_listed(self): + missing = sorted(k for k in rt.CAPS if k not in rt.UNSUPPORTED and k not in SEEN_CAPS) + allowed = {'eval.concentration', 'power.press_switch', 'chip.remove', 'bottle.empty_waste', 'run.queue_delete'} + self.assertTrue(set(missing) <= allowed | set(), missing) + CHECKS.append(dict(check='capabilities_exercised', status='passed', exercised=len(SEEN_CAPS), missing=missing)) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_asset_eppendorf_cellxpertc170i.py b/tests/test_asset_eppendorf_cellxpertc170i.py new file mode 100644 index 0000000000000000000000000000000000000000..eb62caa2af9f539c36c97fe57fbd89c474d4dd56 --- /dev/null +++ b/tests/test_asset_eppendorf_cellxpertc170i.py @@ -0,0 +1,1185 @@ +"""tests for CHEM-166 eppendorf_cellxpertc170i: python3 -m unittest tests/test_asset_eppendorf_cellxpertc170i.py + +Topics (pipeline.md): set points only write targets, read/describe are pure, rejected preconditions leave the state unchanged, two instances are +isolated, agent/evaluator truth isolation and vessel ownership, conservation (energy, CO2, water, glucose/lactate ledgers), real return values +validated against the declared schemas (asset_tool validate_value), asynchronous HTD with cancellation, host-step independence (fixed 1 s grid), +declared immediate and on_step effects over scenario states; plus the incubator physics against the manufacturer data: warm-up and 37 C stability, +CO2 sensor initialisation (30 min) and the 5 % set point within +-0.3 %, recovery after a 30 s door opening in < 5 min (brochure), humidity 92.5 % +with the water tray, the 14 h / 180 C high-temperature disinfection with its checks and aborts, gas-pressure warnings / alarms / valve closing, +O2 control with N2 and its physical upper limit, the CO2 wait after a power interruption, the temperature limiter, condensation behind an +unlatched inner door, altitude (partial-pressure sensors), alarms and BMS relays, recurring tasks and the performance check; the cultures: medium pH +from the HiMedia formulations at 5 / 10 % CO2, growth with the Cellosaurus doubling time, glucose / lactate, bench exposure, contamination. +""" +import copy +import json +import math +import sys +import unittest +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / 'scripts')) +sys.path.insert(0, str(ROOT / 'skills/chemistry-lab-assets/scripts')) +from asset_runtime import eppendorf_cellxpertc170i as rt # noqa: E402 +import asset_tool # noqa: E402 + +CHECKS, PROCESS_EVIDENCE, REJECTIONS = [], {}, {} +_META = {} +INST = 'incubator_01' + + +def _meta(): + if not _META: + _META.update(rt.export_eppendorf_cellxpertc170i_contract_metadata()) + return _META + + +def _changed(a, b): + return json.dumps(a, sort_keys=True, default=str) != json.dumps(b, sort_keys=True, default=str) + + +_orig_invoke = rt.EppendorfCellxpertC170iRuntime.invoke + + +def _instrumented_invoke(self, capability_id, **a): + """Every successful call is checked against its declared output schema and immediate state effects (a call does not advance time); every + rejection code is recorded for the declaration check.""" + before = self.read('evaluator') if capability_id != 'sim.step' else None + t0 = self.t + try: + out = _orig_invoke(self, capability_id, **a) + except rt.ActionRejected as exc: + REJECTIONS.setdefault(capability_id, set()).add(str(exc)) + raise + meta = _meta()['capabilities'][capability_id] + errs = asset_tool.validate_value(out, meta['output_schema']) + if errs: + raise AssertionError(f'{capability_id} output violates its schema: {errs[:3]}') + if before is not None: + assert self.t == t0, capability_id + after = self.read('evaluator') + undeclared = {k for k in after if _changed(before[k], after[k])} - set(rt.EFFECTS.get(capability_id, [])) + if undeclared: + raise AssertionError(f'{capability_id} changed undeclared state immediately: {sorted(undeclared)}') + PROCESS_EVIDENCE.setdefault(capability_id, []).append(dict(arguments=copy.deepcopy(a), result_keys=sorted(out))) + return out + + +rt.EppendorfCellxpertC170iRuntime.invoke = _instrumented_invoke + + +def check(cid, **detail): + CHECKS.append(dict(check=cid, status='passed', **detail)) + + +def powered(seed=1, **plant): + h = rt.EppendorfCellxpertC170iRuntime() + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, noise_seed=seed, **plant)) + h.invoke('power.set', enabled=True) + return h + + +def open_both(h): + h.invoke('door.outer', open=True) + h.step(2.0) + h.invoke('door.latch', open=True) + h.step(1.0) + h.invoke('door.inner', open=True) + h.step(2.0) + + +def close_both(h): + h.invoke('door.inner', open=False) + h.step(2.0) + h.invoke('door.latch', open=False) + h.step(1.0) + h.invoke('door.outer', open=False) + h.step(2.0) + + +def ready(seed=1, water=2.0e-3, settle=6 * 3600.0, **plant): + """Powered, tray filled with 2 L of 36 C water, doors closed, settled.""" + h = powered(seed, **plant) + if water: + open_both(h) + h.invoke('water_tray.fill', volume_m3=water, temperature_k=309.15) + close_both(h) + h.step(settle) + return h + + +def flask(h, vid='f1', medium='himedia_al028', cell='hela', cells=1.0e6, vtype='flask_t75', vol=1.5e-5, T=310.15, closure=None, gas='air'): + kw = dict(vessel_id=vid, vessel_type=vtype, medium_id=medium, medium_volume_m3=vol, cell_line_id=cell, seeded_cells=cells, temperature_k=T, initial_gas=gas) + if closure: + kw['closure'] = closure + return h.invoke('vessel.provide', **kw) + + +def truth(h, vid): + return h.invoke('vessel.inspect', vessel_id=vid)['truth'] + + +# ---------------------------------------------------------------- contract, libraries +class ContractAndLibraries(unittest.TestCase): + def test_module_identity_and_export(self): + m = _meta() + self.assertEqual(m['asset_type_id'], 'instrument.eppendorf_cellxpertc170i') + self.assertEqual(set(m['capabilities']), set(rt.CAPS)) + self.assertEqual(set(m['state_slots']), set(rt.SLOTS)) + for k, c in m['capabilities'].items(): + self.assertTrue(c['errors'], k) + for e in rt.CAP_ERRORS.get(k, []): + self.assertIn(e, rt.ERROR_ZH, e) + contract = ROOT / 'assets/expansion_batch04/t4_measure/eppendorf_cellxpertc170i/asset.contract.json' + if contract.exists(): + c = json.loads(contract.read_text()) + if c.get('capabilities', {}).get('htd.start'): + self.assertEqual(set(c['capabilities']), set(rt.CAPS)) + check('export') + + def test_template_libraries(self): + md, cl, vs = rt.media(), rt.cell_lines(), rt.vessel_types() + self.assertGreaterEqual(len(md), 50) + self.assertGreaterEqual(len(cl), 50) + self.assertEqual(set(vs), set(rt.VESSEL_TYPES)) + for v in md.values(): + self.assertTrue(v['source'].startswith('HiMedia technical data sheet')) + self.assertIn(v['evidence'], ('documented',)) + self.assertAlmostEqual(md['himedia_al111']['bicarbonate_mol_m3'], 3700 / 84.007, places=3) + self.assertGreater(sum(1 for v in cl.values() if v['doubling_times']), 50) + self.assertEqual(vs['flask_t75']['growth_area_m2'], 0.0075) + e = rt.eqm() + self.assertAlmostEqual(rt.henry_co2(298.15), 3.4e-4 * 0.97, delta=1e-9) + self.assertAlmostEqual(rt.pk1_apparent(310.15), 6.10, delta=1e-9) + self.assertIn('source', e['o2_henry']) + check('libraries', media=len(md), cell_lines=len(cl)) + + def test_ph_chemistry_matches_henderson_hasselbalch(self): + T = 310.15 + for hco3, xc in ((26.2, 0.05), (44.0, 0.10), (44.0, 0.05), (4.17, 0.0004)): + co2 = rt.henry_co2(T) * xc * rt.P_REF + ph = rt.medium_ph(hco3, co2, 0.0, 0.0, T) + hh = 6.10 + math.log10(hco3 / co2) + self.assertAlmostEqual(ph, hh, delta=0.03 if xc > 0.001 else 0.2) + self.assertLess(rt.medium_ph(24.0 + 12.0, 1.24, 25.0, 0.0, T) - rt.medium_ph(24.0 + 12.0, 2.48, 25.0, 0.0, T), + rt.medium_ph(24.0, 1.24, 0.0, 0.0, T) - rt.medium_ph(24.0, 2.48, 0.0, 0.0, T)) # HEPES damps the CO2 dependence + self.assertEqual(rt.phenol_red(6.6, True)[0], 'yellow') + self.assertEqual(rt.phenol_red(7.4, True)[0], 'red') + self.assertEqual(rt.phenol_red(8.5, True)[0], 'purple') + check('ph_chemistry') + + +# ---------------------------------------------------------------- chamber physics +class Chamber(unittest.TestCase): + def test_warm_up_stability_and_power(self): + h = powered() + h.step(7200.0) + T = [h.sens['T']] + for _ in range(120): + h.step(60.0) + T.append(h.sens['T']) + mean = sum(T) / len(T) + self.assertAlmostEqual(mean, 310.15, delta=0.1) # 37 C + self.assertLess(max(T) - min(T), 0.25) # +-0.1 C stability (with sensor noise) + L0 = h.ledger()['heater_energy_j'] + h.step(3600.0) + P = (h.ledger()['heater_energy_j'] - L0) / 3600.0 + ua = rt.MODEL['ua_wall_w_k'] + self.assertAlmostEqual(P, ua * 15.0 + rt.MODEL['g_door_w_k'] * 15.0, delta=12.0) # steady power = losses at 22 C room + check('warm_up', mean_k=mean, steady_w=P) + + def test_co2_initialisation_accuracy_and_stability(self): + h = powered() + h.step(1799.0) + self.assertIsNone(h.read()['sensor.co2_fraction']) + self.assertTrue(h.read()['status.co2_initializing']) + with self.assertRaises(rt.ActionRejected): + h.invoke('co2.set', setpoint_fraction=0.06) # no set point change while initialising + h.step(3 * 3600.0) + xs = [] + for _ in range(60): + h.step(60.0) + xs.append(h.read('evaluator')['truth.co2_fraction']) + self.assertAlmostEqual(sum(xs) / len(xs), 0.05, delta=0.003) # accuracy +-0.3 % + self.assertLess(max(xs) - min(xs), 0.002) # stability +-0.1 % + self.assertAlmostEqual(h.read()['display.co2_percent'], 5.0, delta=0.3) + check('co2_control', mean=sum(xs) / len(xs)) + + def test_recovery_after_a_30_s_door_opening(self): + h = ready() + t0 = h.t + open_both(h) + h.step(25.0) + close_both(h) + Tmin, cmin, t98T, t98C = 1e9, 1e9, None, None + for _ in range(600): + h.step(1.0) + v = h.read('evaluator') + Tmin, cmin = min(Tmin, v['truth.air_temperature_k']), min(cmin, v['truth.co2_fraction']) + if t98T is None and Tmin < 309.0 and v['truth.air_temperature_k'] - 273.15 >= 0.98 * 37.0: + t98T = h.t - t0 + if t98C is None and cmin < 0.04 and v['truth.co2_fraction'] >= 0.98 * 0.05: + t98C = h.t - t0 + self.assertLess(Tmin, 303.15) # the chamber air is exchanged while open + self.assertLess(cmin, 0.01) + self.assertIsNotNone(t98T) + self.assertIsNotNone(t98C) + self.assertLess(t98T, 300.0) # brochure: 98 % in < 5 min + self.assertLess(t98C, 300.0) + self.assertEqual(h.read()['alarms.active'], []) # the alarms are paused after closing + check('door_recovery', t98_T_s=t98T, t98_CO2_s=t98C, Tmin_k=Tmin, co2_min=cmin) + + def test_humidity_water_tray_and_water_alarm(self): + h = ready(settle=24 * 3600.0) + rh = h.read('evaluator')['truth.rh'] + self.assertAlmostEqual(rh, 0.925, delta=0.025) # 92.5 +- 2.5 % at 37 C + self.assertAlmostEqual(h.read()['sensor.rh'], rh, delta=0.02) + dry = powered() + dry.step(3 * 3600.0) + self.assertLess(dry.read('evaluator')['truth.rh'], 0.3) + self.assertIn('WATER_LOW', dry.read()['alarms.active']) # < 0.5 L, armed 1 h after switch-on + self.assertTrue(dry.read()['bms.relays'][3]) + check('humidity', rh=rh) + + def test_condensation_behind_an_unlatched_inner_door(self): + def run(latch): + h = ready(settle=3600.0) + open_both(h) + h.invoke('door.inner', open=False) # manual: the inner door is not correctly closed until the + h.step(2.0) # latch is horizontal - otherwise condensation + if latch: + h.invoke('door.latch', open=False) + h.step(1.0) + h.invoke('door.outer', open=False) + h.step(24 * 3600.0) + return h.read('evaluator')['truth.condensate_kg'] + wet, dry = run(False), run(True) + self.assertGreater(wet, dry) + self.assertGreater(wet, 1e-4) + check('condensation', unlatched_kg=wet, latched_kg=dry) + + def test_setpoint_close_to_the_room_cannot_be_held(self): + h = powered(room_k=308.15) + w = h.invoke('temperature.set', setpoint_k=310.15)['warnings'] + self.assertIn('setpoint_below_ambient_plus_4k', w) + h.invoke('temperature.set', setpoint_k=303.15) + h.step(6 * 3600.0) + self.assertIn('E_6731FW108', h.read()['alarms.active']) + self.assertGreater(h.read('evaluator')['truth.air_temperature_k'], 303.15 + 0.5) + check('ambient_limit') + + def test_gas_pressure_alarms_and_control_timeout(self): + h = ready(settle=3 * 3600.0) + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, co2_supply_pa=0.03e6)) + h.step(2.0) + self.assertIn('CO2_PRESSURE_WARNING', h.read()['alarms.active']) + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, co2_supply_pa=0.01e6)) + h.step(2.0) + self.assertIn('CO2_PRESSURE_LOW', h.read()['alarms.active']) + self.assertEqual(h.u['c'], 0.0) # control stopped + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, co2_supply_pa=0.2e6)) + h.step(2.0) + self.assertIn('CO2_PRESSURE_HIGH', h.read()['alarms.active']) # inlet valve closed + k = ready(settle=3 * 3600.0) + k.invoke('gas.pressure_monitor', enabled=False) + k.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, co2_supply_pa=0.0)) + open_both(k) + k.step(20.0) + close_both(k) + k.step(2 * 3600.0) + self.assertTrue(k.read()['status.co2_control_failed']) + self.assertIn('E_6731FW214', k.read()['alarms.active']) + self.assertTrue(k.read()['bms.relays'][1]) + k.invoke('plant.configure', **rt.PLANT_EXAMPLE) + k.invoke('gas.reset', gas='co2') + k.step(1800.0) + self.assertAlmostEqual(k.read('evaluator')['truth.co2_fraction'], 0.05, delta=0.003) + check('gas_supply') + + def test_o2_control_with_nitrogen_and_its_limit(self): + h = ready(settle=3 * 3600.0) + h.invoke('o2.control', enabled=True) + h.invoke('o2.set', setpoint_fraction=0.05) + h.step(3 * 3600.0) + self.assertAlmostEqual(h.read('evaluator')['truth.o2_fraction'], 0.05, delta=0.0025) + self.assertGreater(h.ledger()['n2_injected_mol'], 3.0) + w = h.invoke('o2.set', setpoint_fraction=0.20)['warnings'] + self.assertIn('o2_setpoint_above_achievable', w) # 5 % CO2 and water vapour dilute the air + h.step(3 * 3600.0) + self.assertLess(h.read('evaluator')['truth.o2_fraction'], 0.195) + self.assertIn('O2_LOW', h.read()['alarms.active']) + check('o2_control') + + def test_co2_waits_for_the_temperature_after_a_power_cut(self): + h = ready(settle=3 * 3600.0) + h.invoke('fault.inject', fault='power_loss', active=True) + h.step(3 * 3600.0) + h.invoke('fault.inject', fault='power_loss', active=False) + self.assertTrue(h.status['co2_gate']) + inj0 = h.ledger()['co2_injected_mol'] + h.step(1900.0) # sensor initialised, temperature not yet reached? + if h.status['co2_gate']: + self.assertAlmostEqual(h.ledger()['co2_injected_mol'], inj0, delta=1e-12) + h.step(3 * 3600.0) + self.assertFalse(h.status['co2_gate']) + self.assertAlmostEqual(h.read('evaluator')['truth.co2_fraction'], 0.05, delta=0.003) + check('power_cut') + + def test_temperature_limiter(self): + h = ready(settle=2 * 3600.0) + h.invoke('fault.inject', fault='heater_stuck_on', active=True) + h.step(3600.0) + self.assertIn('E_6731FW111', h.read()['alarms.active']) + self.assertTrue(h.read()['status.heating_shutdown']) + self.assertLess(h.read('evaluator')['truth.wall_temperature_k'], 310.15 + 12.0) + k = ready(settle=2 * 3600.0) + k.invoke('fault.inject', fault='heater_failure', active=True) + k.step(8 * 3600.0) + self.assertIn('E_6731W112', k.read()['alarms.active']) + check('limiter') + + def test_altitude_partial_pressure_sensors(self): + h = ready(settle=4 * 3600.0, ambient_pressure_pa=80000.0) + x = h.read('evaluator')['truth.co2_fraction'] + self.assertAlmostEqual(x * 80000.0, 0.05 * rt.P_REF, delta=0.004 * rt.P_REF) # the NDIR controls the partial pressure + self.assertGreater(x, 0.058) + check('altitude', true_fraction=x) + + def test_alarms_door_signal_mute_and_relays(self): + h = ready(settle=3 * 3600.0) + h.invoke('door.outer', open=True) + h.step(29.0) + self.assertNotIn('DOOR_OPEN', h.read()['alarms.active']) + h.step(3.0) + self.assertIn('DOOR_OPEN', h.read()['alarms.active']) + self.assertTrue(h.read()['alarm.sound']) + h.invoke('alarm.mute') + self.assertFalse(h.read()['alarm.sound']) + h.step(300.0) + self.assertIn('DOOR_LONG', h.read()['alarms.active']) + h.invoke('door.outer', open=False) + h.step(2.0) + self.assertNotIn('DOOR_OPEN', h.read()['alarms.active']) + with self.assertRaises(rt.ActionRejected): + h.invoke('alarm.configure', kind='door', enabled=True, signal_s=20.0) + h.invoke('alarm.configure', kind='door', enabled=True, signal_s=15.0) + h.invoke('alarm.configure', kind='temperature', enabled=True, low_k=0.2, high_k=0.2) + h.invoke('door.outer', open=True) + h.step(17.0) + self.assertIn('DOOR_OPEN', h.read()['alarms.active']) + check('alarms') + + def test_high_temperature_disinfection(self): + h = ready(settle=3600.0) + flask(h, 'v1', cells=0.0, cell=None) + open_both(h) + h.invoke('vessel.place', vessel_id='v1', shelf=1) + for code in ('VESSELS_IN_CHAMBER',): + with self.assertRaises(rt.ActionRejected) as cm: + h.invoke('htd.start') + self.assertIn(str(cm.exception), ('VESSELS_IN_CHAMBER', 'DOORS_NOT_CLOSED')) + h.invoke('vessel.remove', vessel_id='v1') + with self.assertRaises(rt.ActionRejected) as cm: + h.invoke('htd.start') + self.assertEqual(str(cm.exception), 'WATER_IN_TRAY') + h.invoke('water_tray.empty', clean=True) + with self.assertRaises(rt.ActionRejected) as cm: + h.invoke('htd.start') + self.assertEqual(str(cm.exception), 'RH_SENSOR_UNCOVERED') + h.invoke('rh_sensor.cover', on=True) + with self.assertRaises(rt.ActionRejected) as cm: + h.invoke('htd.start') + self.assertEqual(str(cm.exception), 'DOORS_NOT_CLOSED') + close_both(h) + t0 = h.t + op = h.invoke('htd.start')['operation_id'] + self.assertEqual(h.read()['operation.kind'], 'htd') + with self.assertRaises(rt.ActionRejected): + h.invoke('temperature.set', setpoint_k=311.15) + peak = 0.0 + while h.htd['phase'] in ('heating', 'holding', 'cooling') and h.t - t0 < 20 * 3600: + h.step(300.0) + peak = max(peak, h.read('evaluator')['truth.wall_temperature_k']) + self.assertEqual(h.htd['last'], 'successful') + self.assertAlmostEqual((h.t - t0) / 3600.0, 14.0, delta=0.5) # manual: approx. 14 h + self.assertGreater(peak, 452.15) + self.assertEqual(h.operations[op]['phase'], 'completed') + self.assertTrue(h.read()['status.co2_initializing']) + rec = h.invoke('records.list')['records'][-1] + self.assertGreaterEqual(rec['details']['hold_at_180_s'], rt.HTD_HOLD_S) + k = ready(settle=600.0, water=0.0) + open_both(k) + k.invoke('rh_sensor.cover', on=True) + close_both(k) + k.invoke('htd.start') + k.step(3 * 3600.0) + k.invoke('door.outer', open=True) + k.step(2.0) + self.assertEqual(k.htd['last'], 'failed') + self.assertIn('E_6731FW753', k.read()['alarms.active']) + self.assertEqual(k.read()['htd.phase'], 'post_htd_cooling') + with self.assertRaises(rt.ActionRejected): + k.invoke('door.latch', open=True) if k._ang('outer') < 1.0 else k.invoke('vessel.place', vessel_id='nope', shelf=1) + check('htd', hours=(h.t - t0) / 3600.0, peak_k=peak) + + def test_performance_check_and_recurring_tasks(self): + h = ready(settle=3 * 3600.0) + r = h.invoke('performance_check.record', kind='temperature', reference_temperature_k=310.05, instrument='probe') + self.assertAlmostEqual(r['deviation_k'], r['displayed_temperature_k'] - 310.05, delta=1e-12) + self.assertIsNone(r['deviation_fraction']) + with self.assertRaises(rt.ActionRejected): + h.invoke('performance_check.record', kind='o2', reference_fraction=0.10, instrument='analyser') # O2 not at its default 10 % + with self.assertRaises(rt.ActionRejected): + h.invoke('task.complete', task='high_temperature_disinfection') + h.invoke('task.configure', task='chamber_cleaning', interval_s=3600.0) + h.step(3700.0) + self.assertIn('chamber_cleaning', h.read()['tasks.due']) + h.invoke('task.complete', task='chamber_cleaning') + self.assertNotIn('chamber_cleaning', h.read()['tasks.due']) + h.step(15 * 86400.0) + self.assertIn('water_refill', h.read()['tasks.due']) + check('tasks') + + +# ---------------------------------------------------------------- cultures +class Cultures(unittest.TestCase): + def test_medium_ph_at_5_and_10_percent_co2(self): + h = ready(settle=4 * 3600.0) + open_both(h) + for vid, med in (('dmem', 'himedia_al111'), ('rpmi', 'himedia_al028'), ('rpmi_hepes', 'himedia_al060')): + flask(h, vid, medium=med, cell=None, cells=0.0) + h.invoke('vessel.place', vessel_id=vid, shelf=2) + close_both(h) + h.step(6 * 3600.0) + ph5 = {v: truth(h, v)['pH'] for v in ('dmem', 'rpmi', 'rpmi_hepes')} + self.assertAlmostEqual(ph5['rpmi'], 7.42, delta=0.08) # 23.8 mM bicarbonate + 5.6 mM Na2HPO4 at 5 % CO2 + self.assertAlmostEqual(ph5['dmem'], 7.65, delta=0.08) # DMEM (44 mM) is alkaline at 5 % + h.invoke('co2.set', setpoint_fraction=0.10) + h.step(8 * 3600.0) + ph10 = {v: truth(h, v)['pH'] for v in ('dmem', 'rpmi', 'rpmi_hepes')} + self.assertAlmostEqual(ph10['dmem'], 7.38, delta=0.08) # ... and ~7.4 at 10 % (its design point) + self.assertLess(ph5['rpmi_hepes'] - ph10['rpmi_hepes'], ph5['rpmi'] - ph10['rpmi']) # HEPES buffers the CO2 step + self.assertEqual(rt.phenol_red(ph5['rpmi'], True)[0], 'red') + self.assertEqual(rt.phenol_red(ph10['rpmi'], True)[0], 'orange') + open_both(h) + self.assertEqual(h.invoke('vessel.observe', vessel_id='rpmi')['medium_colour'], 'orange') + check('medium_ph', at5=ph5, at10=ph10) + + def test_growth_follows_the_doubling_time_and_uses_glucose(self): + h = ready(settle=3 * 3600.0) + open_both(h) + flask(h, 'k562', cell='k_562', cells=2.0e6) + h.invoke('vessel.place', vessel_id='k562', shelf=3) + close_both(h) + t0 = truth(h, 'k562') + h.step(3 * 86400.0) + t3 = truth(h, 'k562') + td = rt.cell_lines()['k_562']['doubling_time_s'] + expected = 2 ** ((3 * 86400.0 - rt.GROWTH['lag_s']) / td) + ratio = t3['cells_live'] / t0['cells_live'] + self.assertGreater(ratio, 0.6 * expected) + self.assertLess(ratio, 1.05 * expected) + self.assertLess(t3['glucose_mol_m3'], t0['glucose_mol_m3']) + self.assertGreater(t3['lactate_mol_m3'], 1.0) + self.assertLess(t3['pH'], t0['pH'] + 0.2) + L = h.ledger() + self.assertAlmostEqual(L['lactate_produced_mol'], rt.GROWTH['y_lac'] * L['glucose_consumed_mol'], delta=1e-9) + h.step(4 * 86400.0) + t7 = truth(h, 'k562') + self.assertLess(t7['glucose_mol_m3'], 0.5) # glucose runs out, cells die + self.assertEqual(t7['phase'], 'death') + open_both(h) + self.assertIn(h.invoke('vessel.observe', vessel_id='k562')['medium_colour'], ('orange', 'yellow')) + check('growth', ratio_3d=ratio, expected=expected) + + def test_bench_exposure_and_cold_vessels(self): + h = ready(settle=3 * 3600.0) + open_both(h) + flask(h, 'warm', cell=None, cells=0.0, gas='incubator') + h.invoke('vessel.place', vessel_id='warm', shelf=2) + for i in range(6): + flask(h, f'cold{i}', vtype='flask_t175', vol=5.0e-5, T=277.15, cell=None, cells=0.0) + h.invoke('vessel.place', vessel_id=f'cold{i}', shelf=1 + i % 4) + close_both(h) + h.step(600.0) + self.assertLess(h.read('evaluator')['truth.air_temperature_k'], 309.65) # cold medium pulls the chamber down + h.step(3 * 3600.0) + self.assertAlmostEqual(truth(h, 'cold0')['temperature_k'], 310.15, delta=0.8) + open_both(h) + ph_in = truth(h, 'warm')['pH'] + h.invoke('vessel.remove', vessel_id='warm') + close_both(h) + h.step(3600.0) + tb = truth(h, 'warm') + self.assertLess(tb['temperature_k'], 297.15) + self.assertGreater(tb['pH'], ph_in + 0.4) # CO2 leaves through the vented cap + self.assertIn(h.invoke('vessel.observe', vessel_id='warm')['medium_colour'], ('pink', 'purple')) + check('bench_and_cold', ph_in=ph_in, ph_bench=tb['pH']) + + def test_contamination_turns_the_medium_turbid_and_acid(self): + h = ready(settle=3 * 3600.0) + open_both(h) + flask(h, 'c1', cells=1.0e6) + h.invoke('vessel.place', vessel_id='c1', shelf=2) + close_both(h) + h.invoke('fault.inject', fault='vessel_contamination', active=True, vessel_id='c1') + h.step(36 * 3600.0) + open_both(h) + ob = h.invoke('vessel.observe', vessel_id='c1') + self.assertTrue(ob['turbid']) + self.assertIn(ob['medium_colour'], ('yellow', 'orange')) + self.assertLess(truth(h, 'c1')['viability'], 0.9) + check('contamination') + + def test_shelf_capacity_and_vessel_rules(self): + h = ready(settle=600.0) + open_both(h) + for i in range(6): + flask(h, f'b{i}', vtype='flask_t225', vol=6.8e-5, cell=None, cells=0.0) + for i in range(5): + h.invoke('vessel.place', vessel_id=f'b{i}', shelf=1) + with self.assertRaises(rt.ActionRejected) as cm: + h.invoke('vessel.place', vessel_id='b5', shelf=1) + self.assertIn(str(cm.exception), ('SHELF_FULL', 'SHELF_OVERLOAD')) + with self.assertRaises(rt.ActionRejected): + flask(h, 'x', cells=1e9) # above the confluent number + with self.assertRaises(rt.ActionRejected): + flask(h, 'y', vtype='dish_60mm', closure='vented_cap') + close_both(h) + with self.assertRaises(rt.ActionRejected): + h.invoke('vessel.remove', vessel_id='b0') # doors closed + with self.assertRaises(rt.ActionRejected): + h.invoke('vessel.observe', vessel_id='b0') # opaque outer door + check('vessel_rules') + + +# ---------------------------------------------------------------- framework +class Framework(unittest.TestCase): + def test_read_describe_pure_and_clock(self): + h = ready(settle=600.0) + h.register_principal('ag', 'agent') + v0 = h.read('evaluator') + h.session('ag').describe(instance_id=INST) + h.session('ag').read(instance_id=INST) + self.assertEqual(json.dumps(h.read('evaluator'), sort_keys=True), json.dumps(v0, sort_keys=True)) + t = h.invoke('sim.step', dt_s=2.25)['time_s'] + self.assertEqual(t, h.t) + check('pure_reads') + + def test_step_partition_independent(self): + def run(splits): + h = powered(seed=4) + for dt in splits(1200.0): + h.step(dt) + open_both(h) + h.invoke('water_tray.fill', volume_m3=2.0e-3, temperature_k=305.15) + flask(h, 'p', cells=1.0e6) + h.invoke('vessel.place', vessel_id='p', shelf=2) + for dt in splits(30.5): + h.step(dt) + close_both(h) + for dt in splits(7300.0): + h.step(dt) + v_mid = h.read('evaluator') + h.invoke('co2.set', setpoint_fraction=0.07) + for dt in splits(3000.0): + h.step(dt) + return h, v_mid + a, am = run(lambda T: [T]) + b, bm = run(lambda T: [T / 8] * 8) + self.assertEqual(json.dumps(am, sort_keys=True), json.dumps(bm, sort_keys=True)) + self.assertEqual(json.dumps(a.read('evaluator'), sort_keys=True), json.dumps(b.read('evaluator'), sort_keys=True)) + self.assertEqual(json.dumps(truth(a, 'p'), sort_keys=True), json.dumps(truth(b, 'p'), sort_keys=True)) + self.assertEqual(json.dumps(a.chart, sort_keys=True), json.dumps(b.chart, sort_keys=True)) + self.assertEqual(json.dumps(a.ledger(), sort_keys=True), json.dumps(b.ledger(), sort_keys=True)) + check('step_partition') + + def test_conservation_ledgers(self): + h = powered() + c0 = copy.deepcopy(h.ch) + tray0 = h.tray['V'] + open_both(h) + h.invoke('water_tray.fill', volume_m3=2.0e-3, temperature_k=309.15) + flask(h, 'q', cells=1.0e6) + h.invoke('vessel.place', vessel_id='q', shelf=2) + h.step(10.0) + close_both(h) + h.step(6 * 3600.0) + L, c = h.ledger(), h.ch + self.assertAlmostEqual(c['nc'] - c0['nc'], L['co2_injected_mol'] + L['co2_exchanged_in_mol'] - L['co2_exchanged_out_mol'], delta=1e-9) + dw = (c['nw'] - c0['nw']) + (c['cond'] - c0['cond']) + self.assertAlmostEqual(dw, L['water_evaporated_tray_mol'] + L['water_evaporated_vessels_mol'] - L['water_vented_mol'] - L['water_drained_to_tray_mol'], delta=1e-9) + tray_mol = (tray0 + L['water_filled_m3'] - L['water_removed_m3'] - h.tray['V']) * rt.RHO_WATER / rt.M_WATER + self.assertAlmostEqual(tray_mol, L['water_evaporated_tray_mol'] - L['water_drained_to_tray_mol'], delta=1e-6) + self.assertGreater(L['electrical_energy_j'], L['heater_energy_j']) + self.assertEqual(h.invoke('ledger.read')['ledger'], h.ledger()) + check('ledgers') + + def test_rejections_leave_state_unchanged(self): + h = ready(settle=600.0) + v0 = json.dumps(h.read('evaluator'), sort_keys=True, default=str) + for cap, args in [('door.inner', dict(open=True)), ('door.latch', dict(open=True)), ('water_tray.fill', dict(volume_m3=1e-3, temperature_k=309.15)), + ('temperature.set', dict(setpoint_k=310.17)), ('co2.set', dict(setpoint_fraction=0.0505)), ('htd.start', {}), ('gas.reset', dict(gas='co2')), + ('vessel.place', dict(vessel_id='none', shelf=1)), ('task.complete', dict(task='performance_check')), + ('alarm.configure', dict(kind='rh', enabled=True, low=0.3))]: + with self.assertRaises(rt.ActionRejected): + h.invoke(cap, **args) + self.assertEqual(json.dumps(h.read('evaluator'), sort_keys=True, default=str), v0) + check('rejections_pure') + + def test_htd_cancellation(self): + h = ready(settle=600.0, water=0.0) + open_both(h) + h.invoke('rh_sensor.cover', on=True) + close_both(h) + h.register_principal('ag', 'agent') + s = h.session('ag') + r = s.invoke(instance_id=INST, capability_id='htd.start', arguments={}, request_id='h') + self.assertEqual(r['status'], 'accepted') + h.step(1800.0) + s.cancel(r['operation_id'], 'c') + self.assertEqual(s.poll(r['operation_id'])['status'], 'cancelled') + self.assertEqual(h.read()['htd.last_result'], 'cancelled') + self.assertEqual(h.read()['htd.phase'], 'post_htd_cooling') + h.step(12 * 3600.0) + self.assertEqual(h.read()['htd.phase'], 'idle') + self.assertNotIn('E_6731FW111', h.read()['alarms.active']) # a cancelled HTD cools without tripping the limiter + check('htd_cancel') + + def test_two_instances_isolated(self): + a, b = ready(settle=600.0), ready(settle=600.0) + open_both(a) + flask(a, 'iso', cell=None, cells=0.0) + self.assertEqual(b.vessels, {}) + self.assertNotEqual(a._ang('outer'), b._ang('outer')) + check('isolation') + + def test_agent_truth_isolation_ownership_and_idempotence(self): + h = ready(settle=600.0) + for n, v in (('a1', 'agent'), ('a2', 'agent'), ('ev', 'evaluator')): + h.register_principal(n, v) + s1, s2, e = h.session('a1'), h.session('a2'), h.session('ev') + obs = s1.read(instance_id=INST)['observations'] + self.assertFalse([k for k in obs if k.startswith('truth.')]) + self.assertIn('truth.co2_fraction', e.read(instance_id=INST)['observations']) + r = s1.invoke(instance_id=INST, capability_id='vessel.provide', arguments=dict(rt.VESSEL_EXAMPLE, vessel_id='own'), request_id='p') + self.assertEqual(r['status'], 'succeeded') + self.assertEqual(s1.invoke(instance_id=INST, capability_id='vessel.provide', arguments=dict(rt.VESSEL_EXAMPLE, vessel_id='own'), request_id='p'), r) + self.assertEqual(s1.invoke(instance_id=INST, capability_id='door.outer', arguments=dict(open=True), request_id='p')['error']['code'], 'REQUEST_CONFLICT') + self.assertEqual(s2.invoke(instance_id=INST, capability_id='vessel.discard', arguments=dict(vessel_id='own'), request_id='d')['error']['code'], 'ACCESS_DENIED') + self.assertEqual(s1.invoke(instance_id=INST, capability_id='vessel.inspect', arguments=dict(vessel_id='own'), request_id='i')['error']['code'], 'ACCESS_DENIED') + self.assertEqual(s2.read(instance_id=INST)['observations']['vessels.on_bench']['value'], []) + self.assertEqual(s1.read(instance_id=INST)['observations']['vessels.on_bench']['value'], ['own']) + check('truth_isolation_ownership') + + def test_switch_ports_control_flags_and_discard(self): + h = ready(settle=3 * 3600.0) + k = copy.deepcopy(h) + h.invoke('access_port.plug', port='upper', plugged=False) # an open 25 mm port leaks + self.assertEqual(h.read()['access_ports.unplugged'], ['upper']) + c0h, c0k = h.ledger()['co2_injected_mol'], k.ledger()['co2_injected_mol'] + h.step(3600.0) + k.step(3600.0) + self.assertGreater(h.ledger()['co2_injected_mol'] - c0h, 3.0 * (k.ledger()['co2_injected_mol'] - c0k)) + h.invoke('access_port.plug', port='upper', plugged=True) + h.invoke('co2.control', enabled=False) + u = h.ledger()['co2_injected_mol'] + h.step(1800.0) + self.assertEqual(h.ledger()['co2_injected_mol'], u) # temperature control only + h.invoke('co2.control', enabled=True) + self.assertEqual(h.invoke('contamination.set_status', contaminated=True)['status'], 'contaminated') + self.assertEqual(h.read()['contamination.status'], 'contaminated') + self.assertFalse(h.invoke('power.press_switch')['enabled']) # the mains switch toggles + self.assertIsNone(h.read()['display.temperature_c']) + self.assertTrue(h.invoke('power.press_switch')['enabled']) + flask(h, 'gone', cell=None, cells=0.0) + self.assertEqual(h.invoke('vessel.discard', vessel_id='gone')['vessel_id'], 'gone') + self.assertNotIn('gone', h.vessels) + check('controls_and_flags') + + def test_queries_export_and_unsupported(self): + h = ready(settle=3 * 3600.0) + rows = h.invoke('chart.read', since_s=0.0, max_points=1440)['rows'] + self.assertGreater(len(rows), 100) + self.assertTrue(h.invoke('events.read', since_s=0.0)['events']) + self.assertEqual(h.invoke('alarms.list')['relays'], [False, False, False, False]) + self.assertGreaterEqual(len(h.invoke('provenance.read')['libraries']), 5) + ex = h.invoke('data.export', kind='chart') + self.assertEqual(ex['rows'], len(h.chart)) + self.assertEqual(len(h.invoke('tasks.list')['tasks']), 4) + for k in rt.UNSUPPORTED: + with self.assertRaises(rt.ActionRejected): + h.invoke(k) + check('queries') + + +# ---------------------------------------------------------------- declared effects over scenario states +_SC = {} + + +def _build(name): + if name == 'fresh': + return rt.EppendorfCellxpertC170iRuntime() + if name == 'off': + h = rt.EppendorfCellxpertC170iRuntime() + h.invoke('plant.configure', **rt.PLANT_EXAMPLE) + flask(h, 'v', cell=None, cells=0.0) + return h + if name == 'warming': + h = powered() + h.step(600.0) + return h + if name == 'steady': + h = ready(settle=3 * 3600.0) + flask(h, 'v', cells=1.0e6) + return h + if name == 'outer_open': + h = _scenario('steady') + h.invoke('door.outer', open=True) + h.step(2.0) + return h + if name == 'open': + h = _scenario('steady') + open_both(h) + return h + if name == 'loaded': + h = _scenario('open') + h.invoke('vessel.place', vessel_id='v', shelf=2) + close_both(h) + h.step(600.0) + return h + if name == 'loaded_open': + h = _scenario('loaded') + open_both(h) + return h + if name == 'htd_ready': + h = ready(settle=600.0, water=0.0) + open_both(h) + h.invoke('rh_sensor.cover', on=True) + close_both(h) + return h + if name == 'alarm': + h = _scenario('steady') + h.invoke('door.outer', open=True) + h.step(40.0) + return h + if name == 'htd': + h = ready(settle=600.0, water=0.0) + open_both(h) + h.invoke('rh_sensor.cover', on=True) + close_both(h) + h.invoke('htd.start') + h.step(1800.0) + return h + if name == 'failed_gas': + h = ready(settle=3 * 3600.0) + h.invoke('gas.pressure_monitor', enabled=False) + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, co2_supply_pa=0.0)) + open_both(h) + h.step(20.0) + close_both(h) + h.step(2 * 3600.0) + return h + raise KeyError(name) + + +def _scenario(name): + if name not in _SC: + _SC[name] = _build(name) + return copy.deepcopy(_SC[name]) + + +SCENARIOS = ['fresh', 'off', 'warming', 'steady', 'outer_open', 'open', 'loaded', 'loaded_open', 'alarm', 'htd_ready', 'htd', 'failed_gas'] +STEP_DTS = (0.5, 5.0, 60.0) + + +def _variants(cap): + V = { + 'plant.configure': [dict(rt.PLANT_EXAMPLE), dict(rt.PLANT_EXAMPLE, mains_voltage_v=60.0), dict(rt.PLANT_EXAMPLE, room_k=300.15, co2_supply_pa=0.03e6)], + 'power.set': [dict(enabled=True), dict(enabled=False)], 'power.press_switch': [{}], + 'temperature.set': [dict(setpoint_k=311.15)], 'co2.set': [dict(setpoint_fraction=0.06)], 'o2.set': [dict(setpoint_fraction=0.05)], + 'co2.control': [dict(enabled=False), dict(enabled=True)], 'o2.control': [dict(enabled=True)], 'gas.pressure_monitor': [dict(enabled=False)], 'gas.reset': [dict(gas='co2')], + 'alarm.configure': [dict(kind='temperature', enabled=True, low_k=0.2, high_k=0.2), dict(kind='door', enabled=True, signal_s=15.0)], 'alarm.mute': [{}], + 'htd.start': [{}], 'contamination.set_status': [dict(contaminated=True)], 'task.configure': [dict(task='chamber_cleaning', interval_s=3600.0)], + 'task.complete': [dict(task='water_refill')], 'performance_check.record': [dict(kind='temperature', reference_temperature_k=310.1, instrument='p')], + 'data.export': [dict(kind='events')], 'door.outer': [dict(open=True), dict(open=False)], 'door.latch': [dict(open=True), dict(open=False)], + 'door.inner': [dict(open=True), dict(open=False)], 'water_tray.fill': [dict(volume_m3=2.0e-4, temperature_k=309.15)], 'water_tray.empty': [dict(clean=True)], + 'rh_sensor.cover': [dict(on=True)], 'access_port.plug': [dict(port='upper', plugged=False)], 'vessel.provide': [dict(rt.VESSEL_EXAMPLE, vessel_id='new')], + 'vessel.place': [dict(vessel_id='v', shelf=2)], 'vessel.remove': [dict(vessel_id='v')], 'vessel.observe': [dict(vessel_id='v')], 'vessel.discard': [dict(vessel_id='v')], + 'fault.inject': [dict(fault=f, active=True) for f in ('power_loss', 'heater_failure', 'heater_stuck_on', 'co2_valve_stuck_closed', 'gasket_leak', 'ndir_drift')] + + [dict(fault='vessel_contamination', active=True, vessel_id='v'), dict(fault='power_loss', active=False)], + 'sim.step': [dict(dt_s=0.5), dict(dt_s=30.0)], + } + return V.get(cap, []) + + +def _num(x): + return isinstance(x, (int, float)) and not isinstance(x, bool) + + +def _flat(v, prefix=''): + out = {} + if isinstance(v, dict): + for k, x in v.items(): + out.update(_flat(x, f'{prefix}.{k}')) + elif isinstance(v, list) and len(v) <= 128: + for i, x in enumerate(v): + out.update(_flat(x, f'{prefix}[{i}]')) + else: + out[prefix] = json.dumps(v, sort_keys=True, default=str) if isinstance(v, list) else v + return out + + +def _rel_changed(a, b, scale=None): + if _num(a) and _num(b): + return abs(a - b) > 1e-9 * (max(abs(a), abs(b)) if scale is None else scale) + 1e-300 + return _changed(a, b) + + +def _leaf_changed(a, b): + fa, fb = _flat(a), _flat(b) + return any(_rel_changed(fa.get(k, ''), fb.get(k, '')) for k in set(fa) | set(fb)) + + +def _step_differs(v1, a2, v0, b2): + f1, fa, f0, fb = _flat(v1), _flat(a2), _flat(v0), _flat(b2) + for leaf in set(f1) | set(fa) | set(f0) | set(fb): + x1, xa, x0, xb = (f.get(leaf, '') for f in (f1, fa, f0, fb)) + ca, cb = _rel_changed(x1, xa), _rel_changed(x0, xb) + if not (ca or cb): + continue + if ca and cb and all(_num(x) for x in (x1, xa, x0, xb)) and not _rel_changed(xa - x1, xb - x0, max(abs(x1), abs(xa), abs(x0), abs(xb))): + continue + if ca and cb and (x1, xa) == (x0, xb): + continue + if ca and cb and x1 == x0 and not _rel_changed(xa, xb): + continue + return True + return False + + +def _executable(cap): + return cap not in rt.UNSUPPORTED and rt.CAPS[cap]['kind'] not in ('query',) + + +class ReviewRound1(unittest.TestCase): + """Findings of the independent runtime / contract review round 1 (outputs/.../independent_*_review_r1.json).""" + + def _open30(self, h): + h.invoke('door.outer', open=True) + h.step(1.5) + h.invoke('door.latch', open=True) + h.step(0.5) + h.invoke('door.inner', open=True) + h.step(24.0) + h.invoke('door.inner', open=False) + h.step(1.5) + h.invoke('door.latch', open=False) + h.step(0.5) + h.invoke('door.outer', open=False) + + def test_f01_no_overshoot_after_door_opening_and_f05_humidity_recovery(self): + h = ready(settle=24 * 3600.0) + self.assertAlmostEqual(h._rh_true(), 0.925, delta=0.01) + t0 = h.t + self._open30(h) + temps, rhs = [], [] + for _ in range(3600): + h.step(1.0) + temps.append((h.t - t0, h.sens['T'])) + rhs.append((h.t - t0, h.sens['rh'])) + late = [T for s, T in temps if s >= 180.0] + self.assertLess(max(late) - 310.15, 0.2) # brochure: recovery without regulation overshoot + self.assertGreater(min(late) - 310.15, -0.2) + self.assertLess(max(abs(T - 310.15) for s, T in temps if s >= 600.0), 0.1) + rh80 = next(s for s, r in rhs if r >= 0.80 and s > 60.0) + self.assertLess(rh80, 1800.0) # back above 80 % well before the 3.5 h RH-alarm time-out + self.assertNotIn('RH_LOW', h.alarms) + check('door_recovery_no_overshoot', t_max_k=max(late), t_min_k=min(late), rh80_s=rh80) + + def test_f05_warm_tray_water_fogs_the_glass_door(self): + h = ready(settle=6 * 3600.0) + open_both(h) + h.invoke('water_tray.empty', clean=False) + h.invoke('water_tray.fill', volume_m3=1.5e-3, temperature_k=333.15) + close_both(h) + fog, rh = 0.0, 0.0 + for _ in range(90): + h.step(60.0) + fog = max(fog, h.read('evaluator')['truth.condensate_kg']) + rh = max(rh, h.read('evaluator')['truth.rh']) + self.assertGreater(fog, 1e-4) # manual Tab. 11-7: condensation on the inner door with too-warm tray water + self.assertLessEqual(rh, 1.0 + 1e-9) + cold = ready(settle=12 * 3600.0) + self.assertEqual(cold.read('evaluator')['truth.condensate_kg'], 0.0) + check('warm_water_fog', condensate_kg=fog) + + def test_f02_bms_relays_fail_safe(self): + h = ready(settle=600.0) + h.invoke('power.set', enabled=False) + self.assertEqual(h.read()['bms.relays'], [True, True, True, True]) + h.invoke('power.set', enabled=True) + h.invoke('fault.inject', fault='power_loss', active=True) + self.assertEqual(h.read()['bms.relays'], [True, True, True, True]) + check('bms_fail_safe') + + def test_f03_initial_gas_states_and_sealed_flasks(self): + h = ready(settle=3 * 3600.0) + for mid in ('himedia_al111', 'himedia_al028', 'himedia_al060'): + flask(h, 'b' + mid, medium=mid, cell=None, cells=0.0, T=298.15, gas='as_supplied') + qc = rt.media()[mid]['qc_pH'] + self.assertAlmostEqual(truth(h, 'b' + mid)['pH'], 0.5 * (qc[0] + qc[1]), delta=1e-6) + flask(h, 'inc5', medium='himedia_al111', cell=None, cells=0.0, gas='incubator') + h.invoke('co2.set', setpoint_fraction=0.10) + h.step(3 * 3600.0) + flask(h, 'inc10', medium='himedia_al111', cell=None, cells=0.0, gas='incubator') + self.assertLess(truth(h, 'inc10')['pH'], truth(h, 'inc5')['pH'] - 0.2) # 'incubator' follows the chamber's actual CO2 + hanks = 'himedia_al056' + self.assertLess(rt.media()[hanks]['bicarbonate_mol_m3'], 6.0) + open_both(h) + flask(h, 'empty', medium=hanks, cell=None, cells=0.0, vtype='flask_t25', vol=5e-6, closure='plug_seal_closed', gas='as_supplied') + flask(h, 'cult', medium=hanks, cell='hela', cells=0.5e6, vtype='flask_t25', vol=5e-6, closure='plug_seal_closed', gas='as_supplied') + for k in ('empty', 'cult'): + h.invoke('vessel.place', vessel_id=k, shelf=2) + close_both(h) + h.step(3600.0) + e1, c1 = truth(h, 'empty'), truth(h, 'cult') + h.step(47 * 3600.0) + e2, c2 = truth(h, 'empty'), truth(h, 'cult') + self.assertAlmostEqual(e2['pH'], e1['pH'], delta=0.02) # sealed and without cells: no CO2 escapes, the pH stays + self.assertGreater(c2['headspace_co2_fraction'], c1['headspace_co2_fraction']) # respiration accumulates in the headspace + self.assertLess(c2['pH'], c1['pH'] - 0.1) + self.assertTrue(6.8 < c2['pH'] < 8.3, c2['pH']) + check('sealed_flask', ph_empty=e2['pH'], ph_culture=[c1['pH'], c2['pH']], headspace=[c1['headspace_co2_fraction'], c2['headspace_co2_fraction']]) + + def test_f04_reference_culture_reproduces_the_library_doubling_time(self): + h = ready(settle=3 * 3600.0) + open_both(h) + flask(h, 'dm', medium='himedia_al111', cells=1.0e6, gas='incubator') + flask(h, 'pl', medium='himedia_al111', vtype='plate_96', vol=96 * 1.5e-7, cells=96 * 5.0e3, gas='incubator') + h.invoke('vessel.place', vessel_id='dm', shelf=2) + h.invoke('vessel.place', vessel_id='pl', shelf=3) + close_both(h) + h.step(24 * 3600.0) + n24 = {k: truth(h, k)['cells_live'] for k in ('dm', 'pl')} + h.step(48 * 3600.0) + lib = rt.cell_lines()['hela']['doubling_time_s'] + for k in ('dm', 'pl'): + td = 48 * 3600.0 * math.log(2) / math.log(truth(h, k)['cells_live'] / n24[k]) + self.assertLess(abs(td / lib - 1.0), 0.15, (k, td / 3600.0)) + check('doubling_time_reference') + + def test_minor_limits_doors_monitor_htd_chart_o2_contamination(self): + h = ready(settle=600.0, room_k=308.15) # F-M01: set point only 2 K above the room + h.step(10 * 3600.0) # the uncontrolled heat drifts the chamber up; > set + 0.5 K for 4 h + self.assertGreater(h.ch['Ta'], 306.15 + 3.0) + self.assertIn('E_6731FW108', h.alarms) + k = ready(settle=600.0) # F-M02: inner door refused while the outer door closes + k.invoke('door.outer', open=True) + k.step(2.0) + k.invoke('door.latch', open=True) + k.step(1.0) + k.invoke('door.outer', open=False) + with self.assertRaises(rt.ActionRejected): + k.invoke('door.inner', open=True) + m = ready(settle=2 * 3600.0) # F-M03: the pressure monitor stops the control, no timeout + m.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, noise_seed=1, co2_supply_pa=0.0)) + open_both(m) + m.step(20.0) + close_both(m) + m.step(2 * 3600.0) + self.assertFalse(m.read()['status.co2_control_failed']) + m.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, noise_seed=1)) + m.step(1800.0) + self.assertAlmostEqual(m.read('evaluator')['truth.co2_fraction'], 0.05, delta=0.003) + d = ready(settle=600.0, water=0.0) # F-M04: an open access port blocks the HTD + open_both(d) + d.invoke('rh_sensor.cover', on=True) + close_both(d) + d.invoke('access_port.plug', port='upper', plugged=False) + with self.assertRaises(rt.ActionRejected) as e: + d.invoke('htd.start') + self.assertEqual(str(e.exception), 'ACCESS_PORT_OPEN') + d.invoke('access_port.plug', port='upper', plugged=True) + d.invoke('htd.start') + d.step(3 * 3600.0) + d.invoke('door.outer', open=True) # F-M05: aborted at 180 C -> chamber handling refused while hot + d.step(2.0) + d.invoke('door.latch', open=True) + d.step(1.0) + d.invoke('door.inner', open=True) + d.step(2.0) + self.assertEqual(d.read()['htd.phase'], 'post_htd_cooling') + with self.assertRaises(rt.ActionRejected) as e: + d.invoke('water_tray.fill', volume_m3=1e-3, temperature_k=298.15) + self.assertEqual(str(e.exception), 'HTD_RUNNING') + self.assertNotIn('heater_fraction', d.chart[-1]) # F-M07 + d.register_principal('ag_c06', 'agent') # C-06: the tray volume is a process value for the evaluator + s = d.session('ag_c06') + self.assertNotIn('water_tray.volume_m3', s.read(instance_id=INST)['observations']) + o = ready(settle=600.0) # F-M09: 5 % O2 recovers before the 15 min alarm pause ends + o.invoke('o2.control', enabled=True) + o.step(1800.0) + o.invoke('o2.set', setpoint_fraction=0.05) + o.step(3 * 3600.0) + self._open30(o) + o.step(3600.0) + self.assertFalse([e for e in o.events if e['code'] == 'O2_HIGH']) + c = ready(settle=3 * 3600.0, water=2.0e-3) # F-M10: contaminated medium stalls in acid, no solver floor + open_both(c) + flask(c, 'cx', medium='himedia_al111', cells=1.0e6, gas='incubator') + c.invoke('vessel.place', vessel_id='cx', shelf=1) + close_both(c) + c.invoke('fault.inject', fault='vessel_contamination', active=True, vessel_id='cx') + c.step(5 * 86400.0) + self.assertGreater(truth(c, 'cx')['pH'], 4.5) + check('minor_findings_r1') + + def test_c09_alarm_limits_and_performance_reference_units(self): + h = ready(settle=3 * 3600.0) + h.invoke('alarm.configure', kind='temperature', enabled=True, low_k=2.0, high_k=2.0) + for args in (dict(kind='temperature', enabled=True, low=0.2), dict(kind='co2', enabled=True, low_k=0.5), dict(kind='temperature', enabled=True, low_k=6.0)): + with self.assertRaises(rt.ActionRejected) as e: + h.invoke('alarm.configure', **args) + self.assertEqual(str(e.exception), 'INVALID_ALARM_LIMIT') + with self.assertRaises(rt.ActionRejected) as e: + h.invoke('performance_check.record', kind='temperature', reference_fraction=0.05, instrument='p') + self.assertEqual(str(e.exception), 'MISSING_REFERENCE') + r = h.invoke('performance_check.record', kind='co2', reference_fraction=0.05, instrument='analyser') + self.assertIsNone(r['deviation_k']) + self.assertLess(abs(r['deviation_fraction']), 0.003) + check('unit_split_arguments') + + +class ReviewRound2(unittest.TestCase): + """Findings of the combined independent review round 2 (independent_*_review_r2.json).""" + + def test_f2_01_default_initial_gas_and_f2_06_l15(self): + h = ready(settle=600.0) + h.invoke('vessel.provide', vessel_id='d', vessel_type='flask_t75', medium_id='himedia_al111', medium_volume_m3=1.5e-5, seeded_cells=0.0, temperature_k=298.15) + qc = rt.media()['himedia_al111']['qc_pH'] + self.assertAlmostEqual(truth(h, 'd')['pH'], 0.5 * (qc[0] + qc[1]), delta=1e-6) # documented default 'as_supplied' + h.invoke('vessel.provide', vessel_id='l15', vessel_type='flask_t75', medium_id='himedia_al011', medium_volume_m3=1.5e-5, seeded_cells=0.0, temperature_k=298.15) + qc = rt.media()['himedia_al011']['qc_pH'] + self.assertAlmostEqual(truth(h, 'l15')['pH'], 0.5 * (qc[0] + qc[1]), delta=1e-6) # no bicarbonate: QC midpoint without CO2 + check('default_as_supplied') + + def test_f2_02_htd_finishes_with_a_set_point_near_the_room(self): + h = powered() + h.invoke('temperature.set', setpoint_k=298.15) # 25 C at a 22 C room (accepted with a warning), set before the warm-up + open_both(h) + h.invoke('rh_sensor.cover', on=True) + close_both(h) + h.step(6 * 3600.0) + h.invoke('htd.start') + h.step(30 * 3600.0) + self.assertEqual(h.read()['htd.last_result'], 'successful') + self.assertEqual(h.read()['htd.phase'], 'idle') + check('htd_low_set_point') + + def test_f2_03_latch_race_and_f2_04_incubator_gas(self): + h = ready(settle=3 * 3600.0) + h.invoke('door.outer', open=True) + h.step(2.0) + h.invoke('door.latch', open=True) + h.step(1.0) + h.invoke('door.inner', open=True) + with self.assertRaises(rt.ActionRejected) as e: + h.invoke('door.latch', open=False) + self.assertEqual(str(e.exception), 'INNER_DOOR_OPEN') + k = ready(settle=600.0) # F3-01: reverse order (latch closing, then the inner door) is refused too + k.invoke('door.outer', open=True) + k.step(2.0) + k.invoke('door.latch', open=True) + k.step(1.0) + k.invoke('door.latch', open=False) + with self.assertRaises(rt.ActionRejected) as e2: + k.invoke('door.inner', open=True) + self.assertEqual(str(e2.exception), 'LATCH_CLOSED') + h.step(30.0) # chamber CO2 has dropped with both doors open + self.assertLess(h.read('evaluator')['truth.co2_fraction'], 0.01) + flask(h, 'inc', medium='himedia_al111', cell=None, cells=0.0, gas='incubator') + self.assertAlmostEqual(truth(h, 'inc')['pH'], 7.64, delta=0.03) # equilibrated at the 5 % set point, not at the open-door chamber + check('latch_race_incubator_gas') + + def test_c2_01_water_level_sensor_interlock(self): + h = ready(settle=600.0) + self.assertTrue(h.read()['sensor.water_present']) + open_both(h) + h.invoke('rh_sensor.cover', on=True) + close_both(h) + with self.assertRaises(rt.ActionRejected) as e: + h.invoke('htd.start') + self.assertEqual(str(e.exception), 'WATER_IN_TRAY') + open_both(h) + h.invoke('water_tray.empty', clean=True) + self.assertFalse(h.read()['sensor.water_present']) + h.invoke('power.set', enabled=False) + self.assertIsNone(h.read()['sensor.water_present']) + check('water_sensor_interlock') + + +class ZDeclaredEffects(unittest.TestCase): + def test_immediate_and_on_step_effects_are_declared(self): + missing_imm, missing_step = {}, {} + states = {n: _scenario(n) for n in SCENARIOS} + for cap in rt.CAPS: + if not _executable(cap): + continue + for sname, S in states.items(): + for args in _variants(cap): + A = copy.deepcopy(S) + v0 = A.read('evaluator') + try: + _orig_invoke(A, cap, **args) + except rt.ActionRejected: + continue + v1 = A.read('evaluator') + if cap == 'sim.step': + for k in v0: + if _leaf_changed(v0[k], v1[k]) and k not in rt.ON_STEP['sim.step'] + rt.EFFECTS['sim.step']: + missing_step.setdefault('sim.step', set()).add((sname, k)) + continue + for k in v0: + if _leaf_changed(v0[k], v1[k]) and k not in rt.EFFECTS.get(cap, []): + missing_imm.setdefault(cap, set()).add((sname, k)) + for dt in STEP_DTS: + A2, B2 = copy.deepcopy(A), copy.deepcopy(S) + A2.step(dt) + B2.step(dt) + a2, b2 = A2.read('evaluator'), B2.read('evaluator') + for k in v0: + if k not in rt.ON_STEP.get(cap, []) and _step_differs(v1[k], a2[k], v0[k], b2[k]): + missing_step.setdefault(cap, set()).add((sname, k)) + if k not in rt.ON_STEP['sim.step'] + ['clock.time_s'] and _leaf_changed(v0[k], b2[k]): + missing_step.setdefault('sim.step', set()).add((sname, k)) + self.maxDiff = None + self.assertEqual(missing_imm, {}) + self.assertEqual(missing_step, {}) + check('declared_effects_scenarios') + + def test_every_device_capability_is_accepted_in_some_scenario(self): + accepted = set() + for n in SCENARIOS: + S = _scenario(n) + for cap in rt.CAPS: + if not _executable(cap) or cap in accepted: + continue + for args in _variants(cap): + try: + _orig_invoke(copy.deepcopy(S), cap, **args) + accepted.add(cap) + break + except rt.ActionRejected: + pass + self.assertEqual({c for c in rt.CAPS if _executable(c)} - accepted, set()) + + +class ZZRejectionCodes(unittest.TestCase): + def test_every_observed_rejection_code_is_declared(self): + undeclared = {k: sorted(v - set(rt.CAP_ERRORS.get(k, [])) - {'INVALID_ARGUMENT', 'UNSUPPORTED', 'UNKNOWN_CAPABILITY'}) for k, v in REJECTIONS.items()} + self.assertEqual({k: v for k, v in undeclared.items() if v}, {}) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_asset_eppendorf_cryocubef570n.py b/tests/test_asset_eppendorf_cryocubef570n.py new file mode 100644 index 0000000000000000000000000000000000000000..b62c7a7fe1d193fb45753c6c5b6aa63fe208c185 --- /dev/null +++ b/tests/test_asset_eppendorf_cryocubef570n.py @@ -0,0 +1,460 @@ +"""tests for CHEM-197 eppendorf_cryocubef570n (Eppendorf CryoCube F570n ULT freezer): python3 -m unittest tests/test_asset_eppendorf_cryocubef570n.py + +Themes: contract consistency (slots, effects, errors raised vs declared); agent / evaluator truth isolation; idempotent request ids; two instances +isolated; step-partition independence; rejected calls leave the state unchanged; every output validated against its schema and every success +changes only declared slots; pull-down 3 h 53 min and 8.3 kWh/day (calibrated) with the probe in the middle compartment and the integer display; +door handle, outer / inner doors, vacuum after closing and the auto vent; door-opening recovery and frost; alarm limits, on-site / remote delays, +mute and test, BMS relay; mains outage on the battery back-up circuit; lock code and programming mode; loading warm items (latent heat, +compartment limits, inventory from the host); gasket / vent icing, de-icing and seal cleaning; defrost and drying; filter dust, condenser fan +failure (E-04), sensor errors; energy, water and air ledgers closing exactly.""" +import copy +import json +import math +import re +import sys +import unittest +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / 'scripts')) +from asset_runtime import eppendorf_cryocubef570n as rt # noqa: E402 + +INST = 'eppendorf_cryocubef570n_01' +CHECKS = [] +SEEN_CAPS = set() +PROCESS_EVIDENCE = {} +SET = 193.15 + + +def _differ(x, y): + if isinstance(x, float) and isinstance(y, float): + return abs(x - y) > 1e-12 * max(1.0, abs(x), abs(y)) + return json.dumps(x, sort_keys=True, default=str) != json.dumps(y, sort_keys=True, default=str) + + +class Rig: + def __init__(self, seed=1, instance=INST, **plant): + self.h = rt.EppendorfCryocubef570nRuntime(instance) + self.h.register_principal('agent', 'agent') + self.h.register_principal('eval', 'evaluator') + self.A = self.h.session('agent') + self.E = self.h.session('eval') + self.n = 0 + self.inst = instance + self.call(self.E, 'plant.configure', **dict(rt.PLANT_EXAMPLE, noise_seed=seed, **plant)) + + def call(self, sess, cap, expect='succeeded', **args): + self.n += 1 + before, t0 = self.h.read('evaluator'), self.h.t + r = sess.invoke(instance_id=self.inst, capability_id=cap, arguments=args, request_id=f'r{self.n}') + after = self.h.read('evaluator') + changed = {k for k in after if _differ(after[k], before[k])} - {'clock.time_s'} + if expect == 'succeeded': + assert r['status'] == 'succeeded', (cap, r['error']) + rt.validate(rt.CAPS[cap]['output_schema'], r['result']) + if cap != 'sim.step': + extra = changed - set(rt.EFFECTS.get(cap, [])) + assert not extra, (cap, sorted(extra)) + assert self.h.t == t0, cap + SEEN_CAPS.add(cap) + PROCESS_EVIDENCE.setdefault(cap, []).append(dict(arguments=json.dumps(args, sort_keys=True, default=str)[:200], time_s=t0, status=r['status'])) + return r['result'] + assert r['status'] in ('rejected', 'unsupported'), (cap, r['status'], r.get('result')) + assert r['error']['code'] == expect, (cap, r['error']['code'], expect) + assert not changed, (cap, 'rejected call changed', sorted(changed)) + assert expect in [e['code'] for e in rt.export_eppendorf_cryocubef570n_contract_metadata()['capabilities'][cap]['errors']], (cap, expect) + return r + + def step(self, s): + self.call(self.E, 'sim.step', dt_s=float(s)) + + def read(self, *ids, who=None): + sess = who or self.E + o = sess.read(instance_id=self.inst, state_ids=list(ids) if ids else None)['observations'] + return {k: v['value'] for k, v in o.items()} if not ids or len(ids) > 1 else o[ids[0]]['value'] + + def cold(self, settle=6 * 3600.0): + """Switched on (battery circuit on) and pulled down to -80 C.""" + self.call(self.A, 'battery.set', on=True) + self.call(self.A, 'power.set', on=True) + self.step(rt.DOC['pull_down_s'] + settle) + + def open_all(self, angle=1.6): + self.call(self.A, 'handle.set', locked=False) + self.call(self.A, 'door.move', angle_rad=angle) + for c in range(1, 6): + self.call(self.A, 'inner_door.move', compartment=c, angle_rad=angle) + + def close_all(self): + for c in range(1, 6): + self.call(self.A, 'inner_door.move', compartment=c, angle_rad=0.0) + self.call(self.A, 'door.move', angle_rad=0.0) + self.call(self.A, 'handle.set', locked=True) + + def until(self, pred, limit, every=10.0): + t = 0.0 + while not pred() and t < limit: + self.step(every) + t += every + return t + + def ledger(self): + return self.call(self.E, 'ledger.read')['ledger'] + + +def _raised_codes(): + src = Path(rt.__file__).read_text() + funcs = {} + for m in re.finditer(r'\n def (\w+)\(self[^\n]*\n(.*?)(?=\n def |\n# ----|\nclass |\ndef )', src, re.S): + funcs[m.group(1)] = m.group(2) + own = {k: set(re.findall(r"ActionRejected\('([A-Z_]+)'\)", v)) for k, v in funcs.items()} + calls = {k: set(re.findall(r'self\.(_\w+)\(', v)) & set(funcs) for k, v in funcs.items()} + out = {} + for k in funcs: + if not k.startswith('_cmd_'): + continue + seen, todo, codes = set(), [k], set() + while todo: + f = todo.pop() + if f in seen: + continue + seen.add(f) + codes |= own.get(f, set()) + todo += [g for g in calls.get(f, ()) if g not in ('_cmd_sim_step', 'step', '_tick')] + out[k] = codes + name = {'_cmd_' + c.replace('.', '_'): c for c in rt.CAPS} + return {name[k]: v for k, v in out.items() if k in name} + + +def _balance(test, L): + U = L['e_initial_j'] + L['e_conduction_in_j'] + L['e_exchange_in_j'] - L['e_refrigeration_out_j'] + L['e_items_added_j'] - L['e_items_removed_j'] - L['e_meltwater_wiped_j'] + test.assertAlmostEqual(L['u_cabinet_j'], U, delta=1e-9 * max(abs(L['e_initial_j']), abs(L['e_refrigeration_out_j']), 1.0) + 1e-3) + test.assertAlmostEqual(L['w_deposited_kg'], L['frost_kg'] + L['melt_water_kg'] + L['w_wiped_kg'] + L['w_deiced_kg'], delta=1e-12 + 1e-9 * L['w_deposited_kg']) + test.assertAlmostEqual(L['n_interior_mol'], L['n_initial_mol'] + L['n_door_mol'] + L['n_vent_mol'], delta=1e-9 * L['n_initial_mol']) + + +class Contract(unittest.TestCase): + def test_metadata_slots_effects_consistent(self): + meta = rt.export_eppendorf_cryocubef570n_contract_metadata() + slots = set(meta['state_slots']) + self.assertEqual(slots, set(rt.SLOTS)) + for k, c in meta['capabilities'].items(): + for e in c['state_effects']: + self.assertIn(e['state_id'], slots, k) + self.assertTrue({'INVALID_ARGUMENT', 'REQUEST_CONFLICT', 'UNKNOWN_INSTANCE'} <= {e['code'] for e in c['errors']}, k) + self.assertTrue(rt.SCENE_MIRRORED <= slots) + for name, p in meta['mechanisms']['ult_freezer_thermal']['parameters'].items(): + self.assertEqual(name, name.lower()) + self.assertIn(p['evidence'], ('documented', 'assumption'), name) + + def test_declared_errors_cover_raised_codes(self): + meta = rt.export_eppendorf_cryocubef570n_contract_metadata() + for cap, codes in _raised_codes().items(): + declared = {e['code'] for e in meta['capabilities'][cap]['errors']} + self.assertTrue(codes <= declared, (cap, sorted(codes - declared))) + + def test_unsupported_capabilities(self): + g = Rig() + for k in rt.UNSUPPORTED: + g.call(g.A, k, expect='UNSUPPORTED') + + def test_agent_truth_isolation(self): + g = Rig() + g.call(g.A, 'power.set', on=True) + g.step(600.0) + self.assertFalse(any(k.startswith('truth.') for k in g.read(who=g.A))) + for cap, a in (('truth.inspect', {}), ('ledger.read', {}), ('fault.inject', dict(fault='mains_outage', active=True))): + r = g.A.invoke(instance_id=INST, capability_id=cap, arguments=a, request_id='x' + cap) + self.assertEqual(r['error']['code'], 'ACCESS_DENIED') + g.call(g.E, 'fault.inject', fault='compressor_failure', active=True) + self.assertFalse(any(e['kind'] in ('fault', 'truth') for e in g.call(g.A, 'events.read', since_s=0.0)['events'])) + + def test_idempotent_request_ids(self): + g = Rig() + a = g.A.invoke(instance_id=INST, capability_id='power.set', arguments=dict(on=True), request_id='same') + b = g.A.invoke(instance_id=INST, capability_id='power.set', arguments=dict(on=True), request_id='same') + self.assertEqual(a, b) + c = g.A.invoke(instance_id=INST, capability_id='power.set', arguments=dict(on=False), request_id='same') + self.assertEqual(c['error']['code'], 'REQUEST_CONFLICT') + + def test_two_instances_isolated(self): + a, b = Rig(instance='i1'), Rig(instance='i2') + a.call(a.A, 'power.set', on=True) + self.assertFalse(b.read('power.on')) + + def test_step_partition_independence(self): + runs = [] + for parts in ([3000.0], [0.3, 7.7, 400.0, 2592.0], [1.0] * 40 + [2960.0]): + g = Rig(seed=7) + g.call(g.A, 'power.set', on=True) + for p in parts: + g.step(p) + v = g.read() + v.pop('clock.time_s') + runs.append(json.dumps(v, sort_keys=True, default=str)) + self.assertEqual(runs[0], runs[1]) + self.assertEqual(runs[0], runs[2]) + + def test_rejections_change_nothing(self): + r = rt.EppendorfCryocubef570nRuntime('fresh') + r.register_principal('e', 'evaluator') + self.assertEqual(r.session('e').invoke(instance_id='fresh', capability_id='power.set', arguments=dict(on=True), request_id='p')['error']['code'], 'PLANT_REQUIRED') + g = Rig() + g.call(g.E, 'plant.configure', expect='SEED_FIXED', **dict(rt.PLANT_EXAMPLE, noise_seed=2)) + g.call(g.A, 'settings.configure', expect='POWER_OFF', set_point_k=193.15) + g.call(g.A, 'alarm.mute', expect='POWER_OFF') + g.call(g.A, 'door.move', expect='HANDLE_LOCKED', angle_rad=1.0) + g.call(g.A, 'inner_door.move', expect='OUTER_DOOR_CLOSED', compartment=1, angle_rad=1.0) + g.call(g.A, 'lock.set', locked=True) + g.call(g.A, 'handle.set', expect='CYLINDER_LOCKED', locked=False) + g.call(g.A, 'lock.set', locked=False) + g.call(g.A, 'vent.deice', expect='OUTER_DOOR_CLOSED') + g.call(g.A, 'load.place', expect='OUTER_DOOR_CLOSED', **rt.ITEM_EXAMPLE) + g.call(g.A, 'load.remove', expect='UNKNOWN_ITEM', item_id='nothing') + g.call(g.A, 'log.read', last=5) + g.call(g.A, 'power.set', on=True) + g.call(g.A, 'settings.configure', expect='INVALID_ARGUMENT', set_point_k=277.15) # not a 4 C fridge + g.call(g.A, 'settings.configure', expect='OUT_OF_LIMITS', high_alarm_k=SET + 2.0) + g.call(g.A, 'settings.configure', expect='LIMITS_CONFLICT', set_point_k=223.15) + g.call(g.A, 'interior.dry', expect='POWER_ON') + g.call(g.E, 'fault.inject', expect='INVALID_ARGUMENT', fault='alien', active=True) + h = Rig(monitoring=False) + h.call(h.A, 'log.read', expect='NO_MONITORING', last=5) + + +class Physics(unittest.TestCase): + def test_pull_down_energy_and_display(self): + g = Rig() + g.call(g.A, 'power.set', on=True) + g.step(60.0) + self.assertEqual(g.read('state.current'), 'pull_down') + t = g.until(lambda: g.read('truth.thermal')['probe_k'] <= SET, 6 * 3600.0, 30.0) + self.assertAlmostEqual(t, rt.DOC['pull_down_s'], delta=150.0) + g.step(12 * 3600.0) + self.assertEqual(g.read('state.current'), 'running') + self.assertEqual(g.read('display.temperature'), -80.0) + e0 = g.ledger()['electric_energy_j'] + g.step(86400.0) + self.assertAlmostEqual((g.ledger()['electric_energy_j'] - e0) / 3.6e6, rt.DOC['energy_kwh_day'], delta=0.1) + th = g.read('truth.thermal') + self.assertLess(th['condenser_k'], rt.ENG['condenser_e04_k']) + self.assertLessEqual(g.read('truth.power')['mains_current_a'], rt.DOC['current_a']) + _balance(self, g.ledger()) + + def test_door_vacuum_auto_vent_and_recovery(self): + g = Rig() + g.cold() + g.open_all() + g.step(60.0) + peak = g.read('truth.thermal')['probe_k'] + self.assertGreater(peak, SET + 20.0) + g.close_all() + g.step(20.0) + dp = g.read('truth.thermal')['pressure_deficit_pa'] + self.assertGreater(dp, rt.ENG['door_open_dp_pa']) + g.call(g.A, 'handle.set', locked=False) + g.call(g.A, 'door.move', expect='NEGATIVE_PRESSURE', angle_rad=1.0) # the vacuum holds the door + g.call(g.A, 'vent.press') + t = g.until(lambda: g.read('truth.thermal')['pressure_deficit_pa'] <= rt.ENG['door_open_dp_pa'], 600.0, 5.0) + self.assertLessEqual(t, 120.0) # auto vent: 1-2 min (manual) + g.call(g.A, 'handle.set', locked=True) + t = g.until(lambda: g.read('truth.thermal')['probe_k'] <= SET + 0.5, 3 * 3600.0, 10.0) + self.assertAlmostEqual(t + 160.0, rt.DOC['recovery_s'], delta=240.0) + self.assertGreater(g.read('truth.thermal')['frost_kg']['liner'], 0.005) # humid room air froze out + _balance(self, g.ledger()) + + def test_inner_door_rules_and_partial_opening(self): + g = Rig() + g.cold() + g.call(g.A, 'handle.set', locked=False) + g.call(g.A, 'door.move', angle_rad=0.8) + g.call(g.A, 'inner_door.move', expect='OUTER_DOOR_CLOSED', compartment=3, angle_rad=1.5) + g.call(g.A, 'door.move', angle_rad=1.6) + g.call(g.A, 'inner_door.move', compartment=3, angle_rad=1.5) + g.call(g.A, 'door.move', expect='INNER_DOOR_OPEN', angle_rad=0.0) + g.call(g.A, 'handle.set', expect='DOOR_OPEN', locked=True) + g.step(60.0) + air = g.read('truth.thermal')['air_k'] + self.assertGreater(air[2], air[0] + 10.0) # only compartment 3 inner door open + g.call(g.A, 'inner_door.move', compartment=3, angle_rad=0.0) + g.call(g.A, 'door.move', angle_rad=0.0) + + def test_alarm_delays_mute_relay_and_resound(self): + g = Rig() + g.cold() + g.call(g.A, 'settings.configure', onsite_delay_s=0.0, remote_delay_s=600.0) + g.open_all() + t = g.until(lambda: 'TEMP_HIGH' in g.read('alarms.active'), 1800.0, 5.0) + self.assertLess(t, 300.0) + self.assertTrue(g.read('indicator.temp_alarm') and g.read('alarm.audible')) + self.assertFalse(g.read('alarm.remote_relay')) + g.call(g.A, 'alarm.mute') + self.assertFalse(g.read('alarm.audible')) + g.step(700.0) + self.assertTrue(g.read('alarm.remote_relay')) # remote delay elapsed + g.close_all() + g.until(lambda: 'TEMP_HIGH' not in g.read('alarms.active'), 4 * 3600.0, 30.0) + self.assertFalse(g.read('alarm.audible')) + r = g.call(g.A, 'alarm.mute') # no alarm: tone test + self.assertTrue(r['test'] and g.read('alarm.audible')) + g.step(10.0) + self.assertFalse(g.read('alarm.audible')) + _balance(self, g.ledger()) + + def test_outage_battery_and_display_flashing(self): + g = Rig() + g.cold(settle=3600.0) + g.call(g.E, 'fault.inject', fault='mains_outage', active=True) + g.step(5.0) + self.assertEqual(g.read('state.current'), 'outage') + self.assertTrue(g.read('indicator.power_fail') and g.read('alarm.remote_relay') and g.read('display.flashing')) + g.step(6 * 3600.0) + T6 = g.read('truth.thermal')['probe_k'] + self.assertGreater(T6, SET + 5.0) # warms without the compressor + self.assertLess(T6, SET + 50.0) # 130 mm walls: hours, not minutes + g.call(g.E, 'fault.inject', fault='mains_outage', active=False) + g.step(5.0) + self.assertNotIn('POWER_FAIL', g.read('alarms.active')) + g.call(g.A, 'battery.set', on=False) + g.call(g.E, 'fault.inject', fault='mains_outage', active=True) + g.step(5.0) + self.assertIsNone(g.read('display.temperature')) # battery circuit off: dark panel, no alarm + self.assertEqual(g.read('alarms.active'), []) + h = Rig() + h.cold(settle=600.0) + h.call(h.E, 'fault.inject', fault='battery_aged', active=True) + h.call(h.E, 'fault.inject', fault='mains_outage', active=True) + h.step(8 * 3600.0) + self.assertEqual(h.read('truth.power')['battery_charge'], 0.0) # aged battery: 10 % of 72 h + self.assertIsNone(h.read('display.temperature')) + + def test_lock_code_programming_mode(self): + g = Rig() + g.call(g.A, 'power.set', on=True) + g.call(g.A, 'code.change', code='4711') + self.assertTrue(g.read('panel.code_active')) + g.call(g.A, 'panel.lock') + g.call(g.A, 'settings.configure', expect='PANEL_LOCKED', set_point_k=203.15) + g.call(g.A, 'panel.unlock', expect='WRONG_CODE', code='1234') + g.call(g.A, 'panel.unlock', code='4711') + self.assertTrue(g.read('indicator.lock')) + g.call(g.A, 'settings.configure', set_point_k=203.15, high_alarm_k=213.15, low_alarm_k=193.15) + g.call(g.A, 'code.change', code='0000') + g.call(g.A, 'panel.lock') + self.assertFalse(g.read('panel.code_active')) + g.call(g.A, 'settings.configure', onsite_delay_s=600.0) + + def test_loading_warm_samples_latent_heat_and_inventory(self): + g = Rig() + g.cold() + g.open_all() + g.call(g.A, 'load.place', **rt.ITEM_EXAMPLE) + g.call(g.A, 'load.place', item_id='warm_box', compartment=3, kind='box', label='LIMS:B-17', water_kg=0.5, polymer_kg=0.2, cardboard_kg=0.15, initial_k=293.15) + g.call(g.A, 'load.place', expect='DUPLICATE_ITEM', **rt.ITEM_EXAMPLE) + g.call(g.A, 'load.place', expect='SHELF_OVERLOAD', item_id='heavy', compartment=3, kind='other', steel_kg=64.0, initial_k=193.15) + for i in range(4): + g.call(g.A, 'load.place', item_id=f'r{i}', compartment=5, kind='rack', steel_kg=2.0, initial_k=193.15) + g.call(g.A, 'load.place', item_id='r4', compartment=5, kind='rack', steel_kg=2.0, initial_k=193.15) + g.call(g.A, 'load.place', expect='COMPARTMENT_FULL', item_id='r5', compartment=5, kind='rack', steel_kg=2.0, initial_k=193.15) + inv = g.call(g.A, 'inventory.read')['items'] + self.assertEqual({x['item_id'] for x in inv} >= {'rack_A1', 'warm_box'}, True) + self.assertEqual(next(x for x in inv if x['item_id'] == 'warm_box')['label'], 'LIMS:B-17') + g.close_all() + g.step(1800.0) + it = g.read('truth.items')['warm_box'] + self.assertGreater(it['temperature_k'], 260.0) # still freezing (latent heat) after 30 min + g.step(24 * 3600.0) + it = g.read('truth.items')['warm_box'] + self.assertLess(it['temperature_k'], SET + 3.0) + self.assertEqual(it['liquid_fraction'], 0.0) + self.assertLess(g.read('truth.items')['rack_A1']['equivalent_storage_s_at_m80'], 2.0 * (g.h.t - 0.0)) + g.open_all() + g.call(g.A, 'load.remove', item_id='warm_box') + g.close_all() + self.assertEqual(g.read('inventory.count'), 6) + _balance(self, g.ledger()) + + def test_gasket_vent_icing_deice_and_seals(self): + g = Rig(relative_humidity=0.8) + g.cold(settle=600.0) + g.call(g.E, 'fault.inject', fault='door_gasket_damage', active=True) + g.step(20 * 86400.0) + fr = g.read('truth.thermal')['frost_kg'] + self.assertGreater(fr['vent'], rt.ENG['vent_iced_kg']) + self.assertGreater(fr['gasket'], 0.05) + g.call(g.E, 'fault.inject', fault='door_gasket_damage', active=False) # an intact (but iced) gasket: the iced vent sets the pace + g.open_all(1.6) + g.step(30.0) + g.close_all() + g.call(g.A, 'vent.press') + g.step(600.0) + self.assertGreater(g.read('truth.thermal')['pressure_deficit_pa'], rt.ENG['door_open_dp_pa']) # iced vent: 1-2 h + t = g.until(lambda: g.read('truth.thermal')['pressure_deficit_pa'] <= rt.ENG['door_open_dp_pa'], 4 * 3600.0, 60.0) + self.assertGreater(t, 1800.0) + g.call(g.A, 'handle.set', locked=False) + g.call(g.A, 'door.move', angle_rad=1.6) + r = g.call(g.A, 'vent.deice') + self.assertGreater(r['removed_kg'], 0.0) + self.assertGreater(g.call(g.A, 'seals.clean')['removed_kg'], 0.0) + g.call(g.A, 'door.move', angle_rad=0.0) + _balance(self, g.ledger()) + + def test_defrost_and_dry(self): + g = Rig(relative_humidity=0.7) + g.cold(settle=600.0) + for _ in range(3): + g.open_all() + g.step(60.0) + g.close_all() + g.step(1800.0) + frost = sum(g.read('truth.thermal')['frost_kg'].values()) + self.assertGreater(frost, 0.02) + g.call(g.A, 'battery.toggle') + g.call(g.A, 'power.toggle') + self.assertFalse(g.read('power.on') or g.read('battery.on')) + g.step(600.0) + g.call(g.A, 'handle.set', locked=False) + g.call(g.A, 'door.move', angle_rad=1.6) + g.call(g.A, 'interior.dry', expect='FROST_REMAINING') + for c in range(1, 6): + g.call(g.A, 'inner_door.move', compartment=c, angle_rad=1.6) + g.step(2 * 86400.0) + self.assertEqual(sum(g.read('truth.thermal')['frost_kg'].values()), 0.0) + r = g.call(g.A, 'interior.dry') + self.assertGreaterEqual(r['wiped_kg'], frost) # humid room air keeps freezing out on the still cold walls + L = g.ledger() + self.assertAlmostEqual(L['w_deposited_kg'], L['w_wiped_kg'] + L['w_deiced_kg'], delta=1e-9) + self.assertEqual(g.call(g.E, 'truth.inspect')['thermal']['melt_water_kg'], 0.0) + _balance(self, g.ledger()) + + def test_filter_dust_e04_and_sensor_errors(self): + g = Rig(ambient_k=303.15) + g.cold(settle=600.0) + for _ in range(4): + g.step(23 * 86400.0) + self.assertTrue(g.read('indicator.filter_clean')) + g.call(g.A, 'filter.clean') + self.assertFalse(g.read('indicator.filter_clean')) + g.call(g.E, 'fault.inject', fault='condenser_fan_failure', active=True) + g.step(3600.0) + self.assertIn('E-04', g.read('alarms.active')) + self.assertTrue(g.read('indicator.fault')) + g.call(g.E, 'fault.inject', fault='condenser_fan_failure', active=False) + g.call(g.E, 'fault.inject', fault='interior_sensor_failure', active=True) + g.step(60.0) + self.assertIsNone(g.read('display.temperature')) + self.assertEqual(g.read('display.code'), 'E-01') + self.assertTrue(g.read('alarm.audible')) + _balance(self, g.ledger()) + + +class ZCoverage(unittest.TestCase): + def test_all_capabilities_exercised(self): + implemented = {k for k in rt.CAPS if k not in rt.UNSUPPORTED} + missing = implemented - SEEN_CAPS + if len(SEEN_CAPS) > 5: + self.assertFalse(missing, sorted(missing)) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_asset_esco_ac24s8.py b/tests/test_asset_esco_ac24s8.py new file mode 100644 index 0000000000000000000000000000000000000000..e364687855aec46877dbd262491563b26792434c --- /dev/null +++ b/tests/test_asset_esco_ac24s8.py @@ -0,0 +1,649 @@ +"""tests for CHEM-193 esco_ac24s8 (Esco Airstream Plus AC2-4S8-TU Class II biological safety cabinet): python3 -m unittest tests/test_asset_esco_ac24s8.py + +Themes: contract consistency (slots, effects, errors raised vs declared); agent / evaluator truth isolation; idempotent request ids; two instances +isolated; step-partition independence; rejected calls leave the state unchanged; every output validated against its schema and every success +changes only declared slots; nominal airflow (displayed inflow 0.48 / downflow 0.35 m/s at the tested opening, 876 / 369 m3/h, 200 W); +documented Sentinel Gold behaviour (warm-up, post-purge, sash states and stops, light at the safe height, UV interlock and timer, standby, +quickstart, mute, socket fuse); air barrier (operator protection >= 1e5 at the nominal point, lost with the sash fully open, cross draught, +grille blockage, blower failure -> airflow alarm); filter loading and ECM compensation (duty rises, flows held until saturation); work-zone +cleanliness (ISO class) and product protection; biological aerosol (escape, capture, emission, deposition, UV inactivation) and chemical +vapour (evaporation from an open dish, recirculation, exhaust to the room) ledgers closing exactly; electrical energy.""" +import json +import math +import re +import sys +import unittest +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / 'scripts')) +from asset_runtime import esco_ac24s8 as rt # noqa: E402 + +INST = 'esco_ac24s8_01' +CHECKS = [] +SEEN_CAPS = set() +PROCESS_EVIDENCE = {} +DISH = dict(item_id='dish', kind='open_vessel', x_m=0.30, y_m=0.0, footprint_m2=0.0064, liquid='ethanol', liquid_mass_kg=0.02, surface_area_m2=0.0064) +SPRAY = dict(item_id='pipetting', kind='aerosol_source', x_m=0.30, y_m=0.2, footprint_m2=0.01, aerosol_rate_per_s=1.0e5, viable_fraction=0.1) + + +def _differ(x, y): + if isinstance(x, float) and isinstance(y, float): + return abs(x - y) > 1e-12 * max(1.0, abs(x), abs(y)) + return json.dumps(x, sort_keys=True, default=str) != json.dumps(y, sort_keys=True, default=str) + + +class Rig: + def __init__(self, seed=1, instance=INST, **plant): + self.h = rt.EscoAc24s8Runtime(instance) + self.h.register_principal('agent', 'agent') + self.h.register_principal('eval', 'evaluator') + self.A = self.h.session('agent') + self.E = self.h.session('eval') + self.n = 0 + self.inst = instance + self.call(self.E, 'plant.configure', **dict(rt.PLANT_EXAMPLE, noise_seed=seed, **plant)) + + def call(self, sess, cap, expect='succeeded', **args): + """Instrumented call: outputs validated against the declared schema; a success changes only declared immediate slots and never the clock; + a rejection leaves every slot unchanged and returns a declared error code.""" + self.n += 1 + before, t0 = self.h.read('evaluator'), self.h.t + r = sess.invoke(instance_id=self.inst, capability_id=cap, arguments=args, request_id=f'r{self.n}') + after = self.h.read('evaluator') + changed = {k for k in after if _differ(after[k], before[k])} - {'clock.time_s'} + if expect == 'succeeded': + assert r['status'] == 'succeeded', (cap, r['error']) + rt.validate(rt.CAPS[cap]['output_schema'], r['result']) + if cap != 'sim.step': + extra = changed - set(rt.EFFECTS.get(cap, [])) + assert not extra, (cap, sorted(extra)) + assert self.h.t == t0, cap + SEEN_CAPS.add(cap) + PROCESS_EVIDENCE.setdefault(cap, []).append(dict(arguments=json.dumps(args, sort_keys=True, default=str)[:200], time_s=t0, status=r['status'])) + return r['result'] + assert r['status'] in ('rejected', 'unsupported'), (cap, r['status'], r.get('result')) + assert r['error']['code'] == expect, (cap, r['error']['code'], expect) + assert not changed, (cap, 'rejected call changed', sorted(changed)) + assert expect in [e['code'] for e in rt.export_esco_ac24s8_contract_metadata()['capabilities'][cap]['errors']], (cap, expect) + return r + + def step(self, s): + self.call(self.E, 'sim.step', dt_s=float(s)) + + def read(self, *ids, who=None): + sess = who or self.E + o = sess.read(instance_id=self.inst, state_ids=list(ids) if ids else None)['observations'] + return {k: v['value'] for k, v in o.items()} if not ids or len(ids) > 1 else o[ids[0]]['value'] + + def on(self): + self.call(self.A, 'power.set', on=True) + + def sash(self, d, **kw): + self.call(self.A, 'sash.move', direction=d, **kw) + self.step(15.0) + + def working(self): + self.on() + self.sash('up') + self.call(self.A, 'fan.toggle') + self.step(200.0) + + def ledger(self): + return self.call(self.E, 'ledger.read')['ledger'] + + +def _raised_codes(): + src = Path(rt.__file__).read_text() + funcs = {} + for m in re.finditer(r'\n def (\w+)\(self[^\n]*\n(.*?)(?=\n def |\n# ----|\nclass |\ndef )', src, re.S): + funcs[m.group(1)] = m.group(2) + own = {k: set(re.findall(r"ActionRejected\('([A-Z_]+)'\)", v)) for k, v in funcs.items()} + for k, v in funcs.items(): # data-driven interlocks: the codes the key's INTERLOCK entry allows + for what in re.findall(r"self\._interlock\('(\w+)'\)", v): + own[k] |= set(rt.INTERLOCK[what]) + calls = {k: set(re.findall(r'self\.(_\w+)\(', v)) & set(funcs) for k, v in funcs.items()} + out = {} + for k in funcs: + if not k.startswith('_cmd_'): + continue + seen, todo, codes = set(), [k], set() + while todo: + f = todo.pop() + if f in seen: + continue + seen.add(f) + codes |= own.get(f, set()) + todo += [g for g in calls.get(f, ()) if g not in ('_cmd_sim_step', 'step', '_tick')] + out[k[5:].replace('_', '.', 1)] = codes + return out + + +def _balance(test, L, tol=1e-6): + """Particle, aerosol, viable and vapour ledgers close (relative tolerance of the explicit sub-step sums).""" + room = L['initial_room_particles'] + L['room_in'] + out = L['room_captured_down'] + L['room_captured_exh'] + L['room_emitted'] + L['room_deposited'] + L['room_returned'] + L['room_in_air'] + test.assertAlmostEqual(room, out, delta=tol * room) + gen = L['proc_generated'] + out = L['proc_escaped'] + L['proc_captured_down'] + L['proc_captured_exh'] + L['proc_emitted'] + L['proc_deposited'] + L['proc_in_air'] + test.assertAlmostEqual(gen, out, delta=tol * max(gen, 1.0)) + via = L['viable_generated'] + out = L['viable_escaped'] + L['viable_captured'] + L['viable_emitted'] + L['viable_in_air'] + L['viable_on_tray'] + L['viable_uv_inactivated'] + test.assertAlmostEqual(via, out, delta=tol * max(via, 1.0)) + for sp, v in L['vapour'].items(): + test.assertAlmostEqual(v['evaporated_kg'], v['escaped_front_kg'] + v['exhausted_to_room_kg'] + v.get('in_air_kg', 0.0), delta=1e-12 + tol * v['evaporated_kg']) + placed = L['liquid_placed_kg'].get(sp, 0.0) + test.assertAlmostEqual(placed, L['liquid_in_vessels_kg'].get(sp, 0.0) + L.get('liquid_removed_kg', {}).get(sp, 0.0) + v['evaporated_kg'], delta=1e-12) + for k, v in L.items(): + if isinstance(v, float): + test.assertGreaterEqual(v, -1e-9 * max(1.0, abs(v)), k) + + +class Contract(unittest.TestCase): + def test_metadata_slots_effects_and_mirrors_consistent(self): + meta = rt.export_esco_ac24s8_contract_metadata() + slots = set(meta['state_slots']) + self.assertEqual(slots, set(rt.SLOTS)) + for k, c in meta['capabilities'].items(): + for e in c['state_effects']: + self.assertIn(e['state_id'], slots, k) + for x in c['observes']: + self.assertIn(x, slots, k) + for pre in c['preconditions']: + self.assertTrue(set(pre['state_ids']) <= slots, k) + self.assertTrue({'INVALID_ARGUMENT', 'REQUEST_CONFLICT', 'UNKNOWN_INSTANCE'} <= {e['code'] for e in c['errors']}, k) + self.assertIn(c['kind'], ('query', 'device_command', 'robot_skill', 'simulation', 'analysis', 'configuration')) + self.assertTrue(rt.SCENE_MIRRORED <= slots) + for name, p in meta['mechanisms']['class_ii_bsc_airflow']['parameters'].items(): + self.assertEqual(name, name.lower()) + self.assertIn(p['evidence'], ('documented', 'assumption'), name) + + def test_declared_errors_cover_raised_codes(self): + meta = rt.export_esco_ac24s8_contract_metadata() + for cap, codes in _raised_codes().items(): + declared = {e['code'] for e in meta['capabilities'][cap]['errors']} + self.assertTrue(codes <= declared, (cap, sorted(codes - declared))) + + def test_unsupported_capabilities(self): + g = Rig() + for k in rt.UNSUPPORTED: + r = g.A.invoke(instance_id=INST, capability_id=k, arguments={}, request_id='u-' + k) + self.assertEqual((r['status'], r['error']['code']), ('unsupported', 'UNSUPPORTED')) + + def test_agent_truth_isolation(self): + g = Rig() + d = g.A.describe(instance_id=INST) + self.assertFalse(any(k.startswith('truth.') for k in d['state_slots'])) + with self.assertRaises(rt.ActionRejected): + g.A.read(instance_id=INST, state_ids=['truth.workzone']) + for cap, args in (('truth.inspect', {}), ('sim.step', dict(dt_s=1.0)), ('ledger.read', {}), ('fault.inject', dict(fault='filter_clogged', active=True)), + ('plant.configure', dict(rt.PLANT_EXAMPLE))): + r = g.A.invoke(instance_id=INST, capability_id=cap, arguments=args, request_id='x-' + cap) + self.assertEqual(r['error']['code'], 'ACCESS_DENIED', cap) + g.call(g.E, 'fault.inject', fault='downflow_filter_leak', active=True) + self.assertFalse(any(e['kind'] in ('fault', 'truth') for e in g.call(g.A, 'events.read', since_s=0.0)['events'])) + # agent alarms identical when only the truth differs (a filter leak is not visible on the panel) + a, b = Rig(), Rig() + b.call(b.E, 'fault.inject', fault='downflow_filter_leak', active=True) + for x in (a, b): + x.working() + self.assertEqual(a.read('alarms.active', 'airflow.status'), b.read('alarms.active', 'airflow.status')) + + def test_idempotent_request_ids(self): + g = Rig() + g.on() + args = dict(warm_up_s=300.0) + r1 = g.A.invoke(instance_id=INST, capability_id='settings.configure', arguments=args, request_id='same') + snap = g.h.read('evaluator') + r2 = g.A.invoke(instance_id=INST, capability_id='settings.configure', arguments=args, request_id='same') + self.assertEqual(r1, r2) + self.assertEqual(json.dumps(snap, sort_keys=True, default=str), json.dumps(g.h.read('evaluator'), sort_keys=True, default=str)) + r3 = g.A.invoke(instance_id=INST, capability_id='settings.configure', arguments=dict(warm_up_s=400.0), request_id='same') + self.assertEqual(r3['error']['code'], 'REQUEST_CONFLICT') + + def test_two_instances_isolated(self): + a, b = Rig(instance='t_a'), Rig(instance='t_b', ambient_k=298.15) + a.call(a.A, 'power.set', on=True) + self.assertFalse(b.read('power.on')) + r = a.A.invoke(instance_id='t_b', capability_id='power.set', arguments=dict(on=True), request_id='z') + self.assertEqual(r['error']['code'], 'UNKNOWN_INSTANCE') + + def test_step_partition_independence(self): + def run(steps): + g = Rig(seed=5) + g.on() + g.call(g.A, 'sash.move', direction='up') + g.step(15.0) + g.call(g.A, 'item.place', **DISH) + g.call(g.A, 'item.place', **SPRAY) + g.call(g.A, 'fan.toggle') + for s in steps: + g.step(s) + r = g.read() + return json.dumps({k: r[k] for k in r if not k.startswith('clock')}, sort_keys=True), json.dumps(g.ledger(), sort_keys=True) + a = run([400.0]) + b = run([0.05] * 200 + [0.37, 13.11, 376.52]) + c = run([20.0] * 20) + self.assertEqual(a, b) + self.assertEqual(a, c) + + def test_rejections_change_nothing(self): + g = Rig() + r = rt.EscoAc24s8Runtime('fresh') + r.register_principal('e', 'evaluator') + self.assertEqual(r.session('e').invoke(instance_id='fresh', capability_id='power.set', arguments=dict(on=True), request_id='p')['error']['code'], 'PLANT_REQUIRED') + g.call(g.E, 'plant.configure', expect='SEED_FIXED', **dict(rt.PLANT_EXAMPLE, noise_seed=2)) + g.call(g.A, 'fan.toggle', expect='POWER_OFF') + g.call(g.A, 'datalog.read', expect='POWER_OFF') + g.call(g.A, 'item.place', expect='SASH_CLOSED', **DISH) + g.call(g.A, 'operator.set', expect='SASH_CLOSED', arms_in=True) + g.on() + g.call(g.A, 'fan.toggle', expect='SASH_CLOSED') + g.call(g.A, 'lamp.toggle', expect='SASH_CLOSED') + g.call(g.A, 'sash.move', expect='SASH_AT_LIMIT', direction='down') + g.call(g.A, 'alarm.mute', expect='NO_ALARM') + g.call(g.A, 'fan.set', expect='FAN_NOT_RUNNING', state='standby') if False else None + g.sash('up') + g.call(g.A, 'uv.toggle', expect='SASH_NOT_CLOSED') + g.call(g.A, 'fan.set', expect='FAN_NOT_RUNNING', state='standby') + g.call(g.A, 'item.place', expect='MISSING_SETTING', item_id='v', kind='open_vessel', x_m=0.3, y_m=0.0, footprint_m2=0.01) + g.call(g.A, 'item.place', expect='UNKNOWN_LIQUID', **dict(DISH, liquid='unobtainium')) + g.call(g.A, 'item.place', expect='NO_SPACE', item_id='big', kind='closed_container', x_m=0.3, y_m=0.0, footprint_m2=0.3) if False else None + g.call(g.A, 'item.place', **DISH) + g.call(g.A, 'item.place', expect='ITEM_EXISTS', **DISH) + g.call(g.A, 'item.remove', expect='UNKNOWN_ITEM', item_id='nope') + g.call(g.A, 'fan.toggle') + g.call(g.A, 'socket.toggle', expect='WARMING_UP') + g.call(g.A, 'sash.move', expect='WARMING_UP', direction='up') + g.call(g.A, 'settings.configure', expect='WARMING_UP', warm_up_s=300.0) + g.step(200.0) + g.call(g.A, 'uv.toggle', expect='SASH_NOT_CLOSED') + g.call(g.A, 'fan.set', state='standby') + g.call(g.A, 'lamp.toggle', expect='STANDBY') + g.call(g.A, 'fan.set', state='on') + g.call(g.E, 'fault.inject', expect='INVALID_ARGUMENT', fault='alien', active=True) + g.call(g.A, 'settings.configure', expect='INVALID_ARGUMENT', warm_up_s=60.0) + h = Rig() + h.on() + h.sash('up') + for _ in range(4): + h.call(h.A, 'item.place', item_id=f'b{_}', kind='closed_container', x_m=0.3, y_m=0.0, footprint_m2=0.13) + h.call(h.A, 'item.place', expect='NO_SPACE', item_id='b9', kind='closed_container', x_m=0.3, y_m=0.0, footprint_m2=0.1) + + +class Airflow(unittest.TestCase): + def test_nominal_airflow_display_and_power(self): + g = Rig() + g.working() + r = g.read() + self.assertEqual(r['fan.state'], 'on') + self.assertAlmostEqual(r['display.inflow_m_s'], 0.48, delta=0.011) + self.assertAlmostEqual(r['display.downflow_m_s'], 0.35, delta=0.011) + self.assertEqual(r['airflow.status'], 'ok') + ta = r['truth.airflow'] + self.assertAlmostEqual(ta['downflow_m3_s'] * 3600, 876.0, delta=2.0) + self.assertAlmostEqual(ta['exhaust_m3_s'] * 3600, 369.0, delta=1.5) + self.assertAlmostEqual(ta['electrical_power_w'], 200.0, delta=4.0) + self.assertGreaterEqual(r['truth.containment']['apf_log10'], 5.0) # EN 12469 KI-Discus criterion at the nominal point + self.assertLessEqual(r['truth.workzone']['iso_class_workzone'], 5.0) + CHECKS.append(dict(id='nominal_airflow', status='passed', layer='process', inflow=r['display.inflow_m_s'], downflow=r['display.downflow_m_s'], + power_w=ta['electrical_power_w'], apf_log10=r['truth.containment']['apf_log10'], iso=r['truth.workzone']['iso_class_workzone'])) + + def test_warm_up_post_purge_and_display(self): + g = Rig() + g.on() + g.call(g.A, 'settings.configure', warm_up_s=300.0, post_purge_s=180.0) + g.sash('up') + self.assertTrue(g.read('lamp.on')) # light on as a signal at the working height + g.call(g.A, 'fan.toggle') + g.step(60.0) + self.assertEqual(g.read('fan.state'), 'warm_up') + self.assertIsNone(g.read('display.inflow_m_s')) + self.assertAlmostEqual(g.read('fan.remaining_s'), 240.0, delta=0.6) + g.step(250.0) + self.assertEqual(g.read('fan.state'), 'on') + g.call(g.A, 'fan.toggle') + self.assertEqual(g.read('fan.state'), 'post_purge') + g.call(g.A, 'lamp.toggle', expect='POST_PURGE') + g.sash('down') # the sash may be lowered during post-purge + self.assertEqual(g.read('sash.status'), 'closed') + self.assertFalse(g.read('lamp.on')) + g.call(g.A, 'uv.toggle', expect='POST_PURGE') + g.step(200.0) + self.assertEqual(g.read('fan.state'), 'off') + self.assertLess(g.read('truth.airflow')['downflow_m3_s'], 1e-3) + + def test_sash_states_alarm_mute_and_hold(self): + g = Rig() + g.working() + g.sash('up') + self.assertEqual(g.read('sash.status'), 'full_open') + self.assertIn('SASH_ALARM', g.read('alarms.active')) + self.assertTrue(g.read('alarm.audible')) + self.assertTrue(g.read('lamp.on')) + tc = g.read('truth.containment') + self.assertLess(tc['apf_log10'], 2.0) # 470 mm opening: true inflow ~0.18 m/s + self.assertAlmostEqual(g.read('display.inflow_m_s'), 0.48, delta=0.011) # the exhaust sensor still reads the nominal-height value + g.call(g.A, 'alarm.mute') + g.step(10.0) + self.assertFalse(g.read('alarm.audible')) + g.step(25.0) + self.assertTrue(g.read('alarm.audible')) # re-sounds after the 30 s mute + g.call(g.A, 'sash.move', direction='down', hold_s=2.0) # released mid-way + g.step(5.0) + self.assertEqual(g.read('sash.status'), 'intermediate') + self.assertFalse(g.read('lamp.on')) + g.sash('down') + self.assertEqual(g.read('sash.status'), 'safe') + self.assertEqual(g.read('alarms.active'), []) + self.assertGreaterEqual(g.read('meters')['sash_cycles'], 3) + + def test_uv_interlock_timer_and_inactivation(self): + g = Rig() + g.working() + g.call(g.A, 'item.place', **SPRAY) + g.step(600.0) + g.call(g.A, 'item.remove', item_id='pipetting') + before = g.read('truth.workzone')['viable_on_tray_per_m2'] + self.assertGreater(before, 0.0) + g.call(g.A, 'fan.toggle') + g.sash('down') + g.step(5.0) + g.call(g.A, 'settings.configure', uv_timer_s=1200.0) + g.call(g.A, 'uv.toggle') + self.assertTrue(g.read('indicator.uv')) + g.step(600.0) + self.assertLess(g.read('truth.workzone')['viable_on_tray_per_m2'], before * 1e-6) # 600 J/m2 >> D90 50 J/m2 + g.sash('up') # lifting the sash switches the UV lamp off + self.assertFalse(g.read('uv.on')) + g.sash('down') + g.call(g.A, 'uv.toggle') + g.step(1300.0) + self.assertFalse(g.read('uv.on')) # timer + _balance(self, g.ledger()) + + def test_standby_quickstart_socket_fuse(self): + g = Rig() + g.working() + p_on = g.read('truth.airflow')['electrical_power_w'] # nominal 200 W with the LED on + g.call(g.A, 'fan.set', state='standby') + self.assertFalse(g.read('lamp.on')) # standby switches the lights off + g.call(g.A, 'settings.configure', expect='STANDBY', warm_up_s=300.0) # only the FAN key in standby + g.step(60.0) + self.assertEqual(g.read('airflow.status'), 'standby') + self.assertIsNone(g.read('display.inflow_m_s')) + self.assertAlmostEqual(1.0 - g.read('truth.airflow')['electrical_power_w'] / p_on, 0.60, delta=0.03) + g.call(g.A, 'fan.set', state='on') + g.call(g.A, 'socket.toggle') + g.call(g.A, 'item.place', item_id='centrifuge', kind='equipment', x_m=0.4, y_m=-0.3, footprint_m2=0.06, power_w=1500.0) + g.step(1.0) + self.assertFalse(g.read('socket.on')) + self.assertNotIn('SOCKET_FUSE_BLOWN', g.read('alarms.active')) # not a panel alarm (manual list); event only + self.assertIn('SOCKET_FUSE_BLOWN', [e['code'] for e in g.call(g.E, 'events.read', since_s=0.0)['events']]) + g.call(g.A, 'socket.toggle', expect='FUSE_BLOWN') + g.call(g.A, 'item.remove', item_id='centrifuge') + g.call(g.A, 'power.set', on=False) # fuse replaced while off + g.call(g.A, 'power.set', on=True) + g.call(g.A, 'socket.toggle') + self.assertTrue(g.read('socket.on')) + q = Rig() + q.on() + q.call(q.A, 'settings.configure', mode='quickstart') + q.sash('up') + self.assertIn(q.read('fan.state'), ('warm_up', 'on')) # quickstart: lifting the sash starts the blower + q.step(200.0) + q.sash('down') + self.assertEqual(q.read('fan.state'), 'off') + + def test_filter_loading_compensation_and_airflow_alarm(self): + g = Rig() + g.working() + u0 = g.read('truth.airflow')['duty_down'] + m = Rig(downflow_filter_dust_kg=0.9 * 1.3 * rt.ENG['dust_doubling_down_kg'], exhaust_filter_dust_kg=0.9 * 1.3 * rt.ENG['dust_doubling_exh_kg']) + m.working() + ta = m.read('truth.airflow') + self.assertGreater(ta['duty_down'], u0 + 0.05) # the ECM compensates the loading ... + self.assertAlmostEqual(ta['downflow_m3_s'] * 3600, 876.0, delta=3.0) # ... and holds the flow + c = Rig() + c.working() + c.call(c.E, 'fault.inject', fault='filter_clogged', active=True) + c.step(60.0) + self.assertEqual(c.read('airflow.status'), 'fail') + self.assertIn('AIRFLOW_FAIL', c.read('alarms.active')) + self.assertLess(c.read('truth.containment')['apf_log10'], c.read('truth.containment')['apf_log10'] + 1) + b = Rig() + b.working() + b.call(b.E, 'fault.inject', fault='exhaust_blower_failure', active=True) + b.step(60.0) + self.assertIn('AIRFLOW_FAIL', b.read('alarms.active')) + self.assertLess(b.read('truth.containment')['apf_log10'], 1.0) + CHECKS.append(dict(id='filter_loading', status='passed', layer='process', clean_duty=u0, loaded_duty=ta['duty_down'])) + + def test_barrier_disturbances(self): + base, draft, block = Rig(), Rig(cross_draft_m_s=0.3), Rig() + for g in (base, draft, block): + g.working() + block.call(block.A, 'item.place', item_id='rack', kind='closed_container', x_m=0.05, y_m=0.0, footprint_m2=0.25) + block.call(block.A, 'operator.set', arms_in=True, arm_speed_m_s=0.5) + a0 = base.read('truth.containment')['apf_log10'] + self.assertLess(draft.read('truth.containment')['apf_log10'], a0 - 0.5) + self.assertLess(block.read('truth.containment')['apf_log10'], a0 - 0.5) + r = block.call(block.A, 'item.place', item_id='front', kind='closed_container', x_m=0.05, y_m=0.4, footprint_m2=0.01) + self.assertTrue(any('150 mm' in n for n in r['notes'])) + + +class Hazards(unittest.TestCase): + def test_biological_aerosol_contained_and_ledger(self): + g = Rig() + g.working() + g.call(g.A, 'item.place', **SPRAY) + g.step(900.0) + L = g.ledger() + esc = L['proc_escaped'] / L['proc_generated'] + self.assertLess(esc, 1e-5) + self.assertGreater(L['proc_captured_down'] + L['proc_captured_exh'], 0.9 * L['proc_generated']) + self.assertLess(L['proc_emitted'] / L['proc_generated'], 1e-4) # exhaust filter penetration + _balance(self, L) + o = Rig() + o.working() + o.sash('up') + o.call(o.A, 'item.place', **SPRAY) + o.step(900.0) + L2 = o.ledger() + self.assertGreater(L2['proc_escaped'] / L2['proc_generated'], 100 * esc) + CHECKS.append(dict(id='aerosol_containment', status='passed', layer='process', escape_fraction_safe=esc, escape_fraction_full_open=L2['proc_escaped'] / L2['proc_generated'])) + + def test_chemical_vapour_recirculates_and_reaches_the_room(self): + g = Rig() + g.working() + r = g.call(g.A, 'item.place', **DISH) + self.assertTrue(any('不是化学通风柜' in n for n in r['notes'])) + g.step(1800.0) + it = g.read('truth.items')['dish'] + self.assertGreater(it['evaporated_kg'], 1e-3) # ~8 g/h from a 90 mm dish at 0.35 m/s + wz = g.call(g.E, 'truth.inspect')['workzone'] + self.assertIn('VOLATILE_CHEMICAL_RECIRCULATED', wz['conditions']) + v = wz['vapours']['ethanol'] + self.assertGreater(v['workzone_ppm'], 1.0) + L = g.ledger() + lv = L['vapour']['ethanol'] + self.assertGreater(lv['exhausted_to_room_kg'], 0.9 * lv['evaporated_kg'] - lv.get('in_air_kg', 0.0) - lv['escaped_front_kg'] - 1e-9) + # steady state: the exhaust carries away what evaporates, the plenum concentration is G / Q_exhaust (H14 does not retain vapour) + G = it['evaporation_rate_kg_s'] + self.assertAlmostEqual(v['plenum_kg_m3'], G / g.read('truth.airflow')['exhaust_m3_s'], delta=0.05 * v['plenum_kg_m3']) + g.call(g.A, 'item.remove', item_id='dish') + _balance(self, g.ledger()) + w = Rig() + w.working() + w.call(w.A, 'item.place', **dict(DISH, liquid='water')) + w.step(1800.0) + self.assertLess(w.read('truth.items')['dish']['evaporated_kg'], it['evaporated_kg']) # water is less volatile than ethanol + CHECKS.append(dict(id='solvent_vapour', status='passed', layer='process', ethanol_g_h=G * 3.6e6, workzone_ppm=v['workzone_ppm'])) + + def test_product_protection_and_iso_class(self): + g = Rig() + g.working() + iso_ok = g.read('truth.workzone')['iso_class_workzone'] + b = Rig() + b.working() + b.call(b.E, 'fault.inject', fault='downflow_blower_failure', active=True) + b.step(120.0) + self.assertLess(b.read('truth.containment')['ppf_log10'], 2.0) + self.assertGreater(b.read('truth.workzone')['iso_class_workzone'], iso_ok + 2.0) + leak = Rig() + leak.working() + leak.call(leak.E, 'fault.inject', fault='downflow_filter_leak', active=True) + leak.step(120.0) + self.assertGreater(leak.read('truth.workzone')['iso_class_workzone'], iso_ok + 1.5) + + def test_monitor_disabled_outside_ambient_range_and_sensor_faults(self): + g = Rig(ambient_k=305.15) + g.working() + self.assertEqual(g.read('airflow.status'), 'disabled') + self.assertIsNone(g.read('display.inflow_m_s')) + s = Rig() + s.working() + s.call(s.E, 'fault.inject', fault='sash_sensor_error', active=True) + s.step(1.0) + self.assertIn('SASH_ERROR', s.read('alarms.active')) + s.call(s.A, 'sash.move', expect='SASH_SENSOR_ERROR', direction='up') + u = Rig() + u.working() + u.call(u.E, 'fault.inject', fault='airflow_sensor_uncalibrated', active=True) + u.step(1.0) + self.assertIn('SENSOR_UNCALIBRATED', u.read('alarms.active')) + + def test_meters_power_off_and_datalog(self): + g = Rig(filter_hours_h=9999.9, uv_hours_h=10.0, sash_cycles=14999) + g.working() + g.step(600.0) + al = g.read('alarms.active') + self.assertIn('FILTER_LIFE', al) + self.assertIn('REPLACE_SASH_MOTOR', al) + d = g.call(g.A, 'datalog.read', last=5) + self.assertGreaterEqual(len(d['records']), 5) + e0 = g.ledger()['electrical_energy_j'] + g.call(g.A, 'power.set', on=False) + self.assertEqual(g.read('fan.state'), 'off') + self.assertFalse(g.read('indicator.fan')) + g.step(60.0) + self.assertLess(g.ledger()['electrical_energy_j'] - e0, 1.0) + g.call(g.A, 'power.toggle') + self.assertTrue(g.read('power.on')) + g.call(g.A, 'socket.toggle') + self.assertTrue(g.read('indicator.light')) + + +class ReviewR1(unittest.TestCase): + """Round-1 runtime review regressions (R1-02 closed sash, R1-03 clog clear, R1-04 downflow failure, R1-05 fans off, R1-07 hold, R1-10 ISO range).""" + def test_closed_sash_with_fan_on_no_runaway(self): + g = Rig() + g.working() + self.assertTrue(g.read('lamp.on')) + g.call(g.A, 'lamp.toggle') + self.assertFalse(g.read('lamp.on')) + g.sash('down') + g.step(120.0) + self.assertEqual(g.read('airflow.status'), 'sash_closed') + self.assertNotIn('AIRFLOW_FAIL', g.read('alarms.active')) + self.assertLess(g.read('truth.airflow')['exhaust_m3_s'], 0.75 * rt.Q_EXH_NOM) + + def test_clog_clear_restores_loading(self): + g = Rig() + g.working() + d0 = g.read('truth.airflow')['dust_down_kg'] + g.call(g.E, 'fault.inject', fault='filter_clogged', active=True) + g.step(30.0) + self.assertGreater(g.read('truth.airflow')['dust_down_kg'], d0 + rt.ENG['dust_doubling_down_kg']) + g.call(g.E, 'fault.inject', fault='filter_clogged', active=False) + self.assertLess(g.read('truth.airflow')['dust_down_kg'], d0 + 1e-6) + g.step(120.0) + self.assertEqual(g.read('airflow.status'), 'ok') + + def test_downflow_failure_bounded(self): + g = Rig() + g.working() + g.call(g.E, 'fault.inject', fault='downflow_blower_failure', active=True) + g.step(3600.0) + wz = g.read('truth.workzone') + self.assertLessEqual(wz['room_particles_workzone_m3'], rt.PLANT_EXAMPLE['room_particles_m3'] * 1.0001) + self.assertLessEqual(wz['iso_class_workzone'], 9.0) + _balance(self, g.ledger()) + + def test_fans_off_closed_sash_retains_vapour(self): + g = Rig() + g.on() + g.sash('up') + g.call(g.A, 'item.place', **dict(DISH, liquid='acetone', liquid_mass_kg=0.0253)) + g.call(g.A, 'item.place', **SPRAY) + g.sash('down') + g.step(3600.0) + L = g.ledger() + v = L['vapour']['acetone'] + self.assertLess(v['escaped_front_kg'] + v['exhausted_to_room_kg'], 0.2 * v['evaporated_kg']) + self.assertLess(L['proc_escaped'], 0.2 * L['proc_generated']) + _balance(self, L) + + def test_hold_moves_speed_times_hold(self): + g = Rig() + g.on() + g.step(0.3) + g.call(g.A, 'sash.move', direction='up', hold_s=1.0) + g.step(5.0) + self.assertAlmostEqual(g.read('sash.opening_m'), rt.ENG['sash_speed_m_s'] * 1.0, delta=1e-9) + + +class ReviewR2(unittest.TestCase): + """Round-2 review regressions: exhaust failure with the downflow running lets releases out (R2-03), coast-down is continuous (R2-02), + post-purge with a closed sash (R2-01), mute refused in standby (R2-04).""" + def test_exhaust_failure_releases_escape(self): + g = Rig() + g.working() + g.call(g.A, 'item.place', **SPRAY) + g.call(g.E, 'fault.inject', fault='exhaust_blower_failure', active=True) + g.step(600.0) + L = g.ledger() + self.assertGreater(L['proc_escaped'], 0.1 * L['proc_generated']) + self.assertGreater(g.read('truth.containment')['aerosol_escape_rate_per_s'], 0.1 * SPRAY['aerosol_rate_per_s']) + _balance(self, L) + + def test_coast_down_escape_continuous(self): + g = Rig() + g.working() + g.call(g.A, 'item.place', **SPRAY) + g.call(g.A, 'settings.configure', post_purge_s=0.0) + g.call(g.A, 'fan.toggle') + rates = [] + for _ in range(80): + g.step(0.5) + rates.append(g.read('truth.containment')['aerosol_escape_rate_per_s']) + jumps = [abs(b - a) for a, b in zip(rates[16:], rates[17:])] # after the barrier collapse (exhaust well below the exchange flow) + self.assertLess(max(jumps), 0.1 * SPRAY['aerosol_rate_per_s']) # hand-over from direct escape to exchange without a step + self.assertGreater(max(rates), 0.5 * SPRAY['aerosol_rate_per_s']) + _balance(self, g.ledger()) + + def test_post_purge_closed_sash_and_mute_in_standby(self): + g = Rig() + g.working() + g.call(g.A, 'settings.configure', post_purge_s=300.0) + g.call(g.A, 'fan.toggle') + g.sash('down') + self.assertEqual(g.read('fan.state'), 'post_purge') + self.assertEqual(g.read('airflow.status'), 'sash_closed') + h = Rig() + h.working() + h.call(h.A, 'fan.set', state='standby') + h.call(h.E, 'fault.inject', fault='sash_sensor_error', active=True) + h.call(h.A, 'alarm.mute', expect='STANDBY') + + +class ZCoverage(unittest.TestCase): + def test_all_capabilities_exercised(self): + implemented = {k for k in rt.CAPS if k not in rt.UNSUPPORTED} + missing = implemented - SEEN_CAPS + if len(SEEN_CAPS) > 5: + self.assertFalse(missing, sorted(missing)) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_asset_esco_efa5uduvw.py b/tests/test_asset_esco_efa5uduvw.py new file mode 100644 index 0000000000000000000000000000000000000000..e57fca197cdbb06661e077e50abcba9b2548d1cb --- /dev/null +++ b/tests/test_asset_esco_efa5uduvw.py @@ -0,0 +1,579 @@ +"""tests for CHEM-199 esco_efa5uduvw (Esco Frontier Acela EFA-5UDUVW-9 fume hood with the Sentinel XL monitor): python3 -m unittest tests/test_asset_esco_efa5uduvw.py + +Themes: contract consistency (slots, effects, errors raised vs declared); agent / evaluator truth isolation; idempotent request ids; two instances +isolated; step-partition and idle-skip exactness; rejected calls leave the state unchanged; every output validated against its schema and every +success changes only declared slots; the six documented operating points (flow per face velocity and static pressure); building exhaust with a +damper, dedicated blower on the fan switch, constant volume, blower failure and duct blockage; sash stop, Creep Down, hold and key lock; +Sentinel XL: uncalibrated gain and field calibration, low / high alarm with delay, mute, night setback, self test, menu, PIN, units; vapour +sources: evaporation ordering, drying, NIOSH REL, containment against velocity and cross draft (ASHRAE tracer at the design point); gas and +water fixtures; lighting; mains outage; liquid and vapour ledgers close.""" +import json +import math +import re +import sys +import unittest +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / 'scripts')) +from asset_runtime import esco_efa5uduvw as rt # noqa: E402 + +INST = 'esco_efa5uduvw_01' +CHECKS = [] +SEEN_CAPS = set() +PROCESS_EVIDENCE = {} +CMH = 1.0 / 3600.0 + + +def _differ(x, y): + if isinstance(x, float) and isinstance(y, float): + return abs(x - y) > 1e-12 * max(1.0, abs(x), abs(y)) + return json.dumps(x, sort_keys=True, default=str) != json.dumps(y, sort_keys=True, default=str) + + +class Rig: + def __init__(self, seed=1, instance=INST, **plant): + self.h = rt.EscoEfa5uduvwRuntime(instance) + self.h.register_principal('agent', 'agent') + self.h.register_principal('eval', 'evaluator') + self.A = self.h.session('agent') + self.E = self.h.session('eval') + self.n = 0 + self.inst = instance + self.call(self.E, 'plant.configure', **dict(rt.PLANT_EXAMPLE, noise_seed=seed, **plant)) + + def call(self, sess, cap, expect='succeeded', **args): + self.n += 1 + before, t0 = self.h.read('evaluator'), self.h.t + r = sess.invoke(instance_id=self.inst, capability_id=cap, arguments=args, request_id=f'r{self.n}') + after = self.h.read('evaluator') + changed = {k for k in after if _differ(after[k], before[k])} - {'clock.time_s'} + if expect == 'succeeded': + assert r['status'] == 'succeeded', (cap, r['error']) + rt.validate(rt.CAPS[cap]['output_schema'], r['result']) + allowed = set(rt.EFFECTS.get(cap, [])) | (set(rt.ON_STEP['sim.step']) if cap == 'sim.step' else set()) + extra = changed - allowed + assert not extra, (cap, sorted(extra)) + if cap != 'sim.step': + assert self.h.t == t0, cap + SEEN_CAPS.add(cap) + PROCESS_EVIDENCE.setdefault(cap, []).append(dict(arguments=json.dumps(args, sort_keys=True, default=str)[:200], time_s=t0, status=r['status'])) + return r['result'] + assert r['status'] in ('rejected', 'unsupported'), (cap, r['status'], r.get('result')) + assert r['error']['code'] == expect, (cap, r['error']['code'], expect) + assert not changed, (cap, 'rejected call changed', sorted(changed)) + assert expect in [e['code'] for e in rt.export_esco_efa5uduvw_contract_metadata()['capabilities'][cap]['errors']], (cap, expect) + return r + + def step(self, s): + self.call(self.E, 'sim.step', dt_s=float(s)) + + def read(self, *ids, who=None): + sess = who or self.E + o = sess.read(instance_id=self.inst, state_ids=list(ids) if ids else None)['observations'] + return {k: v['value'] for k, v in o.items()} if not ids or len(ids) > 1 else o[ids[0]]['value'] + + def truth(self): + return self.read('truth.process') + + def cv(self, v=0.31, h=0.457): + """Constant-volume exhaust giving face velocity v at sash h.""" + self.call(self.E, 'exhaust.configure', mode='constant_volume', flow_m3_s=v * rt.a_eff(h)) + self.call(self.A, 'sash.set', height_m=h, hold=h > rt.H_STOP) + + def settle(self): + self.step(30.0) + + def calibrate(self): + v = self.call(self.A, 'anemometer.measure')['face_velocity_m_s'] # the agent's own reference (no truth) + r = self.call(self.A, 'monitor.calibrate', reference_m_s=round(v, 3)) + assert set(r) == {'calibrated', 'reading_m_s'}, r + self.step(10.0) + + def ledger(self): + return self.call(self.E, 'ledger.read')['ledger'] + + def events(self, who=None): + return [e['code'] for e in self.call(who or self.E, 'events.read', since_s=0.0)['events']] + + +def _balance(test, L): + test.assertLess(L['worst_liquid_balance_kg'], 1e-12, L) + test.assertLess(L['worst_vapour_balance_kg'], 1e-12, L) + + +def _raised_codes(): + src = Path(rt.__file__).read_text() + funcs = {} + for m in re.finditer(r'\n def (\w+)\(self[^\n]*\n(.*?)(?=\n def |\n# ----|\nclass |\ndef )', src, re.S): + funcs[m.group(1)] = m.group(2) + own = {k: set(re.findall(r"ActionRejected\('([A-Z_]+)'\)", v)) for k, v in funcs.items()} + calls = {k: set(re.findall(r'self\.(_\w+)\(', v)) & set(funcs) for k, v in funcs.items()} + out = {} + for k in funcs: + if not k.startswith('_cmd_'): + continue + seen, todo, codes = set(), [k], set() + while todo: + f = todo.pop() + if f in seen: + continue + seen.add(f) + codes |= own.get(f, set()) + todo += [g for g in calls.get(f, ()) if g not in ('_cmd_sim_step', 'step', '_tick')] + out[k] = codes + name = {'_cmd_' + c.replace('.', '_'): c for c in rt.CAPS} + return {name[k]: v for k, v in out.items() if k in name} + + +class Contract(unittest.TestCase): + def test_metadata_slots_effects_consistent(self): + m = rt.export_esco_efa5uduvw_contract_metadata() + for k, c in m['capabilities'].items(): + for e in c['state_effects']: + self.assertIn(e['state_id'], m['state_slots'], (k, e)) + for p in c['preconditions']: + for s in p['state_ids']: + self.assertIn(s, m['state_slots'], (k, s)) + for s in rt.SCENE_MIRRORED: + self.assertIn(s, rt.SLOTS) + self.assertEqual(rt.SLOTS[s]['visibility'], 'agent') + units = {p['unit'] for p in m['mechanisms']['fume_hood_process']['parameters'].values()} + self.assertFalse(units & {'deg', 'degC', 'mm', 'cmh'}, units) + CHECKS.append(dict(id='metadata_consistent')) + + def test_declared_errors_cover_raised_codes(self): + m = rt.export_esco_efa5uduvw_contract_metadata() + for cap, codes in _raised_codes().items(): + declared = {e['code'] for e in m['capabilities'][cap]['errors']} + self.assertFalse(codes - declared, (cap, codes - declared)) + + def test_unsupported_capabilities(self): + g = Rig() + for k in rt.UNSUPPORTED: + r = g.A.invoke(instance_id=INST, capability_id=k, arguments={}, request_id='u' + k) + self.assertEqual((r['status'], r['error']['code']), ('unsupported', 'UNSUPPORTED')) + + def test_agent_truth_isolation(self): + g = Rig() + obs = g.A.read(instance_id=INST)['observations'] + self.assertFalse([k for k in obs if k.startswith('truth.')]) + for cap, args in (('truth.inspect', {}), ('ledger.read', {}), ('fault.inject', dict(fault='blower_failure', active=True)), ('sim.step', dict(dt_s=1.0)), + ('plant.configure', dict(rt.PLANT_EXAMPLE)), ('tracer.release', dict(rate_l_min=4.0)), ('disturbance.configure', dict(cross_draft_m_s=0.2))): + r = g.A.invoke(instance_id=INST, capability_id=cap, arguments=args, request_id='x' + cap) + self.assertEqual(r['error']['code'], 'ACCESS_DENIED') + g.cv(0.1) + g.call(g.A, 'source.place', source_id='tol', liquid_id='toluene' if 'toluene' in rt.LIQ else 'benzene', mass_kg=1.0, area_m2=0.1) + g.step(5.0) + self.assertIn('BZ_OVER_REL', g.events()) # truth-only event + self.assertNotIn('BZ_OVER_REL', g.events(g.A)) + + def test_idempotent_request_ids(self): + g = Rig() + r1 = g.A.invoke(instance_id=INST, capability_id='light.toggle', arguments={}, request_id='same') + r2 = g.A.invoke(instance_id=INST, capability_id='light.toggle', arguments={}, request_id='same') + self.assertEqual(r1, r2) + self.assertTrue(g.read('light.on')) + r3 = g.A.invoke(instance_id=INST, capability_id='light.set', arguments=dict(on=False), request_id='same') + self.assertEqual(r3['error']['code'], 'REQUEST_CONFLICT') + + def test_two_instances_isolated(self): + a, b = Rig(instance='a'), Rig(instance='b') + a.cv() + a.step(10.0) + self.assertGreater(a.truth()['exhaust_flow_m3_s'], 0.1) + self.assertEqual(b.truth()['exhaust_flow_m3_s'], 0.0) + self.assertEqual(b.read('sash.height_m'), 0.0) + + def test_step_partition_and_skip_exact(self): + def run(parts): + g = Rig(seed=7) + g.call(g.E, 'exhaust.configure', mode='building', suction_pa=250.0, duct_k=3000.0, damper_open=0.6) + g.call(g.A, 'sash.set', height_m=0.62) + g.call(g.A, 'source.place', source_id='a', liquid_id='ethanol', mass_kg=0.01, area_m2=0.003) + g.call(g.A, 'source.place', source_id='b', liquid_id='water', mass_kg=0.05, area_m2=0.004) + g.call(g.A, 'fixture.set', fixture='gas', open_fraction=0.2) + g.call(g.A, 'monitor.press', key='test') + g.call(g.E, 'disturbance.configure', walk_by_s=4.0) + for dt in parts: + g.step(dt) + r = g.h.read('evaluator') + return json.dumps({k: r[k] for k in r if k != 'clock.time_s'}, sort_keys=True, default=float), g.ledger() + a, la = run([300.0]) + b, lb = run([0.1] * 3000) + c, lc = run([7.33] * 40 + [6.8]) + self.assertEqual(a, b) + self.assertEqual(a, c) + self.assertEqual(json.dumps(la, sort_keys=True), json.dumps(lb, sort_keys=True)) + _balance(self, la) + + def test_rejections_change_nothing(self): + g = Rig() + g.call(g.A, 'source.place', source_id='w', liquid_id='water', mass_kg=0.01, area_m2=0.001) + g.call(g.A, 'source.place', expect='DUPLICATE_ID', source_id='w', liquid_id='water', mass_kg=0.01, area_m2=0.001) + g.call(g.A, 'source.remove', expect='NO_SOURCE', source_id='zz') + if 'diethyl_ether' in rt.LIQ: + g2 = Rig(ambient_k=310.15) + g2.call(g2.A, 'source.place', expect='NOT_LIQUID', source_id='e', liquid_id='diethyl_ether', mass_kg=0.01, area_m2=0.001) + g.call(g.A, 'keylock.set', mode='closed') + g.call(g.A, 'sash.set', expect='SASH_LOCKED', height_m=0.2) + g.call(g.A, 'keylock.set', mode='limit') + g.call(g.A, 'sash.set', expect='ABOVE_STOP_LOCKED', height_m=0.6) + g.call(g.A, 'sash.set', height_m=0.3) + g.call(g.A, 'keylock.set', expect='SASH_NOT_CLOSED', mode='closed') + g.call(g.A, 'keylock.set', mode='off') + g.call(g.A, 'sash.set', height_m=0.6, hold=True) + g.call(g.A, 'keylock.set', expect='SASH_ABOVE_STOP', mode='limit') + g.call(g.A, 'monitor.configure', expect='OUT_OF_RANGE', low_alarm_m_s=0.6, high_alarm_m_s=0.5) + g.call(g.A, 'monitor.calibrate', expect='NOT_CALIBRATABLE', reference_m_s=0.3) # no exhaust: the sensor reads below range + g.call(g.A, 'monitor.configure', new_pin='1234') + g.call(g.A, 'monitor.configure', expect='PIN_INVALID', low_alarm_m_s=0.25) + g.call(g.E, 'plant.configure', expect='SEED_FIXED', **dict(rt.PLANT_EXAMPLE, noise_seed=99)) + g.call(g.E, 'fault.inject', fault='mains_outage', active=True) + g.call(g.A, 'monitor.press', expect='MONITOR_OFF', key='test') + + +class Airflow(unittest.TestCase): + def test_documented_operating_points(self): + for key in ('exhaust_design_30', 'exhaust_design_40', 'exhaust_design_50', 'exhaust_full_30', 'exhaust_full_40', 'exhaust_full_50'): + p = rt.DOC[key] + g = Rig() + g.call(g.E, 'exhaust.configure', mode='constant_volume', flow_m3_s=p['flow_m3_s']) + g.call(g.A, 'sash.set', height_m=p['sash_m'], hold=p['sash_m'] > rt.H_STOP) + g.settle() + T = g.truth() + self.assertAlmostEqual(T['face_velocity_m_s'] / p['face_velocity_m_s'], 1.0, delta=0.09, msg=key) # least-squares fit of the six points + self.assertAlmostEqual(T['hood_static_pa'] / p['static_pa'], 1.0, delta=0.08, msg=key) + + def test_building_exhaust_damper_and_sash(self): + g = Rig() + g.call(g.E, 'exhaust.configure', mode='building', suction_pa=250.0, duct_k=3000.0, damper_open=0.5) + g.call(g.A, 'sash.set', height_m=0.457) + g.settle() + q1 = g.truth()['exhaust_flow_m3_s'] + g.call(g.A, 'damper.set', open_fraction=1.0) + g.settle() + q2 = g.truth()['exhaust_flow_m3_s'] + self.assertGreater(q2, q1) + v457 = g.truth()['face_velocity_m_s'] + g.call(g.A, 'sash.set', height_m=0.2) + g.settle() + self.assertGreater(g.truth()['face_velocity_m_s'], v457) # smaller opening: faster face velocity + g.call(g.E, 'fault.inject', fault='duct_blockage', active=True) + g.settle() + self.assertLess(g.truth()['exhaust_flow_m3_s'], 0.2 * q2) + + def test_blower_needs_the_fan_switch(self): + g = Rig() + g.call(g.E, 'exhaust.configure', mode='blower', duct_k=2000.0, blower_speed=0.8) + g.call(g.A, 'sash.set', height_m=0.457) + g.settle() + self.assertEqual(g.truth()['exhaust_flow_m3_s'], 0.0) + g.call(g.A, 'fan.set', on=True) + g.step(1.0) + q1 = g.truth()['exhaust_flow_m3_s'] + g.settle() + q = g.truth()['exhaust_flow_m3_s'] + self.assertGreater(q, q1) # first-order response + g.call(g.A, 'blower.set_speed', speed=0.4) + g.settle() + g.settle() + self.assertAlmostEqual(g.truth()['exhaust_flow_m3_s'] / q, 0.5, delta=1e-6) + g.call(g.E, 'fault.inject', fault='blower_failure', active=True) + g.settle() + self.assertLess(g.truth()['exhaust_flow_m3_s'], 1e-6) # spinning down (tau 2 s) + g.call(g.E, 'fault.inject', fault='mains_outage', active=True) + self.assertFalse(g.read('outlets.powered')) + + def test_sash_stop_creep_down_hold_and_key_lock(self): + g = Rig() + g.call(g.A, 'sash.set', height_m=0.67) + g.step(5.0) + self.assertAlmostEqual(g.read('sash.height_m'), 0.67 - 5.0 * rt.ENG['creep_speed_m_s'], delta=1e-9) + g.step(10.0) + self.assertEqual(g.read('sash.height_m'), rt.H_STOP) # back on the 457 mm stop + self.assertIn('SASH_CREPT_DOWN', g.events(g.A)) + g.call(g.A, 'sash.set', height_m=0.67, hold=True) + g.step(20.0) + self.assertEqual(g.read('sash.height_m'), 0.67) + g.call(g.A, 'sash.release') + g.step(1.0) + self.assertLess(g.read('sash.height_m'), 0.67) + g.step(20.0) + g.call(g.A, 'keylock.set', mode='limit') + g.call(g.A, 'sash.set', height_m=0.0) + g.call(g.A, 'keylock.set', mode='closed') + self.assertEqual(g.read('keylock.mode'), 'closed') + + +class Monitor(unittest.TestCase): + def test_uncalibrated_gain_and_field_calibration(self): + g = Rig(seed=1) + g.cv(0.31) + g.settle() + T = g.truth() + self.assertNotAlmostEqual(T['sensor_gain'], 1.0, delta=0.005) + g.calibrate() + self.assertAlmostEqual(g.read('monitor.reading_m_s'), 0.31, delta=0.02) # anemometer +-2 % and 0.005 m/s, display noise + self.assertTrue(g.read('monitor.settings')['calibrated']) + self.assertTrue(g.read('indicator.safe')) + self.assertEqual(g.read('display.text'), 'SAFE') + + def test_low_alarm_delay_mute_and_clear(self): + g = Rig() + g.cv(0.4) + g.settle() + g.calibrate() + g.call(g.E, 'exhaust.configure', mode='constant_volume', flow_m3_s=0.15 * rt.a_eff(0.457)) + g.step(4.0) + self.assertIsNone(g.read('monitor.alarm')) # still within the alarm delay + g.step(10.0) + self.assertEqual(g.read('monitor.alarm'), 'low') + self.assertTrue(g.read('indicator.unsafe') and g.read('buzzer.on')) + self.assertEqual((g.read('display.text'), g.read('display.lcd_cells')), ('LOW AIRFLOW', 'Lo FLo')) + g.call(g.A, 'monitor.press', key='mute') + self.assertTrue(g.read('indicator.mute') and not g.read('buzzer.on')) + g.call(g.E, 'exhaust.configure', mode='constant_volume', flow_m3_s=0.4 * rt.a_eff(0.457)) + g.settle() + self.assertIsNone(g.read('monitor.alarm')) + self.assertFalse(g.read('monitor.muted')) + g.call(g.E, 'exhaust.configure', mode='constant_volume', flow_m3_s=0.85 * rt.a_eff(0.457)) + g.settle() + self.assertEqual(g.read('monitor.alarm'), 'high') + + def test_night_setback_self_test_menu_units_pin(self): + g = Rig() + g.cv(0.1) + g.settle() + self.assertEqual(g.read('monitor.alarm'), 'low') + g.call(g.A, 'monitor.night_setback', closed=True) + self.assertTrue(g.read('indicator.mute') and not g.read('buzzer.on')) + g.call(g.A, 'monitor.night_setback', closed=False) + g.call(g.A, 'monitor.press', key='test') + self.assertEqual(g.read('display.text'), 'SELF TEST') + self.assertTrue(g.read('indicator.safe') and g.read('indicator.unsafe') and g.read('indicator.mute') and g.read('buzzer.on')) + g.step(3.5) + self.assertNotEqual(g.read('display.text'), 'SELF TEST') + g.call(g.A, 'monitor.press', key='menu') + self.assertEqual(g.read('monitor.menu'), 'low') + for _ in range(5): + g.call(g.A, 'monitor.press', key='down') + g.call(g.A, 'monitor.press', key='set') + self.assertAlmostEqual(g.read('monitor.settings')['low_alarm_m_s'], 0.25, delta=1e-9) + g.call(g.A, 'monitor.press', key='menu') + g.call(g.A, 'monitor.press', key='menu') + self.assertEqual(g.read('monitor.menu'), 'units') + g.call(g.A, 'monitor.press', key='up') + g.call(g.A, 'monitor.press', key='set') + self.assertEqual(g.read('monitor.settings')['units'], 'imperial') + g.step(31.0) + self.assertIsNone(g.read('monitor.menu')) # menu timeout + self.assertAlmostEqual(g.read('display.velocity'), g.read('monitor.reading_m_s') / rt.FPM, delta=1.1) # fpm, whole numbers + g.call(g.A, 'monitor.configure', new_pin='42', units='metric') + g.call(g.A, 'monitor.press', key='menu') + self.assertEqual(g.read('display.text'), 'PIN LOCKED') + g.call(g.A, 'monitor.configure', pin='42', high_alarm_m_s=0.8) + self.assertEqual(g.read('monitor.settings')['high_alarm_m_s'], 0.8) + + +class Vapours(unittest.TestCase): + def test_evaporation_drying_and_ledger(self): + g = Rig() + g.cv(0.4) + for sid, liq in (('a', 'acetone'), ('e', 'ethanol'), ('w', 'water')): + if liq in rt.LIQ: + g.call(g.A, 'source.place', source_id=sid, liquid_id=liq, mass_kg=0.002, area_m2=0.003) + g.step(60.0) + S = g.truth()['sources'] + if 'a' in S and 'e' in S: + self.assertGreater(S['a']['evaporation_kg_s'], S['e']['evaporation_kg_s']) + self.assertGreater(S['e']['evaporation_kg_s'], S['w']['evaporation_kg_s']) + g.step(3 * 3600.0) + self.assertIn('SOURCE_DRY', g.events(g.A)) + r = g.call(g.A, 'source.remove', source_id='w')['source'] + self.assertGreaterEqual(r['remaining_kg'], 0.0) + _balance(self, g.ledger()) + + def test_containment_tracer_against_velocity_and_cross_draft(self): + res = {} + for v, cross in ((0.31, 0.05), (0.2, 0.05), (0.31, 0.3)): + g = Rig() + g.cv(v) + g.call(g.E, 'disturbance.configure', cross_draft_m_s=cross) + g.call(g.E, 'tracer.release', rate_l_min=4.0) + g.settle() + res[(v, cross)] = g.call(g.E, 'truth.inspect')['process']['concentrations']['sulfur_hexafluoride']['breathing_zone_ppm'] + self.assertLess(res[(0.31, 0.05)], 0.010) # ASHRAE 110 certificate: < 0.010 ppm + self.assertGreater(res[(0.2, 0.05)], 100 * res[(0.31, 0.05)]) + self.assertGreater(res[(0.31, 0.3)], 10 * res[(0.31, 0.05)]) + g = Rig() + g.call(g.A, 'sash.set', height_m=0.457) + g.call(g.E, 'tracer.release', rate_l_min=4.0) + g.settle() + self.assertEqual(g.truth()['escape_fraction'], 1.0) # no exhaust: everything escapes + + def test_gas_and_water_fixtures(self): + g = Rig() + g.cv(0.3) + g.call(g.A, 'fixture.set', fixture='cold_water', open_fraction=1.0) + g.call(g.A, 'fixture.set', fixture='gas', open_fraction=1.0) + g.step(60.0) + L = g.ledger() + self.assertAlmostEqual(L['water_m3'], 60.0 * rt.ENG['water_supply']['max_flow_m3_s'], delta=1e-12) + self.assertGreater(L['substances']['methane']['exhausted_kg'], 0.0) + T = g.truth() + lfl = (1.0 - T['escape_fraction']) * T['gas_flow_m3_s'] / T['exhaust_flow_m3_s'] / rt.GAS['methane']['lower_flammable_limit'] + self.assertAlmostEqual(T['methane_exhaust_lfl_fraction'], lfl, delta=1e-9) # unlit gas: about 1 % of the LFL in the exhaust + self.assertLess(T['methane_exhaust_lfl_fraction'], 0.25) + self.assertNotIn('EXHAUST_FLAMMABLE', g.events()) + g.call(g.E, 'facility.configure', water_supply_pa=0.0) + self.assertEqual(g.truth()['water_flow_m3_s'], 0.0) + _balance(self, g.ledger()) + + +class Utilities(unittest.TestCase): + def test_light_and_mains_outage(self): + g = Rig() + g.call(g.A, 'light.set', on=True) + self.assertEqual((g.read('lamp.lit'), g.read('lighting.illuminance_lux')), (True, 915.0)) + g.call(g.E, 'fault.inject', fault='lamp_failure', active=True) + self.assertFalse(g.read('lamp.lit')) + g.call(g.E, 'fault.inject', fault='lamp_failure', active=False) + g.cv(0.4) + g.settle() + g.call(g.E, 'fault.inject', fault='mains_outage', active=True) + self.assertEqual((g.read('lamp.lit'), g.read('display.text'), g.read('monitor.reading_m_s')), (False, '', None)) + g.step(10.0) + self.assertGreater(g.truth()['exhaust_flow_m3_s'], 0.0) # the external exhaust keeps running + g.call(g.E, 'fault.inject', fault='mains_outage', active=False) + g.step(1.0) + self.assertTrue(g.read('lamp.lit')) + g.call(g.A, 'light.toggle') + g.call(g.A, 'fan.toggle') + g.call(g.E, 'facility.configure', gas_supply_pa=1000.0) + + def test_idle_skip_fast(self): + import time + g = Rig() + g.cv(0.4) + g.call(g.A, 'source.place', source_id='w', liquid_id='water', mass_kg=0.5, area_m2=0.01) + t0 = time.time() + g.step(30 * 86400.0) + self.assertLess(time.time() - t0, 2.0) + _balance(self, g.ledger()) + + +class ZCoverage(unittest.TestCase): + def test_all_capabilities_exercised(self): + missing = set(rt.CAPS) - set(rt.UNSUPPORTED) - SEEN_CAPS - {'events.read'} + if len(SEEN_CAPS) > 5: + self.assertFalse(missing, sorted(missing)) + + + +class ReviewR1(unittest.TestCase): + def test_calibration_hides_the_gain_and_uses_the_anemometer(self): + g = Rig(seed=3) + g.cv(0.31) + g.settle() + v_true = g.truth()['face_velocity_m_s'] + m = g.call(g.A, 'anemometer.measure') + self.assertEqual(m['points'], 18) + self.assertLess(abs(m['face_velocity_m_s'] / v_true - 1.0), 0.02 + 0.005 / v_true + 1e-9) + r = g.call(g.A, 'monitor.calibrate', reference_m_s=0.5) # a guessed reference is taken at face value + self.assertEqual(r, dict(calibrated=True, reading_m_s=0.5)) + self.assertNotIn('gain', json.dumps(g.read(who=g.A))) + g.call(g.A, 'sash.set', height_m=0.05) + g.call(g.A, 'anemometer.measure', expect='SASH_TOO_LOW') + + def test_alarm_outside_the_display_range(self): + g = Rig() + g.call(g.A, 'monitor.configure', low_alarm_m_s=0.2, high_alarm_m_s=0.9) + g.call(g.A, 'sash.set', height_m=0.457) + g.step(20.0) # no exhaust: the signal is below 0.2 m/s + self.assertEqual(g.read('display.velocity'), 0.2) + self.assertEqual(g.read('monitor.alarm'), 'low') + g.cv(1.2) + g.step(30.0) + self.assertEqual(g.read('display.velocity'), 0.9) + self.assertEqual(g.read('monitor.alarm'), 'high') + + def test_mains_outage_darkens_the_monitor_at_once(self): + g = Rig() + g.call(g.A, 'sash.set', height_m=0.457) + g.step(20.0) + self.assertEqual(g.read('monitor.alarm'), 'low') + g.call(g.E, 'fault.inject', fault='mains_outage', active=True) + self.assertIsNone(g.read('monitor.alarm')) + self.assertFalse(g.read('buzzer.on') or g.read('indicator.unsafe')) + self.assertIsNone(g.read('monitor.reading_m_s')) + + def test_exhaust_configure_keeps_an_omitted_damper(self): + g = Rig() + g.call(g.E, 'exhaust.configure', mode='building', damper_open=0.5) + g.call(g.E, 'exhaust.configure', mode='building', suction_pa=300.0) + self.assertEqual(g.read('exhaust.controls')['damper_open'], 0.5) + g.call(g.E, 'exhaust.configure', mode='building', damper_open=None) + self.assertIsNone(g.read('exhaust.controls')['damper_open']) + self.assertNotIn('exhaust.configure', g.A.describe(instance_id=INST)['capabilities']) + + def test_bypass_keeps_the_closed_sash_below_the_high_alarm(self): + g = Rig() + g.call(g.E, 'exhaust.configure', mode='building') + for h in (0.0, 0.1, 0.2, 0.457): + g.call(g.A, 'sash.set', height_m=h) + g.step(30.0) + self.assertIsNone(g.read('monitor.alarm'), h) + self.assertLess(g.truth()['face_velocity_m_s'], 0.7) + + def test_containment_degrades_gradually(self): + e = [rt.escape_fraction(v - 0.025, 0.2) for v in (0.1, 0.15, 0.2, 0.25, 0.3)] # face velocity with the default 0.05 m/s cross draft + self.assertTrue(all(a > b for a, b in zip(e, e[1:]))) + self.assertTrue(0.02 < e[1] < 0.5 and 1e-3 < e[2] < 0.02 and e[3] < 1e-3) + + + +class ReviewR2(unittest.TestCase): + def test_nullable_arguments_are_validated(self): + g = Rig() + for bad in (0.0, 0.01, -3.0, 'abc', [1], {'a': 1}): + g.call(g.E, 'exhaust.configure', expect='INVALID_ARGUMENT', mode='building', damper_open=bad) + for bad in (1234, {'p': 1}, 'x' * 500): + g.call(g.A, 'monitor.configure', expect='INVALID_ARGUMENT', pin=bad) + g.call(g.E, 'exhaust.configure', mode='building', damper_open=None) + g.step(5.0) + + def test_agent_cannot_see_the_facility_exhaust(self): + g = Rig() + g.call(g.E, 'exhaust.configure', mode='building', suction_pa=250.0, duct_k=3000.0, damper_open=0.6) + obs = g.read(who=g.A) + self.assertNotIn('exhaust.state', obs) + self.assertEqual(obs['exhaust.controls'], dict(damper_open=0.6, blower_speed=1.0)) + self.assertNotIn('EXHAUST_CONFIGURED', g.events(g.A)) + self.assertIn('EXHAUST_CONFIGURED', g.events(g.E)) + g.call(g.A, 'damper.set', open_fraction=0.4) + self.assertEqual(g.read('exhaust.controls', who=g.A)['damper_open'], 0.4) + + + +class ReviewR3(unittest.TestCase): + def test_branch_suction_and_duct_are_seeded(self): + vals = set() + for seed in (1, 2, 3): + g = Rig(seed=seed) + e = g.read('exhaust.state') + self.assertTrue(200.0 <= e['suction_pa'] <= 300.0 and 2100.0 <= e['duct_k'] <= 3900.0, e) + self.assertNotEqual((e['suction_pa'], e['duct_k']), (rt.ENG['building_suction_pa'], rt.ENG['duct_k'])) + vals.add(round(e['suction_pa'], 6)) + self.assertEqual(len(vals), 3) + + def test_damper_set_needs_a_damper(self): + g = Rig() + g.call(g.E, 'exhaust.configure', mode='building') + g.call(g.A, 'damper.set', expect='NO_DAMPER', open_fraction=0.3) + g.call(g.E, 'exhaust.configure', mode='building', damper_open=1.0) + g.call(g.A, 'damper.set', open_fraction=0.3) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_asset_evident_bx53p.py b/tests/test_asset_evident_bx53p.py new file mode 100644 index 0000000000000000000000000000000000000000..fab4bc22aa8ccb7b1ef5aee45b448d9138f81dbb --- /dev/null +++ b/tests/test_asset_evident_bx53p.py @@ -0,0 +1,910 @@ +"""tests for CHEM-162 evident_bx53p: python3 -m unittest tests/test_asset_evident_bx53p.py + +Topics (pipeline.md): set points only write targets, read/describe are pure, rejected preconditions leave the state unchanged, two instances +are isolated, agent/evaluator truth isolation, conservation (electrical energy = electronics + LED power x time; frame / exposure / rotation +ledgers), real return values validated against the declared schemas (asset_tool validate_value), asynchronous completion and cancellation +remnants, host-step independence, declared immediate and on_step effects over scenario states; plus the polarized-light physics: extinction of a +birefringent crystal when its vibration directions are parallel to the polarizer, maximum brightness at 45 deg, Michel-Levy colours (quartz 30 um +first-order white/yellow, calcite high-order white), the first-order red plate (magenta on isotropic, addition / subtraction with a quartz section), +isotropic sections dark between crossed polars, a nematic Schlieren texture, the extinction scan against the truth, the retardation estimate with +a non-unique candidate list, objectives (field of view FN 22 / M, defocus, oil), condenser top lens and iris, click stops, camera saturation, faults. +""" +import copy +import json +import math +import sys +import unittest +from pathlib import Path + +import numpy as np + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / 'scripts')) +sys.path.insert(0, str(ROOT / 'skills/chemistry-lab-assets/scripts')) +from asset_runtime import evident_bx53p as rt # noqa: E402 +import asset_tool # noqa: E402 + +DEG = rt.DEG +CHECKS, PROCESS_EVIDENCE, REJECTIONS = [], {}, {} +_META = {} + + +def _meta(): + if not _META: + _META.update(rt.export_evident_bx53p_contract_metadata()) + return _META + + +def _changed(a, b): + return json.dumps(a, sort_keys=True, default=str) != json.dumps(b, sort_keys=True, default=str) + + +_orig_invoke = rt.EvidentBx53pRuntime.invoke + + +def _instrumented_invoke(self, capability_id, **a): + """Every successful call is checked against its declared output schema and immediate state effects (a call does not advance time); every + rejection code is recorded for the declaration check.""" + before = self.read('evaluator') if capability_id != 'sim.step' else None + t0 = self.t + try: + out = _orig_invoke(self, capability_id, **a) + except rt.ActionRejected as exc: + REJECTIONS.setdefault(capability_id, set()).add(str(exc)) + raise + meta = _meta()['capabilities'][capability_id] + errs = asset_tool.validate_value(out, meta['output_schema']) + if errs: + raise AssertionError(f'{capability_id} output violates its schema: {errs[:3]}') + if before is not None: + assert self.t == t0, capability_id + after = self.read('evaluator') + undeclared = {k for k in after if _changed(before[k], after[k])} - set(rt.EFFECTS.get(capability_id, [])) + if undeclared: + raise AssertionError(f'{capability_id} changed undeclared state immediately: {sorted(undeclared)}') + PROCESS_EVIDENCE.setdefault(capability_id, []).append(dict(arguments=copy.deepcopy(a), result_keys=sorted(out))) + return out + + +rt.EvidentBx53pRuntime.invoke = _instrumented_invoke + +QUARTZ = dict(rt.SAMPLE_EXAMPLE) +QUARTZ_XTAL = dict(QUARTZ, sample_id='quartz_plate', kind='single_crystal', grains=1, orientation=dict(tilt_rad=math.pi / 2, azimuth_rad=0.0, spin_rad=0.0)) +CALCITE_XTAL = dict(QUARTZ_XTAL, sample_id='calcite_plate', substance_id='main_caco3') +LC = dict(QUARTZ, sample_id='lc_cell', kind='liquid_crystal', substance_id='other_5cb', thickness_m=5e-6, grains=1, defects=4) +GLASS = dict(QUARTZ, sample_id='glass', kind='isotropic', substance_id=None, grains=1) +THICK = dict(QUARTZ, sample_id='thick_slide', slide_thickness_m=2.0e-3) +OIL = dict(QUARTZ, sample_id='oiled', immersion_oil=True) + + +def configured(seed=1, **plant): + h = rt.EvidentBx53pRuntime() + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, noise_seed=seed, **plant)) + return h + + +def ready(seed=1): + h = configured(seed) + h.invoke('power.set', enabled=True) + h.invoke('illumination.set_level', level=0.6) + return h + + +def loaded(sample=QUARTZ, seed=1, objective=1): + h = ready(seed) + h.invoke('sample.provide', **sample) + h.invoke('sample.place', sample_id=sample['sample_id']) + h.invoke('objective.select', index=objective) + h.invoke('focus.move', stage_z_m=h._focus_target(h.samples[sample['sample_id']])) + return h + + +def wait(h, oid, tmax=600.0, dt=0.25): + t0 = h.t + while h.operations[oid]['phase'] == 'running' and h.t - t0 < tmax: + h.step(dt) + return h.operations[oid]['phase'] + + +def acquire(h): + oid = h.invoke('camera.acquire')['operation_id'] + assert wait(h, oid) == 'completed' + return h.records[h.operations[oid]['record_id']] + + +def center(r, half=4): + c = np.asarray(r['image']['counts'], float) + H, W = c.shape[:2] + return c[H // 2 - half:H // 2 + half, W // 2 - half:W // 2 + half].reshape(-1, 3).mean(0) + + +def check(cid, **detail): + CHECKS.append(dict(check=cid, status='passed', **detail)) + + +class ContractAndSchemas(unittest.TestCase): + def test_module_identity_and_export(self): + m = _meta() + self.assertEqual((rt.ASSET_TYPE_ID, rt.CATALOG_ID), ('instrument.evident_bx53p', 'CHEM-162')) + self.assertEqual(set(m['capabilities']), set(rt.CAPS)) + self.assertEqual(set(m['state_slots']), set(rt.SLOTS)) + for k, c in m['capabilities'].items(): + for sch in (c['input_schema'], c['output_schema']): + self.assertEqual(asset_tool.lint_schema(sch) if hasattr(asset_tool, 'lint_schema') else [], [], k) + self.assertTrue(c['errors'], k) + self.assertEqual(asset_tool.validate_value(c['example_arguments'], c['input_schema']), [], k) + for k, v in rt.EFFECTS.items(): + self.assertTrue(set(v) <= set(rt.SLOTS), k) + check('contract_export_consistent') + + def test_library_and_colour_data(self): + lib = rt.biref_lib() + self.assertGreaterEqual(len(lib['substances']), 50) + e = lib['substances']['main_caco3'] + self.assertAlmostEqual(e['n_589']['o'], 1.6583, delta=5e-4) + self.assertAlmostEqual(e['n_589']['e'], 1.4864, delta=5e-4) + q = lib['substances']['main_sio2'] + self.assertAlmostEqual(q['birefringence_589'], 0.0091, delta=3e-4) + self.assertTrue(all(e['source']['references'] for e in lib['substances'].values())) + cmf = rt.cmf() + self.assertEqual(cmf.shape, (len(rt.LAM_M), 3)) + self.assertAlmostEqual(float(rt.rgb_of(np.full(len(rt.LAM_M), 1.0)) @ np.array([0.2126, 0.7152, 0.0722])), 1.0, delta=0.02) + check('library_and_cie_data') + + +class HostClockAndPurity(unittest.TestCase): + def test_read_describe_are_pure_and_calls_do_not_advance_time(self): + h = loaded() + v0, t0 = h.read('evaluator'), h.t + h.register_principal('ag', 'agent') + h.session('ag').describe(instance_id=rt.INSTANCE) + h.session('ag').read(instance_id=rt.INSTANCE) + self.assertEqual(h.read('evaluator'), v0) + oid = h.invoke('camera.acquire')['operation_id'] + self.assertEqual(h.t, t0) + self.assertEqual(h.operations[oid]['phase'], 'running') + h.step(0.01) + self.assertEqual(h.operations[oid]['phase'], 'running') + h.step(1.0) + self.assertEqual(h.operations[oid]['phase'], 'completed') + + def test_step_partition_does_not_change_results(self): + a, b = loaded(seed=4), loaded(seed=4) + a.invoke('scan.extinction', step_rad=15 * DEG, region=None) + b.invoke('scan.extinction', step_rad=15 * DEG, region=None) + a.step(100.0) + for _ in range(400): + b.step(0.25) + ra, rb = a.records['SC0001'], b.records['SC0001'] + self.assertEqual(ra['scan'], rb['scan']) + self.assertAlmostEqual(a.ledger()['electrical_energy_j'], b.ledger()['electrical_energy_j'], delta=1e-6) + check('host_step_partition_independent') + + def test_energy_and_usage_ledgers(self): + h = ready() + e0 = h.ledger()['electrical_energy_j'] + h.step(100.0) + self.assertAlmostEqual(h.ledger()['electrical_energy_j'] - e0, (rt.IDLE_W + rt.LED_W_MAX * 0.6) * 100.0, delta=1e-6) + self.assertAlmostEqual(h.ledger()['led_energy_j'], rt.LED_W_MAX * 0.6 * 100.0, delta=1e-6) + h.invoke('illumination.set_level', level=1.0) + e1 = h.ledger()['electrical_energy_j'] + h.step(10.0) + self.assertAlmostEqual(h.ledger()['electrical_energy_j'] - e1, rt.POWER_W * 10.0, delta=1e-6) # documented approx. 24 W at full level + h.invoke('power.set', enabled=False) + e2 = h.ledger()['electrical_energy_j'] + h.step(50.0) + self.assertEqual(h.ledger()['electrical_energy_j'], e2) + g = loaded() + acquire(g) + g.invoke('stage.rotate', angle_rad=math.pi / 2) + L = g.ledger() + self.assertEqual(L['frames'], 1.0) + self.assertAlmostEqual(L['exposure_s'], 0.05, delta=1e-12) + self.assertAlmostEqual(L['stage_rotation_rad'], math.pi / 2, delta=1e-9) + check('energy_ledger_closes') + + +class Physics(unittest.TestCase): + def test_extinction_and_45_degree_brightness(self): + h = loaded(QUARTZ_XTAL) + dark = center(acquire(h)) + h.invoke('stage.rotate', angle_rad=math.pi / 4) + bright = center(acquire(h)) + self.assertLess(dark.mean(), 0.05 * bright.mean()) + self.assertGreater(bright.mean(), 50.0) + h.invoke('stage.rotate', angle_rad=math.pi / 2) + self.assertLess(center(acquire(h)).mean(), 0.05 * bright.mean()) # extinct every 90 deg + check('extinction_every_90_deg') + + def test_michel_levy_colours(self): + q = rt.chart(275e-9) + self.assertGreater(q[0], q[2]) + self.assertGreater(q[1], q[2]) # first-order white / pale yellow: blue lowest + red = rt.chart(530e-9) + self.assertGreater(red[0], red[1]) + self.assertGreater(red[2], red[1]) # first-order red: magenta, green lowest + blue2 = rt.chart(700e-9) + self.assertGreater(blue2[2], blue2[0]) # second-order blue + h = loaded(CALCITE_XTAL) + h.invoke('stage.rotate', angle_rad=math.pi / 4) + c = center(acquire(h)) + g = loaded(GLASS) + g.invoke('analyzer.set_inserted', inserted=False) + w = center(acquire(g)) + self.assertLess(np.abs(c / c.sum() - w / w.sum()).max(), 0.04) # high-order white: the lamp colour, no hue + check('michel_levy_colours') + + def test_tint_plate_on_isotropic_addition_and_subtraction(self): + g = loaded(GLASS) + g.invoke('compensator.insert', plate='U-TP530') + m = center(acquire(g)) + self.assertGreater(m[0], m[1]) + self.assertGreater(m[2], m[1]) # magenta background + h = loaded(QUARTZ_XTAL) # slow axis along the stage 0 direction (x) + h.invoke('compensator.insert', plate='U-TP530') # plate slow axis NE-SW = +45 deg in the image frame + h.invoke('stage.rotate', angle_rad=math.pi / 4) # sample slow axis parallel to the plate: addition + add = center(acquire(h)) + h.invoke('stage.rotate', angle_rad=3 * math.pi / 4) # perpendicular: subtraction + sub = center(acquire(h)) + R = h.read('evaluator')['truth.center_retardation_m'] + ref_add, ref_sub = rt.chart(R + 530e-9), rt.chart(530e-9 - R) # addition (805 nm, second-order green) / subtraction (255 nm) + chrom = lambda v: np.asarray(v) / np.sum(v) # noqa: E731 + qe = np.asarray(rt.CAMERA['qe']) / max(rt.CAMERA['qe']) + self.assertLess(np.abs(chrom(add) - chrom(ref_add * qe)).sum(), np.abs(chrom(add) - chrom(ref_sub * qe)).sum()) + self.assertLess(np.abs(chrom(sub) - chrom(ref_sub * qe)).sum(), np.abs(chrom(sub) - chrom(ref_add * qe)).sum()) + check('tint_plate_addition_subtraction') + + def test_isotropic_dark_and_open_analyzer(self): + g = loaded(GLASS) + dark = center(acquire(g)) + g.invoke('analyzer.set_inserted', inserted=False) + open_ = center(acquire(g)) + self.assertLess(dark.mean(), 0.01 * open_.mean()) + g.invoke('analyzer.set_inserted', inserted=True) + g.invoke('analyzer.set_angle', angle_rad=0.0) # parallel polars + par = center(acquire(g)) + self.assertGreater(par.mean(), 0.8 * open_.mean()) + check('isotropic_dark_crossed') + + def test_nematic_schlieren_texture(self): + h = loaded(LC) + r = acquire(h) + c = np.asarray(r['image']['counts'], float).mean(2) + H, W = c.shape + yy, xx = np.mgrid[0:H, 0:W] + inside = ((xx - (W - 1) / 2) ** 2 + (yy - (H - 1) / 2) ** 2) <= ((W - 1) / 2 * 0.95) ** 2 + frac_dark = float((c[inside] < 0.1 * np.percentile(c[inside], 95)).mean()) + self.assertGreater(frac_dark, 0.02) # dark brushes where the director is parallel to a polar + self.assertLess(frac_dark, 0.6) + h.invoke('stage.rotate', angle_rad=20 * DEG) + c2 = np.asarray(acquire(h)['image']['counts'], float).mean(2) + self.assertGreater(np.abs(c2 - c)[inside].mean(), 5.0) # the brushes rotate with the stage + check('nematic_schlieren') + + def test_extinction_scan_against_truth(self): + for az in (0.3, 1.1): + s = dict(QUARTZ_XTAL, sample_id=f'q{az}', orientation=dict(tilt_rad=math.pi / 2, azimuth_rad=az, spin_rad=0.0)) + h = loaded(s) + oid = h.invoke('scan.extinction', step_rad=5 * DEG, region=None)['operation_id'] + self.assertEqual(wait(h, oid), 'completed') + r = h.records[h.operations[oid]['record_id']] + truth = h.read('evaluator')['truth.center_slow_axis_rad'] + ext_truth = (-truth) % (math.pi / 2) # stage angle bringing the slow axis onto a polar + d = abs(((r['scan']['extinction_rad'] - ext_truth) + math.pi / 4) % (math.pi / 2) - math.pi / 4) + self.assertLess(d, 1.0 * DEG, az) + self.assertGreater(r['scan']['contrast'], 0.8) + self.assertEqual(h.stage, 0.0) # returns to the start angle + check('extinction_scan_recovers_truth') + + def test_retardation_estimate_is_not_a_phase_identification(self): + h = loaded(QUARTZ_XTAL) + h.invoke('stage.rotate', angle_rad=math.pi / 4) + r = acquire(h) + w = h.invoke('analysis.retardation', record_id=r['record_id'], region=None, thickness_m=30e-6) + R_true = h.read('evaluator')['truth.center_retardation_m'] + self.assertLess(abs(w['retardation_m'] - R_true) / R_true, 0.15) + self.assertFalse(w['unique_identification']) + ids = [c['substance_id'] for c in w['candidates']] + self.assertIn('main_sio2', ids) + self.assertGreater(len(ids), 5) + h.invoke('compensator.insert', plate='U-TP530') + r2 = acquire(h) + with self.assertRaises(rt.ActionRejected): + h.invoke('analysis.retardation', record_id=r2['record_id'], region=None, thickness_m=None) + check('retardation_candidates_not_unique') + + +class Conoscopy(unittest.TestCase): + def _figure(self, sid, orient, stage=0.0, t=300e-6): + h = loaded(dict(QUARTZ_XTAL, sample_id='c' + sid, substance_id=sid, thickness_m=t, orientation=orient), objective=2) + h.invoke('condenser.set_iris', diameter_m=21e-3) + h.invoke('camera.configure', exposure_s=0.01, gain=1.0) + h.invoke('bertrand.set_inserted', inserted=True) + h.invoke('stage.rotate', angle_rad=stage) + return h, acquire(h) + + def test_uniaxial_optic_axis_figure(self): + oa = dict(tilt_rad=0.0, azimuth_rad=0.0, spin_rad=0.0) + h, r = self._figure('main_caco3', oa) + self.assertIn('conoscopic', r['warnings']) + c = np.asarray(r['image']['counts'], float).mean(2) + H, W = c.shape + axis_vals = [c[H // 2, W // 2 + 20], c[H // 2, W // 2 - 20], c[H // 2 + 20, W // 2], c[H // 2 - 20, W // 2]] + diag_vals = [c[H // 2 + 14, W // 2 + 14], c[H // 2 - 14, W // 2 - 14]] + self.assertLess(max(axis_vals), 0.2 * min(diag_vals)) # isogyres along the polarizer and analyzer directions + _, r2 = self._figure('main_caco3', oa, stage=0.5) + self.assertLess(np.abs(np.asarray(r2['image']['counts'], float).mean(2) - c).mean(), 2.0) # the optic-axis figure does not move with the stage + with self.assertRaises(rt.ActionRejected) as cm: + h.invoke('analysis.retardation', record_id=r['record_id'], region=None, thickness_m=None) + self.assertEqual(str(cm.exception), 'CONOSCOPIC_IMAGE') + check('conoscopic_optic_axis_figure') + + def test_biaxial_figure_moves_and_focus_blurs(self): + o = dict(tilt_rad=0.3, azimuth_rad=0.0, spin_rad=0.0) + h, a = self._figure('main_ktiopo4', o) + _, b = self._figure('main_ktiopo4', o, stage=0.6) + self.assertGreater(np.abs(np.asarray(a['image']['counts'], float) - np.asarray(b['image']['counts'], float)).mean(), 50.0) + sharp = np.asarray(a['image']['counts'], float).std() + h.invoke('bertrand.focus', focus_rad=3.0) + self.assertLess(np.asarray(acquire(h)['image']['counts'], float).std(), sharp) + check('biaxial_figure_moves_bertrand_focus') + + +class OpticsAndMechanics(unittest.TestCase): + def test_objectives_fov_defocus_and_oil(self): + h = loaded(QUARTZ) + fovs = [] + for i in range(4): + fovs.append(h.invoke('objective.select', index=i)['fov_m']) + self.assertEqual([round(f * 1e3, 4) for f in fovs], [5.5, 2.2, 0.55, 0.22]) + h.invoke('objective.select', index=2) + sharp = np.asarray(acquire(h)['image']['counts'], float).std() + h.invoke('focus.move', stage_z_m=h.z + 100e-6) + blurred = np.asarray(acquire(h)['image']['counts'], float).std() + self.assertLess(blurred, 0.8 * sharp) + h.invoke('focus.move', stage_z_m=h._focus_target(h.samples['quartz_section'])) + h.invoke('objective.select', index=3) + self.assertIn('no_immersion_oil', acquire(h)['warnings']) + g = loaded(OIL, objective=3) + self.assertNotIn('no_immersion_oil', acquire(g)['warnings']) + check('objectives_fov_defocus_oil') + + def test_condenser_top_lens_iris_and_vignetting(self): + h = loaded(GLASS, objective=0) + h.invoke('analyzer.set_inserted', inserted=False) + self.assertIn('field_not_fully_illuminated', acquire(h)['warnings']) + h.invoke('condenser.set_top_lens', state='out') + self.assertNotIn('field_not_fully_illuminated', acquire(h)['warnings']) + h.invoke('objective.select', index=2) + self.assertIn('condenser_na_low', acquire(h)['warnings']) + h.invoke('condenser.set_top_lens', state='in') + wide = center(acquire(h)).mean() + h.invoke('condenser.set_iris', diameter_m=2e-3) + self.assertLess(center(acquire(h)).mean(), wide) + check('condenser_top_lens_iris') + + def test_click_stops_and_scales(self): + h = loaded() + self.assertTrue(h.invoke('stage.rotate', angle_rad=45.6 * DEG)['click_stop']) + self.assertAlmostEqual(h.stage, math.pi / 4, delta=1e-12) + out = h.invoke('stage.rotate', angle_rad=47.0 * DEG) + self.assertFalse(out['click_stop']) + self.assertAlmostEqual(out['indicated_rad'], math.radians(47.0), places=12) + self.assertEqual(h.invoke('polarizer.set_angle', angle_rad=0.6 * DEG)['angle_rad'], 0.0) + self.assertAlmostEqual(h.invoke('analyzer.set_angle', angle_rad=90.04 * DEG)['angle_rad'], 90.0 * DEG, delta=1e-9) + self.assertTrue(h.read()['optics.crossed']) + h.invoke('analyzer.set_angle', angle_rad=92.0 * DEG) + self.assertFalse(h.read()['optics.crossed']) + check('click_stops') + + def test_slide_limits_and_sample_rules(self): + h = ready() + h.invoke('sample.provide', **THICK) + with self.assertRaises(rt.ActionRejected) as cm: + h.invoke('sample.place', sample_id='thick_slide') + self.assertEqual(str(cm.exception), 'SLIDE_TOO_THICK') + for bad, code in ((dict(QUARTZ, sample_id='x', substance_id='nope'), 'UNKNOWN_SUBSTANCE'), + (dict(LC, sample_id='y', substance_id='main_ktiopo4'), 'NOT_A_LIQUID_CRYSTAL')): + with self.assertRaises(rt.ActionRejected) as cm: + h.invoke('sample.provide', **bad) + self.assertEqual(str(cm.exception), code) + h.invoke('sample.provide', **QUARTZ) + h.invoke('sample.place', sample_id='quartz_section') + h.invoke('sample.provide', **GLASS) + with self.assertRaises(rt.ActionRejected): + h.invoke('sample.place', sample_id='glass') + v0 = h.read('evaluator') + with self.assertRaises(rt.ActionRejected): + h.invoke('sample.remove', sample_id='glass') + self.assertEqual(h.read('evaluator'), v0) + h.invoke('sample.remove', sample_id='quartz_section') + self.assertIsNone(h.read()['sample.on_stage']) + + def test_camera_saturation_lamp_and_power(self): + h = loaded(GLASS) + h.invoke('analyzer.set_inserted', inserted=False) + h.invoke('camera.configure', exposure_s=2.0, gain=4.0) + self.assertIn('saturated', acquire(h)['warnings']) + h.invoke('power.press_switch') + self.assertFalse(h.read()['power.enabled']) + r = acquire(h) + self.assertIn('lamp_off', r['warnings']) + self.assertLess(r['image']['mean_counts'][1], 5.0) + h.invoke('power.press_switch') + self.assertTrue(h.read()['illumination.lamp_on']) + with self.assertRaises(rt.ActionRejected): + configured(mains_voltage_v=60.0).invoke('power.set', enabled=True) + + +class FaultsAndOperations(unittest.TestCase): + def test_faults(self): + h = loaded(GLASS) + h.invoke('analyzer.set_inserted', inserted=False) + h.invoke('fault.inject', fault='lamp_failure', active=True) + self.assertFalse(h.read()['illumination.lamp_on']) + self.assertLess(acquire(h)['image']['mean_counts'][1], 5.0) + h.invoke('fault.inject', fault='lamp_failure', active=False) + g = loaded(QUARTZ_XTAL) + g.invoke('stage.rotate', angle_rad=0.2) + oid = g.invoke('scan.extinction', step_rad=10 * DEG, region=None)['operation_id'] + g.step(15.0) + self.assertNotAlmostEqual(g.stage, 0.2, places=6) + g.invoke('fault.inject', fault='camera_disconnected', active=True) + self.assertEqual(g.operations[oid]['phase'], 'failed') + self.assertAlmostEqual(g.stage, 0.2, delta=1e-12) + self.assertGreater(len(g.records['SC0001']['scan']['stage_rad']), 0) + with self.assertRaises(rt.ActionRejected) as cm: + g.invoke('camera.acquire') + self.assertEqual(str(cm.exception), 'CAMERA_FAULT') + v = loaded(QUARTZ) + v.invoke('fault.inject', fault='vibration', active=True) + self.assertLess(np.asarray(acquire(v)['image']['counts'], float).std(), np.asarray(acquire(loaded(QUARTZ))['image']['counts'], float).std()) + + def test_cancellation_keeps_partial_scan_and_restores_the_stage(self): + h = loaded(QUARTZ_XTAL) + h.register_principal('ag', 'agent') + s = h.session('ag') + r = s.invoke(instance_id=rt.INSTANCE, capability_id='scan.extinction', arguments=dict(step_rad=10 * DEG, region=None), request_id='scan1') + self.assertEqual(r['status'], 'accepted') + h.step(12.0) + c = s.cancel(r['operation_id'], 'c1') + self.assertEqual(c['result']['phase'], 'cancelled') + rec = h.records['SC0001'] + self.assertEqual(rec['status'], 'cancelled') + self.assertEqual(len(rec['scan']['stage_rad']), 5) + self.assertEqual(h.stage, 0.0) + self.assertIsNone(h.op) + with self.assertRaises(rt.ActionRejected): + s.cancel(r['operation_id'], 'c2') + + def test_operation_blocks_manual_parts(self): + h = loaded() + h.invoke('camera.acquire') + for k, a in (('stage.rotate', dict(angle_rad=1.0)), ('objective.select', dict(index=0)), ('focus.move', dict(stage_z_m=0.0)), + ('analyzer.set_inserted', dict(inserted=False)), ('camera.acquire', {})): + v0 = h.read('evaluator') + with self.assertRaises(rt.ActionRejected) as cm: + h.invoke(k, **a) + self.assertEqual(str(cm.exception), 'OPERATION_RUNNING') + self.assertEqual(h.read('evaluator'), v0) + + +class RecordsSessions(unittest.TestCase): + def test_two_instances_are_isolated(self): + a, b = loaded(), loaded() + acquire(a) + a.invoke('stage.rotate', angle_rad=1.0) + self.assertEqual(b.records, {}) + self.assertEqual(b.stage, 0.0) + self.assertEqual(b.ledger()['frames'], 0.0) + + def test_agent_truth_isolation(self): + h = loaded(QUARTZ_XTAL) + h.register_principal('ag', 'agent') + h.register_principal('ev', 'evaluator') + s, e = h.session('ag'), h.session('ev') + obs = s.read(instance_id=rt.INSTANCE)['observations'] + self.assertFalse([k for k in obs if k.startswith('truth.')]) + self.assertIn('truth.samples', e.read(instance_id=rt.INSTANCE)['observations']) + d = s.describe(instance_id=rt.INSTANCE) + self.assertFalse([k for k in d['state_slots'] if k.startswith('truth.')]) + self.assertNotIn('ledger.read', d['capabilities']) + self.assertEqual(s.invoke(instance_id=rt.INSTANCE, capability_id='ledger.read', arguments={}, request_id='l')['error']['code'], 'ACCESS_DENIED') + r = s.invoke(instance_id=rt.INSTANCE, capability_id='camera.acquire', arguments={}, request_id='a1') + h.step(1.0) + res = s.invoke(instance_id=rt.INSTANCE, capability_id='measurement.result', arguments=dict(record_id='IM0001'), request_id='m1')['result'] + self.assertEqual(res['template_source']['substances'], []) # the sample identity is truth + self.assertEqual(e.invoke(instance_id=rt.INSTANCE, capability_id='measurement.result', arguments=dict(record_id='IM0001'), request_id='m1')['result']['template_source']['substances'], ['main_sio2']) + self.assertEqual(s.poll(r['operation_id'])['status'], 'succeeded') # protocol.md status names + + def test_requests_are_idempotent_and_foreign_records_hidden(self): + h = loaded() + h.register_principal('a1', 'agent') + h.register_principal('a2', 'agent') + s1, s2 = h.session('a1'), h.session('a2') + r1 = s1.invoke(instance_id=rt.INSTANCE, capability_id='stage.rotate', arguments=dict(angle_rad=0.5), request_id='x') + self.assertEqual(s1.invoke(instance_id=rt.INSTANCE, capability_id='stage.rotate', arguments=dict(angle_rad=0.5), request_id='x'), r1) + self.assertEqual(s1.invoke(instance_id=rt.INSTANCE, capability_id='stage.rotate', arguments=dict(angle_rad=0.6), request_id='x')['error']['code'], + 'REQUEST_CONFLICT') + s1.invoke(instance_id=rt.INSTANCE, capability_id='camera.acquire', arguments={}, request_id='acq') + self.assertEqual(s2.invoke(instance_id=rt.INSTANCE, capability_id='stage.rotate', arguments=dict(angle_rad=0.1), request_id='y')['error']['code'], 'ACCESS_DENIED') + h.step(1.0) + self.assertEqual(s2.invoke(instance_id=rt.INSTANCE, capability_id='records.list', arguments={}, request_id='r')['result']['records'], []) + self.assertEqual(s2.invoke(instance_id=rt.INSTANCE, capability_id='measurement.result', arguments=dict(record_id='IM0001'), request_id='m')['error']['code'], + 'ACCESS_DENIED') + self.assertIsNone(s2.read(instance_id=rt.INSTANCE)['observations']['result.last_record_id']['value']) + self.assertEqual(s1.read(instance_id=rt.INSTANCE)['observations']['result.last_record_id']['value'], 'IM0001') + + def test_queries_and_unsupported(self): + h = loaded() + acquire(h) + self.assertEqual(h.invoke('records.list')['records'], ['IM0001']) + self.assertTrue(h.invoke('events.read', since_s=0.0)['events']) + self.assertEqual(h.invoke('ledger.read')['frames'], 1.0) + p = h.invoke('provenance.read') + self.assertGreaterEqual(p['substances'], 50) + for k in rt.UNSUPPORTED: + with self.assertRaises(rt.ActionRejected): + h.invoke(k) + h.invoke('sim.step', dt_s=5.0) + with self.assertRaises(rt.ActionRejected): + h.invoke('measurement.result', record_id='nope') + + +# ---------------------------------------------------------------- declared effects over scenario states +_SC = {} + + +def _build(name): + if name == 'fresh': + return rt.EvidentBx53pRuntime() + if name == 'off': + return configured() + if name == 'ready': + h = ready() + for s in (QUARTZ, QUARTZ_XTAL, GLASS, LC, THICK): + h.invoke('sample.provide', **s) + return h + if name == 'loaded': + h = _scenario('ready') + h.invoke('sample.place', sample_id='quartz_plate') + h.invoke('focus.move', stage_z_m=0.0) + return h + if name == 'imaged': + h = _scenario('loaded') + acquire(h) + return h + if name == 'acquiring': + h = _scenario('loaded') + h.invoke('camera.acquire') + return h + if name == 'scanning': + h = _scenario('loaded') + h.invoke('scan.extinction', step_rad=20 * DEG, region=None) + h.step(5.0) + return h + if name == 'lamp_fault': + h = _scenario('loaded') + h.invoke('fault.inject', fault='lamp_failure', active=True) + return h + if name == 'camera_fault': + h = _scenario('loaded') + h.invoke('fault.inject', fault='camera_disconnected', active=True) + return h + if name == 'mains_fault': + h = _scenario('loaded') + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, mains_voltage_v=60.0)) + return h + raise KeyError(name) + + +def _scenario(name): + if name not in _SC: + _SC[name] = _build(name) + return copy.deepcopy(_SC[name]) + + +SCENARIOS = ['fresh', 'off', 'ready', 'loaded', 'imaged', 'acquiring', 'scanning', 'lamp_fault', 'camera_fault', 'mains_fault'] +STEP_DTS = (0.02, 1.0, 3.0, 30.0) + + +def _variants(cap): + V = { + 'plant.configure': [dict(rt.PLANT_EXAMPLE), dict(room_k=300.15, mains_voltage_v=60.0, noise_seed=1)], + 'sample.provide': [dict(QUARTZ, sample_id='new')], 'sample.place': [dict(sample_id='quartz_section'), dict(sample_id='lc_cell')], + 'sample.remove': [dict(sample_id='quartz_plate')], 'power.set': [dict(enabled=True), dict(enabled=False)], 'power.press_switch': [{}], + 'illumination.set_level': [dict(level=0.0), dict(level=1.0)], 'polarizer.set_angle': [dict(angle_rad=0.3), dict(angle_rad=0.0)], + 'analyzer.set_inserted': [dict(inserted=False), dict(inserted=True)], 'analyzer.set_angle': [dict(angle_rad=0.2), dict(angle_rad=math.pi / 2)], + 'compensator.insert': [dict(plate='U-TP530'), dict(plate='none')], 'condenser.set_top_lens': [dict(state='out'), dict(state='in')], + 'condenser.set_iris': [dict(diameter_m=3e-3)], 'objective.select': [dict(index=0), dict(index=3)], + 'stage.rotate': [dict(angle_rad=0.5), dict(angle_rad=math.pi / 4)], 'focus.move': [dict(stage_z_m=0.002)], + 'camera.configure': [dict(exposure_s=0.2, gain=2.0)], 'camera.acquire': [{}], 'scan.extinction': [dict(step_rad=30 * DEG, region=None)], + 'bertrand.set_inserted': [dict(inserted=True), dict(inserted=False)], 'bertrand.focus': [dict(focus_rad=1.0)], + 'fault.inject': [dict(fault=f, active=True) for f in rt.FAULTS] + [dict(fault=f, active=False) for f in rt.FAULTS], + 'sim.step': [dict(dt_s=0.5), dict(dt_s=30.0)], + } + return V.get(cap, []) + + +def _num(x): + return isinstance(x, (int, float)) and not isinstance(x, bool) + + +def _flat(v, prefix=''): + out = {} + if isinstance(v, dict): + for k, x in v.items(): + out.update(_flat(x, f'{prefix}.{k}')) + elif isinstance(v, list) and len(v) <= 64: + for i, x in enumerate(v): + out.update(_flat(x, f'{prefix}[{i}]')) + else: + out[prefix] = json.dumps(v, sort_keys=True, default=str) if isinstance(v, list) else v + return out + + +def _rel_changed(a, b, scale=None): + if _num(a) and _num(b): + return abs(a - b) > 1e-9 * (max(abs(a), abs(b)) if scale is None else scale) + 1e-300 + return _changed(a, b) + + +def _leaf_changed(a, b): + fa, fb = _flat(a), _flat(b) + return any(_rel_changed(fa.get(k, ''), fb.get(k, '')) for k in set(fa) | set(fb)) + + +def _step_differs(v1, a2, v0, b2): + f1, fa, f0, fb = _flat(v1), _flat(a2), _flat(v0), _flat(b2) + for leaf in set(f1) | set(fa) | set(f0) | set(fb): + x1, xa, x0, xb = (f.get(leaf, '') for f in (f1, fa, f0, fb)) + ca, cb = _rel_changed(x1, xa), _rel_changed(x0, xb) + if not (ca or cb): + continue + if ca and cb and all(_num(x) for x in (x1, xa, x0, xb)) and not _rel_changed(xa - x1, xb - x0, max(abs(x1), abs(xa), abs(x0), abs(xb))): + continue + if ca and cb and (x1, xa) == (x0, xb): + continue + if ca and cb and x1 == x0 and not _rel_changed(xa, xb): + continue + return True + return False + + +def _executable(cap): + return cap not in rt.UNSUPPORTED and rt.CAPS[cap]['kind'] not in ('query', 'analysis') + + +class ReviewRound1Fixes(unittest.TestCase): + """Regression tests for the round-1 runtime review findings.""" + def test_conoscopic_angles_scale_with_na_over_n(self): + def first_dark_ring(obj, oil): + s = dict(CALCITE_XTAL, sample_id='c', thickness_m=100e-6, orientation=dict(tilt_rad=0.0, azimuth_rad=0.0, spin_rad=0.0), immersion_oil=oil) + h = loaded(s, objective=obj) + h.invoke('analyzer.set_angle', angle_rad=math.pi / 2) + h.invoke('bertrand.set_inserted', inserted=True) + h.invoke('condenser.set_iris', diameter_m=0.021) + Y = h._linear_image(h.stage, []).sum(-1) + H, W = Y.shape + rs = np.linspace(0, 1, 200) + v = np.array([Y[int(round((H - 1) / 2 - r * (W - 1) / 2 * math.sin(math.pi / 4))), int(round((W - 1) / 2 + r * (W - 1) / 2 * math.cos(math.pi / 4)))] for r in rs]) + k = next(i for i in range(2, len(v) - 2) if v[i] < v[i - 1] and v[i] <= v[i + 1] and v[i] < 0.3 * v.max()) + return rs[k] + ratio = first_dark_ring(3, True) / first_dark_ring(2, False) + self.assertAlmostEqual(ratio, 0.75 / 1.30, delta=0.08) # sin(theta_c) = NA r / n: the same ring at r proportional to 1 / NA + check('conoscopic_ring_radius_scales_with_1_over_na', ratio=ratio, expected=0.75 / 1.30) + + def test_scan_step_and_fit(self): + h = loaded(QUARTZ_XTAL) + h.invoke('analyzer.set_angle', angle_rad=math.pi / 2) + with self.assertRaises(rt.ActionRejected): + h.invoke('scan.extinction', step_rad=45 * DEG, region=None) # 45 deg steps see 4 theta at two phases only + for slow in (10, 20, 30): + h = loaded(dict(QUARTZ_XTAL, orientation=dict(tilt_rad=math.pi / 2, azimuth_rad=slow * DEG, spin_rad=0.0))) + h.invoke('analyzer.set_angle', angle_rad=math.pi / 2) + oid = h.invoke('scan.extinction', step_rad=40 * DEG, region=None)['operation_id'] + self.assertEqual(wait(h, oid), 'completed') + ext = h.records[h.operations[oid]['record_id']]['scan']['extinction_rad'] + truth = (math.pi / 2 - slow * DEG) % (math.pi / 2) + self.assertLess(abs((ext - truth + math.pi / 4) % (math.pi / 2) - math.pi / 4), 2 * DEG, (slow, ext)) + check('scan_45deg_step_refused_and_40deg_fit_correct') + + def test_scan_with_lamp_failure_gives_no_fit_and_ledger_counts_the_way_back(self): + h = loaded(QUARTZ_XTAL) + h.invoke('analyzer.set_angle', angle_rad=math.pi / 2) + oid = h.invoke('scan.extinction', step_rad=20 * DEG, region=None)['operation_id'] + h.step(6.0) + h.invoke('fault.inject', fault='lamp_failure', active=True) + self.assertEqual(wait(h, oid), 'completed') + sc = h.records[h.operations[oid]['record_id']] + self.assertIsNone(sc['scan']['extinction_rad']) + self.assertIn('lamp_off', sc['warnings']) + h2 = loaded(QUARTZ_XTAL) + oid = h2.invoke('scan.extinction', step_rad=20 * DEG, region=None)['operation_id'] + h2.step(6.5) # stage turned by 20 or 40 deg + turned = abs(h2.stage - 0.0) + h2._cancel_op(h2.operations[oid]) + self.assertAlmostEqual(h2.ledger()['stage_rotation_rad'], 2 * turned, places=9) + self.assertEqual(h2.stage, 0.0) + check('scan_lamp_off_no_fit_and_return_trip_in_ledger', turned_rad=turned) + + def test_retardation_candidates_and_saturation(self): + for d in (10e-6, 30e-6, 50e-6): + h = loaded(dict(QUARTZ_XTAL, thickness_m=d)) + h.invoke('analyzer.set_angle', angle_rad=math.pi / 2) + h.invoke('stage.rotate', angle_rad=45 * DEG) + rec = acquire(h) + truth = h.read('evaluator')['truth.center_retardation_m'] + out = h.invoke('analysis.retardation', record_id=rec['record_id'], region=None, thickness_m=d) + self.assertLess(min(abs(x - truth) for x in [out['retardation_m']] + out['alternatives_m']), 15e-9, (d, out['retardation_m'], out['alternatives_m'])) + self.assertIn('main_sio2', [c['substance_id'] for c in out['candidates']]) + self.assertFalse(out['unique_identification']) + h = loaded(dict(QUARTZ_XTAL, thickness_m=30e-6)) + h.invoke('analyzer.set_angle', angle_rad=math.pi / 2) + h.invoke('stage.rotate', angle_rad=45 * DEG) + h.invoke('camera.configure', exposure_s=1.0, gain=4.0) + rec = acquire(h) + out = h.invoke('analysis.retardation', record_id=rec['record_id'], region=None, thickness_m=30e-6) + self.assertIsNone(out['retardation_m']) + self.assertEqual(out['warnings'], ['saturated_region']) + check('retardation_candidates_cover_all_orders_and_saturation_refused') + + def test_objective_front_lens_clearance(self): + h = loaded(QUARTZ, objective=3) + z0, before = h.z, h.read('evaluator') + for z in (z0 + 0.3e-3, z0 + 3e-3): + with self.assertRaises(rt.ActionRejected) as cm: + h.invoke('focus.move', stage_z_m=z) + self.assertEqual(str(cm.exception), 'OBJECTIVE_COLLISION') + self.assertEqual(h.read('evaluator'), before) + h.invoke('focus.move', stage_z_m=z0 + 0.1e-3) # inside the 0.2 mm working distance + h = loaded(QUARTZ, objective=1) + h.invoke('focus.move', stage_z_m=h.z + 2e-3) # 10x: 10 mm working distance + with self.assertRaises(rt.ActionRejected): + h.invoke('objective.select', index=2) # 40x (0.51 mm) would hit the slide + check('objective_working_distance_clearance') + + def test_specimen_turns_with_the_stage(self): + rng = np.random.default_rng(3) + s = rt.make_sample(dict(kind='thin_section', substance_id='main_sio2', thickness_m=30e-6, grains=40), rng) + a = rt.render_linear(s, 0.0, 0.0, math.pi / 2, True, 0.0) + b = rt.render_linear(s, math.pi, 0.0, math.pi / 2, True, 0.0) + np.testing.assert_allclose(b[::-1, ::-1], a, atol=1e-9) # a half turn maps the mosaic onto itself rotated by 180 deg + c = rt.render_linear(s, math.pi / 2, 0.0, math.pi / 2, True, 0.0) + self.assertGreater(float(np.abs(c - a).mean()), 1e-3) + seeds = rt.make_sample(dict(kind='thin_section', substance_id='main_sio2', thickness_m=30e-6, grains=40), np.random.default_rng(3)) + H, W = a.shape[:2] + pts = np.array(min((g['xy'] for g in seeds['grains']), key=lambda q: abs(math.hypot(*q) - 0.4))) # a seed near the centre; slide (x, y) appears at R(+stage)(x, y) + ang = math.radians(90) + rot = np.array([math.cos(ang) * pts[0] - math.sin(ang) * pts[1], math.sin(ang) * pts[0] + math.cos(ang) * pts[1]]) + col = lambda p: (int(round(p[0] * (W - 1) / 2 + (W - 1) / 2)), int(round(-p[1] * (W - 1) / 2 + (H - 1) / 2))) # noqa: E731 (+y up) + c0, c1 = col(pts), col(rot) + self.assertTrue(0 <= c0[1] < H and 0 <= c1[1] < H and 0 <= c0[0] < W and 0 <= c1[0] < W, (c0, c1)) + np.testing.assert_allclose(c[c1[1], c1[0]], a[c0[1], c0[0]], atol=1e-9) # the seed's grain (same colour after 90 deg) moves counter-clockwise + check('specimen_mosaic_turns_with_the_stage') + + + def test_round2_specimen_height_image_axes_and_dry_oil_objective(self): + thick = dict(QUARTZ_XTAL, sample_id='thick_xtal', thickness_m=0.9e-3) + h = loaded(thick, objective=1) + with self.assertRaises(rt.ActionRejected) as cm: + h.invoke('objective.select', index=2) # 40x: 0.51 mm working distance < 0.9 mm crystal + self.assertEqual(str(cm.exception), 'OBJECTIVE_COLLISION') + tilted = dict(QUARTZ_XTAL, sample_id='tilted', substance_id='main_caco3', thickness_m=100e-6, orientation=dict(tilt_rad=0.35, azimuth_rad=0.0, spin_rad=0.0)) + h = loaded(tilted, objective=2) + h.invoke('analyzer.set_angle', angle_rad=math.pi / 2) + h.invoke('bertrand.set_inserted', inserted=True) + h.invoke('condenser.set_iris', diameter_m=0.021) + + def melatope_angle(stage): + Y = h._linear_image(stage, []).sum(-1) + H, W = Y.shape + yy, xx = np.mgrid[0:H, 0:W] + x, y = (xx - (W - 1) / 2) / ((W - 1) / 2), (yy - (H - 1) / 2) / ((W - 1) / 2) + w = np.where((x ** 2 + y ** 2 < 0.9) & (x ** 2 + y ** 2 > 0.02), Y.max() - Y, 0.0) ** 4 # the dark isogyre cross + return math.atan2(float((w * y).sum()), float((w * x).sum())) + turn = (melatope_angle(math.pi / 2) - melatope_angle(0.0)) % (2 * math.pi) # measured in pixel rows (downward): counter-clockwise = -90 deg + self.assertLess(abs(turn - 3 * math.pi / 2), 20 * DEG, turn) # the figure turns counter-clockwise on screen with the stage (joint about +z) + dry = dict(QUARTZ_XTAL, sample_id='dry', substance_id='main_caco3', thickness_m=100e-6, orientation=dict(tilt_rad=0.0, azimuth_rad=0.0, spin_rad=0.0)) + h = loaded(dry, objective=3) + h.invoke('bertrand.set_inserted', inserted=True) + h.invoke('condenser.set_iris', diameter_m=0.021) + w = [] + lin = h._conoscopic(h._obj(), h.stage, 0.0, w) + self.assertIn('no_immersion_oil', w) + H, W = lin.shape[:2] + yy, xx = np.mgrid[0:H, 0:W] + r = np.hypot(xx - (W - 1) / 2, yy - (H - 1) / 2) / ((W - 1) / 2) + self.assertLess(float(lin[(r > 1 / 1.30 + 0.05) & (r <= 1)].max()), 1e-3 * float(lin.max())) # no ray beyond n sin(theta) = 1 through air + check('round2_clearance_axes_and_dry_oil_objective', melatope_turn=turn) + + def test_contract_semantics_of_the_fixes(self): + meta = _meta() + self.assertEqual(meta['capabilities']['analysis.retardation']['output_schema']['properties']['unique_identification'].get('enum'), [False]) + for k in ('stage.angle_rad', 'polarizer.angle_rad', 'analyzer.angle_rad', 'objective.nosepiece_rad', 'focus.stage_z_m'): + self.assertTrue(meta['state_slots'][k].get('reference_conditions'), k) + check('never_unique_and_reference_frames_declared') + + + def test_optic_sign_with_the_tint_plate_textbook_rule(self): + for sid, d, positive in (('main_sio2', 300e-6, True), ('main_caco3', 30e-6, False)): + s = dict(QUARTZ_XTAL, sample_id='x', substance_id=sid, thickness_m=d, orientation=dict(tilt_rad=0.0, azimuth_rad=0.0, spin_rad=0.0)) + h = loaded(s, objective=2) + h.invoke('analyzer.set_angle', angle_rad=math.pi / 2) + h.invoke('bertrand.set_inserted', inserted=True) + h.invoke('condenser.set_iris', diameter_m=0.021) + h.invoke('compensator.insert', plate='U-TP530') + lin = h._linear_image(h.stage, []) + H, W = lin.shape[:2] + yy, xx = np.mgrid[0:H, 0:W] + x, y = (xx - (W - 1) / 2) / ((W - 1) / 2), (yy - (H - 1) / 2) / ((W - 1) / 2) + ring = (np.hypot(x, y) > 0.08) & (np.hypot(x, y) < 0.3) + ne = lin[ring & (x > 0) & (y < 0)].mean(0) # north = decreasing image rows + self.assertEqual(bool(ne[2] > ne[0]), positive, (sid, ne)) # positive crystal: blue NE / SW next to the melatope + check('optic_sign_textbook_rule_with_u_tp530') + + +class ZDeclaredEffects(unittest.TestCase): + def test_immediate_and_on_step_effects_are_declared(self): + missing_imm, missing_step = {}, {} + states = {n: _scenario(n) for n in SCENARIOS} + for cap in rt.CAPS: + if not _executable(cap): + continue + for sname, S in states.items(): + for args in _variants(cap): + A = copy.deepcopy(S) + v0 = A.read('evaluator') + try: + _orig_invoke(A, cap, **args) + except rt.ActionRejected: + continue + v1 = A.read('evaluator') + if cap == 'sim.step': + for k in v0: + if _leaf_changed(v0[k], v1[k]) and k not in rt.ON_STEP['sim.step'] + rt.EFFECTS['sim.step']: + missing_step.setdefault('sim.step', set()).add((sname, k)) + continue + for k in v0: + if _leaf_changed(v0[k], v1[k]) and k not in rt.EFFECTS.get(cap, []): + missing_imm.setdefault(cap, set()).add((sname, k)) + for dt in STEP_DTS: + A2, B2 = copy.deepcopy(A), copy.deepcopy(S) + A2.step(dt) + B2.step(dt) + a2, b2 = A2.read('evaluator'), B2.read('evaluator') + for k in v0: + if k not in rt.ON_STEP.get(cap, []) and _step_differs(v1[k], a2[k], v0[k], b2[k]): + missing_step.setdefault(cap, set()).add((sname, k)) + if k not in rt.ON_STEP['sim.step'] + ['clock.time_s'] and _leaf_changed(v0[k], b2[k]): + missing_step.setdefault('sim.step', set()).add((sname, k)) + self.assertEqual(missing_imm, {}) + self.assertEqual(missing_step, {}) + self.assertFalse([s for v in rt.ON_STEP.values() for s in v if rt.SLOTS[s]['origin'] == 'setpoint' and s != 'stage.angle_rad']) + check('declared_effects_scenarios') + + def test_every_device_capability_is_accepted_in_some_scenario(self): + accepted = set() + for n in SCENARIOS: + S = _scenario(n) + for cap in rt.CAPS: + if not _executable(cap) or cap in accepted: + continue + for args in _variants(cap): + try: + _orig_invoke(copy.deepcopy(S), cap, **args) + accepted.add(cap) + break + except rt.ActionRejected: + pass + self.assertEqual({c for c in rt.CAPS if _executable(c)} - accepted, set()) + + +class ZZRejectionCodes(unittest.TestCase): + def test_every_observed_rejection_code_is_declared(self): + undeclared = {k: sorted(v - set(rt.CAP_ERRORS.get(k, [])) - {'INVALID_ARGUMENT', 'UNSUPPORTED', 'UNKNOWN_CAPABILITY'}) for k, v in REJECTIONS.items()} + self.assertEqual({k: v for k, v in undeclared.items() if v}, {}) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_asset_hot_tps2500.py b/tests/test_asset_hot_tps2500.py new file mode 100644 index 0000000000000000000000000000000000000000..1fd75157aef566c21d8ad9d4c61011d287adc5c6 --- /dev/null +++ b/tests/test_asset_hot_tps2500.py @@ -0,0 +1,184 @@ +"""CHEM136 numerical, evidence, protocol and atomicity regression tests.""" +import copy +import importlib.util +import json +import math +from pathlib import Path +import unittest +import numpy as np +from scipy.integrate import quad +from scripts.asset_runtime import hot_tps2500 as r +ROOT=Path(__file__).resolve().parents[1] +spec=importlib.util.spec_from_file_location('tps_asset_tool',ROOT/'skills/chemistry-lab-assets/scripts/asset_tool.py') +asset_tool=importlib.util.module_from_spec(spec);spec.loader.exec_module(asset_tool) +OBSERVED=[] + +class Checked(r.HotTps2500Runtime): + def invoke(self,key,**a): + before=self.read();out=super().invoke(key,**a);after=self.read() + changed={k for k in after if after[k]!=before[k]} + assert not changed-set(r.CAPS[key]['effects']), (key,changed-set(r.CAPS[key]['effects'])) + assert not asset_tool.validate_value(out,r.CAPS[key]['output_schema']), (key,out,asset_tool.validate_value(out,r.CAPS[key]['output_schema'])) + OBSERVED.append((key,copy.deepcopy(a),copy.deepcopy(out))) + return out + +def make(plant=None,sample=None,method=None): + h=Checked();h.invoke('plant.configure',**dict(r.PLANT_EXAMPLE,**(plant or {})));h.invoke('probe.configure',**r.PROBE_EXAMPLE);h.invoke('sample.load',**dict(r.SAMPLE_EXAMPLE,**(sample or {})));h.invoke('power.set',enabled=True) + h.invoke('fixture.set_clamp',closed=True);h.step(2.);h.invoke('fixture.set_hood',opened=False);h.step(12.);h.invoke('method.configure',**dict(r.METHOD_EXAMPLE,**(method or {})));return h + +def finish(h): + h.invoke('acquisition.start');h.step(h.method['duration_s']);return h.invoke('acquisition.result') + +def remove(h): + if h.phase=='running':h.invoke('acquisition.stop') + h.invoke('fixture.set_hood',opened=True);h.step(12.);h.invoke('fixture.set_clamp',closed=False);h.step(2.);h.invoke('sample.remove') + +def sessions(h): + h.register_principal('student','agent');h.register_principal('teacher','evaluator');h.register_principal('other','agent');return h.session('student'),h.session('teacher'),h.session('other') + +def call(session,cap,args=None,request_id='r1'): + return session.invoke(instance_id=session._host.instance_id,capability_id=cap,arguments=args or {},request_id=request_id) + +class TpsTests(unittest.TestCase): + def test_01_setup_only_targets(self): + h=Checked();h.invoke('plant.configure',**r.PLANT_EXAMPLE);h.invoke('probe.configure',**r.PROBE_EXAMPLE);h.invoke('sample.load',**r.SAMPLE_EXAMPLE) + before=h.time_s;h.invoke('fixture.set_clamp',closed=True);self.assertEqual(h.clamp,.035);h.step(.5);self.assertAlmostEqual(h.clamp,.025);self.assertEqual(h.time_s,before+.5) + old=h.read();self.assertRaises(r.ActionRejected,h.invoke,'fixture.set_hood',opened=False);self.assertEqual(h.read(),old) + def test_02_read_describe_zero_step_pure(self): + h=make();a,e,_=sessions(h);before=copy.deepcopy(h.__dict__) + for _ in range(3):a.read(instance_id=h.instance_id);a.describe(instance_id=h.instance_id);e.describe(asset_type_id=r.ASSET_TYPE_ID);h.step(0.) + self.assertEqual(h.__dict__,before) + def test_03_real_steel_measurement(self): + h=make();o=finish(h);self.assertEqual(o['phase'],'succeeded');self.assertEqual(len(o['rows']),61) + self.assertLess(abs(o['fit']['conductivity_w_m_k']/13.69-1),1e-5);self.assertLess(abs(o['fit']['diffusivity_m2_s']/3.705e-6-1),1e-5) + self.assertAlmostEqual(o['fit']['volumetric_heat_capacity_j_m3_k'],o['fit']['conductivity_w_m_k']/o['fit']['diffusivity_m2_s']);self.assertIn('HotDisk',o['template_source']);self.assertNotIn('reference_id',o) + def test_04_template_count_provenance(self): + lib=r.library();self.assertGreaterEqual(len(lib),50) + for row in lib.values(): + self.assertTrue(row['source']);self.assertTrue(row['evidence']);self.assertTrue(math.isfinite(row['thermal_conductivity_W_m_K'])) + def test_05_gaussian_kernel_independent_integral(self): + k=13.69;alpha=3.705e-6;rad=.0064;P=.5;t=1.5;cv=k/alpha + # Substitute u=v² to remove the heat-kernel endpoint singularity. + numerical=P/cv*quad(lambda v:1/(math.pi**1.5*math.sqrt(alpha)*(rad*rad+4*alpha*v*v)),0,math.sqrt(t),epsabs=1e-12)[0] + self.assertAlmostEqual(numerical,float(r.gaussian_plane_rise(t,P,k,alpha,rad)),12) + def test_06_external_inverse_no_hidden_sample(self): + h=Checked();args=copy.deepcopy(r.FIT_EXAMPLE);args['temperature_rise_k']=(r.gaussian_plane_rise(args['time_s'],.5,22.,1.2e-5,.0064)+.032).tolist() + out=h.invoke('analysis.fit',**args);self.assertLess(abs(out['conductivity_w_m_k']/22.-1),1e-7);self.assertLess(abs(out['diffusivity_m2_s']/1.2e-5-1),1e-7);self.assertAlmostEqual(out['offset_k'],.032,7);self.assertIsNone(h.sample) + def test_07_partition_invariance(self): + a=make();b=make();a.invoke('acquisition.start');b.invoke('acquisition.start');a.step(1.5) + for dt in [.007,.033,.11,.35,.4,.6]:b.step(dt) + self.assertEqual(a.rows,b.rows);self.assertEqual(a.fit,b.fit);self.assertAlmostEqual(a._heat_stored,b._heat_stored,14) + def test_08_energy_mass_conservation_cancel_remove(self): + h=make();initial_mass=h._mass();h.invoke('acquisition.start');h.step(.5);h.invoke('acquisition.stop');self.assertEqual(h._heat_input,.25);self.assertEqual(h._heat_stored,.25) + rows=copy.deepcopy(h.rows);h.step(.3);self.assertEqual(h.rows,rows);self.assertEqual(h._heat_input,.25);self.assertEqual(h._mass(),initial_mass) + remove(h);d=h.invoke('ledger.read');self.assertLess(abs(d['energy_error_j']),1e-14);self.assertLess(abs(d['mass_error_kg']),1e-14);self.assertEqual(d['sample_removed_heat_j'],.25);self.assertEqual(d['sample_present_kg'],0) + def test_09_cancel_residual_cools(self): + h=make();h.invoke('acquisition.start');h.step(.5);before=h.read()['truth.sensor_k'];h.invoke('acquisition.stop');h.step(.1) + self.assertLess(h.read()['truth.sensor_k'],before);self.assertGreater(h.read()['truth.sensor_k'],h.plant['ambient_k']);self.assertEqual(h.phase,'cancelled');self.assertEqual(h._heat_stored,.25) + def test_10_duration_overshoot_exact_energy(self): + h=make();h.invoke('acquisition.start');h.step(100.);self.assertEqual(h._heat_input,.75);self.assertEqual(h.elapsed,1.5);self.assertEqual(h.phase,'succeeded');self.assertEqual(len(h.rows),61) + self.assertIsNone(h.read()['truth.sensor_k']);self.assertIsNone(h.read()['measurement.indicated_k']);self.assertEqual(h.model_fault,'POSTPULSE_FINITE_BOUNDARY_DOMAIN') + def test_11_small_domain_atomic_rejection(self): + h=make(method={'duration_s':5.});before=copy.deepcopy(h.__dict__);self.assertRaisesRegex(r.ActionRejected,'FINITE_BOUNDARY_DOMAIN',h.invoke,'acquisition.start');self.assertEqual(h.__dict__,before) + h=make(plant={'maximum_rise_k':.001});before=copy.deepcopy(h.__dict__);self.assertRaisesRegex(r.ActionRejected,'SMALL_RISE_DOMAIN',h.invoke,'acquisition.start');self.assertEqual(h.__dict__,before) + def test_12_sensor_saturation_not_fake_success(self): + h=make(plant={'sensor_maximum_k':296.151});out=finish(h);self.assertEqual(out['phase'],'failed');self.assertEqual(out['error_code'],'SENSOR_RANGE');self.assertIsNone(out['fit']);self.assertTrue(any(x['temperature_k'] is None for x in out['rows']));self.assertEqual(h._heat_input,.75) + def test_13_external_calibration(self): + h=make(plant={'sensor_gain':2.,'sensor_offset_k':.3});h.invoke('sensor.calibrate',gain_correction=.5,offset_correction_k=.3);out=finish(h) + self.assertLess(abs(out['fit']['conductivity_w_m_k']/13.69-1),1e-5);self.assertLess(abs(out['fit']['diffusivity_m2_s']/3.705e-6-1),1e-5) + def test_14_reference_temperature_atomic(self): + h=Checked();h.invoke('plant.configure',**r.PLANT_EXAMPLE);h.invoke('probe.configure',**r.PROBE_EXAMPLE);before=copy.deepcopy(h.__dict__) + self.assertRaisesRegex(r.ActionRejected,'REFERENCE_TEMPERATURE_RANGE',h.invoke,'sample.load',**dict(r.SAMPLE_EXAMPLE,reference_id='nist_sic'));self.assertEqual(h.__dict__,before) + def test_15_missing_alpha_explicit_completion(self): + record=r.library()['usgs_quartz'];h=Checked();h.invoke('plant.configure',**dict(r.PLANT_EXAMPLE,ambient_k=record['reference_temperature_K']));h.invoke('probe.configure',**r.PROBE_EXAMPLE) + sample=dict(r.SAMPLE_EXAMPLE,reference_id='usgs_quartz');before=copy.deepcopy(h.__dict__);self.assertRaisesRegex(r.ActionRejected,'MISSING_REFERENCE_PROPERTY',h.invoke,'sample.load',**sample);self.assertEqual(h.__dict__,before) + h.invoke('sample.load',**dict(sample,diffusivity_override_m2_s=3e-6,accept_property_completion=True));self.assertTrue(h.sample['completed']);self.assertEqual(h.sample['alpha'],3e-6) + def test_16_invalid_input_atomic(self): + h=make();before=copy.deepcopy(h.__dict__) + for patch in [{'power_w':True},{'power_w':float('nan')},{'bad':1},{'duration_s':.5},{'sample_interval_s':.07},{'temperature_k':300.}]: + self.assertRaises(r.ActionRejected,h.invoke,'method.configure',**dict(r.METHOD_EXAMPLE,**patch));self.assertEqual(h.__dict__,before) + for dt in [-1,float('inf'),True,float('nan')]:self.assertRaises(r.ActionRejected,h.step,dt);self.assertEqual(h.__dict__,before) + def test_17_busy_rejection_keeps_state(self): + h=make();h.invoke('acquisition.start');h.step(.2);before=copy.deepcopy(h.__dict__) + for cap,args in [('sample.remove',{}),('fixture.set_clamp',{'closed':False}),('fixture.set_hood',{'opened':True}),('sensor.calibrate',r.CALIBRATION_EXAMPLE),('method.configure',r.METHOD_EXAMPLE)]: + self.assertRaisesRegex(r.ActionRejected,'BUSY',h.invoke,cap,**args);self.assertEqual(h.__dict__,before) + def test_18_two_instance_isolation(self): + a=make();b=make();before=copy.deepcopy(b.__dict__);finish(a);self.assertEqual(b.__dict__,before) + def test_19_session_host_bound_visibility(self): + h=make();a,e,o=sessions(h);description=a.describe(instance_id=h.instance_id) + self.assertNotIn('sample.load',description['capabilities']);self.assertNotIn('sim.step',description['capabilities']);self.assertFalse(any(k.startswith('truth.') for k in description['state_slots'])) + self.assertNotIn('truth.sensor_k',a.read(instance_id=h.instance_id)['observations']);self.assertIn('truth.sensor_k',e.read(instance_id=h.instance_id)['observations']) + self.assertRaises(r.ActionRejected,a.read,instance_id=h.instance_id,state_ids=['truth.sensor_k']);self.assertRaises(TypeError,a.read,instance_id=h.instance_id,role='evaluator') + self.assertEqual(call(a,'sim.step',{'dt_s':1.})['error']['code'],'ACCESS_DENIED');self.assertEqual(call(a,'sample.load',r.SAMPLE_EXAMPLE,'r2')['error']['code'],'ACCESS_DENIED');self.assertRaises(r.ActionRejected,h.session,'evaluator') + def test_20_request_idempotency_and_conflict(self): + h=make();a,e,_=sessions(h);first=call(a,'acquisition.start');revision=h.revision;self.assertEqual(call(a,'acquisition.start'),first);self.assertEqual(h.revision,revision) + self.assertEqual(call(a,'power.set',{'enabled':False})['error']['code'],'REQUEST_CONFLICT');self.assertEqual(h.phase,'running') + def test_21_operation_owner_poll_cancel(self): + h=make();a,e,o=sessions(h);operation=call(a,'acquisition.start')['operation_id'];h.step(.5) + self.assertRaises(r.ActionRejected,o.poll,operation);self.assertEqual(call(o,'acquisition.result')['error']['code'],'ACCESS_DENIED');self.assertEqual(call(o,'power.set',{'enabled':False},'r2')['error']['code'],'ACCESS_DENIED') + before=h.time_s;response=a.cancel(operation,'cancel1');self.assertEqual(h.time_s,before);self.assertEqual(a.cancel(operation,'cancel1'),response);self.assertEqual(a.poll(operation)['status'],'cancelled');self.assertEqual(h._heat_input,.25) + def test_22_completed_poll_frozen_after_reload(self): + h=make();a,e,_=sessions(h);operation=call(a,'acquisition.start')['operation_id'];h.step(1.5);old=a.poll(operation);remove(h) + h.invoke('sample.load',**r.SAMPLE_EXAMPLE);self.assertEqual(a.poll(operation),old);self.assertEqual(h._heat_stored,0);self.assertEqual(h._heat_removed,.75) + def test_23_power_off_cancel_preserves_energy(self): + h=make();h.invoke('acquisition.start');h.step(.5);h.invoke('power.set',enabled=False);h.step(1.) + self.assertEqual(h.phase,'cancelled');self.assertEqual(h.error,'POWER_OFF');self.assertEqual(h._heat_input,.25);self.assertIsNone(h.read()['measurement.indicated_k']) + def test_24_no_hot_restart(self): + h=make();finish(h);before=copy.deepcopy(h.__dict__);self.assertRaisesRegex(r.ActionRejected,'RELOAD_REQUIRED',h.invoke,'acquisition.start');self.assertEqual(h.__dict__,before) + def test_25_analysis_ambiguous_rejected(self): + h=Checked();a=copy.deepcopy(r.FIT_EXAMPLE);a['time_s']=np.linspace(0,1e-5,41).tolist();a['temperature_rise_k']=r.gaussian_plane_rise(a['time_s'],.5,10,1e-6,.0064).tolist() + self.assertRaisesRegex(r.ActionRejected,'ANALYSIS_UNRESOLVED',h.invoke,'analysis.fit',**a) + a=copy.deepcopy(r.FIT_EXAMPLE);a['time_s'][3]=a['time_s'][2];self.assertRaisesRegex(r.ActionRejected,'ANALYSIS_DATA',h.invoke,'analysis.fit',**a) + def test_26_unsupported_hardware_and_oem(self): + h=make();a,_,_=sessions(h);before=copy.deepcopy(h.__dict__) + for index,key in enumerate(r.UNSUPPORTED):self.assertEqual(call(a,key,request_id='u'+str(index))['status'],'unsupported') + self.assertEqual(h.__dict__,before) + def test_27_metadata_and_all_return_schemas(self): + metadata=r.export_hot_tps2500_contract_metadata();self.assertEqual(set(metadata['state_slots']),set(r.SLOTS));h=make();values=h.read() + for key,value in metadata['capabilities'].items(): + self.assertEqual(asset_tool.lint_schema(value['input_schema']),[],key);self.assertEqual(asset_tool.lint_schema(value['output_schema']),[],key);self.assertEqual(asset_tool.validate_value(value['example_arguments'],value['input_schema']),[],key) + for key,value in values.items():self.assertEqual(asset_tool.validate_value(value,metadata['state_slots'][key]['value_schema']),[],key) + for key,args,out in OBSERVED:self.assertEqual(asset_tool.validate_value(out,metadata['capabilities'][key]['output_schema']),[],key) + def test_28_sim_step_real_entry_schema(self): + h=Checked();out=h.invoke('sim.step',dt_s=.001);self.assertEqual(out,{'time_s':.001});self.assertEqual(h.time_s,.001) + def test_29_known_alpha_cannot_overwrite(self): + h=Checked();h.invoke('plant.configure',**r.PLANT_EXAMPLE);h.invoke('probe.configure',**r.PROBE_EXAMPLE);before=copy.deepcopy(h.__dict__) + self.assertRaisesRegex(r.ActionRejected,'REFERENCE_OVERRIDE_FORBIDDEN',h.invoke,'sample.load',**dict(r.SAMPLE_EXAMPLE,diffusivity_override_m2_s=1e-6,accept_property_completion=True));self.assertEqual(h.__dict__,before) + def test_30_source_provenance_isolation(self): + h=make();a,e,_=sessions(h);op=call(a,'acquisition.start')['operation_id'];h.step(1.5) + for response in [call(a,'acquisition.result',request_id='read1'),a.poll(op)]: + text=json.dumps(response);self.assertNotIn('316L',text);self.assertNotIn('stainless',text);self.assertNotIn('locator',text);self.assertIn('thermal_transport_library.json',text) + privileged_public=call(e,'acquisition.result');self.assertNotIn('locator',json.dumps(privileged_public));self.assertNotIn('316L',json.dumps(privileged_public));self.assertEqual(privileged_public['result']['template_source'],a.poll(op)['result']['template_source']) + full=call(e,'provenance.read',request_id='provenance1');self.assertIn('locator',json.dumps(full));self.assertIn('316',json.dumps(full));self.assertEqual(full['result']['reference_id'],'stainless_steel_316l_hotdisk') + denied=call(a,'provenance.read',request_id='provenance2');self.assertEqual(denied['error']['code'],'ACCESS_DENIED');self.assertNotIn('locator',json.dumps(denied)) + self.assertEqual(call(a,'acquisition.result',request_id='read1')['result']['template_source'],a.poll(op)['result']['template_source']) + def test_31_manufacturer_ambient_domain(self): + h=Checked() + for temperature in [283.15,313.15]:self.assertRaises(r.ActionRejected,h.invoke,'plant.configure',**dict(r.PLANT_EXAMPLE,ambient_k=temperature));self.assertIsNone(h.plant) + def test_32_sixty_hz_clock_and_sampling(self): + whole=make();frames=make();whole.invoke('acquisition.start');frames.invoke('acquisition.start');whole.step(1.5) + before=frames.time_ns + for _ in range(90):frames.step(1/60) + self.assertEqual(frames.time_ns-before,1500000000);self.assertEqual(frames.time_ns,whole.time_ns) + self.assertEqual(frames.rows,whole.rows);self.assertEqual(frames.fit,whole.fit);self.assertEqual(frames.phase,'succeeded') + self.assertAlmostEqual(frames._heat_input,whole._heat_input,13);self.assertLess(abs(frames._clock_remainder_ns),1e-6) + def test_33_subnanosecond_accumulation(self): + h=Checked() + for _ in range(1000):h.step(1e-12) + self.assertEqual(h.time_ns,1);self.assertLess(abs(h._clock_remainder_ns),1e-12) + before=copy.deepcopy(h.__dict__);h.step(0.);self.assertEqual(h.__dict__,before) + def test_34_sixty_hz_long_clock_no_drift(self): + h=Checked() + for _ in range(3600):h.step(1/60) + self.assertEqual(h.time_ns,60000000000);self.assertLess(abs(h._clock_remainder_ns),.00001) + def test_35_bridge_evaluator_dispatch_public_is_safe(self): + h=make();_,e,_=sessions(h);operation=call(e,'acquisition.start')['operation_id'];h.step(1.5) + for public in [call(e,'acquisition.result',request_id='measure'),e.poll(operation)]: + serialized=json.dumps(public);self.assertNotIn('316L',serialized);self.assertNotIn('stainless',serialized);self.assertNotIn('locator',serialized);self.assertIn('thermal_transport_library.json',serialized) + provenance=call(e,'provenance.read',request_id='sources');self.assertEqual(provenance['result']['reference_id'],'stainless_steel_316l_hotdisk');self.assertEqual(provenance['result']['operation_id'],operation) + self.assertEqual(asset_tool.validate_value(provenance['result'],r.CAPS['provenance.read']['output_schema']),[]) + def test_36_missing_geometry_interlocks(self): + h=Checked();before=copy.deepcopy(h.__dict__);self.assertRaisesRegex(r.ActionRejected,'PRECONDITION_FAILED',h.invoke,'acquisition.start');self.assertEqual(h.__dict__,before) + h.invoke('plant.configure',**r.PLANT_EXAMPLE);h.invoke('probe.configure',**r.PROBE_EXAMPLE);before=copy.deepcopy(h.__dict__);self.assertRaisesRegex(r.ActionRejected,'SAMPLE_GEOMETRY',h.invoke,'sample.load',**dict(r.SAMPLE_EXAMPLE,diameter_m=.003));self.assertEqual(h.__dict__,before) + +if __name__=='__main__':unittest.main() diff --git a/tests/test_asset_ika_c6000.py b/tests/test_asset_ika_c6000.py new file mode 100644 index 0000000000000000000000000000000000000000..8c406be46bc5a152a2a8d485abbb25fce35da778 --- /dev/null +++ b/tests/test_asset_ika_c6000.py @@ -0,0 +1,1099 @@ +"""tests for CHEM-150 ika_c6000: python3 -m unittest tests/test_asset_ika_c6000.py + +Topics (pipeline.md): set points only write targets, read/describe are pure, rejected preconditions leave the state unchanged, +two instances are isolated, agent/evaluator truth isolation, conservation (energy, water, oxygen), real return values validated +against the declared schemas (asset_tool lint_schema / validate_value), asynchronous completion and cancellation remnants; plus the +instrument behaviour documented by IKA (power-up sequence, working modes vs. cooling water, measurement sequence, 1 g benzoic acid +about 3 K, 4 / 6 measurements per hour, reproducibility, error codes, evaluation with acid corrections and Hu). +""" +import copy +import math +import statistics +import sys +import unittest +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / "scripts")) +sys.path.insert(0, str(ROOT / "skills/chemistry-lab-assets/scripts")) +from asset_runtime import ika_c6000 as rt # noqa: E402 +import asset_tool # noqa: E402 + +CHECKS, PROCESS_EVIDENCE = [], {} +_META = {} + + +def _meta(): + if not _META: + _META.update(rt.export_ika_c6000_contract_metadata()) + return _META + + +_orig_invoke = rt.IkaC6000Runtime.invoke + + +def _instrumented_invoke(self, capability_id, **a): + """Every successful call is checked against its declared output schema and immediate state effects (read does not advance time).""" + before = self.read('evaluator') if capability_id != 'sim.step' else None + out = _orig_invoke(self, capability_id, **a) + meta = _meta()['capabilities'][capability_id] + errs = asset_tool.validate_value(out, meta['output_schema']) + if errs: + raise AssertionError(f'{capability_id} output violates its schema: {errs[:3]}') + if before is not None: + after = self.read('evaluator') + undeclared = {k for k in after if after[k] != before[k]} - set(rt.CAPS[capability_id]['effects']) + if undeclared: + raise AssertionError(f'{capability_id} changed undeclared state immediately: {sorted(undeclared)}') + PROCESS_EVIDENCE.setdefault(capability_id, []).append(dict(arguments=copy.deepcopy(a), result_keys=sorted(out))) + return out + + +rt.IkaC6000Runtime.invoke = _instrumented_invoke +RFID = 'C6012-0001' +THREAD = [dict(aid_name='IKA cotton wool thread', mass_kg=None)] + + +def powered(mode='isoperibol_25', seed=1, warm=3600.0, reference=26434.0e3, **plant): + h = rt.IkaC6000Runtime() + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, noise_seed=seed, **plant)) + h.invoke('power.set', enabled=True) + h.step(rt.SOFTWARE_LOAD_S + rt.SYSTEM_TEST_S + 60.0) + if mode in h._available_modes() and h.state == 'wait': + h.invoke('mode.set', mode=mode) + h.step(rt.MODE_TEST_S + 1.0) # manual 11.4: a mode change runs a system test + # the benzoic acid in the library is NIST SRM 39j: enter its certificate value (the factory setting is 26461 J/g) + h.invoke('settings.configure', o2_flush=False, auto_vessel_detection=True, reference_value_j_kg=reference) + h.invoke('vessel.scan', rfid=RFID) + h.invoke('vessel.register', name='V1', serial_number='0012345678', previous_ignitions=0, platinum_wire=False) + h.step(warm) + return h + + +def start(h, sub='benzoic_acid', m=1.0e-3, form='pellet', kind='calibration', hang=True, aids=None, vaids=None, prepare=True): + mid = h.invoke('measurement.create', name='run', sample_mass_kg=m, kind=kind, vessel_name=None, aids=aids or THREAD)['measurement_id'] + if prepare: + bal = h.invoke('vessel.prepare', rfid=RFID, sample=dict(substance_id=sub, mass_kg=m, form=form) if sub else None, aids=vaids or [], absorption_water_kg=0.0) + if bal['balance_sample_kg']: + h.records[mid]['sample_mass_kg'] = bal['balance_sample_kg'] + op = h.invoke('measurement.start', measurement_id=mid)['operation_id'] + h.invoke('vessel.scan', rfid=RFID) + if hang: + h.invoke('vessel.hang', rfid=RFID) + h.invoke('measurement.confirm') + return mid, op + + +def finish(h, limit=4000.0, dt=1.0): + t = h.time_s + while h.run is not None and h.time_s - t < limit: + h.step(dt) + return h.time_s - t + + +def take_out(h): + if h.error: + h.invoke('error.acknowledge') + if h.hung: + h.invoke('vessel.remove') + h.invoke('vessel.clean', rfid=RFID) + + +def calibrate(h, n=3, mode=None): + ids = [] + for _ in range(n): + mid, _ = start(h) + finish(h) + ids.append(mid) + take_out(h) + return ids, h.invoke('vessel.select_calibrations', vessel_name='V1', mode=mode or h.mode, measurement_ids=ids) + + +def snapshot(h): + keep = {k: copy.deepcopy(v) for k, v in h.__dict__.items() if k not in ('rng', 'led', '_requests', 'revision')} + keep['led'] = {k: v.value for k, v in h.led.items()} + return keep + + +class IkaC6000RuntimeTests(unittest.TestCase): + # ------------------------------------------------------------ identity, library, metadata + def test01_module_identity(self): + self.assertEqual(rt.ASSET_TYPE_ID, "instrument.ika_c6000") + self.assertEqual(rt.CATALOG_ID, "CHEM-150") + + def test02_library_has_at_least_50_real_substances(self): + lib = rt.library() + subs = list(lib['by_id'].values()) + self.assertGreaterEqual(len(subs), 50) + for s in subs: + self.assertIn(s['evidence'], ('derived', 'measured_literature')) + self.assertTrue(s['source']['file'] and s['source']['sha256']) + self.assertTrue(3000.0 < s['gross_calorific_value_J_g'] < 50000.0) + self.assertEqual(lib['by_id']['benzoic_acid']['certified_calorific_value']['value_J_g'], 26434.0) + + def test03_metadata_complete_and_schemas_lint_clean(self): + meta = rt.export_ika_c6000_contract_metadata() + for k, c in meta['capabilities'].items(): + self.assertTrue(c['source_ids'], k) + for e in c['errors']: + self.assertIn(e['code'], rt.ERROR_ZH, k) + self.assertEqual(asset_tool.lint_schema(c['input_schema']), [], k) + self.assertEqual(asset_tool.lint_schema(c['output_schema']), [], k) + if c['availability'] == 'implemented': + self.assertEqual(asset_tool.validate_value(c['example_arguments'], c['input_schema']), [], k) + for k, s in meta['state_slots'].items(): + self.assertEqual(asset_tool.lint_schema(s['value_schema']), [], k) + self.assertFalse(s['origin'] == 'process_truth' and s['visibility'] == 'agent', k) + + # ------------------------------------------------------------ purity, set points, preconditions + def test04_step_rejects_negative_and_read_is_pure(self): + h = powered(warm=10.0) + with self.assertRaises(rt.ActionRejected): + h.step(-1.0) + t, rev = h.time_s, h.revision + a = h.read('evaluator') + b = h.read('evaluator') + self.assertEqual(a, b) + self.assertEqual((h.time_s, h.revision), (t, rev)) + h.register_principal('ag', 'agent') + d1 = h.session('ag').describe(instance_id=h.instance_id) + self.assertEqual((h.time_s, h.revision), (t, rev)) + self.assertTrue(d1['capabilities']) + + def test05_rejected_call_leaves_state_unchanged(self): + h = powered(warm=10.0) + before = snapshot(h) + for cap, args, code in (('mode.set', dict(mode='isoperibol_30'), 'RUN_MODE_NOT_POSSIBLE'), ('plant.configure', dict(rt.PLANT_EXAMPLE, cooling_pressure_pa=2.0e5), + 'COOLING_PRESSURE_TOO_HIGH'), ('vessel.register', dict(name='V1', serial_number='0012345678', previous_ignitions=0, platinum_wire=False), + 'VESSEL_ALREADY_REGISTERED'), ('measurement.start', dict(measurement_id='m-99'), 'UNKNOWN_MEASUREMENT'), + ('aid.define', dict(list_no=1, name='IKA cotton wool thread', specific_energy_j_kg=None, absolute_energy_j=60.0), 'AID_FIXED'), + ('aid.define', dict(list_no=2, name='x', specific_energy_j_kg=1e7, absolute_energy_j=60.0), 'INVALID_ARGUMENT')): + with self.assertRaises(rt.ActionRejected) as cm: + h.invoke(cap, **args) + self.assertEqual(str(cm.exception), code) + self.assertEqual(snapshot(h), before) + + def test06_mode_set_writes_the_target_only(self): + h = powered(warm=1800.0, cooling_water_k=293.15) # 20 C cooling water: both 22 C and 25 C modes are offered + self.assertIn('isoperibol_22', h._available_modes()) + tj = h.Tj + out = h.invoke('mode.set', mode='isoperibol_22') + self.assertAlmostEqual(out['jacket_setpoint_k'], 295.15) + self.assertEqual(h.Tj, tj) # no instantaneous temperature change + h.step(3600.0) + self.assertLess(abs(h.Tj - 295.15), 0.01) + + def test07_power_up_sequence_opens_cover_and_runs_system_test(self): + h = rt.IkaC6000Runtime() + h.invoke('plant.configure', **rt.PLANT_EXAMPLE) + self.assertEqual(h.lift, 0.0) + h.invoke('power.set', enabled=True) + self.assertEqual(h.state, 'booting') + h.step(rt.SOFTWARE_LOAD_S) + self.assertEqual(h.state, 'system_test') + h.step(20.0) + self.assertGreater(h.lift, 0.0) + h.step(rt.SYSTEM_TEST_S) + self.assertEqual(h.state, 'wait') + self.assertEqual(h.test_result, 'yellow') # preset Isoperibol 22 C does not fit 21.5 C cooling water + self.assertEqual(h.lift, rt.LIFT_TRAVEL_M) + with self.assertRaises(rt.ActionRejected): + h.invoke('measurement.start', measurement_id=h.invoke('measurement.create', name='a', sample_mass_kg=1e-3, kind='calibration', + vessel_name=None, aids=THREAD)['measurement_id']) + h.invoke('mode.set', mode='dynamic_25') + self.assertEqual((h.state, h.test_result), ('system_test', None)) # manual 11.4: the mode change runs a system test + with self.assertRaises(rt.ActionRejected) as cm: + h.invoke('vessel.register', name='V1', serial_number='0012345678', previous_ignitions=0, platinum_wire=False) + self.assertEqual(str(cm.exception), 'NOT_READY') + h.step(rt.MODE_TEST_S) + self.assertEqual((h.state, h.test_result), ('wait', 'green')) + + def test08_system_test_red_and_flow_errors(self): + for plant, err in ((dict(cooling_water_k=303.15), 'SYSTEM_TEST_RED'), (dict(cooling_flow_m3_s=1e-6), 'E32'), (dict(cooling_pressure_pa=0.1e5), 'E31')): + h = rt.IkaC6000Runtime() + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, **plant)) + h.invoke('power.set', enabled=True) + h.step(400.0) + self.assertEqual((h.state, h.error), ('error', err)) + with self.assertRaises(rt.ActionRejected): + h.invoke('cover.close') + + def test09_working_modes_follow_the_cooling_water_table(self): + h = rt.IkaC6000Runtime() + h.invoke('plant.configure', **rt.PLANT_EXAMPLE) + for t5, src, modes in ((289.15, 'tap_water', {22}), (289.15, 'chiller', set()), (291.15, 'chiller', {22}), (294.65, 'tap_water', {25}), + (298.15, 'tap_water', {30}), (293.15, 'tap_water', {22, 25}), (300.65, 'tap_water', set())): + h.plant.update(cooling_water_k=t5, cooling_source=src) + self.assertEqual({rt.mode_parts(m)[1] for m in h._available_modes()}, modes, (t5, src)) + + # ------------------------------------------------------------ measurement sequence and physics + def test10_calibration_sequence_phases_and_throughput(self): + h = powered() + mid, op = start(h) + seen = [] + t0 = h.time_s + while h.run is not None: + h.step(1.0) + if h.run and (not seen or seen[-1] != h.run['phase']): + seen.append(h.run['phase']) + cycle = h.time_s - t0 + self.assertEqual(seen, ['closing', 'filling', 'fill_check', 'o2_filling', 'equalising', 'pre_trial', 'main_trial', 'after_trial', 'degassing', 'draining', 'opening']) + rec = h.records[mid] + self.assertEqual(rec['status'], 'completed') + self.assertEqual(h.operations[op]['phase'], 'succeeded') + self.assertTrue(2.9 < rec['delta_t_k'] < 3.2) # manual: approx. 1 g benzoic acid = 3 K + self.assertTrue(8000.0 < rec['c_value_j_k'] < 9000.0) + self.assertLess(abs(3600.0 / cycle - 4.0), 0.5) # data sheet: 4 measurements per hour (isoperibol) + self.assertEqual((h.lift, h.water_kg, h.vessels[RFID]['state']), (rt.LIFT_TRAVEL_M, 0.0, 'burned_degassed')) + self.assertTrue(40000.0 / rec['c_value_j_k'] < 5.0) # manual: 40 000 J approx. 5 K + + def test11_dynamic_mode_is_faster(self): + h = powered('dynamic_25') + mid, _ = start(h) + cycle = finish(h) + self.assertEqual(h.records[mid]['status'], 'completed') + self.assertLess(abs(3600.0 / cycle - 6.0), 0.8) # data sheet: 6 measurements per hour (dynamic) + self.assertAlmostEqual(h.records[mid]['main_end_time_s'] - h.records[mid]['ignition_time_s'], rt.MAIN_MIN_S['dynamic']) + self.assertIsNone(h.records[mid]['main_end_time_s'] and None) + + def test12_reproducibility_matches_the_data_sheet_ordering(self): + rsd = {} + for mode in ('isoperibol_25', 'dynamic_25'): + h = powered(mode) + cs = [] + for _ in range(8): + mid, _ = start(h) + finish(h) + cs.append(h.records[mid]['c_value_j_k']) + take_out(h) + rsd[mode] = statistics.stdev(cs) / statistics.mean(cs) + self.assertLess(rsd['isoperibol_25'], 0.0005) # 0.05 % RSD (1 g benzoic acid) + self.assertLess(rsd['dynamic_25'], 0.0015) # 0.15 % RSD + self.assertGreater(rsd['dynamic_25'], rsd['isoperibol_25']) + + def test13_measurement_recovers_library_values_after_calibration(self): + h = powered() + calibrate(h, 3) + for sub, m in (('naphthalene', 0.65e-3), ('sucrose', 1.6e-3), ('polymer_pe', 0.55e-3)): + mid, _ = start(h, sub=sub, m=m, kind='measurement') + finish(h) + take_out(h) + ref = rt._lib()['by_id'][sub]['gross_calorific_value_J_g'] * 1000.0 + self.assertLess(abs(h.records[mid]['gross_calorific_value_j_kg'] / ref - 1.0), 0.001, sub) + + def test14_acid_corrections_and_net_value(self): + h = powered() + calibrate(h, 2) + for sub, m in (('urea', 2.0e-3), ('thianthrene', 0.8e-3)): + mid, _ = start(h, sub=sub, m=m, kind='measurement') + finish(h) + h.invoke('vessel.remove') + tit = h.invoke('washings.titrate', rfid=RFID) + lib = rt._lib()['by_id'][sub] + ev = h.invoke('measurement.evaluate', measurement_id=mid, sulfur_mass_fraction=lib['mass_fraction']['S'], total_acid_mol=tit['total_acid_mol'], + hydrogen_mass_fraction=lib['mass_fraction']['H'], moisture_mass_fraction=0.0) + ref = lib['gross_calorific_value_J_g'] * 1000.0 + self.assertGreater(ev['gross_uncorrected_j_kg'], ref * 1.01, sub) # acids add heat + self.assertLess(abs(ev['gross_calorific_value_j_kg'] / ref - 1.0), 0.003, sub) + self.assertAlmostEqual(ev['net_calorific_value_j_kg'], ev['gross_calorific_value_j_kg'] - rt.h_vap_water_j_kg() * rt.water_per_hydrogen() * lib['mass_fraction']['H'], + delta=1e-6) + with self.assertRaises(rt.ActionRejected): + h.invoke('washings.titrate', rfid=RFID) + h.invoke('vessel.clean', rfid=RFID) + + def test15_incomplete_combustion_and_volatile_losses(self): + h = powered() + h.invoke('settings.configure', o2_flush=True, auto_vessel_detection=True, reference_value_j_kg=26434.0e3) + calibrate(h, 2) + mid, _ = start(h, form='powder', kind='measurement') # loose benzoic acid sprays (manual 6.3) + finish(h) + h.invoke('vessel.remove') + self.assertEqual(h.invoke('vessel.inspect', rfid=RFID)['residue'], 'soot') + self.assertLess(h.records[mid]['gross_calorific_value_j_kg'], 0.995 * 26434.0e3) + h.invoke('vessel.clean', rfid=RFID) + mid, _ = start(h, sub='pentane', m=0.5e-3, form='liquid', kind='measurement') + finish(h) + self.assertAlmostEqual(h.vessels[RFID]['vapour_lost_kg'], 0.5e-3, places=12) # two flush vents (manual 11.4.2) carry all the vapour away + self.assertEqual((h.records[mid]['status'], h.records[mid]['error_code']), ('failed', 'E04')) # only the thread burns: no rise + take_out(h) + h.invoke('aid.define', list_no=2, name='Gelatine capsule C 9', specific_energy_j_kg=rt.AIDS['gelatine_capsule'], absolute_energy_j=None) + mid, _ = start(h, sub='pentane', m=0.5e-3, form='capsule', kind='measurement', aids=THREAD + [dict(aid_name='Gelatine capsule C 9', mass_kg=0.12e-3)], + vaids=[dict(kind='gelatine_capsule', mass_kg=0.12e-3)]) + finish(h) + take_out(h) + ref = rt._lib()['by_id']['pentane']['gross_calorific_value_J_g'] * 1000.0 + self.assertLess(abs(h.records[mid]['gross_calorific_value_j_kg'] / ref - 1.0), 0.002) + + def test16_low_oxygen_pressure_gives_incomplete_combustion(self): + h = powered() + calibrate(h, 2) + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, oxygen_supply_pa=1.2e6)) + mid, _ = start(h, kind='measurement') + finish(h) + h.invoke('vessel.remove') + self.assertIn(h.invoke('vessel.inspect', rfid=RFID)['residue'], ('soot', 'unburnt_sample')) + self.assertLess(h.records[mid]['gross_calorific_value_j_kg'], 0.9 * 26434.0e3) + + def test17_error_codes_E11_E04_E07(self): + h = powered() + mid, op = start(h, hang=False) + finish(h) + self.assertEqual((h.records[mid]['status'], h.records[mid]['error_code'], h.state, h.operations[op]['phase']), ('failed', 'E11', 'error', 'failed')) + with self.assertRaises(rt.ActionRejected): + h.invoke('cover.close') # ERROR_PENDING + h.invoke('error.acknowledge') + self.assertFalse(h.records[mid]['ignited']) + h.invoke('vessel.clean', rfid=RFID) + mid, _ = start(h, sub=None) + finish(h) + self.assertEqual((h.records[mid]['error_code'], h.records[mid]['ignited']), ('E04', True)) + take_out(h) + mid, _ = start(h) + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, cooling_water_k=299.15)) # cooling water warmer than the start temperature + finish(h) + self.assertEqual(h.records[mid]['error_code'], 'E07') + self.assertFalse(h.records[mid]['ignited']) + + def test18_cancel_before_and_after_ignition(self): + h = powered() + mid, op = start(h) + h.step(100.0) + h.register_principal('ag', 'agent') + h._owners[op] = 'ag' + h._owners[mid] = 'ag' + s = h.session('ag') + r = s.cancel(op, 'c1') + self.assertEqual(r['status'], 'succeeded') + finish(h) + self.assertEqual((h.records[mid]['status'], h.operations[op]['phase']), ('cancelled_before_ignition', 'cancelled')) + self.assertEqual((h.lift, h.water_kg, h.vessels[RFID]['state']), (rt.LIFT_TRAVEL_M, 0.0, 'prepared')) + h.invoke('vessel.remove') + op2 = h.invoke('measurement.start', measurement_id=mid)['operation_id'] # restartable + h.invoke('vessel.scan', rfid=RFID) + h.invoke('vessel.hang', rfid=RFID) + h.invoke('measurement.confirm') + while h.run['phase'] != 'main_trial': + h.step(1.0) + h._cancel_run(h.operations[op2]) + finish(h) + self.assertEqual((h.records[mid]['status'], h.records[mid]['ignited']), ('cancelled_after_ignition', True)) + with self.assertRaises(rt.ActionRejected) as cm: + h.invoke('measurement.start', measurement_id=mid) + self.assertEqual(str(cm.exception), 'NOT_STARTABLE') + + def test19_power_loss_mid_run_and_degas(self): + h = powered() + mid, op = start(h) + while h.run['phase'] != 'equalising': + h.step(1.0) + h.invoke('power.set', enabled=False) + self.assertEqual((h.records.get(mid, {}).get('status', 'lost'), h.operations[op]['phase']), ('lost', 'failed')) + self.assertEqual(h.vessels[RFID]['state'], 'pressurized') + self.assertGreater(h.water_kg, 1.0) + h.invoke('power.set', enabled=True) + h.step(400.0) + with self.assertRaises(rt.ActionRejected): + h.invoke('vessel.remove') # VESSEL_PRESSURIZED + h.invoke('maintenance.run', program='o2_degas') + h.invoke('maintenance.run', program='empty_water') + h.step(60.0) + self.assertEqual((h.vessels[RFID]['state'], h.water_kg), ('prepared', 0.0)) + h.invoke('vessel.remove') + + def test20_shutdown_saves_records_power_off_without_it_loses_them(self): + h = powered(warm=10.0) + h.invoke('measurement.create', name='a', sample_mass_kg=1e-3, kind='calibration', vessel_name=None, aids=THREAD) + h.invoke('system.shutdown') + h.step(20.0) + self.assertEqual(h.lift, 0.0) + h.invoke('power.set', enabled=False) + self.assertEqual(len(h.records), 1) + h.invoke('power.set', enabled=True) + h.step(400.0) + h.invoke('measurement.create', name='b', sample_mass_kg=1e-3, kind='calibration', vessel_name=None, aids=THREAD) + h.invoke('power.set', enabled=False) + self.assertEqual(len(h.records), 1) + self.assertEqual(h.events[-2]['code'], 'DATA_LOST') + + def test21_calibration_statistics_formulas(self): + h = powered() + ids, st = calibrate(h, 4) + cs = [h.records[m]['c_value_j_k'] for m in ids] + mean, sd = statistics.mean(cs), statistics.stdev(cs) + self.assertAlmostEqual(st['c_value_j_k'], mean) + self.assertAlmostEqual(st['rsd'], sd / mean) + self.assertAlmostEqual(st['ucl_j_k'], mean + 3 * sd / 2.0) + self.assertAlmostEqual(st['lwl_j_k'], mean - 2 * sd / 2.0) + self.assertEqual(h.invoke('vessel.statistics', vessel_name='V1', mode=h.mode), st) + with self.assertRaises(rt.ActionRejected): + h.invoke('vessel.select_calibrations', vessel_name='V1', mode='dynamic_25', measurement_ids=ids) # CALIBRATION_MISMATCH + + def test22_simulation_recomputes_without_changing_records(self): + h = powered() + ids, st = calibrate(h, 2) + rec = copy.deepcopy(h.records[ids[0]]) + out = h.invoke('measurement.simulate', measurement_id=ids[0], delta_t_k=3.0, ignition_energy_j=30.0, c_value_j_k=None, reference_value_j_kg=26000.0e3) + q = 30.0 + 50.0 + self.assertAlmostEqual(out['c_value_j_k'], (26000.0e3 * rec['sample_mass_kg'] + q) / 3.0) + self.assertEqual(h.records[ids[0]], rec) + + def test23_energy_limit_and_rise_flags(self): + h = powered() + calibrate(h, 2) + mid, _ = start(h, sub='polymer_pe', m=0.9e-3, kind='measurement') # ~43 kJ + finish(h) + take_out(h) + self.assertIn('energy_above_40kJ', h.records[mid]['quality_flags']) + self.assertTrue(h.vessels[RFID]['inspection_required']) + self.assertIn('ENERGY_ABOVE_40KJ', [e['code'] for e in h.events]) + mid, _ = start(h, sub='benzoic_acid', m=0.3e-3, kind='measurement') + finish(h) + take_out(h) + self.assertIn('rise_far_from_calibration', h.records[mid]['quality_flags']) + + def test24_ledgers_close(self): + h = powered() + calibrate(h, 2) + mid, _ = start(h, sub='urea', m=1.5e-3, kind='measurement') + h.step(500.0) + led = h.ledger() + self.assertLess(abs(led['energy_residual_j']), 1e-5 * (led['jacket_heater_j'] + led['sample_j'])) + self.assertLess(abs(led['water_residual_kg']), 1e-12) + self.assertLess(abs(led['o2_residual_mol']), 1e-12) + finish(h) + led = h.ledger() + self.assertLess(abs(led['energy_residual_j']), 1e-5 * (led['jacket_heater_j'] + led['sample_j'])) + self.assertAlmostEqual(led['water_in_vessel_kg'], 0.0) + + def test25_host_step_size_independence(self): + res = [] + for dt in (1.0, 7.3): + h = powered(seed=5) + mid, _ = start(h) + finish(h, dt=dt) + res.append(h.records[mid]['c_value_j_k']) + self.assertEqual(res[0], res[1]) + + def test26_two_instances_are_isolated(self): + a, b = powered(seed=2, warm=10.0), powered(seed=2, warm=10.0) + mid, _ = start(a) + a.step(300.0) + self.assertIsNone(b.run) + self.assertEqual(b.vessels[RFID]['state'], 'clean') + self.assertNotEqual(a.time_s, b.time_s) + self.assertEqual(b.records, {}) + + def test27_agent_truth_isolation_and_roles(self): + h = powered(warm=10.0) + h.register_principal('ag', 'agent') + h.register_principal('ev', 'evaluator') + ag, ev = h.session('ag'), h.session('ev') + obs = ag.read(instance_id=h.instance_id)['observations'] + self.assertFalse([k for k in obs if k.startswith('truth.') or k in ('lift.position_m', 'stirrer.angle_rad')]) + self.assertIn('truth.water_k', ev.read(instance_id=h.instance_id)['observations']) + with self.assertRaises(rt.ActionRejected): + ag.read(instance_id=h.instance_id, state_ids=['truth.c_total_j_k']) + for cap, args in (('vessel.prepare', rt.PREPARE_EXAMPLE), ('sim.step', dict(dt_s=1.0)), ('ledger.read', {}), ('plant.configure', rt.PLANT_EXAMPLE)): + r = ag.invoke(instance_id=h.instance_id, capability_id=cap, arguments=args, request_id='x-' + cap) + self.assertEqual((r['status'], r['error']['code']), ('rejected', 'ACCESS_DENIED'), cap) + d = ag.describe(instance_id=h.instance_id) + self.assertNotIn('ledger.read', d['capabilities']) + self.assertNotIn('truth.water_k', d['state_slots']) + + def test28_request_binding_and_foreign_agents(self): + h = powered(warm=10.0) + for p in ('a1', 'a2'): + h.register_principal(p, 'agent') + a1, a2 = h.session('a1'), h.session('a2') + args = dict(name='x', sample_mass_kg=1e-3, kind='calibration', vessel_name=None, aids=THREAD) + r1 = a1.invoke(instance_id=h.instance_id, capability_id='measurement.create', arguments=args, request_id='r1') + self.assertEqual(a1.invoke(instance_id=h.instance_id, capability_id='measurement.create', arguments=args, request_id='r1'), r1) + r = a1.invoke(instance_id=h.instance_id, capability_id='measurement.create', arguments=dict(args, name='y'), request_id='r1') + self.assertEqual(r['error']['code'], 'REQUEST_CONFLICT') + mid = r1['result']['measurement_id'] + h.invoke('vessel.prepare', **rt.PREPARE_EXAMPLE) + st = a1.invoke(instance_id=h.instance_id, capability_id='measurement.start', arguments=dict(measurement_id=mid), request_id='s1') + self.assertEqual(st['status'], 'accepted') + for cap, a in (('measurement.confirm', {}), ('cover.close', {}), ('measurement.result', dict(measurement_id=mid)), ('vessel.scan', dict(rfid=RFID))): + r = a2.invoke(instance_id=h.instance_id, capability_id=cap, arguments=a, request_id='f-' + cap) + self.assertEqual(r['error']['code'], 'ACCESS_DENIED', cap) + with self.assertRaises(rt.ActionRejected): + a2.cancel(st['operation_id'], 'c2') + self.assertTrue(a2.read(instance_id=h.instance_id)['observations']['measurement.started_by_other_agent']['value']) + self.assertIsNone(a2.read(instance_id=h.instance_id)['observations']['measurement.id']['value']) + lst = a2.invoke(instance_id=h.instance_id, capability_id='archive.list', arguments={}, request_id='l2')['result']['measurements'] + self.assertEqual(lst, []) + self.assertEqual(a1.poll(st['operation_id'])['status'], 'running') + + def test29_return_values_validate_against_declared_schemas(self): + h = powered() + meta = rt.export_ika_c6000_contract_metadata()['capabilities'] + ids, st = calibrate(h, 2) + mid, _ = start(h, sub='urea', m=1.5e-3, kind='measurement') + finish(h) + h.invoke('vessel.remove') + outs = dict(stats=('vessel.statistics', dict(vessel_name='V1', mode=h.mode)), res=('measurement.result', dict(measurement_id=mid)), + tit=('washings.titrate', dict(rfid=RFID)), insp=('vessel.inspect', dict(rfid=RFID)), arch=('archive.list', {}), ev=('events.read', dict(since_s=0.0)), + led=('ledger.read', {}), prov=('provenance.read', {}), sim=('measurement.simulate', dict(measurement_id=mid, delta_t_k=3.0, ignition_energy_j=30.0, + c_value_j_k=None, reference_value_j_kg=None)), + evl=('measurement.evaluate', dict(measurement_id=mid, sulfur_mass_fraction=0.0, total_acid_mol=0.002, hydrogen_mass_fraction=0.067, + moisture_mass_fraction=0.0)), mnt=('maintenance.run', dict(program='flow_outer'))) + for key, (cap, args) in outs.items(): + val = h.invoke(cap, **args) + self.assertEqual(asset_tool.validate_value(val, meta[cap]['output_schema']), [], cap) + values = h.read('evaluator') + slots = rt.export_ika_c6000_contract_metadata()['state_slots'] + for k, v in values.items(): + self.assertEqual(asset_tool.validate_value(v, slots[k]['value_schema']), [], k) + + def test30_unsupported_capabilities_return_unsupported(self): + h = powered(warm=10.0) + h.register_principal('ag', 'agent') + before = snapshot(h) + for k in rt.UNSUPPORTED: + r = h.session('ag').invoke(instance_id=h.instance_id, capability_id=k, arguments={}, request_id='u-' + k) + self.assertEqual((r['status'], r['error']['code']), ('unsupported', 'UNSUPPORTED')) + self.assertIn('mode.adiabatic', rt.UNSUPPORTED) + self.assertEqual(snapshot(h), before) + + def test31_lift_and_stirrer_mirrors(self): + h = powered(warm=10.0) + h.invoke('cover.close') + h.step(5.0) + self.assertAlmostEqual(h.lift, rt.LIFT_TRAVEL_M - 5 * rt.LIFT_SPEED_M_S, places=9) + h.step(20.0) + self.assertEqual(h.read()['cover.state'], 'closed') + h.invoke('maintenance.run', program='fill_water') + h.step(60.0) + out = h.invoke('maintenance.run', program='stirrer') + self.assertTrue(out['running'] and out['stirrer_rpm'] == rt.STIRRER_RPM and out['flow_m3_s'] is None) + a0 = h.stir_angle + h.step(1.0) + self.assertAlmostEqual((h.stir_angle - a0) % (2 * math.pi), 2 * math.pi * rt.STIRRER_RPM / 60.0 % (2 * math.pi), places=9) + self.assertTrue(0.0 <= h.stir_angle < rt.STIRRER_JOINT_MAX_RAD) + h.invoke('maintenance.run', program='stirrer') + h.invoke('maintenance.run', program='empty_water') + h.step(60.0) + self.assertEqual(h.water_kg, 0.0) + + def test32_readings_resolution_and_power_off(self): + h = powered(warm=10.0) + t1 = h.read()['inner.indicated_k'] + self.assertAlmostEqual(t1 / rt.RESOLUTION_K, round(t1 / rt.RESOLUTION_K), places=6) + h.invoke('power.set', enabled=False) + h.step(2.0) + self.assertIsNone(h.read()['inner.indicated_k']) + + def test33_vessel_registry_limits_and_pressure_test_warning(self): + h = powered(warm=10.0) + for i in range(2, 5): + h.invoke('vessel.provide', rfid=f'X{i}', model='C 6010') + h.invoke('vessel.scan', rfid=f'X{i}') + h.invoke('vessel.register', name=f'V{i}', serial_number=f'00000000{i:02d}', previous_ignitions=0, platinum_wire=False) + h.invoke('vessel.provide', rfid='X5', model='C 6010') + h.invoke('vessel.scan', rfid='X5') + with self.assertRaises(rt.ActionRejected) as cm: + h.invoke('vessel.register', name='V5', serial_number='0000000005', previous_ignitions=0, platinum_wire=False) + self.assertEqual(str(cm.exception), 'TOO_MANY_VESSELS') + h2 = rt.IkaC6000Runtime() + h2.invoke('plant.configure', **rt.PLANT_EXAMPLE) + h2.invoke('power.set', enabled=True) + h2.step(400.0) + h2.invoke('mode.set', mode='isoperibol_25') + h2.step(rt.MODE_TEST_S + 1.0) + h2.invoke('settings.configure', o2_flush=False, auto_vessel_detection=True, reference_value_j_kg=26434.0e3) + h2.invoke('vessel.scan', rfid=RFID) + h2.invoke('vessel.register', name='V1', serial_number='0012345678', previous_ignitions=999, platinum_wire=False) + h2.step(3600.0) + mid, _ = start(h2) + finish(h2) + self.assertIn('PRESSURE_TEST_DUE', [e['code'] for e in h2.events]) + self.assertIn('pressure_test_due', h2.records[mid]['quality_flags']) + + def test34_create_and_confirm_preconditions(self): + h = powered(warm=10.0) + with self.assertRaises(rt.ActionRejected) as cm: + h.invoke('measurement.create', name='a', sample_mass_kg=1e-3, kind='calibration', vessel_name=None, aids=[dict(aid_name='IKA cotton wool thread', mass_kg=1e-4)]) + self.assertEqual(str(cm.exception), 'AID_MASS_MISMATCH') + mid = h.invoke('measurement.create', name='a', sample_mass_kg=1e-3, kind='measurement', vessel_name=None, aids=THREAD)['measurement_id'] + h.invoke('vessel.prepare', **rt.PREPARE_EXAMPLE) + h.invoke('measurement.start', measurement_id=mid) + with self.assertRaises(rt.ActionRejected) as cm: + h.invoke('measurement.confirm') + self.assertEqual(str(cm.exception), 'VESSEL_NOT_SCANNED') + h.invoke('vessel.scan', rfid=RFID) + with self.assertRaises(rt.ActionRejected) as cm: + h.invoke('measurement.confirm') + self.assertEqual(str(cm.exception), 'C_VALUE_REQUIRED') # a measurement needs the vessel's C-value in this mode + + def test35_prepare_rules(self): + h = powered(warm=10.0) + with self.assertRaises(rt.ActionRejected) as cm: + h.invoke('vessel.prepare', rfid=RFID, sample=dict(substance_id='chloroform', mass_kg=1e-3, form='liquid'), aids=[], absorption_water_kg=0.0) + self.assertEqual(str(cm.exception), 'UNKNOWN_SUBSTANCE') # halogen samples are not modelled + with self.assertRaises(rt.ActionRejected) as cm: + h.invoke('vessel.prepare', rfid=RFID, sample=dict(substance_id='ethanol', mass_kg=1e-3, form='pellet'), aids=[], absorption_water_kg=0.0) + self.assertEqual(str(cm.exception), 'FORM_NOT_POSSIBLE') + h.invoke('vessel.prepare', **rt.PREPARE_EXAMPLE) + with self.assertRaises(rt.ActionRejected) as cm: + h.invoke('vessel.prepare', **rt.PREPARE_EXAMPLE) + self.assertEqual(str(cm.exception), 'VESSEL_NOT_CLEAN') + + def test37_key_toggle_cover_open_sim_step_and_manual_c_value(self): + h = powered(warm=10.0) + self.assertEqual(h.invoke('power.toggle'), dict(enabled=False)) + self.assertEqual(h.state, 'off') + self.assertEqual(h.invoke('power.toggle'), dict(enabled=True)) + t = h.time_s + self.assertEqual(h.invoke('sim.step', dt_s=400.0)['time_s'], t + 400.0) + h.invoke('cover.close') + h.invoke('sim.step', dt_s=30.0) + self.assertEqual(h.read()['cover.state'], 'closed') + h.invoke('cover.open') + h.invoke('sim.step', dt_s=30.0) + self.assertEqual(h.read()['cover.state'], 'open') + h.invoke('vessel.set_c_value', vessel_name='V1', mode=h.mode, c_value_j_k=8650.0) + h.step(3600.0) + mid, _ = start(h, sub='naphthalene', m=0.65e-3, kind='measurement') + finish(h) + rec = h.records[mid] + self.assertEqual((rec['status'], rec['c_value_j_k']), ('completed', 8650.0)) + self.assertIn('manual_c_value', rec['quality_flags']) + + def test36_benzoic_condition_factor(self): + self.assertAlmostEqual(rt.benzoic_condition_factor(3.0e6, 0.3e-3, 0.3e-3, 0.1e-3, 298.15), 1.0, places=12) + self.assertAlmostEqual(rt.benzoic_condition_factor(3.1e6, 1.0e-3, 0.0, 0.22e-3, 298.15), + 1 + 1e-6 * (200 * 0.1 + 42 * (1 / 0.22 - 3) + 30 * (0 - 3)), places=12) + + + # ------------------------------------------------------------ independent runtime review round 1 (F01-F17) + def test38_power_loss_after_ignition_keeps_the_vessel_pressurized(self): + h = powered() + mid, op = start(h) + while h.run['phase'] != 'main_trial': + h.step(1.0) + h.invoke('power.set', enabled=False) + v = h.vessels[RFID] + self.assertEqual(v['state'], 'burned') + self.assertGreater(h._vessel_pressure(v), 2.0e6) + h.invoke('power.set', enabled=True) + h.step(rt.SOFTWARE_LOAD_S + rt.SYSTEM_TEST_S + 60.0) + with self.assertRaises(rt.ActionRejected) as cm: + h.invoke('vessel.remove') + self.assertEqual(str(cm.exception), 'VESSEL_PRESSURIZED') + h.invoke('maintenance.run', program='o2_degas') + self.assertEqual(h.vessels[RFID]['state'], 'burned_degassed') + h.invoke('vessel.remove') + h.invoke('vessel.inspect', rfid=RFID) + h.invoke('washings.titrate', rfid=RFID) + h.invoke('vessel.clean', rfid=RFID) + led = h.ledger() + self.assertLess(abs(led['o2_residual_mol']), 1e-12) + self.assertLess(abs(led['energy_residual_j']), 1e-6 * (led['jacket_heater_j'] + led['sample_j'])) + + def test39_thread_and_aids_need_oxygen_too(self): + h = powered() + h.invoke('aid.define', list_no=2, name='Paraffin oil', specific_energy_j_kg=rt.AIDS['paraffin_oil'], absolute_energy_j=None) + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, oxygen_supply_pa=1.0e5)) # no oxygen added: only the enclosed air + mid = h.invoke('measurement.create', name='o2', sample_mass_kg=1.0e-3, kind='calibration', vessel_name=None, + aids=THREAD + [dict(aid_name='Paraffin oil', mass_kg=0.5e-3)])['measurement_id'] + h.invoke('vessel.prepare', rfid=RFID, sample=dict(substance_id='benzoic_acid', mass_kg=1.0e-3, form='pellet'), + aids=[dict(kind='paraffin_oil', mass_kg=0.5e-3)], absorption_water_kg=0.0) + h.invoke('measurement.start', measurement_id=mid) + h.invoke('vessel.scan', rfid=RFID) + h.invoke('vessel.hang', rfid=RFID) + h.invoke('measurement.confirm') + while h.run is not None and h.run['phase'] not in ('main_trial', 'degassing'): + h.step(1.0) + v = h.vessels[RFID] + led = h.ledger() + o2_available = led['o2_filled_mol'] # air O2 only (plus nothing added) + chemical = led['thread_j'] + led['aid_j'] + led['sample_j'] + self.assertLessEqual(chemical, o2_available * rt.Q_PER_MOL_O2 * 1.001) + self.assertLess(chemical, 1000.0) # far below the 23 kJ label value of the aid alone + self.assertLessEqual(v['gas']['CO2'], led['o2_consumed_mol'] + 1e-15) + self.assertGreaterEqual(v['gas']['O2'], -1e-15) + finish(h) + self.assertLess(abs(h.ledger()['o2_residual_mol']), 1e-12) + + def test40_acid_corrected_calibrations_make_evaluation_consistent(self): + h = powered() + ids, acids = [], [] + for _ in range(3): + mid, _ = start(h) + finish(h) + h.invoke('vessel.remove') + acids.append(h.invoke('washings.titrate', rfid=RFID)['total_acid_mol']) + h.invoke('vessel.clean', rfid=RFID) + ids.append(mid) + st0 = h.invoke('vessel.select_calibrations', vessel_name='V1', mode=h.mode, measurement_ids=ids) + for mid, acid in zip(ids, acids): + ev = h.invoke('measurement.evaluate', measurement_id=mid, sulfur_mass_fraction=0.0, total_acid_mol=acid, hydrogen_mass_fraction=None, moisture_mass_fraction=0.0) + rec = h.records[mid] + self.assertEqual(ev['kind'], 'calibration') + self.assertAlmostEqual(ev['c_value_j_k'], ev['c_value_uncorrected_j_k'] + acid * rt.HNO3_J_MOL / rec['delta_t_k'], delta=1e-9) + self.assertEqual((rec['c_value_j_k'], rec['acid_correction_j']), (ev['c_value_j_k'], acid * rt.HNO3_J_MOL)) + st = h.invoke('vessel.statistics', vessel_name='V1', mode=h.mode) + self.assertAlmostEqual(st['c_value_j_k'], statistics.mean(h.records[m]['c_value_j_k'] for m in ids), delta=1e-9) + self.assertGreater(st['c_value_j_k'], st0['c_value_j_k']) # the acid heat of the calibrations is no longer lost + mid, _ = start(h, kind='measurement') # benzoic acid measured as a sample + finish(h) + h.invoke('vessel.remove') + tit = h.invoke('washings.titrate', rfid=RFID) + ev = h.invoke('measurement.evaluate', measurement_id=mid, sulfur_mass_fraction=0.0, total_acid_mol=tit['total_acid_mol'], hydrogen_mass_fraction=None, + moisture_mass_fraction=0.0) + self.assertLess(abs(ev['gross_calorific_value_j_kg'] / 26434.0e3 - 1.0), 0.0005) # within the documented 0.05 % RSD + res = h.invoke('measurement.result', measurement_id=ids[0]) # workbook output "total heat": the measured C dT + self.assertAlmostEqual(res['total_heat_j'], res['c_value_j_k'] * res['delta_t_k'], delta=1e-9) + rec0 = h.records[ids[0]] + self.assertAlmostEqual(res['total_heat_j'], rec0['reference_value_j_kg'] * rec0['sample_mass_kg'] + rec0['q_ext_j'] + rec0['acid_correction_j'], delta=1e-6) + + def test41_no_truth_or_foreign_results_in_events_and_slots(self): + h = powered() + calibrate(h, 2) + h.register_principal('a1', 'agent') + h.register_principal('a2', 'agent') + a1, a2 = h.session('a1'), h.session('a2') + mid = a1.invoke(instance_id=h.instance_id, capability_id='measurement.create', request_id='c1', + arguments=dict(name='pe', sample_mass_kg=0.9e-3, kind='measurement', vessel_name=None, aids=THREAD))['result']['measurement_id'] + h.invoke('vessel.prepare', rfid=RFID, sample=dict(substance_id='polymer_pe', mass_kg=0.9e-3, form='pellet'), aids=[], absorption_water_kg=0.0) + a1.invoke(instance_id=h.instance_id, capability_id='measurement.start', arguments=dict(measurement_id=mid), request_id='s1') + a1.invoke(instance_id=h.instance_id, capability_id='vessel.scan', arguments=dict(rfid=RFID), request_id='sc1') + a1.invoke(instance_id=h.instance_id, capability_id='vessel.hang', arguments=dict(rfid=RFID), request_id='h1') + a1.invoke(instance_id=h.instance_id, capability_id='measurement.confirm', arguments={}, request_id='cf1') + finish(h) + truth = h.vessels[RFID]['last_heat_j'] + self.assertGreater(truth, rt.MAX_ENERGY_J) + msgs = [e['message_zh'] for e in h.invoke('events.read', since_s=0.0)['events']] + self.assertFalse([m for m in msgs if f'{truth:.0f}' in m]) # the true heat never reaches the log + warn = [e for e in h.events if e['code'] == 'ENERGY_ABOVE_40KJ'] + self.assertEqual(len(warn), 1) + rec = h.records[mid] + self.assertIn(f"{rec['c_value_j_k'] * rec['delta_t_k']:.0f}", warn[0]['message_zh']) # the measured energy + r2 = a2.read(instance_id=h.instance_id)['observations'] + self.assertIsNone(r2['result.gross_calorific_value_j_kg']['value']) + self.assertIsNone(r2['result.delta_t_k']['value']) + self.assertIsNotNone(a1.read(instance_id=h.instance_id)['observations']['result.gross_calorific_value_j_kg']['value']) + ev2 = a2.invoke(instance_id=h.instance_id, capability_id='events.read', arguments=dict(since_s=0.0), request_id='e2')['result']['events'] + ev1 = a1.invoke(instance_id=h.instance_id, capability_id='events.read', arguments=dict(since_s=0.0), request_id='e1')['result']['events'] + own = {(e['time_s'], e['code']) for e in h.events if e['_mid'] == mid} + self.assertTrue(own and own <= {(e['time_s'], e['code']) for e in ev1}) + self.assertFalse(own & {(e['time_s'], e['code']) for e in ev2}) + self.assertFalse([e for e in ev2 if mid in e['message_zh'] or e['code'] == 'ENERGY_ABOVE_40KJ']) + self.assertFalse([e for e in ev1 + ev2 if '_mid' in e]) + + def test42_rejected_confirm_and_restart_bind_the_scanned_vessel(self): + h = powered() + h.invoke('vessel.provide', rfid='X2', model='C 6010') + h.invoke('vessel.scan', rfid='X2') + h.invoke('vessel.register', name='V2', serial_number='0000000002', previous_ignitions=0, platinum_wire=False) + h.invoke('vessel.set_c_value', vessel_name='V2', mode=h.mode, c_value_j_k=8600.0) + mid = h.invoke('measurement.create', name='m', sample_mass_kg=0.65e-3, kind='measurement', vessel_name=None, aids=THREAD)['measurement_id'] + h.invoke('vessel.prepare', rfid='X2', sample=dict(substance_id='naphthalene', mass_kg=0.65e-3, form='pellet'), aids=[], absorption_water_kg=0.0) + h.invoke('measurement.start', measurement_id=mid) + h.invoke('vessel.scan', rfid=RFID) # V1 has no C-value in this mode + with self.assertRaises(rt.ActionRejected) as cm: + h.invoke('measurement.confirm') + self.assertEqual(str(cm.exception), 'C_VALUE_REQUIRED') + self.assertIsNone(h.run['vessel_name']) # nothing bound by the rejected confirm + h.invoke('vessel.scan', rfid='X2') + h.invoke('vessel.hang', rfid='X2') + h.invoke('measurement.confirm') + self.assertEqual(h.records[mid]['vessel_name'], 'V2') + finish(h) + h.invoke('vessel.remove') + h.invoke('vessel.clean', rfid='X2') + # automatic detection: cancel before ignition, then restart with another vessel + cal = h.invoke('measurement.create', name='c', sample_mass_kg=1.0e-3, kind='calibration', vessel_name=None, aids=THREAD)['measurement_id'] + h.invoke('vessel.prepare', **rt.PREPARE_EXAMPLE) + op = h.invoke('measurement.start', measurement_id=cal)['operation_id'] + h.invoke('vessel.scan', rfid=RFID) + h.invoke('vessel.hang', rfid=RFID) + h.invoke('measurement.confirm') + h.step(30.0) + h._cancel_run(h.operations[op]) + finish(h) + self.assertEqual((h.records[cal]['status'], h.records[cal]['vessel_name']), ('cancelled_before_ignition', None)) + h.invoke('vessel.remove') + h.invoke('vessel.prepare', rfid='X2', sample=dict(substance_id='benzoic_acid', mass_kg=1.0e-3, form='pellet'), aids=[], absorption_water_kg=0.0) + h.invoke('measurement.start', measurement_id=cal) + self.assertIsNone(h.run['vessel_name']) # waits for a new scan + h.invoke('vessel.scan', rfid='X2') + h.invoke('vessel.hang', rfid='X2') + h.invoke('measurement.confirm') + finish(h) + self.assertEqual((h.records[cal]['status'], h.records[cal]['vessel_name']), ('completed', 'V2')) + self.assertEqual((h.registry['V1']['ignitions'], h.registry['V2']['ignitions']), (0, 2)) + + def test43_records_can_be_deleted(self): + h = powered() + ids, _ = calibrate(h, 2) + extra = h.invoke('measurement.create', name='x', sample_mass_kg=1e-3, kind='calibration', vessel_name=None, aids=THREAD)['measurement_id'] + with self.assertRaises(rt.ActionRejected) as cm: + h.invoke('measurement.delete', measurement_ids=[ids[0]]) + self.assertEqual(str(cm.exception), 'RECORD_IN_USE') + self.assertEqual(h.invoke('measurement.delete', measurement_ids=[extra]), dict(deleted=[extra])) + self.assertNotIn(extra, h.records) + mid, _ = start(h) + with self.assertRaises(rt.ActionRejected) as cm: + h.invoke('measurement.delete', measurement_ids=[mid]) + self.assertEqual(str(cm.exception), 'MEASUREMENT_RUNNING') + finish(h) + take_out(h) + h.register_principal('a1', 'agent') + h.register_principal('a2', 'agent') + own = h.session('a1').invoke(instance_id=h.instance_id, capability_id='measurement.create', request_id='c', + arguments=dict(name='o', sample_mass_kg=1e-3, kind='calibration', vessel_name=None, aids=THREAD))['result']['measurement_id'] + r = h.session('a2').invoke(instance_id=h.instance_id, capability_id='measurement.delete', arguments=dict(measurement_ids=[own]), request_id='d2') + self.assertEqual(r['error']['code'], 'ACCESS_DENIED') + r = h.session('a1').invoke(instance_id=h.instance_id, capability_id='measurement.delete', arguments=dict(measurement_ids=[own]), request_id='d1') + self.assertEqual(r['status'], 'succeeded') + + def test44_immersion_is_latched_on_the_instrument_cycle(self): + res = [] + for dt in (1.0, 0.3, 0.7): + h = powered(seed=5) + h.invoke('maintenance.run', program='fill_water') # water already in the inner vessel while the cover closes + h.step(60.0) + mid, _ = start(h) + finish(h, dt=dt) + res.append(h.records[mid]['c_value_j_k']) + self.assertEqual(res[0], res[1]) + self.assertEqual(res[0], res[2]) + + def test45_cancel_refused_during_the_end_sequence(self): + h = powered() + h.register_principal('ag', 'agent') + s = h.session('ag') + for sub, final, code in (('benzoic_acid', 'completed', None), (None, 'failed', 'E04')): + mid, op = start(h, sub=sub) + h._owners[op] = 'ag' + while h.run['phase'] != 'degassing': + h.step(1.0) + with self.assertRaises(rt.ActionRejected) as cm: + s.cancel(op, 'c-' + str(sub)) + self.assertEqual(str(cm.exception), 'NOT_CANCELLABLE') + finish(h) + self.assertEqual((h.records[mid]['status'], h.records[mid]['error_code']), (final, code)) + self.assertEqual(h.error, code) + take_out(h) + + def test46_power_loss_restores_saved_records_and_rebuilds_c_values(self): + h = powered() + ids, st = calibrate(h, 2) + waiting = h.invoke('measurement.create', name='w', sample_mass_kg=1e-3, kind='calibration', vessel_name=None, aids=THREAD)['measurement_id'] + h.invoke('system.shutdown') + h.step(20.0) + h.invoke('power.set', enabled=False) + h.invoke('power.set', enabled=True) + h.step(rt.SOFTWARE_LOAD_S + rt.SYSTEM_TEST_S + 60.0) + c_saved = h.registry['V1']['c'][h.mode] + self.assertEqual(c_saved, st['c_value_j_k']) + new, _ = start(h) # a new, unsaved calibration + finish(h) + take_out(h) + h.invoke('vessel.select_calibrations', vessel_name='V1', mode=h.mode, measurement_ids=[ids[1], new]) + h.invoke('measurement.delete', measurement_ids=[ids[0]]) # a saved record deleted after the shutdown + h.invoke('vessel.prepare', **rt.PREPARE_EXAMPLE) # the saved, never-run record is run now + h.invoke('measurement.start', measurement_id=waiting) + h.invoke('vessel.scan', rfid=RFID) + h.invoke('vessel.hang', rfid=RFID) + h.invoke('measurement.confirm') + finish(h) + self.assertEqual(h.records[waiting]['status'], 'completed') + spare = h.invoke('measurement.create', name='s', sample_mass_kg=1e-3, kind='calibration', vessel_name=None, aids=THREAD)['measurement_id'] + h.invoke('power.set', enabled=False) # no shutdown: changes since the last save are lost + self.assertNotIn(new, h.records) + self.assertNotIn(spare, h.records) + self.assertEqual(h.records[waiting]['status'], 'created') # back to the saved version + self.assertEqual(h.registry['V1']['calibrations'][h.mode], ids) # the saved selection and C-value + self.assertEqual(h.registry['V1']['c'][h.mode], c_saved) + + def test47_documented_27C_cooling_water_is_not_red(self): + self.assertEqual(rt.quantize(300.15, 0.01), 300.15) + h = rt.IkaC6000Runtime() + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, cooling_water_k=300.15, noise_seed=3)) + h.invoke('power.set', enabled=True) + h.step(rt.SOFTWARE_LOAD_S + rt.SYSTEM_TEST_S + 1.0) + self.assertEqual((h.test_result, h.error), ('yellow', None)) # the 30 C modes are offered, the preset 22 C is not + self.assertIn('isoperibol_30', h.read()['mode.available']) + + def test48_absorption_water_adds_heat_capacity(self): + cs = {} + for water in (0.0, 10e-3): + h = powered(warm=10.0) + h.invoke('vessel.prepare', rfid=RFID, sample=dict(substance_id='benzoic_acid', mass_kg=1e-3, form='pellet'), aids=[], absorption_water_kg=water) + h.invoke('vessel.hang', rfid=RFID) + cs[water] = h.read('evaluator')['truth.c_total_j_k'] + h.invoke('vessel.remove') + h.invoke('vessel.clean', rfid=RFID) + led = h.ledger() + self.assertLess(abs(led['energy_residual_j']), 1e-6 * max(1.0, led['jacket_heater_j'])) + self.assertAlmostEqual(cs[10e-3] - cs[0.0], 10e-3 * rt.CP_WATER, places=9) + + def test49_result_slots_describe_the_last_run(self): + h = powered() + calibrate(h, 1) + v = h.read() + self.assertIsNotNone(v['result.c_value_j_k']) + self.assertIsNone(v['result.gross_calorific_value_j_kg']) + start(h, kind='measurement') + finish(h) + take_out(h) + v = h.read() + self.assertIsNone(v['result.c_value_j_k']) + self.assertIsNotNone(v['result.gross_calorific_value_j_kg']) + start(h) + finish(h) + v = h.read() + self.assertIsNone(v['result.gross_calorific_value_j_kg']) # after a calibration no stale Ho + + def test50_metadata_matches_behaviour(self): + meta = rt.export_ika_c6000_contract_metadata() + caps, slots = meta['capabilities'], meta['state_slots'] + step_effects = {e['state_id'] for e in caps['sim.step']['state_effects']} + self.assertTrue({'truth.water_k', 'lift.position_m', 'result.delta_t_k', 'measurement.phase', 'inner.indicated_k'} <= step_effects) + props = caps['aid.define']['input_schema']['properties'] + self.assertEqual((props['specific_energy_j_kg']['anyOf'][0]['x-unit'] if 'anyOf' in props['specific_energy_j_kg'] else props['specific_energy_j_kg']['x-unit']), 'J/kg') + out = caps['maintenance.run']['output_schema']['properties'] + self.assertNotIn('reading', out) + self.assertEqual(caps['vessel.register']['input_schema']['properties']['previous_ignitions']['type'], 'integer') + self.assertNotIn('E30', slots['system.error_code']['meaning_zh']) + self.assertNotIn('E26', slots['system.error_code']['meaning_zh']) + self.assertIn('SYSTEM_TEST_RED', slots['system.error_code']['meaning_zh']) + h = powered(warm=10.0) + with self.assertRaises(rt.ActionRejected) as cm: + h.invoke('vessel.register', name='V9', serial_number='0000000009', previous_ignitions=999.7, platinum_wire=False) + self.assertEqual(str(cm.exception), 'INVALID_ARGUMENT') + h.register_principal('ag', 'agent') + d = h.session('ag').describe(instance_id=h.instance_id) + visible = set(d['state_slots']) + for k, c in d['capabilities'].items(): + refs = {e['state_id'] for e in c['state_effects']} | set(c['observes']) | set(c['execution']['completion_state_ids']) + for pre in c['preconditions']: + refs |= set(pre['state_ids']) + self.assertTrue(refs <= visible, (k, refs - visible)) + + def test51_manual_operating_details(self): + h = rt.IkaC6000Runtime() + self.assertEqual(h.settings['reference_value_j_kg'], 26461.0e3) # manual factory setting + h = powered() + h.invoke('mode.set', mode='isoperibol_25') # manual 11.4: runs a system test + with self.assertRaises(rt.ActionRejected) as cm: # manual 10.3: shutdown only from Wait + h.invoke('system.shutdown') + self.assertEqual(str(cm.exception), 'NOT_READY') + h.step(rt.MODE_TEST_S + 1.0) + h.invoke('settings.configure', o2_flush=True, auto_vessel_detection=True, reference_value_j_kg=26434.0e3) + vented0 = h.ledger()['o2_vented_mol'] + mid, _ = start(h) + while h.run['phase'] != 'equalising': + h.step(1.0) + V = rt.VESSEL_VOLUME_M3['C 6012'] + R = rt.GAS_CONSTANT * rt.T_REF + n_air, added = rt.P_ATM * V / R, (h.plant['oxygen_supply_pa'] - rt.P_ATM) * V / R + filled, keep = added * h.plant['oxygen_purity'], rt.P_ATM / h.plant['oxygen_supply_pa'] + o2, vent = 0.2095 * n_air + filled, 0.0 + for _ in range(2): # manual 11.4.2: emptied twice before the actual filling + vent += o2 * (1.0 - keep) + o2 = o2 * keep + filled + self.assertAlmostEqual(h.ledger()['o2_vented_mol'] - vented0, vent, delta=1e-12) + self.assertAlmostEqual(h.vessels[RFID]['gas']['O2'], o2, delta=1e-12) + finish(h) + + def test52_simulation_defaults_reproduce_the_record(self): + h = powered() + ids, _ = calibrate(h, 2) + mid, _ = start(h, sub='naphthalene', m=0.65e-3, kind='measurement') + finish(h) + take_out(h) + rec = h.records[mid] + h.invoke('vessel.set_c_value', vessel_name='V1', mode=h.mode, c_value_j_k=9000.0) # today's C-value differs + out = h.invoke('measurement.simulate', measurement_id=mid, delta_t_k=rec['delta_t_k'], ignition_energy_j=rec['ignition_energy_j'], c_value_j_k=None, + reference_value_j_kg=None) + self.assertEqual(out['gross_calorific_value_j_kg'], rec['gross_calorific_value_j_kg']) + cal = h.records[ids[0]] + h.invoke('settings.configure', o2_flush=False, auto_vessel_detection=True, reference_value_j_kg=26461.0e3) + out = h.invoke('measurement.simulate', measurement_id=ids[0], delta_t_k=cal['delta_t_k'], ignition_energy_j=cal['ignition_energy_j'], c_value_j_k=None, + reference_value_j_kg=None) + self.assertAlmostEqual(out['c_value_j_k'], cal['c_value_j_k'], delta=1e-9) + + + # ------------------------------------------------------------ independent runtime review round 2 (F18-F21) + def test53_record_changes_need_the_owner_and_no_foreign_run(self): + h = powered() + ids, _ = calibrate(h, 2) # host records (no owner) + for p in ('a1', 'a2'): + h.register_principal(p, 'agent') + a1, a2 = h.session('a1'), h.session('a2') + r = a1.invoke(instance_id=h.instance_id, capability_id='measurement.evaluate', request_id='e0', + arguments=dict(measurement_id=ids[0], sulfur_mass_fraction=0.0, total_acid_mol=0.05, hydrogen_mass_fraction=None, moisture_mass_fraction=0.0)) + self.assertEqual(r['error']['code'], 'ACCESS_DENIED') # not the agent's calibration + r = a1.invoke(instance_id=h.instance_id, capability_id='measurement.delete', arguments=dict(measurement_ids=[ids[0]]), request_id='d0') + self.assertEqual(r['error']['code'], 'ACCESS_DENIED') + own = [] + for k in range(2): # a1's own calibrations, selected for V1 + mid = a1.invoke(instance_id=h.instance_id, capability_id='measurement.create', request_id=f'c{k}', + arguments=dict(name=f'cal{k}', sample_mass_kg=1e-3, kind='calibration', vessel_name=None, aids=THREAD))['result']['measurement_id'] + h.invoke('vessel.prepare', **rt.PREPARE_EXAMPLE) + a1.invoke(instance_id=h.instance_id, capability_id='measurement.start', arguments=dict(measurement_id=mid), request_id=f's{k}') + a1.invoke(instance_id=h.instance_id, capability_id='vessel.scan', arguments=dict(rfid=RFID), request_id=f'sc{k}') + a1.invoke(instance_id=h.instance_id, capability_id='vessel.hang', arguments=dict(rfid=RFID), request_id=f'h{k}') + a1.invoke(instance_id=h.instance_id, capability_id='measurement.confirm', arguments={}, request_id=f'cf{k}') + finish(h) + take_out(h) + own.append(mid) + a1.invoke(instance_id=h.instance_id, capability_id='vessel.select_calibrations', arguments=dict(vessel_name='V1', mode=h.mode, measurement_ids=own), request_id='sel') + c0 = h.registry['V1']['c'][h.mode] + mid = a2.invoke(instance_id=h.instance_id, capability_id='measurement.create', request_id='b', + arguments=dict(name='b', sample_mass_kg=0.65e-3, kind='measurement', vessel_name=None, aids=THREAD))['result']['measurement_id'] + h.invoke('vessel.prepare', rfid=RFID, sample=dict(substance_id='naphthalene', mass_kg=0.65e-3, form='pellet'), aids=[], absorption_water_kg=0.0) + a2.invoke(instance_id=h.instance_id, capability_id='measurement.start', arguments=dict(measurement_id=mid), request_id='bs') + a2.invoke(instance_id=h.instance_id, capability_id='vessel.scan', arguments=dict(rfid=RFID), request_id='bsc') + a2.invoke(instance_id=h.instance_id, capability_id='vessel.hang', arguments=dict(rfid=RFID), request_id='bh') + a2.invoke(instance_id=h.instance_id, capability_id='measurement.confirm', arguments={}, request_id='bcf') + h.step(200.0) + r = a1.invoke(instance_id=h.instance_id, capability_id='measurement.evaluate', request_id='e1', + arguments=dict(measurement_id=own[0], sulfur_mass_fraction=0.0, total_acid_mol=0.05, hydrogen_mass_fraction=None, moisture_mass_fraction=0.0)) + self.assertEqual(r['error']['code'], 'ACCESS_DENIED') # a2's measurement runs with this C-value + h.invoke('vessel.set_c_value', vessel_name='V1', mode=h.mode, c_value_j_k=10000.0) # even the host changes it mid-run ... + finish(h) + self.assertEqual(h.records[mid]['c_value_j_k'], c0) # ... the run uses the C-value valid at its confirmation + ref = rt._lib()['by_id']['naphthalene']['gross_calorific_value_J_g'] * 1000.0 + self.assertLess(abs(h.records[mid]['gross_calorific_value_j_kg'] / ref - 1.0), 0.003) + + def test54_manual_c_value_releases_the_selected_calibrations(self): + h = powered() + ids, _ = calibrate(h, 2) + with self.assertRaises(rt.ActionRejected) as cm: + h.invoke('measurement.delete', measurement_ids=[ids[0]]) + self.assertEqual(str(cm.exception), 'RECORD_IN_USE') + h.invoke('vessel.set_c_value', vessel_name='V1', mode=h.mode, c_value_j_k=8650.0) + st = h.invoke('vessel.statistics', vessel_name='V1', mode=h.mode) + self.assertEqual((st['c_value_j_k'], st['n']), (8650.0, 0)) + self.assertEqual(h.invoke('measurement.delete', measurement_ids=[ids[0]]), dict(deleted=[ids[0]])) + meta = rt.export_ika_c6000_contract_metadata() + self.assertIn('两次', meta['state_slots']['settings.o2_flush']['meaning_zh']) + self.assertTrue(any('Q_acid' in eq for eq in meta['mechanisms']['c6000_isoperibol_bomb_calorimetry']['equations'])) + + + def test55_quality_flags_follow_the_c_value_basis_fixed_at_confirmation(self): + h = powered() + ids, _ = calibrate(h, 2) + mid, _ = start(h, sub='naphthalene', m=0.65e-3, kind='measurement') # C from calibrations at confirmation + h.step(200.0) + h.invoke('vessel.set_c_value', vessel_name='V1', mode=h.mode, c_value_j_k=9500.0) # manual C mid-run + finish(h) + take_out(h) + self.assertNotIn('manual_c_value', h.records[mid]['quality_flags']) + mid, _ = start(h, sub='benzoic_acid', m=0.3e-3, kind='measurement') # confirmed with the manual C, no calibration basis + h.step(200.0) + h.invoke('vessel.select_calibrations', vessel_name='V1', mode=h.mode, measurement_ids=ids) + finish(h) + take_out(h) + rec = h.records[mid] + self.assertEqual(rec['c_value_j_k'], 9500.0) + self.assertIn('manual_c_value', rec['quality_flags']) + self.assertNotIn('rise_far_from_calibration', rec['quality_flags']) # no calibrations behind the C-value it used + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_asset_ika_plate_rctdigital.py b/tests/test_asset_ika_plate_rctdigital.py new file mode 100644 index 0000000000000000000000000000000000000000..815bdbfe535a0338bd7ad9567317d55ac4d3ad2d --- /dev/null +++ b/tests/test_asset_ika_plate_rctdigital.py @@ -0,0 +1,690 @@ +"""tests for CHEM-008 ika_plate_rctdigital (IKA Plate (RCT digital) 25004601 magnetic hotplate stirrer): python3 -m unittest tests/test_asset_ika_plate_rctdigital.py + +Themes: contract consistency (slots, effects, errors raised vs declared); agent / evaluator truth isolation; idempotent request ids; two instances +isolated; step-partition independence; rejected calls leave the state unchanged; every output validated against its schema and every success +changes only declared slots; heating rate (6.5 K/min, 1 l water / H1500) and self-heating (+13 K) as calibrated; PT1000 PID and 2P control; plate +control; safety circuit (Err. 25 with a short-circuited TRIAC, Err. 24 when lowered below the plate); Error 5 (sensor out of the medium), Err. 6 +(sensor pulled while heating), Err. 4 (motor blocked), Err. 3 (heat accumulation under an overhanging pot at 310 C), Err. 14, 21, 31; boiling at +the pressure-corrected boiling point with the latent heat; evaporation; bar decoupling in a viscous medium and the viscosity trend; timer with the +expiry actions and the counter; intermittent / reverse stirring; operating modes A / B after a power failure; lock; HOT! display; NAMUR commands +and watchdogs 1 / 2; energy and liquid-mass ledgers close.""" +import copy +import json +import math +import re +import sys +import unittest +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / 'scripts')) +from asset_runtime import ika_plate_rctdigital as rt # noqa: E402 + +INST = 'ika_plate_rctdigital_01' +CHECKS = [] +SEEN_CAPS = set() +PROCESS_EVIDENCE = {} +C0 = 273.15 +RPM = rt.RPM + + +def _differ(x, y): + if isinstance(x, float) and isinstance(y, float): + return abs(x - y) > 1e-12 * max(1.0, abs(x), abs(y)) + return json.dumps(x, sort_keys=True, default=str) != json.dumps(y, sort_keys=True, default=str) + + +class Rig: + def __init__(self, seed=1, instance=INST, **plant): + self.h = rt.IkaPlateRctdigitalRuntime(instance) + self.h.register_principal('agent', 'agent') + self.h.register_principal('eval', 'evaluator') + self.A = self.h.session('agent') + self.E = self.h.session('eval') + self.n = 0 + self.inst = instance + self.call(self.E, 'plant.configure', **dict(rt.PLANT_EXAMPLE, noise_seed=seed, **plant)) + + def call(self, sess, cap, expect='succeeded', **args): + self.n += 1 + before, t0 = self.h.read('evaluator'), self.h.t + r = sess.invoke(instance_id=self.inst, capability_id=cap, arguments=args, request_id=f'r{self.n}') + after = self.h.read('evaluator') + changed = {k for k in after if _differ(after[k], before[k])} - {'clock.time_s'} + if expect == 'succeeded': + assert r['status'] == 'succeeded', (cap, r['error']) + rt.validate(rt.CAPS[cap]['output_schema'], r['result']) + if cap != 'sim.step': + extra = changed - set(rt.EFFECTS.get(cap, [])) + assert not extra, (cap, sorted(extra)) + assert self.h.t == t0, cap + SEEN_CAPS.add(cap) + PROCESS_EVIDENCE.setdefault(cap, []).append(dict(arguments=json.dumps(args, sort_keys=True, default=str)[:200], time_s=t0, status=r['status'])) + return r['result'] + assert r['status'] in ('rejected', 'unsupported'), (cap, r['status'], r.get('result')) + assert r['error']['code'] == expect, (cap, r['error']['code'], expect) + assert not changed, (cap, 'rejected call changed', sorted(changed)) + assert expect in [e['code'] for e in rt.export_ika_plate_rctdigital_contract_metadata()['capabilities'][cap]['errors']], (cap, expect) + return r + + def step(self, s): + self.call(self.E, 'sim.step', dt_s=float(s)) + + def read(self, *ids, who=None): + sess = who or self.E + o = sess.read(instance_id=self.inst, state_ids=list(ids) if ids else None)['observations'] + return {k: v['value'] for k, v in o.items()} if not ids or len(ids) > 1 else o[ids[0]]['value'] + + def truth(self): + return self.read('truth.process') + + def on(self): + self.call(self.A, 'power.set', on=True) + + def beaker(self, vessel='beaker_600ml', sid='water', ml=500.0, bar=0.04, **kw): + return self.call(self.A, 'vessel.place', vessel=vessel, substance_id=sid, volume_m3=ml * 1e-6, stir_bar_length_m=bar, **kw) + + def stir(self, rpm): + self.call(self.A, 'stirring.set_speed', speed_rad_s=rpm * RPM) + self.call(self.A, 'stirring.set', on=True) + + def heat(self, c): + self.call(self.A, 'heating.set_temperature', temperature_k=C0 + c) + self.call(self.A, 'heating.set', on=True) + + def ledger(self): + return self.call(self.E, 'ledger.read')['ledger'] + + def events(self): + return [e['code'] for e in self.call(self.E, 'events.read', since_s=0.0)['events']] + + +def _balance(test, L): + scale = max(abs(L['e_heater_j']) + abs(L['e_magnet_j']) + abs(L['e_vessel_in_j']), 1.0) + test.assertLess(abs(L['energy_balance_j']), 1e-9 * scale + 1e-6, L) + test.assertLess(abs(L['mass_balance_kg']), 1e-12 + 1e-12 * L['m_placed_kg'], L) + + +def _raised_codes(): + src = Path(rt.__file__).read_text() + funcs = {} + for m in re.finditer(r'\n def (\w+)\(self[^\n]*\n(.*?)(?=\n def |\n# ----|\nclass |\ndef )', src, re.S): + funcs[m.group(1)] = m.group(2) + own = {k: set(re.findall(r"ActionRejected\('([A-Z_]+)'\)", v)) for k, v in funcs.items()} + calls = {k: set(re.findall(r'self\.(_\w+)\(', v)) & set(funcs) for k, v in funcs.items()} + out = {} + for k in funcs: + if not k.startswith('_cmd_'): + continue + seen, todo, codes = set(), [k], set() + while todo: + f = todo.pop() + if f in seen: + continue + seen.add(f) + codes |= own.get(f, set()) + todo += [g for g in calls.get(f, ()) if g not in ('_cmd_sim_step', 'step', '_tick')] + out[k] = codes + name = {'_cmd_' + c.replace('.', '_'): c for c in rt.CAPS} + return {name[k]: v for k, v in out.items() if k in name} + + +class Contract(unittest.TestCase): + def test_metadata_slots_effects_consistent(self): + m = rt.export_ika_plate_rctdigital_contract_metadata() + for k, c in m['capabilities'].items(): + for e in c['state_effects']: + self.assertIn(e['state_id'], m['state_slots'], (k, e)) + for p in c['preconditions']: + for s in p['state_ids']: + self.assertIn(s, m['state_slots'], (k, s)) + for s in rt.SCENE_MIRRORED: + self.assertIn(s, rt.SLOTS) + self.assertEqual(rt.SLOTS[s]['visibility'], 'agent') + CHECKS.append(dict(id='metadata_consistent')) + + def test_declared_errors_cover_raised_codes(self): + m = rt.export_ika_plate_rctdigital_contract_metadata() + for cap, codes in _raised_codes().items(): + declared = {e['code'] for e in m['capabilities'][cap]['errors']} + self.assertFalse(codes - declared, (cap, codes - declared)) + + def test_unsupported_capabilities(self): + g = Rig() + for k in rt.UNSUPPORTED: + r = g.A.invoke(instance_id=INST, capability_id=k, arguments={}, request_id='u' + k) + self.assertEqual((r['status'], r['error']['code']), ('unsupported', 'UNSUPPORTED')) + + def test_agent_truth_isolation(self): + g = Rig() + obs = g.A.read(instance_id=INST)['observations'] + self.assertFalse([k for k in obs if k.startswith('truth.')]) + for cap, args in (('truth.inspect', {}), ('ledger.read', {}), ('fault.inject', dict(fault='motor_blocked', active=True)), ('medium.modify', dict(viscosity_factor=2.0)), + ('sim.step', dict(dt_s=1.0))): + r = g.A.invoke(instance_id=INST, capability_id=cap, arguments=args, request_id='x' + cap) + self.assertEqual(r['error']['code'], 'ACCESS_DENIED') + d = g.A.describe(instance_id=INST) + self.assertNotIn('truth.inspect', d['capabilities']) + self.assertNotIn('truth.process', d['state_slots']) + + def test_idempotent_request_ids(self): + g = Rig() + r1 = g.A.invoke(instance_id=INST, capability_id='power.toggle', arguments={}, request_id='same') + r2 = g.A.invoke(instance_id=INST, capability_id='power.toggle', arguments={}, request_id='same') + self.assertEqual(r1, r2) + self.assertTrue(g.read('power.on')) + r3 = g.A.invoke(instance_id=INST, capability_id='power.set', arguments=dict(on=False), request_id='same') + self.assertEqual(r3['error']['code'], 'REQUEST_CONFLICT') + + def test_two_instances_isolated(self): + a, b = Rig(instance='a'), Rig(instance='b') + a.on() + a.heat(80.0) + a.step(60.0) + self.assertFalse(b.read('power.on')) + self.assertEqual(b.h.Tp, rt.PLANT_EXAMPLE['ambient_k']) + + def test_step_partition_independence(self): + def run(parts): + g = Rig(seed=7) + g.on() + g.beaker() + g.call(g.A, 'sensor.set', connected=True, immersed=True) + g.stir(600) + g.heat(60.0) + g.call(g.A, 'stirring.configure', expect='FUNCTIONS_RUNNING', run_s=30.0) + g.call(g.A, 'timer.set', duration_s=95.0) + g.call(g.A, 'timer.toggle') + for dt in parts: + g.step(dt) + r = g.h.read('evaluator') + return json.dumps({k: r[k] for k in r if k != 'clock.time_s'}, sort_keys=True, default=float), g.ledger() + a, la = run([300.0]) + b, lb = run([0.05] * 6000) + c, lc = run([7.33] * 40 + [6.8]) + self.assertEqual(a, b) + self.assertEqual(a, c) + self.assertEqual(json.dumps(la, sort_keys=True), json.dumps(lb, sort_keys=True)) + + def test_rejections_change_nothing(self): + g = Rig() + g.call(g.A, 'heating.set', expect='POWER_OFF', on=True) + g.on() + g.call(g.A, 'heating.set_temperature', expect='ABOVE_SAFETY_LIMIT', temperature_k=C0 + 300.0) if g.h.heat['safe_k'] < C0 + 315.0 else None + g.call(g.A, 'safety.set_limit', limit_k=C0 + 200.0) + g.call(g.A, 'heating.set_temperature', expect='ABOVE_SAFETY_LIMIT', temperature_k=C0 + 190.0) + g.call(g.A, 'safety.set_limit', expect='BELOW_SET_MARGIN', limit_k=C0 + 30.0 + 10.0 if False else C0 + 50.0) if g.h.heat['set_k'] > C0 + 35.0 else None + g.call(g.A, 'sensor.set', expect='NOT_IMMERSIBLE', connected=True, immersed=True) + g.call(g.A, 'vessel.place', expect='OVERFILL', vessel='beaker_250ml', substance_id='water', volume_m3=300e-6) + g.call(g.A, 'vessel.place', expect='NOT_LIQUID', vessel='h1000', substance_id='diethyl_ether', volume_m3=500e-6, initial_k=C0 + 40.0) + g.call(g.A, 'vessel.place', expect='BAR_LENGTH', vessel='beaker_250ml', substance_id='water', volume_m3=200e-6, stir_bar_length_m=0.07) + g.call(g.A, 'vessel.remove', expect='NO_VESSEL') + g.call(g.A, 'namur.send', expect='NO_CONNECTION', command='IN_PV_2') + g.call(g.A, 'timer.toggle', expect='TIMER_NOT_SET') + g.call(g.A, 'viscosity.reset', expect='NOT_VISC_MODE') + g.stir(300) + g.call(g.A, 'menu.configure', expect='FUNCTIONS_RUNNING', operating_mode='B') + g.call(g.A, 'stirring.configure', expect='FUNCTIONS_RUNNING', auto_reverse=True) + g.call(g.A, 'stirring.set', on=False) + g.call(g.A, 'stirring.configure', expect='NEEDS_INTERVAL', auto_reverse=True) + g.call(g.A, 'lock.toggle') + g.call(g.A, 'heating.set_temperature', expect='LOCKED', temperature_k=C0 + 50.0) + g.call(g.A, 'lock.toggle') + g.call(g.A, 'interface.set', connected=True) + g.call(g.A, 'namur.send', expect='UNKNOWN_COMMAND', command='FOO_9') + g.call(g.A, 'namur.send', expect='ABOVE_SAFETY_LIMIT', command='OUT_SP_1 250') + g.call(g.E, 'plant.configure', expect='SEED_FIXED', **dict(rt.PLANT_EXAMPLE, noise_seed=99)) + g.call(g.E, 'medium.modify', expect='NO_VESSEL', viscosity_factor=3.0) + + +class Physics(unittest.TestCase): + def test_heating_rate_and_boiling_with_ledgers(self): + g = Rig() + g.on() + g.beaker('h1500', ml=1000.0) + g.stir(600) + g.heat(310.0) + t30 = t80 = None + while t80 is None: + g.step(1.0) + tl = g.truth()['charge_k'] - C0 + if t30 is None and tl >= 30.0: + t30 = g.h.t + if tl >= 80.0: + t80 = g.h.t + self.assertAlmostEqual(50.0 / (t80 - t30) * 60.0, rt.DOC['heating_rate_k_s'] * 60.0, delta=0.05) # datasheet 6.5 K/min (calibrated) + g.step(1800.0) + tr = g.truth() + self.assertAlmostEqual(tr['charge_k'], rt.boiling_k('water', 101325.0), delta=0.05) # boiling at 100 C + self.assertGreater(tr['liquid']['boiled_kg'], 0.1) + self.assertLess(g.read('display.temperature'), 311.0) + _balance(self, g.ledger()) + r = g.call(g.A, 'vessel.remove')['vessel'] + self.assertAlmostEqual(r['liquid_mass_kg'] + r['evaporated_kg'] + r['boiled_kg'], 1e-3 * rt.LIQ['water']['density']['value'], delta=1e-9) + _balance(self, g.ledger()) + + def test_boiling_point_follows_pressure(self): + g = Rig(pressure_pa=80000.0) + g.on() + g.beaker('beaker_600ml', sid='ethanol', ml=300.0) + g.stir(500) + g.heat(120.0) + g.step(600.0) + tb = rt.boiling_k('ethanol', 80000.0) + self.assertLess(tb, rt.LIQ['ethanol']['boiling_point']['value'] - 5.0) + self.assertAlmostEqual(g.truth()['charge_k'], tb, delta=0.05) + self.assertGreater(g.truth()['liquid']['boiled_kg'], 0.0) + _balance(self, g.ledger()) + g.step(3600.0) # boiled dry: the empty beaker heats up + self.assertEqual(g.truth()['liquid']['mass_kg'], 0.0) + self.assertGreater(g.truth()['charge_k'], tb + 5.0) + _balance(self, g.ledger()) + + def test_self_heating(self): + g = Rig(ambient_k=C0 + 22.0) + g.on() + g.stir(1500) + g.step(3600.0) + self.assertAlmostEqual(g.truth()['plate_k'] - (C0 + 22.0), rt.DOC['self_heating_k'], delta=0.1) # datasheet +13 K + self.assertTrue(g.read('indicator.motor')) + + def test_pid_and_two_point(self): + res = {} + for mode in ('pid', '2p'): + g = Rig() + g.on() + g.beaker() + g.call(g.A, 'sensor.set', connected=True, immersed=True) + self.assertEqual(g.read('heating.control'), 'pid') + g.call(g.A, 'heating.set_mode', mode=mode) + g.stir(600) + g.heat(50.0) + peak, reach = 0.0, None + while g.h.t < 2400.0: + g.step(2.0) + tl = g.truth()['charge_k'] - C0 + peak = max(peak, tl) + if reach is None and tl >= 49.5: + reach = g.h.t + dev = [] + for _ in range(300): + g.step(2.0) + dev.append(abs(g.truth()['charge_k'] - C0 - 50.0)) + res[mode] = (reach, peak - 50.0, max(dev)) + if mode == 'pid': + self.assertAlmostEqual(g.read('display.temperature'), 50.0, delta=0.3) + self.assertEqual(g.call(g.E, 'truth.inspect')['process']['plate_target_k'] is not None, True) + self.assertLess(res['pid'][2], rt.DOC['medium_control_accuracy_pt1000_k']) # datasheet +-0.5 K + self.assertLess(res['2p'][0], res['pid'][0]) # manual: 2P fastest, PID minimal overshoot + self.assertGreater(res['2p'][1], res['pid'][1]) + + def test_safety_circuit_errors_24_25(self): + g = Rig() + g.on() + g.call(g.A, 'safety.set_limit', limit_k=C0 + 120.0) + g.call(g.E, 'fault.inject', fault='triac_short', active=True) + g.step(900.0) + self.assertEqual(g.read('error.code'), 25) + self.assertEqual(g.read('display.message'), 'E25') + self.assertLess(g.truth()['plate_k'], C0 + 125.0) + g.call(g.A, 'heating.set', expect='ERROR_ACTIVE', on=True) + g.call(g.E, 'fault.inject', fault='triac_short', active=False) + g.call(g.A, 'power.set', on=False) + self.assertEqual(g.read('display.message'), 'HOt') + self.assertTrue(g.read('indicator.hot')) + g.step(3600.0) + g.call(g.A, 'power.set', on=False) + g.on() + self.assertIsNone(g.read('error.code')) + g.call(g.A, 'safety.set_limit', limit_k=C0 + 370.0) # manual p.27 step 2: screw to the clockwise stop + g.heat(100.0) # step 3: set point = desired safe temperature + g.step(900.0) + for lim in (160.0, 130.0, 115.0): # step 4: turn slowly anticlockwise ... + g.call(g.A, 'safety.set_limit', limit_k=C0 + lim) # (below set + 15 K is allowed for the screw) + self.assertIsNone(g.read('error.code')) + g.call(g.A, 'safety.set_limit', limit_k=C0 + 95.0) # ... until the heating switches off with Err. 25 + self.assertEqual(g.read('error.code'), 25) + self.assertFalse(g.read('heating.on')) + self.assertEqual(g.read('display.safe_temperature'), 95) + self.assertEqual(g.read('heating.set_k'), C0 + 80.0) # the set point follows the knob maximum (limit - 15 K) + g.call(g.A, 'heating.set_temperature', expect='ABOVE_SAFETY_LIMIT', temperature_k=C0 + 90.0) # the knob maximum stays 15 K below the limit + _balance(self, g.ledger()) + g2 = Rig() # heating off and the screw turned below the hot plate: Err. 24 + g2.on() + g2.heat(100.0) + g2.step(900.0) + g2.call(g2.A, 'heating.set', on=False) + g2.call(g2.A, 'safety.set_limit', limit_k=C0 + 60.0) + self.assertEqual(g2.read('error.code'), 24) + _balance(self, g2.ledger()) + + def test_error5_and_error6(self): + g = Rig() + g.on() + g.beaker() + g.call(g.A, 'sensor.set', connected=True, immersed=False) # sensor lying beside the beaker + g.call(g.A, 'menu.configure', err5_timeout_s=300.0) + g.stir(400) + g.heat(60.0) + g.step(400.0) + self.assertEqual(g.read('error.code'), 5) + self.assertFalse(g.read('heating.on')) + g.call(g.A, 'power.toggle') + g.call(g.A, 'power.toggle') + self.assertIsNone(g.read('error.code')) + g.call(g.A, 'sensor.set', connected=True, immersed=True) + g.heat(60.0) + g.step(400.0) + self.assertIsNone(g.read('error.code')) # in the medium: the reading rises + g.call(g.A, 'sensor.set', connected=False, immersed=False) + self.assertEqual(g.read('error.code'), 6) + + def test_motor_errors_and_bar_decoupling_viscosity_trend(self): + g = Rig() + g.on() + g.beaker('beaker_600ml', sid='ethylene_glycol', ml=400.0, bar=0.06) + g.call(g.A, 'menu.configure', display='visc') + g.stir(800) + g.step(30.0) + self.assertTrue(g.truth()['bar_coupled']) + v0 = g.read('display.visc_trend') + self.assertAlmostEqual(v0, 100.0, delta=2.0) # manual: starts at 100 % + g.call(g.E, 'medium.modify', viscosity_factor=8.0) # the medium thickens + g.step(5.0) + self.assertGreater(g.read('display.visc_trend'), 150.0) + g.call(g.A, 'viscosity.reset') + g.step(1.0) + self.assertAlmostEqual(g.read('display.visc_trend'), 100.0, delta=2.0) + g.call(g.E, 'medium.modify', viscosity_factor=200.0) # far too viscous: the bar decouples + g.step(5.0) + self.assertFalse(g.truth()['bar_coupled']) + self.assertIn('BAR_DECOUPLED', g.events()) + g.call(g.E, 'fault.inject', fault='motor_blocked', active=True) + g.step(1.0) + self.assertEqual(g.read('error.code'), 4) + self.assertFalse(g.read('stirring.on')) + + def test_error3_overhanging_pot(self): + g = Rig(ambient_k=C0 + 38.0) + g.on() + g.call(g.A, 'vessel.place', vessel='h5000', substance_id='decane', volume_m3=1e-3, stir_bar_length_m=0.05) + g.heat(310.0) + g.step(3 * 3600.0) + self.assertEqual(g.read('error.code'), 3) + h = Rig(ambient_k=C0 + 40.0) + h.on() + h.heat(310.0) + h.step(3600.0) + self.assertIsNone(h.read('error.code')) # rated conditions: no Err. 3 + + def test_sensor_heater_and_selftest_faults(self): + g = Rig() + g.on() + g.call(g.A, 'sensor.set', connected=True, immersed=False) + g.call(g.E, 'fault.inject', fault='sensor_short', active=True) + self.assertEqual(g.read('error.code'), 14) + g.call(g.E, 'fault.inject', fault='sensor_short', active=False) + g.call(g.A, 'power.toggle') + g.call(g.E, 'fault.inject', fault='safety_test_fault', active=True) + g.call(g.A, 'power.toggle') + self.assertEqual(g.read('error.code'), 21) + g.call(g.E, 'fault.inject', fault='safety_test_fault', active=False) + g.call(g.A, 'power.toggle') + g.call(g.A, 'power.toggle') + g.call(g.E, 'fault.inject', fault='heater_switch_fault', active=True) + self.assertEqual(g.read('error.code'), 31) + + def test_timer_counter_intermittent_reverse(self): + g = Rig() + g.on() + g.beaker() + g.call(g.A, 'stirring.configure', run_s=30.0, pause_s=10.0, auto_reverse=True) + g.call(g.A, 'menu.configure', expiry_stop_heating=True, expiry_stop_stirring=True) + g.stir(500) + g.heat(40.0) + g.call(g.A, 'timer.set', duration_s=100.0) + g.call(g.A, 'timer.toggle') + signs = [] + for _ in range(95): + g.step(1.0) + signs.append(math.copysign(1, g.truth()['motor_rad_s']) if abs(g.truth()['motor_rad_s']) > 1 else 0) + self.assertIn(1, signs) + self.assertIn(-1, signs) # reversed after the first pause + self.assertIn(0, signs) + g.step(10.0) + self.assertTrue(g.read('timer.state')['expired']) + self.assertFalse(g.read('heating.on')) + self.assertFalse(g.read('stirring.on')) + g.call(g.A, 'timer.toggle', expect='TIMER_EXPIRED') + g.call(g.A, 'timer.set', duration_s=0.0) + g.call(g.A, 'timer.toggle') + g.step(42.0) + self.assertAlmostEqual(g.read('timer.state')['elapsed_s'], 42.0, delta=1e-6) + g.call(g.A, 'timer.clear') + + def test_modes_power_failure_lock_and_namur(self): + g = Rig() + g.on() + g.call(g.A, 'menu.configure', operating_mode='B', beep=False, unit='F') + g.stir(400) + g.call(g.E, 'fault.inject', fault='mains_outage', active=True) + self.assertFalse(g.read('indicator.motor')) + g.call(g.E, 'fault.inject', fault='mains_outage', active=False) + self.assertTrue(g.read('stirring.on')) # mode B continues + g.call(g.A, 'stirring.set', on=False) + g.call(g.A, 'menu.configure', operating_mode='A') + g.stir(400) + g.call(g.E, 'fault.inject', fault='mains_outage', active=True) + g.call(g.E, 'fault.inject', fault='mains_outage', active=False) + self.assertFalse(g.read('stirring.on')) # mode A starts with everything off + self.assertFalse(g.read('indicator.standby')) + g.call(g.A, 'power.set', on=False) + self.assertTrue(g.read('indicator.standby')) + g.on() + g.call(g.A, 'lock.toggle') + self.assertTrue(g.read('indicator.lock')) + g.call(g.A, 'interface.set', connected=True) + self.assertEqual(g.call(g.A, 'namur.send', command='IN_NAME')['response'], 'RCT digital') + g.call(g.A, 'namur.send', command='OUT_SP_1 80') # remote control is not blocked by the panel lock + self.assertEqual(g.read('heating.set_k'), C0 + 80.0) + g.call(g.A, 'namur.send', command='OUT_SP_4 700') + g.call(g.A, 'namur.send', command='START_4') + g.call(g.A, 'namur.send', command='START_1') + g.step(10.0) + self.assertTrue(g.call(g.A, 'namur.send', command='IN_PV_4')['response'].endswith(' 4')) + self.assertEqual(g.call(g.A, 'namur.send', command='IN_SP_3')['response'], '370 3') + g.call(g.A, 'namur.send', command='OUT_SP_12@50') + g.call(g.A, 'namur.send', command='OUT_SP_42@100') + g.call(g.A, 'namur.send', command='OUT_WD2@30') + g.step(40.0) + self.assertTrue(g.read('interface.state')['wd2_active']) + self.assertEqual(g.read('display.message'), 'SAFE') + g.call(g.A, 'namur.send', command='OUT_WD2@0') + g.call(g.A, 'namur.send', command='OUT_WD1@20') + g.call(g.A, 'interface.set', connected=False) + g.step(25.0) + self.assertEqual(g.read('error.code'), 1) + self.assertFalse(g.read('heating.on') or g.read('stirring.on')) + g.call(g.A, 'lock.toggle') + g.call(g.A, 'interface.set', connected=True) + g.call(g.A, 'namur.send', command='RESET') + g.call(g.A, 'namur.send', command='SET_MODE_D') + self.assertEqual(g.read('menu.state')['operating_mode'], 'D') + + def test_evaporation_and_removal_with_sensor(self): + g = Rig() + g.on() + g.beaker('beaker_250ml', sid='dichloromethane', ml=100.0, bar=0.03) + g.call(g.A, 'sensor.set', connected=True, immersed=True) + g.stir(300) + g.heat(35.0) + g.step(1200.0) + tr = g.truth() + self.assertGreater(tr['liquid']['evaporated_kg'], 1e-4) + g.call(g.A, 'vessel.remove', expect='SENSOR_IMMERSED') + g.call(g.A, 'sensor.set', connected=True, immersed=False) + g.call(g.A, 'heating.set', on=False) + g.call(g.A, 'vessel.remove') + _balance(self, g.ledger()) + + def test_quiet_stepping_is_exact(self): + g = Rig() + n = g.h.tick + g.step(30 * 86400.0) + self.assertEqual(g.h.tick - n, int(round(30 * 86400.0 / rt.DT))) + g.on() + g.call(g.A, 'heating.set_temperature', temperature_k=C0 + 50.0) + g.call(g.A, 'stirring.set_speed', speed_rad_s=0.0) + g.call(g.A, 'heating.toggle') + g.call(g.A, 'stirring.toggle') + g.step(10.0) + g.call(g.A, 'heating.toggle') + g.step(8 * 3600.0) + self.assertEqual(g.truth()['plate_k'], rt.PLANT_EXAMPLE['ambient_k']) # back at ambient: quiet again + n = g.h.tick + g.step(10 * 86400.0) + self.assertEqual(g.h.tick - n, int(round(10 * 86400.0 / rt.DT))) + _balance(self, g.ledger()) + + +class RoundOneFixes(unittest.TestCase): + """Regression tests of the round-1 review findings (R1-*, C1-*).""" + + def test_idle_plate_still_evaporates(self): # R1-QUIET-EVAP + g = Rig() + g.beaker('beaker_250ml', sid='dichloromethane', ml=100.0, bar=0.0) + g.step(600.0) + tr = g.truth() + self.assertGreater(tr['liquid']['evaporated_kg'], 5e-3) # ~12 g in 10 min from an open 250 ml beaker + self.assertLess(tr['charge_k'], rt.PLANT_EXAMPLE['ambient_k'] - 0.5) # evaporative cooling + _balance(self, g.ledger()) + + def test_humidity_slows_water_evaporation(self): # R1-EVAP-DRY-AIR + out = {} + for rh in (0.0, 0.5, 1.0): + g = Rig(relative_humidity=rh) + g.beaker('beaker_600ml', sid='water', ml=400.0, bar=0.0) + g.step(3600.0) + out[rh] = g.truth()['liquid']['evaporated_kg'] + _balance(self, g.ledger()) + self.assertGreater(out[0.0], 1.6 * out[0.5]) + self.assertGreater(out[0.5], out[1.0]) + area = math.pi * (rt.VESSELS['beaker_600ml']['od_m'] / 2.0) ** 2 + self.assertLess(out[0.5] / area, 0.2) # still-air indoor range ~0.05-0.15 kg/(m2 h) + + def test_blocked_motor_before_start_gives_err4(self): # R1-ERR4-QUIET + g = Rig() + g.on() + g.call(g.E, 'fault.inject', fault='motor_blocked', active=True) + g.call(g.A, 'stirring.set', on=True) + g.step(1.0) + self.assertEqual(g.read('error.code'), 4) + self.assertFalse(g.read('stirring.on')) + g2 = Rig() + g2.on() + g2.stir(300) + g2.call(g2.E, 'fault.inject', fault='motor_blocked', active=True) # injected while stirring: at once + self.assertEqual(g2.read('error.code'), 4) + + def test_truth_events_hidden_from_agent(self): # C1-EVENT-LEAK + g = Rig() + g.on() + g.beaker('beaker_600ml', sid='ethylene_glycol', ml=400.0, bar=0.06) + g.stir(800) + g.step(10.0) + g.call(g.E, 'medium.modify', viscosity_factor=200.0) + g.step(5.0) + self.assertIn('BAR_DECOUPLED', g.events()) + agent_codes = [e['code'] for e in g.call(g.A, 'events.read', since_s=0.0)['events']] + self.assertNotIn('BAR_DECOUPLED', agent_codes) + self.assertIn('STIRRING_ON', agent_codes) + + def test_err14_when_plugging_a_shorted_sensor(self): # R1-ERR14-PLUG + g = Rig() + g.on() + g.call(g.E, 'fault.inject', fault='sensor_short', active=True) + g.call(g.A, 'sensor.set', connected=True, immersed=False) + self.assertEqual(g.read('error.code'), 14) + g.call(g.A, 'power.set', on=False) + g.on() # still shorted at power-on + self.assertEqual(g.read('error.code'), 14) + + def test_mode_a_switch_off_clears_functions(self): # R1-MODE-D + g = Rig() + g.on() + g.stir(300) + g.call(g.A, 'power.set', on=False) + self.assertFalse(g.read('stirring.on')) + + def test_ccw_intermittent_and_half_up_rounding(self): # R1-CCW-INTERMITTENT, R1-ROUNDING + g = Rig() + g.on() + self.assertEqual(g.call(g.A, 'stirring.configure', direction='ccw', run_s=25.0)['pattern']['run_s'], 30.0) + self.assertAlmostEqual(g.call(g.A, 'stirring.set_speed', speed_rad_s=345.0 * RPM)['speed_rad_s'] / RPM, 350.0, places=9) + self.assertAlmostEqual(g.call(g.A, 'stirring.set_speed', speed_rad_s=335.0 * RPM)['speed_rad_s'] / RPM, 340.0, places=9) + g.call(g.A, 'stirring.set', on=True) + g.step(5.0) + self.assertLess(g.truth()['motor_rad_s'], -1.0) + self.assertEqual(g.call(g.A, 'stirring.set', on=False)['on'], False) + self.assertEqual(g.call(g.A, 'menu.configure', err5_timeout_s=150.0)['menu']['err5_timeout_s'], 180.0) + + def test_watchdog2_rewrites_set_points(self): # R1-WD2-SETPOINT + g = Rig() + g.on() + g.call(g.A, 'interface.set', connected=True) + g.call(g.A, 'namur.send', command='OUT_SP_1 80') + g.call(g.A, 'namur.send', command='OUT_SP_4 700') + g.call(g.A, 'namur.send', command='OUT_SP_12@60') + g.call(g.A, 'namur.send', command='OUT_SP_42@200') + g.call(g.A, 'namur.send', command='OUT_WD2@20') + g.step(25.0) + self.assertTrue(g.read('interface.state')['wd2_active']) + self.assertEqual(g.read('heating.set_k'), C0 + 60.0) + self.assertEqual(g.read('display.set_temperature'), 60) + self.assertAlmostEqual(g.read('stirring.set_rad_s') / RPM, 200.0, places=9) + self.assertEqual(g.call(g.A, 'namur.send', command='IN_SP_1')['response'], '60 1') + + def test_no_freezing_states(self): # R1-FREEZING + g = Rig() + g.call(g.A, 'vessel.place', expect='NOT_LIQUID', vessel='beaker_600ml', substance_id='water', volume_m3=2e-4, initial_k=265.0) + g.beaker('beaker_250ml', sid='dmso', ml=100.0, bar=0.0) + g.call(g.E, 'plant.configure', expect='NOT_LIQUID', **dict(rt.PLANT_EXAMPLE, ambient_k=C0 + 10.0)) + self.assertEqual(rt.LIQ['water']['melting_point_k'], C0) + + def test_timer_display_and_analytic_counter(self): # R1-TIMER-DISPLAY + g = Rig() + g.on() + g.call(g.A, 'timer.set', duration_s=125.0) + self.assertEqual(g.read('display.timer'), '000205') + g.call(g.A, 'timer.toggle') + n = g.h.tick + g.step(100.0) + self.assertEqual(g.read('display.timer'), '000025') + self.assertLess(g.h.tick - n, 1000 + 1) + g.step(30.0) + self.assertTrue(g.read('timer.state')['expired']) + self.assertIn('TIMER_EXPIRED', g.events()) + g.call(g.A, 'timer.set', duration_s=0.0) + g.call(g.A, 'timer.toggle') + g.step(4 * 86400.0 + 5 * 3600.0 + 7.0) + self.assertEqual(g.read('display.timer'), '0405 ') # dd:hh on the printed colons + self.assertAlmostEqual(g.read('timer.state')['elapsed_s'], 4 * 86400.0 + 5 * 3600.0 + 7.0, delta=1e-6) + self.assertEqual(g.read('display.safe_temperature'), 370) + g.call(g.A, 'menu.configure', display='visc') + self.assertIsNone(g.read('display.safe_temperature')) + + def test_contract_parameters_si(self): # C1-PARAM-UNITS + m = rt.export_ika_plate_rctdigital_contract_metadata() + units = {p['unit'] for p in m['mechanisms']['hotplate_process']['parameters'].values()} + self.assertFalse(units & {'degC', 'rpm', 'min'}, units) + + +class ZCoverage(unittest.TestCase): + def test_all_capabilities_exercised(self): + missing = set(rt.CAPS) - set(rt.UNSUPPORTED) - SEEN_CAPS - {'events.read'} + if len(SEEN_CAPS) > 5: + self.assertFalse(missing, sorted(missing)) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_asset_inert_puresolvmd.py b/tests/test_asset_inert_puresolvmd.py new file mode 100644 index 0000000000000000000000000000000000000000..e888049957fc5b6d1e476718b394ad01f56107c3 --- /dev/null +++ b/tests/test_asset_inert_puresolvmd.py @@ -0,0 +1,577 @@ +"""tests for CHEM-200 inert_puresolvmd (Inert PureSolv MD 7 solvent purification system): python3 -m unittest tests/test_asset_inert_puresolvmd.py + +Themes: contract consistency (slots, effects, errors raised vs declared); agent / evaluator truth isolation; idempotent request ids; two instances +isolated; step-partition independence; rejected calls leave the state unchanged; every output validated against its schema and every success +changes only declared slots; gas manifold (50 psi supply, 70 psi relief) and vacuum manifold (6 Torr ultimate, 20 L/min); three evacuate / +refill cycles before dispensing (UCD) against dispensing into an air-filled or undried flask; laminar dispensing flow with the measured +viscosity (DMF slower than THF), the flask never filled above its brim, the 2/3 warning; the dispensing line hold-up blown into the flask on +refill and sucked into the pump when turned back through evacuate (UCD warning); column loading, breakthrough after the calibrated 800 L of +HPLC grade solvent, replacement; Q5 removes oxygen, alumina does not (Texas A&M); sparging (UCD 45 min for 15 L) and refilling with +air-saturated, stabilised or wet solvent; faults (pump, supply, clogged filter, joint leak, check valve, regulator creep up to the 60 psi keg +relief); per-channel solvent, water and flask-gas ledgers closing exactly.""" +import json +import math +import re +import sys +import unittest +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / 'scripts')) +from asset_runtime import inert_puresolvmd as rt # noqa: E402 + +INST = 'inert_puresolvmd_01' +PSI, INHG = rt.PSI, rt.INHG +CHECKS = [] +SEEN_CAPS = set() +PROCESS_EVIDENCE = {} + + +def _differ(x, y): + if isinstance(x, float) and isinstance(y, float): + return abs(x - y) > 1e-12 * max(1.0, abs(x), abs(y)) + return json.dumps(x, sort_keys=True, default=str) != json.dumps(y, sort_keys=True, default=str) + + +class Rig: + def __init__(self, seed=1, instance=INST, **plant): + self.h = rt.InertPuresolvmdRuntime(instance) + self.h.register_principal('agent', 'agent') + self.h.register_principal('eval', 'evaluator') + self.A = self.h.session('agent') + self.E = self.h.session('eval') + self.n = 0 + self.inst = instance + self.call(self.E, 'plant.configure', **dict(rt.PLANT_EXAMPLE, noise_seed=seed, **plant)) + + def call(self, sess, cap, expect='succeeded', **args): + self.n += 1 + before, t0 = self.h.read('evaluator'), self.h.t + r = sess.invoke(instance_id=self.inst, capability_id=cap, arguments=args, request_id=f'r{self.n}') + after = self.h.read('evaluator') + changed = {k for k in after if _differ(after[k], before[k])} - {'clock.time_s'} + if expect == 'succeeded': + assert r['status'] == 'succeeded', (cap, r['error']) + rt.validate(rt.CAPS[cap]['output_schema'], r['result']) + if cap != 'sim.step': + extra = changed - set(rt.EFFECTS.get(cap, [])) + assert not extra, (cap, sorted(extra)) + assert self.h.t == t0, cap + SEEN_CAPS.add(cap) + PROCESS_EVIDENCE.setdefault(cap, []).append(dict(arguments=json.dumps(args, sort_keys=True, default=str)[:200], time_s=t0, status=r['status'])) + return r['result'] + assert r['status'] in ('rejected', 'unsupported'), (cap, r['status'], r.get('result')) + assert r['error']['code'] == expect, (cap, r['error']['code'], expect) + assert not changed, (cap, 'rejected call changed', sorted(changed)) + assert expect in [e['code'] for e in rt.export_inert_puresolvmd_contract_metadata()['capabilities'][cap]['errors']], (cap, expect) + return r + + def step(self, s): + self.call(self.E, 'sim.step', dt_s=float(s)) + + def read(self, *ids, who=None): + sess = who or self.E + o = sess.read(instance_id=self.inst, state_ids=list(ids) if ids else None)['observations'] + return {k: v['value'] for k, v in o.items()} if not ids or len(ids) > 1 else o[ids[0]]['value'] + + def truth(self, ch): + return self.read('truth.channels')['channels'][ch - 1] + + def prime(self): + self.call(self.A, 'gas.isolation', open=True) + self.call(self.A, 'pump.set', on=True) + self.step(30.0) + + def turn(self, ch, pos, direction='shortest'): + return self.call(self.A, 'valve.turn', channel=ch, position=pos, direction=direction) + + def purge(self, ch, cycles=3): + for _ in range(cycles): + self.turn(ch, 'evacuate') + self.step(30.0) + self.turn(ch, 'refill', 'counterclockwise') # evacuate -> closed -> refill + self.step(10.0) + + def dispense(self, ch, seconds, opening=1.0, evacuate_first=True): + if evacuate_first: + self.turn(ch, 'evacuate', 'clockwise') # refill -> dispense -> evacuate: flask still empty, line empty + self.step(30.0) + self.call(self.A, 'needle.set', channel=ch, opening=opening) + self.turn(ch, 'dispense', 'counterclockwise') + self.step(seconds) + + def finish(self, ch): + self.turn(ch, 'refill', 'counterclockwise') # back-fill: the line hold-up is blown into the flask + self.step(5.0) + self.turn(ch, 'closed', 'counterclockwise') + out = self.call(self.A, 'flask.detach', channel=ch)['flask'] + assert 'water_ppm' not in out and 'oxygen_ppm' not in out # not measured by the system: evaluator truth only + return self.call(self.E, 'truth.inspect')['removed_flasks'][-1] + + def ledger(self): + return self.call(self.E, 'ledger.read')['ledger'] + + +def _raised_codes(): + src = Path(rt.__file__).read_text() + funcs = {} + for m in re.finditer(r'\n def (\w+)\(self[^\n]*\n(.*?)(?=\n def |\n# ----|\nclass |\ndef )', src, re.S): + funcs[m.group(1)] = m.group(2) + own = {k: set(re.findall(r"ActionRejected\('([A-Z_]+)'\)", v)) for k, v in funcs.items()} + calls = {k: set(re.findall(r'self\.(_\w+)\(', v)) & set(funcs) for k, v in funcs.items()} + out = {} + for k in funcs: + if not k.startswith('_cmd_'): + continue + seen, todo, codes = set(), [k], set() + while todo: + f = todo.pop() + if f in seen: + continue + seen.add(f) + codes |= own.get(f, set()) + todo += [g for g in calls.get(f, ()) if g not in ('_cmd_sim_step', 'step', '_tick')] + out[k] = codes + name = {'_cmd_' + c.replace('.', '_'): c for c in rt.CAPS} + return {name[k]: v for k, v in out.items() if k in name} + + +def _balance(test, L, rig): + for k, lk in enumerate(L['channels']): + if rig.h.ch[k]['solvent'] is None: + continue + S = (lk['initial_solvent_kg'] + lk['added_solvent_kg'] - lk['removed_solvent_kg'] - lk['solvent_to_pump_kg'] - lk['sparge_solvent_kg'] - lk['drip_solvent_kg']) + test.assertAlmostEqual(lk['solvent_in_system_kg'], S, delta=1e-9 * max(lk['initial_solvent_kg'], 1.0), msg=f'solvent ch{k + 1}') + W = (lk['initial_water_kg'] + lk['added_water_kg'] + lk['water_from_air_kg'] + lk['wall_water_kg'] - lk['removed_water_kg'] - lk['water_to_pump_kg'] + - lk['water_vented_kg'] - lk['drip_water_kg'] - lk['column_water_removed_kg']) + test.assertAlmostEqual(lk['water_in_system_kg'], W, delta=1e-12 + 1e-9 * lk['initial_water_kg'], msg=f'water ch{k + 1}') + G = lk['air_in_mol'] + lk['flask_refill_mol'] - lk['flask_evac_mol'] - lk['flask_relief_mol'] - lk['flask_removed_mol'] - lk['gas_dissolved_mol'] + test.assertAlmostEqual(lk['flask_gas_mol'], G, delta=1e-12 + 1e-9 * (lk['air_in_mol'] + lk['flask_refill_mol']), msg=f'gas ch{k + 1}') + + +class Contract(unittest.TestCase): + def test_metadata_slots_effects_consistent(self): + meta = rt.export_inert_puresolvmd_contract_metadata() + slots = set(meta['state_slots']) + self.assertEqual(slots, set(rt.SLOTS)) + for k, c in meta['capabilities'].items(): + for e in c['state_effects']: + self.assertIn(e['state_id'], slots, k) + self.assertTrue({'INVALID_ARGUMENT', 'REQUEST_CONFLICT', 'UNKNOWN_INSTANCE'} <= {e['code'] for e in c['errors']}, k) + for p in c['preconditions']: + for s in p['state_ids']: + self.assertIn(s, slots, k) + self.assertTrue(rt.SCENE_MIRRORED <= slots) + for name, p in meta['mechanisms']['solvent_purification_process']['parameters'].items(): + self.assertEqual(name, name.lower()) + self.assertIn(p['evidence'], ('documented', 'assumption'), name) + + def test_declared_errors_cover_raised_codes(self): + meta = rt.export_inert_puresolvmd_contract_metadata() + for cap, codes in _raised_codes().items(): + declared = {e['code'] for e in meta['capabilities'][cap]['errors']} + self.assertTrue(codes <= declared, (cap, sorted(codes - declared))) + + def test_unsupported_capabilities(self): + g = Rig() + for k in rt.UNSUPPORTED: + g.call(g.A, k, expect='UNSUPPORTED') + + def test_agent_truth_isolation(self): + g = Rig() + g.prime() + self.assertFalse(any(k.startswith('truth.') for k in g.read(who=g.A))) + for cap, a in (('truth.inspect', {}), ('ledger.read', {}), ('fault.inject', dict(fault='pump_failure', active=True)), ('sim.step', dict(dt_s=1.0)), + ('plant.configure', rt.PLANT_EXAMPLE)): + r = g.A.invoke(instance_id=INST, capability_id=cap, arguments=a, request_id='x' + cap) + self.assertEqual(r['error']['code'], 'ACCESS_DENIED') + g.call(g.E, 'fault.inject', fault='filter_clogged', active=True, channel=2) + self.assertFalse(any(e['kind'] in ('fault', 'truth') for e in g.call(g.A, 'events.read', since_s=0.0)['events'])) + g.call(g.E, 'truth.inspect') + + def test_idempotent_request_ids(self): + g = Rig() + a = g.A.invoke(instance_id=INST, capability_id='pump.set', arguments=dict(on=True), request_id='same') + b = g.A.invoke(instance_id=INST, capability_id='pump.set', arguments=dict(on=True), request_id='same') + self.assertEqual(a, b) + c = g.A.invoke(instance_id=INST, capability_id='pump.set', arguments=dict(on=False), request_id='same') + self.assertEqual(c['error']['code'], 'REQUEST_CONFLICT') + + def test_two_instances_isolated(self): + a, b = Rig(instance='i1'), Rig(instance='i2') + a.call(a.A, 'pump.set', on=True) + self.assertFalse(b.read('pump.on')) + + def test_step_partition_independence(self): + runs = [] + for parts in ([400.0], [0.3, 7.7, 92.0, 300.0], [1.0] * 40 + [360.0]): + g = Rig(seed=7) + g.prime() + g.call(g.A, 'flask.attach', channel=1, volume_m3=0.001, oven_dried=False) + g.call(g.A, 'line.set', channel=3, keg_outlet=False) + g.call(g.A, 'keg.sparge', channel=3, duration_s=200.0) + g.call(g.E, 'fault.inject', fault='regulator_creep', active=True, channel=2) + g.call(g.A, 'needle.set', channel=1, opening=0.3) + g.turn(1, 'dispense') + for p in parts: + g.step(p) + v = g.read() + v.pop('clock.time_s') + runs.append(json.dumps(v, sort_keys=True, default=str)) + self.assertEqual(runs[0], runs[1]) + self.assertEqual(runs[0], runs[2]) + + def test_rejections_change_nothing(self): + r = rt.InertPuresolvmdRuntime('fresh') + r.register_principal('e', 'evaluator') + r.register_principal('a', 'agent') + self.assertEqual(r.session('a').invoke(instance_id='fresh', capability_id='pump.set', arguments=dict(on=True), request_id='p')['error']['code'], 'PLANT_REQUIRED') + g = Rig(solvents=['tetrahydrofuran', 'toluene', None, None, None, None, None]) + g.call(g.E, 'plant.configure', expect='SEED_FIXED', **dict(rt.PLANT_EXAMPLE, solvents=['tetrahydrofuran', 'toluene', None, None, None, None, None], noise_seed=2)) + g.call(g.E, 'plant.configure', expect='SOLVENTS_FIXED', **rt.PLANT_EXAMPLE) + g.call(g.A, 'valve.turn', expect='EMPTY_CHANNEL', channel=3, position='evacuate') + g.call(g.A, 'flask.detach', expect='NO_FLASK', channel=1) + g.call(g.A, 'flask.attach', channel=1, volume_m3=0.0005) + g.call(g.A, 'flask.attach', expect='FLASK_ATTACHED', channel=1, volume_m3=0.0005) + g.turn(1, 'refill') + g.call(g.A, 'flask.detach', expect='VALVE_NOT_CLOSED', channel=1) + g.call(g.A, 'keg.refill', expect='CABINET_CLOSED', channel=1, volume_m3=0.001) + g.call(g.A, 'cabinet.door', side='left', angle_rad=1.5) + g.call(g.A, 'keg.refill', expect='KEG_CONNECTED', channel=1, volume_m3=0.001) + g.call(g.A, 'line.set', channel=1, keg_gas=False, keg_outlet=False) + g.call(g.A, 'keg.refill', expect='KEG_OVERFILL', channel=1, volume_m3=0.010) + g.call(g.A, 'keg.sparge', expect='NO_GAS', channel=1, duration_s=60.0) + g.call(g.A, 'line.set', channel=1, keg_outlet=True) + g.call(g.A, 'gas.isolation', open=True) + g.call(g.A, 'keg.sparge', expect='KEG_CONNECTED', channel=1, duration_s=60.0) + g.call(g.A, 'column.replace', expect='COLUMN_OPEN', channel=1) + g.call(g.A, 'needle.set', expect='INVALID_ARGUMENT', channel=1, opening=1.5) + g.call(g.A, 'valve.turn', expect='INVALID_ARGUMENT', channel=8, position='closed') + g.call(g.E, 'fault.inject', expect='CHANNEL_REQUIRED', fault='filter_clogged', active=True) + g.call(g.E, 'fault.inject', expect='INVALID_ARGUMENT', fault='alien', active=True) + + +class Physics(unittest.TestCase): + def test_manifolds_and_gauges(self): + g = Rig() + self.assertEqual(g.read('gauge.pressure_pa'), 0.0) + g.prime() + self.assertAlmostEqual(g.read('gauge.pressure_pa'), 50.0 * PSI, delta=0.6 * PSI) # building supply about 50 psi (UCD) + self.assertAlmostEqual(g.read('gauge.pressure_angle_rad'), -rt.GAUGE_SWEEP * g.read('gauge.pressure_pa') / (100.0 * PSI), places=9) + self.assertLess(g.read('gauge.vacuum_pa'), -29.0 * INHG) # 6 Torr ultimate + self.assertAlmostEqual(g.read('truth.manifold')['vacuum_pa'], rt.DOC['pump_ultimate_pa'], delta=1.0) + g.call(g.A, 'pump.toggle') + self.assertFalse(g.read('pump.on')) + g.call(g.A, 'gas.isolation', open=False) + self.assertEqual(g.read('gas.isolation_angle_rad'), 0.0) + h = Rig(supply_gauge_pa=90.0 * PSI) + h.prime() + self.assertAlmostEqual(h.read('gauge.pressure_pa'), 70.0 * PSI, delta=0.6 * PSI) # main relief 70 psi + self.assertIn('MAIN_RELIEF', [e['code'] for e in h.call(h.A, 'events.read', since_s=0.0)['events']]) + + def test_purged_flask_gives_dry_oxygen_free_solvent(self): + g = Rig() + g.prime() + g.call(g.A, 'flask.attach', channel=3, volume_m3=0.0005, oven_dried=True) + g.purge(3) + air = g.truth(3)['flask']['gas_mol'] + self.assertLess(air['air'] + air['o2'], 1e-6) # three cycles (UCD) + self.assertGreater(g.read('gauge.station3_pa'), 1.0 * PSI) # refilled to the low-pressure regulator + g.dispense(3, 45.0) + self.assertGreater(g.read('flask.ch3')['liquid_m3'], 1e-4) + r = g.finish(3) + self.assertEqual(r['solvent'], 'toluene') + self.assertAlmostEqual(r['water_ppm'], rt.ENG['water_floor_ppm'], delta=0.5) + self.assertLess(r['oxygen_ppm'], 1.0) # Q5 column removes oxygen + self.assertTrue(r['under_inert']) + _balance(self, g.ledger(), g) + + def test_unpurged_or_undried_flask_contaminates(self): + res = {} + for name, purge, dried in (('purged', True, True), ('air', False, True), ('wet', True, False)): + g = Rig() + g.prime() + g.call(g.A, 'flask.attach', channel=1, volume_m3=0.001, oven_dried=dried) + if purge: + g.purge(1) + g.dispense(1, 30.0) + else: + g.call(g.A, 'needle.set', channel=1, opening=1.0) + g.turn(1, 'dispense') # straight into the air-filled flask + g.step(30.0) + res[name] = g.finish(1) + _balance(self, g.ledger(), g) + self.assertGreater(res['air']['water_ppm'], res['purged']['water_ppm'] + 5.0) + self.assertGreater(res['air']['oxygen_ppm'], 5.0 * res['purged']['oxygen_ppm']) + self.assertFalse(res['air']['under_inert']) + self.assertGreater(res['wet']['water_ppm'], res['purged']['water_ppm'] + 20.0) # wall water is not removed by vacuum + + def test_flow_viscosity_brim_and_two_thirds_warning(self): + g = Rig() + g.prime() + q = {} + for ch in (1, 7): # THF 0.5 mPa s, DMF about 0.9 mPa s + g.call(g.A, 'flask.attach', channel=ch, volume_m3=0.002) + g.purge(ch) + g.dispense(ch, 20.0, opening=0.5) + q[ch] = g.read(f'flask.ch{ch}')['liquid_m3'] + mu = {ch: rt.SOLV[g.h.ch[ch - 1]['solvent']]['viscosity']['value'] for ch in (1, 7)} + self.assertGreater(q[1], q[7]) + self.assertAlmostEqual(q[1] / q[7], mu[7] / mu[1] * 0.9, delta=0.35 * mu[7] / mu[1]) # laminar: Q ~ 1/mu (head and density differ) + self.assertAlmostEqual(g.read('needle.ch1_angle_rad'), 0.5 * rt.NEEDLE_TURNS * 2 * math.pi, places=9) + g.call(g.A, 'flask.attach', channel=2, volume_m3=0.00025) + g.purge(2) + g.dispense(2, 300.0) + f = g.read('flask.ch2') + self.assertLessEqual(f['liquid_m3'], f['volume_m3'] + 1e-12) # a closed flask fills at most to its brim + codes = [e['code'] for e in g.call(g.A, 'events.read', since_s=0.0)['events']] + self.assertIn('FLASK_OVER_TWO_THIRDS', codes) + self.assertIn('FLASK_PRESSURISED', codes) + _balance(self, g.ledger(), g) + + def test_line_holdup_pump_and_drip(self): + g = Rig() + g.prime() + g.call(g.A, 'flask.attach', channel=1, volume_m3=0.001) + g.purge(1) + g.dispense(1, 20.0) + self.assertGreater(g.truth(1)['line_m3'], 0.0) + g.turn(1, 'closed', 'clockwise') # dispense -> evacuate -> closed: UCD warning + self.assertEqual(g.truth(1)['line_m3'], 0.0) + self.assertGreater(g.ledger()['channels'][0]['solvent_to_pump_kg'], 0.0) + self.assertIn('SOLVENT_TO_VACUUM', [e['code'] for e in g.call(g.A, 'events.read', since_s=0.0)['events']]) + g.turn(1, 'dispense', 'counterclockwise') + g.step(10.0) + g.turn(1, 'closed', 'counterclockwise') # through refill: line blown into the flask + self.assertEqual(g.truth(1)['line_m3'], 0.0) + g.call(g.A, 'flask.detach', channel=1) + _balance(self, g.ledger(), g) + + def test_column_breakthrough_and_replacement(self): + g = Rig() + g.prime() + cap = g.truth(1)['column_water_capacity_kg'] + self.assertAlmostEqual(cap[0], rt.ENG['column_water_capacity_kg'], places=12) + for i in range(2): # near the end of the 800 L (white box) + g.h.ch[0]['col']['load'][i] = 0.99 * cap[i] + g.h.led['ch'][0]['initial_water_kg'] += 0.99 * (cap[0] + cap[1]) + g.call(g.A, 'flask.attach', channel=1, volume_m3=0.002) + g.purge(1) + g.dispense(1, 60.0) + r = g.finish(1) + self.assertGreater(r['water_ppm'], 2.0 * rt.ENG['water_floor_ppm']) # broken through + self.assertIn('COLUMN_BREAKTHROUGH', [e['kind'] == 'truth' and e['code'] for e in g.call(g.E, 'events.read', since_s=0.0)['events']]) + _balance(self, g.ledger(), g) + g.call(g.A, 'line.set', channel=1, column_inlet=False, column_outlet=False) + g.call(g.A, 'column.replace', channel=1) + self.assertEqual(g.truth(1)['column_water_load_kg'], [0.0, 0.0]) + self.assertEqual(g.read('lines.valves')['1']['column_inlet'], False) + g.call(g.A, 'line.set', channel=1, column_inlet=True, column_outlet=True) + g.call(g.A, 'flask.attach', channel=1, volume_m3=0.002) + g.purge(1) + g.dispense(1, 60.0) + self.assertAlmostEqual(g.finish(1)['water_ppm'], rt.ENG['water_floor_ppm'], delta=0.5) + _balance(self, g.ledger(), g) + + def test_alumina_keeps_oxygen_sparging_and_refill(self): + g = Rig() + g.prime() + o2_keg = g.truth(1)['keg_o2_ppm'] + g.call(g.A, 'flask.attach', channel=1, volume_m3=0.001) + g.purge(1) + g.dispense(1, 30.0) + f, rho = g.truth(1)['flask'], rt.SOLV['tetrahydrofuran']['density']['value'] + o2_total = f['o2_ppm'] * 1e-6 * rho * f['liquid_m3'] + f['gas_mol']['o2'] * 0.0319988 # dissolved plus partitioned into the inert headspace + self.assertAlmostEqual(o2_total, o2_keg * 1e-6 * rho * f['liquid_m3'], delta=0.1 * o2_keg * 1e-6 * rho * f['liquid_m3']) # alumina keeps O2 (Texas A&M) + self.assertEqual(g.truth(1)['q5_o2_load_kg'], 0.0) + r = g.finish(1) + self.assertLess(r['oxygen_ppm'], o2_keg) + g.call(g.A, 'cabinet.door', side='right', angle_rad=1.5) + g.call(g.A, 'line.set', channel=1, keg_gas=False, keg_outlet=False) + g.call(g.A, 'keg.refill', channel=1, volume_m3=0.004, water_ppm=300.0, stabiliser_ppm=250.0, grounded=False) + t = g.truth(1) + self.assertAlmostEqual(t['keg_o2_ppm'], rt.ENG['o2_air_saturated_ppm'], delta=1e-6) + self.assertGreater(t['keg_water_ppm'], 150.0) + codes = [e['code'] for e in g.call(g.A, 'events.read', since_s=0.0)['events']] + self.assertIn('NOT_GROUNDED', codes) + self.assertIn('STABILISER_IN_FEED', codes) + v0 = t['keg_m3'] + g.call(g.A, 'keg.sparge', channel=1, duration_s=rt.DOC['ucd_sparge_s']) + g.step(rt.DOC['ucd_sparge_s'] + 10.0) + t = g.truth(1) + self.assertLess(t['keg_o2_ppm'], 0.06 * rt.ENG['o2_air_saturated_ppm']) # 45 min (UCD): about 3 time constants + self.assertLess(t['keg_m3'], v0) # solvent vapour carried away + self.assertFalse(t['sparging']) + g.call(g.A, 'line.set', channel=1, keg_gas=True, keg_outlet=True) + g.call(g.A, 'flask.attach', channel=1, volume_m3=0.002) + g.purge(1) + g.dispense(1, 60.0) + g.finish(1) + self.assertGreater(g.truth(1)['stabiliser_on_column_kg'], 0.0) + self.assertEqual(g.read('reservoirs.recorded')['1']['added_m3'], 0.004) + _balance(self, g.ledger(), g) + + def test_faults(self): + g = Rig() + g.call(g.E, 'fault.inject', fault='pump_failure', active=True) + g.prime() + self.assertEqual(g.read('gauge.vacuum_pa'), 0.0) + g.call(g.E, 'fault.inject', fault='pump_failure', active=False) + g.step(30.0) + g.call(g.E, 'fault.inject', fault='check_valve_leak', active=True, channel=1) + g.call(g.A, 'flask.attach', channel=1, volume_m3=0.0005) + g.turn(1, 'evacuate') + g.step(60.0) + p_leak = g.truth(1)['flask']['pressure_pa'] + g.call(g.E, 'fault.inject', fault='check_valve_leak', active=False, channel=1) + g.step(60.0) + self.assertGreater(p_leak, 2.0 * g.truth(1)['flask']['pressure_pa']) # poorer vacuum in the flask + g.turn(1, 'closed', 'counterclockwise') + g.call(g.E, 'fault.inject', fault='flask_joint_leak', active=True, channel=1) + n0 = g.truth(1)['flask']['gas_mol']['air'] + g.step(600.0) + self.assertGreater(g.truth(1)['flask']['gas_mol']['air'], n0) + g.call(g.E, 'fault.inject', fault='flask_joint_leak', active=False, channel=1) + g.call(g.E, 'fault.inject', fault='gas_supply_empty', active=True) + p_im = g.read('truth.manifold')['inert_pa'] + g.turn(1, 'refill', 'clockwise') + g.step(30.0) + self.assertLess(g.read('truth.manifold')['inert_pa'], p_im - 1000.0) # only the gas left in the manifold + self.assertLess(g.read('gauge.pressure_pa'), 50.0 * PSI) + g.call(g.E, 'fault.inject', fault='gas_supply_empty', active=False) + g.step(1.0) + q = {} + for clog in (False, True): + h = Rig() + h.prime() + if clog: + h.call(h.E, 'fault.inject', fault='filter_clogged', active=True, channel=2) + h.call(h.A, 'flask.attach', channel=2, volume_m3=0.002) + h.purge(2) + h.dispense(2, 20.0, opening=0.3) + q[clog] = h.read('flask.ch2')['liquid_m3'] + self.assertLess(q[True], 0.8 * q[False]) + k = Rig(supply_gauge_pa=65.0 * PSI) + k.prime() + k.call(k.E, 'fault.inject', fault='regulator_creep', active=True, channel=4) + k.step(86400.0) + self.assertAlmostEqual(k.truth(4)['keg_head_pa'] - 101325.0, rt.DOC['ucd_gauges_pa']['keg'] + 86400.0 * rt.ENG['regulator_creep_pa_s'], delta=1.0) + k.step(4 * 86400.0) + self.assertAlmostEqual(k.truth(4)['keg_head_pa'] - 101325.0, rt.DOC['tamu_keg_relief_pa'], delta=1.0) # 60 psi keg relief + self.assertIn('KEG_RELIEF', [e['code'] for e in k.call(k.A, 'events.read', since_s=0.0)['events']]) + k.call(k.A, 'regulator.set', channel=4, keg_gauge_pa=10.0 * PSI, flask_gauge_pa=2.0 * PSI) + self.assertEqual(k.read('regulators.settings')['4']['keg_gauge_pa'], 10.0 * PSI) + _balance(self, g.ledger(), g) + + def test_cabinet_doors_and_quiet_stepping(self): + g = Rig() + g.call(g.A, 'cabinet.door', side='left', angle_rad=1.2) + self.assertEqual(g.read('cabinet.left_angle_rad'), 1.2) + g.call(g.A, 'cabinet.door', side='left', angle_rad=0.0) + g.prime() + n = g.h.tick + g.step(30 * 86400.0) # nothing evolves: the grid is skipped exactly + self.assertEqual(g.h.tick - n, int(round(30 * 86400.0 / rt.DT))) + _balance(self, g.ledger(), g) + + + def test_review_r1_fixes(self): + g = Rig() + g.prime() + g.call(g.A, 'flask.attach', channel=1, volume_m3=0.005) + g.purge(1) + g.call(g.A, 'line.set', channel=1, keg_gas=False) # keg cut off: headspace expands + g.call(g.A, 'gas.isolation', open=False) + g.call(g.E, 'fault.inject', fault='gas_supply_empty', active=True) + p0 = g.truth(1)['keg_head_pa'] + g.dispense(1, 300.0) + self.assertLess(g.truth(1)['keg_head_pa'], p0 - 0.2 * (p0 - 101325.0)) + g.turn(1, 'refill', 'counterclockwise') + g.step(30.0) + self.assertLess(g.read('gauge.pressure_pa'), 50.0 * PSI - 1.0) # isolated manifold drawn down + _balance(self, g.ledger(), g) + h = Rig() + h.prime() + h.call(h.A, 'flask.attach', channel=1, volume_m3=5e-5) + h.purge(1) + h.dispense(1, 600.0) + h.turn(1, 'refill', 'counterclockwise') + f = h.read('flask.ch1') + self.assertLessEqual(f['liquid_m3'], f['volume_m3']) # the line hold-up does not overfill + _balance(self, h.ledger(), h) + b = Rig(ambient_k=308.15, pressure_pa=80000.0, solvents=['diethyl_ether', None, None, None, None, None, None]) + b.prime() + b.call(b.A, 'line.set', channel=1, keg_outlet=False) + v0 = b.truth(1)['keg_m3'] + b.call(b.A, 'keg.sparge', channel=1, duration_s=60.0) + b.step(60.0) + self.assertGreater(b.truth(1)['keg_m3'], v0 - 1e-4) # bounded vapour carry-over + self.assertIn('SPARGE_NEAR_BOILING', [e['code'] for e in b.call(b.A, 'events.read', since_s=0.0)['events']]) + o = Rig() + o.prime() + o.turn(2, 'evacuate') # open joint: air into the vacuum + o.step(10.0) + self.assertGreater(o.read('truth.manifold')['vacuum_pa'], 10.0 * rt.DOC['pump_ultimate_pa']) + o.turn(2, 'closed') + o.call(o.A, 'needle.set', channel=2, opening=1.0) + o.turn(2, 'dispense') # no flask: solvent onto the drip tray + o.step(10.0) + o.turn(2, 'closed', 'counterclockwise') + self.assertGreater(o.ledger()['channels'][1]['drip_solvent_kg'], 0.0) + o.call(o.A, 'pump.set', on=False) + o.call(o.A, 'flask.attach', channel=3, volume_m3=0.001) + o.turn(3, 'evacuate') + o.step(60.0) + o.turn(3, 'closed', 'counterclockwise') + o.turn(4, 'evacuate') # vent the manifold through an open joint + o.step(20.0) + o.turn(4, 'closed') + n_air = o.truth(3)['flask']['gas_mol']['air'] + o.turn(3, 'evacuate') # back-flow from the manifold + o.step(5.0) + self.assertGreater(o.truth(3)['flask']['gas_mol']['air'], n_air) + _balance(self, o.ledger(), o) + + + def test_review_r2_isolated_manifold_conserves_gas(self): + def inventory(g): + RT = rt.R_GAS * g.h._T() + return (g.h.p_im * rt.ENG['gas_manifold_volume_m3'] / RT + sum(c['keg']['n_gas'] for c in g.h.ch if c['solvent']) + + sum(lk['flask_refill_mol'] for lk in g.h.led['ch'])) + g = Rig(supply_gauge_pa=20.0 * PSI) + g.prime() + g.call(g.A, 'flask.attach', channel=1, volume_m3=0.005) + g.call(g.A, 'gas.isolation', open=False) + for ch in range(2, 8): + g.call(g.A, 'line.set', channel=ch, keg_gas=False) + n0 = inventory(g) + g.call(g.A, 'regulator.set', channel=1, keg_gauge_pa=25.0 * PSI) # set above what the manifold holds + g.step(1.0) + self.assertGreaterEqual(g.truth(1)['keg_head_pa'], 101325.0) + g.turn(1, 'evacuate') + g.step(30.0) + g.call(g.A, 'needle.set', channel=1, opening=1.0) + g.turn(1, 'dispense', 'counterclockwise') # headspace grows: gas from the manifold + g.step(120.0) + g.turn(1, 'refill', 'clockwise') + g.step(30.0) + self.assertAlmostEqual(inventory(g), n0, delta=1e-9 * n0) + p_low = g.read('truth.manifold')['inert_pa'] + g.call(g.A, 'gas.isolation', open=True) # the supply refills the manifold + g.turn(1, 'closed', 'counterclockwise') + g.call(g.A, 'pump.set', on=False) + g.step(600.0) + self.assertGreater(g.read('truth.manifold')['inert_pa'], p_low) + self.assertAlmostEqual(g.read('truth.manifold')['inert_pa'], 101325.0 + 20.0 * PSI, delta=1.0) + _balance(self, g.ledger(), g) + + +class ZCoverage(unittest.TestCase): + def test_all_capabilities_exercised(self): + missing = set(rt.CAPS) - set(rt.UNSUPPORTED) - SEEN_CAPS + if len(SEEN_CAPS) > 5: + self.assertFalse(missing, sorted(missing)) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_asset_inficon_ul1000fab.py b/tests/test_asset_inficon_ul1000fab.py new file mode 100644 index 0000000000000000000000000000000000000000..72924475368062c497309cbda963c968bd5b678a --- /dev/null +++ b/tests/test_asset_inficon_ul1000fab.py @@ -0,0 +1,697 @@ +"""tests for CHEM-194 inficon_ul1000fab (INFICON UL1000 Fab helium leak detector): python3 -m unittest tests/test_asset_inficon_ul1000fab.py + +Themes: contract consistency (slots, effects, errors raised vs declared); agent / evaluator truth isolation; idempotent request ids; two instances +isolated; step-partition independence; rejected calls leave the state unchanged; every output validated against its schema and every success +changes only declared slots; run-up 3 min; pump-down and autoranging (15 / 2 / 0.4 mbar) faster for small volumes and slower with polymer outgassing; +large leak -> maximum evacuation time W76; response time of a sprayed leak grows with the part volume and the leak path; the detection limit is a +display floor, not the reading error; ZERO, I-ZERO (stable signal only) and auto zero; internal / external calibration, temperature drift and +W80 / W81; O-ring permeation slow signal; sniffer mode (air helium background, distance law, W62 / W63); molecular-flow leak-rate conversion; +helium and total-gas ledgers closing exactly; vent and part exchange.""" +import json +import math +import re +import sys +import unittest +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / 'scripts')) +from asset_runtime import inficon_ul1000fab as rt # noqa: E402 + +INST = 'inficon_ul1000fab_01' +CHECKS = [] +SEEN_CAPS = set() +PROCESS_EVIDENCE = {} +MB = rt.MBAR_L +CHAMBER = dict(part_id='chamber', volume_m3=0.01, surface_area_m2=0.3, material='stainless_unbaked', + leaks=[dict(leak_id='weld', helium_leak_rate_pa_m3_s=1e-9 * MB, path_length_m=0.3, path_diameter_m=0.004)]) + + +def _differ(x, y): + if isinstance(x, float) and isinstance(y, float): + return abs(x - y) > 1e-12 * max(1.0, abs(x), abs(y)) + return json.dumps(x, sort_keys=True, default=str) != json.dumps(y, sort_keys=True, default=str) + + +class Rig: + def __init__(self, seed=1, instance=INST, **plant): + self.h = rt.InficonUl1000fabRuntime(instance) + self.h.register_principal('agent', 'agent') + self.h.register_principal('eval', 'evaluator') + self.A = self.h.session('agent') + self.E = self.h.session('eval') + self.n = 0 + self.inst = instance + self.call(self.E, 'plant.configure', **dict(rt.PLANT_EXAMPLE, noise_seed=seed, **plant)) + + def call(self, sess, cap, expect='succeeded', **args): + self.n += 1 + before, t0 = self.h.read('evaluator'), self.h.t + r = sess.invoke(instance_id=self.inst, capability_id=cap, arguments=args, request_id=f'r{self.n}') + after = self.h.read('evaluator') + changed = {k for k in after if _differ(after[k], before[k])} - {'clock.time_s'} + if expect == 'succeeded': + assert r['status'] == 'succeeded', (cap, r['error']) + rt.validate(rt.CAPS[cap]['output_schema'], r['result']) + if cap != 'sim.step': + extra = changed - set(rt.EFFECTS.get(cap, [])) + assert not extra, (cap, sorted(extra)) + assert self.h.t == t0, cap + SEEN_CAPS.add(cap) + PROCESS_EVIDENCE.setdefault(cap, []).append(dict(arguments=json.dumps(args, sort_keys=True, default=str)[:200], time_s=t0, status=r['status'])) + return r['result'] + assert r['status'] in ('rejected', 'unsupported'), (cap, r['status'], r.get('result')) + assert r['error']['code'] == expect, (cap, r['error']['code'], expect) + assert not changed, (cap, 'rejected call changed', sorted(changed)) + assert expect in [e['code'] for e in rt.export_inficon_ul1000fab_contract_metadata()['capabilities'][cap]['errors']], (cap, expect) + return r + + def step(self, s): + self.call(self.E, 'sim.step', dt_s=float(s)) + + def read(self, *ids, who=None): + sess = who or self.E + o = sess.read(instance_id=self.inst, state_ids=list(ids) if ids else None)['observations'] + return {k: v['value'] for k, v in o.items()} if not ids or len(ids) > 1 else o[ids[0]]['value'] + + def ready(self): + self.call(self.A, 'power.set', on=True) + self.step(181.0) + + def until(self, pred, limit, every=1.0): + t = 0.0 + while not pred() and t < limit: + self.step(every) + t += every + return t + + def ledger(self): + return self.call(self.E, 'ledger.read')['ledger'] + + +def _raised_codes(): + src = Path(rt.__file__).read_text() + funcs = {} + for m in re.finditer(r'\n def (\w+)\(self[^\n]*\n(.*?)(?=\n def |\n# ----|\nclass |\ndef )', src, re.S): + funcs[m.group(1)] = m.group(2) + own = {k: set(re.findall(r"ActionRejected\('([A-Z_]+)'\)", v)) for k, v in funcs.items()} + calls = {k: set(re.findall(r'self\.(_\w+)\(', v)) & set(funcs) for k, v in funcs.items()} + out = {} + for k in funcs: + if not k.startswith('_cmd_'): + continue + seen, todo, codes = set(), [k], set() + while todo: + f = todo.pop() + if f in seen: + continue + seen.add(f) + codes |= own.get(f, set()) + todo += [g for g in calls.get(f, ()) if g not in ('_cmd_sim_step', 'step', '_tick')] + out[k[5:].replace('_', '.', 1)] = codes + return out + + +def _balance(test, L): + he_in = L['he_initial'] + L['he_added_with_part'] + L['he_leak_in'] + L['he_permeation_in'] + L['he_vent_in'] + he_out = L['he_pumped'] + L['he_vent_out'] + L['he_removed_with_part'] + L['he_in_volume'] + test.assertAlmostEqual(he_in, he_out, delta=1e-9 * he_in + 1e-18) + g_in = L['gas_initial'] + L['gas_added_with_part'] + L['gas_leak_in'] + L['gas_outgassing'] + L['gas_vent_in'] + g_out = L['gas_pumped'] + L['gas_vent_out'] + L['gas_removed_with_part'] + L['gas_in_volume'] + test.assertAlmostEqual(g_in, g_out, delta=1e-9 * g_in) + + +class Contract(unittest.TestCase): + def test_metadata_slots_effects_and_mirrors_consistent(self): + meta = rt.export_inficon_ul1000fab_contract_metadata() + slots = set(meta['state_slots']) + self.assertEqual(slots, set(rt.SLOTS)) + for k, c in meta['capabilities'].items(): + for e in c['state_effects']: + self.assertIn(e['state_id'], slots, k) + for x in c['observes']: + self.assertIn(x, slots, k) + for pre in c['preconditions']: + self.assertTrue(set(pre['state_ids']) <= slots, k) + self.assertTrue({'INVALID_ARGUMENT', 'REQUEST_CONFLICT', 'UNKNOWN_INSTANCE'} <= {e['code'] for e in c['errors']}, k) + self.assertTrue(rt.SCENE_MIRRORED <= slots) + for name, p in meta['mechanisms']['helium_leak_detection']['parameters'].items(): + self.assertEqual(name, name.lower()) + self.assertIn(p['evidence'], ('documented', 'assumption'), name) + + def test_declared_errors_cover_raised_codes(self): + meta = rt.export_inficon_ul1000fab_contract_metadata() + for cap, codes in _raised_codes().items(): + declared = {e['code'] for e in meta['capabilities'][cap]['errors']} + self.assertTrue(codes <= declared, (cap, sorted(codes - declared))) + + def test_unsupported_capabilities(self): + g = Rig() + for k in rt.UNSUPPORTED: + r = g.A.invoke(instance_id=INST, capability_id=k, arguments={}, request_id='u-' + k) + self.assertEqual((r['status'], r['error']['code']), ('unsupported', 'UNSUPPORTED')) + + def test_agent_truth_isolation(self): + g = Rig() + d = g.A.describe(instance_id=INST) + self.assertFalse(any(k.startswith('truth.') for k in d['state_slots'])) + with self.assertRaises(rt.ActionRejected): + g.A.read(instance_id=INST, state_ids=['truth.gas']) + for cap, args in (('truth.inspect', {}), ('sim.step', dict(dt_s=1.0)), ('ledger.read', {}), ('fault.inject', dict(fault='turbo_failure', active=True))): + r = g.A.invoke(instance_id=INST, capability_id=cap, arguments=args, request_id='x-' + cap) + self.assertEqual(r['error']['code'], 'ACCESS_DENIED', cap) + g.call(g.E, 'fault.inject', fault='helium_contamination', active=True) + self.assertFalse(any(e['kind'] in ('fault', 'truth') for e in g.call(g.A, 'events.read', since_s=0.0)['events'])) + + def test_idempotent_request_ids(self): + g = Rig() + g.ready() + args = dict(trigger_1_pa_m3_s=1e-11) + r1 = g.A.invoke(instance_id=INST, capability_id='settings.configure', arguments=args, request_id='same') + snap = g.h.read('evaluator') + r2 = g.A.invoke(instance_id=INST, capability_id='settings.configure', arguments=args, request_id='same') + self.assertEqual(r1, r2) + self.assertEqual(json.dumps(snap, sort_keys=True, default=str), json.dumps(g.h.read('evaluator'), sort_keys=True, default=str)) + r3 = g.A.invoke(instance_id=INST, capability_id='settings.configure', arguments=dict(trigger_1_pa_m3_s=1e-12), request_id='same') + self.assertEqual(r3['error']['code'], 'REQUEST_CONFLICT') + + def test_two_instances_isolated(self): + a, b = Rig(instance='t_a'), Rig(instance='t_b', ambient_k=298.15) + a.call(a.A, 'power.set', on=True) + self.assertFalse(b.read('power.on')) + r = a.A.invoke(instance_id='t_b', capability_id='power.set', arguments=dict(on=True), request_id='z') + self.assertEqual(r['error']['code'], 'UNKNOWN_INSTANCE') + + def test_step_partition_independence(self): + def run(steps): + g = Rig(seed=5) + g.call(g.A, 'power.set', on=True) + g.call(g.A, 'part.connect', **CHAMBER) + for s in steps: + g.step(s) + r = g.read() + return json.dumps({k: r[k] for k in r if not k.startswith('clock')}, sort_keys=True), json.dumps(g.ledger(), sort_keys=True) + a = run([400.0]) + b = run([0.05] * 200 + [0.37, 13.11, 376.52]) + c = run([20.0] * 20) + self.assertEqual(a, b) + self.assertEqual(a, c) + + def test_rejections_change_nothing(self): + g = Rig() + r = rt.InficonUl1000fabRuntime('fresh') + r.register_principal('e', 'evaluator') + self.assertEqual(r.session('e').invoke(instance_id='fresh', capability_id='power.set', arguments=dict(on=True), request_id='p')['error']['code'], 'PLANT_REQUIRED') + g.call(g.E, 'plant.configure', expect='SEED_FIXED', **dict(rt.PLANT_EXAMPLE, noise_seed=2)) + g.call(g.A, 'measure.start', expect='POWER_OFF') + g.call(g.A, 'part.disconnect', expect='NO_PART') + g.call(g.A, 'spray.set', expect='NO_PART', target='x', on=True) + g.call(g.A, 'part.connect', expect='DUPLICATE_LEAK', **dict(CHAMBER, leaks=CHAMBER['leaks'] * 2)) + g.call(g.A, 'power.set', on=True) + g.call(g.A, 'measure.start', expect='RUNNING_UP') + g.step(181.0) + g.call(g.A, 'zero.set', expect='NOT_MEASURING', enabled=True) + g.call(g.A, 'settings.configure', expect='TRIGGER_ORDER', trigger_1_pa_m3_s=1e-9, trigger_2_pa_m3_s=1e-10) + g.call(g.A, 'calibration.start', expect='MISSING_SETTING', kind='external') + g.call(g.A, 'sniffer.position', expect='NO_SNIFFER', target='x', distance_m=0.0) + g.call(g.A, 'part.connect', **CHAMBER) + g.call(g.A, 'part.connect', expect='INLET_OCCUPIED', **CHAMBER) + g.call(g.A, 'measure.start') + g.step(5.0) + g.call(g.A, 'part.disconnect', expect='INLET_NOT_VENTED') + g.call(g.A, 'settings.configure', expect='MEASURING', mode='sniff') + g.call(g.E, 'fault.inject', expect='INVALID_ARGUMENT', fault='alien', active=True) + g.call(g.E, 'fault.inject', fault='turbo_failure', active=True) + g.call(g.A, 'zero.set', expect='DETECTOR_FAULT', enabled=True) + + +class Physics(unittest.TestCase): + def test_run_up_pumpdown_and_autoranging(self): + g = Rig() + g.call(g.A, 'power.set', on=True) + self.assertEqual(g.read('state.current'), 'run_up') + g.step(179.0) + self.assertEqual(g.read('state.current'), 'run_up') + g.step(2.0) + self.assertEqual(g.read('state.current'), 'standby') + g.call(g.A, 'part.connect', **CHAMBER) + g.call(g.A, 'measure.start') + seen = [] + t = g.until(lambda: (seen.append(g.read('range.current')) or True) and g.read('range.current') == 'ULTRA', 600.0, 0.5) + order = [x for i, x in enumerate(seen) if x and (i == 0 or seen[i - 1] != x)] + self.assertEqual(order[:3], ['GROSS', 'FINE', 'ULTRA']) + self.assertLess(t, 120.0) + ta = g.read('truth.gas') + self.assertLess(ta['total_pressure_pa'], 40.0) + big = Rig() + big.ready() + big.call(big.A, 'part.connect', **dict(CHAMBER, volume_m3=0.2)) + big.call(big.A, 'measure.start') + t_big = big.until(lambda: big.read('range.current') == 'ULTRA', 3000.0, 2.0) + self.assertGreater(t_big, 3 * t) # pump-down time grows with the volume + poly = Rig() + poly.ready() + poly.call(poly.A, 'part.connect', **dict(CHAMBER, surface_area_m2=2.0, material='neoprene_unbaked')) + poly.call(poly.A, 'measure.start') + t_poly = poly.until(lambda: poly.read('range.current') == 'ULTRA', 1700.0, 5.0) + self.assertGreater(t_poly, 2 * t) # polymer outgassing delays ULTRA + CHECKS.append(dict(id='pumpdown', status='passed', layer='process', t_ultra_10l_s=t, t_ultra_200l_s=t_big, t_ultra_neoprene_s=t_poly)) + + def test_large_leak_hits_the_maximum_evacuation_time(self): + g = Rig() + g.ready() + g.call(g.A, 'settings.configure', max_evacuation_s=300.0) + r = g.call(g.A, 'part.connect', **dict(CHAMBER, leaks=[dict(leak_id='gross', helium_leak_rate_pa_m3_s=20.0)])) + self.assertTrue(r['notes']) + g.call(g.A, 'measure.start') + g.step(320.0) + self.assertIn('W76', g.read('alarms.active')) + self.assertEqual(g.read('state.current'), 'standby') + + def test_spray_response_time_grows_with_volume_and_path(self): + def t63(volume, path_len, diam): + g = Rig() + g.ready() + g.call(g.A, 'part.connect', **dict(CHAMBER, volume_m3=volume, leaks=[dict(leak_id='weld', helium_leak_rate_pa_m3_s=1e-8 * MB, path_length_m=path_len, + path_diameter_m=diam)])) + g.call(g.A, 'measure.start') + g.until(lambda: g.read('range.current') == 'ULTRA', 3000.0, 2.0) + g.step(120.0) + g.call(g.A, 'zero.set', enabled=True) + g.call(g.A, 'spray.set', target='weld', on=True) + final = 1e-8 * MB * rt.ENG['spray_he_fraction'] + t = g.until(lambda: (g.read('leak.display_pa_m3_s') or 0) > 0.63 * final, 2000.0, 0.5) + g.step(600.0) + return t, g.read('leak.display_pa_m3_s') + t_small, v_small = t63(0.002, 0.05, 0.01) + t_big, _ = t63(0.05, 0.05, 0.01) + t_path, _ = t63(0.002, 3.0, 0.002) + self.assertGreater(t_big, 3 * t_small) + self.assertGreater(t_path, t_small + 5.0) + self.assertAlmostEqual(v_small / (1e-8 * MB * rt.ENG['spray_he_fraction']), 1.0, delta=0.2) + CHECKS.append(dict(id='response_time', status='passed', layer='process', t63_2l_s=t_small, t63_50l_s=t_big, t63_3m_path_s=t_path)) + + def test_detection_limit_is_a_floor_not_the_reading_error(self): + g = Rig() + g.ready() + g.call(g.A, 'part.connect', **dict(CHAMBER, leaks=[])) + g.call(g.A, 'measure.start') + g.until(lambda: g.read('range.current') == 'ULTRA', 600.0, 1.0) + g.step(1200.0) + g.call(g.A, 'zero.set', enabled=True) + vals = [] + for _ in range(40): + g.step(1.0) + vals.append(g.read('leak.display_pa_m3_s')) + self.assertTrue(all(v >= rt.DISPLAY_LIMIT['ULTRA'] for v in vals)) + self.assertLess(max(vals), 5 * rt.RANGES['ULTRA']['limit_pa_m3_s']) + big = Rig() + big.ready() + big.call(big.A, 'part.connect', **dict(CHAMBER, leaks=[dict(leak_id='w', helium_leak_rate_pa_m3_s=1e-6 * MB)])) + big.call(big.A, 'measure.start') + big.until(lambda: big.read('range.current') == 'ULTRA', 600.0, 1.0) + big.call(big.A, 'spray.set', target='w', on=True) + big.step(120.0) + r = [] + for _ in range(20): + big.step(1.0) + r.append(big.read('leak.display_pa_m3_s')) + mean = sum(r) / len(r) + rel = math.sqrt(sum((x - mean) ** 2 for x in r) / len(r)) / mean + self.assertLess(rel, 0.12) # a large reading has a relative error far above the detection limit + self.assertEqual(big.read('leak.status'), 'reject') + + def test_zero_izero_and_auto_zero(self): + g = Rig() + g.ready() + g.call(g.A, 'settings.configure', zero_mode='i_zero') + g.call(g.A, 'part.connect', **CHAMBER) + g.call(g.A, 'measure.start') + g.until(lambda: g.read('range.current') == 'GROSS', 600.0, 0.5) + g.step(0.5) + g.call(g.A, 'zero.set', expect='SIGNAL_NOT_STABLE', enabled=True) # background still falling fast + g.until(lambda: g.read('signal.stable'), 1800.0, 2.0) + g.call(g.A, 'zero.toggle') + self.assertTrue(g.read('zero.enabled')) + g.call(g.A, 'zero.set', enabled=False) + self.assertFalse(g.read('zero.enabled')) + h = Rig() + h.ready() + h.call(h.E, 'fault.inject', fault='helium_contamination', active=True) + h.step(30.0) + h.call(h.E, 'fault.inject', fault='helium_contamination', active=False) + h.call(h.A, 'measure.start') + self.assertGreater(h.read('zero.offset_pa_m3_s'), 0.0) # background suppression: internal background measured in standby + + def test_calibration_drift_and_test_leak(self): + g = Rig(ambient_k=303.15, temperature_at_calibration_k=293.15) + g.ready() + self.assertNotIn('W80', g.read('alarms.active')) # calibration request is OFF by default (manual) + g.call(g.A, 'settings.configure', calibration_request=True) + self.assertIn('W80', g.read('alarms.active')) + g.call(g.A, 'part.connect', **dict(CHAMBER, volume_m3=0.002, leaks=[dict(leak_id='ref', helium_leak_rate_pa_m3_s=1e-7 * MB, path_length_m=0.0)])) + g.call(g.A, 'measure.start') + g.until(lambda: g.read('range.current') == 'ULTRA', 600.0, 1.0) + g.step(300.0) + g.call(g.A, 'zero.set', enabled=True) + g.call(g.A, 'spray.set', target='ref', on=True) + g.step(60.0) + before = g.read('leak.display_pa_m3_s') + true = 1e-7 * MB * rt.ENG['spray_he_fraction'] + self.assertGreater(abs(before / true - 1), 0.07) # 10 K away from the last calibration: about 10 % off + g.call(g.A, 'spray.set', target='ref', on=False) + g.step(60.0) + r = g.call(g.A, 'calibration.start', kind='external', test_leak_pa_m3_s=1e-7 * MB * rt.ENG['spray_he_fraction']) + g.call(g.A, 'spray.set', target='ref', on=True) + g.step(r['duration_s'] + 30.0) + self.assertEqual(g.read('state.current'), 'measure') + g.step(30.0) + self.assertAlmostEqual(g.read('leak.display_pa_m3_s') / true, 1.0, delta=0.12) + self.assertNotIn('W80', g.read('alarms.active')) # calibrated at the current temperature + e = Rig() + e.ready() + e.call(e.E, 'fault.inject', fault='internal_test_leak_empty', active=True) + e.call(e.A, 'calibration.start', kind='internal') + e.step(60.0) + self.assertIn('W81', e.read('alarms.active')) + self.assertEqual(e.read('calibration.factor'), 1.0) + ok = Rig() + ok.ready() + ok.call(ok.A, 'calibration.start', kind='internal') + ok.step(60.0) + self.assertEqual(ok.read('state.current'), 'standby') + self.assertAlmostEqual(ok.read('calibration.factor'), 1.0, delta=0.1) + + def test_seal_permeation_slow_signal(self): + g = Rig() + g.ready() + g.call(g.A, 'part.connect', **dict(CHAMBER, volume_m3=0.002, leaks=[dict(leak_id='oring', helium_leak_rate_pa_m3_s=2e-9 * MB, kind='seal_permeation')])) + g.call(g.A, 'measure.start') + g.until(lambda: g.read('range.current') == 'ULTRA', 600.0, 1.0) + g.step(300.0) + g.call(g.A, 'zero.set', enabled=True) + g.call(g.A, 'spray.set', target='oring', on=True) + g.step(20.0) + early = g.read('leak.display_pa_m3_s') + g.step(400.0) + late = g.read('leak.display_pa_m3_s') + self.assertGreater(late, 3 * early) # permeation is slow (minutes), unlike a channel leak + + def test_sniffer_mode(self): + g = Rig() + g.ready() + g.call(g.A, 'sniffer.connect', connected=True) + g.call(g.A, 'measure.start', expect='SNIFFER_IN_VACUUM_MODE') + g.call(g.A, 'settings.configure', mode='sniff') + g.call(g.A, 'measure.start') + g.step(10.0) + bg = g.read('leak.display_pa_m3_s') + self.assertGreater(bg, 0.5 * rt.ENG['helium_in_air_mol_fraction'] * rt.ENG['sniff_flow_pa_m3_s']) # air helium background + g.call(g.A, 'zero.set', enabled=True) + g.call(g.A, 'measure.stop') + g.call(g.A, 'sniffer.connect', connected=False) + g.call(g.A, 'part.connect', **dict(CHAMBER, helium_fill_pa=2e5, leaks=[dict(leak_id='weld', helium_leak_rate_pa_m3_s=1e-5 * MB)])) + g.call(g.A, 'part.disconnect') + h = Rig() + h.ready() + h.call(h.A, 'settings.configure', mode='sniff') + h.call(h.A, 'sniffer.connect', connected=True) + r = h.call(h.A, 'part.connect', part_id='vessel', volume_m3=0.01, surface_area_m2=0.0, material='stainless_unbaked', helium_fill_pa=2e5, + leaks=[dict(leak_id='weld', helium_leak_rate_pa_m3_s=1e-5 * MB)]) # sniffer mode: declared as the sniffed object + self.assertTrue(any('吸枪检查对象' in n for n in r['notes'])) + self.assertEqual(h.read('part.connected'), 'sniffer') + h.call(h.A, 'part.connect', expect='INLET_OCCUPIED', **CHAMBER) + h.call(h.A, 'measure.start') + h.step(10.0) + h.call(h.A, 'zero.set', enabled=True) # subtract the air helium background + h.call(h.A, 'sniffer.position', target='weld', distance_m=0.0) + h.step(5.0) + near = h.read('leak.display_pa_m3_s') + h.call(h.A, 'sniffer.position', target='weld', distance_m=0.02) + h.step(5.0) + far = h.read('leak.display_pa_m3_s') + self.assertGreater(near, 10 * far) + h.call(h.A, 'part.disconnect') # sniffed object moved away: only the background remains + h.step(5.0) + self.assertLess(h.read('leak.display_pa_m3_s'), far + 1e-15) + self.assertAlmostEqual(near / (2e-5 * MB), 1.0, delta=0.3) # 2 bar helium fill doubles the standard leak rate + b = Rig() + b.ready() + b.call(b.A, 'settings.configure', mode='sniff') + b.call(b.A, 'sniffer.connect', connected=True) + b.call(b.E, 'fault.inject', fault='sniffer_capillary_blocked', active=True) + b.call(b.A, 'measure.start') + b.step(8.0) + self.assertIn('W62', b.read('alarms.active')) # inlet below 0.1 mbar after the warning delay + c = Rig() + c.ready() + c.call(c.A, 'settings.configure', mode='sniff') + c.call(c.A, 'sniffer.connect', connected=True) + c.call(c.A, 'measure.start') + c.step(8.0) + self.assertTrue(10.0 <= c.read('truth.gas')['total_pressure_pa'] <= 100.0) # healthy line: inside the 0.1-1 mbar window + self.assertNotIn('W62', c.read('alarms.active')) + + def test_conversion_vent_ledgers_rotation_and_faults(self): + g = Rig() + g.ready() + r = g.call(g.A, 'leakrate.convert', gas='nitrogen', helium_leak_rate_pa_m3_s=1e-8) + self.assertAlmostEqual(r['factor'], math.sqrt(rt.M_HE / rt.gases()['nitrogen']['molar_mass_kg_mol']), places=12) + self.assertLess(r['equivalent_leak_rate_pa_m3_s'], 1e-8) + self.assertGreaterEqual(len(rt.gases()), 50) + g.call(g.A, 'display.rotate', angle_rad=0.7) + g.call(g.A, 'part.connect', **CHAMBER) + g.call(g.A, 'measure.start') + g.step(120.0) + g.call(g.A, 'spray.set', target='weld', on=True) + g.step(30.0) + g.call(g.A, 'measure.stop', hold_s=3.0) + self.assertEqual(g.read('state.current'), 'vent') + g.step(30.0) + self.assertEqual(g.read('state.current'), 'standby') + self.assertAlmostEqual(g.read('pressure.inlet_pa'), 101325.0, delta=0.05 * 101325.0) + g.call(g.A, 'part.disconnect') + _balance(self, g.ledger()) + d = g.call(g.A, 'datalog.read', last=10) + self.assertGreaterEqual(len(d['records']), 10) + g.call(g.E, 'fault.inject', fault='filament_1_failure', active=True) + g.step(1.0) + self.assertIn('W45', g.read('alarms.active')) + g.call(g.A, 'power.toggle') + self.assertFalse(g.read('power.on')) + f = Rig() + f.ready() + f.call(f.A, 'part.connect', **CHAMBER) + f.call(f.A, 'measure.start') + f.step(200.0) + f.call(f.A, 'calibration.start', kind='internal') + f.step(100.0) + self.assertIn(f.read('state.current'), ('measure', 'calibration')) + f.call(f.E, 'truth.inspect') + _balance(self, f.ledger()) + + +class ReviewR1(unittest.TestCase): + """Round-1 runtime review regressions.""" + def test_zero_follows_a_falling_signal(self): + g = Rig() + g.ready() + g.call(g.A, 'part.connect', **dict(CHAMBER, volume_m3=0.002, leaks=[dict(leak_id='w', helium_leak_rate_pa_m3_s=5e-10 * MB)])) + g.call(g.A, 'measure.start') + g.until(lambda: g.read('range.current') == 'ULTRA', 600.0, 1.0) + g.step(20.0) + g.call(g.A, 'zero.set', enabled=True) # ZERO while the background is still falling + g.step(600.0) + self.assertEqual(g.read('leak.status'), 'pass') # no false reject later + g.call(g.A, 'spray.set', target='w', on=True) + g.step(30.0) + self.assertGreater(g.read('leak.display_pa_m3_s'), 0.5 * 5e-10 * MB * rt.ENG['spray_he_fraction']) # the sprayed leak is not masked + + def test_start_during_vent_and_machine_factor(self): + g = Rig() + g.ready() + g.call(g.A, 'settings.configure', machine_factor=0.37) + g.call(g.A, 'measure.start') + g.step(5.0) + g.call(g.A, 'measure.stop', hold_s=3.0) + self.assertEqual(g.read('state.current'), 'vent') + g.call(g.A, 'measure.start') + g.step(10.0) + self.assertEqual(g.read('state.current'), 'measure') + + def test_two_stage_w76_and_huge_leaks_stable(self): + g = Rig() + g.ready() + g.call(g.A, 'part.connect', **dict(CHAMBER, volume_m3=0.0, surface_area_m2=0.0, leaks=[dict(leak_id=f'l{i}', helium_leak_rate_pa_m3_s=100.0) for i in range(12)])) + g.call(g.A, 'measure.start') + g.step(31.0) + self.assertIn('W76', g.read('alarms.active')) # p1 never below 100 mbar within 30 s + tg = g.read('truth.gas') + self.assertTrue(all(math.isfinite(v) for v in (tg['total_pressure_pa'], tg['helium_partial_pa']))) + L = g.ledger() + _balance(self, L) + + def test_internal_calibration_with_part_and_timing(self): + g = Rig() + g.ready() + r = g.call(g.A, 'calibration.start', kind='internal') + t = g.until(lambda: g.read('state.current') == 'standby', 120.0, 0.5) + self.assertAlmostEqual(t, r['duration_s'], delta=6.0) + self.assertAlmostEqual(r['duration_s'], 25.0, delta=0.5) # about 25 s including the recovery after the test leak closes + h = Rig() + h.ready() + h.call(h.A, 'part.connect', **dict(CHAMBER, volume_m3=0.005, leaks=[])) + h.call(h.A, 'measure.start') + h.until(lambda: h.read('range.current') == 'ULTRA', 600.0, 1.0) + h.step(60.0) + h.call(h.A, 'calibration.start', kind='internal') + h.step(300.0) + self.assertNotIn('W81', h.read('alarms.active')) + self.assertAlmostEqual(h.read('calibration.factor'), 1.0, delta=0.15) + + def test_range_does_not_flap(self): + g = Rig() + g.ready() + g.call(g.A, 'part.connect', **dict(CHAMBER, volume_m3=0.002, surface_area_m2=1.0, material='neoprene_unbaked', leaks=[])) + g.call(g.A, 'measure.start') + g.step(600.0) + n = sum(e['code'].startswith('RANGE_') for e in g.call(g.A, 'events.read', since_s=0.0)['events']) + self.assertLess(n, 25) # anti-hunting: at most one upgrade per minute + + +class ReviewR2(unittest.TestCase): + """Round-2 review: calibration from vented standby, manual 6.4.5 alarm delay, anti-hunting reset, truth air inflow, recovery after calibration.""" + def test_calibration_with_part_from_vented_standby(self): + g = Rig() + g.ready() + g.call(g.A, 'part.connect', **dict(CHAMBER, volume_m3=0.005, leaks=[])) + r = g.call(g.A, 'calibration.start', kind='internal') + rem = [] + t = g.until(lambda: rem.append(g.read('state.remaining_s')) or g.read('state.current') == 'standby', 600.0, 0.5) + self.assertTrue(all(x is not None and x > 0 for x in rem[:-1]), rem[:5]) + self.assertLess(abs(t - r['duration_s']), 0.35 * t, (t, r['duration_s'])) + self.assertNotIn('W81', g.read('alarms.active')) + self.assertAlmostEqual(g.read('calibration.factor'), 1.0, delta=0.03) + ref = Rig() + ref.ready() + ref.call(ref.A, 'part.connect', **dict(CHAMBER, volume_m3=0.005, leaks=[])) + ref.call(ref.A, 'measure.start') + ref.step(g.h.t - ref.h.t) + bg, bg_ref = g.read('truth.detector')['internal_background_pa_m3_s'], ref.read('truth.detector')['internal_background_pa_m3_s'] + self.assertLess(bg, 1.2 * bg_ref, (bg, bg_ref)) # no air helium counted above 15 mbar: background as after a normal START + g.call(g.A, 'measure.start') + g.step(300.0) + self.assertEqual(g.read('leak.status'), 'pass') + + def test_alarm_sounds_once_below_trigger_and_partition_independent(self): + part = dict(CHAMBER, volume_m3=0.0005, surface_area_m2=0.05, leaks=[dict(leak_id='weld', helium_leak_rate_pa_m3_s=1e-7 * MB)]) + res = [] + for chunks in ([0.5] * 40, [20.0]): + g = Rig() + g.ready() + g.call(g.A, 'part.connect', **part) + g.call(g.A, 'measure.start') + for c in chunks: + g.step(c) + self.assertEqual(g.read('leak.status'), 'pass') + g.call(g.A, 'spray.set', target='weld', on=True) + g.step(4.0) + res.append((g.read('leak.status'), g.read('alarm.audible'))) + self.assertEqual(res[0], ('reject', True)) # 24 s after START: below trigger 1 earlier, so no alarm delay + self.assertEqual(res[0], res[1]) + + def test_new_start_is_not_held_by_an_old_downgrade(self): + g = Rig() + g.ready() + g.call(g.A, 'part.connect', **dict(CHAMBER, volume_m3=0.0005, surface_area_m2=0.05, leaks=[])) + g.h.downgrade_t = g.h.t # a downgrade just happened in an earlier measurement + g.call(g.A, 'measure.start') + t = g.until(lambda: g.read('range.current') == 'ULTRA', 60.0, 0.5) + self.assertLess(t, 20.0) + + def test_truth_air_inflow_matches_the_gas_balance(self): + g = Rig() + g.ready() + g.call(g.A, 'part.connect', **dict(CHAMBER, volume_m3=0.002, surface_area_m2=0.0, + leaks=[dict(leak_id='crack', helium_leak_rate_pa_m3_s=1e-2, path_length_m=0.5, path_diameter_m=0.002)])) + g.call(g.A, 'measure.start') + g.step(60.0) + q = g.read('truth.leaks')['crack']['air_inflow_pa_m3_s'] + L0 = g.ledger()['gas_leak_in'] + g.step(2.0) + rate = (g.ledger()['gas_leak_in'] - L0) / 2.0 + self.assertAlmostEqual(q / rate, 1.0, delta=0.02) + + def test_no_false_reject_right_after_calibration(self): + g = Rig() + g.ready() + g.call(g.A, 'part.connect', **dict(CHAMBER, volume_m3=0.0005, surface_area_m2=0.05, leaks=[])) + g.call(g.A, 'measure.start') + g.until(lambda: g.read('range.current') == 'ULTRA', 120.0, 0.5) + g.step(30.0) + g.call(g.A, 'calibration.start', kind='internal') + g.until(lambda: g.read('state.current') == 'measure', 120.0, 0.5) + st = [] + for _ in range(20): + st.append(g.read('leak.status')) + g.step(0.5) + self.assertNotIn('reject', st) + + +class ReviewR3(unittest.TestCase): + """Round-3 minors fixed directly: duration incl. range dwells, drift-corrected baseline, warning cleared by a new calibration, abort on re-pressurising.""" + def test_duration_estimate_and_warning_cleared(self): + g = Rig() + g.ready() + g.call(g.A, 'part.connect', **dict(CHAMBER, volume_m3=0.005, leaks=[])) + r = g.call(g.A, 'calibration.start', kind='internal') + t = g.until(lambda: g.read('state.current') == 'standby', 600.0, 0.5) + self.assertLess(abs(t - r['duration_s']), 6.0, (t, r['duration_s'])) + g.h.warnings_latch = 'W76' # an earlier aborted calibration + g.call(g.A, 'calibration.start', kind='internal') + self.assertNotIn('W76', g.read('alarms.active')) + + def test_no_false_reject_with_falling_background(self): + g = Rig() + g.ready() + g.call(g.A, 'settings.configure', trigger_1_pa_m3_s=2.3e-10) + g.call(g.A, 'part.connect', **dict(CHAMBER, volume_m3=0.01, leaks=[])) + g.call(g.A, 'measure.start') + g.until(lambda: g.read('range.current') == 'GROSS', 60.0, 0.5) + g.call(g.A, 'calibration.start', kind='internal') + g.until(lambda: g.read('state.current') == 'measure', 300.0, 0.5) + st = [] + for _ in range(10): + st.append(g.read('leak.status')) + g.step(0.5) + self.assertNotIn('reject', st) + self.assertAlmostEqual(g.read('calibration.factor'), 1.0, delta=0.02) + + def test_repressurised_inlet_aborts_running_calibration(self): + g = Rig() + g.ready() + g.call(g.A, 'part.connect', **dict(CHAMBER, volume_m3=0.002, leaks=[])) + g.call(g.A, 'measure.start') + g.until(lambda: g.read('range.current') == 'ULTRA', 120.0, 0.5) + f0 = g.read('calibration.factor') + g.call(g.A, 'calibration.start', kind='internal') + g.until(lambda: g.h.cal is not None and g.h.cal['stage'] == 'open', 120.0, 0.5) + g.call(g.E, 'fault.inject', fault='scroll_pump_failure', active=True) + g.call(g.E, 'part.connect', **dict(CHAMBER, part_id='chamber2', volume_m3=0.002, leaks=[dict(leak_id='big', helium_leak_rate_pa_m3_s=0.3)]), expect='PART_CONNECTED') if False else None + g.h.p1 = 5000.0 # the inlet re-pressurises (evaluator-only situation) + g.step(1.0) + self.assertIsNone(g.h.cal) + self.assertEqual(g.read('calibration.factor'), f0) + self.assertIn('CAL_ABORTED', [e['code'] for e in g.call(g.E, 'events.read', since_s=0.0)['events']]) + + +class ZCoverage(unittest.TestCase): + def test_all_capabilities_exercised(self): + implemented = {k for k in rt.CAPS if k not in rt.UNSUPPORTED} + missing = implemented - SEEN_CAPS + if len(SEEN_CAPS) > 5: + self.assertFalse(missing, sorted(missing)) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_asset_ja_alphase.py b/tests/test_asset_ja_alphase.py new file mode 100644 index 0000000000000000000000000000000000000000..887fbfa210574cc12a6c4715f20fe657b34054b3 --- /dev/null +++ b/tests/test_asset_ja_alphase.py @@ -0,0 +1,1912 @@ +"""tests for CHEM-157 ja_alphase (J.A. Woollam alpha-SE): python3 -m unittest tests/test_asset_ja_alphase.py + +Topics (pipeline.md): set points only write targets, read/describe are pure, rejected preconditions leave the state unchanged, two instances +are isolated, agent/evaluator truth isolation (truth slots, template substances of the true sample, fault events, other agents' records +and operations), conservation (electrical energy = integral of the lamp and electronics power, lamp hours, stage and arm travel, liquid +volume added = drained + in the cell), real return values validated against the declared schemas (asset_tool lint_schema / validate_value), +asynchronous completion and cancellation remnants, host-step independence, declared immediate and on_step effects (scenario states, short +and long windows); plus the instrument (initialisation, lamp warm-up, vacuum chuck, manual angle change with the plunger, Z stage and +alignment, collision guard, liquid cell, faults) and the physics: exact Fresnel / Airy / Abeles optics, Brewster angle, Kramers-Kronig of the +Tauc-Lorentz model, Bruggeman limits, pseudo dielectric inversion, the straight-through accuracy and the 2 nm SiO2 repeatability of the +specification, calibration against the hidden angle / azimuth / retardance errors, %R against the model reflectance, Mueller-matrix +structure of an isotropic sample, depolarization and backside reflections, and the CompleteEASE-like analysis (prefit, multi-angle fit, +confidence limits, uniqueness, Tauc-Lorentz and library models). +""" +import copy +import json +import math +import sys +import time +import unittest +from pathlib import Path + +import numpy as np + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / 'scripts')) +sys.path.insert(0, str(ROOT / 'skills/chemistry-lab-assets/scripts')) +from asset_runtime import ja_alphase as rt # noqa: E402 +import asset_tool # noqa: E402 + +CHECKS, PROCESS_EVIDENCE, REJECTIONS = [], {}, {} +_META = {} +_SC = {} + + +def _meta(): + if not _META: + _META.update(rt.export_ja_alphase_contract_metadata()) + return _META + + +def _changed(a, b): + return json.dumps(a, sort_keys=True, default=str) != json.dumps(b, sort_keys=True, default=str) + + +_orig_invoke = rt.JaAlphaseRuntime.invoke + + +def _instrumented_invoke(self, capability_id, **a): + """Every successful call is checked against its declared output schema and immediate state effects (a call does not advance time); every + rejection code is recorded for the declaration check.""" + before = self.read('evaluator') if capability_id != 'sim.step' else None + t0 = self.t + try: + out = _orig_invoke(self, capability_id, **a) + except rt.ActionRejected as exc: + REJECTIONS.setdefault(capability_id, set()).add(str(exc)) + raise + meta = _meta()['capabilities'][capability_id] + errs = asset_tool.validate_value(out, meta['output_schema']) + if errs: + raise AssertionError(f'{capability_id} output violates its schema: {errs[:3]}') + if before is not None: + assert self.t == t0, capability_id + after = self.read('evaluator') + undeclared = {k for k in after if _changed(before[k], after[k])} - set(rt.EFFECTS.get(capability_id, [])) + if undeclared and len(rt.EFFECTS) > 1: + raise AssertionError(f'{capability_id} changed undeclared state immediately: {sorted(undeclared)}') + PROCESS_EVIDENCE.setdefault(capability_id, []).append(dict(arguments=copy.deepcopy(a), result_keys=sorted(out))) + return out + + +rt.JaAlphaseRuntime.invoke = _instrumented_invoke + +MZ = rt.MEASURE_POINT_M[2] +PMMA = copy.deepcopy(rt.SAMPLE_EXAMPLE) # 120 nm PMMA over 1.8 nm SiO2 on a 2 in Si wafer +CAL = copy.deepcopy(rt.CALIBRATION_WAFER) # 25 nm thermal oxide on Si +OX2 = dict(sample_id='ox2_si', kind='film_stack', shape='disc', size_m=[0.1, 0.1], substrate_thickness_m=0.000525, substrate={'library': 'si'}, + layers=[dict(material={'library': 'sio2'}, thickness_m=2e-9)], roughness_m=0.0, backside='rough') +BARE = dict(sample_id='bare_si', kind='film_stack', shape='disc', size_m=[0.0508, 0.0508], substrate_thickness_m=0.000275, substrate={'library': 'si'}, layers=[], + roughness_m=0.0, backside='rough') +SLIDE = dict(sample_id='tio2_slide', kind='film_stack', shape='rectangle', size_m=[0.0762, 0.0254], substrate_thickness_m=0.001, substrate={'library': 'soda_lime'}, + layers=[dict(material={'library': 'tio2'}, thickness_m=80e-9)], roughness_m=2e-9, backside='polished') +W200 = dict(sample_id='wafer_200', kind='film_stack', shape='disc', size_m=[0.2, 0.2], substrate_thickness_m=0.000725, substrate={'library': 'si'}, + layers=[dict(material={'library': 'sio2'}, thickness_m=100e-9)], roughness_m=0.0, backside='rough') +BLOCK = dict(sample_id='glass_block', kind='film_stack', shape='rectangle', size_m=[0.025, 0.025], substrate_thickness_m=0.006, substrate={'library': 'soda_lime'}, + layers=[], roughness_m=0.0, backside='rough') +TINY = dict(sample_id='tiny', kind='film_stack', shape='disc', size_m=[0.006, 0.006], substrate_thickness_m=0.0005, substrate={'library': 'si'}, layers=[], + roughness_m=0.0, backside='rough') +MGF2 = dict(sample_id='mgf2_plate', kind='film_stack', shape='rectangle', size_m=[0.025, 0.025], substrate_thickness_m=0.001, substrate={'library': 'mgf2'}, + layers=[], roughness_m=0.0, backside='rough') +FIT = dict(record_ids=['SE0001'], model_id='cauchy_on_si', parameters={}, fit=['film.thickness_m', 'film.A', 'film.B'], thickness_prefit=True) + + +def configured(seed=1, samples=(PMMA, CAL), **plant): + h = rt.JaAlphaseRuntime() + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, noise_seed=seed, **plant)) + for s in samples: + h.invoke('sample.provide', **s) + return h + + +def ready(seed=1, warm=600.0, samples=(PMMA, CAL), **plant): + h = configured(seed, samples, **plant) + h.invoke('power.set', enabled=True) + h.step(warm) + return h + + +def settle(h, limit=600.0, dt=0.5): + t = 0.0 + while (h._stage_moving() or h._arm_seat_at is not None) and t < limit: + h.step(dt) + t += dt + assert not (h._stage_moving() or h._arm_seat_at is not None) + return h + + +def wait(h, op, tmax=900.0, dt=0.5): + t = 0.0 + while h.operations[op]['phase'] == 'running' and t < tmax: + h.step(dt) + t += dt + assert h.operations[op]['phase'] != 'running', op + return h.records[h.operations[op]['record_id']] + + +def held(sample=PMMA, seed=1, offset=(0.0, 0.0), samples=(PMMA, CAL), **plant): + h = ready(seed, samples=tuple(samples) + ((sample,) if sample not in samples else ()), **plant) + h.invoke('sample.place', sample_id=sample['sample_id'], offset_x_m=offset[0], offset_y_m=offset[1]) + h.invoke('vacuum.set', on=True) + return h + + +def measure(h, mode='standard', alignment='standard', fixed_height_m=None, model_id=None): + op = h.invoke('measure', mode=mode, alignment=alignment, fixed_height_m=fixed_height_m, model_id=model_id)['operation_id'] + return wait(h, op) + + +def straight_through(h): + settle(h) + h.invoke('aoi.set', position='90') + settle(h) + return measure(h, alignment='none') + + +def rejected(h, cap, code, **a): + before = h.read('evaluator') + rev = h.revision + led = h.ledger() + try: + h.invoke(cap, **a) + except rt.ActionRejected as exc: + assert str(exc) == code, (cap, str(exc), code) + assert not _changed(h.read('evaluator'), before), cap + assert h.revision == rev, cap + assert not _changed(h.ledger(), led), cap + return True + raise AssertionError(f'{cap} was not rejected (expected {code})') + + +def _into(h, phase, frac=0.5): + """Advance event-exactly to the given phase of the running operation and then to `frac` of its duration.""" + for _ in range(20): + o = h.op + assert o is not None, phase + end = o['ends'][o['i']] + if o['phases'][o['i']][0] == phase: + h.step(max(0.0, (end - h.t) * frac)) + return h + h.step(max(0.0, end - h.t) + 1e-9) + raise AssertionError(phase) + + +def _ncs(psi, delta): + return rt.ncs_of(np.asarray(psi), np.asarray(delta)) + + +def _close(a, b, rel=1e-8): + """Nested equality with a relative tolerance for floats (host-step chopping only reorders floating-point sums).""" + if isinstance(a, dict) and isinstance(b, dict): + return a.keys() == b.keys() and all(_close(a[k], b[k], rel) for k in a) + if isinstance(a, (list, tuple)) and isinstance(b, (list, tuple)): + return len(a) == len(b) and all(_close(x, y, rel) for x, y in zip(a, b)) + if isinstance(a, float) or isinstance(b, float): + return abs(a - b) <= rel * max(abs(a), abs(b), 1e-300) + return a == b + + +class ContractAndSchemas(unittest.TestCase): + def test_module_identity(self): + self.assertEqual(rt.ASSET_TYPE_ID, 'instrument.ja_alphase') + self.assertEqual(rt.CATALOG_ID, 'CHEM-157') + self.assertEqual(len(rt.wavelengths_nm()), 180) + self.assertAlmostEqual(rt.wavelengths_nm()[0], 380.0, places=9) + self.assertAlmostEqual(rt.wavelengths_nm()[-1], 900.0, places=9) + e = rt.HC_EV_NM / rt.wavelengths_nm() + self.assertTrue(np.allclose(np.diff(e[::-1]), rt.PIXEL_WIDTH_EV)) # pixels equal in photon energy + + def test_schemas_lint_and_examples_validate(self): + m = _meta() + for k, c in m['capabilities'].items(): + for part in ('input_schema', 'output_schema'): + self.assertEqual(asset_tool.lint_schema(c[part]), [], (k, part)) + ex = rt.CAPS[k].get('example_arguments') + if ex is not None: + self.assertEqual(asset_tool.validate_value(ex, c['input_schema']), [], k) + for k, s in m['state_slots'].items(): + self.assertEqual(asset_tool.lint_schema(s['value_schema']), [], k) + for name in ('fresh', 'ready', 'acquiring', 'measured', 'cell_filled', 'calibrated'): + v = _scenario(name).read('evaluator') + for k, x in v.items(): + self.assertEqual(asset_tool.validate_value(x, m['state_slots'][k]['value_schema']), [], (name, k)) + h = _scenario('measured') + for rid in h.records: + self.assertEqual(asset_tool.validate_value(h._out(h.records[rid]), m['capabilities']['measurement.result']['output_schema']), [], rid) + + def test_metadata_references_are_consistent(self): + m = _meta() + slots = set(m['state_slots']) + for k, c in m['capabilities'].items(): + for e in c['state_effects']: + self.assertIn(e['state_id'], slots, (k, e)) + for x in c['observes']: + self.assertIn(x, slots, (k, x)) + for pre in c['preconditions']: + for x in pre['state_ids']: + self.assertIn(x, slots, (k, x)) + for x in c['execution']['completion_state_ids']: + self.assertIn(x, slots, (k, x)) + codes = [e['code'] for e in c['errors']] + self.assertEqual(len(codes), len(set(codes)), k) + for e in c['errors']: + self.assertIn(e['code'], rt.ERROR_ZH, (k, e['code'])) + for k in rt.CAPS: + self.assertIn(k, rt.CAP_SOURCES, k) + self.assertEqual(set(rt.PRECONDITIONS) - set(rt.CAPS), set()) + for k, v in rt.EFFECTS.items(): + self.assertIn(k, rt.CAPS) + self.assertEqual(set(v) - slots, set(), k) + for k, v in rt.ON_STEP.items(): + self.assertIn(k, rt.CAPS) + self.assertEqual(set(v) - slots, set(), k) + for mech in m['mechanisms'].values(): + self.assertEqual(set(mech['state_ids']) - slots, set()) + + def test_unsupported_capabilities_report_unsupported(self): + h = ready() + for k in rt.UNSUPPORTED: + with self.assertRaises(rt.ActionRejected) as cm: + _orig_invoke(h, k, **(rt.CAPS[k].get('example_arguments') or {})) + self.assertEqual(str(cm.exception), 'UNSUPPORTED') + self.assertEqual(_meta()['capabilities'][k]['availability'], 'unsupported') + h.register_principal('agent', 'agent') + s = h.session('agent') + r = s.invoke(instance_id=h.instance_id, capability_id='export.dataset', arguments={}, request_id='u1') + self.assertEqual(r['status'], 'unsupported') + self.assertEqual(r['error']['code'], 'UNSUPPORTED') + + +class HostClockAndPurity(unittest.TestCase): + def test_read_and_describe_do_not_advance_time(self): + h = _scenario('acquiring') + h.register_principal('agent', 'agent') + s = h.session('agent') + t, rev, led = h.t, h.revision, h.ledger() + for i in range(3): + h.read('evaluator'); s.read(instance_id=h.instance_id); s.describe(instance_id=h.instance_id) + s.invoke(instance_id=h.instance_id, capability_id='events.read', arguments=dict(since_s=0.0), request_id=f'e{i}') + self.assertEqual((h.t, h.revision), (t, rev)) + self.assertFalse(_changed(h.ledger(), led)) + + def test_step_zero_and_negative(self): + h = ready() + v = h.read('evaluator') + h.step(0.0) + self.assertFalse(_changed(h.read('evaluator'), v)) + for bad in (-1.0, float('nan'), float('inf')): + with self.assertRaises(rt.ActionRejected): + h.step(bad) + self.assertEqual(h.invoke('sim.step', dt_s=2.5)['time_s'], v['clock.time_s'] + 2.5) + + def test_host_step_chopping_does_not_change_the_result(self): + """Power-up and warm-up, an angle change, a Z move, a calibration and a fitted measurement advanced in single host steps and in irregular small + steps give identical records, positions and ledgers (phases, motions and the lamp are cut exactly at events).""" + def run(chunks): + h = configured() + + def adv(T): + if chunks: + t, i = 0.0, 0 + while t < T - 1e-12: + d = min((0.037, 0.211, 0.0043, 0.5, 1.7)[i % 5], T - t) + h.step(d) + t += d + i += 1 + else: + h.step(T) + h.invoke('power.set', enabled=True) + adv(40.0) + h.invoke('aoi.set', position='65') + adv(5.0) + h.invoke('stage.move_z', z_m=MZ - 0.005) + adv(6.0) + h.invoke('sample.place', sample_id='cal_wafer', offset_x_m=0.0, offset_y_m=0.0) + h.invoke('vacuum.set', on=True) + op = h.invoke('calibration.run')['operation_id'] + adv(h.op['duration_s'] + 0.5) + h.invoke('vacuum.set', on=False) + h.invoke('sample.remove', sample_id='cal_wafer') + h.invoke('sample.place', sample_id='pmma_on_si', offset_x_m=0.0, offset_y_m=0.0) + h.invoke('vacuum.set', on=True) + op2 = h.invoke('measure', mode='fast', alignment='standard', fixed_height_m=None, model_id='cauchy_on_si')['operation_id'] + adv(h.op['duration_s'] + 0.5) + self.assertEqual(h.operations[op]['phase'], 'completed') + self.assertEqual(h.operations[op2]['phase'], 'completed') + return h, h.records[h.operations[op]['record_id']], h.records[h.operations[op2]['record_id']] + a, ca, ra = run(False) + b, cb, rb = run(True) + self.assertTrue(_close(ca['calibration'], cb['calibration'])) + self.assertTrue(_close(ra['psi_rad'], rb['psi_rad'], 1e-10)) + self.assertTrue(_close(ra['delta_rad'], rb['delta_rad'], 1e-10)) + self.assertTrue(_close(ra['fit']['parameters'], rb['fit']['parameters'], 1e-6)) + self.assertAlmostEqual(a.z, b.z, places=12) + self.assertAlmostEqual(a.arm_el, b.arm_el, places=12) + for k, v in a.ledger().items(): + self.assertAlmostEqual(v, b.ledger()[k], delta=1e-9 * max(1.0, abs(v)), msg=k) + + def test_reads_do_not_change_later_results(self): + def run(reads): + h = held() + op = h.invoke('measure', mode='standard', alignment='standard', fixed_height_m=None, model_id='cauchy_on_si')['operation_id'] + for i in range(30): + if reads: + h.read('evaluator'); h.invoke('events.read', since_s=0.0); h.invoke('records.list'); h.invoke('ledger.read'); h.invoke('models.list') + h.step(0.7) + rec = wait(h, op) + return rec['psi_rad'], rec['fit']['mse'], h.ledger() + self.assertEqual(run(False), run(True)) + + def test_set_points_only_write_targets(self): + h = _scenario('held') + z0 = h.z + out = h.invoke('stage.move_z', z_m=z0 + 0.004) + self.assertEqual(h.z, z0) + self.assertEqual(h.read()['stage.z_target_m'], z0 + 0.004) + self.assertAlmostEqual(out['duration_s'], 0.004 / rt.STAGE_Z_SPEED_M_S) + h.step(0.5) + self.assertAlmostEqual(h.z, z0 + 0.5 * rt.STAGE_Z_SPEED_M_S, places=12) + self.assertTrue(h.read()['stage.moving']) + settle(h) + e0 = h.arm_el + out = h.invoke('aoi.set', position='75') + self.assertEqual(h.arm_el, e0) + self.assertIsNone(h.read()['aoi.position']) + self.assertTrue(h.read()['aoi.moving']) + self.assertAlmostEqual(out['duration_s'], math.radians(5.0) / rt.ARM_SPEED_RAD_S + 2.0) + h.step(1.0) + self.assertEqual(h.arm_el, e0) # the plunger is pulled first + h.step(0.25) + self.assertAlmostEqual(h.arm_el, e0 - 0.25 * rt.ARM_SPEED_RAD_S, places=12) + settle(h) + self.assertEqual(h.read()['aoi.position'], '75') + self.assertAlmostEqual(h.arm_el, math.radians(15.0), places=12) + h2 = configured() + h2.invoke('power.set', enabled=True) + self.assertEqual(h2.read()['system.state'], 'booting') + h2.step(rt.BOOT_S - 0.01) + self.assertEqual(h2.read()['system.state'], 'booting') + h2.step(0.02) + self.assertEqual(h2.read()['system.state'], 'ready') + + +class PowerLampVacuum(unittest.TestCase): + def test_lamp_warm_up_and_ageing(self): + h = configured() + h.invoke('power.set', enabled=True) + age = 1.0 - rt.LAMP_END_OF_LIFE_LOSS * rt.PLANT_EXAMPLE['lamp_age_s'] / rt.LAMP_RATED_S + self.assertAlmostEqual(h.read('evaluator')['truth.lamp_intensity_rel'], age * (1 - rt.LAMP_WARMUP_DEFICIT), places=12) + h.step(90.0) + age = 1.0 - rt.LAMP_END_OF_LIFE_LOSS * (rt.PLANT_EXAMPLE['lamp_age_s'] + 90.0) / rt.LAMP_RATED_S + self.assertAlmostEqual(h.read('evaluator')['truth.lamp_intensity_rel'], age * (1 - rt.LAMP_WARMUP_DEFICIT * math.exp(-1.0)), places=9) + self.assertFalse(h.read()['lamp.warmed_up']) + h.step(rt.LAMP_WARMUP_TAU_S * math.log(rt.LAMP_WARMUP_DEFICIT / 0.01) - 90.0 + 0.5) + self.assertTrue(h.read()['lamp.warmed_up']) + self.assertAlmostEqual(h.read()['lamp.on_time_s'], rt.PLANT_EXAMPLE['lamp_age_s'] + h.t, places=6) + old = ready(lamp_age_s=3000.0 * 3600.0) + self.assertLess(old.read('evaluator')['truth.lamp_intensity_rel'], h.read('evaluator')['truth.lamp_intensity_rel'] * 0.8) + cold = configured() + cold.invoke('aoi.set', position='90') + settle(cold) + cold.invoke('power.set', enabled=True) + cold.step(20.0) + rec = measure(cold, alignment='none') + self.assertIn('lamp_not_warmed_up', rec['warnings']) + warm = straight_through(ready()) + self.assertNotIn('lamp_not_warmed_up', warm['warnings']) + + def test_power_mains_and_power_loss_during_a_measurement(self): + h = configured(mains_voltage_v=60.0) + rejected(h, 'power.set', 'MAINS_OUT_OF_RANGE', enabled=True) + rejected(h, 'measure', 'POWER_OFF', mode='standard', alignment='none', fixed_height_m=None, model_id=None) + h = held() + rejected(h, 'plant.configure', 'POWER_ON', **rt.PLANT_EXAMPLE) + op = h.invoke('measure', mode='long', alignment='standard', fixed_height_m=None, model_id=None)['operation_id'] + _into(h, 'acquiring', 0.5) + h.invoke('power.set', enabled=False) + rec = h.records[h.operations[op]['record_id']] + self.assertEqual((rec['status'], rec['reason'], rec['psi_rad']), ('failed', 'POWER_OFF', None)) + self.assertFalse(h.read()['lamp.on']) + h.invoke('power.press_button') + self.assertTrue(h.power) + h.invoke('power.press_button') + self.assertFalse(h.power) + + def test_vacuum_holds_only_a_sample_covering_the_holes_with_enough_supply(self): + h = held() + self.assertTrue(h.read('evaluator')['sample.held']) + self.assertAlmostEqual(h.read('evaluator')['vacuum.pressure_pa'], rt.PLANT_EXAMPLE['vacuum_supply_pa']) + rejected(h, 'sample.remove', 'SAMPLE_HELD', sample_id='pmma_on_si') + h.invoke('vacuum.press_switch') + self.assertFalse(h.read('evaluator')['sample.held']) + self.assertAlmostEqual(h.read('evaluator')['vacuum.pressure_pa'], 101325.0) + loose = measure(h) # the vacuum only holds the sample; measuring works without it + self.assertEqual(loose['status'], 'completed') + self.assertIn('sample_not_held', loose['warnings']) + h.invoke('sample.remove', sample_id='pmma_on_si') + h.invoke('sample.provide', **TINY) + h.invoke('sample.place', sample_id='tiny', offset_x_m=0.0015, offset_y_m=0.0) # one hole uncovered + h.invoke('vacuum.set', on=True) + self.assertFalse(h.read('evaluator')['sample.held']) + self.assertGreater(h.read('evaluator')['vacuum.pressure_pa'], 80.0e3) + weak = held(vacuum_supply_pa=90.0e3) + self.assertFalse(weak.read('evaluator')['sample.held']) + self.assertIn('sample_not_held', measure(weak)['warnings']) + op = h.invoke('vacuum.set', on=False) + self.assertEqual(op['on'], False) + + +class MechanicsAndCollision(unittest.TestCase): + def test_angle_positions_arm_elevation_and_plunger(self): + h = ready() + for a in ('65', '75', '90', '70'): + h.invoke('aoi.set', position=a) + rejected(h, 'measure', 'MOTION_IN_PROGRESS', mode='standard', alignment='none', fixed_height_m=None, model_id=None) + settle(h) + self.assertEqual(h.read()['aoi.position'], a) + self.assertAlmostEqual(h.read()['aoi.arm_elevation_rad'], math.radians(90.0 - float(a)), places=12) + self.assertEqual(h.invoke('aoi.set', position='70')['duration_s'], 0.0) # already seated there + self.assertEqual(h.ledger()['aoi_changes'], 4.0) + self.assertAlmostEqual(h.ledger()['arm_travel_rad'], math.radians(5 + 10 + 15 + 20), places=9) + with self.assertRaises(rt.ActionRejected): + h.invoke('aoi.set', position='60') + h.invoke('fault.inject', fault='plunger_not_seated', active=True) + self.assertIsNone(h.read()['aoi.position']) + rejected(h, 'measure', 'AOI_NOT_SEATED', mode='standard', alignment='none', fixed_height_m=None, model_id=None) + h.invoke('aoi.set', position='70') + settle(h) + self.assertIsNone(h.read()['aoi.position']) # still not seated + h.invoke('fault.inject', fault='plunger_not_seated', active=False) + h.invoke('aoi.set', position='70') + settle(h) + self.assertEqual(h.read()['aoi.position'], '70') + + def test_collision_guard_for_large_and_raised_samples(self): + h = ready(samples=(PMMA, CAL, W200)) + rejected(h, 'sample.place', 'COLLISION_RISK', sample_id='wafer_200', offset_x_m=0.0, offset_y_m=0.0) # would run into the Z guide + rejected(h, 'sample.place', 'NOT_ON_PLATFORM', sample_id='pmma_on_si', offset_x_m=0.03, offset_y_m=0.0) # the beam would miss it + out = h.invoke('sample.place', sample_id='wafer_200', offset_x_m=0.0, offset_y_m=-0.052) # overhangs the base front + self.assertTrue(out['covers_vacuum_holes']) + h.invoke('vacuum.set', on=True) + rec = measure(h) + self.assertEqual(rec['status'], 'completed') + rejected(h, 'aoi.set', 'COLLISION_RISK', position='90') # the horizontal arms would hit the wafer at the measuring height + h.invoke('stage.move_z', z_m=rt.STAGE_Z_RANGE_M[0]) + settle(h) + h.invoke('aoi.set', position='90') + settle(h) + rejected(h, 'stage.move_z', 'COLLISION_RISK', z_m=rt.STAGE_Z_RANGE_M[1]) + st = measure(h, alignment='none') + self.assertEqual(st['status'], 'completed') # lowered far enough: the beam passes over the wafer + h2 = ready(samples=(PMMA, CAL, BLOCK)) + h2.invoke('aoi.set', position='90') + settle(h2) + h2.invoke('stage.move_z', z_m=MZ - 0.004) + settle(h2) + h2.invoke('sample.place', sample_id='glass_block', offset_x_m=0.0, offset_y_m=0.0) # 6 mm block reaches into the beam + h2.invoke('vacuum.set', on=True) + rec = measure(h2, alignment='none') + self.assertEqual((rec['status'], rec['reason']), ('failed', 'BEAM_BLOCKED')) + rejected(h2, 'measure', 'ALIGNMENT_NOT_POSSIBLE_STRAIGHT_THROUGH', mode='standard', alignment='standard', fixed_height_m=None, model_id=None) + rejected(h2, 'measure', 'MODE_NOT_AVAILABLE', mode='mm', alignment='none', fixed_height_m=None, model_id=None) + rejected(h2, 'measure', 'NO_SAMPLE_IN_BEAM', mode='standard', alignment='none', fixed_height_m=None, model_id='cauchy_on_si') + + def test_sample_definitions_are_checked(self): + h = configured() + for bad, code in [(dict(PMMA, sample_id='big', size_m=[0.25, 0.25]), 'SAMPLE_SIZE_OUT_OF_RANGE'), + (dict(PMMA, sample_id='small', size_m=[0.004, 0.004]), 'SAMPLE_SIZE_OUT_OF_RANGE'), + (dict(PMMA, sample_id='thick', substrate_thickness_m=0.017), 'SAMPLE_TOO_THICK'), + (dict(PMMA, sample_id='pmma_on_si'), 'DUPLICATE_SAMPLE'), + (dict(PMMA, sample_id='oval', size_m=[0.05, 0.04]), 'INVALID_ARGUMENT')]: + rejected(h, 'sample.provide', code, **bad) + with self.assertRaises(rt.ActionRejected): + h.invoke('sample.provide', **dict(PMMA, sample_id='unobtainium', substrate={'library': 'unobtainium'})) + for i in range(rt.MAX_SAMPLES - 2): + h.invoke('sample.provide', **dict(BARE, sample_id=f's{i}')) + rejected(h, 'sample.provide', 'TOO_MANY_SAMPLES', **dict(BARE, sample_id='one_more')) + + +class OpticsPhysics(unittest.TestCase): + def test_bare_silicon_and_oxide_growth(self): + lam = np.array([632.8]) + N = rt.library_index('si', lam) + self.assertAlmostEqual(N.real[0], rt.substance('si')['at_632_8nm']['n'], places=4) + rp, rs = rt.stack_rps(lam, np.ones(1, complex), [], N, math.radians(70.0)) + psi, delta = rt.psi_delta(*rt.rncs(rp, rs)[1:]) + self.assertAlmostEqual(psi[0], 10.5, delta=0.1) + self.assertGreater(delta[0], 178.5) # Woollam convention: bare Si just below 180 deg at 70 deg + last = delta[0] + for d in (5e-9, 25e-9, 50e-9): + rp, rs = rt.stack_rps(lam, np.ones(1, complex), [(rt.library_index('sio2', lam), d)], N, math.radians(70.0)) + psi, dl = rt.psi_delta(*rt.rncs(rp, rs)[1:]) + self.assertLess(dl[0], last) # Delta falls as the oxide grows + last = dl[0] + self.assertAlmostEqual(last, 91.4, delta=6.0) + + def test_airy_and_abeles_agree_and_conserve_energy(self): + lam = rt.wavelengths_nm() + n1, n2, ns = rt.library_index('tio2', lam), rt.library_index('sio2', lam), rt.library_index('n_bk7', lam).real + 0j + layers = [(n1.real + 0j, 80e-9), (n2.real + 0j, 150e-9)] + th = math.radians(65.0) + rp, rs = rt.stack_rps(lam, np.ones_like(n1), layers, ns, th) + for pol, r in (('p', rp), ('s', rs)): + r2, t2, T = rt._stack_rt(lam, np.ones_like(n1), layers, ns, np.sin(th) * np.ones_like(n1), pol) + self.assertLess(np.max(np.abs(r2 - r)), 1e-12) + self.assertLess(np.max(np.abs(np.abs(r2) ** 2 + T - 1.0)), 1e-12) + q_in, q_out = rt._q(np.ones_like(n1), np.sin(th)), rt._q(ns, np.sin(th)) + eta = (lambda N, q: q) if pol == 's' else (lambda N, q: N * N / q) + self.assertLess(np.max(np.abs(np.abs(t2) ** 2 * np.real(eta(ns, q_out)) / np.real(eta(np.ones_like(n1), q_in)) - T)), 1e-12) + + def test_brewster_angle_of_glass(self): + lam = np.array([632.8]) + n = rt.library_index('n_bk7', lam).real[0] + tb = math.atan(n) + rp, rs = rt.stack_rps(lam, np.ones(1, complex), [], np.array([n + 0j]), tb) + psi, _ = rt.psi_delta(*rt.rncs(rp, rs)[1:]) + self.assertLess(psi[0], 1e-6) + rp2, _ = rt.stack_rps(lam, np.ones(1, complex), [], np.array([n + 0j]), tb + math.radians(1.0)) + self.assertGreater(abs(rp2[0]), 1e-3) + + def test_tauc_lorentz_kramers_kronig_and_bruggeman_limits(self): + from scipy.integrate import quad + p = dict(eps_inf=1.15, Eg=1.2, A=122.0, E0=3.45, C=2.54) + E = np.array([1.5, 2.5, 3.2]) + eps = rt.tauc_lorentz_eps(E, p['eps_inf'], p['Eg'], p['A'], p['E0'], p['C']) + + def e2(x): + return p['A'] * p['E0'] * p['C'] * (x - p['Eg']) ** 2 / ((x * x - p['E0'] ** 2) ** 2 + p['C'] ** 2 * x * x) / x if x > p['Eg'] else 0.0 + for Ei, ei in zip(E, eps): + pv = quad(lambda x: x * e2(x) / (x + Ei), p['Eg'], 2000.0, weight='cauchy', wvar=Ei, limit=400)[0] + self.assertAlmostEqual(ei.real, p['eps_inf'] + 2 / math.pi * pv, delta=2e-3 * abs(ei.real)) + self.assertAlmostEqual(ei.imag, e2(Ei), places=12) + ea, eb = np.array([2.1 + 0.0j]), np.array([12.0 + 1.0j]) + self.assertAlmostEqual(rt.bruggeman(ea, eb, 0.0)[0], ea[0]) + self.assertAlmostEqual(rt.bruggeman(ea, eb, 1.0)[0], eb[0]) + self.assertAlmostEqual(rt.bruggeman(ea, eb, 0.3)[0], rt.bruggeman(eb, ea, 0.7)[0]) + + def test_pseudo_dielectric_inversion_is_exact_for_a_bare_substrate(self): + lam = rt.wavelengths_nm() + for amb in ('air', 'water'): + N0 = np.ones(lam.shape, complex) if amb == 'air' else rt.library_index('water', lam) + N = rt.library_index('gaas', lam) + rp, rs = rt.stack_rps(lam, N0, [], N, math.radians(70.0)) + psi, delta = rt.psi_delta(*rt.rncs(rp, rs)[1:]) + ps = rt.pseudo_constants(dict(record_id='x', wavelengths_m=list(lam * 1e-9), aoi_rad=math.radians(70.0), ambient=amb, psi_rad=list(np.radians(psi)), + delta_rad=list(np.radians(delta)))) + self.assertLess(np.max(np.abs(np.array(ps['n']) + 1j * np.array(ps['k']) - N)), 1e-9, amb) + + def test_depolarization_from_non_uniformity_and_backside_beams(self): + lam = rt.wavelengths_nm() + base = dict(PMMA, layers=[dict(material={'library': 'pmma'}, thickness_m=1.0e-6)]) + uni = rt.sample_mueller(base, lam, math.radians(70.0)) + non = rt.sample_mueller(dict(base, layers=[dict(material={'library': 'pmma'}, thickness_m=1.0e-6, nonuniformity=0.02)]), lam, math.radians(70.0)) + self.assertGreater(float(np.mean(non['depol'])), 5 * float(np.mean(uni['depol']))) + rough = rt.sample_mueller(dict(SLIDE, backside='rough'), lam, math.radians(70.0)) + pol = rt.sample_mueller(SLIDE, lam, math.radians(70.0)) + self.assertGreater(float(np.mean(pol['R'])), float(np.mean(rough['R']))) # the back face adds light + self.assertGreater(float(np.mean(pol['depol'])), float(np.mean(rough['depol'])) + 0.01) + + +class InstrumentAccuracy(unittest.TestCase): + def test_straight_through_meets_the_accuracy_specification(self): + """Specification: straight-through empty beam Psi = 45 +- 0.1 deg and Delta = 0 +- 0.2 deg (98 % of the wavelengths, 10 s).""" + for seed in (1, 2, 3, 4): + rec = straight_through(ready(seed)) + dp = np.abs(np.degrees(rec['psi_rad']) - 45.0) + dd = np.abs((np.degrees(rec['delta_rad']) + 180.0) % 360.0 - 180.0) + frac = float(np.mean((dp <= rt.ACCURACY_PSI_DEG) & (dd <= rt.ACCURACY_DELTA_DEG))) + CHECKS.append(dict(check='straight_through_accuracy', seed=seed, fraction_within=frac, psi_p98=float(np.percentile(dp, 98)), + delta_p98=float(np.percentile(dd, 98)))) + self.assertGreaterEqual(frac, 0.98, seed) + + def test_repeatability_of_2nm_oxide_and_mode_times(self): + """Specification: 30 repeated 10 s measurements of 2 nm SiO2 on Si at 70 deg, thickness 1 sigma 0.01 nm; the noise falls with the mode time.""" + sd = {} + for mode in ('fast', 'standard', 'long'): + h = held(OX2, offset=(0.0, -0.02)) + th = [] + for i in range(30): + rec = measure(h, mode=mode, alignment='standard' if i == 0 else 'none', model_id='si_native_oxide') + th.append(rec['fit']['parameters']['oxide.thickness_m']['value']) + sd[mode] = float(np.std(th, ddof=1)) + self.assertAlmostEqual(float(np.mean(th)), 2e-9, delta=0.05e-9) + self.assertAlmostEqual(rec['finished_s'] - rec['started_s'], rt.ALIGN_TIME_S['none'] + rt.MODE_TIME_S[mode] + rt.FIT_TIME_S, places=6) + CHECKS.append(dict(check='repeatability_2nm_sio2', sigma_m=sd)) + self.assertLessEqual(sd['standard'], rt.REPEATABILITY_2NM_SIO2_M) + self.assertGreater(sd['fast'], sd['standard']) + self.assertGreater(sd['standard'], sd['long']) + + def test_calibration_recovers_the_hidden_instrument_errors(self): + h = held(CAL, calibration='nominal') + rec0 = measure(h, model_id='si_native_oxide') + self.assertIn('instrument_not_calibrated', rec0['warnings']) + op = h.invoke('calibration.run')['operation_id'] + rec = wait(h, op) + c, tr = h.cal, h.truth + self.assertEqual(c['status'], 'calibrated') + self.assertLess(abs(math.degrees(c['aoi_rad']['70']) - tr['aoi_deg'][70.0]), 0.01) + self.assertLess(abs(math.degrees(c['polarizer_offset_rad'] - tr['P_offset'])), 0.05) + self.assertLess(abs(math.degrees(c['analyzer_rad'] - tr['A'])), 0.05) + self.assertAlmostEqual(rec['calibration']['reference_thickness_m'], 25e-9, delta=0.1e-9) + self.assertEqual(c['aoi_rad']['65'], math.radians(65.0)) # only the calibrated position changes + CHECKS.append(dict(check='calibration', aoi_error_rad=c['aoi_rad']['70'] - math.radians(tr['aoi_deg'][70.0]), + nominal_aoi_error_rad=math.radians(70.0 - tr['aoi_deg'][70.0]))) + rec1 = measure(h, model_id='si_native_oxide') + self.assertNotIn('instrument_not_calibrated', rec1['warnings']) + self.assertLess(rec1['fit']['mse'], rec0['fit']['mse']) + rejected(h, 'records.delete', 'UNKNOWN_RECORD', record_id='XX0001') + h.invoke('vacuum.set', on=False) + h.invoke('sample.remove', sample_id='cal_wafer') + h.invoke('sample.place', sample_id='pmma_on_si', offset_x_m=0.0, offset_y_m=0.0) + h.invoke('vacuum.set', on=True) + rejected(h, 'calibration.run', 'CALIBRATION_WAFER_REQUIRED') + + def test_reflectance_follows_the_straight_through_baseline(self): + h = ready(samples=(PMMA, CAL, BARE)) + straight_through(h) + self.assertTrue(h.read()['calibration.baseline']['valid']) + h.invoke('aoi.set', position='70') + settle(h) + h.invoke('sample.place', sample_id='bare_si', offset_x_m=0.0, offset_y_m=0.0) + h.invoke('vacuum.set', on=True) + rec = measure(h) + truth = rt.sample_mueller(BARE, rt.wavelengths_nm(), math.radians(h.truth['aoi_deg'][70.0]))['R'] + rel = np.abs(np.array(rec['reflectance']) / truth - 1.0) + self.assertLess(float(np.median(rel)), 0.01) + fresh = held(BARE, samples=(PMMA, CAL, BARE)) + self.assertIsNone(measure(fresh)['reflectance']) # no baseline yet + + def test_mueller_matrix_of_an_isotropic_sample(self): + h = held() + se = measure(h) + mm = measure(h, mode='mm') + M = {k: np.array(v) for k, v in mm['mueller'].items()} + for k in ('m13', 'm23', 'm31', 'm32', 'm41', 'm42'): + self.assertLess(float(np.max(np.abs(M[k]))), 0.01, k) + self.assertLess(float(np.max(np.abs(M['m12'] - M['m21']))), 0.01) + self.assertLess(float(np.max(np.abs(M['m22'] - 1.0))), 0.01) + for a, b in ((mm['N'], se['N']), (mm['C'], se['C']), (mm['S'], se['S'])): + self.assertLess(float(np.max(np.abs(np.array(a) - np.array(b)))), 0.01) + self.assertAlmostEqual(mm['finished_s'] - mm['started_s'], rt.ALIGN_TIME_S['standard'] + rt.MODE_TIME_S['mm'], delta=0.5) + + +class AlignmentAndHeight(unittest.TestCase): + def test_alignment_modes(self): + h = held() + rec = measure(h, alignment='none') # the stage is still at its reference height + self.assertEqual((rec['status'], rec['reason']), ('failed', 'NO_SIGNAL')) + rec = measure(h, alignment='standard') + self.assertEqual(rec['status'], 'completed') + z_ok = rec['stage_z_m'] + self.assertAlmostEqual(z_ok + rt.sample_height_m(PMMA), MZ, delta=15e-6) + self.assertEqual(h.read()['stage.last_aligned_z_m'], z_ok) + rec = measure(h, alignment='fixed_height', fixed_height_m=MZ - rt.sample_height_m(PMMA) - 50e-6) + self.assertEqual(rec['status'], 'completed') + self.assertIn('height_offset_um:-50', rec['warnings']) + rec = measure(h, alignment='fixed_height', fixed_height_m=MZ - rt.sample_height_m(PMMA) - 1.5e-3) + self.assertEqual((rec['status'], rec['reason']), ('failed', 'NO_SIGNAL')) + rejected(h, 'measure', 'INVALID_ARGUMENT', mode='standard', alignment='standard', fixed_height_m=MZ - 0.001, model_id=None) + h.invoke('vacuum.set', on=False) + h.invoke('sample.remove', sample_id='pmma_on_si') + h.invoke('sample.provide', **BLOCK) + h.invoke('sample.place', sample_id='glass_block', offset_x_m=0.0, offset_y_m=0.0) + h.invoke('vacuum.set', on=True) + rec = measure(h, alignment='standard') # 5.7 mm higher than the last aligned height + self.assertEqual((rec['status'], rec['reason']), ('failed', 'ALIGNMENT_FAILED')) + rec = measure(h, alignment='robust') + self.assertEqual(rec['status'], 'completed') + self.assertAlmostEqual(rec['stage_z_m'] + 0.006, MZ, delta=15e-6) + + def test_too_little_reflected_light_fails_the_alignment(self): + h = ready(samples=(PMMA, CAL, MGF2)) + h.invoke('liquid_cell.install', sample_id='mgf2_plate') + h.invoke('liquid_cell.fill', liquid_id='ethanol', volume_m3=480e-9) # index-matched: almost no reflection + h.invoke('vacuum.set', on=True) + rec = measure(h, alignment='robust') + self.assertEqual((rec['status'], rec['reason']), ('failed', 'ALIGNMENT_FAILED')) + + +class LiquidCell(unittest.TestCase): + def test_cell_rules_volumes_and_a_fit_in_water(self): + h = ready() + h.invoke('aoi.set', position='65') + settle(h) + rejected(h, 'liquid_cell.install', 'AOI_NOT_70', sample_id='pmma_on_si') + h.invoke('aoi.set', position='70') + settle(h) + rejected(h, 'liquid_cell.fill', 'NO_LIQUID_CELL', liquid_id='water', volume_m3=100e-9) + h.invoke('liquid_cell.install', sample_id='pmma_on_si') + rejected(h, 'aoi.set', 'LIQUID_CELL_INSTALLED', position='75') + rejected(h, 'sample.place', 'SAMPLE_NOT_ON_BENCH', sample_id='pmma_on_si', offset_x_m=0.0, offset_y_m=0.0) + rejected(h, 'sample.place', 'STAGE_OCCUPIED', sample_id='cal_wafer', offset_x_m=0.0, offset_y_m=0.0) + h.invoke('vacuum.set', on=True) + air = measure(h) + self.assertEqual((air['status'], air['ambient']), ('completed', 'air')) + h.invoke('liquid_cell.fill', liquid_id='water', volume_m3=300e-9) + rejected(h, 'measure', 'LIQUID_LEVEL_LOW', mode='standard', alignment='standard', fixed_height_m=None, model_id=None) + rejected(h, 'liquid_cell.fill', 'CELL_OVERFLOW', liquid_id='water', volume_m3=250e-9) + rejected(h, 'liquid_cell.fill', 'DIFFERENT_LIQUID', liquid_id='ethanol', volume_m3=10e-9) + h.invoke('liquid_cell.fill', liquid_id='water', volume_m3=150e-9) + wet = measure(h) + self.assertEqual((wet['status'], wet['ambient']), ('completed', 'water')) + self.assertGreater(float(np.max(np.abs(np.array(wet['psi_rad']) - np.array(air['psi_rad'])))), math.radians(2.0)) + fa = h.invoke('analysis.fit', **dict(FIT, record_ids=[air['record_id']])) + fw = h.invoke('analysis.fit', **dict(FIT, record_ids=[wet['record_id']])) + self.assertAlmostEqual(fw['parameters']['film.thickness_m']['value'], fa['parameters']['film.thickness_m']['value'], delta=1.0e-9) + self.assertLess(fw['mse'], 5.0) + rejected(h, 'liquid_cell.remove', 'CELL_NOT_EMPTY') + self.assertEqual(h.invoke('liquid_cell.drain')['drained_m3'], 450e-9) + led = h.ledger() + self.assertAlmostEqual(led['liquid_added_m3'], led['liquid_drained_m3'] + led['liquid_in_cell_m3'], places=18) + self.assertEqual(led['liquid_residual_m3'], 0.0) + h.invoke('vacuum.set', on=False) + self.assertEqual(h.invoke('liquid_cell.remove')['sample_id'], 'pmma_on_si') + self.assertIn('pmma_on_si', h.read()['sample.bench_ids']) + h2 = ready(samples=(PMMA, CAL, W200)) + rejected(h2, 'liquid_cell.install', 'SAMPLE_DOES_NOT_FIT_CELL', sample_id='wafer_200') + + +class Analysis(unittest.TestCase): + def test_fit_confidence_limits_and_nk(self): + h = _scenario('measured') + f = h.records['SE0001']['fit'] + p = f['parameters'] + self.assertAlmostEqual(p['film.thickness_m']['value'], 121.8e-9, delta=0.6e-9) # 120 nm PMMA + 1.8 nm oxide as one layer + self.assertAlmostEqual(f['nk_632_8nm']['film']['n'], rt.substance('pmma')['at_632_8nm']['n'], delta=0.01) + self.assertLess(f['mse'], 5.0) + self.assertTrue(f['converged']) + for k in f['fitted_parameters']: + self.assertGreater(p[k]['ci90'], 0.0) + C = np.array(f['correlation']) + self.assertTrue(np.allclose(C, C.T)) + self.assertTrue(np.allclose(np.diag(C), 1.0)) + self.assertEqual(h.read()['result.last_thickness_m'], p['film.thickness_m']['value']) + self.assertEqual(h.read()['result.last_mse'], f['mse']) + + def test_thickness_prefit_finds_the_global_minimum(self): + h = _scenario('measured') + far = dict(FIT, parameters={'film.thickness_m': 700e-9}) + good = h.invoke('analysis.fit', **far) + bad = h.invoke('analysis.fit', **dict(far, thickness_prefit=False)) + self.assertAlmostEqual(good['parameters']['film.thickness_m']['value'], 121.8e-9, delta=0.6e-9) + self.assertGreater(bad['mse'], 10 * good['mse']) + self.assertIsNotNone(h.records[good['record_id']]['fit']['prefit']) + self.assertIsNone(h.records[bad['record_id']]['fit']['prefit']) + + def test_multi_angle_fit_and_uniqueness(self): + h = held() + rids = [] + for a in ('65', '70', '75'): + h.invoke('aoi.set', position=a) + settle(h) + rids.append(measure(h)['record_id']) + one = h.invoke('analysis.fit', **dict(FIT, record_ids=[rids[1]], fit=FIT['fit'] + ['film.C'])) + three = h.invoke('analysis.fit', **dict(FIT, record_ids=rids, fit=FIT['fit'] + ['film.C'])) + self.assertAlmostEqual(three['parameters']['film.thickness_m']['value'], one['parameters']['film.thickness_m']['value'], delta=1.0e-9) + self.assertLess(three['parameters']['film.thickness_m']['ci90'], one['parameters']['film.thickness_m']['ci90']) + self.assertEqual(len(h.records[three['record_id']]['model_curves']), 3) + u = h.invoke('analysis.uniqueness', record_ids=[rids[1]], model_id='cauchy_on_si', parameters={}, fit=['film.A', 'film.B'], + scan_parameter='film.thickness_m', values=list(np.linspace(80e-9, 160e-9, 17))) + self.assertAlmostEqual(u['best_value'], 120e-9, delta=5.1e-9) + self.assertEqual(len(u['local_minima']), 1) + self.assertLess(min(u['mse']) * 5, max(u['mse'])) + + def test_library_tauc_lorentz_and_pseudo_models(self): + asi = dict(PMMA, sample_id='asi_on_oxide', layers=[dict(material={'library': 'a_si'}, thickness_m=30e-9), dict(material={'library': 'sio2'}, thickness_m=100e-9)]) + gold = dict(BARE, sample_id='gold', substrate={'library': 'au'}) + h = held(asi, samples=(PMMA, CAL, gold)) + rec = measure(h, alignment='robust') + out = h.invoke('analysis.fit', record_ids=[rec['record_id']], model_id='tauc_lorentz_on_si', + parameters={'interface.thickness_m': 100e-9, 'film.thickness_m': 25e-9, 'film.eps_inf': 1.15, 'film.Eg_ev': 1.2, 'film.A_ev': 122.0, + 'film.E0_ev': 3.45, 'film.C_ev': 2.54}, fit=['film.thickness_m', 'film.A_ev', 'film.E0_ev', 'film.C_ev', 'film.Eg_ev'], thickness_prefit=False) + self.assertAlmostEqual(out['parameters']['film.thickness_m']['value'], 30e-9, delta=0.5e-9) + self.assertAlmostEqual(out['nk_632_8nm']['film']['n'], rt.substance('a_si')['at_632_8nm']['n'], delta=0.05) + self.assertLess(out['mse'], 5.0) + h.invoke('vacuum.set', on=False) + h.invoke('sample.remove', sample_id='asi_on_oxide') + h.invoke('sample.place', sample_id='gold', offset_x_m=0.0, offset_y_m=0.0) + h.invoke('vacuum.set', on=True) + rec = measure(h, alignment='robust') + lib = h.invoke('analysis.fit', record_ids=[rec['record_id']], model_id='library_bulk:au', parameters={}, fit=['rough.thickness_m'], thickness_prefit=False) + self.assertLess(lib['mse'], 5.0) + ps = h.invoke('data.pseudo', record_id=rec['record_id']) + i = int(np.argmin(np.abs(np.array(ps['wavelengths_m']) - 632.8e-9))) + nk = rt.library_index('au', [ps['wavelengths_m'][i] * 1e9])[0] + self.assertAlmostEqual(ps['n'][i], nk.real, delta=0.02) + self.assertAlmostEqual(ps['k'][i], nk.imag, delta=0.05) + dl = h.invoke('analysis.fit', record_ids=[rec['record_id']], model_id='drude_lorentz_bulk', parameters={}, fit=['substrate.Ep_ev', 'substrate.gamma_ev', + 'substrate.osc_A', 'substrate.osc_E0_ev', 'substrate.osc_B_ev', 'substrate.eps_inf'], thickness_prefit=False) + self.assertLess(dl['mse'], 50.0) + self.assertAlmostEqual(dl['nk_632_8nm']['substrate']['k'], rt.substance('au')['at_632_8nm']['k'], delta=0.2) + for bad, code in [(dict(FIT, record_ids=[rec['record_id']], model_id='nope'), 'UNKNOWN_MODEL'), + (dict(FIT, record_ids=[rec['record_id']], parameters={'film.X': 1.0}), 'INVALID_ARGUMENT'), # not a parameter name + (dict(FIT, record_ids=[rec['record_id']], parameters={'film.Eg_ev': 3.0}), 'UNKNOWN_PARAMETER'), # not of this model + (dict(FIT, record_ids=[rec['record_id']], parameters={'film.A': 9.0}), 'PARAMETER_OUT_OF_RANGE'), + (dict(FIT, record_ids=[rec['record_id']], fit=['film.band_edge_ev']), 'PARAMETER_NOT_FITTABLE'), + (dict(FIT, record_ids=['XX0001']), 'UNKNOWN_RECORD'), + (dict(FIT, record_ids=[rec['record_id'], rec['record_id']]), 'INVALID_ARGUMENT')]: + rejected(h, 'analysis.fit', code, **bad) + + def test_backside_correction_of_a_polished_glass_slide(self): + h = held(SLIDE) + rec = measure(h, alignment='robust') + with_back = h.invoke('analysis.fit', record_ids=[rec['record_id']], model_id='library_film:tio2@soda_lime', + parameters={'substrate.backside_polished': 1.0, 'substrate.thickness_m': 0.001}, fit=['film.thickness_m', 'rough.thickness_m'], + thickness_prefit=True) + without = h.invoke('analysis.fit', record_ids=[rec['record_id']], model_id='library_film:tio2@soda_lime', parameters={}, + fit=['film.thickness_m', 'rough.thickness_m'], thickness_prefit=True) + self.assertAlmostEqual(with_back['parameters']['film.thickness_m']['value'], 80e-9, delta=1e-9) + self.assertLess(with_back['mse'] * 5, without['mse']) + self.assertGreater(max(rec['depolarization']), 0.02) + + +class FaultsCancelAndData(unittest.TestCase): + def test_lamp_failure_stage_stall_and_vacuum_leak(self): + h = held() + op = h.invoke('measure', mode='long', alignment='standard', fixed_height_m=None, model_id=None)['operation_id'] + _into(h, 'acquiring', 0.3) + h.invoke('fault.inject', fault='lamp_failure', active=True) + rec = h.records[h.operations[op]['record_id']] + self.assertEqual((rec['status'], rec['reason']), ('failed', 'LAMP_FAILURE')) + self.assertEqual(h.read()['system.error_code'], 'LAMP_FAILURE') + self.assertFalse(h.read()['lamp.on']) + rejected(h, 'system.acknowledge', 'CAUSE_PERSISTS') + rejected(h, 'measure', 'ERROR_PENDING', mode='standard', alignment='standard', fixed_height_m=None, model_id=None) + h.invoke('fault.inject', fault='lamp_failure', active=False) + self.assertEqual(h.invoke('system.acknowledge')['cleared'], 'LAMP_FAILURE') + self.assertFalse(h.read()['lamp.warmed_up']) # the new lamp warms up again + h.step(600.0) + z0 = h.z + h.invoke('stage.move_z', z_m=rt.STAGE_Z_RANGE_M[0]) + rejected(h, 'measure', 'MOTION_IN_PROGRESS', mode='standard', alignment='standard', fixed_height_m=None, model_id=None) + settle(h) + op = h.invoke('measure', mode='standard', alignment='standard', fixed_height_m=None, model_id=None)['operation_id'] + _into(h, 'aligning', 0.2) + zmid = h.z + h.invoke('fault.inject', fault='stage_stall', active=True) + rec = h.records[h.operations[op]['record_id']] + self.assertEqual((rec['status'], rec['reason']), ('failed', 'STAGE_FAULT')) + h.step(5.0) + self.assertEqual(h.z, zmid) # stopped where it was + self.assertNotEqual(zmid, z0) + rejected(h, 'stage.move_z', 'ERROR_PENDING', z_m=MZ - 0.001) + h.invoke('fault.inject', fault='stage_stall', active=False) + h.invoke('system.acknowledge') + op = h.invoke('measure', mode='long', alignment='standard', fixed_height_m=None, model_id=None)['operation_id'] + _into(h, 'acquiring', 0.5) + h.invoke('fault.inject', fault='vacuum_leak', active=True) + self.assertFalse(h.read('evaluator')['sample.held']) + rec = wait(h, op) # the loose sample is still measured (warning) + self.assertEqual(rec['status'], 'completed') + self.assertIn('vacuum_lost', rec['warnings']) + self.assertIn('sample_not_held', rec['warnings']) + + def test_cancel_keeps_the_height_and_writes_no_data(self): + h = held() + h.register_principal('agent', 'agent') + s = h.session('agent') + r = s.invoke(instance_id=h.instance_id, capability_id='measure', arguments=dict(mode='long', alignment='robust', fixed_height_m=None, model_id=None), + request_id='m1') + op = r['operation_id'] + _into(h, 'aligning', 0.5) + z = h.z + out = s.cancel(op, 'c1') + self.assertEqual(out['result']['phase'], 'cancelled') + rec = h.records[h.operations[op]['record_id']] + self.assertEqual((rec['status'], rec['psi_rad']), ('cancelled', None)) + h.step(10.0) + self.assertEqual(h.z, z) + self.assertEqual(s.cancel(op, 'c1'), out) # idempotent + with self.assertRaises(rt.ActionRejected): + s.cancel(op, 'c2') + self.assertIsNone(h.read()['measurement.id']) + + def test_records_delete_and_full(self): + h = _scenario('measured') + rejected(h, 'records.delete', 'UNKNOWN_RECORD', record_id='SE0099') + for i in range(rt.MAX_RECORDS - len(h.records)): + h.invoke('analysis.fit', **dict(FIT, thickness_prefit=False)) + rejected(h, 'analysis.fit', 'RECORDS_FULL', **dict(FIT, thickness_prefit=False)) + rejected(h, 'measure', 'RECORDS_FULL', mode='fast', alignment='none', fixed_height_m=None, model_id=None) + self.assertEqual(h.invoke('records.delete', record_id='FT0001')['remaining'], rt.MAX_RECORDS - 1) + rejected(h, 'measurement.result', 'UNKNOWN_RECORD', record_id='FT0001') + h2 = _scenario('acquiring') + rejected(h2, 'records.delete', 'RECORD_IN_USE', record_id=h2.op['record_id']) + rejected(h2, 'analysis.fit', 'RECORD_NOT_SUITABLE', **dict(FIT, record_ids=[h2.op['record_id']])) + + +class LedgersIsolationSessions(unittest.TestCase): + def test_energy_and_travel_ledgers_close(self): + h = configured() + h.invoke('power.set', enabled=True) + h.step(100.0) + h.invoke('stage.move_z', z_m=MZ - 0.002) + h.step(20.0) + h.invoke('aoi.set', position='65') + h.step(10.0) + led = h.ledger() + self.assertAlmostEqual(led['electrical_energy_j'], (rt.LAMP_POWER_W + rt.ELECTRONICS_POWER_W) * 130.0, places=6) + self.assertAlmostEqual(led['lamp_on_s'], 130.0, places=9) + self.assertAlmostEqual(led['stage_travel_m'], abs(MZ - 0.002 - rt.STAGE_Z_REF_M), places=12) + self.assertAlmostEqual(led['arm_travel_rad'], math.radians(5.0), places=12) + h.invoke('power.set', enabled=False) + h.step(50.0) + self.assertAlmostEqual(h.ledger()['electrical_energy_j'], led['electrical_energy_j'], places=9) + + def test_two_instances_are_isolated(self): + a, b = held(), held(seed=2) + ra = measure(a) + self.assertEqual(b.records, {}) + self.assertIsNone(b.read()['result.last_record_id']) + self.assertNotEqual(a.truth['aoi_deg'], b.truth['aoi_deg']) + self.assertEqual(ra['record_id'], 'SE0001') + + def test_agent_does_not_see_truth_faults_or_templates(self): + h = held() + h.register_principal('agent', 'agent') + h.register_principal('eval', 'evaluator') + s, e = h.session('agent'), h.session('eval') + obs = s.read(instance_id=h.instance_id)['observations'] + self.assertFalse([k for k in obs if k.startswith('truth.')]) + self.assertIn('truth.aoi_rad', e.read(instance_id=h.instance_id)['observations']) + for k in ('truth.samples', 'truth.instrument'): + with self.assertRaises(rt.ActionRejected): + s.read(instance_id=h.instance_id, state_ids=[k]) + d = s.describe(instance_id=h.instance_id) + self.assertNotIn('fault.inject', d['capabilities']) + self.assertNotIn('truth.samples', d['state_slots']) + r = s.invoke(instance_id=h.instance_id, capability_id='fault.inject', arguments=dict(fault='vacuum_leak', active=True), request_id='f1') + self.assertEqual(r['error']['code'], 'ACCESS_DENIED') + e.invoke(instance_id=h.instance_id, capability_id='fault.inject', arguments=dict(fault='plunger_not_seated', active=True), request_id='f2') + ev = s.invoke(instance_id=h.instance_id, capability_id='events.read', arguments=dict(since_s=0.0), request_id='e1')['result']['events'] + self.assertFalse([x for x in ev if x['kind'] == 'fault']) + e.invoke(instance_id=h.instance_id, capability_id='fault.inject', arguments=dict(fault='plunger_not_seated', active=False), request_id='f3') + h.invoke('aoi.set', position='70') + settle(h) + r = s.invoke(instance_id=h.instance_id, capability_id='measure', arguments=dict(mode='fast', alignment='standard', fixed_height_m=None, model_id=None), + request_id='m1') + rec = wait(h, r['operation_id']) + res = s.invoke(instance_id=h.instance_id, capability_id='measurement.result', arguments=dict(record_id=rec['record_id']), request_id='r1')['result'] + self.assertEqual(res['template_source']['substances'], []) + self.assertNotIn('_counts', res) + full = e.invoke(instance_id=h.instance_id, capability_id='measurement.result', arguments=dict(record_id=rec['record_id']), request_id='r2')['result'] + self.assertEqual(full['template_source']['substances'], ['pmma', 'si', 'sio2']) + self.assertEqual(s.poll(r['operation_id'])['result']['template_source']['substances'], []) + + def test_records_and_control_belong_to_their_agent(self): + h = held() + for n in ('a1', 'a2'): + h.register_principal(n, 'agent') + a1, a2 = h.session('a1'), h.session('a2') + iid = h.instance_id + r = a1.invoke(instance_id=iid, capability_id='measure', arguments=dict(mode='standard', alignment='standard', fixed_height_m=None, model_id=None), + request_id='m1') + op = r['operation_id'] + o2 = a2.read(instance_id=iid)['observations'] + self.assertTrue(o2['measurement.started_by_other_agent']['value']) + self.assertIsNone(o2['measurement.id']['value']) + for cap, args in [('stage.move_z', dict(z_m=MZ - 0.01)), ('vacuum.set', dict(on=False)), ('aoi.set', dict(position='65'))]: + self.assertEqual(a2.invoke(instance_id=iid, capability_id=cap, arguments=args, request_id='x' + cap)['error']['code'], 'ACCESS_DENIED') + with self.assertRaises(rt.ActionRejected): + a2.poll(op) + with self.assertRaises(rt.ActionRejected): + a2.cancel(op, 'c1') + rec = wait(h, op) + rid = rec['record_id'] + self.assertEqual(a2.invoke(instance_id=iid, capability_id='measurement.result', arguments=dict(record_id=rid), request_id='r1')['error']['code'], 'ACCESS_DENIED') + self.assertEqual(a2.invoke(instance_id=iid, capability_id='records.list', arguments={}, request_id='l1')['result']['records'], []) + self.assertIsNone(a2.read(instance_id=iid)['observations']['result.last_record_id']['value']) + self.assertEqual(a2.invoke(instance_id=iid, capability_id='analysis.fit', arguments=dict(FIT, record_ids=[rid]), request_id='f1')['error']['code'], 'ACCESS_DENIED') + self.assertEqual(a2.invoke(instance_id=iid, capability_id='records.delete', arguments=dict(record_id=rid), request_id='d1')['error']['code'], 'ACCESS_DENIED') + f = a1.invoke(instance_id=iid, capability_id='analysis.fit', arguments=dict(FIT, record_ids=[rid]), request_id='f2') + self.assertEqual(f['status'], 'succeeded') + o2 = a2.read(instance_id=iid)['observations'] + self.assertIsNone(o2['result.last_thickness_m']['value']) + self.assertIsNotNone(a1.read(instance_id=iid)['observations']['result.last_thickness_m']['value']) + again = a1.invoke(instance_id=iid, capability_id='analysis.fit', arguments=dict(FIT, record_ids=[rid]), request_id='f2') + self.assertEqual(again, f) # idempotent replay + conflict = a1.invoke(instance_id=iid, capability_id='records.list', arguments={}, request_id='f2') + self.assertEqual(conflict['error']['code'], 'REQUEST_CONFLICT') + self.assertEqual(a1.invoke(instance_id=iid, capability_id='records.delete', arguments=dict(record_id=rid), request_id='d2')['status'], 'succeeded') + with self.assertRaises(rt.ActionRejected): + a1.write(instance_id=iid, state_id='stage.z_m', value=0.1, request_id='w1') + self.assertEqual(a1.invoke(instance_id='other', capability_id='records.list', arguments={}, request_id='z1')['error']['code'], 'UNKNOWN_INSTANCE') + + def test_queries_and_bookkeeping(self): + h = _scenario('measured') + self.assertEqual(h.invoke('records.list')['records'], ['SE0001']) + ev = h.invoke('events.read', since_s=0.0)['events'] + self.assertIn('MEASURE_DONE', [e['code'] for e in ev]) + prov = h.invoke('provenance.read') + self.assertEqual(prov['substances'], 84) + self.assertIn('CC0', prov['license']) + models = h.invoke('models.list')['models'] + self.assertIn('cauchy_on_si', models) + self.assertIn('library_film:{film}@{substrate}', models) + self.assertEqual(len(rt.library()['subs']), 84) + for s in rt.library()['subs'].values(): + self.assertEqual(len(s['n']), len(rt.library()['grid'])) + self.assertTrue(s['sources'], s['substance_id']) + + +def _dense_nonuniform(d, nu, lam, theta): + z = np.linspace(-7, 7, 6001) + w = np.exp(-0.5 * z * z) + w /= w.sum() + tot = (0.0, 0.0, 0.0, 0.0) + Nf, Ns = rt.library_index('pmma', lam), rt.library_index('si', lam) + for zi, wi in zip(z, w): + rp, rs = rt.stack_rps(lam, np.ones(lam.shape, complex), [(Nf, d * (1 + nu * zi))], Ns, theta) + tot = rt._add(tot, rt._pair(rp, rs), wi) + return rt.normalised(tot) + + +def _pmma_film(d, nu=0.0): + return dict(sample_id='film', kind='film_stack', shape='disc', size_m=[0.05, 0.05], substrate_thickness_m=0.0005, substrate={'library': 'si'}, + layers=[dict(material={'library': 'pmma'}, thickness_m=d, nonuniformity=nu)], roughness_m=0.0, backside='rough') + + +class RuntimeReviewRound1Regressions(unittest.TestCase): + def test_F01_no_z_move_during_an_angle_change(self): + h = ready(samples=(PMMA, CAL, W200)) + h.invoke('stage.move_z', z_m=rt.STAGE_Z_RANGE_M[0]) + settle(h) + h.invoke('sample.place', sample_id='wafer_200', offset_x_m=0.0, offset_y_m=-0.052) + h.invoke('aoi.set', position='90') + h.step(0.2) + rejected(h, 'stage.move_z', 'MOTION_IN_PROGRESS', z_m=rt.STAGE_Z_RANGE_M[1]) + settle(h) + rejected(h, 'stage.move_z', 'COLLISION_RISK', z_m=rt.STAGE_Z_RANGE_M[1]) # the horizontal arms over the wafer + + def test_F02_F03_non_reflecting_samples_give_no_nan_and_never_break_the_clock(self): + matched = dict(BARE, sample_id='matched', substrate={'cauchy': dict(A=1.0, B=0.0)}) + h = held(matched, samples=(PMMA, CAL, matched)) + op = h.invoke('measure', mode='standard', alignment='fixed_height', fixed_height_m=MZ - matched['substrate_thickness_m'], + model_id='cauchy_on_si')['operation_id'] + rec = wait(h, op) + self.assertEqual((rec['status'], rec['reason'], rec['psi_rad']), ('failed', 'NO_SIGNAL', None)) + self.assertEqual(json.loads(json.dumps(h._out(rec), allow_nan=False))['record_id'], rec['record_id']) + r = rt.normalised((np.zeros(3), np.zeros(3), np.zeros(3), np.zeros(3))) + self.assertTrue(np.all(r['depol'] == 1.0) and np.all(np.isfinite(r['N']))) + good = measure(held()) + broken = dict(good, N=[float('nan')] * len(good['N'])) + with self.assertRaises(rt.ActionRejected) as cm: + rt.run_fit([broken], 'cauchy_on_si', {}, ['film.thickness_m'], True) + self.assertEqual(str(cm.exception), 'FIT_FAILED') + + def test_F04_thickness_non_uniformity_average_is_converged(self): + lam = rt.wavelengths_nm() + for d, nu in ((1e-6, 0.05), (5e-6, 0.02), (20e-6, 0.01)): + a = rt.sample_mueller(_pmma_film(d, nu), lam, math.radians(70.0), bandwidth_ev=0.0, divergence_rad=0.0) + ref = _dense_nonuniform(d, nu, lam, math.radians(70.0)) + self.assertLess(max(float(np.max(np.abs(a[k] - ref[k]))) for k in ('N', 'C', 'S')), 1e-6, (d, nu)) + + def test_F05_bandwidth_average_is_converged_up_to_the_spectral_edges(self): + lam = rt.wavelengths_nm() + E, bw, g = rt.HC_EV_NM / lam, rt.BANDWIDTH_SIGMA_EV, rt.library()['grid'] + for d in (2e-6, 20e-6): + a = rt.sample_mueller(_pmma_film(d), lam, math.radians(70.0), divergence_rad=0.0) + z = np.linspace(-7, 7, 4001) + w = np.exp(-0.5 * z * z) + w /= w.sum() + tot = (0.0, 0.0, 0.0, 0.0) + for zi, wi in zip(z, w): + lb = rt.HC_EV_NM / (E + zi * bw) # the tables continue linearly beyond 380 / 900 nm (edge pixels) + rp, rs = rt.stack_rps(lb, np.ones(lam.shape, complex), [(rt.library_index('pmma', lb), d)], rt.library_index('si', lb), math.radians(70.0)) + tot = rt._add(tot, rt._pair(rp, rs), wi) + ref = rt.normalised(tot) + self.assertLess(max(float(np.max(np.abs(a[k] - ref[k]))) for k in ('N', 'C', 'S')), 5e-5, d) + + def test_F06_backside_beams_carry_the_film_transmission_phase(self): + lam = rt.wavelengths_nm() + th = math.radians(70.0) + N0 = np.ones(lam.shape, complex) + Nf, Ns = rt.library_index('tio2', lam).real + 0j, rt.library_index('n_bk7', lam).real + 0j + kx = N0 * math.sin(th) + + def fres(Ni, Nj, pol): + qi, qj = np.sqrt(Ni ** 2 - kx ** 2 + 0j), np.sqrt(Nj ** 2 - kx ** 2 + 0j) + if pol == 's': + return (qi - qj) / (qi + qj), 2 * qi / (qi + qj) + return (Nj ** 2 * qi - Ni ** 2 * qj) / (Nj ** 2 * qi + Ni ** 2 * qj), 2 * Ni * Nj * qi / (Nj ** 2 * qi + Ni ** 2 * qj) + + def film_t(Na, Nb, Nc, pol, d=80e-9): # independent Airy sum of the E-field transmission + _, t_ab = fres(Na, Nb, pol) + _, t_bc = fres(Nb, Nc, pol) + r_ba, _ = fres(Nb, Na, pol) + r_bc, _ = fres(Nb, Nc, pol) + e = np.exp(1j * 2 * math.pi / (lam * 1e-9) * np.sqrt(Nb ** 2 - kx ** 2 + 0j) * d) + return t_ab * t_bc * e / (1 - r_ba * r_bc * e * e) + amp = {pol: film_t(Ns, Nf, N0, pol) * fres(Ns, N0, pol)[0] * film_t(N0, Nf, Ns, pol) for pol in ('p', 's')} + ref = rt._pair(amp['p'], amp['s'], 1.0) + got = rt._backside(lam, N0, [(Nf, 80e-9)], Ns, kx, 1e-9, th, orders=1) + self.assertLess(max(float(np.max(np.abs(np.asarray(a) - np.asarray(b)))) for a, b in zip(got, ref)), 1e-12) + self.assertGreater(float(np.max(np.abs(np.asarray(ref[3])))), 1e-4) # the transmission phase is not zero for a coating + + def test_F07_unphysical_dispersion_models_are_rejected(self): + h = configured() + for m in ({'cauchy': dict(A=1.0, B=-5e-13, k_amp=0.1)}, {'cauchy': dict(A=1.0, B=-5e-13)}): # n < 0 in the blue (with and without a tail) + rejected(h, 'sample.provide', 'UNPHYSICAL_MATERIAL', **dict(BARE, sample_id='bad', substrate=m)) + self.assertTrue(rt.material_physical({'cauchy': dict(A=1.46, B=4e-15)}, rt.library()['grid'])) + + def test_F09_failed_or_cancelled_records_keep_no_data_and_the_fit_survives_hardware_faults(self): + h = held() + h.register_principal('agent', 'agent') + s = h.session('agent') + op = s.invoke(instance_id=h.instance_id, capability_id='measure', arguments=dict(mode='fast', alignment='standard', fixed_height_m=None, + model_id='cauchy_on_si'), request_id='m1')['operation_id'] + _into(h, 'fitting', 0.5) + s.cancel(op, 'c1') + rec = h.records[h.operations[op]['record_id']] + self.assertEqual((rec['status'], rec['psi_rad'], rec['N'], rec['fit']), ('cancelled', None, None, None)) + for fault in ('lamp_failure', 'vacuum_leak'): + g = held() + op = g.invoke('measure', mode='fast', alignment='standard', fixed_height_m=None, model_id='cauchy_on_si')['operation_id'] + _into(g, 'fitting', 0.5) + g.invoke('fault.inject', fault=fault, active=True) + rec = wait(g, op) + self.assertEqual(rec['status'], 'completed', fault) + self.assertIsNotNone(rec['fit'], fault) + g = held() + op = g.invoke('measure', mode='fast', alignment='standard', fixed_height_m=None, model_id='cauchy_on_si')['operation_id'] + _into(g, 'fitting', 0.5) + g.invoke('power.set', enabled=False) # the workstation fit goes on + self.assertEqual(wait(g, op)['status'], 'completed') + + def test_F10_undetermined_parameters_get_no_confidence_limit(self): + h = _scenario('measured') + out = h.invoke('analysis.fit', record_ids=['SE0001'], model_id='cauchy_urbach_on_si', parameters={'film.k_amp': 0.0}, + fit=['film.thickness_m', 'film.A', 'film.B', 'film.k_exp'], thickness_prefit=True) + f = h.records[out['record_id']]['fit'] + self.assertIsNone(out['parameters']['film.k_exp']['ci90']) + self.assertIn('parameter_not_determined:film.k_exp', f['warnings']) + self.assertTrue(all(abs(f['correlation'][i][i] - 1.0) < 1e-12 for i in range(4))) + self.assertGreater(out['parameters']['film.thickness_m']['ci90'], 0.0) + + def test_F12_F19_steps_advance_the_revision_and_are_bounded(self): + h = ready() + rev = h.revision + h.step(1.0) + self.assertEqual(h.revision, rev + 1) + h.step(0.0) + self.assertEqual(h.revision, rev + 1) + for bad in (1e308, rt.MAX_STEP_S * 2): + with self.assertRaises(rt.ActionRejected): + h.step(bad) + + def test_F13_tauc_lorentz_eps1_equals_the_kramers_kronig_integral(self): + from scipy.integrate import quad + E = np.array([1.5, 2.5, 3.2]) + for p in ((1.0, 0.1, 500.0, 3.0, 2.0), (2.0, 0.8, 50.0, 2.0, 0.5), (1.0, 2.0, 100.0, 3.0, 8.0)): + e1 = rt.tauc_lorentz_eps(E, *p).real + for Ei, ei in zip(E, e1): + pv = quad(lambda x: x * float(rt._tl_eps2(np.array([x]), *p[1:])[0]) / (x + Ei), p[1], 3000.0, weight='cauchy', wvar=Ei, limit=600)[0] + self.assertAlmostEqual(ei, p[0] + 2 / math.pi * pv, delta=1e-4, msg=p) + + def test_F14_F15_F16_vacuum_liquid_cell_and_lamp_replacement(self): + h = ready() + h.invoke('sample.place', sample_id='pmma_on_si', offset_x_m=0.0, offset_y_m=0.0) + h.invoke('stage.move_z', z_m=rt.STAGE_Z_RANGE_M[0]) + settle(h) + h.invoke('aoi.set', position='90') + settle(h) + op = h.invoke('measure', mode='standard', alignment='none', fixed_height_m=None, model_id=None)['operation_id'] + _into(h, 'acquiring', 0.5) + h.invoke('fault.inject', fault='vacuum_leak', active=True) + rec = wait(h, op) + self.assertEqual(rec['status'], 'completed') + self.assertNotIn('vacuum_lost', rec['warnings']) # the straight-through beam does not need the vacuum + c = ready(lamp_age_s=1900 * 3600.0) + c.invoke('liquid_cell.install', sample_id='pmma_on_si') + c.invoke('vacuum.set', on=True) + rejected(c, 'liquid_cell.remove', 'SAMPLE_HELD') + old = c.read('evaluator')['truth.lamp_intensity_rel'] + c.invoke('fault.inject', fault='lamp_failure', active=True) + c.invoke('fault.inject', fault='lamp_failure', active=False) + c.invoke('system.acknowledge') + c.step(900.0) + self.assertLess(old, 0.8) + new = (1.0 - rt.LAMP_END_OF_LIFE_LOSS * 900.0 / rt.LAMP_RATED_S) * (1.0 - rt.LAMP_WARMUP_DEFICIT * math.exp(-900.0 / rt.LAMP_WARMUP_TAU_S)) + self.assertAlmostEqual(c.read('evaluator')['truth.lamp_intensity_rel'], new, delta=1e-9) + self.assertAlmostEqual(c.read()['lamp.on_time_s'], 900.0, places=6) + + def test_F17_guard_agrees_with_the_collision_proxies(self): + proxies = json.loads((ROOT / 'assets/expansion_batch04/t3_analytical/ja_alphase/collision_proxies.json').read_text())['components'] + box = proxies['detector_housing']['primitives'][0] + a_in = box['origin_m'][0] - box['size_m'][0] / 2 - rt.MEASURE_POINT_M[0] + h_lo = box['origin_m'][2] - box['size_m'][2] / 2 - rt.MEASURE_POINT_M[2] + self.assertAlmostEqual(a_in, rt.ARM_BODY_R_M[0], places=6) + self.assertAlmostEqual(h_lo, -rt.ARM_HALF_HEIGHT_M, places=6) + for aoi in (65.0, 70.0, 75.0, 90.0): + e = math.radians(90.0 - aoi) + c, s_ = math.cos(e), math.sin(e) + corner_x = a_in * c + rt.ARM_HALF_HEIGHT_M * s_ # inner lower corner of the proxy box + corner_z = rt.MEASURE_POINT_M[2] + a_in * s_ - rt.ARM_HALF_HEIGHT_M * c + self.assertLessEqual(rt.arm_lowest_z(e, corner_x - 1e-4, corner_x + 1e-4), corner_z + 1e-9, aoi) + + def test_F18_bandwidth_option_of_the_models_for_thick_films(self): + thick = dict(BARE, sample_id='thick', layers=[dict(material={'cauchy': dict(A=1.49, B=4.6e-15)}, thickness_m=5e-6)]) + h = held(thick, samples=(PMMA, CAL, thick)) + rec = measure(h) + truth = {'film.thickness_m': 5e-6, 'film.A': 1.49, 'film.B': 4.6e-15} + plain = h.invoke('analysis.fit', record_ids=[rec['record_id']], model_id='cauchy_on_si', parameters=truth, fit=['film.thickness_m', 'film.A', 'film.B'], + thickness_prefit=False) + opt = h.invoke('analysis.fit', record_ids=[rec['record_id']], model_id='cauchy_on_si', parameters=dict(truth, **{'options.bandwidth': 1.0, 'options.divergence': 1.0}), + fit=['film.thickness_m', 'film.A', 'film.B'], thickness_prefit=False) + self.assertLess(opt['mse'] * 5, plain['mse']) + self.assertLess(opt['mse'], 6.0) + + def test_F20_unsupported_whatever_the_arguments_and_prefit_inside_the_bounds(self): + h = ready() + h.register_principal('agent', 'agent') + r = h.session('agent').invoke(instance_id=h.instance_id, capability_id='hardware.connect', arguments={'port': 'x'}, request_id='u1') + self.assertEqual((r['status'], r['error']['code']), ('unsupported', 'UNSUPPORTED')) + g = _scenario('measured') + out = g.invoke('analysis.fit', **dict(FIT, parameters={'film.thickness_m': 15e-6})) + self.assertLessEqual(g.records[out['record_id']]['fit']['prefit']['grid_max'], 20e-6) + + def test_F21_the_smallest_documented_samples_can_be_measured(self): + five = dict(TINY, sample_id='five', size_m=[0.005, 0.005]) + h = held(five, samples=(PMMA, CAL, five)) + self.assertFalse(h.read('evaluator')['sample.held']) + rec = measure(h, mode='fast', alignment='robust') + self.assertEqual(rec['status'], 'completed') + self.assertIn('sample_not_held', rec['warnings']) + + +# ---------------------------------------------------------------- scenario states and declared effects +def _build(name): + if name == 'fresh': + return rt.JaAlphaseRuntime() + if name == 'off': + return configured() + if name == 'booting': + h = configured() + h.invoke('power.set', enabled=True) + h.step(2.0) + return h + if name == 'warming': + h = _scenario('booting') + h.step(30.0) + return h + if name == 'ready': + return ready() + if name == 'placed': + h = ready() + h.invoke('sample.place', sample_id='pmma_on_si', offset_x_m=0.0, offset_y_m=0.0) + return h + if name == 'held': + h = _scenario('placed') + h.invoke('vacuum.set', on=True) + return h + if name in ('aligning', 'acquiring', 'fitting'): + h = _scenario('held') + h.invoke('measure', mode='standard', alignment='standard', fixed_height_m=None, model_id='cauchy_on_si') + return _into(h, name, 0.5) + if name == 'measured': + h = _scenario('held') + measure(h, model_id='cauchy_on_si') + return h + if name == 'mm_measuring': + h = _scenario('measured') + h.invoke('measure', mode='mm', alignment='none', fixed_height_m=None, model_id=None) + return _into(h, 'acquiring', 0.5) + if name == 'analysed': + h = _scenario('measured') + h.invoke('analysis.fit', **FIT) + return h + if name == 'aoi_changing': + h = _scenario('held') + h.invoke('aoi.set', position='65') + h.step(1.2) + return h + if name == 'stage_moving': + h = _scenario('held') + h.invoke('stage.move_z', z_m=MZ - 0.005) + h.step(1.0) + return h + if name == 'straight': + h = ready() + h.invoke('aoi.set', position='90') + return settle(h) + if name == 'straight_measuring': + h = _scenario('straight') + h.invoke('measure', mode='standard', alignment='none', fixed_height_m=None, model_id=None) + return _into(h, 'acquiring', 0.5) + if name == 'straight_done': + h = _scenario('straight') + measure(h, alignment='none') + return h + if name == 'straight_off': # a valid %R baseline, power off: plant.configure is allowed + h = _scenario('straight_done') + h.invoke('power.set', enabled=False) + return h + if name == 'cal_held': + h = ready() + h.invoke('sample.place', sample_id='cal_wafer', offset_x_m=0.0, offset_y_m=0.0) + h.invoke('vacuum.set', on=True) + return h + if name == 'calibrating': + h = _scenario('cal_held') + h.invoke('calibration.run') + return _into(h, 'acquiring', 0.5) + if name == 'calibrated': + h = _scenario('cal_held') + wait(h, h.invoke('calibration.run')['operation_id']) + return h + if name == 'cell_installed': + h = ready() + h.invoke('liquid_cell.install', sample_id='pmma_on_si') + return h + if name == 'cell_filled': + h = _scenario('cell_installed') + h.invoke('liquid_cell.fill', liquid_id='water', volume_m3=450e-9) + h.invoke('vacuum.set', on=True) + return h + if name == 'cell_measuring': + h = _scenario('cell_filled') + h.invoke('measure', mode='fast', alignment='standard', fixed_height_m=None, model_id=None) + return _into(h, 'acquiring', 0.5) + if name == 'lamp_fault': + h = _scenario('held') + h.invoke('fault.inject', fault='lamp_failure', active=True) + return h + if name == 'lamp_replaced': # the fault is gone, the latched error still waits for acknowledgement + h = _scenario('lamp_fault') + h.invoke('fault.inject', fault='lamp_failure', active=False) + return h + if name == 'stall_fault': + h = _scenario('held') + h.invoke('fault.inject', fault='stage_stall', active=True) + return h + if name == 'leak_fault': + h = _scenario('held') + h.invoke('fault.inject', fault='vacuum_leak', active=True) + return h + if name == 'plunger_fault': + h = _scenario('held') + h.invoke('fault.inject', fault='plunger_not_seated', active=True) + return h + if name == 'vacuum_on_empty': # placing onto a running vacuum changes held / pressure at once + h = ready() + h.invoke('vacuum.set', on=True) + return h + if name == 'weak_vacuum_placed': # supply too weak to hold: removal still changes the pressure + h = ready(vacuum_supply_pa=70.0e3) + h.invoke('sample.place', sample_id='pmma_on_si', offset_x_m=0.0, offset_y_m=0.0) + h.invoke('vacuum.set', on=True) + return h + if name == 'unpowered_lamp_fault': # a fault present at power-up latches its error + h = configured() + h.invoke('fault.inject', fault='lamp_failure', active=True) + return h + if name == 'unpowered_stall': + h = configured() + h.invoke('fault.inject', fault='stage_stall', active=True) + return h + if name == 'weak_vacuum_cell': # cell on a vacuum too weak to hold it: removal changes the pressure + h = ready(vacuum_supply_pa=70.0e3) + h.invoke('liquid_cell.install', sample_id='pmma_on_si') + h.invoke('vacuum.set', on=True) + return h + if name == 'cell_held': + h = _scenario('cell_installed') + h.invoke('vacuum.set', on=True) + return h + if name == 'unpowered_placed': + h = configured() + h.invoke('sample.place', sample_id='pmma_on_si', offset_x_m=0.0, offset_y_m=0.0) + h.invoke('vacuum.set', on=True) + return h + raise KeyError(name) + + +def _stack_sample(layers, sub='si', size=0.05, backside='rough'): + return dict(sample_id='stack', kind='film_stack', shape='disc', size_m=[size, size], substrate_thickness_m=0.0005, substrate={'library': sub}, + layers=[dict(material={'library': m} if isinstance(m, str) else m, thickness_m=d, nonuniformity=nu) for m, d, nu in layers], roughness_m=0.0, + backside=backside) + + +def _dense_tensor(s, theta, n_nu=1, n_dv=1, n_b=1): + """Independent reference: trapezoid tensor over (thickness |z| <= 7, angle |z| <= 6, band |z| <= 6) with the stack evaluated at every node.""" + lam = rt.wavelengths_nm() + E = rt.HC_EV_NM / lam + + def rule(n, Z): + if n == 1: + return np.zeros(1), np.ones(1) + z = np.linspace(-Z, Z, n) + w = np.exp(-0.5 * z * z) + return z, w / w.sum() + (zu, wu), (za, wa), (zb, wb) = rule(n_nu, 7.0), rule(n_dv, 6.0), rule(n_b, 6.0) + tot = [np.zeros(lam.size) for _ in range(4)] + for b, w_b in zip(zb, wb): + lb = rt.HC_EV_NM / (E + b * rt.BANDWIDTH_SIGMA_EV) + N0, layers, Ns = rt.stack_media(s, lb, np.ones(lb.shape, complex)) + th = (theta + za * rt.BEAM_DIVERGENCE_RAD)[None, :, None] + lay = [(N[None, None], d * np.clip(1 + sg * zu, 0, None)[:, None, None]) for N, d, sg in layers] + m = rt._pair(*rt.stack_rps(lb[None, None], N0[None, None], lay, Ns[None, None], th)) + wgt = wu[:, None, None] * wa[None, :, None] * w_b + tot = [t + np.sum(np.broadcast_to(x, (len(zu), len(za), lam.size)) * wgt, axis=(0, 1)) for t, x in zip(tot, m)] + return rt.normalised(tuple(tot)) + + +def _ncs_err(a, b): + return max(float(np.max(np.abs(a[k] - b[k]))) for k in ('N', 'C', 'S')) + + +class RuntimeReviewRound2Regressions(unittest.TestCase): + def test_F04_non_uniformity_converged_on_reflecting_substrates_and_at_the_largest_spread(self): + lam = rt.wavelengths_nm() + th = math.radians(70.0) + for sub, mat, d, nu, n in (('ag', 'sio2', 1e-6, 0.0131, 4001), ('al', 'sio2', 1e-6, 0.0131, 4001), ('si', 'sio2', 1e-6, 0.0131, 4001), + ('si', 'pmma', 20e-6, rt.NONUNIFORMITY_MAX, 40001)): + s = _stack_sample([(mat, d, nu)], sub) + v = rt.sample_mueller(s, lam, th, bandwidth_ev=0.0, divergence_rad=0.0, backside=False) + ref = _dense_tensor(s, th, n_nu=n) + self.assertLess(_ncs_err(v, ref), 1e-6, (sub, mat, d, nu)) + with self.assertRaises(rt.ActionRejected): # the sample model's non-uniformity range + rt.validate(rt.CAPS['sample.provide']['input_schema'], dict(rt.SAMPLE_EXAMPLE, layers=[dict(material={'library': 'pmma'}, thickness_m=1e-6, + nonuniformity=0.2)])) + + def test_F25_divergence_average_is_exact_and_converged(self): + lam = rt.wavelengths_nm() + for aoi, sub, mat, d in ((70.0, 'si', 'pmma', 20e-6), (75.0, 'al', 'sio2', 20e-6), (70.0, 'si', 'pmma', 2e-6)): + th = math.radians(aoi) + s = _stack_sample([(mat, d, 0.0)], sub) + v = rt.sample_mueller(s, lam, th, bandwidth_ev=0.0, backside=False) + ref = _dense_tensor(s, th, n_dv=2001) + self.assertLess(_ncs_err(v, ref), 1e-6, (aoi, sub, mat, d)) + + def test_joint_average_matches_an_independent_tensor_reference(self): + lam = rt.wavelengths_nm() + th = math.radians(70.0) + s = _stack_sample([('pmma', 1e-6, 0.02)]) + v = rt.sample_mueller(s, lam, th, backside=False) + ref = _dense_tensor(s, th, n_nu=801, n_dv=41, n_b=161) + self.assertLess(_ncs_err(v, ref), 2e-5) + + def test_F24_model_with_options_reproduces_the_truth(self): + lam = rt.wavelengths_nm() + th = math.radians(70.0) + cauchy = {'cauchy': dict(A=1.49, B=4.6e-15, C=0.0)} + for d, nu in ((20e-6, 0.0), (5e-6, 0.002)): + s = _stack_sample([(cauchy, d, nu)]) + truth = rt.sample_mueller(s, lam, th) + mdl = rt.get_model('cauchy_on_si') + p = mdl.defaults() + p.update({'film.thickness_m': d, 'film.A': 1.49, 'film.B': 4.6e-15, 'film.C': 0.0, 'film.nonuniformity': nu, 'options.bandwidth': 1.0, + 'options.divergence': 1.0}) + N, C, S = rt.model_ncs(mdl, p, dict(record_id='x', lam=lam, theta=th, amb=np.ones(lam.shape, complex)), {}) + self.assertLess(_ncs_err(dict(N=N, C=C, S=S), truth), 1e-4, d) + cache = {} + mdl.media(p, lam, cache) + mdl.media(p, np.stack([lam * 0.999, lam]), cache) + self.assertEqual(len(cache), 6) # keyed by the wavelengths as well: film, interface, substrate on two grids + + def test_F23_work_is_bounded_and_capped_averages_are_flagged(self): + lam = rt.wavelengths_nm() + s = _stack_sample([('pmma', 20e-6, 0.05)] * 8, size=0.1) + info = {} + t0 = time.time() + rt.sample_mueller(s, lam, math.radians(70.0), info=info) + self.assertLess(time.time() - t0, 60.0) + self.assertTrue(info['capped']) + h = held(dict(s, sample_id='stack8')) + t0 = time.time() + rec = measure(h, mode='fast', alignment='robust') + self.assertLess(time.time() - t0, 90.0) + self.assertEqual((rec['status'], rec['reason'], rec['psi_rad']), ('failed', 'SIMULATION_LIMIT', None)) # no unconverged spectrum is delivered + self.assertIn('SIMULATION_LIMIT', [e['code'] for e in rt.export_ja_alphase_contract_metadata()['capabilities']['measure']['errors']]) + + def test_F32_an_incoherent_layer_is_averaged_over_one_fringe_and_converges(self): + lam = np.array([380.0, 393.0, 561.0, 800.0, 900.0]) + th = math.radians(70.0) + s = _stack_sample([('pmma', 20e-6, rt.NONUNIFORMITY_MAX)]) + info = {} + v = rt.sample_mueller(s, lam, th, backside=False, info=info) + self.assertFalse(info['capped']) + self.assertIn('phase', info['levels']) # the uniform one-fringe average of the incoherent layer + E = rt.HC_EV_NM / lam + zu = np.linspace(-7, 7, 40001); wu = np.exp(-zu ** 2 / 2); wu /= wu.sum() + za = np.linspace(-6, 6, 21); wa = np.exp(-za ** 2 / 2); wa /= wa.sum() + zb = np.linspace(-6, 6, 41); wb = np.exp(-zb ** 2 / 2); wb /= wb.sum() + tot = [np.zeros(lam.size) for _ in range(4)] + for b, w_b in zip(zb, wb): + lb = rt.HC_EV_NM / (E + b * rt.BANDWIDTH_SIGMA_EV) + N0, layers, Ns = rt.stack_media(s, lb, np.ones(lb.shape, complex)) + for i0 in range(0, len(zu), 4000): + zc, wc = zu[i0:i0 + 4000], wu[i0:i0 + 4000] + lay = [(N[None, None], d * (1 + sg * zc)[:, None, None]) for N, d, sg in layers] + m = rt._pair(*rt.stack_rps(lb[None, None], N0[None, None], lay, Ns[None, None], (th + za * rt.BEAM_DIVERGENCE_RAD)[None, :, None])) + wgt = wc[:, None, None] * wa[None, :, None] * w_b + tot = [t + np.sum(np.broadcast_to(x, (len(zc), len(za), lam.size)) * wgt, axis=(0, 1)) for t, x in zip(tot, m)] + self.assertLess(_ncs_err(v, rt.normalised(tuple(tot))), 1e-6) + + def test_F33_model_with_options_matches_the_truth_for_a_thick_non_uniform_film(self): + lam = rt.wavelengths_nm() + th = math.radians(70.0) + s = _stack_sample([({'cauchy': dict(A=1.49, B=4.6e-15, C=0.0)}, 5e-6, 0.05)]) + truth = rt.sample_mueller(s, lam, th) + mdl = rt.get_model('cauchy_on_si') + p = dict(mdl.defaults(), **{'film.thickness_m': 5e-6, 'film.A': 1.49, 'film.B': 4.6e-15, 'film.C': 0.0, 'film.nonuniformity': 0.05, + 'options.bandwidth': 1.0, 'options.divergence': 1.0}) + N, C, S = rt.model_ncs(mdl, p, dict(record_id='x', lam=lam, theta=th, amb=np.ones(lam.shape, complex)), {}) + self.assertLess(_ncs_err(dict(N=N, C=C, S=S), truth), 1e-4) + + def test_F22_plunger_fault_in_the_calibration_fit_does_not_wedge_the_clock(self): + h = ready() + h.invoke('sample.place', sample_id='cal_wafer', offset_x_m=0.0, offset_y_m=0.0) + h.invoke('vacuum.set', on=True) + op = h.invoke('calibration.run')['operation_id'] + _into(h, 'fitting', 0.5) + h.invoke('fault.inject', fault='plunger_not_seated', active=True) + for _ in range(4): + h.step(1.0) + rec = h.records[h.operations[op]['record_id']] + self.assertEqual(rec['status'], 'completed') + self.assertEqual(rec['calibration']['position'], '70') + self.assertEqual(h.cal['status'], 'calibrated') + h.register_principal('ev', 'evaluator') + r = h.session('ev').invoke(instance_id=h.instance_id, capability_id='sim.step', arguments=dict(dt_s=1.0), request_id='s') + self.assertEqual(r['status'], 'succeeded') + + def test_defects_become_DEVICE_ERROR_instead_of_raw_exceptions(self): + h = ready() + h.invoke('sample.place', sample_id='cal_wafer', offset_x_m=0.0, offset_y_m=0.0) + op = h.invoke('calibration.run')['operation_id'] + _into(h, 'fitting', 0.5) + + def broken(o, rec): + raise RuntimeError('simulated defect') + h._calibrate = broken + h.step(5.0) + self.assertEqual(h.operations[op]['phase'], 'failed') + self.assertEqual(h.operations[op]['reason'], 'DEVICE_ERROR') + self.assertIsNone(h.op) + h.step(1.0) # the clock goes on + h.register_principal('agent', 'agent') + + def boom(): + raise RuntimeError('simulated defect') + h._cmd_records_list = boom + r = h.session('agent').invoke(instance_id=h.instance_id, capability_id='records.list', arguments={}, request_id='l') + self.assertEqual((r['status'], r['error']['code'], r['error']['side_effects']), ('rejected', 'DEVICE_ERROR', 'unknown')) + self.assertIn('DEVICE_ERROR', [e['code'] for e in rt.export_ja_alphase_contract_metadata()['capabilities']['records.list']['errors']]) + + def test_F26_guard_checks_the_beam_side_faces_of_the_ports(self): + block = dict(sample_id='block', kind='film_stack', shape='rectangle', size_m=[0.177, 0.03], substrate_thickness_m=0.016, substrate={'library': 'soda_lime'}, + layers=[], roughness_m=0.0, backside='rough') + h = ready(samples=(PMMA, CAL, block)) + h.invoke('aoi.set', position='75') + settle(h) + h.invoke('sample.place', sample_id='block', offset_x_m=0.0, offset_y_m=0.0) + rejected(h, 'stage.move_z', 'COLLISION_RISK', z_m=rt.STAGE_Z_RANGE_M[1]) + rejected(h, 'measure', 'COLLISION_RISK', mode='fast', alignment='fixed_height', fixed_height_m=rt.STAGE_Z_RANGE_M[1], model_id=None) + rng = np.random.default_rng(3) + worst = math.inf + for _ in range(3000): # every accepted pose keeps 2 mm to the densely sampled proxy boxes + el = math.radians(90.0 - float(rng.choice([65.0, 70.0, 75.0, 90.0]))) + half = float(rng.uniform(0.0025, 0.1)) + ztop = float(rng.uniform(rt.STAGE_Z_RANGE_M[0], rt.STAGE_Z_RANGE_M[1] + 0.016)) + x0, x1 = -half, half + if not rt.arm_lowest_z(el, x0 - rt.CLEARANCE_M, x1 + rt.CLEARANCE_M) > ztop + rt.CLEARANCE_M: + continue + for poly in rt.arm_polygons(el): + P = np.array(poly + poly[:1]) + for (xa, za), (xb, zb) in zip(P[:-1], P[1:]): + f = np.linspace(0.0, 1.0, 400) + xs, zs = xa + f * (xb - xa), za + f * (zb - za) + dx = np.maximum(np.maximum(x0 - xs, xs - x1), 0.0) + gap = np.where(dx > 0, np.hypot(dx, np.maximum(zs - ztop, 0.0)), zs - ztop) + worst = min(worst, float(gap.min())) + self.assertGreater(worst, rt.CLEARANCE_M * 0.999) + + def test_F27_negative_noise_seed_is_rejected_before_any_change(self): + h = rt.JaAlphaseRuntime() + rejected(h, 'plant.configure', 'INVALID_ARGUMENT', **dict(rt.PLANT_EXAMPLE, noise_seed=-1)) + self.assertIsNone(h.plant) + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, noise_seed=2 ** 32 - 1)) + self.assertTrue(h.read()['plant.configured']) + + def test_F28_plant_configure_invalidates_the_baseline_and_declares_it(self): + h = ready() + straight_through(h) + self.assertTrue(h.read()['calibration.baseline']['valid']) + h.invoke('power.set', enabled=False) + h.invoke('plant.configure', **rt.PLANT_EXAMPLE) + self.assertFalse(h.read()['calibration.baseline']['valid']) + self.assertIn('calibration.baseline', rt.EFFECTS['plant.configure']) + + def test_F29_a_leak_with_the_vacuum_off_leaves_no_warning(self): + h = ready() + h.invoke('sample.place', sample_id='pmma_on_si', offset_x_m=0.0, offset_y_m=0.0) + op = h.invoke('measure', mode='standard', alignment='standard', fixed_height_m=None, model_id=None)['operation_id'] + _into(h, 'acquiring', 0.5) + h.invoke('fault.inject', fault='vacuum_leak', active=True) + rec = wait(h, op) + self.assertNotIn('vacuum_lost', rec['warnings']) + g = held() + op = g.invoke('measure', mode='standard', alignment='standard', fixed_height_m=None, model_id=None)['operation_id'] + _into(g, 'acquiring', 0.5) + g.invoke('fault.inject', fault='vacuum_leak', active=True) + self.assertIn('vacuum_lost', wait(g, op)['warnings']) # evaluator view; agents do not get it (C05) + + def test_F30_clearing_an_inactive_lamp_fault_changes_nothing(self): + h = ready() + before = h.read('evaluator') + n_ev = len(h.events) + h.invoke('fault.inject', fault='lamp_failure', active=False) + self.assertFalse(_changed(h.read('evaluator'), before)) + self.assertEqual(len(h.events), n_ev) + + +class ContractReviewRound1Regressions(unittest.TestCase): + def test_C03_every_parameter_name_has_one_declared_unit(self): + cat = rt.models_catalog() + models = [rt.get_model(k) for k in rt._static_models()] + [rt.get_model(k) for k in + ('library_film:pmma@si', 'library_film:sio2@soda_lime', 'library_bulk:au', 'cauchy_on:n_bk7')] + for m in models: + for n, P in m.params.items(): + self.assertEqual(rt.PARAM_UNITS.get(n), P.unit, (m.model_id, n)) + for k, v in cat.items(): + self.assertEqual(sorted(v['parameter_units']), v['parameters'], k) + self.assertTrue(all(rt.PARAM_UNITS[n] == u for n, u in v['parameter_units'].items()), k) + out_schema = rt.CAPS['analysis.fit']['output_schema']['properties']['parameters'] + in_schema = rt.CAPS['analysis.fit']['input_schema']['properties']['parameters'] + for n, u in rt.PARAM_UNITS.items(): + self.assertEqual(out_schema['properties'][n]['properties']['value']['x-unit'], u) + self.assertEqual(in_schema['properties'][n]['x-unit'], u) + self.assertEqual(rt.PARAM_UNITS['film.A'], '1') # Cauchy A; the Tauc-Lorentz amplitude is film.A_ev + self.assertEqual(rt.PARAM_UNITS['film.A_ev'], 'eV') + h = held() + rec = measure(h) + out = h.invoke('analysis.fit', **dict(FIT, record_ids=[rec['record_id']])) + for n, v in out['parameters'].items(): + self.assertEqual(v['unit'], rt.PARAM_UNITS[n], n) + rt.validate(rt.CAPS['analysis.fit']['input_schema'], dict(FIT, record_ids=[rec['record_id']])) + uq = rt.CAPS['analysis.uniqueness'] + self.assertEqual(uq['output_schema']['properties']['best_value']['x-unit'], 'm') + self.assertEqual(uq['input_schema']['properties']['values']['items']['x-unit'], 'm') + self.assertTrue(all(rt.PARAM_UNITS[n] == 'm' for n in uq['input_schema']['properties']['scan_parameter']['enum'])) + rejected(h, 'analysis.uniqueness', 'INVALID_ARGUMENT', record_ids=[rec['record_id']], model_id='cauchy_on_si', parameters={}, fit=['film.thickness_m'], + scan_parameter='film.A', values=[1.4, 1.5]) + + def test_C04_pressures_heights_angles_and_offsets_name_their_reference(self): + meta = rt.export_ja_alphase_contract_metadata() + for k in ('vacuum.pressure_pa', 'stage.z_m', 'stage.z_target_m', 'stage.last_aligned_z_m', 'aoi.arm_elevation_rad', 'sample.on_stage', + 'calibration.table', 'truth.aoi_rad', 'liquid_cell.volume_m3'): + self.assertTrue(meta['state_slots'][k].get('reference_conditions'), k) + self.assertIn('绝对压力', meta['state_slots']['vacuum.pressure_pa']['reference_conditions']) + self.assertEqual(rt.CAPS['plant.configure']['input_schema']['properties']['vacuum_supply_pa']['x-reference-conditions'], '绝对压力') + + def test_C05_the_chuck_vacuum_is_process_truth_not_an_agent_reading(self): + h = held() + h.register_principal('agent', 'agent') + h.register_principal('eval', 'evaluator') + s, e = h.session('agent'), h.session('eval') + iid = h.instance_id + for k in ('vacuum.pressure_pa', 'sample.held'): + self.assertEqual(rt.SLOTS[k]['origin'], 'process_truth') + self.assertNotIn(k, s.read(instance_id=iid)['observations']) + self.assertNotIn(k, s.describe(instance_id=iid)['state_slots']) + self.assertIn(k, e.read(instance_id=iid)['observations']) + self.assertTrue(all(k not in ('vacuum.pressure_pa', 'sample.held') for c in s.describe(instance_id=iid)['capabilities'].values() + for k in [x['state_id'] for x in c['state_effects']] + c['observes'])) + before = s.read(instance_id=iid)['observations'] + e.invoke(instance_id=iid, capability_id='fault.inject', arguments=dict(fault='vacuum_leak', active=True), request_id='f1') + h.step(1.0) + after = s.read(instance_id=iid)['observations'] + self.assertEqual({k: v['value'] for k, v in before.items() if k not in ('clock.time_s', 'lamp.on_time_s')}, + {k: v['value'] for k, v in after.items() if k not in ('clock.time_s', 'lamp.on_time_s')}) + self.assertFalse(e.read(instance_id=iid)['observations']['sample.held']['value']) + r = s.invoke(instance_id=iid, capability_id='vacuum.set', arguments=dict(on=True), request_id='v1') + self.assertEqual(set(r['result']), {'on'}) + r = s.invoke(instance_id=iid, capability_id='measure', arguments=dict(mode='fast', alignment='standard', fixed_height_m=None, model_id=None), request_id='m1') + rec = wait(h, r['operation_id']) + self.assertIn('sample_not_held', rec['warnings']) # the runtime record (evaluator view) keeps it + mine = s.invoke(instance_id=iid, capability_id='measurement.result', arguments=dict(record_id=rec['record_id']), request_id='r1')['result'] + full = e.invoke(instance_id=iid, capability_id='measurement.result', arguments=dict(record_id=rec['record_id']), request_id='r2')['result'] + self.assertNotIn('sample_not_held', mine['warnings']) + self.assertIn('sample_not_held', full['warnings']) + self.assertNotIn('sample_not_held', s.poll(r['operation_id'])['result']['warnings']) + ev = s.invoke(instance_id=iid, capability_id='events.read', arguments=dict(since_s=0.0), request_id='e1')['result']['events'] + self.assertFalse([x for x in ev if 'kPa' in x['message_zh'] or x['kind'] == 'fault']) + + +def _scenario(name): + if name not in _SC: + _SC[name] = _build(name) + return copy.deepcopy(_SC[name]) + + +SCENARIOS = ['fresh', 'off', 'booting', 'warming', 'ready', 'placed', 'held', 'aligning', 'acquiring', 'fitting', 'measured', 'mm_measuring', 'analysed', + 'aoi_changing', 'stage_moving', 'straight', 'straight_measuring', 'straight_done', 'cal_held', 'calibrating', 'calibrated', 'cell_installed', + 'cell_filled', 'cell_measuring', 'lamp_fault', 'lamp_replaced', 'stall_fault', 'leak_fault', 'plunger_fault', 'unpowered_placed', 'vacuum_on_empty', + 'weak_vacuum_placed', 'unpowered_lamp_fault', 'unpowered_stall', 'cell_held', 'weak_vacuum_cell', 'straight_off'] +LONG_SCENARIOS = ['warming', 'held', 'measured', 'straight', 'cal_held', 'cell_filled', 'lamp_replaced', 'unpowered_placed', 'unpowered_lamp_fault'] +STEP_DTS = (0.4, 1.5, 6.0, 60.0) + + +def _variants(cap): + V = { + 'plant.configure': [dict(rt.PLANT_EXAMPLE), dict(rt.PLANT_EXAMPLE, calibration='nominal', noise_seed=2), dict(rt.PLANT_EXAMPLE, mains_voltage_v=60.0), + dict(rt.PLANT_EXAMPLE, vacuum_supply_pa=90.0e3, lamp_age_s=1500.0 * 3600.0)], + 'sample.provide': [dict(rt.SAMPLE_EXAMPLE, sample_id='new')], + 'sample.place': [dict(sample_id='pmma_on_si', offset_x_m=0.0, offset_y_m=0.0), dict(sample_id='cal_wafer', offset_x_m=0.001, offset_y_m=0.0)], + 'sample.remove': [dict(sample_id='pmma_on_si'), dict(sample_id='cal_wafer')], + 'power.set': [dict(enabled=True), dict(enabled=False)], 'power.press_button': [{}], + 'vacuum.set': [dict(on=True), dict(on=False)], 'vacuum.press_switch': [{}], + 'aoi.set': [dict(position='65'), dict(position='70'), dict(position='90')], + 'stage.move_z': [dict(z_m=rt.STAGE_Z_REF_M), dict(z_m=MZ - 0.0003), dict(z_m=rt.STAGE_Z_RANGE_M[0])], + 'liquid_cell.install': [dict(sample_id='pmma_on_si')], 'liquid_cell.remove': [{}], + 'liquid_cell.fill': [dict(liquid_id='water', volume_m3=450e-9), dict(liquid_id='ethanol', volume_m3=100e-9)], 'liquid_cell.drain': [{}], + 'measure': [dict(mode='standard', alignment='standard', fixed_height_m=None, model_id='cauchy_on_si'), + dict(mode='fast', alignment='none', fixed_height_m=None, model_id=None), + dict(mode='mm', alignment='robust', fixed_height_m=None, model_id=None), + dict(mode='fast', alignment='fixed_height', fixed_height_m=MZ - rt.sample_height_m(PMMA), model_id=None)], + 'calibration.run': [{}], + 'analysis.fit': [dict(FIT), dict(FIT, model_id='si_native_oxide', fit=['oxide.thickness_m'], thickness_prefit=False)], + 'analysis.uniqueness': [dict(record_ids=['SE0001'], model_id='cauchy_on_si', parameters={}, fit=['film.A', 'film.B'], scan_parameter='film.thickness_m', + values=[100e-9, 120e-9, 140e-9])], + 'data.pseudo': [dict(record_id='SE0001')], + 'records.delete': [dict(record_id='SE0001'), dict(record_id='CA0001'), dict(record_id='FT0001'), dict(record_id='ST0001')], + 'system.acknowledge': [{}], + 'fault.inject': [dict(fault=f, active=True) for f in rt.FAULTS] + [dict(fault=f, active=False) for f in rt.FAULTS], + 'sim.step': [dict(dt_s=0.5), dict(dt_s=30.0)], + } + return V.get(cap, []) + + +def _num(x): + return isinstance(x, (int, float)) and not isinstance(x, bool) + + +def _flat(v, prefix=''): + out = {} + if isinstance(v, dict): + for k, x in v.items(): + out.update(_flat(x, f'{prefix}.{k}')) + elif isinstance(v, list) and len(v) <= 64: + for i, x in enumerate(v): + out.update(_flat(x, f'{prefix}[{i}]')) + else: + out[prefix] = json.dumps(v, sort_keys=True, default=str) if isinstance(v, list) else v + return out + + +def _rel_changed(a, b, scale=None): + if _num(a) and _num(b): + return abs(a - b) > 1e-9 * (max(abs(a), abs(b)) if scale is None else scale) + 1e-300 + return _changed(a, b) + + +def _leaf_changed(a, b): + fa, fb = _flat(a), _flat(b) + return any(_rel_changed(fa.get(k, ''), fb.get(k, '')) for k in set(fa) | set(fb)) + + +def _step_differs(v1, a2, v0, b2): + """Does the step change the value differently with the call (v1 -> a2) than without it (v0 -> b2)? (leaf-wise, numeric increments)""" + f1, fa, f0, fb = _flat(v1), _flat(a2), _flat(v0), _flat(b2) + for leaf in set(f1) | set(fa) | set(f0) | set(fb): + x1, xa, x0, xb = (f.get(leaf, '') for f in (f1, fa, f0, fb)) + ca, cb = _rel_changed(x1, xa), _rel_changed(x0, xb) + if not (ca or cb): + continue + if ca and cb and all(_num(x) for x in (x1, xa, x0, xb)) and not _rel_changed(xa - x1, xb - x0, max(abs(x1), abs(xa), abs(x0), abs(xb))): + continue + if ca and cb and (x1, xa) == (x0, xb): + continue + if ca and cb and x1 == x0 and not _rel_changed(xa, xb): + continue + return True + return False + + +def _executable(cap): + return cap not in rt.UNSUPPORTED and rt.CAPS[cap]['kind'] != 'query' + + +class DeclaredEffects(unittest.TestCase): + def test_immediate_and_on_step_effects_are_declared(self): + """For every capability accepted in any scenario state: the slots it changes at once are declared effects, the slots whose change during the + following step differs from an identical run without the call are declared on_step effects, and the step itself only changes slots declared + as on_step effects of sim.step (the runtime noise is seeded by operation counters, so both runs draw identical noise).""" + missing_imm, missing_step = {}, {} + states = {n: _scenario(n) for n in SCENARIOS} + for cap in rt.CAPS: + if not _executable(cap): + continue + for sname, S in states.items(): + for args in _variants(cap): + A = copy.deepcopy(S) + v0 = A.read('evaluator') + try: + _orig_invoke(A, cap, **args) + except rt.ActionRejected: + continue + v1 = A.read('evaluator') + if cap == 'sim.step': + for k in v0: + if _leaf_changed(v0[k], v1[k]) and k not in rt.ON_STEP['sim.step'] + rt.EFFECTS['sim.step']: + missing_step.setdefault('sim.step', set()).add((sname, k)) + continue + for k in v0: + if _changed(v0[k], v1[k]) and _leaf_changed(v0[k], v1[k]) and k not in rt.EFFECTS.get(cap, []): + missing_imm.setdefault(cap, set()).add((sname, k)) + for dt in STEP_DTS: + A2, B2 = copy.deepcopy(A), copy.deepcopy(S) + A2.step(dt) + B2.step(dt) + a2, b2 = A2.read('evaluator'), B2.read('evaluator') + for k in v0: + if k not in rt.ON_STEP.get(cap, []) and _step_differs(v1[k], a2[k], v0[k], b2[k]): + missing_step.setdefault(cap, set()).add((sname, k)) + if k not in rt.ON_STEP['sim.step'] + ['clock.time_s'] and _leaf_changed(v0[k], b2[k]): + missing_step.setdefault('sim.step', set()).add((sname, k)) + self.assertEqual(missing_imm, {}) + self.assertEqual(missing_step, {}) + self.assertFalse([s for v in rt.ON_STEP.values() for s in v if rt.SLOTS[s]['origin'] == 'setpoint']) + + def test_every_executable_capability_is_accepted_in_some_scenario(self): + accepted = set() + for n in SCENARIOS: + S = _scenario(n) + for cap in rt.CAPS: + if not _executable(cap) or cap in accepted: + continue + for args in _variants(cap): + try: + _orig_invoke(copy.deepcopy(S), cap, **args) + accepted.add(cap) + break + except rt.ActionRejected: + pass + self.assertEqual({c for c in rt.CAPS if _executable(c)} - accepted, set()) + + def test_long_window_effects_of_operations_are_declared(self): + """Every accepted asynchronous call is followed until its operation has left 'running' (+ 5 s), every other call for 400 s (longer than + the lamp warm-up), comparing with the identical run without the call every 0.05 s for the first 10 s and every 1 s after.""" + missing = {} + for sname in LONG_SCENARIOS: + S = _scenario(sname) + for cap in rt.CAPS: + if not _executable(cap) or cap == 'sim.step': + continue + for args in _variants(cap): + A = copy.deepcopy(S) + v0 = A.read('evaluator') + try: + res = _orig_invoke(A, cap, **args) + except rt.ActionRejected: + continue + oid = res.get('operation_id') if isinstance(res, dict) and cap in rt.ASYNC else None + v1 = A.read('evaluator') + B = copy.deepcopy(S) + t, t_end = 0.0, (3600.0 if oid else 400.0) + while t < t_end - 1e-9: + d = 0.05 if t < 10.0 - 1e-9 else 1.0 + A.step(d) + B.step(d) + t += d + a2, b2 = A.read('evaluator'), B.read('evaluator') + for k in v0: + if k not in rt.ON_STEP.get(cap, []) and _step_differs(v1[k], a2[k], v0[k], b2[k]): + missing.setdefault(cap, set()).add((sname, k)) + if oid and A.operations[oid]['phase'] != 'running' and t_end == 3600.0: + t_end = t + 5.0 + self.assertEqual(missing, {}) + + +class ZZRejectionCodes(unittest.TestCase): + def test_every_observed_rejection_code_is_declared(self): + """Runs last (class name): every code raised by a device call anywhere in this test module is declared for that capability.""" + undeclared = {k: sorted(v - set(rt.CAP_ERRORS.get(k, [])) - {'INVALID_ARGUMENT', 'UNSUPPORTED', 'UNKNOWN_CAPABILITY'}) + for k, v in REJECTIONS.items()} + self.assertEqual({k: v for k, v in undeclared.items() if v}, {}) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_asset_jeol_jem1400flash.py b/tests/test_asset_jeol_jem1400flash.py new file mode 100644 index 0000000000000000000000000000000000000000..9e4178e80448e498b0c5d86d24a322b3a86d4246 --- /dev/null +++ b/tests/test_asset_jeol_jem1400flash.py @@ -0,0 +1,1619 @@ +"""tests for CHEM-152 jeol_jem1400flash: python3 -m unittest tests/test_asset_jeol_jem1400flash.py + +Topics (pipeline.md): set points only write targets, read/describe are pure, rejected preconditions leave the state unchanged, two +instances are isolated, agent/evaluator truth isolation, conservation (electron charge, gas), real return values validated against the +declared schemas (asset_tool lint_schema / validate_value), asynchronous completion and cancellation remnants, host-step independence, +declared immediate and on_step effects covering what the process changes; plus the instrument behaviour documented by JEOL and the facility +procedures (start-up and vacuum, HT 10-120 kV with the dark current of 44 uA at 80 kV and 66 uA at 120 kV, beam current 5-7 uA above the dark +current at bias 40, specimen exchange through the airlock with stage neutral and filament off, Evac Ready, holder tilt limits, LOW MAG / +MAG / DIFF steps, camera 2048 x 2048 with 21.7 um pixels, lattice resolution 0.14 nm) and the electron-scattering physics (mass-thickness and +diffraction contrast, extinction distances, ring and spot patterns, Thon rings, beam damage). +""" +import copy +import json +import math +import random +import sys +import unittest +from pathlib import Path + +import numpy as np + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / "scripts")) +sys.path.insert(0, str(ROOT / "skills/chemistry-lab-assets/scripts")) +from asset_runtime import jeol_jem1400flash as rt # noqa: E402 +import asset_tool # noqa: E402 + +CHECKS, PROCESS_EVIDENCE = [], {} +_META = {} + + +def _meta(): + if not _META: + _META.update(rt.export_jeol_jem1400flash_contract_metadata()) + return _META + + +_orig_invoke = rt.JeolJem1400flashRuntime.invoke + + +def _instrumented_invoke(self, capability_id, **a): + """Every successful call is checked against its declared output schema and immediate state effects (read does not advance time).""" + before = self.read('evaluator') if capability_id != 'sim.step' else None + t0 = self.time_ns + out = _orig_invoke(self, capability_id, **a) + meta = _meta()['capabilities'][capability_id] + errs = asset_tool.validate_value(out, meta['output_schema']) + if errs: + raise AssertionError(f'{capability_id} output violates its schema: {errs[:3]}') + if before is not None: + assert self.time_ns == t0, capability_id + after = self.read('evaluator') + undeclared = {k for k in after if after[k] != before[k]} - set(rt.CAPS[capability_id]['effects']) + if undeclared: + raise AssertionError(f'{capability_id} changed undeclared state immediately: {sorted(undeclared)}') + PROCESS_EVIDENCE.setdefault(capability_id, []).append(dict(arguments=copy.deepcopy(a), result_keys=sorted(out))) + return out + + +rt.JeolJem1400flashRuntime.invoke = _instrumented_invoke +AU = rt.SPECIMEN_EXAMPLE + + +class QuietRng: + """Noise-free stand-in for random.Random (gauges exact, fixed draws) so that two runs differ only by the process.""" + def gauss(self, mu, sigma): + return mu + + def random(self): + return 0.5 + + def uniform(self, a, b): + return 0.5 * (a + b) + + def getrandbits(self, k): + return 12345 + + +def grid(sid, phases, support='amorphous_carbon', t_support=1e-8, holes=0.0, mesh='200'): + return dict(specimen_id=sid, grid_mesh=mesh, grid_material='copper', support_film=support, support_thickness_m=t_support if support != 'none' else 0.0, + hole_fraction=holes, phases=phases) + + +def phase(sub, form='particles', size=2e-8, t=2e-8, cov=0.15, cryst='single_crystal', zone=None, stain=0.0): + return dict(substance_id=sub, form=form, size_m=size, thickness_m=t, coverage=cov, crystallinity=cryst, zone_axis=zone, stain_mass_fraction=stain) + + +def configured(seed=1, **plant): + h = rt.JeolJem1400flashRuntime() + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, noise_seed=seed, **plant)) + return h + + +def ready(seed=1, ht=True, **plant): + """Powered, TEM Center up, column and gun at the ready pressure, HT at 120 kV (filament off).""" + h = configured(seed, **plant) + h.invoke('power.set', enabled=True) + h.step(260.0) + if ht: + h.invoke('ht.set_on', on=True) + h.step(125.0) + return h + + +def inserted(specimen=AU, holder='quick_change', seed=1, beam=True, **plant): + """A grid in the column (quick-change holder), filament saturated, condenser aperture in, beam spread over about 12 um, screen down.""" + h = ready(seed, **plant) + if specimen is not None: + h.invoke('specimen.provide', **specimen) + h.invoke('holder.load_grid', holder_id=holder, specimen_id=specimen['specimen_id']) + h.invoke('holder.insert_to_airlock', holder_id=holder) + h.step(12.0) + h.invoke('airlock.set_pump', pump=True) + h.step(60.0) + h.invoke('holder.insert') + h.step(10.0) + if specimen is not None: # view an open grid square (the random mount may put the origin on a bar) + x, y = open_square(h) + h.invoke('stage.move_xy', x_m=x, y_m=y) + h.step(3.0) + if beam: + h.invoke('filament.set_on', on=True) + h.step(25.0) + h.invoke('aperture.set_condenser', inserted=True) + h.invoke('optics.set_brightness', value=0.53) + h.step(1.0) + return h + + +def open_square(h, near=(0.0, 0.0)): + """Stage position of the centre of the grid square nearest to `near` (the host knows how the grid was mounted; an operator finds it at LOW MAG).""" + spec = h._spec() + mesh = rt.GRID_MESH[int(spec['grid_mesh'])] + p, w = mesh['pitch'], mesh['bar'] + phi, oa, ob = spec['_mount']['phi'], spec['_mount']['off_a'], spec['_mount']['off_b'] + a0 = math.cos(phi) * near[0] + math.sin(phi) * near[1] + oa + b0 = -math.sin(phi) * near[0] + math.cos(phi) * near[1] + ob + ac = round((a0 - (p + w) / 2) / p) * p + (p + w) / 2 - oa + bc = round((b0 - (p + w) / 2) / p) * p + (p + w) / 2 - ob + return math.cos(phi) * ac - math.sin(phi) * bc, math.sin(phi) * ac + math.cos(phi) * bc + + +def camera(h, mag=30000.0, ol=2): + h.invoke('aperture.set_objective', position=ol) + h.invoke('optics.set_magnification', magnification=mag) + h.invoke('screen.set', up=True) + h.step(1.0) + return h + + +def acquire_image(h, exposure=1.0, binning=1): + op = h.invoke('image.acquire', exposure_s=exposure, binning=binning)['operation_id'] + h.step(h.operations[op]['duration'] + 1.0) + return h.images[h.operations[op]['record_id']] + + +def acquire_pattern(h, exposure=0.5, binning=1): + op = h.invoke('diffraction.acquire', exposure_s=exposure, binning=binning)['operation_id'] + h.step(h.operations[op]['duration'] + 1.0) + return h.patterns[h.operations[op]['record_id']] + + +def rejected(h, cap, code, **a): + before = h.read('evaluator') + rev = h.revision + try: + h.invoke(cap, **a) + except rt.ActionRejected as exc: + assert str(exc) == code, (cap, str(exc), code) + assert h.read('evaluator') == before, cap + assert h.revision == rev, cap + return True + raise AssertionError(f'{cap} was not rejected (expected {code})') + + +def transmission(sid, t, v=120000.0, alpha=15e-3): + """Bright-field transmission of an amorphous layer (Lenz-Wentzel).""" + return math.exp(-rt.mu_el_outside(sid, v, alpha) * t) + + +class ContractAndSchemas(unittest.TestCase): + def test_module_identity(self): + self.assertEqual(rt.ASSET_TYPE_ID, 'instrument.jeol_jem1400flash') + self.assertEqual(rt.CATALOG_ID, 'CHEM-152') + + def test_schemas_lint_and_examples_validate(self): + meta = _meta() + for k, c in meta['capabilities'].items(): + self.assertEqual(asset_tool.lint_schema(c['input_schema']), [], k) + self.assertEqual(asset_tool.lint_schema(c['output_schema']), [], k) + if c['availability'] == 'implemented': + self.assertEqual(asset_tool.validate_value(c['example_arguments'], c['input_schema']), [], k) + for k, s in meta['state_slots'].items(): + self.assertEqual(asset_tool.lint_schema(s['value_schema']), [], k) + + def test_metadata_references_are_consistent(self): + meta = _meta() + slots = set(meta['state_slots']) + for k, c in meta['capabilities'].items(): + for e in c['state_effects']: + self.assertIn(e['state_id'], slots, k) + for x in c['observes']: + self.assertIn(x, slots, k) + for p in c['preconditions']: + for x in p['state_ids']: + self.assertIn(x, slots, k) + for e in c['errors']: + self.assertIn(e['code'], rt.ERROR_ZH, k) + self.assertEqual(set(rt.EFFECTS) | set(rt.UNSUPPORTED) | {'image.result', 'diffraction.result', 'montage.result', 'records.list', 'events.read', + 'ledger.read', 'provenance.read', 'camera.auto_exposure'}, set(rt.CAPS)) + self.assertEqual(set(rt.CAP_SOURCES), set(rt.CAPS)) + for mech in meta['mechanisms'].values(): + for x in mech['component_ids']: + self.assertIsInstance(x, str) + + def test_every_rejection_code_is_declared(self): + """Each ActionRejected code raised by a command method appears in that capability's declared errors.""" + import inspect + import re + src = inspect.getsource(rt.JeolJem1400flashRuntime) + meta = _meta()['capabilities'] + helpers = {'_need_plant': ['PLANT_REQUIRED'], '_need_power': ['PLANT_REQUIRED', 'POWER_OFF'], + '_need_ready': ['PLANT_REQUIRED', 'POWER_OFF', 'NOT_READY', 'ERROR_PENDING'], '_need_idle': ['ACQUISITION_RUNNING'], + '_need_holder_still': ['HOLDER_MOVING'], '_need_camera_view': ['BEAM_NOT_READY', 'SCREEN_DOWN'], + '_need_stage': ['PLANT_REQUIRED', 'POWER_OFF', 'NOT_READY', 'ERROR_PENDING', 'ACQUISITION_RUNNING', 'HOLDER_MOVING', 'HOLDER_NOT_IN_COLUMN'], + '_need_acquire': ['PLANT_REQUIRED', 'POWER_OFF', 'NOT_READY', 'ERROR_PENDING', 'ACQUISITION_RUNNING', 'HOLDER_MOVING', 'BEAM_NOT_READY', + 'SCREEN_DOWN', 'STAGE_MOVING', 'RECORDS_FULL']} + for k in rt.CAPS: + if k in rt.UNSUPPORTED: + continue + m = re.search(r' def _cmd_' + k.replace('.', '_') + r'\(.*?(?=\n def |\Z)', src, re.S) + self.assertIsNotNone(m, k) + body = m.group(0) + codes = set(re.findall(r"ActionRejected\('([A-Z_]+)'\)", body)) + for hname, hcodes in helpers.items(): + if hname + '(' in body: + codes |= set(hcodes) + if '_cmd_power_set(' in body: + codes |= {'PLANT_REQUIRED', 'MAINS_OUT_OF_RANGE'} + if '_cmd_screen_set(' in body: + codes |= {'PLANT_REQUIRED', 'POWER_OFF', 'NOT_READY', 'ERROR_PENDING', 'ACQUISITION_RUNNING'} + declared = {e['code'] for e in meta[k]['errors']} + self.assertLessEqual(codes, declared, (k, sorted(codes - declared))) + + def test_unsupported_capabilities_report_unsupported(self): + h = configured() + h.register_principal('a', 'agent') + s = h.session('a') + for k in rt.UNSUPPORTED: + r = s.invoke(instance_id=h.instance_id, capability_id=k, arguments={}, request_id='u-' + k) + self.assertEqual(r['status'], 'unsupported', k) + self.assertEqual(r['error']['code'], 'UNSUPPORTED') + + +class HostClockAndPurity(unittest.TestCase): + def test_read_and_describe_do_not_advance_time(self): + h = inserted() + h.register_principal('a', 'agent') + t, rev = h.time_ns, h.revision + h.read('evaluator') + s = h.session('a') + s.read(instance_id=h.instance_id) + s.describe(instance_id=h.instance_id) + self.assertEqual((h.time_ns, h.revision), (t, rev)) + + def test_step_zero_and_negative(self): + h = configured() + rev = h.revision + h.step(0.0) + self.assertEqual(h.revision, rev) + with self.assertRaises(rt.ActionRejected): + h.step(-1.0) + + def test_host_step_chopping_does_not_change_the_result(self): + def run(chunks): + h = configured(seed=5) + h.rng = QuietRng() + h.invoke('specimen.provide', **AU) + h.invoke('power.set', enabled=True) + h.invoke('holder.load_grid', holder_id='quick_change', specimen_id=AU['specimen_id']) + h.invoke('holder.insert_to_airlock', holder_id='quick_change') + h.invoke('airlock.set_pump', pump=True) + for dt in chunks: + h.step(dt) + return h.read('evaluator'), h.ledger() + (a, la), (b, lb) = run([300.0]), run([0.37] * 810 + [0.3]) + for k in ('truth.column_pressure_pa', 'truth.gun_pressure_pa', 'truth.airlock_pressure_pa', 'vacuum.state', 'airlock.state', 'holder.position', + 'holder.withdrawal_m', 'truth.tmp_speed_fraction', 'system.state'): + if isinstance(a[k], float): + self.assertAlmostEqual(a[k], b[k], delta=1e-9 * max(abs(a[k]), 1e-12), msg=k) + else: + self.assertEqual(a[k], b[k], k) + self.assertAlmostEqual(la['gas_pumped_mol'], lb['gas_pumped_mol'], delta=1e-12 * la['gas_pumped_mol']) + + def test_beam_dose_does_not_depend_on_the_host_step(self): + def run(chunks): + h = inserted(seed=3) + h.rng = QuietRng() + h.invoke('stage.move_xy', x_m=2e-5, y_m=-1e-5) + for dt in chunks: + h.step(dt) + return h.read('evaluator') + a, b = run([20.0]), run([0.25] * 80) + for k in ('stage.x_m', 'stage.y_m', 'truth.view_center_dose_c_m2', 'truth.filament_on_time_s'): + self.assertAlmostEqual(a[k], b[k], delta=1e-9 * max(abs(a[k]), 1e-15), msg=k) + + def test_set_points_only_write_targets(self): + h = inserted() + x0, y0 = h.stage['x'], h.stage['y'] + h.invoke('stage.move_xy', x_m=x0 + 1e-4, y_m=y0) + self.assertEqual(h.stage['x'], x0) + self.assertEqual(h.stage_target['x'], x0 + 1e-4) + h.step(1.0) + self.assertAlmostEqual(h.stage['x'], x0 + rt.STAGE_XY_SPEED * 1.0, places=15) + h.invoke('ht.set_voltage', voltage_v=80000.0) + self.assertEqual(h.kv_act, 120000.0) + h.step(10.0) + self.assertAlmostEqual(h.kv_act, 110000.0, places=6) + h.invoke('screen.set', up=True) + self.assertEqual(h.screen_angle, 0.0) + h.step(0.25) + self.assertAlmostEqual(h.screen_angle, rt.SCREEN_UP_ANGLE_RAD / 2.0, places=12) + + +class StartUpVacuumAndGun(unittest.TestCase): + def test_start_up_times(self): + h = configured() + h.invoke('power.set', enabled=True) + h.step(rt.SOFTWARE_BOOT_S - 1.0) + self.assertEqual(h.state, 'booting') + rejected(h, 'ht.set_on', 'NOT_READY', on=True) + h.step(2.0) + self.assertEqual(h.state, 'ready') + self.assertEqual(h.vac_state, 'pumping') # the turbo pump is still spinning up + rejected(h, 'ht.set_on', 'VACUUM_NOT_READY', on=True) + h.step(150.0) + self.assertEqual(h.vac_state, 'ready') + self.assertLess(h.p_col, rt.COL_READY_PA) + self.assertLess(h.p_gun, rt.GUN_READY_PA) + self.assertAlmostEqual(h.p_col, rt.Q_COLUMN_PA_M3_S / rt.S_TMP_M3_S, delta=0.05 * rt.Q_COLUMN_PA_M3_S / rt.S_TMP_M3_S) + + def test_high_tension_ramp_and_dark_current(self): + h = ready(ht=False) + h.invoke('ht.set_voltage', voltage_v=80000.0) + h.invoke('ht.set_on', on=True) + h.step(40.0) + self.assertAlmostEqual(h.kv_act, 40000.0, places=6) # 1 kV/s + h.step(45.0) + r = h.read() + self.assertEqual(r['ht.voltage_indicated_v'], 80000.0) + self.assertAlmostEqual(r['gun.dark_current_indicated_a'], 44e-6, delta=2e-6) # facility: 44 uA +- 2 uA at 80 kV + h.invoke('ht.set_voltage', voltage_v=120000.0) + h.step(45.0) + self.assertAlmostEqual(h.read()['gun.dark_current_indicated_a'], 66e-6, delta=2e-6) # 66 uA +- 2 uA at 120 kV + self.assertEqual(h.read()['ht.voltage_indicated_v'], 120000.0) # the monitor shows it as 120 kV + self.assertAlmostEqual(rt.quantize_kv(80020.0) % rt.KV_STEP_V, 0.0, delta=1e-6) + self.assertEqual(rt.quantize_kv(5000.0), 10000.0) + + def test_filament_bias_and_beam_current(self): + h = ready() + h.invoke('filament.set_on', on=True) + h.step(10.0) + self.assertEqual(h.read()['filament.state'], 'heating') + h.step(12.0) + r = h.read() + self.assertEqual(r['filament.state'], 'saturated') + above = r['gun.beam_current_indicated_a'] - r['gun.dark_current_indicated_a'] + self.assertTrue(5e-6 <= above <= 7e-6, above) # facility: 5-7 uA above the dark current at bias 40 + self.assertTrue(r['panel.beam_lamp']) + diffs = [] + for _ in range(300): # the meter fluctuates, but beam - dark stays inside the SOP window every cycle + h.step(1.0) + r = h.read() + diffs.append(r['gun.beam_current_indicated_a'] - r['gun.dark_current_indicated_a']) + self.assertTrue(all(5e-6 <= d <= 7e-6 for d in diffs), (min(diffs), max(diffs))) + self.assertLess(np.std(diffs), 0.2e-6) + h.invoke('filament.set_bias', bias=20.0) + h.step(1.0) + self.assertGreater(h.read()['gun.beam_current_indicated_a'] - h.read()['gun.dark_current_indicated_a'], 9e-6) + + def test_ht_needs_cooling_water_and_trips_on_gun_vacuum(self): + h = ready(ht=False, cooling_water_m3_s=2.0 / 60000.0) + rejected(h, 'ht.set_on', 'COOLING_WATER_LOW', on=True) + h = inserted() + camera(h) + op = h.invoke('image.acquire', exposure_s=5.0, binning=1)['operation_id'] + h.step(1.0) + h.p_gun = 1e-3 # fault injection: a gun leak (no public command reaches the trip) + h.step(1.0) + self.assertEqual(h.error, 'HT_TRIP') + self.assertFalse(h.ht_on) + self.assertEqual(h.images[h.operations[op]['record_id']]['status'], 'failed') + rejected(h, 'ht.set_on', 'ERROR_PENDING', on=True) + h.invoke('error.acknowledge') + h.step(60.0) + h.invoke('ht.set_on', on=True) + + def test_power_cycle_and_mains(self): + h = configured(mains_voltage_v=170.0) + rejected(h, 'power.set', 'MAINS_OUT_OF_RANGE', enabled=True) + rejected(h, 'power.key_toggle', 'MAINS_OUT_OF_RANGE') + h = configured() + self.assertTrue(h.invoke('power.key_toggle')['enabled']) + self.assertTrue(h.read()['panel.power_lamp']) + self.assertFalse(h.invoke('power.key_toggle')['enabled']) + self.assertEqual((h.state, h.vac_state), ('off', 'idle')) + h = inserted() + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, mains_voltage_v=250.0)) + h.step(1.0) + self.assertFalse(h.power) + self.assertEqual(h.error, 'MAINS_FAULT') + self.assertEqual(h.vac_state, 'idle') + p = h.p_col + h.step(600.0) + self.assertGreater(h.p_col, p) # valves closed: the column leaks slowly + self.assertLess(h.p_col, 0.1) + + def test_burnout_and_replacement(self): + h = ready() + h.invoke('filament.set_on', on=True) + h.step(25.0) + h.fil_used_s = h.fil_life_s - 0.5 + h.step(1.0) + self.assertEqual((h.fil_burned, h.error), (True, 'FILAMENT_BURNOUT')) + rejected(h, 'gun.replace_filament', 'HT_ON') + h.invoke('ht.set_on', on=False) + n = h.invoke('gun.replace_filament')['filament_serial'] + self.assertEqual((n, h.fil_burned, h.fil_used_s, h.error), (2, False, 0.0, None)) + + def test_filament_life_is_weibull_around_150_hours(self): + lives = [] + for seed in range(400): + h = rt.JeolJem1400flashRuntime() + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, noise_seed=seed)) + lives.append(h.fil_life_s) + self.assertAlmostEqual(np.mean(lives) / 3600.0, rt.FILAMENT_LIFE_H, delta=0.08 * rt.FILAMENT_LIFE_H) + + +class SpecimenExchange(unittest.TestCase): + def test_airlock_evacuation_insertion_and_removal(self): + h = ready() + h.invoke('specimen.provide', **AU) + h.invoke('holder.load_grid', holder_id='quick_change', specimen_id=AU['specimen_id']) + h.invoke('holder.insert_to_airlock', holder_id='quick_change') + self.assertEqual(h.holder_pos, 'entering') + rejected(h, 'holder.insert', 'HOLDER_NOT_AT_AIRLOCK') + h.step(11.0) + self.assertEqual((h.holder_pos, h.read()['airlock.state']), ('airlock', 'vented')) + rejected(h, 'holder.insert', 'AIRLOCK_NOT_EVACUATED') + h.invoke('airlock.set_pump', pump=True) + h.step(30.0) + self.assertEqual(h.read()['airlock.state'], 'pumping') + self.assertFalse(h.read()['panel.airlock_lamp']) + h.step(15.0) + self.assertEqual(h.read()['airlock.state'], 'evacuated') # about 40 s to 5 Pa + self.assertTrue(h.read()['panel.airlock_lamp']) + p0 = h.p_col + h.invoke('holder.insert') + self.assertGreater(h.p_col, p0) # the airlock gas joins the column + h.step(3.0) + self.assertEqual(h.holder_pos, 'column') + self.assertTrue(h.ht_on) # the short pressure rise does not trip the gun + h.step(20.0) + self.assertEqual(h.vac_state, 'ready') + h.invoke('filament.set_on', on=True) + h.step(25.0) + rejected(h, 'holder.withdraw', 'FILAMENT_ON') + h.invoke('filament.set_on', on=False) + h.invoke('stage.move_xy', x_m=1e-5, y_m=0.0) + h.step(1.0) + rejected(h, 'holder.withdraw', 'STAGE_NOT_NEUTRAL') + h.invoke('stage.neutral') + h.step(1.0) + h.invoke('holder.withdraw') + h.step(2.0) + self.assertEqual(h.holder_pos, 'airlock') + rejected(h, 'holder.remove', 'AIRLOCK_NOT_VENTED') + h.invoke('airlock.set_pump', pump=False) + h.step(15.0) + self.assertEqual(h.read()['airlock.state'], 'vented') + h.invoke('holder.remove') + h.step(11.0) + self.assertEqual((h.holder_pos, h.holder_in), ('bench', None)) + self.assertEqual(h.invoke('holder.unload_grid', holder_id='quick_change')['specimen_id'], AU['specimen_id']) + self.assertIn(AU['specimen_id'], h.read()['specimen.bench_ids']) + led = h.ledger() + self.assertEqual(led['airlock_cycles'], 1.0) + self.assertLess(abs(led['gas_residual_mol']), 1e-12 + 1e-9 * led['gas_admitted_mol']) + + def test_exchange_preconditions(self): + h = ready() + h.invoke('specimen.provide', **AU) + rejected(h, 'holder.unload_grid', 'HOLDER_EMPTY', holder_id='quick_change') + rejected(h, 'holder.load_grid', 'UNKNOWN_SPECIMEN', holder_id='quick_change', specimen_id='nope') + h.invoke('holder.load_grid', holder_id='quick_change', specimen_id=AU['specimen_id']) + rejected(h, 'holder.load_grid', 'SPECIMEN_NOT_ON_BENCH', holder_id='high_tilt', specimen_id=AU['specimen_id']) + h.invoke('filament.set_on', on=True) + rejected(h, 'holder.insert_to_airlock', 'FILAMENT_ON', holder_id='quick_change') + h.invoke('filament.set_on', on=False) + h.invoke('holder.insert_to_airlock', holder_id='quick_change') + rejected(h, 'holder.insert_to_airlock', 'GONIOMETER_OCCUPIED', holder_id='high_tilt') + rejected(h, 'filament.set_on', 'HOLDER_MOVING', on=True) + rejected(h, 'stage.neutral', 'HOLDER_MOVING') + rejected(h, 'holder.load_grid', 'HOLDER_IN_GONIOMETER', holder_id='quick_change', specimen_id=AU['specimen_id']) + + def test_tilt_limits_of_the_holders(self): + h = inserted() + rejected(h, 'stage.set_tilt', 'TILT_OUT_OF_RANGE', tilt_rad=math.radians(25.0)) + h.invoke('stage.set_tilt', tilt_rad=math.radians(-20.0)) + h.step(12.0) + self.assertAlmostEqual(h.read()['stage.tilt_indicated_rad'], math.radians(-20.0), places=9) + h2 = inserted(holder='high_tilt') + h2.invoke('stage.set_tilt', tilt_rad=math.radians(70.0)) + h2.step(40.0) + self.assertAlmostEqual(math.degrees(h2.stage['tilt']), 70.0, places=9) + with self.assertRaises(rt.ActionRejected): # outside the input schema (+-70 deg) + h2.invoke('stage.set_tilt', tilt_rad=math.radians(71.0)) + + def test_specimen_validation(self): + h = configured() + rejected(h, 'specimen.provide', 'SUPPORT_REQUIRED', **grid('a', [phase('gold')], support='none')) + rejected(h, 'specimen.provide', 'SUPPORT_INVALID', **dict(grid('b', []), support_thickness_m=0.0)) + rejected(h, 'specimen.provide', 'UNKNOWN_SUBSTANCE', **grid('c', [phase('unobtainium')])) + rejected(h, 'specimen.provide', 'CRYSTALLINITY_INVALID', **grid('d', [phase('polystyrene', cryst='single_crystal')])) + rejected(h, 'specimen.provide', 'ZONE_AXIS_INVALID', **grid('e', [phase('silicon', form='film', size=1e-6, cov=1.0, cryst='polycrystalline', zone=[0, 0, 1])])) + rejected(h, 'specimen.provide', 'STAIN_INVALID', **grid('f', [phase('gold', stain=0.1)])) + rejected(h, 'specimen.provide', 'COVERAGE_TOO_HIGH', **grid('g', [phase('gold', cov=0.5)])) + rejected(h, 'specimen.provide', 'COVERAGE_INVALID', **grid('h', [phase('gold', cov=0.0)])) + h.invoke('specimen.provide', **AU) + rejected(h, 'specimen.provide', 'SPECIMEN_EXISTS', **AU) + + +class OpticsAndImaging(unittest.TestCase): + def test_modes_and_magnification_steps(self): + h = ready() + h.invoke('optics.set_mode', mode='LOW_MAG') + self.assertEqual(h.invoke('optics.set_magnification', magnification=5000.0)['magnification'], 1000.0) # LOW MAG up to x1,000 + self.assertEqual(h.invoke('optics.set_magnification', magnification=10.0)['magnification'], 10.0) + rejected(h, 'optics.set_mode', 'NOT_IN_MAG_MODE', mode='DIFF') + rejected(h, 'optics.toggle_diffraction', 'NOT_IN_MAG_MODE') + h.invoke('optics.set_mode', mode='MAG') + self.assertEqual(h.invoke('optics.set_magnification', magnification=1.5e6)['magnification'], 1.5e6) # HR x1,500,000 + self.assertEqual(h.invoke('optics.set_magnification', magnification=50.0)['magnification'], 200.0) # MAG from x200 + h.invoke('optics.toggle_diffraction') + self.assertEqual(h.mode, 'DIFF') + rejected(h, 'optics.set_magnification', 'DIFF_MODE', magnification=1000.0) + self.assertEqual(h.invoke('optics.set_camera_length', camera_length_m=0.33)['camera_length_m'], 0.30) + self.assertEqual(h.read()['display.mag_or_camera_length_text'], '300') # mm on the display + out = h.invoke('optics.set_magnification_step_fraction', fraction=1.0) + self.assertEqual((out['magnification'], out['camera_length_m']), (None, rt.CAMERA_LENGTHS_M[-1])) + self.assertEqual(h.read()['optics.camera_length_m'], rt.CAMERA_LENGTHS_M[-1]) + self.assertEqual(h.read()['display.mag_or_camera_length_text'], '3000') + h.invoke('optics.toggle_diffraction') + self.assertEqual(h.mode, 'MAG') + + def test_magnification_knob_keeps_the_hand_position(self): + h = ready() + n = len(rt.MAG_STEPS) - 1 + frac = (rt.MAG_STEPS.index(30000) + 0.3) / n # a hand turn between two detents + out = h.invoke('optics.set_magnification_step_fraction', fraction=frac) + self.assertEqual((out['fraction'], out['magnification']), (frac, 30000.0)) + self.assertEqual(h.read()['optics.magnification_step_fraction'], frac) # the knob stays where it was left + h.invoke('optics.set_magnification', magnification=5000.0) # a selected step puts the knob on its detent + self.assertEqual(h.read()['optics.magnification_step_fraction'], rt.MAG_STEPS.index(5000) / n) + + def test_illumination_current_and_screen_reading(self): + h = inserted() + I1 = h._specimen_current() + h.invoke('optics.set_spot_size', spot=3) + self.assertAlmostEqual(h._specimen_current() / I1, 0.25, places=12) + h.invoke('aperture.set_condenser', inserted=False) + self.assertAlmostEqual(h._specimen_current() / I1, 0.75, places=12) + h.invoke('optics.set_spot_size', spot=1) + h.invoke('aperture.set_condenser', inserted=True) + h.invoke('optics.set_brightness', value=0.5) + d0 = h._illum_d() + self.assertAlmostEqual(d0, rt.ILLUM_D_MIN_M, places=15) + h.invoke('optics.set_brightness', value=1.0) + self.assertAlmostEqual(h._illum_d(), rt.ILLUM_D_MAX_M, places=15) + h.invoke('optics.set_brightness', value=0.53) + h.step(2.0) + r = h.read() + j1 = r['illumination.screen_current_density_a_m2'] + self.assertIsNotNone(j1) + h.invoke('optics.set_magnification', magnification=60000.0) + h.step(1.0) + self.assertAlmostEqual(h.read()['illumination.screen_current_density_a_m2'] / j1, (30000.0 / 60000.0) ** 2, delta=0.12) # 1/M^2 (3 % noise) + self.assertTrue(h.invoke('screen.toggle')['up']) # F1 + h.step(0.2) + self.assertTrue(h.read()['screen.moving']) + rejected(h, 'image.acquire', 'SCREEN_DOWN', exposure_s=0.1, binning=1) # still turning + h.step(0.8) + self.assertIsNone(h.read()['illumination.screen_current_density_a_m2']) + + def test_mass_thickness_contrast(self): + """Amorphous transmission follows exp(-t / x_k): thicker, heavier, smaller aperture and lower voltage all darken.""" + c10, c20 = transmission('amorphous_carbon', 10e-9), transmission('amorphous_carbon', 20e-9) + self.assertAlmostEqual(c20, c10 ** 2, places=12) + self.assertTrue(0.95 < c10 < 0.99, c10) # a 10 nm carbon film is nearly transparent at 120 kV + self.assertLess(transmission('gold', 10e-9), 0.5) + self.assertLess(transmission('amorphous_carbon', 10e-9, alpha=5e-3), transmission('amorphous_carbon', 10e-9, alpha=30e-3)) + self.assertLess(transmission('amorphous_carbon', 50e-9, v=60000.0), transmission('amorphous_carbon', 50e-9, v=120000.0)) + # a stained section is darker than an unstained one of the same thickness + h = inserted(specimen=grid('sec', [phase('epoxy_resin', form='section', size=1e-6, t=7e-8, cov=1.0, cryst='amorphous', stain=0.15)], support='formvar', + t_support=2e-8, mesh='300')) + h2 = inserted(specimen=grid('sec', [phase('epoxy_resin', form='section', size=1e-6, t=7e-8, cov=1.0, cryst='amorphous')], support='formvar', + t_support=2e-8, mesh='300')) + f1, f2 = h._view_fractions(), h2._view_fractions() + self.assertLess(f1['T_view'], f2['T_view']) + + def test_diffraction_contrast_and_extinction_distances(self): + """Two-beam extinction distances from the library structure factors agree with the tabulated values (100 kV).""" + lit = {('gold', (1, 1, 1)): 18.3e-9, ('aluminium', (1, 1, 1)): 55.6e-9, ('silicon', (2, 2, 0)): 75.7e-9} + for (sid, hkl), ref in lit.items(): + cr = rt.substance(sid)['crystal'] + r = [x for x in cr['_refl'] if tuple(x['hkl']) == hkl][0] + self.assertAlmostEqual(rt.extinction_distance(cr, r, 100000.0) / ref, 1.0, delta=0.08, msg=sid) + # a crystal in the Bragg condition diffracts strongly out of a small aperture: pendellosung at t = xi / 2 + xi = 20e-9 + self.assertAlmostEqual(rt.two_beam_intensity(xi / 2.0, 0.0, xi), 1.0, places=12) + self.assertLess(rt.two_beam_intensity(xi / 2.0, 0.2e9, xi), 0.05) + + def test_image_counts_regions_and_noise(self): + h = camera(inserted(), mag=30000.0) + img = acquire_image(h, exposure=1.0) + self.assertEqual(img['status'], 'completed') + self.assertEqual(len(img['thumbnail']), rt.THUMB) + self.assertAlmostEqual(img['field_of_view_m'], 2048 * 21.7e-6 / 30000.0, places=15) + self.assertAlmostEqual(img['pixel_size_m'], 21.7e-6 / 30000.0, places=15) + self.assertGreaterEqual(len(img['regions']), 2) + self.assertFalse(any('gold' in json.dumps(r) or 'carbon' in json.dumps(r) for r in img['regions'])) + self.assertEqual(img['template_source']['library'], rt.LIBRARY_REL) + bright = img['regions'][0] + dose = h._current_density() * 1.0 / rt.E_CHARGE # incident dose (evaluator truth) + expected = dose * (21.7e-6 / 30000.0) ** 2 * rt.ADU_PER_ELECTRON + self.assertTrue(0.8 * expected < bright['mean_counts'] <= expected * 1.0001, (bright['mean_counts'], expected)) + est = img['dose_estimate_e_per_m2'] # camera estimate: brightest 1 % of the frame (film, no holes): below the dose + self.assertTrue(0.7 * dose < est < 1.02 * dose and est != dose, (est, dose)) + img4 = acquire_image(h, exposure=4.0) + self.assertAlmostEqual(img4['regions'][0]['mean_counts'] / bright['mean_counts'], 4.0, delta=0.2) + self.assertAlmostEqual(img4['regions'][0]['snr'] / bright['snr'], 2.0, delta=0.2) # Poisson: SNR ~ sqrt(dose) + imgb = acquire_image(h, exposure=1.0, binning=2) + self.assertAlmostEqual(imgb['regions'][0]['mean_counts'] / bright['mean_counts'], 4.0, delta=0.2) + h.invoke('optics.set_brightness', value=0.5) # condensed to the crossover: most of the frame is dark + dark = acquire_image(h, exposure=0.001) + self.assertGreater(max(r['area_fraction_in_view'] for r in dark['regions'] if r['mean_counts'] == 0.0), 0.9) + + def test_lattice_fringes_need_resolution_and_the_aperture(self): + h = camera(inserted(specimen=grid('auz', [phase('gold', zone=[1, 1, 0])])), mag=300000.0, ol=0) # [110] particles: {111} and {200} excited + h.invoke('optics.set_brightness', value=0.5) # crossover (2 mrad) and the grid height away from focus: washed out + img0 = acquire_image(h, exposure=0.5) + self.assertFalse([x for r in img0['regions'] for x in r['lattice_spacings_m']]) + h.invoke('optics.set_brightness', value=0.505) + h.invoke('optics.auto_focus') # near focus the spatial-coherence envelope passes the fringes + img = acquire_image(h, exposure=0.5) + d = sorted({x for r in img['regions'] for x in r['lattice_spacings_m']}) + self.assertTrue(d, img['regions']) + gold = {round(x['d'], 12) for x in rt.substance('gold')['crystal']['_refl']} + self.assertTrue(all(round(x, 12) in gold for x in d), d) + self.assertTrue(all(x >= rt.LATTICE_RESOLUTION_M for x in d)) + h.invoke('aperture.set_objective', position=4) # 20 um: 5 mrad < 2 theta of Au 111 (14 mrad) + img2 = acquire_image(h, exposure=0.5) + self.assertFalse([x for r in img2['regions'] for x in r['lattice_spacings_m']]) + h.invoke('aperture.set_objective', position=0) + h.invoke('optics.set_magnification', magnification=50000.0) # Nyquist 0.87 nm > 0.235 nm + img3 = acquire_image(h, exposure=0.5) + self.assertFalse([x for r in img3['regions'] for x in r['lattice_spacings_m']]) + + def test_thon_rings_follow_the_defocus(self): + h = camera(inserted(specimen=grid('c', [], t_support=2e-8)), mag=150000.0, ol=0) + h.invoke('optics.set_brightness', value=0.503) + h.invoke('optics.auto_focus') + self.assertLess(abs(h._defocus_true()), 5 * rt.AUTOFOCUS_SD_M) + h.invoke('optics.set_defocus', defocus_m=h.dz_display + 2e-6) + img = acquire_image(h, exposure=1.0) + k = img['thon_ring_frequencies_per_m'] + self.assertTrue(k, img) + lam = rt.wavelength_m(120000.0) + self.assertAlmostEqual(k[0], 1.0 / math.sqrt(lam * 2e-6), delta=0.05 / math.sqrt(lam * 2e-6)) # first zero ~ (lambda dz)^-1/2 + h.invoke('optics.set_defocus', defocus_m=h.dz_display - 2e-6 + 4e-6) + k2 = acquire_image(h, exposure=1.0)['thon_ring_frequencies_per_m'] + self.assertLess(k2[0], k[0]) # more defocus: the rings contract + + def test_eucentric_height_tilt_shift_and_standard_focus(self): + h = inserted() + h.invoke('stage.set_z', z_m=2e-5) + h.step(3.0) + h.invoke('optics.standard_focus') + hgt = h._spec()['_mount']['h'] + 2e-5 + self.assertAlmostEqual(h._defocus_true(), -hgt, places=15) # specimen above the eucentric plane: overfocus + h.invoke('stage.set_tilt', tilt_rad=math.radians(10.0)) + h.step(6.0) + cu, cv, t, h_axis = h._geometry() + self.assertAlmostEqual(cv - h.stage['y'], hgt * math.tan(math.radians(10.0)), places=15) # the image moves h tan(tilt) + self.assertAlmostEqual(h_axis, hgt / math.cos(math.radians(10.0)), places=15) + + def test_auto_focus_and_exposure_need_a_view(self): + h = inserted() + rejected(h, 'optics.auto_focus', 'SCREEN_DOWN') + camera(h) + e = h.invoke('camera.auto_exposure') + self.assertTrue(0.001 <= e['exposure_s'] <= 60.0) + h.invoke('optics.toggle_diffraction') + rejected(h, 'optics.auto_focus', 'NOT_IN_MAG_MODE') + rejected(h, 'image.acquire', 'DIFF_MODE', exposure_s=1.0, binning=1) + + def test_low_mag_shows_the_grid_and_the_objective_aperture_blocks_it(self): + h = camera(inserted(), mag=100.0, ol=0) + h.invoke('optics.set_mode', mode='LOW_MAG') + h.invoke('optics.set_magnification', magnification=100.0) + h.invoke('optics.set_brightness', value=1.0) + img = acquire_image(h, exposure=0.1) + dark = sum(r['area_fraction_in_view'] for r in img['regions'] if r['mean_counts'] < 0.05 * img['regions'][0]['mean_counts']) + mesh = rt.GRID_MESH[200] + bars = 1.0 - ((mesh['pitch'] - mesh['bar']) / mesh['pitch']) ** 2 + self.assertAlmostEqual(dark, bars, delta=0.12) # 200 mesh: about half of the area is bars + h.invoke('aperture.set_objective', position=2) + img2 = acquire_image(h, exposure=0.1) + dark2 = sum(r['area_fraction_in_view'] for r in img2['regions'] if r['mean_counts'] < 0.05 * max(1e-9, img['regions'][0]['mean_counts'])) + self.assertGreater(dark2, 0.95) # facility: no beam in LOW MAG with the objective aperture in + + +class Diffraction(unittest.TestCase): + def test_polycrystalline_rings_and_camera_length_calibration(self): + al = grid('al', [phase('aluminium', form='film', size=2e-8, t=3e-8, cov=1.0, cryst='polycrystalline')]) + h = inserted(specimen=al) + h.invoke('aperture.set_selected_area', position=1) + h.invoke('optics.set_brightness', value=0.9) + h.invoke('optics.toggle_diffraction') + h.invoke('screen.set', up=True) + h.step(1.0) + p = acquire_pattern(h) + self.assertGreaterEqual(len(p['rings']), 5) + self.assertEqual(p['spots'], []) + refl = rt.substance('aluminium')['crystal']['_refl'] + ratios = [] + for ring in p['rings'][:5]: + true_d = min((x['d'] for x in refl), key=lambda d: abs(d - ring['d_spacing_display_m'] * (1 + h.cl_err))) + ratios.append(ring['d_spacing_display_m'] / true_d) + self.assertLess(max(ratios) - min(ratios), 2e-3) # one calibration constant for all rings + self.assertAlmostEqual(np.mean(ratios), 1.0 / (1.0 + h.cl_err), delta=2e-3) + strongest = max(p['rings'], key=lambda r: r['relative_intensity']) + self.assertAlmostEqual(strongest['d_spacing_display_m'] * (1 + h.cl_err), 0.2338e-9, delta=0.003e-9) # Al 111 + self.assertEqual(p['halos'][0]['relative_intensity'] > 0.0, True) + self.assertAlmostEqual(p['selected_area_diameter_m'], 100e-6 / 30.0, places=15) + + def test_single_crystal_zone_axis_spots(self): + si = grid('si', [phase('silicon', form='film', size=1e-6, t=5e-8, cov=1.0, cryst='single_crystal', zone=[0, 0, 1])], support='none') + h = inserted(specimen=si) + h.invoke('aperture.set_selected_area', position=3) + h.invoke('optics.set_brightness', value=0.9) + h.invoke('optics.toggle_diffraction') + h.invoke('screen.set', up=True) + h.step(1.0) + p = acquire_pattern(h) + self.assertEqual(p['rings'], []) + self.assertGreater(len(p['spots']), 4) + lam, L = rt.wavelength_m(120000.0), h._camera_length_true() + radii = sorted({round(math.hypot(s['x_m'], s['y_m']) / (L * lam), -6) for s in p['spots']}) + g220 = 1.0 / 0.19201e-9 + self.assertTrue(any(abs(r - g220) < 0.02 * g220 for r in radii), radii) # {220} of the [001] zone + g200 = 1.0 / 0.27155e-9 + self.assertFalse(any(abs(r - g200) < 0.02 * g200 for r in radii)) # 200 is kinematically forbidden in diamond Si + + def test_amorphous_halo_and_objective_aperture_truncation(self): + h = inserted(specimen=grid('pc', [phase('polystyrene', form='film', size=1e-6, t=3e-8, cov=1.0, cryst='amorphous')])) + h.invoke('optics.toggle_diffraction') + h.invoke('screen.set', up=True) + h.step(1.0) + p = acquire_pattern(h) + self.assertEqual((p['rings'], p['spots']), ([], [])) + self.assertTrue(p['halos']) + h2 = inserted() + h2.invoke('optics.set_brightness', value=0.9) + h2.invoke('optics.toggle_diffraction') + h2.invoke('screen.set', up=True) + h2.step(1.0) + full = acquire_pattern(h2) + h2.invoke('aperture.set_objective', position=4) + cut = acquire_pattern(h2) + self.assertLess(len(cut['rings']), len(full['rings'])) + self.assertTrue(all(r['radius_m'] < h2._camera_length_true() * math.tan(20e-6 / (2 * rt.OBJ_FOCAL_M)) for r in cut['rings'])) + + +class BeamDamage(unittest.TestCase): + def test_formvar_loses_mass_under_an_intense_beam(self): + h = inserted(specimen=grid('fv', [], support='formvar', t_support=5e-8, mesh='400')) + camera(h, mag=30000.0) + x, y = open_square(h, (3e-4, 3e-4)) + h.invoke('optics.set_brightness', value=1.0) # beam spread to 200 um while the stage travels (negligible dose) + h.invoke('stage.move_xy', x_m=x, y_m=y) # a fresh area + h.step(10.0) + h.invoke('optics.set_brightness', value=0.53) + d0 = h.read('evaluator')['truth.view_center_dose_c_m2'] + t0 = acquire_image(h, exposure=1.0)['regions'][0]['mean_counts'] # spread beam (about 12 um): a few C/m^2 + h.invoke('optics.set_brightness', value=0.505) # condensed to about 2 um for 30 s + h.step(30.0) + h.invoke('optics.set_brightness', value=0.53) + d1 = h.read('evaluator')['truth.view_center_dose_c_m2'] + self.assertLess(d0, 50.0) + self.assertGreater(d1, 1e4) # far above Formvar's characteristic dose (~400 C/m^2 at 120 kV) + t1 = acquire_image(h, exposure=1.0)['regions'][0]['mean_counts'] + T0, T1 = transmission('formvar', 5e-8), transmission('formvar', 0.7 * 5e-8) + self.assertAlmostEqual(t1 / t0, T1 / T0, delta=0.01) # 30 % mass loss (residual 0.7): the film transmits more + + def test_halide_crystallinity_fades_gold_does_not(self): + def rings(sub): + h = inserted(specimen=grid(sub, [phase(sub, form='film', size=2e-8, t=4e-8, cov=1.0, cryst='polycrystalline')])) + h.invoke('optics.set_brightness', value=0.51) # about 4 um: the diffracting area is the damaged area + h.invoke('optics.toggle_diffraction') + h.invoke('screen.set', up=True) + h.step(1.0) + p0 = acquire_pattern(h) + h.step(300.0) # about 3 characteristic doses of the halide at 120 kV + p1 = acquire_pattern(h) + halo = lambda p: sum(x['relative_intensity'] for x in p['halos']) # noqa: E731 + return p0, p1, halo(p0), halo(p1) + _, _, h0, h1 = rings('halite') + self.assertGreater(h1, h0) # radiolysis turns Bragg scattering into diffuse scattering + g0, g1, gh0, gh1 = rings('gold') + self.assertEqual(len(g0['rings']), len(g1['rings'])) + self.assertAlmostEqual(gh0, gh1, places=9) + + +class LedgersIsolationSessions(unittest.TestCase): + def test_charge_and_gas_ledgers_close(self): + h = camera(inserted()) + acquire_image(h) + h.invoke('optics.toggle_diffraction') + acquire_pattern(h) + h.invoke('optics.toggle_diffraction') + h.invoke('aperture.set_objective', position=0) + h.invoke('filament.set_on', on=False) + h.invoke('stage.neutral') + h.step(1.0) + h.invoke('holder.withdraw') + h.step(5.0) + h.invoke('airlock.set_pump', pump=False) + h.step(20.0) + h.invoke('holder.remove') + h.step(15.0) + led = h.ledger() + self.assertLess(abs(led['charge_residual_c']), 1e-18 + 1e-9 * led['beam_charge_c']) + self.assertLess(abs(led['gas_residual_mol']), 1e-15 + 1e-9 * led['gas_admitted_mol']) + self.assertGreater(led['grid_stopped_charge_c'], 0.0) + self.assertGreater(led['detector_charge_c'], 0.0) + self.assertGreater(led['gas_released_mol'], 0.0) + self.assertAlmostEqual(led['specimen_plane_charge_c'], led['grid_stopped_charge_c'] + led['objective_aperture_stopped_charge_c'] + led['detector_charge_c'], + delta=1e-9 * led['specimen_plane_charge_c']) + + def test_redeclared_room_temperature_keeps_the_gas_ledger(self): + h = inserted(beam=False) + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, room_k=300.15)) + h.step(30.0) + led = h.ledger() + self.assertLess(abs(led['gas_residual_mol']), 1e-15 + 1e-9 * led['gas_admitted_mol']) + + def test_two_instances_are_isolated(self): + a, b = inserted(seed=1), inserted(seed=1) + camera(a) + acquire_image(a) + self.assertEqual(b.images, {}) + self.assertNotEqual(a.read('evaluator'), b.read('evaluator')) + + def test_agent_does_not_see_truth(self): + h = inserted() + h.register_principal('a', 'agent') + h.register_principal('e', 'evaluator') + a, e = h.session('a'), h.session('e') + ra = a.read(instance_id=h.instance_id)['observations'] + re_ = e.read(instance_id=h.instance_id)['observations'] + self.assertFalse(any(k.startswith('truth.') for k in ra)) + self.assertTrue(any(k.startswith('truth.') for k in re_)) + with self.assertRaises(rt.ActionRejected): + a.read(instance_id=h.instance_id, state_ids=['truth.column_pressure_pa']) + d = a.describe(instance_id=h.instance_id) + self.assertNotIn('ledger.read', d['capabilities']) + self.assertNotIn('specimen.provide', d['capabilities']) + self.assertFalse(any(k.startswith('truth.') for k in d['state_slots'])) + r = a.invoke(instance_id=h.instance_id, capability_id='ledger.read', arguments={}, request_id='x') + self.assertEqual(r['error']['code'], 'ACCESS_DENIED') + camera(h) + rid = a.invoke(instance_id=h.instance_id, capability_id='image.acquire', arguments=dict(exposure_s=0.5, binning=1), request_id='i')['operation_id'] + h.step(2.0) + out = a.poll(rid)['result'] + self.assertEqual(out['template_source']['library'], rt.LIBRARY_REL) + self.assertNotIn('truth', json.dumps(out)) + + def test_records_and_control_belong_to_their_agent(self): + h = camera(inserted()) + for p in ('a1', 'a2'): + h.register_principal(p, 'agent') + s1, s2 = h.session('a1'), h.session('a2') + I = h.instance_id + r = s1.invoke(instance_id=I, capability_id='image.acquire', arguments=dict(exposure_s=3.0, binning=1), request_id='r1') + self.assertEqual(r['status'], 'accepted') + self.assertEqual(s1.invoke(instance_id=I, capability_id='image.acquire', arguments=dict(exposure_s=3.0, binning=1), request_id='r1'), r) + self.assertEqual(s1.invoke(instance_id=I, capability_id='image.acquire', arguments=dict(exposure_s=1.0, binning=1), + request_id='r1')['error']['code'], 'REQUEST_CONFLICT') + for cap, args in (('ht.set_voltage', dict(voltage_v=80000.0)), ('filament.set_on', dict(on=False)), ('aperture.set_objective', dict(position=0)), + ('holder.load_grid', dict(holder_id='high_tilt', specimen_id='x'))): + self.assertEqual(s2.invoke(instance_id=I, capability_id=cap, arguments=args, request_id='g-' + cap)['error']['code'], 'ACCESS_DENIED') + o2 = s2.read(instance_id=I)['observations'] + self.assertTrue(o2['acquisition.started_by_other_agent']['value']) + self.assertIsNone(o2['acquisition.id']['value']) + h.step(5.0) + rid = h.operations[r['operation_id']]['record_id'] + self.assertEqual(s2.invoke(instance_id=I, capability_id='image.result', arguments=dict(image_id=rid), request_id='x2')['error']['code'], 'ACCESS_DENIED') + self.assertEqual(s2.invoke(instance_id=I, capability_id='image.result', arguments=dict(image_id='img-99'), request_id='x3')['error']['code'], + 'UNKNOWN_RECORD') + self.assertEqual(s1.invoke(instance_id=I, capability_id='image.result', arguments=dict(image_id=rid), request_id='x4')['status'], 'succeeded') + self.assertEqual(s1.read(instance_id=I)['observations']['result.last_image_id']['value'], rid) + self.assertIsNone(s2.read(instance_id=I)['observations']['result.last_image_id']['value']) + self.assertEqual(s2.invoke(instance_id=I, capability_id='records.list', arguments={}, request_id='x5')['result']['images'], []) + with self.assertRaises(rt.ActionRejected): + s2.poll(r['operation_id']) + + def test_cancel_keeps_the_dose_and_discards_the_frame(self): + h = camera(inserted()) + h.register_principal('a', 'agent') + s = h.session('a') + r = s.invoke(instance_id=h.instance_id, capability_id='image.acquire', arguments=dict(exposure_s=10.0, binning=1), request_id='c1') + h.step(4.0) + q0 = h.ledger()['beam_charge_c'] + d0 = h.read('evaluator')['truth.view_center_dose_c_m2'] + c = s.cancel(r['operation_id'], 'c2') + self.assertEqual(c['result']['phase'], 'cancelled') + rec = h.images[h.operations[r['operation_id']]['record_id']] + self.assertEqual((rec['status'], rec['error_code'], rec['regions']), ('cancelled', 'USER_CANCEL', [])) + self.assertGreater(q0, 0.0) + self.assertEqual(h.ledger()['beam_charge_c'], q0) + self.assertEqual(h.read('evaluator')['truth.view_center_dose_c_m2'], d0) + self.assertIsNone(h.acq) + with self.assertRaises(rt.ActionRejected): + s.cancel(r['operation_id'], 'c3') + + def test_beam_off_and_power_off_fail_running_acquisitions(self): + h = camera(inserted()) + op = h.invoke('image.acquire', exposure_s=10.0, binning=1)['operation_id'] + h.step(2.0) + h.invoke('filament.set_on', on=False) + h.step(1.0) + rec = h.images[h.operations[op]['record_id']] + self.assertEqual((rec['status'], rec['error_code']), ('failed', 'BEAM_OFF')) + h = camera(inserted()) + h.invoke('optics.set_magnification', magnification=5000.0) + op = h.invoke('montage.acquire', rows=2, cols=2, overlap=0.1, exposure_s=0.5, binning=2)['operation_id'] + h.step(3.0) + h.invoke('power.set', enabled=False) + rec = h.montages[h.operations[op]['record_id']] + self.assertEqual((rec['status'], rec['error_code']), ('failed', 'POWER_OFF')) + + def test_montage_path_duration_and_return(self): + h = camera(inserted(), mag=5000.0) + x0 = h.stage['x'] + op = h.invoke('montage.acquire', rows=2, cols=3, overlap=0.1, exposure_s=0.5, binning=2)['operation_id'] + o = h.operations[op] + fov = 2048 * 21.7e-6 / 5000.0 + step = fov * 0.9 + self.assertAlmostEqual(h.montages[o['record_id']]['tile_step_m'], step, places=15) + moves = [max(abs(a['x'] - b['x']), abs(a['y'] - b['y'])) for a, b in zip([dict(x=x0, y=h.stage['y'])] + o['schedule'][:-1], o['schedule'])] + self.assertAlmostEqual(o['duration'], sum(m / rt.STAGE_XY_SPEED for m in moves) + 6 * (rt.MONTAGE_SETTLE_S + 0.5 + rt.CAMERA_READOUT_S), places=9) + h.step(1.0) + self.assertAlmostEqual(h.stage['x'], o['schedule'][0]['x'], places=15) # the stage drives the field to the first tile + self.assertAlmostEqual(h.stage['y'], o['schedule'][0]['y'], places=15) + h.step(o['duration'] + 10.0) + rec = h.montages[o['record_id']] + self.assertEqual(rec['status'], 'completed') + self.assertEqual(h.invoke('montage.result', montage_id=o['record_id'])['status'], 'completed') + self.assertEqual((len(rec['mosaic']), len(rec['mosaic'][0])), (2 * rt.TILE_PX, 3 * rt.TILE_PX)) + self.assertAlmostEqual(h.stage['x'], x0, places=15) + h.invoke('optics.set_mode', mode='LOW_MAG') + h.invoke('optics.set_magnification', magnification=50.0) + rejected(h, 'montage.acquire', 'MONTAGE_OUT_OF_RANGE', rows=8, cols=8, overlap=0.0, exposure_s=0.1, binning=1) + + def test_query_and_bookkeeping_capabilities(self): + h = camera(inserted()) + out = h.invoke('sim.step', dt_s=2.0) + self.assertAlmostEqual(out['time_s'], h.time_s, places=12) + img = acquire_image(h) + h.invoke('optics.toggle_diffraction') + pat = acquire_pattern(h) + self.assertEqual(h.invoke('image.result', image_id=img['image_id'])['status'], 'completed') + self.assertEqual(h.invoke('diffraction.result', pattern_id=pat['pattern_id'])['status'], 'completed') + self.assertEqual(h.invoke('records.list'), dict(images=[img['image_id']], patterns=[pat['pattern_id']], montages=[])) + codes = [e['code'] for e in h.invoke('events.read', since_s=0.0)['events']] + for c in ('POWER_ON', 'SOFTWARE_READY', 'VACUUM_READY', 'HT_ON', 'GRID_LOADED', 'HOLDER_AT_AIRLOCK', 'HOLDER_IN_COLUMN', 'FILAMENT_ON', 'IMAGE_START', + 'DIFF_START', 'ACQ_COMPLETED'): + self.assertIn(c, codes) + prov = h.invoke('provenance.read') + self.assertEqual((prov['library'], prov['substances']), (rt.LIBRARY_REL, ['amorphous_carbon', 'gold'])) + led = h.invoke('ledger.read') + self.assertEqual(set(led), set(rt.LEDGER_KEYS)) + self.assertGreater(led['beam_charge_c'], 0.0) + + +# ---------------------------------------------------------------- declared effects cover what the process changes +def _scenario(name): + """Scenario states for the with/without-call comparison (built with a seeded noise stream; the comparison replaces it by QuietRng).""" + R = rt.JeolJem1400flashRuntime() + inv = R.invoke + if name == 'fresh': + return R + inv('plant.configure', **rt.PLANT_EXAMPLE) + inv('specimen.provide', **AU) + inv('specimen.provide', **grid('stained_section', [phase('epoxy_resin', form='section', size=1e-6, t=7e-8, cov=0.8, cryst='amorphous', stain=0.1)], + support='formvar', t_support=2e-8, mesh='300')) + inv('specimen.provide', **grid('hal', [phase('halite', form='film', size=2e-8, t=4e-8, cov=1.0, cryst='polycrystalline')])) + if name == 'off': + return R + inv('power.set', enabled=True) + if name == 'booting': + R.step(10.0) + return R + R.step(260.0) + if name == 'ready': + return R + if name == 'power_cycled_off': + inv('power.set', enabled=False) + R.step(5.0) + return R + inv('ht.set_on', on=True) + if name == 'ht_ramping': + R.step(30.0) + return R + R.step(125.0) + if name == 'ht_ready': + return R + if name in ('high_tilt_screen', 'sec_beam_screen', 'sec_moving', 'halite_diffracting'): + sid, holder = {'high_tilt_screen': (AU['specimen_id'], 'high_tilt'), 'halite_diffracting': ('hal', 'quick_change')}.get(name, ('stained_section', 'quick_change')) + inv('holder.load_grid', holder_id=holder, specimen_id=sid) + inv('holder.insert_to_airlock', holder_id=holder) + R.step(12.0) + inv('airlock.set_pump', pump=True) + R.step(60.0) + inv('holder.insert') + R.step(5.0) + inv('filament.set_on', on=True) + R.step(25.0) + inv('aperture.set_condenser', inserted=True) + inv('optics.set_brightness', value=0.53) + R.step(1.0) + if name == 'high_tilt_screen': + inv('stage.set_tilt', tilt_rad=math.radians(60.0)) + R.step(12.7) + elif name == 'sec_moving': + inv('stage.move_xy', x_m=1e-4, y_m=0.0) + R.step(0.4) + elif name == 'halite_diffracting': + inv('screen.set', up=True) + inv('optics.toggle_diffraction') + R.step(1.0) + inv('diffraction.acquire', exposure_s=3.0, binning=1) + R.step(1.4) + return R + inv('holder.load_grid', holder_id='quick_change', specimen_id=AU['specimen_id']) + if name == 'bench_loaded': + return R + inv('holder.insert_to_airlock', holder_id='quick_change') + if name in ('holder_entering', 'entering_unpowered'): + R.step(3.0) + if name == 'entering_unpowered': + inv('power.set', enabled=False) + R.step(0.5) + return R + R.step(12.0) + if name == 'airlock_vented': + return R + inv('airlock.set_pump', pump=True) + if name == 'airlock_pumping': + R.step(10.0) + return R + R.step(60.0) + if name == 'airlock_evacuated': + return R + if name == 'airlock_unpowered': + inv('power.set', enabled=False) + R.step(2.0) + return R + inv('holder.insert') + if name == 'turning_in': + R.step(0.5) + return R + R.step(5.0) + if name == 'column_dark': + return R + inv('filament.set_on', on=True) + if name == 'heating': + R.step(5.0) + return R + R.step(25.0) + inv('aperture.set_condenser', inserted=True) + inv('optics.set_brightness', value=0.52) + R.step(1.0) + if name == 'beam_screen': + return R + if name == 'cooling_error': + inv('plant.configure', **dict(rt.PLANT_EXAMPLE, cooling_water_m3_s=2.0 / 60000.0)) + R.step(1.0) + return R + inv('screen.set', up=True) + R.step(1.0) + if name == 'beam_camera': + return R + tail = { + 'imaging': [('image.acquire', dict(exposure_s=2.0, binning=1)), 0.5], + 'stage_moving': [('stage.move_xy', dict(x_m=2e-4, y_m=-1e-4)), 0.3], + 'tilting': [('stage.set_tilt', dict(tilt_rad=math.radians(10.0))), 0.5], + 'diff': [('optics.toggle_diffraction', {}), 1.0], + 'diffracting': [('optics.toggle_diffraction', {}), 1.0, ('diffraction.acquire', dict(exposure_s=2.0, binning=1)), 0.5], + 'montage': [('optics.set_magnification', dict(magnification=5000.0)), ('montage.acquire', dict(rows=2, cols=2, overlap=0.1, exposure_s=0.3, binning=2)), 0.7], + 'low_mag': [('optics.set_mode', dict(mode='LOW_MAG')), ('aperture.set_objective', dict(position=2)), 1.0], + 'withdrawing': [('filament.set_on', dict(on=False)), ('holder.withdraw', {}), 0.5], + 'airlock_back': [('filament.set_on', dict(on=False)), ('holder.withdraw', {}), 3.0], + 'venting': [('filament.set_on', dict(on=False)), ('holder.withdraw', {}), 3.0, ('airlock.set_pump', dict(pump=False)), 0.3], + 'far_from_eucentric': [('stage.set_z', dict(z_m=1.9e-4)), 25.0], + 'screen_flipping': [('screen.set', dict(up=False)), 0.2], + 'long_move': [('stage.move_xy', dict(x_m=8e-4, y_m=0.0)), 2.5], + 'removing': [('filament.set_on', dict(on=False)), ('holder.withdraw', {}), 3.0, ('airlock.set_pump', dict(pump=False)), 10.0, ('holder.remove', {}), 2.0], + 'removed': [('filament.set_on', dict(on=False)), ('holder.withdraw', {}), 3.0, ('airlock.set_pump', dict(pump=False)), 10.0, ('holder.remove', {}), 12.0], + 'defocused': [('stage.set_z', dict(z_m=2e-5)), 3.0, ('optics.set_defocus', dict(defocus_m=3e-6)), ('optics.set_magnification', dict(magnification=200000.0)), + 1.0], + 'power_off_in_column': [('power.set', dict(enabled=False)), 10.0], + } + if name in tail: + for item in tail[name]: + if isinstance(item, float): + R.step(item) + else: + inv(item[0], **item[1]) + return R + if name == 'error_pending': + R.p_gun = 1e-3 + R.step(1.0) + return R + if name in ('burned_out', 'burned_out_ht_off'): + R.fil_used_s = R.fil_life_s + 1.0 + R.step(1.0) + if name == 'burned_out_ht_off': + inv('ht.set_on', on=False) + R.step(1.0) + return R + raise KeyError(name) + + +SCENARIOS = ['fresh', 'off', 'booting', 'ready', 'ht_ramping', 'ht_ready', 'bench_loaded', 'holder_entering', 'airlock_vented', 'airlock_pumping', + 'airlock_evacuated', 'turning_in', 'column_dark', 'heating', 'beam_screen', 'beam_camera', 'imaging', 'stage_moving', 'tilting', 'diff', + 'diffracting', 'montage', 'low_mag', 'withdrawing', 'airlock_back', 'removing', 'removed', 'defocused', 'error_pending', 'power_off_in_column', + 'burned_out', 'burned_out_ht_off', 'power_cycled_off', 'entering_unpowered', 'airlock_unpowered', 'venting', 'far_from_eucentric', 'cooling_error', + 'high_tilt_screen', 'sec_beam_screen', 'sec_moving', 'halite_diffracting', 'screen_flipping', 'long_move'] +STEP_DTS = (0.4, 1.0, 3.0, 15.0, 120.0) + + +def _variants(cap): + ex = copy.deepcopy(rt.CAPS[cap]['example_arguments']) + extra = { + 'plant.configure': [dict(rt.PLANT_EXAMPLE, room_k=300.15), dict(rt.PLANT_EXAMPLE, mains_voltage_v=150.0), dict(rt.PLANT_EXAMPLE, cooling_water_m3_s=1.0 / 60000.0)], + 'specimen.provide': [dict(AU, specimen_id='new_one')], + 'holder.load_grid': [dict(holder_id='high_tilt', specimen_id='stained_section'), dict(holder_id='quick_change', specimen_id='stained_section')], + 'holder.unload_grid': [dict(holder_id='high_tilt')], 'holder.insert_to_airlock': [dict(holder_id='high_tilt')], 'airlock.set_pump': [dict(pump=False)], + 'power.set': [dict(enabled=False)], 'ht.set_voltage': [dict(voltage_v=80000.0)], 'ht.set_on': [dict(on=False)], 'filament.set_on': [dict(on=False)], + 'filament.set_bias': [dict(bias=20.0)], 'optics.set_mode': [dict(mode='LOW_MAG'), dict(mode='DIFF')], + 'optics.set_magnification': [dict(magnification=300000.0), dict(magnification=100.0)], 'optics.set_camera_length': [dict(camera_length_m=2.0)], + 'optics.set_magnification_step_fraction': [dict(fraction=0.9), dict(fraction=0.0)], 'optics.set_brightness': [dict(value=0.5), dict(value=1.0)], + 'optics.set_spot_size': [dict(spot=5)], 'optics.set_defocus': [dict(defocus_m=-5e-6)], 'aperture.set_condenser': [dict(inserted=False)], + 'aperture.set_objective': [dict(position=0), dict(position=4)], 'aperture.set_selected_area': [dict(position=0), dict(position=4)], + 'screen.set': [dict(up=False)], 'stage.move_xy': [dict(x_m=-3e-4, y_m=2e-4)], 'stage.set_z': [dict(z_m=5e-5)], + 'stage.set_tilt': [dict(tilt_rad=-math.radians(15.0))], 'image.acquire': [dict(exposure_s=0.1, binning=2)], + 'diffraction.acquire': [dict(exposure_s=0.1, binning=2)], 'montage.acquire': [dict(rows=1, cols=2, overlap=0.2, exposure_s=0.1, binning=4)], + 'sim.step': [dict(dt_s=2.0)], + } + return [ex] + extra.get(cap, []) + + +def _flat(v, pre=''): + if isinstance(v, dict): + out = {} + for k, x in v.items(): + out.update(_flat(x, f'{pre}/{k}')) + return out or {pre: '{}'} + if isinstance(v, list): + out = {} + for i, x in enumerate(v): + out.update(_flat(x, f'{pre}[{i}]')) + return out or {pre: '[]'} + return {pre: v} + + +def _num(x): + return isinstance(x, (int, float)) and not isinstance(x, bool) + + +def _changed(a, b, scale=None): + """Relative comparison (no absolute floor: slots in A/m^2 or Pa change by less than 1e-9 in absolute terms).""" + if _num(a) and _num(b): + return abs(a - b) > 1e-9 * (max(abs(a), abs(b)) if scale is None else scale) + 1e-300 + return a != b + + +def _step_differs(v1, a2, v0, b2): + """Does the step change the value differently with the call (v1 -> a2) than without it (v0 -> b2)? (leaf-wise, numeric increments)""" + f1, fa, f0, fb = _flat(v1), _flat(a2), _flat(v0), _flat(b2) + for leaf in set(f1) | set(fa) | set(f0) | set(fb): + x1, xa, x0, xb = (f.get(leaf, '') for f in (f1, fa, f0, fb)) + ca, cb = _changed(x1, xa), _changed(x0, xb) + if not (ca or cb): + continue + if ca and cb and all(_num(x) for x in (x1, xa, x0, xb)) and not _changed(xa - x1, xb - x0, max(abs(x1), abs(xa), abs(x0), abs(xb))): + continue + if ca and cb and (x1, xa) == (x0, xb): + continue + return True + return False + + +class DeclaredEffects(unittest.TestCase): + def test_on_step_effects_cover_what_the_process_changes(self): + """For every capability accepted in any scenario state: the slots it changes at once are declared effects, the slots whose change during the + following step differs from an identical run without the call are declared on_step effects, and the step itself only changes slots declared + as on_step effects of sim.step (noise-free and noisy runs; both runs draw identical noise during the step).""" + missing_imm, missing_step = {}, {} + states = {n: _scenario(n) for n in SCENARIOS} + for noisy in (False, True): + for n, S in states.items(): + for i, name in enumerate(('rng', 'rng_acq', 'rng_life', 'rng_mount', 'rng_af')): + setattr(S, name, random.Random(7 + i) if noisy else QuietRng()) + for cap in rt.CAPS: + if cap in rt.UNSUPPORTED or rt.CAPS[cap]['kind'] in ('query', 'analysis'): + continue + for sname, S in states.items(): + for args in _variants(cap): + A = copy.deepcopy(S) + v0 = A.read('evaluator') + try: + _orig_invoke(A, cap, **args) + except rt.ActionRejected: + continue + v1 = A.read('evaluator') + if cap == 'sim.step': + for k in v0: + if _changed(v0[k], v1[k]) and k not in rt.ON_STEP['sim.step'] + rt.EFFECTS['sim.step']: + missing_step.setdefault('sim.step', set()).add(k) + continue + for k in v0: + if json.dumps(v0[k], sort_keys=True, default=str) != json.dumps(v1[k], sort_keys=True, default=str) and _changed(v0[k], v1[k]) \ + and k not in rt.EFFECTS[cap]: + missing_imm.setdefault(cap, set()).add(k) + for dt in STEP_DTS: + A2, B2 = copy.deepcopy(A), copy.deepcopy(S) + for name in ('rng', 'rng_acq', 'rng_life', 'rng_mount', 'rng_af'): + setattr(A2, name, copy.deepcopy(getattr(B2, name))) + A2.step(dt) + B2.step(dt) + a2, b2 = A2.read('evaluator'), B2.read('evaluator') + for k in v0: + if k not in rt.ON_STEP.get(cap, []) and _step_differs(v1[k], a2[k], v0[k], b2[k]): + missing_step.setdefault(cap, set()).add(k) + if k not in rt.ON_STEP['sim.step'] + ['clock.time_s'] and _changed(v0[k], b2[k]): + missing_step.setdefault('sim.step', set()).add(k) + self.assertEqual(missing_imm, {}) + self.assertEqual(missing_step, {}) + self.assertFalse([s for v in rt.ON_STEP.values() for s in v if rt.SLOTS[s]['origin'] == 'setpoint']) + + def test_units_and_sampling(self): + meta = _meta() + si = {'1', 's', 'm', 'rad', 'Pa', 'V', 'A', 'C', 'mol', 'K', 'J', 'm^2', '1/s', 'Pa*m^3/s', 'm^3', 'm^3/s', 'm/s', 'V/s', 'A/m^2', 'C/m^2', '1/m', + '1/m^2', 'ohm'} + units = {v['unit'] for v in meta['state_slots'].values()} + for mech in meta['mechanisms'].values(): + units |= {p_['unit'] for p_ in mech['parameters'].values()} + self.assertEqual(units - si, set(), units - si) + h = camera(inserted()) + h.register_principal('e', 'evaluator') + h.invoke('stage.move_xy', x_m=1e-4, y_m=0.0) + h.step(0.5) + obs = h.session('e').read(instance_id=h.instance_id)['observations'] + self.assertIsNone(obs['stage.x_indicated_m']['sample_window_s']) + self.assertGreater(obs['stage.x_indicated_m']['value'], 0.0) # continuous between the cycles + self.assertEqual(obs['vacuum.column_pressure_indicated_pa']['sample_window_s'], rt.CYCLE_S) + self.assertEqual(obs['vacuum.column_pressure_indicated_pa']['sample_time_s'], math.floor(h.time_s)) + g0 = h.read()['vacuum.column_pressure_indicated_pa'] + h.step(0.2) + self.assertEqual(h.read()['vacuum.column_pressure_indicated_pa'], g0) # held until the next cycle + + +class ReviewRound1(unittest.TestCase): + """Regression tests for the findings F01-F20 of the first independent runtime review.""" + + def test_f01_records_do_not_name_the_specimen(self): + h = camera(inserted()) + h.register_principal('a', 'agent') + a = h.session('a') + op = a.invoke(instance_id=h.instance_id, capability_id='image.acquire', arguments=dict(exposure_s=0.5, binning=1), request_id='f01')['operation_id'] + h.step(2.0) + img = a.poll(op)['result'] + self.assertEqual(img['template_source'], dict(library=rt.LIBRARY_REL, substances=[])) + r = a.invoke(instance_id=h.instance_id, capability_id='provenance.read', arguments={}, request_id='f01p') + self.assertEqual(r['error']['code'], 'ACCESS_DENIED') + + def test_f02_indistinguishable_classes_form_one_region(self): + h = camera(inserted(specimen=grid('thin', [], t_support=2e-10, holes=0.5))) # 0.2 nm carbon over 50 % holes: invisible + img = acquire_image(h, exposure=0.2) + self.assertEqual(len(img['regions']), 1, img['regions']) + self.assertAlmostEqual(img['regions'][0]['area_fraction_in_view'], 1.0, places=9) + h2 = camera(inserted(specimen=grid('thick', [], t_support=5e-8, holes=0.5))) # 50 nm carbon over holes: two regions + self.assertGreaterEqual(len(acquire_image(h2, exposure=0.5)['regions']), 2) + + def test_f03_coherence_envelope_removes_fringes_and_thon_rings(self): + c = camera(inserted(specimen=grid('c', [], t_support=2e-8)), mag=150000.0, ol=0) + c.invoke('optics.set_brightness', value=0.5) # crossover: 2 mrad convergence + c.invoke('optics.set_defocus', defocus_m=2e-5) + self.assertEqual(acquire_image(c, exposure=1.0)['thon_ring_frequencies_per_m'], []) + lam = rt.wavelength_m(120000.0) + self.assertLess(rt.spatial_envelope(1.0 / math.sqrt(lam * 2e-5), 2e-5, 120000.0, 2e-3), 1e-100) + self.assertGreater(rt.spatial_envelope(1.0 / math.sqrt(lam * 2e-6), 2e-6, 120000.0, 1e-5), 0.99) + + def test_f04_uranyl_stain_keeps_its_uranium(self): + dmg = rt.substance(rt.STAIN_ID)['damage'] + w_u = rt.substance(rt.STAIN_ID)['composition_mass_fraction']['U'] + self.assertGreaterEqual(dmg['residual_fraction'], w_u) + self.assertEqual(dmg['evidence'], 'assumption') + v, a = 120000.0, 7.5e-3 + full = rt.mu_damaged(rt.STAIN_ID, v, a, dmg['residual_fraction']) + rho = rt.substance(rt.STAIN_ID)['density_g_cm3'] * 1000.0 + mu_u = rho * w_u / (rt.element('U')['molar_mass_g_mol'] * 1e-3) * rt.N_AVOGADRO * rt.sigma_el_outside(92, v, a) + self.assertGreaterEqual(float(full), mu_u) # the stain never scatters less than its uranium + self.assertAlmostEqual(float(rt.mu_damaged(rt.STAIN_ID, v, a, 1.0)), rt.mu_el_outside(rt.STAIN_ID, v, a), places=6) + + def test_f06_tilt_does_not_reduce_the_damage(self): + out = [] + for tilt in (0.0, 60.0): + h = inserted(specimen=grid('fv', [], support='formvar', t_support=5e-8), holder='high_tilt') + h.invoke('stage.set_tilt', tilt_rad=math.radians(tilt)) + h.step(35.0) + h.invoke('optics.set_brightness', value=0.51) + f0 = h.read('evaluator')['truth.view_center_dose_c_m2'] + h.step(20.0) + out.append(h.read('evaluator')['truth.view_center_dose_c_m2'] - f0) + self.assertAlmostEqual(out[1] / out[0], 1.0, delta=0.01) # fluence through each molecule, not the plane dose + + def test_f07_long_beam_on_step_is_fast(self): + import time + h = camera(inserted(specimen=grid('hap', [phase('hydroxyapatite', form='film', size=2e-8, t=4e-8, cov=1.0, cryst='single_crystal')]))) + h.invoke('optics.set_brightness', value=0.52) + t0 = time.perf_counter() + h.step(3600.0) + self.assertLess(time.perf_counter() - t0, 60.0) + + def test_f08_holder_arrival_is_exact_for_any_chopping(self): + runs = [] + for chop in (30.0, 0.1, 0.7): + h = inserted(beam=False) + h.invoke('filament.set_on', on=False) + h.invoke('stage.neutral') + h.step(20.0) + h.invoke('holder.withdraw') + h.step(3.0) + h.invoke('holder.insert') + t_ins = h.time_s + left = 30.0 + while left > 1e-9: + d = min(chop, left) + h.step(d) + left -= d + ev = [e for e in h.events if e['code'] == 'HOLDER_IN_COLUMN'][-1] + runs.append((ev['time_s'] - t_ins, h.p_col, h.p_gun)) + for r in runs[1:]: + self.assertAlmostEqual(r[0], runs[0][0], places=9) + self.assertAlmostEqual(r[1] / runs[0][1], 1.0, places=9) + self.assertAlmostEqual(runs[0][0], rt.HOLDER_STROKE_M['airlock'] / rt.HOLDER_SPEED_M_S, places=9) + + def test_f09_thon_zeros_include_the_chi_zero_root(self): + v, dz = 120000.0, 20e-9 + lam = rt.wavelength_m(v) + k0 = math.sqrt(2.0 * dz / (rt.CS_M * lam * lam)) + zeros = rt.thon_zeros(dz, v, 3.2e9, 8) + self.assertTrue(any(abs(k - k0) < 1e3 for k in zeros), (zeros, k0)) + + def test_f10_rejected_auto_focus_changes_nothing_later(self): + a, b = camera(inserted()), camera(inserted()) + for h in (a, b): + h.invoke('stage.set_z', z_m=1.9e-4) + h.step(25.0) + self.assertEqual(a.read(), b.read()) + with self.assertRaises(rt.ActionRejected): + a.invoke('optics.auto_focus') + a.step(5.0) + b.step(5.0) + self.assertEqual(a.read(), b.read()) + + def test_f11_integer_valued_floats_are_accepted(self): + h = camera(inserted(), mag=5000.0) + out = h.invoke('montage.acquire', rows=2.0, cols=2, overlap=0.1, exposure_s=0.2, binning=2.0) + self.assertIn('operation_id', out) + self.assertIsInstance(h.acq['rows'], int) + + def test_f12_aperture_sinks_in_the_charge_ledger(self): + h = inserted(specimen=None) # holder without a grid + h.invoke('aperture.set_objective', position=2) + h.invoke('optics.set_mode', mode='LOW_MAG') + h.step(10.0) + led = h.ledger() + self.assertEqual(led['grid_stopped_charge_c'], 0.0) + self.assertGreater(led['objective_aperture_stopped_charge_c'], 0.0) + g = camera(inserted(), ol=0) + g.invoke('optics.set_brightness', value=0.7) + g.invoke('optics.toggle_diffraction') + g.invoke('aperture.set_selected_area', position=4) + l0 = g.ledger() + g.step(10.0) + l1 = g.ledger() + det = l1['detector_charge_c'] - l0['detector_charge_c'] + sa = l1['selected_area_aperture_stopped_charge_c'] - l0['selected_area_aperture_stopped_charge_c'] + self.assertGreater(sa, 100.0 * det) # a 0.33 um area of an 80 um beam + self.assertLess(abs(l1['charge_residual_c']), 1e-9 * l1['beam_charge_c']) + + def test_f13_agent_outputs_are_estimates(self): + h = camera(inserted()) + self.assertEqual(set(h.invoke('optics.set_brightness', value=0.53)), {'value'}) + h.invoke('stage.set_tilt', tilt_rad=0.1750565) + h.step(10.0) + img = acquire_image(h, exposure=0.5) + self.assertEqual(img['tilt_rad'], h.read()['stage.tilt_indicated_rad']) + self.assertNotEqual(img['dose_estimate_e_per_m2'], h._current_density() * 0.5 / rt.E_CHARGE) + + def test_f16_dose_follows_the_stage_path_continuously(self): + h = camera(inserted(specimen=grid('fv', [], support='formvar', t_support=2e-8))) + h.invoke('optics.set_brightness', value=0.505) + x0, y0 = h.stage['x'], h.stage['y'] + xs = x0 + np.linspace(1e-5, 9e-5, 33) + f0 = rt.dose_at(h._spec(), xs, np.full(len(xs), y0))[0] # earlier exposures (the spread beam while the filament heated) + h.invoke('stage.move_xy', x_m=x0 + 1e-4, y_m=y0) + h.step(3.0) + d = rt.dose_at(h._spec(), xs, np.full(len(xs), y0))[0] - f0 + J, r = h._current_density(), h._illum_d() / 2.0 + self.assertTrue(np.all(np.abs(d / (J * 2.0 * r / rt.STAGE_XY_SPEED) - 1.0) < 0.02), d / (J * 2.0 * r / rt.STAGE_XY_SPEED)) + + def test_f17_central_disc_saturation(self): + h = inserted(specimen=None) + h.invoke('optics.set_brightness', value=0.5) + h.invoke('screen.set', up=True) + h.invoke('optics.toggle_diffraction') + h.invoke('optics.set_camera_length', camera_length_m=3.0) + h.step(1.0) + p = acquire_pattern(h, exposure=0.5) + self.assertTrue(p['central_beam_saturated']) + + def test_f18_spheres_and_grid_bars_under_tilt(self): + h = inserted(holder='high_tilt') + spec = copy.deepcopy(h._spec()) + p = spec['phases'][0] + U = np.linspace(0.0, 2e-6, 400) + V = np.linspace(0.0, 2e-6, 400) + UU, VV = np.meshgrid(U, V) + mean_t = [] + for tilt in (0.0, math.radians(60.0)): + _, _, _, _, tl = rt._particle_at(UU.ravel(), VV.ravel() / math.cos(tilt), p, rt._phase_seed(spec, 0), tilt) + mean_t.append(float(np.mean(tl[tl > 0]))) + self.assertAlmostEqual(mean_t[1] / mean_t[0], 1.0, delta=0.05) # a sphere looks the same at any tilt + spec['_mount'] = dict(h=0.0, phi=0.0, off_a=0.0, off_b=0.0) + spec['phases'] = [] + g = np.linspace(-5e-4, 5e-4, 801) + GU, GV = np.meshgrid(g, g) + opens = [] + for tilt in (0.0, math.radians(60.0)): + o = rt.sample_specimen(spec, GU.ravel(), GV.ravel() / math.cos(tilt), 1.25e-6, 120000.0, 0.06, tilt) + opens.append(float(np.mean(o['open']))) + mesh = rt.GRID_MESH[200] + self.assertAlmostEqual(opens[0], (1 - mesh['bar'] / mesh['pitch']) ** 2, delta=0.01) + w60 = mesh['bar'] + rt.GRID_THICKNESS_M * math.tan(math.radians(60.0)) + self.assertAlmostEqual(opens[1], (1 - mesh['bar'] / mesh['pitch']) * (1 - w60 / mesh['pitch']), delta=0.01) + + def test_f19_unpowered_labels(self): + h = camera(inserted()) + h.invoke('screen.set', up=False) + h.step(0.2) + h.invoke('power.set', enabled=False) + h.step(60.0) + self.assertFalse(h.read()['screen.moving']) + g = ready() + g.invoke('specimen.provide', **AU) + g.invoke('holder.load_grid', holder_id='quick_change', specimen_id=AU['specimen_id']) + g.invoke('holder.insert_to_airlock', holder_id='quick_change') + g.step(12.0) + g.invoke('airlock.set_pump', pump=True) + g.step(60.0) + g.invoke('power.set', enabled=False) + g.step(1.0) + r = g.read() + self.assertEqual((r['airlock.state'], r['panel.airlock_lamp'], r['airlock.pressure_indicated_pa']), ('idle', False, None)) + + def test_f20_mirrored_states_need_the_host(self): + meta = _meta() + self.assertEqual(meta['capabilities']['screen.set']['model_effects']['mode'], 'host_required') + self.assertEqual(meta['capabilities']['camera.auto_exposure']['model_effects']['mode'], 'none') + for k, c in meta['capabilities'].items(): + me = c['model_effects'] + if me['mode'] == 'none': + self.assertNotIn('绑定', me['description_zh'], k) + + +class ReviewRound2(unittest.TestCase): + """Regression tests for the second independent runtime review (F07 revisited, F21-F23).""" + + def test_f07_hydroxyapatite_and_many_dose_events_stay_fast(self): + import time + h = camera(inserted(specimen=grid('hap', [phase('hydroxyapatite', form='film', size=2e-8, t=4e-8, cov=1.0, cryst='single_crystal')]))) + h.invoke('screen.set', up=False) # the screen reading needs the view fractions every cycle + t0 = time.perf_counter() + h.step(3600.0) + self.assertLess(time.perf_counter() - t0, 60.0) + g = inserted(specimen=grid('sec', [phase('epoxy_resin', form='section', size=1e-6, t=7e-8, cov=0.8, cryst='amorphous', stain=0.1)], + support='formvar', t_support=2e-8, mesh='300')) + x0, y0 = g.stage['x'], g.stage['y'] + for i in range(300): # 600 overlapping dose events around the view + g.invoke('stage.move_xy', x_m=x0 + (3e-6 if i % 2 else -3e-6), y_m=y0 + 1e-8 * i) + g.step(1.0) + self.assertGreater(len(g._spec()['_dose']), 300) + t0 = time.perf_counter() + g.step(3600.0) + self.assertLess(time.perf_counter() - t0, 60.0) + + def test_f21_dose_events_do_not_depend_on_the_host_step(self): + out = [] + for chop in (1.0, 0.001): + h = camera(inserted(specimen=grid('fv', [], support='formvar', t_support=2e-8), holder='high_tilt')) + h.invoke('optics.set_brightness', value=0.51) + n0 = len(h._spec()['_dose']) + h.invoke('stage.set_tilt', tilt_rad=math.radians(20.0)) + left = 12.0 + while left > 1e-9: + d = min(chop, left) + h.step(d) + left -= d + cu, cv, _, _ = h._geometry() + out.append((len(h._spec()['_dose']) - n0, h.read('evaluator')['truth.view_center_dose_c_m2'])) + self.assertEqual(out[0][0], out[1][0]) + self.assertAlmostEqual(out[1][1] / out[0][1], 1.0, delta=1e-4) + sweep = [] + for chop in (1.0, 1.0 / 60.0): + h = inserted() + h.invoke('optics.set_mode', mode='LOW_MAG') + n0 = len(h._spec()['_dose']) + h.invoke('stage.move_xy', x_m=h.stage['x'] + 8e-4, y_m=h.stage['y']) + left = 17.0 + while left > 1e-9: + d = min(chop, left) + h.step(d) + left -= d + sweep.append(len(h._spec()['_dose']) - n0) + self.assertEqual(sweep[0], sweep[1]) + self.assertLessEqual(sweep[1], 3) # one swept run (+ the stays before and after) + + def test_f21_tilt_ramp_at_a_height_offset_is_chopping_independent(self): + tracks = [] + for chop in (1.0, 0.01): + h = camera(inserted(specimen=grid('fv', [], support='formvar', t_support=2e-8), holder='high_tilt')) + h.invoke('optics.set_brightness', value=0.505) + h.invoke('stage.set_z', z_m=2e-4) + h.invoke('stage.set_tilt', tilt_rad=math.radians(60.0)) + h.step(50.0) + f0 = None + ts = np.radians(np.arange(60.25, 70.0, 0.5)) + hh = h._spec()['_mount']['h'] + h.stage['z'] + vs = h.stage['y'] + hh * np.tan(ts) + us = np.full(len(ts), h.stage['x']) + f0 = rt.dose_at(h._spec(), us, vs)[0] + h.invoke('stage.set_tilt', tilt_rad=math.radians(70.0)) + left = 6.0 + while left > 1e-9: + d = min(chop, left) + h.step(d) + left -= d + tracks.append(rt.dose_at(h._spec(), us, vs)[0] - f0) + self.assertTrue(np.all(np.abs(tracks[1] / tracks[0] - 1.0) < 1e-3), tracks[1] / tracks[0]) + + def test_f26_out_and_back_within_a_cycle_doses_both_passes(self): + h = camera(inserted(specimen=grid('fv', [], support='formvar', t_support=2e-8))) + h.invoke('optics.set_brightness', value=0.505) + h.step(1.0 - (h.time_s % 1.0)) # start at a cycle boundary + x0, y0 = h.stage['x'], h.stage['y'] + xs = x0 + np.array([-15e-6, -10e-6, 7.5e-6, 10e-6]) + f0 = rt.dose_at(h._spec(), xs, np.full(len(xs), y0))[0] + h.invoke('stage.move_xy', x_m=x0 + 20e-6, y_m=y0) # out 20 um (0.4 s) ... + for _ in range(40): + h.step(0.01) + h.invoke('stage.move_xy', x_m=x0 - 20e-6, y_m=y0) # ... and back past the start, inside the same cycle + h.step(2.0) # past the next cycle end (the dose is deposited per cycle) + d = rt.dose_at(h._spec(), xs, np.full(len(xs), y0))[0] - f0 + one = h._current_density() * 2.0 * (h._illum_d() / 2.0) / rt.STAGE_XY_SPEED + self.assertTrue(np.allclose(d / one, [1.0, 1.0, 2.0, 2.0], rtol=0.02), d / one) # the excursion is crossed twice + + def test_f22_regions_follow_the_observable_layers(self): + films = [phase('polystyrene', form='film', size=1e-6, t=5e-8, cov=0.6, cryst='amorphous'), + phase('polystyrene', form='film', size=1e-6, t=5e-8, cov=0.6, cryst='amorphous')] + h = camera(inserted(specimen=grid('twin', films, t_support=1e-9, holes=0.0)), mag=3000.0) + img = acquire_image(h, exposure=2.0) + counts = sorted(r['mean_counts'] for r in img['regions']) + self.assertLessEqual(len(img['regions']), 3, img['regions']) # support-only, one layer (either film), two layers + spec = h._spec() + U = np.linspace(0, 20e-6, 200) + UU, VV = np.meshgrid(U, U) + o = rt.sample_specimen(spec, UU.ravel(), VV.ravel(), 1e-7, 120000.0, h._alpha(), 0.0) + both = np.mean(o['label'] == 1 + 0b10011) + self.assertGreater(both, 0.2) # the overlap is its own class + + def test_f23_no_fringes_beyond_the_axial_information_limit(self): + h = camera(inserted(specimen=grid('auz', [phase('gold', zone=[1, 1, 0])])), mag=1.5e6, ol=0) + h.invoke('optics.set_brightness', value=0.505) + h.invoke('optics.auto_focus') + img = acquire_image(h, exposure=0.5) + d = {x for r in img['regions'] for x in r['lattice_spacings_m']} + lam = rt.wavelength_m(120000.0) + self.assertTrue(all(math.exp(-0.5 * (math.pi * lam * rt.focus_spread_m(120000.0)) ** 2 / x ** 4) > 0.05 for x in d), d) + self.assertNotIn(round(0.144e-9, 12), {round(x, 12) for x in d}) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_asset_jeol_jsmit200.py b/tests/test_asset_jeol_jsmit200.py new file mode 100644 index 0000000000000000000000000000000000000000..295c4f76f02197d6a70d79947728061d5aeb6c0d --- /dev/null +++ b/tests/test_asset_jeol_jsmit200.py @@ -0,0 +1,1224 @@ +"""tests for CHEM-151 jeol_jsmit200: python3 -m unittest tests/test_asset_jeol_jsmit200.py + +Topics (pipeline.md): set points only write targets, read/describe are pure, rejected preconditions leave the state unchanged, two +instances are isolated, agent/evaluator truth isolation, conservation (charge, gas), real return values validated against the declared +schemas (asset_tool lint_schema / validate_value), asynchronous completion and cancellation remnants, host-step independence; plus the +instrument behaviour documented by JEOL and the facility guides (start-up, draw-out exchange, EVAC within minutes and the 10-min limit, +VENT with the stage returning to the exchange position, LV 10-100 Pa with the BED only, probe sizes reproducing the catalogue resolutions, +kV and probe-current ranges, magnification on the 128 mm print, SE/BSE contrast, charging of uncoated insulators, EDS resolution +<= 130 eV at Mn Ka, Duane-Hunt limit, count rates, standardless quantification and automatic identification, stage strokes and +collision limits, filament life, mains tolerance). +""" +import copy +import json +import math +import sys +import unittest +from pathlib import Path + +import numpy as np + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / "scripts")) +sys.path.insert(0, str(ROOT / "skills/chemistry-lab-assets/scripts")) +from asset_runtime import jeol_jsmit200 as rt # noqa: E402 +import asset_tool # noqa: E402 + +OUT = ROOT / 'outputs/expansion_batch04/t3_analytical/jeol_jsmit200' +CHECKS, PROCESS_EVIDENCE = [], {} +_META = {} + + +def _meta(): + if not _META: + _META.update(rt.export_jeol_jsmit200_contract_metadata()) + return _META + + +_orig_invoke = rt.JeolJsmit200Runtime.invoke + + +def _instrumented_invoke(self, capability_id, **a): + """Every successful call is checked against its declared output schema and immediate state effects (read does not advance time).""" + before = self.read('evaluator') if capability_id != 'sim.step' else None + t0 = self.time_ns + out = _orig_invoke(self, capability_id, **a) + meta = _meta()['capabilities'][capability_id] + errs = asset_tool.validate_value(out, meta['output_schema']) + if errs: + raise AssertionError(f'{capability_id} output violates its schema: {errs[:3]}') + if before is not None: + assert self.time_ns == t0, capability_id + after = self.read('evaluator') + undeclared = {k for k in after if after[k] != before[k]} - set(rt.CAPS[capability_id]['effects']) + if undeclared: + raise AssertionError(f'{capability_id} changed undeclared state immediately: {sorted(undeclared)}') + PROCESS_EVIDENCE.setdefault(capability_id, []).append(dict(arguments=copy.deepcopy(a), result_keys=sorted(out))) + return out + + +rt.JeolJsmit200Runtime.invoke = _instrumented_invoke +FE_SI = rt.SPECIMEN_EXAMPLE + + +def spec(sid, sub, coating='none', thick=0.0, wet=False, topo='flat_polished', height=0.005, diameter=0.012, grain=2e-5): + return dict(specimen_id=sid, phases=[dict(substance_id=sub, area_fraction=1.0, grain_size_m=grain)], diameter_m=diameter, height_m=height, + topography=topo, coating=coating, coating_thickness_m=thick, wet=wet) + + +def configured(seed=1, **plant): + h = rt.JeolJsmit200Runtime() + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, noise_seed=seed, **plant)) + return h + + +def ready(seed=1, specimen=FE_SI, wd=0.010, evacuate=True, lv=False, **plant): + """Powered, specimen loaded at the requested working distance, door closed and (optionally) evacuated.""" + h = configured(seed, **plant) + if specimen: + h.invoke('specimen.provide', **specimen) + h.invoke('power.set', enabled=True) + h.step(rt.SOFTWARE_BOOT_S + 1.0) + if specimen: + h.invoke('chamber.draw_out') + h.step(3.0) + h.invoke('specimen.load', specimen_id=specimen['specimen_id']) + h.invoke('stage.set_z', z_lift_m=rt.WD_RANGE_M[1] - wd - specimen['height_m']) + h.step(30.0) + h.invoke('chamber.draw_in') + h.step(3.0) + if lv: + h.invoke('vacuum.toggle_lv') + if evacuate: + h.invoke('vacuum.evacuate') + h.step(240.0) + return h + + +def observing(h, kv=15000.0, ip=1e-10, det='BED_COMPO', mag=1000.0): + h.invoke('beam.set_voltage', voltage_v=kv) + h.invoke('beam.set_probe_current', current_a=ip) + h.invoke('beam.observation_on') + h.step(rt.SATURATION_S + 1.0) + h.invoke('detector.select', detector=det) + h.invoke('scan.set_magnification', magnification=mag) + h.invoke('optics.autofocus') + h.invoke('optics.auto_stigmate') + h.invoke('optics.auto_contrast_brightness') + return h + + +def acquire_image(h, pixels='320x240', dwell=1e-5): + op = h.invoke('image.acquire', pixels=pixels, dwell_s=dwell)['operation_id'] + h.step(h.operations[op]['duration'] + 1.0) + return h.images[h.operations[op]['record_id']] + + +def acquire_eds(h, mode='point', live=20.0, pt='T3'): + op = h.invoke('eds.acquire', mode=mode, live_time_s=live, process_time=pt)['operation_id'] + h.step(h.operations[op]['duration'] + 1.0) + return h.spectra[h.operations[op]['record_id']] + + +def rejected(h, cap, code, **a): + before = h.read('evaluator') + rev = h.revision + try: + h.invoke(cap, **a) + except rt.ActionRejected as exc: + assert str(exc) == code, (cap, str(exc), code) + assert h.read('evaluator') == before, cap + assert h.revision == rev, cap + return True + raise AssertionError(f'{cap} was not rejected (expected {code})') + + +class ContractAndSchemas(unittest.TestCase): + def test_module_identity(self): + self.assertEqual(rt.ASSET_TYPE_ID, 'instrument.jeol_jsmit200') + self.assertEqual(rt.CATALOG_ID, 'CHEM-151') + + def test_schemas_lint_and_examples_validate(self): + meta = _meta() + for k, c in meta['capabilities'].items(): + self.assertEqual(asset_tool.lint_schema(c['input_schema']), [], k) + self.assertEqual(asset_tool.lint_schema(c['output_schema']), [], k) + if c['availability'] == 'implemented': + self.assertEqual(asset_tool.validate_value(c['example_arguments'], c['input_schema']), [], k) + for k, s in meta['state_slots'].items(): + self.assertEqual(asset_tool.lint_schema(s['value_schema']), [], k) + + def test_metadata_references_are_consistent(self): + meta = _meta() + slots = set(meta['state_slots']) + for k, c in meta['capabilities'].items(): + for e in c['state_effects']: + self.assertIn(e['state_id'], slots, k) + for x in c['observes']: + self.assertIn(x, slots, k) + for p in c['preconditions']: + for x in p['state_ids']: + self.assertIn(x, slots, k) + for e in c['errors']: + self.assertIn(e['code'], rt.ERROR_ZH, k) + self.assertEqual(set(rt.EFFECTS) | set(rt.UNSUPPORTED), set(rt.CAPS)) + + def test_unsupported_capabilities_report_unsupported(self): + h = configured() + h.register_principal('a', 'agent') + s = h.session('a') + for k in rt.UNSUPPORTED: + r = s.invoke(instance_id=h.instance_id, capability_id=k, arguments={}, request_id='u-' + k) + self.assertEqual(r['status'], 'unsupported', k) + self.assertEqual(r['error']['code'], 'UNSUPPORTED') + + +class HostClockAndPurity(unittest.TestCase): + def test_read_and_describe_do_not_advance_time(self): + h = ready(evacuate=False) + h.register_principal('a', 'agent') + t, rev = h.time_ns, h.revision + h.read('evaluator') + s = h.session('a') + s.read(instance_id=h.instance_id) + s.describe(instance_id=h.instance_id) + self.assertEqual((h.time_ns, h.revision), (t, rev)) + + def test_step_zero_and_negative(self): + h = configured() + h.step(0.0) + with self.assertRaises(rt.ActionRejected): + h.step(-1.0) + + def test_host_step_chopping_does_not_change_the_result(self): + def run(chunks): + h = ready(seed=5, evacuate=False) + h.invoke('vacuum.evacuate') + for dt in chunks: + h.step(dt) + return h.read('evaluator') + a = run([150.0]) + b = run([0.37] * 405 + [0.15]) + for k in ('truth.chamber_pressure_pa', 'vacuum.state', 'vacuum.chamber_pressure_indicated_pa', 'truth.tmp_speed_fraction'): + if isinstance(a[k], float): + self.assertAlmostEqual(a[k], b[k], delta=1e-6 * max(abs(a[k]), 1e-12), msg=k) + else: + self.assertEqual(a[k], b[k], k) + + def test_set_points_only_write_targets(self): + h = ready(evacuate=False) + z0 = h.stage['z'] + h.invoke('stage.set_z', z_lift_m=0.0) + self.assertEqual(h.stage['z'], z0) # target only; the hand moves the stage during step + h.step(1.0) + self.assertAlmostEqual(z0 - h.stage['z'], rt.STAGE_Z_SPEED_M_S * 1.0, places=9) + h.invoke('vacuum.set_lv_pressure', pressure_pa=80.0) + self.assertEqual(h.lv_set, 80.0) + p = h.p_ch + self.assertEqual(h.read('evaluator')['truth.chamber_pressure_pa'], p) + + +class VacuumAndPanel(unittest.TestCase): + def test_start_up_exchange_and_evacuation_time(self): + h = ready(evacuate=False, vent_gas='room_air', relative_humidity=0.5) + r = h.read() + self.assertEqual((r['vacuum.state'], r['panel.vent_lamp_mode'], r['panel.evac_lamp_mode']), ('vented', 'on', 'off')) + h.invoke('vacuum.evacuate') + h.step(1.0) + self.assertEqual(h.read()['panel.evac_lamp_mode'], 'blinking') + t = 0 + while h.vac_state != 'hv_ready' and t < 600: + h.step(1.0) + t += 1 + self.assertEqual(h.vac_state, 'hv_ready') + self.assertLess(t, 180) # "a few minutes" (JSM-IT300 manual), well inside the 10-min limit + self.assertGreater(t, 60) + self.assertEqual(h.read()['panel.evac_lamp_mode'], 'on') + self.assertLess(h.read()['vacuum.gun_pressure_indicated_pa'], 1e-2) + + def test_door_not_closed_times_out_after_ten_minutes(self): + h = ready(evacuate=False) + h.invoke('chamber.draw_out') + h.step(3.0) + h.invoke('vacuum.evacuate') + h.step(rt.EVAC_LIMIT_S - 5) + self.assertIsNone(h.error) + h.step(10.0) + self.assertEqual(h.error, 'EVAC_TIMEOUT') + self.assertGreater(h.p_ch, 1e4) + rejected(h, 'beam.observation_on', 'ERROR_PENDING') + + def test_vent_returns_xy_and_lamps(self): + h = ready() + h.invoke('stage.move_xy', x_m=0.01, y_m=-0.005) + h.step(10.0) + self.assertAlmostEqual(h.stage['x'], 0.01, places=9) + h.invoke('vacuum.vent') + h.step(1.0) + self.assertEqual(h.read()['panel.vent_lamp_mode'], 'blinking') + h.step(150.0) + r = h.read('evaluator') + self.assertEqual(r['vacuum.state'], 'vented') + self.assertEqual((r['stage.x_m'], r['stage.y_m']), (0.0, 0.0)) + self.assertEqual(r['panel.vent_lamp_mode'], 'on') + self.assertGreater(r['truth.chamber_pressure_pa'], rt.VENT_READY_PA) + + def test_blinking_lamp_alternates(self): + h = ready(evacuate=False) + h.invoke('vacuum.evacuate') + seen = set() + for _ in range(4): + h.step(0.5) + seen.add(h.read()['panel.evac_lamp']) + self.assertEqual(seen, {True, False}) + + def test_low_vacuum_regulates_and_keeps_the_gun_in_high_vacuum(self): + for p_set in (10.0, 100.0): + h = ready(lv=True, evacuate=False) + h.invoke('vacuum.set_lv_pressure', pressure_pa=p_set) + h.invoke('vacuum.evacuate') + h.step(400.0) + r = h.read('evaluator') + self.assertEqual(r['vacuum.state'], 'lv_ready', p_set) + self.assertAlmostEqual(r['vacuum.lv_pressure_indicated_pa'] / p_set, 1.0, delta=0.06) + self.assertLess(r['truth.gun_pressure_pa'], rt.HV_READY_PA) + self.assertTrue(r['panel.lv_lamp']) + rejected(h, 'detector.select', 'DETECTOR_NOT_AVAILABLE', detector='SED') + + def test_wet_specimen_needs_low_vacuum(self): + wet = spec('leaf', 'tissue_soft', wet=True, topo='rough_fracture', height=0.002) + h = ready(specimen=wet) + h.step(rt.EVAC_LIMIT_S) + self.assertEqual(h.error, 'EVAC_TIMEOUT') + h.invoke('error.acknowledge') + h.invoke('vacuum.toggle_lv') + h.step(200.0) + self.assertEqual(h.vac_state, 'lv_ready') + + def test_power_cycle_and_mains(self): + h = configured(mains_voltage_v=85.0) + rejected(h, 'power.set', 'MAINS_OUT_OF_RANGE', enabled=True) + h = ready() + h.invoke('power.key_toggle') + self.assertFalse(h.power) + self.assertEqual(h.vac_state, 'idle') + self.assertTrue(any(e['code'] == 'UNSAFE_POWER_OFF' for e in h.events)) + p = h.p_ch + h.step(3600.0) + self.assertGreater(h.p_ch, p) # slowly leaking up without pumps + h.invoke('power.key_toggle') + self.assertEqual(h.vac_state, 'roughing') # start-up pumping of a chamber left under vacuum + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, mains_voltage_v=120.0)) + h.step(2.0) + self.assertFalse(h.power) + self.assertEqual(h.error, 'MAINS_FAULT') + + def test_shutdown_then_key_off_is_clean(self): + h = ready() + h.invoke('system.shutdown') + rejected(h, 'vacuum.vent', 'NOT_READY') + n = len(h.events) + h.invoke('power.set', enabled=False) + self.assertFalse(any(e['code'] == 'UNSAFE_POWER_OFF' for e in h.events[n:])) + + +class StageDoorSpecimen(unittest.TestCase): + def test_draw_out_needs_vent_and_draw_in_needs_clearance(self): + h = ready() + rejected(h, 'chamber.draw_out', 'CHAMBER_UNDER_VACUUM') + h.invoke('vacuum.vent') + h.step(150.0) + h.invoke('chamber.draw_out') + h.step(1.0) + self.assertEqual(h.read()['chamber.door_state'], 'moving') + h.step(2.0) + self.assertEqual(h.read('evaluator')['chamber.door_position_m'], rt.DOOR_TRAVEL_M) + h.invoke('stage.set_z', z_lift_m=0.0) + h.step(30.0) + h.invoke('specimen.unload') + h.invoke('specimen.provide', **spec('tall', 'aluminium', height=0.046)) + h.invoke('specimen.load', specimen_id='tall') + rejected(h, 'chamber.draw_in', 'STAGE_COLLISION_RISK') # 46 mm high: top 2 mm under the pole piece even at Z 0 + h.invoke('stage.set_z', z_lift_m=0.01) # drawn out: no pole piece above the stage + h.step(6.0) + rejected(h, 'chamber.draw_in', 'STAGE_COLLISION_RISK') + + def test_specimen_limits_and_bookkeeping(self): + h = configured() + rejected(h, 'specimen.provide', 'SPECIMEN_TOO_LARGE', **spec('big', 'iron', diameter=0.16)) + rejected(h, 'specimen.provide', 'SPECIMEN_TOO_LARGE', **spec('high', 'iron', height=0.05)) + rejected(h, 'specimen.provide', 'UNKNOWN_SUBSTANCE', **spec('x', 'unobtainium')) + bad = spec('frac', 'iron') + bad['phases'][0]['area_fraction'] = 0.8 + rejected(h, 'specimen.provide', 'AREA_FRACTIONS_INVALID', **bad) + rejected(h, 'specimen.provide', 'COATING_INVALID', **spec('c', 'iron', coating='gold', thick=0.0)) + h.invoke('specimen.provide', **FE_SI) + rejected(h, 'specimen.load', 'DOOR_NOT_OPEN', specimen_id=FE_SI['specimen_id']) + + def test_stage_moves_at_its_speeds_and_tilt_limit(self): + h = ready() + h.invoke('stage.move_xy', x_m=0.03, y_m=0.0) + h.step(5.0) + self.assertAlmostEqual(h.stage['x'], rt.STAGE_XY_SPEED_M_S * 5.0, places=9) + self.assertTrue(h.read()['stage.moving']) + h.step(10.0) + self.assertAlmostEqual(h.stage['x'], 0.03, places=12) + h.invoke('stage.move_xy', x_m=0.0, y_m=0.0) + h.step(12.0) + rejected(h, 'stage.set_tilt', 'STAGE_COLLISION_RISK', tilt_rad=math.radians(80.0)) # WD 10 mm, 12 mm specimen + h.invoke('stage.set_z', z_lift_m=0.0) + h.step(25.0) + h.invoke('stage.set_tilt', tilt_rad=math.radians(30.0)) + h.step(5.0) + self.assertAlmostEqual(h.stage['tilt'], math.radians(30.0), places=12) + # tilt about the holder top: the beam meets the 5 mm high top face h tan t from its centre, WD = 48 mm - z - h / cos t + u, v, on = h._beam_point() + self.assertTrue(on) + self.assertAlmostEqual(math.hypot(u, v), 0.005 * math.tan(math.radians(30.0)), places=12) + self.assertAlmostEqual(h._wd_true(), 0.048 - 0.0 - 0.005 / math.cos(math.radians(30.0)), places=12) + h.invoke('stage.set_tilt', tilt_rad=math.radians(60.0)) + h.step(5.0) + # at 60 deg the hit point (8.7 mm from the centre) is beyond the 6 mm radius: the beam lands on the holder plane + self.assertFalse(h._beam_point()[2]) + self.assertAlmostEqual(h._wd_true(), 0.048, places=12) + with self.assertRaises(rt.ActionRejected): + h.invoke('stage.move_xy', x_m=0.05, y_m=0.0) + + +class OpticsAndImaging(unittest.TestCase): + def test_probe_model_reproduces_the_catalogue_resolutions(self): + fit = json.loads((OUT / 'optics_fit.json').read_text()) + self.assertAlmostEqual(fit['fitted']['c_s'], rt.C_S_COEF, places=12) + self.assertAlmostEqual(fit['fitted']['c_c'], rt.C_C_COEF, places=12) + for v, d, wd in ((30000.0, 3.0e-9, 0.008), (3000.0, 8.0e-9, 0.006), (1000.0, 15.0e-9, 0.006)): + dp, a = rt.probe(v, 3e-12, wd) + self.assertAlmostEqual(rt.K_RES * dp / d, 1.0, delta=0.05) + # more current, bigger probe; longer WD, bigger probe + self.assertGreater(rt.probe(15000.0, 1e-9, 0.01)[0], rt.probe(15000.0, 1e-11, 0.01)[0]) + self.assertGreater(rt.probe(15000.0, 1e-10, 0.04)[0], rt.probe(15000.0, 1e-10, 0.008)[0]) + + def test_voltage_steps_and_ranges(self): + h = ready(evacuate=False) + self.assertEqual(h.invoke('beam.set_voltage', voltage_v=2345.0)['voltage_v'], 2300.0) + self.assertEqual(h.invoke('beam.set_voltage', voltage_v=12345.0)['voltage_v'], 12000.0) + with self.assertRaises(rt.ActionRejected): + h.invoke('beam.set_voltage', voltage_v=400.0) + with self.assertRaises(rt.ActionRejected): + h.invoke('beam.set_probe_current', current_a=5e-7) + self.assertAlmostEqual(h.invoke('scan.set_magnification', magnification=1000.0)['field_width_m'], 128e-6, places=12) + rejected(h, 'beam.observation_on', 'VACUUM_NOT_READY') + + def test_bse_composition_contrast_follows_atomic_number(self): + mix = dict(FE_SI, specimen_id='au_c', phases=[dict(substance_id='gold', area_fraction=0.5, grain_size_m=2e-5), + dict(substance_id='carbon_graphite', area_fraction=0.5, grain_size_m=2e-5)]) + h = observing(ready(specimen=mix)) + img = acquire_image(h) + self.assertEqual(img['status'], 'completed') + self.assertEqual([r['region_id'] for r in img['regions']], ['region_1', 'region_2']) # grey-level regions, no phase names + r1, r2 = img['regions'] + self.assertGreater(r1['mean_grey'], r2['mean_grey'] + 100) + self.assertNotIn('signal_per_electron', r1) + fr = h._frame_signals(dwell=1e-5, nx=320, ny=240, noise=False) # evaluator-side truth behind the regions + y = {r['substance_id']: r for r in fr['regions']} + self.assertGreater(y['gold']['y'], 3 * y['carbon_graphite']['y']) + self.assertAlmostEqual(r1['area_fraction_in_view'], y['gold']['fraction'], places=12) # the bright region is the gold phase + self.assertEqual(img['template_source'], dict(library=rt.LIBRARY_REL, substances=[])) + self.assertEqual(len(img['thumbnail']), rt.THUMB_H) + self.assertTrue(all(len(row) == rt.THUMB_W for row in img['thumbnail'])) + self.assertAlmostEqual(img['field_of_view_m'][0], 128e-6, places=12) + self.assertEqual(img['template_source']['library'], rt.LIBRARY_REL) + + def test_noise_falls_with_dwell_and_current(self): + h = observing(ready()) + a = {r['region_id']: r['snr'] for r in acquire_image(h, dwell=1e-6)['regions']} + b = {r['region_id']: r['snr'] for r in acquire_image(h, dwell=1e-4)['regions']} + self.assertEqual(set(a), set(b)) + for k in a: + self.assertGreater(b[k], 5 * a[k]) + + def test_defocus_blurs_and_autofocus_recovers(self): + h = observing(ready(), mag=20000.0) + r0 = acquire_image(h, pixels='1280x960')['effective_resolution_m'] + h.invoke('optics.set_focus', focus_wd_m=0.013) + r1 = acquire_image(h, pixels='1280x960')['effective_resolution_m'] + self.assertGreater(r1, 3 * r0) + h.invoke('optics.autofocus') + self.assertAlmostEqual(h.focus_wd, h._wd_true(), delta=2e-5) + + def test_charging_of_uncoated_insulators_in_high_vacuum_only(self): + q = spec('quartz', 'quartz', topo='particles', height=0.003, grain=5e-5) + h = observing(ready(specimen=q), det='SED', ip=1e-9) + img = acquire_image(h) + self.assertTrue(img['charging_artifacts']) + sp = acquire_eds(h) + u, v, on = h._beam_point() + sub, th, az, k = h._phase_sub(h._spec(), u, v) + land = h._landing_ev(sub, h._spec(), k) # truth: E0 minus the potential of that phase + self.assertLess(land, 0.5 * 15000.0) + self.assertLess(abs(sp['duane_hunt_limit_ev'] - land), 500.0) # the agent sees the charging only through the Duane-Hunt limit + self.assertEqual(max(i for i, c in enumerate(sp['counts']) if c > 0) * rt.EDS_CHANNEL_EV <= sp['duane_hunt_limit_ev'] + 300.0, True) + # the pre-charged surface (about 11 kV) mirrors a 1 kV beam; a fresh specimen at 1 kV (below E2) does not charge + h.invoke('beam.set_voltage', voltage_v=1000.0) + h.step(2.0) + h.invoke('optics.auto_contrast_brightness') + self.assertTrue(acquire_image(h)['charging_artifacts']) + h3 = observing(ready(specimen=q), kv=1000.0, det='SED') + self.assertFalse(acquire_image(h3)['charging_artifacts']) + self.assertEqual(h3.v_surface.get(0, 0.0), 0.0) + # carbon coating or low vacuum: no charging + for kw in (dict(specimen=spec('qc', 'quartz', coating='carbon', thick=2e-8, height=0.003)), dict(specimen=q, lv=True)): + h2 = observing(ready(**kw), det='BED_COMPO') + self.assertFalse(acquire_image(h2)['charging_artifacts']) + self.assertLess(abs(acquire_eds(h2, live=60.0)['duane_hunt_limit_ev'] - 15000.0), 600.0) + self.assertEqual(h2.v_surface, {}) + + def test_sed_rejected_in_lv_and_image_needs_beam(self): + h = ready(lv=True) + rejected(h, 'image.acquire', 'BEAM_NOT_READY', pixels='320x240', dwell_s=1e-5) + h.invoke('beam.observation_on') + h.step(rt.SATURATION_S + 1) + self.assertEqual(h.detector, 'BED_COMPO') + rejected(h, 'detector.select', 'DETECTOR_NOT_AVAILABLE', detector='SED') + + +class EdsPhysics(unittest.TestCase): + def setUp(self): + self.psi, self.omega = rt.eds_geometry(0.010, 0.0) + + def test_resolution_meets_the_catalogue(self): + self.assertLessEqual(rt.fwhm_ev(5898.75, rt.EDS_PROCESS_TIMES['T4']['noise_ev']), rt.EDS_FWHM_MN_SPEC_EV) + self.assertAlmostEqual(rt.fwhm_ev(5898.75, rt.EDS_PROCESS_TIMES['T4']['noise_ev']), 127.0, delta=0.5) + self.assertGreater(rt.fwhm_ev(5898.75, rt.EDS_PROCESS_TIMES['T1']['noise_ev']), 140.0) + + def test_geometry_matches_the_model_detector(self): + psi, om = rt.eds_geometry(0.010, 0.0) + self.assertAlmostEqual(math.degrees(psi), 35.0, places=9) + self.assertAlmostEqual(om, 25e-6 / 0.040 ** 2, places=12) + self.assertLess(rt.eds_geometry(0.030, 0.0)[1], om) + self.assertLess(rt.eds_geometry(0.010, math.radians(40))[0], psi) + + def test_line_positions_and_duane_hunt(self): + rates, gen, em = rt.spectrum_rates(rt.substance('iron')['composition_mass_fraction'], 15000.0, self.psi, self.omega, 60.0) + k = int(np.argmax(rates[300:]) + 300) + self.assertAlmostEqual((k + 0.5) * rt.EDS_CHANNEL_EV, 6403.84, delta=15.0) # Fe Ka1 (Elam) + self.assertEqual(float(rates[int(15000 / rt.EDS_CHANNEL_EV) + 2:].sum()), 0.0) # nothing above E0 + self.assertGreater(gen, em) # absorption + + def test_detector_efficiency_shape(self): + eff = rt.detector_efficiency + self.assertAlmostEqual(eff(5000.0), rt.WINDOW['grid_open'], delta=0.02) # the Si support grid bounds the efficiency + self.assertLess(eff(277.0), eff(1500.0)) + self.assertLess(eff(30000.0), eff(10000.0)) # 0.45 mm Si becomes transparent + self.assertGreater(eff(240.0), eff(300.0)) # window C K edge (284 eV) + + def test_count_rate_scales_with_current_and_dead_time(self): + h = observing(ready(), ip=1e-10) + a = acquire_eds(h, mode='area', live=10.0) + h.invoke('beam.set_probe_current', current_a=1e-9) + b = acquire_eds(h, mode='area', live=10.0) + self.assertAlmostEqual(b['input_count_rate_cps'] / a['input_count_rate_cps'], 10.0, delta=0.01) + self.assertGreater(b['dead_time_fraction'], a['dead_time_fraction']) + self.assertAlmostEqual(b['real_time_s'], 10.0 / (1 - b['dead_time_fraction']), places=6) + self.assertAlmostEqual(sum(b['counts']) / (b['input_count_rate_cps'] * 10.0), 1.0, delta=0.01) + + def test_standardless_quantification_of_pure_and_binary_compounds(self): + rng = np.random.default_rng(3) + noise = rt.EDS_PROCESS_TIMES['T3']['noise_ev'] + for sid, tol in (('iron', 1e-9), ('gallium_arsenide', 0.05), ('galena', 0.05), ('cadmium_telluride', 0.05), ('halite', 0.12)): + comp = rt.substance(sid)['composition_mass_fraction'] + rates, _, _ = rt.spectrum_rates(comp, 20000.0, self.psi, self.omega, noise) + y = rng.poisson(rates * 1e-9 / rt.E_CHARGE * 60.0) + res = {r['element']: r for r in rt.quantify(y, 20000.0, self.psi, noise, list(comp))} + self.assertAlmostEqual(sum(r['mass_fraction'] for r in res.values()), 1.0, places=9) + for e, w in comp.items(): + self.assertAlmostEqual(res[e]['mass_fraction'] / w, 1.0, delta=tol, msg=(sid, e)) + self.assertEqual(sorted(rt.identify_elements(y, 20000.0, noise)), sorted(comp), sid) + + def test_oxygen_is_underestimated_as_in_standardless_practice(self): + rng = np.random.default_rng(4) + noise = rt.EDS_PROCESS_TIMES['T3']['noise_ev'] + comp = rt.substance('quartz')['composition_mass_fraction'] + rates, _, _ = rt.spectrum_rates(comp, 15000.0, self.psi, self.omega, noise) + res = {r['element']: r['mass_fraction'] for r in rt.quantify(rng.poisson(rates * 1e-9 / rt.E_CHARGE * 60.0), 15000.0, self.psi, noise, ['Si', 'O'])} + self.assertLess(res['O'], comp['O']) + self.assertGreater(res['O'], 0.8 * comp['O']) + + def test_eds_through_the_runtime(self): + h = observing(ready(specimen=spec('ga', 'gallium_arsenide')), ip=1e-9) + sp = acquire_eds(h, mode='area', live=30.0) + self.assertEqual(sp['status'], 'completed') + self.assertEqual(len(sp['counts']), rt.EDS_CHANNELS) + q = h.invoke('eds.quantify', spectrum_id=sp['spectrum_id'], elements=[]) + self.assertEqual(sorted(q['elements_identified']), ['As', 'Ga']) + w = {r['element']: r['mass_fraction'] for r in q['results']} + self.assertAlmostEqual(w['Ga'], 0.482, delta=0.03) + rejected(h, 'eds.quantify', 'UNKNOWN_ELEMENT', spectrum_id=sp['spectrum_id'], elements=['Xx']) + rejected(h, 'eds.quantify', 'UNKNOWN_RECORD', spectrum_id='eds-99', elements=[]) + + +class GunAndFilament(unittest.TestCase): + def test_saturation_time_and_emission(self): + h = ready() + h.invoke('beam.observation_on') + h.step(5.0) + self.assertEqual(h.read()['beam.filament_state'], 'heating') + rejected(h, 'image.acquire', 'BEAM_NOT_READY', pixels='320x240', dwell_s=1e-5) + h.step(6.0) + r = h.read() + self.assertEqual(r['beam.filament_state'], 'saturated') + self.assertAlmostEqual(r['beam.emission_indicated_a'], rt.EMISSION_SAT_A, delta=0.05 * rt.EMISSION_SAT_A) + + def test_burnout_and_replacement(self): + h = observing(ready()) + h.fil_used_s = h.fil_life_s - 1.0 + h.step(3.0) + self.assertTrue(h.fil_burned) + self.assertEqual(h.error, 'FILAMENT_BURNOUT') + self.assertEqual(h.read()['beam.filament_state'], 'burned_out') + rejected(h, 'gun.replace_filament', 'VENT_REQUIRED') + h.invoke('error.acknowledge') + h.invoke('vacuum.vent') + h.step(150.0) + n = h.invoke('gun.replace_filament')['filament_serial'] + self.assertEqual(n, 2) + self.assertFalse(h.fil_burned) + self.assertEqual(h.fil_used_s, 0.0) + + +class LedgersIsolationSessions(unittest.TestCase): + def test_charge_and_gas_ledgers_close(self): + q = spec('quartz', 'quartz', topo='particles', height=0.003) + h = observing(ready(specimen=q, vent_gas='room_air'), det='SED') + acquire_image(h) + acquire_eds(h) + h.invoke('vacuum.toggle_lv') # the mode change switches the beam off + h.step(120.0) + h.invoke('beam.observation_on') + h.step(rt.SATURATION_S + 1.0) + acquire_image(h) + led = h.ledger() + self.assertLess(abs(led['charge_residual_c']), 1e-15 + 1e-9 * led['beam_charge_c']) + self.assertLess(abs(led['gas_residual_mol']), 1e-12 + 1e-9 * led['gas_pumped_mol']) + self.assertGreater(led['gas_pumped_mol'], 0.3) + self.assertGreater(led['xray_generated'], led['xray_detected'] > 0) + self.assertAlmostEqual(led['electrons_on_specimen'] * rt.E_CHARGE, led['beam_charge_c'], delta=1e-9 * led['beam_charge_c']) + + def test_two_instances_are_isolated(self): + a, b = ready(seed=1), ready(seed=1) + observing(a) + acquire_image(a) + self.assertFalse(b.ht) + self.assertEqual(b.images, {}) + self.assertNotEqual(a.read('evaluator'), b.read('evaluator')) + + def test_agent_does_not_see_truth(self): + h = ready() + h.register_principal('a', 'agent') + h.register_principal('e', 'evaluator') + a, e = h.session('a'), h.session('e') + ra = a.read(instance_id=h.instance_id)['observations'] + re_ = e.read(instance_id=h.instance_id)['observations'] + self.assertFalse(any(k.startswith('truth.') for k in ra)) + self.assertTrue(any(k.startswith('truth.') for k in re_)) + with self.assertRaises(rt.ActionRejected): + a.read(instance_id=h.instance_id, state_ids=['truth.chamber_pressure_pa']) + d = a.describe(instance_id=h.instance_id) + self.assertNotIn('ledger.read', d['capabilities']) + self.assertFalse(any(k.startswith('truth.') for k in d['state_slots'])) + r = a.invoke(instance_id=h.instance_id, capability_id='ledger.read', arguments={}, request_id='x') + self.assertEqual(r['error']['code'], 'ACCESS_DENIED') + + def test_records_and_control_belong_to_their_agent(self): + h = observing(ready()) + for p in ('a1', 'a2'): + h.register_principal(p, 'agent') + s1, s2 = h.session('a1'), h.session('a2') + I = h.instance_id + r = s1.invoke(instance_id=I, capability_id='image.acquire', arguments=dict(pixels='640x480', dwell_s=2e-5), request_id='r1') + self.assertEqual(r['status'], 'accepted') + self.assertEqual(s1.invoke(instance_id=I, capability_id='image.acquire', arguments=dict(pixels='640x480', dwell_s=2e-5), request_id='r1'), r) + self.assertEqual(s1.invoke(instance_id=I, capability_id='image.acquire', arguments=dict(pixels='320x240', dwell_s=2e-5), + request_id='r1')['error']['code'], 'REQUEST_CONFLICT') + # the other agent cannot steer the beam, the stage or the vacuum while the first agent acquires + for cap, args in (('beam.set_voltage', dict(voltage_v=5000.0)), ('stage.move_xy', dict(x_m=0.0, y_m=0.0)), ('vacuum.vent', {})): + self.assertEqual(s2.invoke(instance_id=I, capability_id=cap, arguments=args, request_id='g-' + cap)['error']['code'], 'ACCESS_DENIED') + o2 = s2.read(instance_id=I)['observations'] + self.assertTrue(o2['acquisition.started_by_other_agent']['value']) + self.assertIsNone(o2['acquisition.id']['value']) + h.step(10.0) + rid = h.operations[r['operation_id']]['record_id'] + self.assertEqual(s2.invoke(instance_id=I, capability_id='image.result', arguments=dict(image_id=rid), request_id='x2')['error']['code'], 'ACCESS_DENIED') + self.assertEqual(s2.invoke(instance_id=I, capability_id='image.result', arguments=dict(image_id='img-99'), request_id='x3')['error']['code'], + 'UNKNOWN_RECORD') + self.assertEqual(s1.invoke(instance_id=I, capability_id='image.result', arguments=dict(image_id=rid), request_id='x4')['status'], 'succeeded') + self.assertEqual(s1.read(instance_id=I)['observations']['result.last_image_id']['value'], rid) + self.assertIsNone(s2.read(instance_id=I)['observations']['result.last_image_id']['value']) + self.assertEqual(s2.invoke(instance_id=I, capability_id='records.list', arguments={}, request_id='x5')['result']['images'], []) + with self.assertRaises(rt.ActionRejected): + s2.poll(r['operation_id']) + + def test_cancel_keeps_the_dose_and_discards_the_frame(self): + h = observing(ready()) + h.register_principal('a', 'agent') + s = h.session('a') + r = s.invoke(instance_id=h.instance_id, capability_id='image.acquire', arguments=dict(pixels='2560x1920', dwell_s=1e-5), request_id='c1') + h.step(5.0) + q0 = h.ledger()['beam_charge_c'] + c = s.cancel(r['operation_id'], 'c2') + self.assertEqual(c['result']['phase'], 'cancelled') + rec = h.images[h.operations[r['operation_id']]['record_id']] + self.assertEqual((rec['status'], rec['error_code']), ('cancelled', 'USER_CANCEL')) + self.assertGreater(q0, 0.0) + self.assertEqual(h.ledger()['beam_charge_c'], q0) + self.assertIsNone(h.acq) + with self.assertRaises(rt.ActionRejected): + s.cancel(r['operation_id'], 'c3') + + def test_query_and_bookkeeping_capabilities(self): + h = observing(ready()) + h.invoke('stage.rotate', rotation_rad=math.pi / 2) + out = h.invoke('sim.step', dt_s=4.0) + self.assertAlmostEqual(out['time_s'], h.time_s, places=12) + self.assertAlmostEqual(h.stage['rot'], min(math.pi / 2, rt.STAGE_ROT_SPEED * 4.0), places=12) + h.invoke('sim.step', dt_s=4.0) + self.assertAlmostEqual(h.read()['stage.rotation_indicated_rad'], math.radians(90.0), places=9) + img = acquire_image(h) + sp = acquire_eds(h) + self.assertEqual(h.invoke('image.result', image_id=img['image_id'])['status'], 'completed') + res = h.invoke('eds.result', spectrum_id=sp['spectrum_id']) + self.assertEqual((res['status'], res['total_counts']), ('completed', sum(res['counts']))) + self.assertEqual(h.invoke('records.list'), dict(images=[img['image_id']], spectra=[sp['spectrum_id']])) + codes = [e['code'] for e in h.invoke('events.read', since_s=0.0)['events']] + for c in ('POWER_ON', 'SOFTWARE_READY', 'EVAC', 'EVAC_COMPLETE', 'HT_ON', 'IMAGE_START', 'EDS_START', 'ACQ_COMPLETED', 'LOAD'): + self.assertIn(c, codes) + prov = h.invoke('provenance.read') + self.assertEqual((prov['library'], prov['substances']), (rt.LIBRARY_REL, ['iron', 'silicon'])) + led = h.invoke('ledger.read') + self.assertEqual(set(led), set(rt.LEDGER_KEYS)) + self.assertGreater(led['beam_charge_c'], 0.0) + + def test_beam_off_fails_a_running_acquisition(self): + h = observing(ready()) + op = h.invoke('eds.acquire', mode='point', live_time_s=60.0, process_time='T3')['operation_id'] + h.step(5.0) + h.invoke('beam.observation_off') + rec = h.spectra[h.operations[op]['record_id']] + self.assertEqual((rec['status'], rec['error_code']), ('failed', 'BEAM_OFF')) + + + +class ReviewRoundOneRegressions(unittest.TestCase): + """Independent runtime review round 1 (F01-F23): each fixed behaviour is pinned here.""" + + def test_power_loss_while_venting_keeps_the_door_locked(self): # F01 + for wait in (0.0, 1.0): + h = ready() + h.invoke('vacuum.vent') + h.step(wait) + h.invoke('power.set', enabled=False) + self.assertEqual(h.vac_state, 'idle') + self.assertLess(h.p_ch, rt.VENT_READY_PA) + rejected(h, 'chamber.draw_out', 'CHAMBER_UNDER_VACUUM') + rejected(h, 'gun.replace_filament', 'VENT_REQUIRED') + h.step(60.0) + self.assertEqual(h._door_state(), 'closed') + h.invoke('power.set', enabled=True) # start-up pumps the chamber that was left under vacuum + h.step(rt.SOFTWARE_BOOT_S + 1.0) + h.invoke('vacuum.vent') + h.step(150.0) + self.assertEqual(h.vac_state, 'vented') + h.invoke('chamber.draw_out') + + def test_records_do_not_reveal_truth(self): # F02 + mix = dict(FE_SI, specimen_id='qz_pb', phases=[dict(substance_id='quartz', area_fraction=0.6, grain_size_m=2e-5), + dict(substance_id='galena', area_fraction=0.4, grain_size_m=2e-5)]) + h = observing(ready(specimen=mix)) + h.register_principal('a', 'agent') + s = h.session('a') + op = s.invoke(instance_id=h.instance_id, capability_id='image.acquire', arguments=dict(pixels='320x240', dwell_s=1e-5), request_id='i')['operation_id'] + h.step(h.operations[op]['duration'] + 1.0) + img = s.invoke(instance_id=h.instance_id, capability_id='image.result', arguments=dict(image_id=h.operations[op]['record_id']), request_id='r')['result'] + text = json.dumps(img) + for name in ('quartz', 'galena', 'substance_id', 'signal_per_electron'): + self.assertNotIn(name, text) + self.assertEqual(img['template_source']['substances'], []) + self.assertEqual(img['working_distance_m'], h.focus_wd) # the displayed WD, not the true one + self.assertIsNone(img['probe_diameter_m']) + op = s.invoke(instance_id=h.instance_id, capability_id='eds.acquire', arguments=dict(mode='point', live_time_s=10.0, process_time='T3'), + request_id='e')['operation_id'] + h.step(h.operations[op]['duration'] + 1.0) + sp = s.invoke(instance_id=h.instance_id, capability_id='eds.result', arguments=dict(spectrum_id=h.operations[op]['record_id']), request_id='s')['result'] + self.assertNotIn('landing_energy_ev', sp) + self.assertEqual(sp['template_source']['substances'], []) + self.assertEqual(sp['working_distance_m'], h.focus_wd) + self.assertAlmostEqual(sp['takeoff_angle_rad'], rt.eds_geometry(h.focus_wd, 0.0)[0], places=12) + h2 = observing(ready()) + h2.fil_used_s = h2.fil_life_s - 1.0 + h2.step(3.0) + msg = [e['message_zh'] for e in h2.events if e['code'] == 'FILAMENT_BURNOUT'][0] + self.assertNotRegex(msg, r'\d') + + def test_collision_check_covers_the_swept_path(self): # F03 + big = spec('big', 'iron', height=0.001, diameter=0.040) + h = ready(specimen=big, wd=0.005) + self.assertAlmostEqual(h.stage['z'], 0.042, places=9) + h.invoke('stage.set_z', z_lift_m=0.0) + rejected(h, 'stage.set_tilt', 'STAGE_COLLISION_RISK', tilt_rad=math.radians(90.0)) # the edge would sweep through the pole piece + h.step(25.0) + h.invoke('stage.set_tilt', tilt_rad=math.radians(90.0)) # once lowered, the tilt is safe + top = max(h._top_z_rel(h.stage['z'], math.radians(t)) for t in range(0, 91)) + self.assertLessEqual(top, 0.044 + 1e-12) + g = ready(wd=0.012) + g.invoke('stage.set_z', z_lift_m=0.015) + g.step(25.0) + g.invoke('stage.set_tilt', tilt_rad=math.radians(60.0)) + g.step(8.0) + rejected(g, 'stage.move_xy', 'STAGE_COLLISION_RISK', x_m=0.0, y_m=0.02) # Y rides on the tilted cradle (+17 mm at 60 deg) + g.invoke('stage.move_xy', x_m=0.0, y_m=-0.02) # moving down-slope is safe + + def test_charging_follows_the_incidence_angle(self): # F05 + charge = {} + for tilt in (0.0, 60.0): + q = spec('q', 'quartz', height=0.001, diameter=0.004) + h = ready(specimen=q, wd=0.010) + if tilt: + h.invoke('stage.set_z', z_lift_m=0.0) + h.step(25.0) + h.invoke('stage.set_tilt', tilt_rad=math.radians(tilt)) + h.step(8.0) + observing(h, det='SED') + h.step(60.0) + charge[tilt] = h.read('evaluator')['truth.specimen_charge_c'] + e2_0, e2_60 = rt.second_crossover_kev(rt.substance('quartz'), 0.0), rt.second_crossover_kev(rt.substance('quartz'), math.radians(60.0)) + self.assertTrue(3.0 < e2_0 < 4.5, e2_0) # F13: about 3-4 keV for quartz (no double-counted SE2) + self.assertGreater(e2_60, 3.0 * e2_0) # tilting raises E2 (the IT300 manual's remedy against charge-up) + self.assertGreater(charge[0.0], 3.0 * charge[60.0]) + self.assertGreater(charge[60.0], 0.0) + + def test_each_insulating_phase_keeps_its_own_potential(self): # F12 + mix = dict(FE_SI, specimen_id='qz_pm', phases=[dict(substance_id='quartz', area_fraction=0.5, grain_size_m=2e-5), + dict(substance_id='pmma', area_fraction=0.5, grain_size_m=2e-5)]) + h = observing(ready(specimen=mix), kv=20000.0, det='SED') + h.step(600.0) + self.assertEqual(len(h.v_surface), 2) + for k, ph in enumerate(mix['phases']): + sub = rt.substance(ph['substance_id']) + self.assertAlmostEqual(h._landing_ev(sub, h._spec(), k), 20000.0 - h.v_surface[k], places=9) + v_eq = h._v_equilibrium(sub, 0.0) + self.assertLessEqual(h.v_surface[k], v_eq + 1e-6) + self.assertAlmostEqual(h.v_surface[k], v_eq, delta=0.02 * v_eq) + self.assertNotAlmostEqual(h.v_surface[0], h.v_surface[1], delta=1000.0) # quartz E2 ~3.8 keV, PMMA ~1.4 keV + led = h.ledger() + self.assertLess(abs(led['charge_residual_c']), 1e-15 + 1e-9 * led['beam_charge_c']) + + def test_automatic_identification_on_library_spectra(self): # F06 + psi, om = rt.eds_geometry(0.010, 0.0) + noise = rt.EDS_PROCESS_TIMES['T3']['noise_ev'] + cases = [(15000.0, 'chromium', ['Cr']), (15000.0, 'nickel', ['Ni']), (15000.0, 'bismuth', ['Bi']), (20000.0, 'rutile', ['O', 'Ti']), + (20000.0, 'bone_cortical', ['C', 'Ca', 'O', 'P']), (15000.0, 'galena', ['Pb', 'S']), (15000.0, 'alanine', ['C', 'N', 'O']), + (15000.0, 'gold', ['Au'])] + rng = np.random.default_rng(7) + for kv, sid, expect in cases: + comp = rt.substance(sid)['composition_mass_fraction'] + rates, _, _ = rt.spectrum_rates(comp, kv, psi, om, noise) + y = rng.poisson(rates * 1e-9 / rt.E_CHARGE * 60.0) + found = sorted(rt.identify_elements(y, kv, noise)) + self.assertEqual([e for e in found if comp.get(e, 0.0) >= 0.02], expect, (sid, found)) + self.assertFalse(set(found) - set(comp), (sid, found)) + self.assertTrue({'Ne', 'Be', 'B'} <= rt.ID_EXCLUDED) + + def test_mode_change_switches_the_beam_off_with_an_event(self): # F07 + h = observing(ready(lv=True)) + self.assertTrue(h.ht) + h.invoke('vacuum.toggle_lv') + self.assertFalse(h.ht) + self.assertIsNone(h.error) + self.assertEqual([e['code'] for e in h.events][-2:], ['HT_OFF', 'MODE_HV']) + h.step(240.0) + self.assertEqual(h.vac_state, 'hv_ready') + + def test_declared_effects_and_errors(self): # F08, F09, F22 + h = observing(ready()) + h.invoke('system.shutdown') # instrumented invoke: the beam truth is a declared effect now + errs = {k: {e['code'] for e in v['errors']} for k, v in _meta()['capabilities'].items()} + for k in ('beam.observation_on', 'optics.autofocus', 'optics.auto_stigmate', 'optics.auto_contrast_brightness', 'image.acquire', 'eds.acquire'): + self.assertNotIn('DOOR_OPEN', errs[k], k) + self.assertNotIn('DETECTOR_NOT_AVAILABLE', errs[k], k) + self.assertNotIn('HT_ON', errs['gun.replace_filament']) + self.assertIn('STAGE_COLLISION_RISK', errs['stage.move_xy']) + self.assertIn('COUNT_RATE_TOO_HIGH', errs['eds.acquire']) + g = observing(ready(), ip=3e-7) + rejected(g, 'eds.acquire', 'COUNT_RATE_TOO_HIGH', mode='point', live_time_s=600.0, process_time='T4') + w = configured() + w.invoke('specimen.provide', **spec('wet', 'bone_cortical', wet=True, height=0.003)) + w.invoke('power.set', enabled=True) + w.step(rt.SOFTWARE_BOOT_S + 1.0) + w.invoke('chamber.draw_out') + w.step(3.0) + w.invoke('specimen.load', specimen_id='wet') + w.invoke('vacuum.evacuate') # pumping with the door out: roughing never reaches crossover + w.step(2.0) + w.invoke('specimen.unload') # unloading the wet specimen changes the gas load (declared effect) + + def test_queries_and_zero_steps_keep_the_revision(self): # F10 + h = observing(ready()) + rev = h.revision + h.invoke('records.list') + h.invoke('events.read', since_s=0.0) + h.invoke('ledger.read') + h.invoke('provenance.read') + h.invoke('sim.step', dt_s=0.0) + h.step(0.0) + self.assertEqual(h.revision, rev) + h.step(1.0) + self.assertEqual(h.revision, rev + 1) + + def test_redeclared_room_temperature_keeps_the_gas_ledger(self): # F11 + h = configured() + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, room_k=300.15)) + self.assertLess(abs(h.ledger()['gas_residual_mol']), 1e-12) + self.assertAlmostEqual(h.p_ch, rt.P_ATM * 300.15 / 295.15, places=6) + + def test_bed_factor_and_filament_life(self): # F14, F20, F23 + d, _ = rt.probe(30000.0, 3e-12, 0.005) + self.assertAlmostEqual(rt.K_RES * d * rt.BED_RES_FACTOR, 4.0e-9, delta=0.02e-9) + self.assertEqual(rt.FILAMENT_LIFE_H, 300.0) + rt.second_crossover_kev(rt.substance('quartz'), 0.3) + self.assertFalse(any(k.startswith('_') for k in rt.library()['substances']['quartz'])) + + + +class ReviewRoundTwoRegressions(unittest.TestCase): + """Independent runtime review round 2 (F24-F30).""" + + def test_vent_keeps_y_when_the_return_would_lift_the_rim(self): # F24 + thin = spec('thin', 'iron', height=0.001, diameter=0.010) + h = ready(specimen=thin, wd=0.030) + h.invoke('stage.set_z', z_lift_m=0.0) + h.step(20.0) + h.invoke('stage.set_tilt', tilt_rad=math.radians(60.0)) + h.step(8.0) + h.invoke('stage.move_xy', x_m=0.01, y_m=-0.02) + h.step(15.0) + h.invoke('stage.set_z', z_lift_m=0.043) # rim is safe at Y -20 mm, not at Y 0 + h.step(25.0) + h.invoke('vacuum.vent') + codes = [e['code'] for e in h.events][-3:] + self.assertIn('Y_RETURN_SKIPPED', codes) + h.step(30.0) + self.assertEqual(h.stage['x'], 0.0) + self.assertAlmostEqual(h.stage['y'], -0.02, places=12) + self.assertLessEqual(h._top_z_rel(h.stage['z'], h.stage['tilt'], h.stage['y']), 0.044 + 1e-12) + + def test_lowering_is_always_allowed_from_a_too_high_pose(self): # F25 + h = ready(wd=0.010) # 5 mm specimen at Z 33 mm + h.invoke('vacuum.vent') + h.step(150.0) + h.invoke('chamber.draw_out') + h.step(3.0) + h.invoke('specimen.unload') + h.invoke('specimen.provide', **spec('tall20', 'aluminium', height=0.020)) + h.invoke('specimen.load', specimen_id='tall20') # top now 53 mm above the WD-48 plane (door out) + rejected(h, 'chamber.draw_in', 'STAGE_COLLISION_RISK') + h.invoke('stage.set_z', z_lift_m=0.010) + h.step(15.0) + h.invoke('chamber.draw_in') + h.step(3.0) + rejected(h, 'stage.set_z', 'STAGE_COLLISION_RISK', z_lift_m=0.025) # inside: raising the top to 45 mm is refused + h.invoke('stage.set_z', z_lift_m=0.005) # lowering stays possible + + def test_lowered_voltage_below_the_surface_potential_mirrors_the_beam(self): # F26 + q = spec('q', 'quartz', height=0.001, diameter=0.004) + h = observing(ready(specimen=q, wd=0.010), kv=15000.0, det='SED') + h.step(120.0) + v0 = dict(h.v_surface) + self.assertGreater(max(v0.values()), 10000.0) + h.invoke('beam.set_voltage', voltage_v=5000.0) + e0 = h.ledger()['beam_energy_j'] + h.step(5.0) + self.assertEqual(h.v_surface, v0) # nothing lands, the potential stays + self.assertEqual(h.ledger()['beam_energy_j'], e0) + led = h.ledger() + self.assertLess(abs(led['charge_residual_c']), 1e-15 + 1e-9 * led['beam_charge_c']) + u, v, on = h._beam_point() + sub, th, az, k = h._phase_sub(h._spec(), u, v) + self.assertEqual(h._landing_ev(sub, h._spec(), k), 0.0) + + def test_regions_merge_indistinguishable_phases_and_resolution_is_measured(self): # F28 + twin = dict(FE_SI, specimen_id='fe_fe', phases=[dict(substance_id='iron', area_fraction=0.3, grain_size_m=2e-5), + dict(substance_id='iron', area_fraction=0.7, grain_size_m=2e-5)]) + h = observing(ready(specimen=twin)) + img = acquire_image(h) + self.assertEqual([r['region_id'] for r in img['regions']], ['region_1']) + self.assertAlmostEqual(img['regions'][0]['area_fraction_in_view'], 1.0, places=12) + fr = h._frame_signals(dwell=1e-5, nx=320, ny=240, noise=False) + self.assertNotEqual(img['effective_resolution_m'], fr['eff_res']) + self.assertEqual(img['effective_resolution_m'], float(f"{img['effective_resolution_m']:.2g}")) + + def test_duane_hunt_limit_validity(self): # F29 + psi, om = rt.eds_geometry(0.010, 0.0) + rates, _, _ = rt.spectrum_rates(rt.substance('iron')['composition_mass_fraction'], 15000.0, psi, om, 60.0) + rng = np.random.default_rng(3) + y = rng.poisson(rates * 1e-9 / rt.E_CHARGE * 30.0) + dh = rt.duane_hunt_limit(y, 60.0, 15000.0) + self.assertLessEqual(dh, 15000.0) + self.assertLess(abs(dh - 15000.0), 200.0) + self.assertIsNone(rt.duane_hunt_limit(rng.poisson(rates * 1e-12 / rt.E_CHARGE * 5.0), 60.0, 15000.0)) # too few counts + r30, _, _ = rt.spectrum_rates(rt.substance('iron')['composition_mass_fraction'], 30000.0, psi, om, 60.0) + self.assertIsNone(rt.duane_hunt_limit(rng.poisson(r30 * 1e-9 / rt.E_CHARGE * 30.0), 60.0, 30000.0)) # tail beyond 20.48 keV + + + def test_door_commanded_in_counts_as_inside(self): # F31 + h = ready(wd=0.010) + h.invoke('vacuum.vent') + h.step(150.0) + h.invoke('chamber.draw_out') + h.step(3.0) + h.invoke('stage.set_z', z_lift_m=0.030) # drawn out: free + h.step(20.0) + h.invoke('stage.set_z', z_lift_m=0.020) + h.step(10.0) + h.invoke('chamber.draw_in') # accepted at the safe pose, the door has not moved yet + rejected(h, 'stage.set_z', 'STAGE_COLLISION_RISK', z_lift_m=0.043) # judged as inside now + rejected(h, 'specimen.unload', 'DOOR_NOT_OPEN') + h.invoke('specimen.provide', **spec('tall30', 'aluminium', height=0.030)) + rejected(h, 'specimen.load', 'DOOR_NOT_OPEN', specimen_id='tall30') + meta = _meta()['capabilities']['chamber.draw_in']['errors'] + self.assertIn('严格', next(e['meaning_zh'] for e in meta if e['code'] == 'STAGE_COLLISION_RISK')) + + + def test_separable_phases_stay_separate_regions(self): # F33 + ti_zn = dict(FE_SI, specimen_id='ti_zn', phases=[dict(substance_id='titanium', area_fraction=0.5, grain_size_m=2e-5), + dict(substance_id='zinc', area_fraction=0.5, grain_size_m=2e-5)]) + h = observing(ready(specimen=ti_zn), ip=1e-10) + img = acquire_image(h, dwell=1e-6) + self.assertEqual(len(img['regions']), 2, img['regions']) + five = dict(FE_SI, specimen_id='five', phases=[dict(substance_id=s_, area_fraction=0.2, grain_size_m=2e-5) + for s_ in ('carbon_graphite', 'aluminium', 'titanium', 'copper', 'gold')]) + g = observing(ready(specimen=five), ip=1e-10) + self.assertEqual(len(acquire_image(g, dwell=1e-5)['regions']), 5) + + + def test_lv_skirt_compresses_the_region_greys_like_the_thumbnail(self): # F34 + ti_zn = dict(FE_SI, specimen_id='ti_zn_lv', phases=[dict(substance_id='titanium', area_fraction=0.5, grain_size_m=2e-5), + dict(substance_id='zinc', area_fraction=0.5, grain_size_m=2e-5)]) + h = ready(specimen=ti_zn, lv=True) + h.invoke('vacuum.set_lv_pressure', pressure_pa=100.0) + h.step(60.0) + observing(h, kv=20000.0) + img = acquire_image(h, dwell=1e-5) + greys = sorted(r['mean_grey'] for r in img['regions']) + self.assertEqual(len(greys), 2) + self.assertTrue(10.0 < greys[0] < greys[1] < 245.0, greys) # not clipped: the ACB was set on the skirted frame + thumb = np.asarray(img['thumbnail'], float) + cut = 0.5 * (greys[0] + greys[1]) + self.assertAlmostEqual(float(thumb[thumb > cut].mean()), greys[1], delta=25.0) + self.assertAlmostEqual(float(thumb[thumb <= cut].mean()), greys[0], delta=25.0) + + + def test_texture_and_topo_noise(self): # F35 + def two(sid, a, b, topo): + return dict(FE_SI, specimen_id=sid, topography=topo, phases=[dict(substance_id=a, area_fraction=0.5, grain_size_m=3e-5), + dict(substance_id=b, area_fraction=0.5, grain_size_m=3e-5)]) + for det, ip, dwell in (('BED_TOPO', 1e-12, 1e-6), ('SED', 1e-9, 1e-5), ('BED_COMPO', 1e-8, 1e-4)): + h = observing(ready(specimen=two('ti_ti_rough', 'titanium', 'titanium', 'rough_fracture')), kv=20000.0, ip=ip, det=det, mag=500.0) + img = acquire_image(h, pixels='640x480', dwell=dwell) + self.assertEqual(len(img['regions']), 1, (det, img['regions'])) # texture of the grains, not two phases + self.assertAlmostEqual(img['regions'][0]['area_fraction_in_view'], 1.0, places=12) + if det == 'BED_TOPO': + self.assertIsNone(img['contrast']) # signed difference signal + h = observing(ready(specimen=two('ti_zn_flat', 'titanium', 'zinc', 'flat_polished')), kv=20000.0, ip=1e-12, det='BED_TOPO', mag=500.0) + self.assertLess(h.acb['gain'], 1e-6) # stretched to the noise, not to 1e32 + img = acquire_image(h, pixels='640x480', dwell=1e-6) + self.assertGreater(float(np.std(img['thumbnail'])), 5.0) # the sum signal's shot noise remains + g = observing(ready(specimen=two('fe_si_rough', 'iron', 'silicon', 'rough_fracture')), kv=20000.0, ip=1e-9, det='BED_COMPO', mag=500.0) + self.assertEqual(len(acquire_image(g, pixels='640x480', dwell=1e-5)['regions']), 2) # composition contrast still separates + + + +class _QuietRng: + """Noise-free stand-in for the runtime's random.Random (gauges exact, fixed draws) so that two runs differ only by the process.""" + def gauss(self, mu, sigma): + return mu + + def random(self): + return 0.5 + + def uniform(self, a, b): + return 0.5 * (a + b) + + def getrandbits(self, k): + return 12345 + + +class ContractReviewRegressions(unittest.TestCase): + def test_on_step_effects_cover_what_the_process_changes(self): # C20 + """For each timed capability: the slots whose trajectories differ from an otherwise identical run without the call are declared + (immediate or on_step); the step itself only changes slots declared as on_step effects of sim.step.""" + def lv_ready(): + h = ready(lv=True) + return h + + def drawn_out(): + h = ready(evacuate=False) + h.invoke('chamber.draw_out') + h.step(10.0) + return h + + def moved(): + h = ready() + h.invoke('stage.move_xy', x_m=0.01, y_m=0.005) + h.step(30.0) + return h + cases = [('power.set', lambda: configured(), dict(enabled=True), 300.0), ('power.key_toggle', lambda: configured(), {}, 300.0), + ('vacuum.evacuate', lambda: ready(evacuate=False), {}, 300.0), ('vacuum.vent', moved, {}, 200.0), + ('vacuum.toggle_lv', ready, {}, 300.0), ('vacuum.set_lv_pressure', lv_ready, dict(pressure_pa=80.0), 120.0), + ('chamber.draw_out', lambda: ready(evacuate=False), {}, 10.0), ('chamber.draw_in', drawn_out, {}, 10.0), + ('stage.move_xy', ready, dict(x_m=0.01, y_m=-0.005), 60.0), ('stage.set_z', ready, dict(z_lift_m=0.030), 60.0), + ('stage.set_tilt', ready, dict(tilt_rad=0.3), 60.0), ('stage.rotate', ready, dict(rotation_rad=1.0), 60.0), + ('beam.observation_on', ready, {}, 120.0), ('image.acquire', lambda: observing(ready()), dict(pixels='640x480', dwell_s=2e-5), 12.0), + ('eds.acquire', lambda: observing(ready()), dict(mode='point', live_time_s=10.0, process_time='T3'), 40.0)] + # the same calls while the beam is on (conductive specimen, charging uncoated quartz, low vacuum): consequences on the beam process count too + def quartz_on(): + return observing(ready(specimen=spec('quartz', 'quartz', topo='particles', height=0.003)), kv=15000.0) + + def lv_on(): + return observing(ready(lv=True)) + for make in (lambda: observing(ready()), quartz_on): + cases += [('power.set', make, dict(enabled=False), 30.0), ('power.key_toggle', make, {}, 30.0), ('vacuum.vent', make, {}, 60.0), + ('vacuum.toggle_lv', make, {}, 60.0), ('stage.move_xy', make, dict(x_m=0.002, y_m=0.001), 30.0), + ('stage.set_z', make, dict(z_lift_m=0.030), 30.0), ('stage.set_tilt', make, dict(tilt_rad=0.35), 30.0), + ('stage.rotate', make, dict(rotation_rad=1.0), 30.0), ('image.acquire', make, dict(pixels='640x480', dwell_s=2e-5), 12.0), + ('eds.acquire', make, dict(mode='point', live_time_s=10.0, process_time='T3'), 40.0), + ('eds.acquire', make, dict(mode='area', live_time_s=10.0, process_time='T3'), 40.0)] + def moving_on(): + h = quartz_on() + h.invoke('stage.move_xy', x_m=0.004, y_m=0.002) + h.step(0.5) + return h + def lv_imaging(): + h = observing(ready(lv=True)) + h.invoke('image.acquire', pixels='2560x1920', dwell_s=2e-5) + h.step(2.0) + return h + cases += [('vacuum.set_lv_pressure', lv_on, dict(pressure_pa=80.0), 60.0), ('vacuum.toggle_lv', lv_on, {}, 120.0), ('vacuum.vent', lv_on, {}, 60.0), + ('vacuum.set_lv_pressure', lv_imaging, dict(pressure_pa=90.0), 30.0), # the frame fails with VACUUM_LOST + ('power.set', moving_on, dict(enabled=False), 30.0), ('power.key_toggle', moving_on, {}, 30.0)] # the X/Y motors stop without power + # calls without a process of their own whose consequences appear on the step (beam off, landing energy/current/field on a charging insulator, + # a mains trip or new room conditions) + for make in (lambda: observing(ready()), quartz_on): + cases += [('beam.observation_off', make, {}, 30.0), ('system.shutdown', make, {}, 30.0), ('beam.set_voltage', make, dict(voltage_v=5000.0), 30.0), + ('beam.set_probe_current', make, dict(current_a=1e-9), 30.0), ('scan.set_magnification', make, dict(magnification=5000.0), 30.0), + ('plant.configure', make, dict(rt.PLANT_EXAMPLE, mains_voltage_v=120.0), 30.0)] + def roughing_door_out(load_wet): + def make(): + h = ready(specimen=None, evacuate=False) + h.invoke('specimen.provide', **spec('wet_leaf', 'tissue_soft', wet=True, height=0.002)) + h.invoke('chamber.draw_out') + h.step(10.0) + if load_wet: + h.invoke('specimen.load', specimen_id='wet_leaf') + h.invoke('vacuum.evacuate') + h.step(5.0) + return h + return make + cases += [('specimen.load', roughing_door_out(False), dict(specimen_id='wet_leaf'), 60.0), ('specimen.unload', roughing_door_out(True), {}, 60.0), + ('chamber.draw_in', roughing_door_out(True), {}, 300.0), ('chamber.draw_in', roughing_door_out(False), {}, 300.0)] + cases += [('plant.configure', lambda: ready(evacuate=False), dict(rt.PLANT_EXAMPLE, room_k=303.15), 60.0), + ('plant.configure', moving_on, dict(rt.PLANT_EXAMPLE, mains_voltage_v=80.0), 30.0)] + declared_all = {k: set(rt.EFFECTS[k]) | set(rt.ON_STEP.get(k, [])) for k in rt.EFFECTS} + missing = {} + for cap, make, args, horizon in cases: + runs = [] + for call in (True, False): + h = make() + h.rng = _QuietRng() + if call: + h.invoke(cap, **args) + traj = [] + for dt in (1.0, 5.0) + (horizon / 8.0,) * 8: + h.step(dt) + traj.append(h.read('evaluator')) + runs.append(traj) + changed = {k for a, b in zip(*runs) for k in a if a[k] != b[k]} + for k in changed - declared_all[cap] - {'clock.time_s'}: + missing.setdefault(cap, set()).add(k) + step_changed = {k for a, b in zip(runs[0], runs[0][1:]) for k in a if a[k] != b[k]} + for k in step_changed - set(rt.ON_STEP['sim.step']): + missing.setdefault('sim.step', set()).add(k) + self.assertEqual(missing, {}) + self.assertFalse([s for v in rt.ON_STEP.values() for s in v if rt.SLOTS[s]['origin'] == 'setpoint']) + + def test_gun_vacuum_loss_trips_the_high_voltage(self): # C05 + h = observing(ready()) + op = h.invoke('image.acquire', pixels='1280x960', dwell_s=1e-4)['operation_id'] + h.step(2.0) + h.p_ch = 50.0 # fault injection: a sudden chamber leak (no public command reaches the gun trip) + h.step(1.0) + v = h.read('evaluator') + self.assertFalse(v['beam.ht_on']) + self.assertEqual(v['system.error_code'], 'HT_TRIP') + self.assertGreater(v['truth.gun_pressure_pa'], rt.GUN_TRIP_PA) + self.assertIn('HT_TRIP', [e['code'] for e in h.events]) + self.assertEqual(h.images[h.operations[op]['record_id']]['status'], 'failed') + rejected(h, 'beam.observation_on', 'ERROR_PENDING') + + def test_units_and_sampling(self): # C07, C08, C11 + meta = _meta() + si = {'1', 's', 'm', 'rad', 'Pa', 'V', 'A', 'C', 'J', 'mol', 'kg', 'K', 'W', 'F', 'm^2', 'sr', '1/s', 'Pa*m^3/s', 'm^3', 'm^3/s', 'm/s', + 'rad/s', 'Hz', 'A/(m^2 sr V)'} + units = {v['unit'] for v in meta['state_slots'].values()} + for mech in meta['mechanisms'].values(): + units |= {p_['unit'] for p_ in mech['parameters'].values()} + self.assertLessEqual(units - si, {'eV', '1/eV'}, units - si) + h = ready() + h.register_principal('e', 'evaluator') + h.invoke('stage.move_xy', x_m=0.01, y_m=0.0) + h.step(0.5) + obs = h.session('e').read(instance_id=h.instance_id)['observations'] + self.assertIsNone(obs['stage.x_indicated_m']['sample_window_s']) + self.assertGreater(obs['stage.x_indicated_m']['value'], 0.0) # continuous between the cycles + self.assertEqual(obs['vacuum.chamber_pressure_indicated_pa']['sample_window_s'], rt.CYCLE_S) + self.assertEqual(obs['vacuum.chamber_pressure_indicated_pa']['sample_time_s'], math.floor(h.time_s)) + self.assertEqual(obs['truth.filament_life_s']['unit'], 's') + self.assertNotIn('Pure read of the latest 1 s instrument cycle', json.dumps(meta['state_slots'])) + + + def test_wet_specimen_outgasses_whenever_it_is_in_the_pumped_chamber(self): # F38 + wet = spec('leaf', 'tissue_soft', wet=True, topo='rough_fracture', height=0.002) + h = ready(specimen=None, evacuate=False) + h.invoke('specimen.provide', **wet) + h.invoke('chamber.draw_out') + h.step(10.0) + h.invoke('vacuum.evacuate') # EVAC pressed with the door out, the specimen loaded afterwards + h.step(5.0) + h.invoke('specimen.load', specimen_id='leaf') + h.step(20.0) + self.assertEqual(h._spec()['_wet_exposed_s'], 0.0) # drawn out: in room air, not drying + h.invoke('stage.set_z', z_lift_m=rt.WD_RANGE_M[1] - 0.010 - 0.002) + h.step(30.0) + h.invoke('chamber.draw_in') + h.step(rt.EVAC_LIMIT_S) + self.assertEqual(h.error, 'EVAC_TIMEOUT') # the water load keeps high vacuum out of reach, as on the normal path + self.assertNotEqual(h.vac_state, 'hv_ready') + dried = h._spec()['_wet_exposed_s'] + self.assertGreater(dried, 400.0) + h.invoke('error.acknowledge') + h.invoke('vacuum.vent') + h.step(200.0) + self.assertEqual(h._spec()['_wet_exposed_s'], dried) # venting neither dries nor re-wets it + h.invoke('vacuum.toggle_lv') + h.invoke('vacuum.evacuate') + h.step(3600.0) # an hour in low vacuum dries it + h.invoke('vacuum.vent') + h.step(200.0) + h.invoke('vacuum.toggle_lv') + h.invoke('vacuum.evacuate') + h.step(400.0) + self.assertEqual(h.vac_state, 'hv_ready') + led = h.ledger() + self.assertLess(abs(led['gas_residual_mol']), 1e-9 * max(1.0, led['gas_admitted_mol'])) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_asset_keyence_vkx3000.py b/tests/test_asset_keyence_vkx3000.py new file mode 100644 index 0000000000000000000000000000000000000000..33ff89c6dc7532b01b709509779bfb6b897c7505 --- /dev/null +++ b/tests/test_asset_keyence_vkx3000.py @@ -0,0 +1,1494 @@ +"""tests for CHEM-155 keyence_vkx3000: python3 -m unittest tests/test_asset_keyence_vkx3000.py + +Topics (pipeline.md): set points only write targets, read/describe are pure, rejected preconditions leave the state unchanged, two instances +are isolated, agent/evaluator truth isolation, conservation (laser energy: reflected + absorbed + transmitted = energy to the sample; travel and +frame ledgers), real return values validated against the declared schemas (asset_tool lint_schema / validate_value), asynchronous completion +and cancellation remnants, host-step independence, declared immediate and on_step effects (scenario states, short and long windows); plus the +instrument (boot and Z homing, motorized XY, manual lift without power, revolver timing and the empty optical axis while turning, lens-change +retraction, collision protection, faults) and the measurement physics: laser-confocal heights on opaque steps against the hidden Z scale, +transparent-step errors of the strongest / first peak, confocal film mode and its resolution limit, slope cut-off of the numerical aperture, +double scan on dark pixels, focus variation needing texture, white light interferometry with the phase change on reflection of Au against Si, +spectral film thickness (right and wrong materials, range), Z and XY calibration with step and pitch standards, stitching, ISO analyses. +""" +import copy +import json +import math +import sys +import unittest +from pathlib import Path + +import numpy as np + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / 'scripts')) +sys.path.insert(0, str(ROOT / 'skills/chemistry-lab-assets/scripts')) +from asset_runtime import keyence_vkx3000 as rt # noqa: E402 +import asset_tool # noqa: E402 + +CHECKS, PROCESS_EVIDENCE, REJECTIONS = [], {}, {} +_META = {} + + +def _meta(): + if not _META: + _META.update(rt.export_keyence_vkx3000_contract_metadata()) + return _META + + +def _changed(a, b): + return json.dumps(a, sort_keys=True, default=str) != json.dumps(b, sort_keys=True, default=str) + + +_orig_invoke = rt.KeyenceVkx3000Runtime.invoke + + +def _instrumented_invoke(self, capability_id, **a): + """Every successful call is checked against its declared output schema and immediate state effects (a call does not advance time); every + rejection code is recorded for the declaration check.""" + before = self.read('evaluator') if capability_id != 'sim.step' else None + t0 = self.t + try: + out = _orig_invoke(self, capability_id, **a) + except rt.ActionRejected as exc: + REJECTIONS.setdefault(capability_id, set()).add(str(exc)) + raise + meta = _meta()['capabilities'][capability_id] + errs = asset_tool.validate_value(out, meta['output_schema']) + if errs: + raise AssertionError(f'{capability_id} output violates its schema: {errs[:3]}') + if before is not None: + assert self.t == t0, capability_id + after = self.read('evaluator') + undeclared = {k for k in after if _changed(before[k], after[k])} - set(rt.EFFECTS.get(capability_id, [])) + if undeclared and len(rt.EFFECTS) > 1: + raise AssertionError(f'{capability_id} changed undeclared state immediately: {sorted(undeclared)}') + PROCESS_EVIDENCE.setdefault(capability_id, []).append(dict(arguments=copy.deepcopy(a), result_keys=sorted(out))) + return out + + +rt.KeyenceVkx3000Runtime.invoke = _instrumented_invoke + +AU = dict(sample_id='au_step', substrate_substance_id='si', thickness_m=5.25e-4, size_x_m=0.010, size_y_m=0.010, + features=[dict(kind='step', substance_id='au', height_m=200e-9, width_m=0.3e-6, pitch_m=0.0, x_m=0.0, y_m=0.0, extent_m=0.004)], film=None, + roughness=dict(sq_m=0.5e-9, correlation_length_m=2e-6), tilt_x_rad=0.0, tilt_y_rad=0.0) +TALL = dict(AU, sample_id='tall', thickness_m=0.033, features=[]) +PMMA3 = dict(sample_id='pmma_al', substrate_substance_id='al', thickness_m=0.001, size_x_m=0.010, size_y_m=0.010, features=[], + film=dict(substance_id='pmma', thickness_m=3.0e-6), roughness=dict(sq_m=0.5e-9, correlation_length_m=5e-6), tilt_x_rad=0.0, tilt_y_rad=0.0) +STEEL = dict(sample_id='worn_steel', substrate_substance_id='stainless_steel', thickness_m=0.003, size_x_m=0.020, size_y_m=0.020, + features=[dict(kind='groove', substance_id=None, height_m=-5e-6, width_m=200e-6, pitch_m=0.0, x_m=0.0, y_m=0.0, extent_m=0.010)], film=None, + roughness=dict(sq_m=0.2e-6, correlation_length_m=10e-6), tilt_x_rad=0.0, tilt_y_rad=0.0) +STEP_STD = dict(sample_id='step_standard', substrate_substance_id='sio2_fused', thickness_m=0.00635, size_x_m=0.025, size_y_m=0.025, + features=[dict(kind='step', substance_id='cr', height_m=1.803e-6, width_m=0.5e-6, pitch_m=0.0, x_m=0.0, y_m=0.0, extent_m=0.005)], + film=dict(substance_id='cr', thickness_m=60e-9), roughness=dict(sq_m=0.5e-9, correlation_length_m=3e-6), tilt_x_rad=0.001, tilt_y_rad=0.0) +GRATING = dict(sample_id='grating', substrate_substance_id='si', thickness_m=5.25e-4, size_x_m=0.010, size_y_m=0.010, + features=[dict(kind='grating', substance_id=None, height_m=0.5e-6, width_m=5e-6, pitch_m=10e-6, x_m=0.0, y_m=0.0, extent_m=0.004)], film=None, + roughness=dict(sq_m=0.5e-9, correlation_length_m=3e-6), tilt_x_rad=0.0, tilt_y_rad=0.0) +FAST = dict(rt.SETTINGS_EXAMPLE, quality='high_speed') + + +def configured(seed=1, **plant): + h = rt.KeyenceVkx3000Runtime() + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, noise_seed=seed, **plant)) + return h + + +def ready(seed=1, **plant): + h = configured(seed, **plant) + h.invoke('power.set', enabled=True) + h.step(rt.BOOT_S + 1.0) + return h + + +def busy(h): + return h._z_moving() or not h._revolver_settled() or h._stage_moving() or h.op is not None or h._lift_moving() + + +def settle(h, limit=900.0, dt=0.5): + t = 0.0 + while busy(h) and t < limit: + h.step(dt) + t += dt + assert not busy(h) + return h + + +def focus_near(h, above=1.0e-4): + s = h.samples[h.on_stage] + hi = rt.sample_extremes(s)[0] + h.invoke('focus.move', z_m=h._z_for_focus(rt.SAMPLE_PLATE_Z + h.lift + s['thickness_m'] + 0.5 * hi) - above) + return settle(h) + + +def loaded(sample=AU, slot=1, seed=1, x=0.0, y=0.0): + h = ready(seed) + if sample['sample_id'] not in h.samples: + h.invoke('sample.provide', **sample) + h.invoke('sample.place', sample_id=sample['sample_id'], x_m=x, y_m=y) + h.invoke('lens.select', slot=slot) + settle(h) + return focus_near(h) + + +def wait(h, op, tmax=3600.0, dt=0.5): + t0 = h.t + while h.operations[op]['phase'] == 'running' and h.t - t0 < tmax: + h.step(dt) + return h.operations[op]['phase'] + + +def prepare(h, mode='laser_confocal', **settings): + h.invoke('measurement.configure', **dict(rt.SETTINGS_EXAMPLE, mode=mode, **settings)) + op = h.invoke('focus.auto')['operation_id'] + assert wait(h, op) == 'completed', h.operations[op] + op = h.invoke('measurement.auto_range')['operation_id'] + assert wait(h, op) == 'completed', h.operations[op] + return h + + +def measure(h, mode='laser_confocal', autofocus=True, **settings): + if autofocus: + prepare(h, mode, **settings) + op = h.invoke('measurement.start')['operation_id'] + assert wait(h, op) == 'completed', h.operations[op] + rid = h.operations[op]['record_id'] + return rid, h.records[rid] + + +def hmap(r, key='height_m'): + return rt._none_to_nan(r[key]) + + +def step_height(h, rid, lower, upper, axis='x'): + return h.invoke('data.step_height', record_id=rid, axis=axis, lower=lower, upper=upper, leveling='none')['step_height_m'] + + +def rejected(h, cap, code, **a): + before = h.read('evaluator') + rev = h.revision + led = h.ledger() + try: + h.invoke(cap, **a) + except rt.ActionRejected as exc: + assert str(exc) == code, (cap, str(exc), code) + assert not _changed(h.read('evaluator'), before), cap + assert h.revision == rev, cap + assert not _changed(h.ledger(), led), cap + return True + raise AssertionError(f'{cap} was not rejected (expected {code})') + + +def pcor_offset(a, b, lam=rt.WLI_LAMBDA0_M): + """Apparent height offset of material a against b in phase-shifting interferometry (phase change on reflection at normal incidence).""" + pa = np.angle(-(1 - rt.nk(a, lam)) / (1 + rt.nk(a, lam))) + pb = np.angle(-(1 - rt.nk(b, lam)) / (1 + rt.nk(b, lam))) + return float(-(pa - pb) * lam / (4 * math.pi)) + + +class ContractAndSchemas(unittest.TestCase): + def test_module_identity(self): + self.assertEqual(rt.ASSET_TYPE_ID, 'instrument.keyence_vkx3000') + self.assertEqual(rt.CATALOG_ID, 'CHEM-155') + + def test_schemas_lint_and_examples_validate(self): + m = _meta() + for k, c in m['capabilities'].items(): + for part in ('input_schema', 'output_schema'): + self.assertEqual(asset_tool.lint_schema(c[part]), [], (k, part)) + ex = rt.CAPS[k].get('example_arguments') + if ex is not None: + self.assertEqual(asset_tool.validate_value(ex, c['input_schema']), [], k) + for k, s in m['state_slots'].items(): + self.assertEqual(asset_tool.lint_schema(s['value_schema']), [], k) + v = ready().read('evaluator') + for k, x in v.items(): + self.assertEqual(asset_tool.validate_value(x, m['state_slots'][k]['value_schema']), [], k) + + def test_metadata_references_are_consistent(self): + m = _meta() + slots, comps = set(m['state_slots']), set(rt.COMPONENTS) if hasattr(rt, 'COMPONENTS') else None + for k, c in m['capabilities'].items(): + for e in c['state_effects']: + self.assertIn(e['state_id'], slots, (k, e)) + for x in c['observes']: + self.assertIn(x, slots, (k, x)) + for pre in c['preconditions']: + for x in pre['state_ids']: + self.assertIn(x, slots, (k, x)) + for x in c['execution']['completion_state_ids']: + self.assertIn(x, slots, (k, x)) + if comps is not None: + for x in c['component_ids']: + self.assertIn(x, comps, (k, x)) + for k in rt.CAPS: + self.assertIn(k, rt.CAP_SOURCES, k) + self.assertEqual(set(rt.PRECONDITIONS) - set(rt.CAPS), set()) + for k, v in rt.EFFECTS.items(): + self.assertIn(k, rt.CAPS) + self.assertEqual(set(v) - slots, set(), k) + for k, v in rt.ON_STEP.items(): + self.assertIn(k, rt.CAPS) + self.assertEqual(set(v) - slots, set(), k) + + def test_unsupported_capabilities_report_unsupported(self): + h = ready() + for k in rt.UNSUPPORTED: + with self.assertRaises(rt.ActionRejected) as cm: + _orig_invoke(h, k, **(rt.CAPS[k].get('example_arguments') or {})) + self.assertEqual(str(cm.exception), 'UNSUPPORTED') + self.assertEqual(_meta()['capabilities'][k]['availability'], 'unsupported') + h.register_principal('agent', 'agent') + s = h.session('agent') + r = s.invoke(instance_id=h.instance_id, capability_id='export.vk_file', arguments=rt.CAPS['export.vk_file'].get('example_arguments') or {}, request_id='u1') + self.assertEqual(r['status'], 'unsupported') + + +class HostClockAndPurity(unittest.TestCase): + def test_read_and_describe_do_not_advance_time(self): + h = loaded() + h.register_principal('agent', 'agent') + s = h.session('agent') + t, rev = h.t, h.revision + for _ in range(3): + h.read('evaluator'); s.read(instance_id=h.instance_id); s.describe(instance_id=h.instance_id) + self.assertEqual((h.t, h.revision), (t, rev)) + + def test_step_zero_and_negative(self): + h = ready() + t = h.t + h.step(0.0) + self.assertEqual(h.t, t) + for bad in (-1.0, float('nan'), float('inf')): + with self.assertRaises(rt.ActionRejected): + h.step(bad) + + def test_host_step_chopping_does_not_change_the_result(self): + """The same measurement advanced in one host step and in irregular small steps gives identical records, positions and ledgers.""" + def run(chunks): + h = loaded(AU, slot=3) + prepare(h, **{k: v for k, v in FAST.items() if k != 'mode'}) + op = h.invoke('measurement.start')['operation_id'] + T = h.op['duration_s'] + 0.5 + if chunks: + t, i = 0.0, 0 + while t < T: + d = (0.037, 0.211, 0.0043, 0.5)[i % 4] + h.step(d); t += d; i += 1 + else: + h.step(T) + self.assertEqual(h.operations[op]['phase'], 'completed') + r = h.records[h.operations[op]['record_id']] + return h, r + a, ra = run(False) + b, rb = run(True) + self.assertEqual(ra['height_m'], rb['height_m']) + self.assertEqual(ra['intensity'], rb['intensity']) + self.assertAlmostEqual(a.z, b.z, places=12) + for k, v in a.ledger().items(): + self.assertAlmostEqual(v, b.ledger()[k], delta=1e-9 * max(1.0, abs(v)), msg=k) + + def test_reads_do_not_change_later_results(self): + def run(reads): + h = loaded(AU, slot=1) + prepare(h, **{k: v for k, v in FAST.items() if k != 'mode'}) + op = h.invoke('measurement.start')['operation_id'] + for _ in range(20): + if reads: + h.read('evaluator'); h.invoke('events.read', since_s=0.0); h.invoke('records.list'); h.invoke('ledger.read') + h.step(0.25) + wait(h, op) + return h.records[h.operations[op]['record_id']]['height_m'] + self.assertEqual(run(False), run(True)) + + def test_set_points_only_write_targets(self): + h = loaded(AU, slot=1) + x0 = h.stage['x'] + out = h.invoke('stage.move', x_m=0.004, y_m=-0.002) + self.assertEqual(h.stage['x'], x0) + self.assertEqual(h.read()['stage.target_m'], [0.004, -0.002]) + self.assertAlmostEqual(out['duration_s'], 0.004 / rt.STAGE_SPEED_M_S) + h.step(0.2) + self.assertAlmostEqual(h.stage['x'], 0.002, places=12) + self.assertAlmostEqual(h.stage['y'], -0.002, places=12) + self.assertTrue(h.read()['stage.moving']) + settle(h) + z0 = h.z + h.invoke('focus.move', z_m=z0 - 0.001) + self.assertEqual(h.z, z0) + h.step(0.1) + self.assertAlmostEqual(h.z, z0 - 0.0005, places=12) + settle(h) + l0 = h.lift + h.invoke('stage.set_lift', lift_m=-0.004) + self.assertEqual(h.lift, l0) + h.step(1.0) + self.assertAlmostEqual(h.lift, -0.002, places=12) + self.assertAlmostEqual(h.read()['stage.focus_drive_rad'], 0.002 / rt.COARSE_PITCH_M * 2 * math.pi, places=9) + settle(h) + h.invoke('lens.select', slot=2) + self.assertEqual(h.read()['head.objective'], '10x') # the revolver has not turned yet + self.assertTrue(h.read()['head.revolver_moving']) + self.assertEqual(h.read()['head.lens_slot'], 2) + h.step(0.4) + self.assertIsNone(h.read()['head.objective']) # the optical axis is between two objectives + h.step(0.41) + self.assertEqual(h.read()['head.objective'], '20x') + + +class PowerMotionAndProtection(unittest.TestCase): + def test_boot_homes_the_z_stage_and_power_loss_stops_the_axes(self): + h = configured() + h.invoke('power.set', enabled=True) + self.assertEqual(h.state, 'booting') + rejected(h, 'stage.move', 'NOT_READY', x_m=0.001, y_m=0.0) + h.step(rt.BOOT_S - 0.01) + self.assertEqual(h.state, 'booting') + h.step(0.02) + self.assertEqual(h.state, 'ready') + h.invoke('stage.move', x_m=0.02, y_m=0.0) + h.step(1.0) + h.invoke('power.set', enabled=False) + x = h.stage['x'] + h.step(5.0) + self.assertAlmostEqual(x, 0.010, places=12) + self.assertEqual(h.stage['x'], x) + self.assertEqual(h.read()['stage.x_indicated_m'], None) + h.invoke('power.set', enabled=True) + h.step(rt.BOOT_S + 0.1) + self.assertEqual(h.stage['x'], x) # the XY stage keeps its position; only Z homes + self.assertEqual(h.z, 0.0) + + def test_manual_lift_works_without_power_and_mains_fault(self): + h = configured() + h.invoke('stage.set_lift', lift_m=-0.010) + h.step(10.0) + self.assertAlmostEqual(h.lift, -0.010, places=12) + self.assertAlmostEqual(h.ledger()['lift_travel_m'], 0.010, places=12) + h.invoke('power.set', enabled=True) + h.step(rt.BOOT_S + 1) + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, mains_voltage_v=60.0)) + self.assertFalse(h.power) + self.assertEqual(h.error, 'MAINS_FAULT') + rejected(h, 'power.set', 'MAINS_OUT_OF_RANGE', enabled=True) + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE)) + h.invoke('power.set', enabled=True) + self.assertIsNone(h.error) + rejected(h, 'plant.configure', 'SEED_FIXED', **dict(rt.PLANT_EXAMPLE, noise_seed=5)) + + def test_revolver_timing_and_lens_change_retraction(self): + h = loaded(AU, slot=1) + z10 = h.z + out = h.invoke('lens.select', slot=3) # 50x: 0.35 mm working distance -> Z retracts first + self.assertLess(out['z_retract_m'], 0.0) + tip_after = h._tip_z(rt.LENSES[3], z10 + out['z_retract_m']) + self.assertAlmostEqual(tip_after, h._sample_top_z() + rt.SAFE_TIP_CLEARANCE_M, places=9) + t_retract = abs(out['z_retract_m']) / rt.HEAD_Z_SPEED_M_S + self.assertAlmostEqual(out['duration_s'], t_retract + 2 * rt.REVOLVER_S_PER_STEP, places=9) + h.step(t_retract * 0.5) + self.assertAlmostEqual(h.rev, 2 * math.pi / 6 * 1, places=12) # the revolver waits for the retraction + settle(h) + self.assertEqual(h.read()['head.objective'], '50x') + self.assertAlmostEqual(h.ledger()['revolver_steps'], 3.0, places=9) # 0 -> 1 (loading) and 1 -> 3 + + def test_collision_protection(self): + h = loaded(AU, slot=3) + top = h._sample_top_z() + z_hit = h._z_for_focus(top + rt.COLLISION_MARGIN_M * 0.5 - rt.LENSES[3]['wd_m']) + rejected(h, 'focus.move', 'COLLISION_RISK', z_m=z_hit) + z_ok = h._z_for_focus(top + rt.COLLISION_MARGIN_M * 2 - rt.LENSES[3]['wd_m']) + h.invoke('focus.move', z_m=z_ok) + settle(h) + h.invoke('stage.set_lift', lift_m=-0.001) + settle(h) + h.invoke('focus.move', z_m=h._z_for_focus(h._sample_top_z() + 0.3e-3 - rt.LENSES[3]['wd_m'])) + settle(h) + rejected(h, 'stage.set_lift', 'COLLISION_RISK', lift_m=-0.0005) # raising 0.5 mm would push the sample into the 50x tip + h.invoke('stage.set_lift', lift_m=-0.0009) + g = ready() + g.invoke('sample.provide', **TALL) + g.invoke('lens.select', slot=3) + settle(g) + g.invoke('focus.move', z_m=0.0) + settle(g) + rejected(g, 'sample.place', 'SAMPLE_TOO_TALL', sample_id='tall', x_m=0.0, y_m=0.0) + g.invoke('stage.set_lift', lift_m=-0.010) + settle(g) + g.invoke('sample.place', sample_id='tall', x_m=0.0, y_m=0.0) + rejected(g, 'sample.place', 'SAMPLE_NOT_ON_BENCH', sample_id='tall', x_m=0.0, y_m=0.0) + + def test_sample_and_argument_validation(self): + h = configured() + rejected(h, 'sample.provide', 'UNKNOWN_SUBSTANCE', **dict(AU, sample_id='x', substrate_substance_id='unobtainium')) + rejected(h, 'sample.provide', 'INVALID_FEATURE', **dict(AU, sample_id='x', features=[dict(GRATING['features'][0], pitch_m=4e-6)])) + rejected(h, 'sample.provide', 'INVALID_FEATURE', **dict(AU, sample_id='x', features=[dict(kind='cap', substance_id=None, height_m=80e-6, width_m=100e-6, + pitch_m=0.0, x_m=0.0, y_m=0.0, extent_m=0.001)])) + h.invoke('sample.provide', **AU) + rejected(h, 'sample.provide', 'SAMPLE_EXISTS', **AU) + h.invoke('sample.provide', **dict(AU, sample_id='wafer', size_x_m=0.1, size_y_m=0.1)) + rejected(h, 'sample.place', 'OUTSIDE_PLATE', sample_id='wafer', x_m=0.03, y_m=0.0) + rejected(h, 'sample.place', 'UNKNOWN_SAMPLE', sample_id='nope', x_m=0.0, y_m=0.0) + with self.assertRaises(rt.ActionRejected): + h.invoke('stage.move', x_m=0.2, y_m=0.0) + rejected(h, 'stage.move', 'POWER_OFF', x_m=0.01, y_m=0.0) + rejected(h, 'measurement.configure', 'FILM_INDEX_REQUIRED', **dict(rt.SETTINGS_EXAMPLE, peak_mode='film')) + rejected(h, 'measurement.configure', 'SETTING_NOT_FOR_MODE', **dict(rt.SETTINGS_EXAMPLE, mode='focus_variation', double_scan=True)) + rejected(h, 'measurement.set_z_range', 'INVALID_Z_RANGE', upper_z_m=0.03, lower_z_m=0.02) + g = loaded(AU, slot=0) + rejected(g, 'focus.auto', 'LENS_NOT_SUPPORTED') # the 2.5x lens is for observation only (engineering configuration) + g.invoke('lens.select', slot=5) + settle(g) + g.invoke('measurement.configure', **rt.SETTINGS_EXAMPLE) + rejected(g, 'measurement.auto_range', 'LENS_NOT_SUPPORTED') # laser confocal with the interference objective + rejected(g, 'measurement.start', 'LENS_NOT_SUPPORTED') + g.invoke('lens.select', slot=1) + settle(g) + rejected(g, 'measurement.start', 'Z_RANGE_NOT_SET') + z = g.z + g.invoke('measurement.set_z_range', upper_z_m=z, lower_z_m=z + 1e-7) + rejected(g, 'measurement.start', 'Z_RANGE_TOO_SMALL') + g.invoke('measurement.configure', **dict(rt.SETTINGS_EXAMPLE, pitch_m=1e-9)) + g.invoke('measurement.set_z_range', upper_z_m=z, lower_z_m=z + 1e-4) + rejected(g, 'measurement.start', 'TOO_MANY_STEPS') + g.invoke('focus.move', z_m=0.010) + settle(g) + g.invoke('measurement.configure', **rt.SETTINGS_EXAMPLE) + rejected(g, 'focus.auto', 'NO_SURFACE_FOUND') + + +class ConfocalPhysics(unittest.TestCase): + def test_opaque_step_heights_follow_the_hidden_z_scale(self): + for slot in (2, 3): + h = loaded(AU, slot=slot) + rid, r = measure(h) + self.assertEqual(r['status'], 'completed') + self.assertGreater(r['valid_fraction'], 0.99) + st = step_height(h, rid, [-150e-6, -20e-6], [20e-6, 150e-6]) + expect = 200e-9 / (1 + h.truth['z_scale']) + self.assertAlmostEqual(st, expect, delta=0.04 * expect, msg=rt.LENSES[slot]['label']) + self.assertEqual(r['template_source']['substances'], ['au', 'si']) + self.assertEqual(r['n_frames'], int(math.floor((r['z_range_m'][1] - r['z_range_m'][0]) / r['pitch_m'] + 1e-9)) + 1) + self.assertAlmostEqual(r['pitch_m'], rt.axial_fwhm_m(rt.LENSES[slot]['na']) / 5.0, places=15) + CHECKS.append(dict(check=f'opaque_step_{rt.LENSES[slot]["label"]}', measured_m=st, expected_m=expect)) + + def test_transparent_step_strongest_and_first_peak(self): + """A 2 um SiO2 step on Si (resolved at 50x): the SiO2/Si interface reflects ~9x more than the SiO2 top, so the strongest peak is the + apparent interface t (1 - 1/n_eff) above the bare Si while the first-peak mode finds the top surface; a 500 nm step is not resolved + (apparent separation 0.24 um < axial FWHM 0.34 um) and both modes give the merged peak.""" + n = rt.nk('sio2_film', rt.LASER_WAVELENGTH_M).real + thick = dict(rt.SAMPLE_EXAMPLE, sample_id='sio2_2um', features=[dict(rt.SAMPLE_EXAMPLE['features'][0], height_m=2.0e-6)]) + h = loaded(thick, slot=3) + sz = 1 + h.truth['z_scale'] + rid, r = measure(h) + s_strong = step_height(h, rid, [-150e-6, -20e-6], [20e-6, 150e-6]) + rid, r = measure(h, peak_mode='first') + s_first = step_height(h, rid, [-150e-6, -20e-6], [20e-6, 150e-6]) + apparent = 2.0e-6 * (1 - 1 / rt.n_effective(n, 0.95)) / sz + self.assertAlmostEqual(s_strong, apparent, delta=0.1 * apparent) + self.assertAlmostEqual(s_first, 2.0e-6 / sz, delta=0.03 * 2.0e-6) + g = loaded(dict(rt.SAMPLE_EXAMPLE), slot=3) + rid, r = measure(g) + t_strong = step_height(g, rid, [-150e-6, -20e-6], [20e-6, 150e-6]) + rid, r = measure(g, peak_mode='first') + t_first = step_height(g, rid, [-150e-6, -20e-6], [20e-6, 150e-6]) + self.assertLess(abs(t_first - t_strong), 40e-9) + self.assertLess(t_strong, 0.6 * 500e-9) + CHECKS.append(dict(check='transparent_step', strongest_2um_m=s_strong, first_2um_m=s_first, apparent_interface_m=apparent, + strongest_500nm_m=t_strong, first_500nm_m=t_first)) + + def test_film_mode_and_its_resolution_limit(self): + h = loaded(PMMA3, slot=3) + rid, r = measure(h, peak_mode='film', film_refractive_index=1.49) + ft = hmap(r, 'film_thickness_m') + self.assertGreater(np.isfinite(ft).mean(), 0.95) + self.assertAlmostEqual(float(np.nanmedian(ft)), 3.0e-6, delta=0.05 * 3.0e-6) + g = loaded(PMMA3, slot=2) # 20x: apparent separation 1.95 um, axial FWHM 2.06 um + rid, r = measure(g, peak_mode='film', film_refractive_index=1.49) + self.assertLess(np.isfinite(hmap(r, 'film_thickness_m')).mean(), 0.2) + CHECKS.append(dict(check='confocal_film_mode', median_50x_m=float(np.nanmedian(ft)))) + + def test_numerical_aperture_limits_measurable_slopes(self): + lens = dict(sample_id='microlens', substrate_substance_id='sio2_fused', thickness_m=0.001, size_x_m=0.010, size_y_m=0.010, + features=[dict(kind='cap', substance_id='sio2_fused', height_m=60e-6, width_m=600e-6, pitch_m=0.0, x_m=0.0, y_m=0.0, extent_m=0.001)], + film=None, roughness=dict(sq_m=1e-9, correlation_length_m=3e-6), tilt_x_rad=0.0, tilt_y_rad=0.0) + h = loaded(lens, slot=1) # 10x NA 0.30: slopes above 17.5 deg return no specular light + rid, r = measure(h, **{k: v for k, v in FAST.items() if k != 'mode'}) + R = (0.3e-3 ** 2 + 60e-6 ** 2) / (2 * 60e-6) + ring = math.pi * ((0.3e-3) ** 2 - (R * 0.30) ** 2) + fov = r['fov_m'][0] * r['fov_m'][1] + self.assertAlmostEqual(1 - r['valid_fraction'], ring / fov, delta=0.5 * ring / fov) + g = loaded(lens, slot=3) # 50x NA 0.95 sees the centre of the cap completely + rid, r = measure(g, **{k: v for k, v in FAST.items() if k != 'mode'}) + self.assertGreater(r['valid_fraction'], 0.99) + + def test_double_scan_recovers_dark_steep_pixels(self): + wavy = dict(sample_id='wavy', substrate_substance_id='si', thickness_m=5.25e-4, size_x_m=0.010, size_y_m=0.010, + features=[dict(kind='sine', substance_id=None, height_m=36e-6, width_m=1e-6, pitch_m=200e-6, x_m=0.0, y_m=0.0, extent_m=0.008)], + film=None, roughness=dict(sq_m=10e-9, correlation_length_m=1e-6), tilt_x_rad=0.0, tilt_y_rad=0.0) + vf = {} + for ds in (False, True): + h = loaded(wavy, slot=1) + rid, r = measure(h, double_scan=ds, **{k: v for k, v in FAST.items() if k not in ('mode', 'double_scan')}) + vf[ds] = r['valid_fraction'] + n = int(math.floor((r['z_range_m'][1] - r['z_range_m'][0]) / r['pitch_m'] + 1e-9)) + 1 + self.assertEqual(r['n_frames'], n * (2 if ds else 1)) + self.assertLess(vf[False], 0.9) + self.assertGreater(vf[True], vf[False] + 0.05) + CHECKS.append(dict(check='double_scan', valid_single=vf[False], valid_double=vf[True])) + + def test_z_and_xy_calibration_with_standards(self): + h = loaded(STEP_STD, slot=3) + rid, r = measure(h) + raw = step_height(h, rid, [-180e-6, -60e-6], [60e-6, 180e-6]) + cal = h.invoke('calibration.z_scale', record_id=rid, certified_height_m=1.803e-6, axis='x', lower=[-180e-6, -60e-6], upper=[60e-6, 180e-6]) + self.assertAlmostEqual(cal['factor'], 1.803e-6 / raw, delta=0.01) + vals = [] + for _ in range(3): + op = h.invoke('measurement.start')['operation_id'] + wait(h, op) + vals.append(step_height(h, h.operations[op]['record_id'], [-180e-6, -60e-6], [60e-6, 180e-6])) + self.assertAlmostEqual(float(np.mean(vals)), 1.803e-6, delta=0.01 * 1.803e-6) + g = loaded(GRATING, slot=3) + rid, r = measure(g) + c = g.invoke('calibration.xy_scale', record_id=rid, certified_pitch_m=10e-6, axis='x') + self.assertAlmostEqual(c['factor'], 1.0 + g.truth['xy_scale']['obj_50x'], delta=1.5e-3) # the real pixel is (1 + e) x nominal + self.assertEqual(g.read()['calibration.xy_scale']['obj_50x'], c['factor']) + rid2, r2 = measure(g, autofocus=False) + self.assertAlmostEqual(r2['pixel_pitch_m'][0], r['pixel_pitch_m'][0] * c['factor'], places=15) + rejected(g, 'calibration.xy_scale', 'UNKNOWN_RECORD', record_id='HM9999', certified_pitch_m=10e-6, axis='x') + CHECKS.append(dict(check='calibration', z_factor=cal['factor'], z_after_m=float(np.mean(vals)), xy_factor=c['factor'])) + + def test_stitching_and_150x(self): + h = loaded(AU, slot=2) + prepare(h, **{k: v for k, v in FAST.items() if k != 'mode'}) + x0 = h.stage['x'] + op = h.invoke('measurement.stitch', nx=3, ny=2, overlap=0.2)['operation_id'] + h.step(1.0 + 0.001) + self.assertEqual(h.op['phase'], 'xy') + self.assertTrue(h.read()['stage.moving']) + self.assertEqual(wait(h, op), 'completed') + r = h.records[h.operations[op]['record_id']] + fx, fy = rt.fov_m(20.0, 1.0) + self.assertAlmostEqual(r['fov_m'][0], fx * (1 + 2 * 0.8) * h.cal['xy']['obj_20x'], delta=0.02 * fx) + self.assertAlmostEqual(r['fov_m'][1], fy * (1 + 1 * 0.8) * h.cal['xy']['obj_20x'], delta=0.02 * fy) + self.assertGreater(r['valid_fraction'], 0.99) + self.assertEqual(h.stage['x'], x0) + self.assertEqual(r['kind'], 'stitched_map') + st = h.invoke('data.step_height', record_id=r['record_id'], axis='x', lower=None, upper=None, leveling='none') + self.assertAlmostEqual(st['step_height_m'], 200e-9 / (1 + h.truth['z_scale']), delta=20e-9) + g = loaded(AU, slot=4) + rid, r = measure(g, **{k: v for k, v in FAST.items() if k != 'mode'}) + self.assertAlmostEqual(r['fov_m'][0], rt.fov_m(150.0, 1.0)[0], delta=0.01 * rt.fov_m(150.0, 1.0)[0]) + self.assertGreater(r['valid_fraction'], 0.99) + + +class OtherPrinciples(unittest.TestCase): + def test_focus_variation_needs_texture(self): + h = loaded(STEEL, slot=1) + rid, r = measure(h, mode='focus_variation') + self.assertGreater(r['valid_fraction'], 0.98) + depth = step_height(h, rid, [-25e-6, 25e-6], [350e-6, 800e-6]) + self.assertAlmostEqual(depth, 5e-6 / (1 + h.truth['z_scale']), delta=0.05 * 5e-6) + self.assertIsNone(r['gain']) + g = loaded(PMMA3, slot=2) # smooth film on smooth aluminium: no texture, no focus-variation data + rid, r = measure(g, mode='focus_variation') + self.assertLess(r['valid_fraction'], 0.02) + CHECKS.append(dict(check='focus_variation_groove', depth_m=depth)) + + def test_white_light_interferometry_phase_change_on_reflection(self): + au = dict(AU, sample_id='au_on_si', features=[dict(AU['features'][0], height_m=50e-9)], roughness=dict(sq_m=0.3e-9, correlation_length_m=3e-6)) + h = loaded(au, slot=5) + rid, r = measure(h, mode='white_light_interferometry') + self.assertGreater(r['valid_fraction'], 0.99) + self.assertEqual(r['pitch_m'], rt.WLI_LAMBDA0_M / 8) + st = step_height(h, rid, [-300e-6, -40e-6], [40e-6, 300e-6]) + expect = (50e-9 + pcor_offset('au', 'si')) / (1 + h.truth['z_scale']) + self.assertAlmostEqual(st, expect, delta=3e-9) + self.assertLess(st, 40e-9) # Au reads ~30 nm low against Si + rg = h.invoke('data.roughness', record_id=rid, region=dict(x0_m=-300e-6, y0_m=-200e-6, x1_m=-40e-6, y1_m=200e-6), leveling='plane', s_filter_m=None, + l_filter_m=None, profile_axis='x', lambda_c_m=None) + self.assertLess(rg['areal']['sq_m'], 0.5e-9) + CHECKS.append(dict(check='wli_pcor', step_m=st, expected_m=expect)) + + def test_spectral_film_thickness(self): + h = loaded(PMMA3, slot=1) # 10x: top and interface both inside the axial response + wait(h, h.invoke('focus.auto')['operation_id']) + op = h.invoke('film.measure', film_substance_id='pmma', substrate_substance_id='al')['operation_id'] + self.assertEqual(wait(h, op), 'completed') + f = h.records[h.operations[op]['record_id']]['film'] + self.assertTrue(f['in_range']) + self.assertAlmostEqual(f['thickness_m'], 3.0e-6, delta=0.006 * 3.0e-6) # documented accuracy +-0.6 % + self.assertEqual(len(f['wavelength_m']), len(f['reflectance'])) + self.assertTrue(4.0e-7 < f['wavelength_m'][0] < f['wavelength_m'][-1] < 8.0e-7) # SI + op = h.invoke('film.measure', film_substance_id='ps', substrate_substance_id='al')['operation_id'] + wait(h, op) + wrong = h.records[h.operations[op]['record_id']]['film']['thickness_m'] + n_pmma, n_ps = rt.nk('pmma', 600e-9).real, rt.nk('ps', 600e-9).real + self.assertAlmostEqual(wrong, 3.0e-6 * n_pmma / n_ps, delta=0.02 * 3.0e-6) # the optical thickness is what the spectrum fixes + thick = dict(PMMA3, sample_id='thick', film=dict(substance_id='pmma', thickness_m=9.0e-6)) + g = loaded(thick, slot=1) + wait(g, g.invoke('focus.auto')['operation_id']) + op = g.invoke('film.measure', film_substance_id='pmma', substrate_substance_id='al')['operation_id'] + wait(g, op) + rec = g.records[g.operations[op]['record_id']] + self.assertIsNone(rec['film']['thickness_m']) + self.assertEqual(rec['valid_fraction'], 0.0) + rejected(g, 'film.measure', 'UNKNOWN_SUBSTANCE', film_substance_id='nope', substrate_substance_id='al') + CHECKS.append(dict(check='spectral_film', thickness_m=f['thickness_m'], wrong_material_m=wrong)) + + def test_autofocus_locks_onto_the_brighter_buried_interface(self): + thick = dict(PMMA3, sample_id='pmma10', film=dict(substance_id='pmma', thickness_m=10.0e-6)) + h = loaded(thick, slot=2) + op = h.invoke('focus.auto')['operation_id'] + wait(h, op) + n = rt.nk('pmma', rt.LASER_WAVELENGTH_M).real + err = h.read('evaluator')['truth.focus_error_m'] + self.assertAlmostEqual(err, -10e-6 / rt.n_effective(n, 0.46), delta=0.2 * rt.axial_fwhm_m(0.46) + 0.3e-6) + + +class FaultsCancelAndPower(unittest.TestCase): + def test_laser_failure_during_a_measurement(self): + h = loaded(AU, slot=2) + prepare(h) + op = h.invoke('measurement.start')['operation_id'] + h.step(1.05) + self.assertTrue(h.read()['laser.on']) + h.invoke('fault.inject', fault='laser_failure', active=True) + self.assertEqual(h.operations[op]['phase'], 'failed') + r = h.records[h.operations[op]['record_id']] + self.assertEqual((r['status'], r['reason'], r['height_m']), ('failed', 'LASER_FAULT', None)) + self.assertFalse(h.read()['laser.on']) + self.assertEqual(h.error, 'LASER_FAULT') + rejected(h, 'system.acknowledge', 'CAUSE_PERSISTS') + rejected(h, 'measurement.start', 'ERROR_PENDING') + h.invoke('fault.inject', fault='laser_failure', active=False) + self.assertEqual(h.invoke('system.acknowledge')['cleared'], 'LASER_FAULT') + h.invoke('measurement.start') + + def test_stage_disconnection_and_revolver_jam(self): + h = loaded(AU, slot=1) + prepare(h, **{k: v for k, v in FAST.items() if k != 'mode'}) + op = h.invoke('measurement.stitch', nx=2, ny=2, overlap=0.2)['operation_id'] + h.step(1.001) + h.invoke('fault.inject', fault='stage_disconnected', active=True) + self.assertEqual(h.operations[op]['phase'], 'failed') + self.assertEqual(h.records[h.operations[op]['record_id']]['reason'], 'STAGE_FAULT') + self.assertFalse(h._stage_moving()) + self.assertFalse(h.read()['panel.stage_lamp']) + h.invoke('fault.inject', fault='stage_disconnected', active=False) + h.invoke('system.acknowledge') + g = loaded(AU, slot=1) + g.invoke('lens.select', slot=4) + g.step(1.0) + g.invoke('fault.inject', fault='revolver_jam', active=True) + rev = g.rev + g.step(10.0) + self.assertEqual(g.rev, rev) + self.assertIsNone(g.read()['head.objective']) + rejected(g, 'lens.select', 'ERROR_PENDING', slot=1) + g.invoke('fault.inject', fault='revolver_jam', active=False) + g.invoke('system.acknowledge') + g.invoke('lens.select', slot=4) + settle(g) + self.assertEqual(g.read()['head.objective'], '150x') + + def test_vibration_adds_scan_noise(self): + sq = {} + for vib in (False, True): + flat = dict(AU, sample_id='flat', features=[], roughness=dict(sq_m=0.2e-9, correlation_length_m=5e-6)) + h = loaded(flat, slot=3) + prepare(h) + if vib: + h.invoke('fault.inject', fault='vibration', active=True) + rid, r = measure(h, autofocus=False) + sq[vib] = h.invoke('data.roughness', record_id=rid, region=None, leveling='plane', s_filter_m=None, l_filter_m=None, profile_axis='x', + lambda_c_m=None)['areal']['sq_m'] + self.assertGreater(sq[True], 1.5 * sq[False]) + + def test_power_loss_and_cancel_keep_the_remnants(self): + h = loaded(AU, slot=2) + prepare(h) + op = h.invoke('measurement.start')['operation_id'] + h.step(1.2) + z = h.z + h.invoke('power.set', enabled=False) + self.assertEqual(h.operations[op]['phase'], 'failed') + self.assertEqual(h.records[h.operations[op]['record_id']]['reason'], 'POWER_OFF') + h.step(5.0) + self.assertEqual(h.z, z) + g = loaded(AU, slot=2) + prepare(g) + g.register_principal('agent', 'agent') + s = g.session('agent') + r = s.invoke(instance_id=g.instance_id, capability_id='measurement.start', arguments={}, request_id='m1') + g.step(1.2) + z = g.z + c = s.cancel(r['operation_id'], 'c1') + self.assertEqual(c['result']['phase'], 'cancelled') + self.assertEqual(s.cancel(r['operation_id'], 'c1'), c) + with self.assertRaises(rt.ActionRejected): + s.cancel(r['operation_id'], 'c2') + rec = g.records[g.operations[r['operation_id']]['record_id']] + self.assertEqual((rec['status'], rec['reason'], rec['height_m']), ('cancelled', 'USER_CANCEL', None)) + g.step(3.0) + self.assertEqual(g.z, z) + self.assertFalse(g.read()['laser.on']) + self.assertEqual(s.poll(r['operation_id'])['status'], 'cancelled') + + +class LedgersIsolationSessions(unittest.TestCase): + def test_ledgers_close(self): + h = loaded(dict(rt.SAMPLE_EXAMPLE), slot=3) + rid, r = measure(h) + L = h.ledger() + self.assertAlmostEqual(L['laser_energy_j'], rt.LASER_MAX_W * L['laser_on_s'], delta=1e-15) + self.assertAlmostEqual(L['energy_to_sample_j'], rt.OPTICS_TRANSMISSION * L['laser_energy_j'], delta=1e-15) + self.assertLess(abs(L['energy_residual_j']), 1e-12 * max(L['energy_to_sample_j'], 1e-30)) + self.assertGreater(L['energy_transmitted_j'], 0.0) + self.assertEqual(L['frames'], r['n_frames']) + self.assertAlmostEqual(L['laser_on_s'], r['n_frames'] * h._frame_s('laser_confocal') + rt.AUTORANGE_S, delta=1e-6) # scan + laser pre-scan + before = h.ledger()['stage_travel_m'] + h.invoke('stage.move', x_m=0.003, y_m=-0.004) + settle(h) + self.assertAlmostEqual(h.ledger()['stage_travel_m'] - before, 0.007, places=12) + + def test_two_instances_are_isolated(self): + a, b = loaded(AU, slot=1), loaded(AU, slot=1) + b2 = copy.deepcopy(b.read('evaluator')) + a.invoke('stage.move', x_m=0.01, y_m=0.0) + a.step(3.0) + a.invoke('fault.inject', fault='laser_failure', active=True) + self.assertFalse(_changed(b.read('evaluator'), b2)) + c = loaded(AU, slot=1, seed=2) + self.assertNotEqual(c.truth['z_scale'], a.truth['z_scale']) + + def test_agent_does_not_see_truth_faults_or_templates(self): + h = loaded(AU, slot=2) + h.register_principal('agent', 'agent') + h.register_principal('judge', 'evaluator') + s, e = h.session('agent'), h.session('judge') + obs = s.read(instance_id=h.instance_id)['observations'] + self.assertFalse([k for k in obs if k.startswith('truth.')]) + self.assertTrue([k for k in e.read(instance_id=h.instance_id)['observations'] if k.startswith('truth.')]) + with self.assertRaises(rt.ActionRejected): + s.read(instance_id=h.instance_id, state_ids=['truth.focus_error_m']) + d = s.describe(instance_id=h.instance_id) + self.assertNotIn('fault.inject', d['capabilities']) + self.assertNotIn('truth.samples', d['state_slots']) + r = s.invoke(instance_id=h.instance_id, capability_id='fault.inject', arguments=dict(fault='vibration', active=True), request_id='f1') + self.assertEqual(r['error']['code'], 'ACCESS_DENIED') + e.invoke(instance_id=h.instance_id, capability_id='fault.inject', arguments=dict(fault='vibration', active=True), request_id='f1') + ev = s.invoke(instance_id=h.instance_id, capability_id='events.read', arguments=dict(since_s=0.0), request_id='e1')['result']['events'] + self.assertFalse([x for x in ev if x['kind'] == 'fault']) + prepare(h) + r = s.invoke(instance_id=h.instance_id, capability_id='measurement.start', arguments={}, request_id='m1') + wait(h, r['operation_id']) + rid = h.operations[r['operation_id']]['record_id'] + res = s.invoke(instance_id=h.instance_id, capability_id='measurement.result', arguments=dict(record_id=rid), request_id='r1')['result'] + self.assertEqual(res['template_source']['substances'], []) + self.assertEqual(s.poll(r['operation_id'])['result']['template_source']['substances'], []) + full = e.read(instance_id=h.instance_id)['observations'] + self.assertEqual(full['result.last_record_id']['value'], rid) + self.assertEqual(s.read(instance_id=h.instance_id)['observations']['result.last_record_id']['value'], rid) + + def test_records_and_control_belong_to_their_agent(self): + h = loaded(AU, slot=2) + prepare(h, **{k: v for k, v in FAST.items() if k != 'mode'}) + h.register_principal('a1', 'agent') + h.register_principal('a2', 'agent') + s1, s2 = h.session('a1'), h.session('a2') + r = s1.invoke(instance_id=h.instance_id, capability_id='measurement.start', arguments={}, request_id='m1') + h.step(0.5) + self.assertTrue(s2.read(instance_id=h.instance_id)['observations']['measurement.started_by_other_agent']['value']) + self.assertIsNone(s2.read(instance_id=h.instance_id)['observations']['measurement.id']['value']) + x = s2.invoke(instance_id=h.instance_id, capability_id='stage.move', arguments=dict(x_m=0.001, y_m=0.0), request_id='s1') + self.assertEqual(x['error']['code'], 'ACCESS_DENIED') + with self.assertRaises(rt.ActionRejected): + s2.poll(r['operation_id']) + with self.assertRaises(rt.ActionRejected): + s2.cancel(r['operation_id'], 'c1') + wait(h, r['operation_id']) + rid = h.operations[r['operation_id']]['record_id'] + for cap, args in (('measurement.result', dict(record_id=rid)), ('data.profile', dict(record_id=rid, start_m=[0.0, 0.0], end_m=[1e-4, 0.0], points=5))): + self.assertEqual(s2.invoke(instance_id=h.instance_id, capability_id=cap, arguments=args, request_id='q' + cap)['error']['code'], 'ACCESS_DENIED') + self.assertNotIn(rid, s2.invoke(instance_id=h.instance_id, capability_id='records.list', arguments={}, request_id='l1')['result']['records']) + self.assertIsNone(s2.read(instance_id=h.instance_id)['observations']['result.last_record_id']['value']) + self.assertEqual(s1.read(instance_id=h.instance_id)['observations']['result.last_record_id']['value'], rid) + a = s1.invoke(instance_id=h.instance_id, capability_id='stage.move', arguments=dict(x_m=0.001, y_m=0.0), request_id='s9') + self.assertEqual(s1.invoke(instance_id=h.instance_id, capability_id='stage.move', arguments=dict(x_m=0.001, y_m=0.0), request_id='s9'), a) + c = s1.invoke(instance_id=h.instance_id, capability_id='stage.move', arguments=dict(x_m=0.002, y_m=0.0), request_id='s9') + self.assertEqual(c['error']['code'], 'REQUEST_CONFLICT') + self.assertEqual(s1.invoke(instance_id='other', capability_id='records.list', arguments={}, request_id='z')['error']['code'], 'UNKNOWN_INSTANCE') + + def test_queries_bookkeeping_and_records_full(self): + h = loaded(AU, slot=1) + p = h.invoke('provenance.read') + self.assertEqual(p['substances'], len(rt.library()['meta']['substances'])) + ev = h.invoke('events.read', since_s=0.0)['events'] + self.assertIn('SAMPLE_PLACED', [e['code'] for e in ev]) + rid, r = measure(h, **{k: v for k, v in FAST.items() if k != 'mode'}) + for i in range(rt.MAX_RECORDS - 1): + h.records[f'X{i:04d}'] = dict(copy.deepcopy(r), record_id=f'X{i:04d}', finished_s=0.0) + rejected(h, 'measurement.start', 'RECORDS_FULL') + rejected(h, 'film.measure', 'RECORDS_FULL', film_substance_id='pmma', substrate_substance_id='al') + self.assertIn(rid, h.invoke('records.list')['records']) + + +class RemainingCapabilities(unittest.TestCase): + def test_zoom_go_to_profile_remove_and_host_step(self): + h = loaded(AU, slot=2) + fx1 = h.read()['optics.fov_m'][0] + out = h.invoke('zoom.set', zoom=2.0) + self.assertAlmostEqual(out['fov_m'][0], fx1 / 2, places=15) + self.assertAlmostEqual(h.read()['optics.total_magnification'], 2 * rt.total_magnification(20.0, 1.0), places=6) + rid, r = measure(h, **{k: v for k, v in FAST.items() if k != 'mode'}) + self.assertAlmostEqual(r['fov_m'][0], fx1 / 2 * h.cal['xy']['obj_20x'], delta=1e-12) + self.assertEqual(r['zoom'], 2.0) + prof = h.invoke('data.profile', record_id=rid, start_m=[-150e-6, 0.0], end_m=[150e-6, 0.0], points=61) + z = np.array([v if v is not None else np.nan for v in prof['height_m']]) + self.assertAlmostEqual(prof['distance_m'][-1], 300e-6, places=12) + self.assertAlmostEqual(float(np.nanmedian(z[-15:]) - np.nanmedian(z[:15])), 200e-9 / (1 + h.truth['z_scale']), delta=20e-9) + h.invoke('zoom.set', zoom=1.0) + s = dict(AU, sample_id='offset', features=[]) + h.invoke('sample.remove', sample_id='au_step') + self.assertEqual(h.read()['sample.bench_ids'], ['au_step']) + h.invoke('sample.provide', **s) + h.invoke('sample.place', sample_id='offset', x_m=0.012, y_m=-0.006) + out = h.invoke('stage.go_to', position='sample_center') + self.assertEqual(out['target_m'], [-0.012, 0.006]) + self.assertAlmostEqual(out['duration_s'], 0.012 / rt.STAGE_SPEED_M_S, places=12) + t0 = h.t + self.assertEqual(h.invoke('sim.step', dt_s=out['duration_s'])['time_s'], t0 + out['duration_s']) + self.assertEqual(h.read()['stage.position_label'], 'sample_center') + self.assertAlmostEqual(h.read('evaluator')['truth.surface_z_on_axis_m'], rt.SAMPLE_PLATE_Z + h.lift + AU['thickness_m'], delta=5e-9) + out = h.invoke('stage.go_to', position='load') + self.assertEqual(out['target_m'], [0.0, -rt.MOTORIZED_XY_M[1] / 2]) + settle(h) + self.assertEqual(h.read()['stage.position_label'], 'load') + h.invoke('stage.go_to', position='center') + settle(h) + self.assertEqual((h.stage['x'], h.stage['y']), (0.0, 0.0)) + h.invoke('sample.remove', sample_id='offset') + rejected(h, 'stage.go_to', 'NO_SAMPLE', position='sample_center') + rejected(h, 'sample.remove', 'SAMPLE_NOT_ON_STAGE', sample_id='offset') + + +class RuntimeReviewRound1Regressions(unittest.TestCase): + def test_F01_focus_variation_and_wli_need_the_surface_inside_the_scan_range(self): + for sample, slot, mode in ((STEEL, 1, 'focus_variation'), (dict(AU, sample_id='au_wli'), 5, 'white_light_interferometry')): + h = loaded(sample, slot=slot) + rid, r = measure(h, mode=mode) + self.assertGreater(r['valid_fraction'], 0.98, mode) + up, low = h.z_range + h.invoke('measurement.set_z_range', upper_z_m=up - 0.002, lower_z_m=low - 0.002) # 2 mm above the surface + rid, r = measure(h, mode=mode, autofocus=False) + self.assertEqual(r['valid_fraction'], 0.0, mode) + + def test_F02_film_thickness_needs_the_spot_in_focus(self): + h = loaded(PMMA3, slot=3) + wait(h, h.invoke('focus.auto')['operation_id']) + op = h.invoke('film.measure', film_substance_id='pmma', substrate_substance_id='al')['operation_id'] + wait(h, op) + f = h.records[h.operations[op]['record_id']]['film'] + self.assertGreater(max(f['collected_fraction'], f['collected_fraction_interface']), 0.9) # autofocus locks onto the brighter interface + self.assertAlmostEqual(f['thickness_m'], 3.0e-6, delta=0.006 * 3.0e-6) + h.invoke('focus.move', z_m=0.0) + settle(h) + op = h.invoke('film.measure', film_substance_id='pmma', substrate_substance_id='al')['operation_id'] + wait(h, op) + rec = h.records[h.operations[op]['record_id']] + self.assertLess(max(rec['film']['collected_fraction'], rec['film']['collected_fraction_interface']), rt.FILM_MIN_SIGNAL) + self.assertIsNone(rec['film']['thickness_m']) + self.assertIn('失焦', rec['note_zh']) + + def test_F14_the_two_film_beams_couple_separately(self): + h = loaded(PMMA3, slot=3) # 50x: the two planes are 1.7 um apart, the axial response is 0.4 um wide + top = h._surface_z_at(*h._axis_in_sample()) + interface = top - 3.0e-6 / rt.n_effective(rt.nk('pmma', 600e-9).real, 0.95) + for label, zf in (('top', top), ('interface', interface), ('midway', 0.5 * (top + interface))): + h.invoke('focus.move', z_m=h._z_for_focus(zf)) + settle(h) + op = h.invoke('film.measure', film_substance_id='pmma', substrate_substance_id='al')['operation_id'] + wait(h, op) + f = h.records[h.operations[op]['record_id']]['film'] + self.assertAlmostEqual(f['thickness_m'], 3.0e-6, delta=0.01 * 3.0e-6, msg=label) # fringe positions keep the thickness + if label == 'top': + self.assertGreater(f['collected_fraction'], 0.9); self.assertLess(f['collected_fraction_interface'], 0.05) + elif label == 'interface': + self.assertLess(f['collected_fraction'], 0.05); self.assertGreater(f['collected_fraction_interface'], 0.9) + else: + self.assertAlmostEqual(f['collected_fraction'], f['collected_fraction_interface'], delta=0.02) + + def test_F15_opaque_films_give_no_thickness(self): + for sample, fid, sid in ((dict(STEP_STD, sample_id='cr_film', features=[]), 'cr', 'sio2_fused'), + (dict(AU, sample_id='au_film', features=[], film=dict(substance_id='au', thickness_m=100e-9)), 'au', 'si')): + h = loaded(sample, slot=2) + wait(h, h.invoke('focus.auto')['operation_id']) + op = h.invoke('film.measure', film_substance_id=fid, substrate_substance_id=sid)['operation_id'] + wait(h, op) + rec = h.records[h.operations[op]['record_id']] + self.assertIsNone(rec['film']['thickness_m'], fid) + self.assertIn('不透明', rec['note_zh']) + + def test_F16_no_fringes_no_thickness(self): + for sample, fid, sid in ((dict(STEP_STD, sample_id='bare_fs', features=[], film=None), 'sio2_film', 'sio2_fused'), # index-matched: no fringes + (dict(PMMA3, sample_id='bare_al', film=None), 'pmma', 'al'), + (dict(AU, sample_id='bulk_au', substrate_substance_id='au', features=[]), 'pmma', 'au')): + h = loaded(sample, slot=2) + wait(h, h.invoke('focus.auto')['operation_id']) + for _ in range(4): + op = h.invoke('film.measure', film_substance_id=fid, substrate_substance_id=sid)['operation_id'] + wait(h, op) + rec = h.records[h.operations[op]['record_id']] + self.assertIsNone(rec['film']['thickness_m'], sample['sample_id']) + self.assertIn('没有膜干涉条纹', rec['note_zh']) + self.assertLess(rec['film']['gain_over_bare_substrate'], rt.FILM_BARE_GAIN) + h = loaded(PMMA3, slot=2) # a real film clears both tests by a wide margin + wait(h, h.invoke('focus.auto')['operation_id']) + op = h.invoke('film.measure', film_substance_id='pmma', substrate_substance_id='al')['operation_id'] + wait(h, op) + f = h.records[h.operations[op]['record_id']]['film'] + self.assertAlmostEqual(f['thickness_m'], 3.0e-6, delta=0.006 * 3.0e-6) + self.assertGreater(f['fringe_to_noise'], 10 * rt.FILM_FRINGE_SNR) + self.assertGreater(f['gain_over_bare_substrate'], 5 * rt.FILM_BARE_GAIN) + self.assertTrue(all(0.0 <= w <= rt.FILM_GAIN_MAX for w in f['fit_collected_fractions'])) + + def test_F17_black_sample_plate_gives_no_film(self): + small = dict(PMMA3, sample_id='off_axis', film=None) + for slot in (1, 2): + h = loaded(small, slot=slot, x=0.02) # the optical axis sees the black anodised plate, 15 mm beside the sample + h.invoke('focus.move', z_m=h._z_for_focus(rt.SAMPLE_PLATE_Z + h.lift)) + settle(h) + for fid, sid in (('sio2_film', 'sio2_fused'), ('pmma', 'sio2_fused'), ('sio2_film', 'caf2')): + op = h.invoke('film.measure', film_substance_id=fid, substrate_substance_id=sid)['operation_id'] + wait(h, op) + rec = h.records[h.operations[op]['record_id']] + self.assertGreater(rec['film']['collected_fraction'], 0.9) # in focus on the plate: the no-fringe test decides, not the signal + self.assertIsNone(rec['film']['thickness_m'], (slot, fid, sid)) + self.assertIn('没有膜干涉条纹', rec['note_zh']) + + def test_F18_thin_film_beams_follow_one_focus_offset(self): + thin = dict(PMMA3, sample_id='pmma110', film=dict(substance_id='pmma', thickness_m=110e-9)) + h = loaded(thin, slot=3) + wait(h, h.invoke('focus.auto')['operation_id']) + for _ in range(6): + op = h.invoke('film.measure', film_substance_id='pmma', substrate_substance_id='al')['operation_id'] + wait(h, op) + f = h.records[h.operations[op]['record_id']]['film'] + # a thin film gives less than one fringe in the band: noise-limited to about 0.3-0.6 nm (sigma) at 50x, well above the 0.1 nm typical value + self.assertAlmostEqual(f['thickness_m'], 110e-9, delta=0.02 * 110e-9) + w_top, w_int = f['fit_collected_fractions'] + self.assertAlmostEqual(w_top, w_int, delta=0.1) # both planes lie well inside the 50x axial response + + def test_F03_collision_checks_use_the_target_of_a_rising_lift(self): + h = loaded(AU, slot=3) + h.invoke('stage.set_lift', lift_m=-0.003) + settle(h) + h.invoke('stage.set_lift', lift_m=0.0) # rising again + h.step(0.2) + top_final = rt.SAMPLE_PLATE_Z + AU['thickness_m'] + rt.sample_extremes(h.samples['au_step'])[0] + z_bad = h._z_for_focus(top_final + 0.5 * rt.COLLISION_MARGIN_M - rt.LENSES[3]['wd_m']) + rejected(h, 'focus.move', 'COLLISION_RISK', z_m=z_bad) + g = loaded(AU, slot=1) + g.invoke('stage.set_lift', lift_m=-0.003) + settle(g) + g.invoke('focus.move', z_m=g._z_for_focus(g._sample_top_z() + 2.0e-3 - rt.LENSES[3]['wd_m'])) # a 50x would clear the lowered top by 2 mm + settle(g) + g.invoke('stage.set_lift', lift_m=0.0) + g.step(0.2) + self.assertLess(g.invoke('lens.select', slot=3)['z_retract_m'], 0.0) # retracts for the lift target, not the current lift + k = loaded(AU, slot=1) + k.invoke('sample.remove', sample_id='au_step') + k.invoke('stage.set_lift', lift_m=-0.003) + settle(k) + k.invoke('focus.move', z_m=k._z_for_focus(rt.SAMPLE_PLATE_Z - 0.003 + TALL['thickness_m'] + 2.5e-3 - rt.LENSES[1]['wd_m'])) + settle(k) + k.invoke('sample.provide', **TALL) + k.invoke('stage.set_lift', lift_m=0.0) + k.step(0.2) + rejected(k, 'sample.place', 'SAMPLE_TOO_TALL', sample_id='tall', x_m=0.0, y_m=0.0) # fits now, not once the lift is up + + def test_F04_lens_change_protects_every_objective_swept_through_the_axis(self): + tall = dict(AU, sample_id='tall_step', features=[dict(AU['features'][0], height_m=0.45e-3)]) + h = loaded(tall, slot=1) + h.invoke('lens.select', slot=2) + settle(h) + h.invoke('focus.move', z_m=h._z_for_focus(h._sample_top_z() + 1.2e-3 - rt.LENSES[2]['wd_m'])) + settle(h) + out = h.invoke('lens.select', slot=5) # 20x -> 20x DI sweeps the 50x and the 150x through the axis + self.assertLess(out['z_retract_m'], 0.0) + z_safe = h.z + out['z_retract_m'] + for L in (rt.LENSES[3], rt.LENSES[4]): + self.assertGreaterEqual(h._tip_z(L, z_safe) - h._sample_top_z(), rt.SAFE_TIP_CLEARANCE_M - 1e-9) + + def test_F05_stitching_in_y_moves_the_y_stage_and_is_declared(self): + self.assertTrue({'stage.y_m', 'stage.y_indicated_m'} <= set(rt.ON_STEP['measurement.stitch'])) + h = loaded(AU, slot=3) + prepare(h, **{k: v for k, v in FAST.items() if k != 'mode'}) + op = h.invoke('measurement.stitch', nx=1, ny=2, overlap=0.2)['operation_id'] + ys = set() + while h.operations[op]['phase'] == 'running': + h.step(0.05) + ys.add(round(h.stage['y'], 9)) + self.assertGreater(len(ys), 2) + + def test_F06_related_model_sources_are_cited(self): + m = _meta()['capabilities'] + for k in ('measurement.configure', 'measurement.start'): + self.assertIn('related_vk_x250k', rt.CAP_SOURCES[k]) + self.assertIn('related_vk_x1000', rt.CAP_SOURCES[k]) + self.assertIn('related_vk_x250k', rt.CAP_SOURCES['measurement.auto_range']) + self.assertIn('VK-X250K', ''.join(rt.CAP_LIMITS['measurement.start'])) + self.assertTrue(m['measurement.start']) + + def test_F07_histogram_step_with_plane_levelling(self): + for tx, ty in ((0.0, 0.0), (-0.003, 0.001), (0.0, 0.003)): # tilts larger than the step (0.8-1.1 um over the field) + h = loaded(dict(AU, sample_id='tilted', tilt_x_rad=tx, tilt_y_rad=ty), slot=3) + rid, r = measure(h) + st = h.invoke('data.step_height', record_id=rid, axis='x', lower=None, upper=None, leveling='plane')['step_height_m'] + self.assertAlmostEqual(st, 200e-9 / (1 + h.truth['z_scale']), delta=12e-9, msg=(tx, ty)) + + def test_F08_vibration_affects_focus_variation_and_wli(self): + for sample, slot, mode in ((STEEL, 2, 'focus_variation'), (dict(AU, sample_id='flat_wli', features=[], roughness=dict(sq_m=0.2e-9, correlation_length_m=5e-6)), 5, + 'white_light_interferometry')): + sq = {} + for vib in (False, True): + h = loaded(sample, slot=slot) + prepare(h, mode=mode) + if vib: + h.invoke('fault.inject', fault='vibration', active=True) + rid, r = measure(h, mode=mode, autofocus=False) + sq[vib] = h.invoke('data.roughness', record_id=rid, region=None, leveling='plane', s_filter_m=None, l_filter_m=None, profile_axis='x', + lambda_c_m=None)['areal']['sq_m'] + self.assertGreater(sq[True], sq[False], mode) + + def test_F09_engineering_constants_are_declared_parameters(self): + params = _meta()['mechanisms']['vk_x3000_profiler']['parameters'] + for k in ('pixel_z_noise_m', 'pinhole_v', 'side_lobe_margin', 'same_peak_fwhm', 'valid_peak', 'aag_target', 'double_scan_gain', 'z_repeat_m', + 'fv_texture_ref_m', 'film_noise_rel', 'film_band_m'): + self.assertEqual(params[k]['evidence'], 'assumption', k) + self.assertNotIn('parfocal_m', params) + + def test_F10_displayed_result_of_another_agent_is_hidden(self): + h = loaded(PMMA3, slot=3) + wait(h, h.invoke('focus.auto')['operation_id']) + h.register_principal('a1', 'agent') + h.register_principal('a2', 'agent') + s1, s2 = h.session('a1'), h.session('a2') + r = s1.invoke(instance_id=h.instance_id, capability_id='film.measure', arguments=dict(film_substance_id='pmma', substrate_substance_id='al'), request_id='f1') + wait(h, r['operation_id']) + self.assertIsNotNone(s1.read(instance_id=h.instance_id)['observations']['result.last_value']['value']) + self.assertIsNone(s2.read(instance_id=h.instance_id)['observations']['result.last_value']['value']) + + def test_F11_laser_pre_scan_of_the_automatic_limits(self): + h = loaded(AU, slot=3) + h.invoke('measurement.configure', **rt.SETTINGS_EXAMPLE) + before = h.ledger()['laser_on_s'] + op = h.invoke('measurement.auto_range')['operation_id'] + h.step(1.0) + self.assertTrue(h.read()['laser.on']) + wait(h, op) + self.assertAlmostEqual(h.ledger()['laser_on_s'] - before, rt.AUTORANGE_S, delta=1e-9) + self.assertLess(abs(h.ledger()['energy_residual_j']), 1e-15) + + def test_F12_opaque_top_materials_absorb(self): + h = loaded(STEP_STD, slot=3) + measure(h) + L = h.ledger() + self.assertEqual(L['energy_transmitted_j'], 0.0) + self.assertGreater(L['energy_absorbed_j'], 0.0) + g = loaded(dict(AU, sample_id='silica', substrate_substance_id='sio2_fused', features=[]), slot=3) + measure(g) + self.assertGreater(g.ledger()['energy_transmitted_j'], 0.9 * g.ledger()['energy_to_sample_j']) + + def test_power_button_toggles(self): + h = configured() + self.assertEqual(h.invoke('power.press_button'), dict(enabled=True, state='booting')) + h.step(rt.BOOT_S + 1) + self.assertEqual(h.invoke('power.press_button'), dict(enabled=False, state='off')) + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, mains_voltage_v=60.0)) + rejected(h, 'power.press_button', 'MAINS_OUT_OF_RANGE') + + +# ---------------------------------------------------------------- declared effects (scenario states) +_SC = {} +_SETTINGS = [dict(FAST), dict(rt.SETTINGS_EXAMPLE, mode='focus_variation'), dict(FAST, peak_mode='film', film_refractive_index=1.49), + dict(FAST, double_scan=True)] + + +def _into(h, phase, frac=0.5): + """Advance event-exactly to the next programme item of the given phase and then to `frac` of its duration.""" + for _ in range(200): + o = h.op + assert o is not None, phase + end = o['ends'][o['i']] + if o['phase'] == phase: + h.step(max(0.0, (end - h.t) * frac)) + return h + h.step(max(0.0, end - h.t) + 1e-9) + raise AssertionError(phase) + + +def _build(name): + if name == 'fresh': + return rt.KeyenceVkx3000Runtime() + if name == 'off': + h = configured() + for s in (AU, TALL, PMMA3): + h.invoke('sample.provide', **s) + return h + if name == 'booting': + h = _scenario('off') + h.invoke('power.set', enabled=True) + h.step(5.0) + return h + if name == 'ready': + h = _scenario('booting') + h.step(rt.BOOT_S) + return h + if name == 'loaded': + h = _scenario('ready') + h.invoke('sample.place', sample_id='au_step', x_m=0.0, y_m=0.0) + h.invoke('lens.select', slot=1) + settle(h) + return focus_near(h) + if name == 'focused': + h = _scenario('loaded') + return prepare(h, **{k: v for k, v in FAST.items() if k != 'mode'}) + if name == 'stage_moving': + h = _scenario('focused') + h.invoke('stage.move', x_m=0.002, y_m=0.001) + h.step(0.05) + return h + if name == 'z_moving': + h = _scenario('focused') + h.invoke('focus.move', z_m=h.z - 0.002) + h.step(0.1) + return h + if name == 'lens_retracting': + h = _scenario('focused') + h.invoke('lens.select', slot=3) + h.step(0.02) + assert h._z_moving() + return h + if name == 'revolver_turning': + h = _scenario('lens_retracting') + while h._z_moving(): + h.step(0.05) + h.step(0.3) + assert not h._revolver_settled() + return h + if name == 'lifting': + h = _scenario('focused') + h.invoke('stage.set_lift', lift_m=-0.004) + h.step(0.5) + return h + if name == 'unpowered_loaded': + h = _scenario('focused') + h.invoke('power.set', enabled=False) + return h + if name == 'unpowered_lifting': + h = _scenario('unpowered_loaded') + h.invoke('stage.set_lift', lift_m=-0.004) + h.step(0.5) + return h + if name == 'autofocusing': + h = _scenario('focused') + h.invoke('focus.move', z_m=h.z - 2e-4) + settle(h) + h.invoke('focus.auto') + h.step(0.5) + return h + if name == 'autofocus_moving': + h = _scenario('autofocusing') + return _into(h, 'z') + if name == 'auto_ranging': + h = _scenario('focused') + h.invoke('measurement.auto_range') + h.step(1.0) + return h + if name == 'measure_overhead': + h = _scenario('focused') + h.invoke('measurement.start') + h.step(0.5) + return h + if name == 'measuring': + h = _scenario('measure_overhead') + return _into(h, 'scan') + if name == 'measure_returning': + h = _scenario('measuring') + _into(h, 'z') + return h + if name == 'measured': + h = _scenario('measuring') + settle(h) + return h + if name == 'fv_measuring': + h = _scenario('focused') + h.invoke('measurement.configure', **dict(rt.SETTINGS_EXAMPLE, mode='focus_variation')) + h.invoke('measurement.start') + return _into(h, 'scan') + if name == 'double_scanning': + h = _scenario('focused') + h.invoke('measurement.configure', **dict(FAST, double_scan=True)) + h.invoke('measurement.start') + return _into(h, 'scan') + if name == 'stitching': + h = _scenario('focused') + h.invoke('measurement.stitch', nx=2, ny=1, overlap=0.2) + return _into(h, 'xy') + if name == 'stitch_scanning': + h = _scenario('stitching') + _into(h, 'scan') + return h + if name == 'film_measuring': + h = _scenario('focused') + h.invoke('film.measure', film_substance_id='pmma', substrate_substance_id='al') + h.step(0.5) + return h + if name == 'laser_fault': + h = _scenario('focused') + h.invoke('fault.inject', fault='laser_failure', active=True) + return h + if name == 'laser_fault_cleared': + h = _scenario('laser_fault') + h.invoke('fault.inject', fault='laser_failure', active=False) + return h + if name == 'stage_fault': + h = _scenario('focused') + h.invoke('fault.inject', fault='stage_disconnected', active=True) + return h + if name == 'revolver_jammed': + h = _scenario('revolver_turning') + h.invoke('fault.inject', fault='revolver_jam', active=True) + return h + if name == 'vibration_measuring': + h = _scenario('focused') + h.invoke('fault.inject', fault='vibration', active=True) + h.invoke('measurement.start') + _into(h, 'scan') + return h + if name == 'mains_fault': + h = _scenario('focused') + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, mains_voltage_v=60.0)) + return h + if name == 'mains_restored': + h = _scenario('mains_fault') + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE)) + return h + if name == 'tall_lowered': + h = _scenario('ready') + h.invoke('stage.set_lift', lift_m=-0.012) + settle(h) + h.invoke('sample.place', sample_id='tall', x_m=0.0, y_m=0.0) + return h + if name == 'film_sample_50x': + h = _scenario('ready') + h.invoke('sample.place', sample_id='pmma_al', x_m=0.0, y_m=0.0) + h.invoke('lens.select', slot=3) + settle(h) + focus_near(h, above=2e-5) + return prepare(h, peak_mode='film', film_refractive_index=1.49, quality='high_speed') + if name == 'wli_ready': + h = _scenario('loaded') + h.invoke('lens.select', slot=5) + settle(h) + focus_near(h, above=2e-5) + return prepare(h, mode='white_light_interferometry') + if name == 'wli_measuring': + h = _scenario('wli_ready') + h.invoke('measurement.start') + return _into(h, 'scan') + raise KeyError(name) + + +def _scenario(name): + if name not in _SC: + _SC[name] = _build(name) + return copy.deepcopy(_SC[name]) + + +SCENARIOS = ['fresh', 'off', 'booting', 'ready', 'loaded', 'focused', 'stage_moving', 'z_moving', 'lens_retracting', 'revolver_turning', 'lifting', + 'unpowered_loaded', 'unpowered_lifting', 'autofocusing', 'autofocus_moving', 'auto_ranging', 'measure_overhead', 'measuring', 'measure_returning', + 'measured', 'fv_measuring', 'double_scanning', 'stitching', 'stitch_scanning', 'film_measuring', 'laser_fault', 'laser_fault_cleared', + 'stage_fault', 'revolver_jammed', 'vibration_measuring', 'mains_fault', 'mains_restored', 'tall_lowered', 'film_sample_50x', 'wli_ready', + 'wli_measuring'] +STEP_DTS = (0.4, 1.0, 3.0, 15.0, 120.0) + + +def _variants(cap): + V = { + 'plant.configure': [dict(rt.PLANT_EXAMPLE), dict(room_k=300.15, mains_voltage_v=60.0, relative_humidity=0.5, noise_seed=1)], + 'sample.provide': [dict(rt.SAMPLE_EXAMPLE, sample_id='new')], + 'sample.place': [dict(sample_id='au_step', x_m=0.0, y_m=0.0), dict(sample_id='pmma_al', x_m=0.01, y_m=-0.005)], + 'sample.remove': [dict(sample_id='au_step'), dict(sample_id='tall')], + 'power.set': [dict(enabled=True), dict(enabled=False)], 'power.press_button': [{}], 'system.acknowledge': [{}], + 'fault.inject': [dict(fault=f, active=True) for f in rt.FAULTS] + [dict(fault=f, active=False) for f in rt.FAULTS], + 'stage.move': [dict(x_m=0.002, y_m=-0.001), dict(x_m=-0.03, y_m=0.02)], + 'stage.go_to': [dict(position='center'), dict(position='load'), dict(position='sample_center')], + 'stage.set_lift': [dict(lift_m=-0.010), dict(lift_m=0.0), dict(lift_m=-0.0005)], + 'lens.select': [dict(slot=2), dict(slot=3), dict(slot=5)], + 'zoom.set': [dict(zoom=2.0), dict(zoom=1.0)], + 'focus.move': [dict(z_m=0.030), dict(z_m=0.0322)], + 'focus.auto': [{}], + 'measurement.configure': _SETTINGS, + 'measurement.set_z_range': [dict(upper_z_m=0.03225, lower_z_m=0.03229)], + 'measurement.auto_range': [{}], 'measurement.start': [{}], 'measurement.stitch': [dict(nx=2, ny=1, overlap=0.2), dict(nx=1, ny=2, overlap=0.2)], + 'film.measure': [dict(film_substance_id='pmma', substrate_substance_id='al')], + 'calibration.z_scale': [dict(record_id='HM0001', certified_height_m=200e-9, axis='x', lower=[-400e-6, -50e-6], upper=[50e-6, 400e-6])], + 'calibration.xy_scale': [dict(record_id='HM0001', certified_pitch_m=10e-6, axis='x')], + 'sim.step': [dict(dt_s=0.5), dict(dt_s=30.0)], + } + return V.get(cap, []) + + +def _num(x): + return isinstance(x, (int, float)) and not isinstance(x, bool) + + +def _flat(v, prefix=''): + out = {} + if isinstance(v, dict): + for k, x in v.items(): + out.update(_flat(x, f'{prefix}.{k}')) + elif isinstance(v, list) and len(v) <= 64: + for i, x in enumerate(v): + out.update(_flat(x, f'{prefix}[{i}]')) + else: + out[prefix] = json.dumps(v, sort_keys=True, default=str) if isinstance(v, list) else v + return out + + +def _rel_changed(a, b, scale=None): + if _num(a) and _num(b): + return abs(a - b) > 1e-9 * (max(abs(a), abs(b)) if scale is None else scale) + 1e-300 + return _changed(a, b) + + +def _leaf_changed(a, b): + fa, fb = _flat(a), _flat(b) + return any(_rel_changed(fa.get(k, ''), fb.get(k, '')) for k in set(fa) | set(fb)) + + +def _step_differs(v1, a2, v0, b2): + """Does the step change the value differently with the call (v1 -> a2) than without it (v0 -> b2)? (leaf-wise, numeric increments)""" + f1, fa, f0, fb = _flat(v1), _flat(a2), _flat(v0), _flat(b2) + for leaf in set(f1) | set(fa) | set(f0) | set(fb): + x1, xa, x0, xb = (f.get(leaf, '') for f in (f1, fa, f0, fb)) + ca, cb = _rel_changed(x1, xa), _rel_changed(x0, xb) + if not (ca or cb): + continue + if ca and cb and all(_num(x) for x in (x1, xa, x0, xb)) and not _rel_changed(xa - x1, xb - x0, max(abs(x1), abs(xa), abs(x0), abs(xb))): + continue + if ca and cb and (x1, xa) == (x0, xb): + continue + if ca and cb and x1 == x0 and not _rel_changed(xa, xb): + continue + return True + return False + + +def _executable(cap): + return cap not in rt.UNSUPPORTED and rt.CAPS[cap]['kind'] not in ('query', 'analysis') + + +class DeclaredEffects(unittest.TestCase): + def test_immediate_and_on_step_effects_are_declared(self): + """For every capability accepted in any scenario state: the slots it changes at once are declared effects, the slots whose change during the + following step differs from an identical run without the call are declared on_step effects, and the step itself only changes slots declared + as on_step effects of sim.step (the runtime noise is seeded by counters, so both runs draw identical noise).""" + missing_imm, missing_step = {}, {} + states = {n: _scenario(n) for n in SCENARIOS} + for cap in rt.CAPS: + if not _executable(cap): + continue + for sname, S in states.items(): + for args in _variants(cap): + A = copy.deepcopy(S) + v0 = A.read('evaluator') + try: + _orig_invoke(A, cap, **args) + except rt.ActionRejected: + continue + v1 = A.read('evaluator') + if cap == 'sim.step': + for k in v0: + if _leaf_changed(v0[k], v1[k]) and k not in rt.ON_STEP['sim.step'] + rt.EFFECTS['sim.step']: + missing_step.setdefault('sim.step', set()).add((sname, k)) + continue + for k in v0: + if _changed(v0[k], v1[k]) and _leaf_changed(v0[k], v1[k]) and k not in rt.EFFECTS.get(cap, []): + missing_imm.setdefault(cap, set()).add((sname, k)) + for dt in STEP_DTS: + A2, B2 = copy.deepcopy(A), copy.deepcopy(S) + A2.step(dt) + B2.step(dt) + a2, b2 = A2.read('evaluator'), B2.read('evaluator') + for k in v0: + if k not in rt.ON_STEP.get(cap, []) and _step_differs(v1[k], a2[k], v0[k], b2[k]): + missing_step.setdefault(cap, set()).add((sname, k)) + if k not in rt.ON_STEP['sim.step'] + ['clock.time_s'] and _leaf_changed(v0[k], b2[k]): + missing_step.setdefault('sim.step', set()).add((sname, k)) + self.assertEqual(missing_imm, {}) + self.assertEqual(missing_step, {}) + self.assertFalse([s for v in rt.ON_STEP.values() for s in v if rt.SLOTS[s]['origin'] == 'setpoint']) + + def test_every_device_capability_is_accepted_in_some_scenario(self): + accepted = set() + for n in SCENARIOS: + S = _scenario(n) + for cap in rt.CAPS: + if not _executable(cap) or cap in accepted: + continue + for args in _variants(cap): + try: + _orig_invoke(copy.deepcopy(S), cap, **args) + accepted.add(cap) + break + except rt.ActionRejected: + pass + self.assertEqual({c for c in rt.CAPS if _executable(c)} - accepted, set()) + + def test_long_window_effects_of_operations_are_declared(self): + """Every accepted asynchronous call is followed until its operation has left 'running' (+ 5 s), every other call for 150 s, comparing with + the identical run without the call every 0.05 s for the first 10 s and every 1 s after (transient phases and completion effects outside + the short windows).""" + missing = {} + for sname in ('focused', 'loaded', 'measuring', 'stitching', 'film_sample_50x', 'wli_ready', 'unpowered_loaded', 'revolver_turning', 'laser_fault'): + S = _scenario(sname) + for cap in rt.CAPS: + if not _executable(cap) or cap == 'sim.step': + continue + for args in _variants(cap): + A = copy.deepcopy(S) + v0 = A.read('evaluator') + try: + res = _orig_invoke(A, cap, **args) + except rt.ActionRejected: + continue + oid = res.get('operation_id') if isinstance(res, dict) else None + v1 = A.read('evaluator') + B = copy.deepcopy(S) + t, t_end = 0.0, (1200.0 if oid else 150.0) + while t < t_end - 1e-9: + d = 0.05 if t < 10.0 - 1e-9 else 1.0 # fine first: transient phases (laser on during a 0.1 s scan) + A.step(d) + B.step(d) + t += d + a2, b2 = A.read('evaluator'), B.read('evaluator') + for k in v0: + if k not in rt.ON_STEP.get(cap, []) and _step_differs(v1[k], a2[k], v0[k], b2[k]): + missing.setdefault(cap, set()).add((sname, k)) + if oid and A.operations[oid]['phase'] != 'running' and t_end == 1200.0: + t_end = t + 5.0 + self.assertEqual(missing, {}) + + +class ZZRejectionCodes(unittest.TestCase): + def test_every_observed_rejection_code_is_declared(self): + """Runs last (class name): every code raised by a device call anywhere in this test module is declared for that capability.""" + undeclared = {k: sorted(v - set(rt.CAP_ERRORS.get(k, [])) - {'INVALID_ARGUMENT', 'UNSUPPORTED', 'UNKNOWN_CAPABILITY'}) + for k, v in REJECTIONS.items()} + self.assertEqual({k: v for k, v in undeclared.items() if v}, {}) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_asset_kratos_axissupra.py b/tests/test_asset_kratos_axissupra.py new file mode 100644 index 0000000000000000000000000000000000000000..e3092896da4f800fe92687686b84bd9fd1d93d89 --- /dev/null +++ b/tests/test_asset_kratos_axissupra.py @@ -0,0 +1,1649 @@ +"""tests for CHEM-154 kratos_axissupra: python3 -m unittest tests/test_asset_kratos_axissupra.py + +Topics (pipeline.md): set points only write targets, read/describe are pure, rejected preconditions leave the state unchanged, two instances +are isolated, agent/evaluator truth isolation, conservation (sputtered atoms, argon, nitrogen, charge), real return values validated against the +declared schemas (asset_tool lint_schema / validate_value), asynchronous completion and cancellation remnants, host-step independence, declared +immediate and on_step effects; plus the instrument (vacuum, Flexi-lock, pump cycle with holder images, transfer, 5-axis stage and lens clearance, +X-ray interlocks) and the XPS physics: the acceptance performance of the related AXIS Supra (Ag 3d5/2 0.48 eV at > 760 kcps, PET C 1s 0.68 eV at +> 44 kcps with the neutraliser), charging and neutralisation, ISO 15472 energy-scale calibration on the Au/Ag/Cu reference samples, chemical +states from the NIST SRD 20 templates, quantification, SiO2/Si overlayer thickness, angle-resolved enhancement, Ta2O5/Ta depth profile with oxide +reduction and argon implantation, parallel imaging of a copper grid, faults. +""" +import copy +import json +import math +import sys +import unittest +from pathlib import Path + +import numpy as np + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / 'scripts')) +sys.path.insert(0, str(ROOT / 'skills/chemistry-lab-assets/scripts')) +from asset_runtime import kratos_axissupra as rt # noqa: E402 +import asset_tool # noqa: E402 + +CHECKS, PROCESS_EVIDENCE = [], {} +_META = {} +UNIFORM = dict(kind='uniform', feature_substance_id=None, feature_thickness_m=None, pitch_m=None, width_m=None, coverage=None) + + +def _meta(): + if not _META: + _META.update(rt.export_kratos_axissupra_contract_metadata()) + return _META + + +def _changed(a, b): + return json.dumps(a, sort_keys=True, default=str) != json.dumps(b, sort_keys=True, default=str) + + +_orig_invoke = rt.KratosAxissupraRuntime.invoke + + +def _instrumented_invoke(self, capability_id, **a): + """Every successful call is checked against its declared output schema and immediate state effects (a call does not advance time).""" + before = self.read('evaluator') if capability_id != 'sim.step' else None + t0 = self.time_ns + out = _orig_invoke(self, capability_id, **a) + meta = _meta()['capabilities'][capability_id] + errs = asset_tool.validate_value(out, meta['output_schema']) + if errs: + raise AssertionError(f'{capability_id} output violates its schema: {errs[:3]}') + if before is not None: + assert self.time_ns == t0, capability_id + after = self.read('evaluator') + undeclared = {k for k in after if _changed(before[k], after[k])} - set(rt.EFFECTS.get(capability_id, [])) + if undeclared and rt.EFFECTS: + raise AssertionError(f'{capability_id} changed undeclared state immediately: {sorted(undeclared)}') + PROCESS_EVIDENCE.setdefault(capability_id, []).append(dict(arguments=copy.deepcopy(a), result_keys=sorted(out))) + return out + + +rt.KratosAxissupraRuntime.invoke = _instrumented_invoke + + +class QuietRng: + """Noise-free stand-in for random.Random (gauges exact, fixed draws) so that two runs differ only by the process.""" + def gauss(self, mu, sigma): + return mu + + def random(self): + return 0.5 + + def uniform(self, a, b): + return 0.5 * (a + b) + + def seed(self, x): + pass + + +def configured(seed=1, **plant): + h = rt.KratosAxissupraRuntime() + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, noise_seed=seed, **plant)) + return h + + +def ready(seed=1, **plant): + h = configured(seed, **plant) + h.invoke('power.set', enabled=True) + h.step(rt.BOOT_S + 1.0) + return h + + +def provide(h, sid, substrate, layers=(), pattern=None, size=0.010, thick=5.0e-4, air=True, form=None): + h.invoke('sample.provide', sample_id=sid, form=form or ('film_on_substrate' if layers else 'solid'), substrate_substance_id=substrate, + layers=[dict(substance_id=a, thickness_m=b) for a, b in layers], pattern=pattern or dict(UNIFORM), lateral_size_m=size, thickness_m=thick, + air_exposed=air) + return sid + + +def on_stage(h, samples, holder='H1', slot=1): + """Mount samples [(sid, x)] on a holder, load it, pump the Flexi-lock and transfer the holder to the stage.""" + for sid, x in samples: + h.invoke('holder.mount_sample', holder_id=holder, sample_id=sid, x_m=x, y_m=0.0) + if h.fl_mode != 'vented': + h.invoke('flexilock.vent') + h.step(90.0) + h.invoke('flexilock.set_lid', open=True) + h.invoke('flexilock.load_holder', holder_id=holder, slot=slot) + h.invoke('flexilock.set_lid', open=False) + h.invoke('flexilock.pump') + for _ in range(200): + h.step(10.0) + if h.fl_mode == 'pumped': + break + assert h.fl_mode == 'pumped', h.p_fl + op = h.invoke('transfer.to_stage', slot=slot)['operation_id'] + wait(h, op) + assert h.stage_holder == holder + return h + + +def wait(h, op, tmax=20000.0, dt=1.0): + t0 = h.time_s + while h.operations[op]['phase'] == 'running' and h.time_s - t0 < tmax: + h.step(dt) + return h.operations[op]['phase'] + + +def beam(h, emission=0.015): + h.invoke('xray.set_source', on=True, emission_a=emission) + h.step(30.0) + assert h._xray_at_setpoint() + return h + + +def go_sample(h, x, z=None, tilt=0.0, rot=0.0): + s = next(sid for sid, (sx, sy) in h.holders[h.stage_holder]['samples'].items() if abs(sx - x) < 1e-9) + zz = -h.samples[s]['thickness_m'] if z is None else z + h.invoke('stage.move', x_m=-x, y_m=0.0, z_m=zz, tilt_rad=tilt, rotation_rad=rot) + h.step(40.0) + return h + + +def spectrum(h, regions, mode='scanned'): + op = h.invoke('acquisition.spectrum', regions=regions, mode=mode)['operation_id'] + st = wait(h, op) + rid = h.operations[op]['record_id'] + assert st == 'completed', (st, h.operations[op]) + return rid + + +def region(name, lo, hi, step=0.05, dwell=0.1, sweeps=2): + return dict(name=name, start_be_ev=lo, end_be_ev=hi, step_ev=step, dwell_s=dwell, sweeps=sweeps) + + +def arrays(h, rid, name): + sp = next(s for s in h.records[rid]['spectra'] if s['name'] == name) + return np.array(sp['binding_energy_ev']), np.array(sp['counts_per_second']) + + +def fwhm(be, y): + y = np.asarray(y, float) - float(np.min(y)) + i = int(np.argmax(y)) + h = y[i] / 2 + l_ = i + while l_ > 0 and y[l_] > h: + l_ -= 1 + r = i + while r < len(y) - 1 and y[r] > h: + r += 1 + xl = be[l_] + (h - y[l_]) / (y[l_ + 1] - y[l_]) * (be[l_ + 1] - be[l_]) + xr = be[r - 1] + (h - y[r - 1]) / (y[r] - y[r - 1]) * (be[r] - be[r - 1]) + return abs(xr - xl), be[i], y[i] + + +def rejected(h, cap, code, **a): + before = h.read('evaluator') + rev = h.revision + try: + h.invoke(cap, **a) + except rt.ActionRejected as exc: + assert str(exc) == code, (cap, str(exc), code) + assert not _changed(h.read('evaluator'), before), cap + assert h.revision == rev, cap + return True + raise AssertionError(f'{cap} was not rejected (expected {code})') + + +def clean_reference(h, ref, seconds=60.0): + h.invoke('stage.go_to', position='reference:' + ref) + h.step(60.0) + if not h.ion_on: + h.invoke('ion_gun.set', on=True, energy_ev=3000.0, raster_m=0.003) + op = h.invoke('ion_gun.etch', duration_s=seconds)['operation_id'] + wait(h, op) + + +class ContractAndSchemas(unittest.TestCase): + def test_module_identity(self): + self.assertEqual(rt.ASSET_TYPE_ID, 'instrument.kratos_axissupra') + self.assertEqual(rt.CATALOG_ID, 'CHEM-154') + + def test_schemas_lint_and_examples_validate(self): + meta = _meta() + for k, c in meta['capabilities'].items(): + self.assertEqual(asset_tool.lint_schema(c['input_schema']), [], k) + self.assertEqual(asset_tool.lint_schema(c['output_schema']), [], k) + if c['availability'] == 'implemented': + self.assertEqual(asset_tool.validate_value(c['example_arguments'], c['input_schema']), [], k) + for k, s in meta['state_slots'].items(): + self.assertEqual(asset_tool.lint_schema(s['value_schema']), [], k) + + def test_metadata_references_are_consistent(self): + meta = _meta() + slots = set(meta['state_slots']) + for k, c in meta['capabilities'].items(): + for e in c['state_effects']: + self.assertIn(e['state_id'], slots, k) + for x in c['observes']: + self.assertIn(x, slots, k) + for p in c['preconditions']: + for x in p['state_ids']: + self.assertIn(x, slots, k) + for e in c['errors']: + self.assertIn(e['code'], rt.ERROR_ZH, k) + self.assertEqual(set(rt.CAP_SOURCES), set(rt.CAPS)) + comps = {p['id'] for p in json.loads((rt.ASSET / 'geometry_manifest.json').read_text())['components']} + for k, c in meta['capabilities'].items(): + self.assertLessEqual(set(c['component_ids']), comps, k) + for k, s in meta['state_slots'].items(): + self.assertLessEqual(set(s['component_ids']), comps, k) + + def test_every_rejection_code_is_declared(self): + """Each ActionRejected code raised by a command method (directly or through its helpers) appears in that capability's declared errors.""" + import inspect + import re + src = inspect.getsource(rt.KratosAxissupraRuntime) + meta = _meta()['capabilities'] + helpers = {'_need_plant': ['PLANT_REQUIRED'], '_need_power': ['PLANT_REQUIRED', 'POWER_OFF'], + '_need_ready()': ['PLANT_REQUIRED', 'POWER_OFF', 'NOT_READY', 'ERROR_PENDING'], '_need_ready(allow_error=True)': ['PLANT_REQUIRED', 'POWER_OFF', 'NOT_READY'], + '_need_idle': ['ACQUISITION_RUNNING'], + '_need_no_transfer': ['TRANSFER_RUNNING'], '_need_beam': ['XRAY_NOT_READY', 'VACUUM_NOT_READY'], + '_need_stage_free': ['PLANT_REQUIRED', 'POWER_OFF', 'NOT_READY', 'ERROR_PENDING', 'ACQUISITION_RUNNING', 'TRANSFER_RUNNING', 'TRANSFER_INTERRUPTED'], + '_need_not_stranded': ['TRANSFER_INTERRUPTED'], + '_need_acquire': ['PLANT_REQUIRED', 'POWER_OFF', 'NOT_READY', 'ERROR_PENDING', 'ACQUISITION_RUNNING', 'TRANSFER_RUNNING', 'XRAY_NOT_READY', + 'VACUUM_NOT_READY', 'STAGE_EMPTY', 'MOTION_IN_PROGRESS', 'RECORDS_FULL'], + '_check_regions(regions, mode)': ['DUPLICATE_REGION', 'INVALID_REGION', 'REGION_EXCEEDS_SNAPSHOT_WINDOW'], + "_check_regions(regions, 'scanned')": ['DUPLICATE_REGION', 'INVALID_REGION'], '_check_stage_target': ['OUT_OF_RANGE', 'COLLISION_RISK'], + '_rec(': ['UNKNOWN_RECORD', 'WRONG_RECORD_KIND', 'RECORD_NOT_COMPLETED'], '_region(': ['UNKNOWN_REGION'], + 'substance(': ['UNKNOWN_TEMPLATE'], '_quantify_spectra(': ['UNKNOWN_REGION', 'UNASSIGNED_REGION']} + for k in rt.CAPS: + if k in rt.UNSUPPORTED: + continue + m = re.search(r' def _cmd_' + k.replace('.', '_') + r'\(.*?(?=\n def |\Z)', src, re.S) + self.assertIsNotNone(m, k) + body = m.group(0) + codes = set(re.findall(r"ActionRejected\('([A-Z_]+)'\)", body)) + for hname, hcodes in helpers.items(): + if hname in body: + codes |= set(hcodes) + codes.discard('INVALID_ARGUMENT') + declared = {e['code'] for e in meta[k]['errors']} + self.assertLessEqual(codes, declared, (k, sorted(codes - declared))) + + def test_unsupported_capabilities_report_unsupported(self): + h = configured() + h.register_principal('a', 'agent') + s = h.session('a') + for k in rt.UNSUPPORTED: + r = s.invoke(instance_id=h.instance_id, capability_id=k, arguments={}, request_id='u-' + k) + self.assertEqual(r['status'], 'unsupported', k) + self.assertEqual(r['error']['code'], 'UNSUPPORTED') + + +class HostClockAndPurity(unittest.TestCase): + def test_read_and_describe_do_not_advance_time(self): + h = ready() + h.register_principal('a', 'agent') + t, rev = h.time_ns, h.revision + h.read('evaluator') + s = h.session('a') + s.read(instance_id=h.instance_id) + s.describe(instance_id=h.instance_id) + self.assertEqual((h.time_ns, h.revision), (t, rev)) + + def test_step_zero_and_negative(self): + h = configured() + rev = h.revision + h.step(0.0) + self.assertEqual(h.revision, rev) + with self.assertRaises(rt.ActionRejected): + h.step(-1.0) + + def test_host_step_chopping_does_not_change_the_result(self): + def run(chunks): + h = ready(seed=5) + h.rng = QuietRng() + h.rng_acq = QuietRng() + provide(h, 'cu', 'cu') + on_stage(h, [('cu', 0.0)]) + beam(h) + h.invoke('stage.move', x_m=0.002, y_m=0.0, z_m=-5.0e-4, tilt_rad=0.2, rotation_rad=0.3) + for dt in chunks: + h.step(dt) + h.invoke('ion_gun.set', on=True, energy_ev=2000.0, raster_m=0.003) + h.invoke('ion_gun.etch', duration_s=33.3) + for dt in chunks: + h.step(dt) + h.invoke('acquisition.spectrum', regions=[region('Cu 2p', 925.0, 960.0, 0.1, 0.05, 1)], mode='scanned') + for dt in chunks: + h.step(dt) + return h.read('evaluator'), h.ledger(), h.records['SP0001'] + (a, la, ra), (b, lb, rb) = run([100.0]), run([0.37] * 270 + [0.1]) + for k in ('truth.sac_pressure_pa', 'truth.fl_pressure_pa', 'stage.x_m', 'stage.tilt_rad', 'stage.rotation_rad', 'clock.time_s'): + self.assertAlmostEqual(a[k], b[k], delta=1e-9 * max(abs(a[k]), 1e-12), msg=k) + for k in ('anode_energy_j', 'photons_on_sample', 'nitrogen_pumped_mol', 'sputtered_atoms', 'argon_admitted_mol'): + self.assertAlmostEqual(la[k], lb[k], delta=1e-9 * max(abs(la[k]), 1.0), msg=k) + self.assertEqual(ra['status'], 'completed') + self.assertEqual(ra['spectra'], rb['spectra']) + self.assertAlmostEqual(a['truth.samples']['cu']['craters'][0]['removed']['base'], b['truth.samples']['cu']['craters'][0]['removed']['base'], delta=1e-18) + + def test_reads_do_not_change_later_counts(self): + h = ready(seed=4) + provide(h, 'cu', 'cu') + on_stage(h, [('cu', 0.0)]) + beam(h) + go_sample(h, 0.0) + h.invoke('acquisition.spectrum', regions=[region('Cu 2p', 925.0, 960.0, 0.1, 0.05, 1)], mode='scanned') + a, b = copy.deepcopy(h), copy.deepcopy(h) + for _ in range(60): + a.step(0.5) + a.read('agent') + a.read('evaluator') + b.step(0.5) + self.assertEqual(a.records['SP0001']['status'], 'completed') + self.assertEqual(a.records['SP0001']['spectra'], b.records['SP0001']['spectra']) + self.assertEqual(a.ledger(), b.ledger()) + + def test_set_points_only_write_targets(self): + h = ready() + provide(h, 'cu', 'cu') + on_stage(h, [('cu', 0.0)]) + x0 = h.stage['x'] + h.invoke('stage.move', x_m=0.010, y_m=0.0, z_m=0.0, tilt_rad=0.0, rotation_rad=0.0) + self.assertEqual(h.stage['x'], x0) + h.step(1.0) + self.assertAlmostEqual(h.stage['x'], x0 + rt.STAGE_SPEED_M_S, places=12) + h.invoke('xray.set_source', on=True, emission_a=0.015) + self.assertEqual(h.hv, 0.0) + h.step(1.0) + self.assertAlmostEqual(h.hv, rt.HV_RAMP_V_S, places=6) + h.invoke('flexilock.vent') + p = h.p_fl + self.assertEqual(h.fl_mode, 'venting') + h.step(1.0) + self.assertGreater(h.p_fl, p) + + +class VacuumAndHandling(unittest.TestCase): + def test_lid_opens_only_at_atmosphere_and_pump_cycle_images_holders(self): + h = ready() + provide(h, 'a', 'au') + h.invoke('holder.mount_sample', holder_id='H2', sample_id='a', x_m=0.010, y_m=0.002) + h.invoke('flexilock.set_lid', open=True) + h.invoke('flexilock.load_holder', holder_id='H2', slot=2) + h.invoke('flexilock.set_lid', open=False) + rejected(h, 'flexilock.load_holder', 'LID_CLOSED', holder_id='H1', slot=1) + h.invoke('flexilock.pump') + h.step(20.0) + rejected(h, 'flexilock.set_lid', 'NOT_VENTED', open=True) + for _ in range(100): + h.step(10.0) + if h.fl_mode == 'pumped': + break + self.assertEqual(h.fl_mode, 'pumped') + self.assertLess(h.p_fl, rt.FL_TRANSFER_MAX_PA) + rid = h.images['H2'] + det = h.records[rid]['image']['detected'] + self.assertEqual([d['sample_id'] for d in det], ['a']) + self.assertLess(abs(det[0]['x_m'] - 0.010), 3e-4) + + def test_transfer_needs_the_pumped_flexilock_and_the_gate_burst(self): + h = ready() + provide(h, 'a', 'au') + h.invoke('holder.mount_sample', holder_id='H1', sample_id='a', x_m=0.0, y_m=0.0) + h.invoke('flexilock.set_lid', open=True) + h.invoke('flexilock.load_holder', holder_id='H1', slot=1) + h.invoke('flexilock.set_lid', open=False) + rejected(h, 'transfer.to_stage', 'FLEXILOCK_NOT_PUMPED', slot=1) + h.invoke('flexilock.pump') + for _ in range(100): + h.step(10.0) + if h.fl_mode == 'pumped': + break + p0 = h.p_sac + op = h.invoke('transfer.to_stage', slot=1)['operation_id'] + rejected(h, 'flexilock.vent', 'TRANSFER_RUNNING') + peak = p0 + h.step(0.01) # the gate opens at once (stage and magazine already in place) + peak = max(peak, h.p_sac) + while h.operations[op]['phase'] == 'running': + h.step(0.5) + peak = max(peak, h.p_sac) + self.assertLessEqual(h.arm, rt.TRANSFER_STROKE_M + 1e-12) + self.assertEqual(h.operations[op]['phase'], 'completed') + self.assertGreater(peak, 3 * p0) # the gate valve lets the Flexi-lock gas into the analysis chamber (equalised 5.1 x p0, tau 0.1 s) + self.assertEqual((h.stage_holder, h.magazine[1], h.gate, h.arm), ('H1', None, 0.0, 0.0)) + op = h.invoke('transfer.to_magazine', slot=3)['operation_id'] + self.assertEqual(wait(h, op), 'completed') + self.assertEqual((h.stage_holder, h.magazine[3]), (None, 'H1')) + + def test_power_loss_during_transfer_interrupts_and_latches(self): + h = ready() + provide(h, 'a', 'au') + on_stage(h, [('a', 0.0)]) + op = h.invoke('transfer.to_magazine', slot=1)['operation_id'] + while h.transfer_op['phase'] != 'arm_in': + h.step(0.5) + h.invoke('power.set', enabled=False) + self.assertEqual(h.operations[op]['phase'], 'failed') + self.assertEqual(h.error, 'TRANSFER_INTERRUPTED') + self.assertEqual(h.holders['H1']['location'], 'arm') + h.step(5.0) + self.assertGreater(h.gate, 0.08) # the extended fork blocks the pneumatic gate valve (it would close otherwise) + h.invoke('power.set', enabled=True) + h.step(rt.BOOT_S + 1.0) + self.assertEqual(wait(h, h.invoke('transfer.recover')['operation_id']), 'completed') + self.assertEqual((h.stage_holder, h.magazine[1], h.holders['H1']['location'], h.gate, h.error), (None, 'H1', 'slot:1', 0.0, None)) + + def test_sample_and_mount_validation(self): + h = configured() + rejected(h, 'sample.provide', 'UNKNOWN_TEMPLATE', sample_id='x', form='solid', substrate_substance_id='unobtainium', layers=[], pattern=dict(UNIFORM), + lateral_size_m=0.01, thickness_m=5e-4, air_exposed=True) + rejected(h, 'sample.provide', 'INVALID_PATTERN', sample_id='x', form='solid', substrate_substance_id='si', layers=[], + pattern=dict(UNIFORM, kind='grid'), lateral_size_m=0.01, thickness_m=5e-4, air_exposed=True) + provide(h, 'big', 'au', size=0.020) + provide(h, 'thick', 'au', thick=0.019) + provide(h, 'small', 'au', size=0.005) + rejected(h, 'holder.mount_sample', 'OUTSIDE_HOLDER', holder_id='H1', sample_id='big', x_m=0.030, y_m=0.0) + h.invoke('holder.mount_sample', holder_id='H1', sample_id='big', x_m=0.0, y_m=0.0) + rejected(h, 'holder.mount_sample', 'POSITION_OCCUPIED', holder_id='H1', sample_id='small', x_m=0.009, y_m=0.0) + h.invoke('holder.mount_sample', holder_id='H1', sample_id='thick', x_m=-0.025, y_m=0.0) + rejected(h, 'holder.mount_sample', 'SAMPLE_NOT_ON_BENCH', holder_id='H2', sample_id='thick', x_m=0.0, y_m=0.0) + + def test_stage_lens_clearance_and_reference_positions(self): + h = ready() + provide(h, 'thick', 'au', thick=0.010) + on_stage(h, [('thick', 0.0)]) + self.assertAlmostEqual(h.stage['z'], -0.0105, places=9) # the transfer pose lowers a holder with a thick sample + rejected(h, 'stage.move', 'COLLISION_RISK', x_m=0.0, y_m=0.0, z_m=0.0, tilt_rad=0.0, rotation_rad=0.0) + h.invoke('stage.go_to', position='reference:Cu') + h.step(60.0) + self.assertEqual(h._analysed_target()[:2], ('reference', 'Cu')) + self.assertLess(abs(h.read()['stage.x_indicated_m'] - (-rt.REF_BLOCK_X)), 5e-6) + + def test_auto_height_brings_the_surface_to_the_focus(self): + h = ready() + provide(h, 'au', 'au', thick=2.0e-3) + on_stage(h, [('au', 0.0)]) + beam(h) + h.invoke('stage.move', x_m=0.0, y_m=0.0, z_m=-1.2e-3, tilt_rad=0.0, rotation_rad=0.0) + h.step(10.0) + self.assertGreater(abs(h._focus_offset()), 5e-4) + op = h.invoke('stage.auto_height')['operation_id'] + self.assertEqual(wait(h, op), 'completed') + h.step(20.0) + self.assertLess(abs(h._focus_offset()), 3e-5) + + +class XraySourceAndFaults(unittest.TestCase): + def test_interlocks_and_power_limit(self): + h = ready() + with self.assertRaises(rt.ActionRejected): + h.invoke('xray.set_source', on=True, emission_a=0.041) + h.invoke('fault.inject', fault='chiller_failure', active=True) + rejected(h, 'xray.set_source', 'COOLING_WATER_LOW', on=True, emission_a=0.015) + h.invoke('fault.inject', fault='chiller_failure', active=False) + beam(h) + self.assertAlmostEqual(h._xray_power(), 225.0, places=6) + h.invoke('fault.inject', fault='chiller_failure', active=True) + h.step(2.0) + self.assertFalse(h.xray_on) + self.assertEqual((h.xray_fault, h.error), ('COOLING_WATER_LOW', 'COOLING_WATER_LOW')) + rejected(h, 'system.acknowledge', 'CAUSE_PERSISTS') + h.invoke('fault.inject', fault='chiller_failure', active=False) + h.invoke('system.acknowledge') + self.assertIsNone(h.error) + + def test_sac_leak_prevents_the_xray_source(self): + h = ready() + h.invoke('fault.inject', fault='sac_leak', active=True) + h.step(60.0) + self.assertGreater(h.p_sac, rt.XRAY_MAX_PA) + rejected(h, 'xray.set_source', 'VACUUM_NOT_READY', on=True, emission_a=0.015) + + def test_neutraliser_filament_failure_switches_it_off(self): + h = ready() + h.invoke('neutraliser.set', on=True, filament_current_a=0.4, charge_balance_v=3.3, filament_bias_v=1.0) + h.invoke('fault.inject', fault='neutraliser_filament_failure', active=True) + h.step(2.0) + self.assertFalse(h.neut_on) + rejected(h, 'neutraliser.set', 'FILAMENT_FAILURE', on=True, filament_current_a=0.4, charge_balance_v=3.3, filament_bias_v=1.0) + + +class SpectroscopyPhysics(unittest.TestCase): + def test_ag_3d52_acceptance_performance(self): + """Related AXIS Supra acceptance value: Ag 3d5/2 > 760 kcps at 0.48 eV FWHM (slot, PE 10 eV, 600 W, sputter-cleaned Ag).""" + h = ready(seed=2) + provide(h, 'dummy', 'au') + on_stage(h, [('dummy', 0.0)]) + beam(h, emission=0.040) + clean_reference(h, 'Ag') + h.invoke('analyser.configure', lens_mode='hybrid', aperture='slot', pass_energy_ev=10.0) + rid = spectrum(h, [region('Ag', 364.0, 373.0, 0.02, 0.1, 1)]) + be, y = arrays(h, rid, 'Ag') + w, c, top = fwhm(be[be < 371.5], y[be < 371.5]) + self.assertAlmostEqual(w, 0.48, delta=0.03) + self.assertGreater(top, 760e3) + + def test_pet_c1s_on_insulators_needs_the_neutraliser(self): + """Related AXIS Supra value on insulators: PET C 1s 0.68 eV FWHM (> 44 kcps) with the electron-only neutraliser; without it the peaks shift + to higher binding energy by several volts and broaden.""" + h = ready(seed=3) + provide(h, 'pet', 'pet', thick=1.0e-4) + on_stage(h, [('pet', 0.0)]) + beam(h, emission=0.040) + go_sample(h, 0.0) + h.invoke('analyser.configure', lens_mode='hybrid', aperture='slot', pass_energy_ev=20.0) + rid = spectrum(h, [region('C 1s wide', 270.0, 330.0, 0.1, 0.02, 1)]) + be, y = arrays(h, rid, 'C 1s wide') + shift_off = float(be[int(np.argmax(y))]) - 284.8 + self.assertGreater(shift_off, 5.0) + h.invoke('neutraliser.set', on=True, filament_current_a=0.4, charge_balance_v=3.3, filament_bias_v=1.0) + h.step(20.0) + rid = spectrum(h, [region('C 1s', 274.0, 292.0, 0.02, 0.1, 1)]) + be, y = arrays(h, rid, 'C 1s') + cc = h.invoke('data.charge_correct', record_id=rid, region='C 1s', reference_be_ev=284.8) + self.assertLess(cc['shift_ev'], 6.0) + self.assertGreater(cc['shift_ev'], 1.0) # the neutraliser overcompensates slightly (negative surface potential) + est = 288.8 - cc['shift_ev'] # the ester component in the uncorrected spectrum + m = (be > est - 0.9) & (be < est + 0.9) + w, c, top = fwhm(be[m], y[m]) + self.assertAlmostEqual(w, 0.68, delta=0.06) + self.assertGreater(top, 44e3) + fit = h.invoke('data.fit', record_id=rid, region='C 1s', shift_ev=cc['shift_ev'], + components=[dict(label='C-C', be_ev=284.8, fwhm_ev=0.8, fix_position=False), dict(label='C-O', be_ev=286.4, fwhm_ev=0.8, fix_position=False), + dict(label='O-C=O', be_ev=288.8, fwhm_ev=0.8, fix_position=False)]) + p = {c_['label']: c_['percent'] for c_ in fit['components']} + self.assertAlmostEqual(p['C-C'] / p['O-C=O'], 3.0, delta=0.9) # PET repeat unit: 6 C-C : 2 C-O : 2 O-C=O (plus adventitious C-C) + self.assertAlmostEqual(p['C-O'] / p['O-C=O'], 1.0, delta=0.35) + + def test_iso15472_energy_scale_calibration(self): + h = ready(seed=6) + provide(h, 'dummy', 'au') + on_stage(h, [('dummy', 0.0)]) + beam(h, emission=0.030) + h.invoke('ion_gun.set', on=True, energy_ev=3000.0, raster_m=0.003) + err0 = abs(h.scale_true['offset_ev'] + h.scale_true['gain'] * 932.62) + op = h.invoke('calibration.energy_scale')['operation_id'] + self.assertEqual(wait(h, op), 'completed') + rec = h.records[h.operations[op]['record_id']] + self.assertEqual(len(rec['spectra']), 3) + self.assertEqual(h.read()['calibration.energy_scale']['calibration_id'], rec['record_id']) + # after calibration, clean Au / Cu peaks come at the ISO 15472 energies + h.invoke('analyser.configure', lens_mode='hybrid', aperture='slot', pass_energy_ev=10.0) + for ref, (lo, hi, want) in (('Au', (81.0, 87.0, 83.96)), ('Cu', (929.0, 936.0, 932.62)), ('Ag', (365.0, 371.0, 368.21))): + clean_reference(h, ref, 20.0) + rid = spectrum(h, [region(ref, lo, hi, 0.02, 0.1, 2)]) + got = h._peak_position(dict(counts=np.array(next(s for s in h.records[rid]['spectra'])['counts']), + be=next(s for s in h.records[rid]['spectra'])['binding_energy_ev'], step=0.02)) + self.assertLess(abs(got - want), 0.05, (ref, got, want, err0)) + + def test_chemical_states_and_oxide_thickness_of_sio2_on_si(self): + h = ready(seed=7) + provide(h, 'ox', 'si', layers=[('sio2', 4.0e-9)]) + on_stage(h, [('ox', 0.0)]) + beam(h, emission=0.040) + go_sample(h, 0.0) + h.invoke('analyser.configure', lens_mode='hybrid', aperture='slot', pass_energy_ev=20.0) + rid = spectrum(h, [region('Si 2p', 95.0, 108.0, 0.05, 0.1, 2)]) + be, y = arrays(h, rid, 'Si 2p') + fit = h.invoke('data.fit', record_id=rid, region='Si 2p', shift_ev=0.0, + components=[dict(label='Si0 2p3/2', be_ev=float(be[int(np.argmax(y))]), fwhm_ev=0.5, fix_position=False), + dict(label='Si0 2p1/2', be_ev=float(be[int(np.argmax(y))]) + 0.6, fwhm_ev=0.5, fix_position=False), + dict(label='SiO2', be_ev=float(be[int(np.argmax(y))]) + 4.0, fwhm_ev=1.4, fix_position=False)]) + c = {x['label']: x for x in fit['components']} + self.assertAlmostEqual(c['Si0 2p1/2']['be_ev'] - c['Si0 2p3/2']['be_ev'], 0.6, delta=0.12) # spin-orbit splitting (xraydb levels) + self.assertAlmostEqual(c['SiO2']['be_ev'] - c['Si0 2p3/2']['be_ev'], 103.4 - 99.31, delta=0.3) # NIST SRD 20 chemical shift + R = c['SiO2']['area_cps_ev'] / (c['Si0 2p3/2']['area_cps_ev'] + c['Si0 2p1/2']['area_cps_ev']) + lam = rt.imfp_nm(rt.substance('sio2'), rt.HV_EV - 103.4) + n_si_ox = rt.composition_atoms(rt.substance('sio2'))['Si'] + n_si = rt.composition_atoms(rt.substance('si'))['Si'] + d = lam * math.log(1 + R * n_si / n_si_ox) # standard overlayer formula (attenuation length ~ IMFP, normal emission) + self.assertAlmostEqual(d, 4.0, delta=1.2) + + def test_quantification_of_sputter_cleaned_oxides(self): + h = ready(seed=8) + provide(h, 'tio2', 'tio2', thick=1e-3) + on_stage(h, [('tio2', 0.0)]) + beam(h, emission=0.040) + go_sample(h, 0.0) + h.invoke('analyser.configure', lens_mode='hybrid', aperture='slot', pass_energy_ev=40.0) + regs = [region('Ti 2p', 450.0, 470.0, 0.1, 0.05, 1), region('O 1s', 524.0, 540.0, 0.1, 0.05, 1), region('C 1s', 280.0, 294.0, 0.1, 0.05, 1)] + rid0 = spectrum(h, regs) + q0 = {r['element']: r['atomic_percent'] for r in h.invoke('data.quantify', record_id=rid0, regions=['Ti 2p', 'O 1s', 'C 1s'], shift_ev=0.0)['results']} + self.assertGreater(q0['C'], 8.0) # adventitious carbon on the air-exposed surface + h.invoke('ion_gun.set', on=True, energy_ev=3000.0, raster_m=0.003) + wait(h, h.invoke('ion_gun.etch', duration_s=120.0)['operation_id']) + rid1 = spectrum(h, regs) + q1 = {r['element']: r['atomic_percent'] for r in h.invoke('data.quantify', record_id=rid1, regions=['Ti 2p', 'O 1s', 'C 1s'], shift_ev=0.0)['results']} + self.assertLess(q1['C'], 1.5) + self.assertAlmostEqual(q1['O'] / q1['Ti'], 2.0, delta=0.5) # theoretical sensitivity factors, some preferential oxygen loss + + def test_angle_resolved_surface_enhancement(self): + h = ready(seed=9) + provide(h, 'ox', 'si', layers=[('sio2', 2.0e-9)]) + on_stage(h, [('ox', 0.0)]) + beam(h, emission=0.040) + ratios = [] + for tilt in (0.0, math.radians(60.0)): + go_sample(h, 0.0, tilt=tilt) + rid = spectrum(h, [region('Si 2p', 95.0, 108.0, 0.1, 0.05, 1)]) + be, y = arrays(h, rid, 'Si 2p') + ox = y[(be > 102.5) & (be < 106.0)].sum() + bulk = y[(be > 98.0) & (be < 101.5)].sum() + ratios.append(ox / bulk) + self.assertGreater(ratios[1], 1.8 * ratios[0]) + + def test_small_spots_scale_with_area_and_snapshot_window(self): + h = ready(seed=10) + provide(h, 'au', 'au') + on_stage(h, [('au', 0.0)]) + beam(h, emission=0.005) # 75 W: far below the DLD saturation + go_sample(h, 0.0) + tops = {} + for ap in ('slot', 'd110', 'd27'): + h.invoke('analyser.configure', lens_mode='hybrid', aperture=ap, pass_energy_ev=10.0) + tops[ap] = float(h._spectrum_model(np.arange(82.0, 86.0, 0.05), 0.05).max()) + area = {'slot': 700e-6 * 300e-6, 'd110': math.pi * 55e-6 ** 2, 'd27': math.pi * 13.5e-6 ** 2} + self.assertAlmostEqual(tops['d110'] / tops['slot'], area['d110'] / area['slot'], delta=0.25 * area['d110'] / area['slot']) + self.assertLess(tops['d27'], tops['d110']) + h.invoke('analyser.configure', lens_mode='hybrid', aperture='slot', pass_energy_ev=40.0) + rejected(h, 'acquisition.spectrum', 'REGION_EXCEEDS_SNAPSHOT_WINDOW', regions=[region('Au', 78.0, 90.0)], mode='snapshot') + rid = spectrum(h, [dict(name='Au snap', start_be_ev=81.0, end_be_ev=87.0, step_ev=0.1, dwell_s=1.0, sweeps=1)], mode='snapshot') + be, y = arrays(h, rid, 'Au snap') + self.assertAlmostEqual(be[1] - be[0], 0.18 * 40.0 / 128, places=9) + self.assertLess(abs(be[int(np.argmax(y))] - 84.0), 0.6) + + +class DepthProfile(unittest.TestCase): + def test_ta2o5_on_ta_profile_reduction_and_argon(self): + h = ready(seed=11) + provide(h, 'bcr', 'ta', layers=[('ta2o5', 30.0e-9)]) + on_stage(h, [('bcr', 0.0)]) + beam(h, emission=0.040) + go_sample(h, 0.0) + h.invoke('analyser.configure', lens_mode='hybrid', aperture='slot', pass_energy_ev=80.0) + h.invoke('ion_gun.set', on=True, energy_ev=4000.0, raster_m=0.003) + regs = [region('Ta 4f', 18.0, 34.0, 0.2, 0.02, 1), region('O 1s', 524.0, 540.0, 0.2, 0.02, 1)] # (Ar 2p overlaps Ta 4d3/2) + op = h.invoke('depth_profile.start', levels=14, etch_s=90.0, regions=regs)['operation_id'] + self.assertEqual(wait(h, op), 'completed') + rid = h.operations[op]['record_id'] + tab = h.invoke('data.depth_profile', record_id=rid, shift_ev=0.0) + els = tab['elements'] + o = np.array([row[els.index('O')] for row in tab['atomic_percent']]) + self.assertGreater(o[1], 50.0) # the oxide (Ta2O5: 71 at% O, with preferential O loss and sensitivity factors) + self.assertLess(o[-1], 10.0) # the metal below + cr = h.samples['bcr']['craters'][0] + j = rt.ion_current_a(4000.0) / rt.E_CHARGE / 0.003 ** 2 + rate = rt.sputter_yield(rt.substance('ta2o5'), 4000.0) * j / rt.atoms_per_m3(rt.substance('ta2o5')) + t_half = tab['etch_time_s'][int(np.argmax(o < 0.5 * o[1]))] + self.assertAlmostEqual(t_half, 30.0e-9 / rate, delta=0.35 * 30.0e-9 / rate) + self.assertGreater(cr['reduction'], 0.1) + self.assertGreater(cr['implant'], 0.005) + led = h.ledger() + self.assertLess(abs(led['sputter_residual_atoms']), 1e-6 * led['sputtered_atoms']) + self.assertGreater(led['argon_implanted_mol'], 0.0) + self.assertLess(abs(led['argon_residual_mol']), 1e-9 * max(led['argon_admitted_mol'], 1e-12) + 1e-18) + + +class Imaging(unittest.TestCase): + def test_copper_grid_image_pitch_and_resolution(self): + h = ready(seed=12) + provide(h, 'grid', 'si', pattern=dict(kind='grid', feature_substance_id='cu', feature_thickness_m=50e-9, pitch_m=50e-6, width_m=12e-6, coverage=None)) + on_stage(h, [('grid', 0.0)]) + beam(h, emission=0.040) + go_sample(h, 0.0) + op = h.invoke('acquisition.image', be_ev=932.6, fov='fov400', pass_energy_ev=160.0, duration_s=120.0)['operation_id'] + self.assertEqual(wait(h, op), 'completed') + img = np.array(h.records[h.operations[op]['record_id']]['image']['counts'], float) + prof = img[40:88, :].mean(0) + f = np.abs(np.fft.rfft(prof - prof.mean())) + k = int(np.argmax(f[2:])) + 2 + pitch = 400e-6 / k + self.assertAlmostEqual(pitch, 50e-6, delta=3e-6) + self.assertGreater(img.max(), 5.0) + op = h.invoke('acquisition.image', be_ev=932.6, fov='fov80', pass_energy_ev=160.0, duration_s=60.0)['operation_id'] + wait(h, op) + im = h.records[h.operations[op]['record_id']]['image'] + self.assertAlmostEqual(im['resolution_m'], 1.25e-6, delta=0.3e-6) + + +class LedgersIsolationSessions(unittest.TestCase): + def test_ledgers_close(self): + h = ready(seed=13) + provide(h, 'pet', 'pet', thick=1.0e-4) + on_stage(h, [('pet', 0.0)]) + beam(h) + go_sample(h, 0.0) + h.invoke('neutraliser.set', on=True, filament_current_a=0.4, charge_balance_v=3.3, filament_bias_v=1.0) + h.step(30.0) + h.invoke('ion_gun.set', on=True, energy_ev=1000.0, raster_m=0.004) + wait(h, h.invoke('ion_gun.etch', duration_s=30.0)['operation_id']) + h.invoke('ion_gun.set', on=False, energy_ev=1000.0, raster_m=0.004) + h.invoke('flexilock.vent') + h.step(200.0) + led = h.ledger() + self.assertGreater(led['charge_neutraliser_c'], 0.0) + self.assertLess(abs(led['charge_residual_c']), 1e-6 * led['charge_photoemitted_c']) + self.assertLess(abs(led['nitrogen_residual_mol']), 1e-9 * led['nitrogen_admitted_mol']) + self.assertLess(abs(led['argon_residual_mol']), 1e-9 * led['argon_admitted_mol']) + self.assertLess(abs(led['sputter_residual_atoms']), 1e-6 * led['sputtered_atoms']) + self.assertGreater(led['anode_energy_j'], 0.0) + + def test_two_instances_are_isolated(self): + a, b = ready(seed=1), ready(seed=2) + provide(a, 'x', 'au') + self.assertIn('x', a.samples) + self.assertNotIn('x', b.samples) + self.assertNotEqual(a.scale_true, b.scale_true) + + def test_agent_does_not_see_truth_or_faults(self): + h = ready() + h.register_principal('a', 'agent') + h.register_principal('e', 'evaluator') + s, e = h.session('a'), h.session('e') + obs = s.read(instance_id=h.instance_id)['observations'] + self.assertFalse(any(k.startswith('truth.') for k in obs)) + with self.assertRaises(rt.ActionRejected): + s.read(instance_id=h.instance_id, state_ids=['truth.scale_error']) + r = s.invoke(instance_id=h.instance_id, capability_id='fault.inject', arguments=dict(fault='chiller_failure', active=True), request_id='f1') + self.assertEqual(r['error']['code'], 'ACCESS_DENIED') + e.invoke(instance_id=h.instance_id, capability_id='fault.inject', arguments=dict(fault='chiller_failure', active=True), request_id='f2') + ev = s.invoke(instance_id=h.instance_id, capability_id='events.read', arguments=dict(since_s=0.0), request_id='e1')['result']['events'] + self.assertFalse(any(x['kind'] == 'fault' for x in ev)) + desc = s.describe(instance_id=h.instance_id) + self.assertNotIn('truth.samples', desc['state_slots']) + self.assertNotIn('ledger.read', desc['capabilities']) + + def test_records_and_control_belong_to_their_agent(self): + h = ready() + provide(h, 'au', 'au') + on_stage(h, [('au', 0.0)]) + beam(h) + go_sample(h, 0.0) + h.register_principal('a', 'agent') + h.register_principal('b', 'agent') + sa, sb = h.session('a'), h.session('b') + r = sa.invoke(instance_id=h.instance_id, capability_id='acquisition.spectrum', arguments=dict(regions=[region('Au', 80.0, 90.0, 0.1, 0.05, 1)], + mode='scanned'), request_id='s1') + self.assertEqual(r['status'], 'accepted') + rb = sb.invoke(instance_id=h.instance_id, capability_id='stage.move', arguments=dict(x_m=0.0, y_m=0.0, z_m=0.0, tilt_rad=0.0, rotation_rad=0.0), + request_id='m1') + self.assertEqual(rb['error']['code'], 'ACCESS_DENIED') + self.assertTrue(sb.read(instance_id=h.instance_id)['observations']['acquisition.started_by_other_agent']['value']) + wait(h, r['operation_id']) + rid = h.operations[r['operation_id']]['record_id'] + rb = sb.invoke(instance_id=h.instance_id, capability_id='acquisition.result', arguments=dict(record_id=rid), request_id='r1') + self.assertEqual(rb['error']['code'], 'ACCESS_DENIED') + self.assertEqual(sa.read(instance_id=h.instance_id)['observations']['result.last_record_id']['value'], rid) + again = sa.invoke(instance_id=h.instance_id, capability_id='acquisition.spectrum', arguments=dict(regions=[region('Au', 80.0, 90.0, 0.1, 0.05, 1)], + mode='scanned'), request_id='s1') + self.assertEqual(again['operation_id'], r['operation_id']) + conflict = sa.invoke(instance_id=h.instance_id, capability_id='acquisition.spectrum', arguments=dict(regions=[region('Au', 80.0, 91.0, 0.1, 0.05, 1)], + mode='scanned'), request_id='s1') + self.assertEqual(conflict['error']['code'], 'REQUEST_CONFLICT') + + def test_cancel_keeps_finished_regions_and_power_off_fails(self): + h = ready() + provide(h, 'au', 'au') + on_stage(h, [('au', 0.0)]) + beam(h) + go_sample(h, 0.0) + h.register_principal('a', 'agent') + s = h.session('a') + r = s.invoke(instance_id=h.instance_id, capability_id='acquisition.spectrum', + arguments=dict(regions=[region('Au', 80.0, 90.0, 0.1, 0.05, 1), region('C', 280.0, 292.0, 0.1, 0.5, 2)], mode='scanned'), request_id='s1') + h.step(30.0) + s.cancel(r['operation_id'], 'c1') + rec = h.records[h.operations[r['operation_id']]['record_id']] + self.assertEqual(rec['status'], 'cancelled') + self.assertEqual([x['name'] for x in rec['spectra']], ['Au']) + op = h.invoke('acquisition.spectrum', regions=[region('Au', 80.0, 90.0, 0.1, 0.5, 2)], mode='scanned')['operation_id'] + h.step(10.0) + h.invoke('power.set', enabled=False) + self.assertEqual(h.operations[op]['phase'], 'failed') + self.assertEqual(h.records[h.operations[op]['record_id']]['reason'], 'POWER_OFF') + + def test_queries_and_bookkeeping(self): + h = ready() + provide(h, 'au', 'au') + on_stage(h, [('au', 0.0)]) + beam(h) + go_sample(h, 0.0) + rid = spectrum(h, [region('survey', 0.0, 1200.0, 1.0, 0.02, 1)]) + ids = h.invoke('data.identify', record_id=rid, region='survey', shift_ev=0.0) + self.assertIn('Au', ids['elements']) + self.assertIn('C', ids['elements']) + self.assertIn(rid, h.invoke('records.list')['records']) + self.assertEqual(h.invoke('acquisition.result', record_id=rid)['status'], 'completed') + rejected(h, 'data.quantify', 'UNKNOWN_REGION', record_id=rid, regions=['nope'], shift_ev=0.0) + rejected(h, 'acquisition.result', 'UNKNOWN_RECORD', record_id='SP9999') + prov = h.invoke('provenance.read') + self.assertIn('au', prov['substances']) + self.assertEqual(prov['library'], rt.LIBRARY_REL) + + + +class HoldersFaradayCupAndHostCalls(unittest.TestCase): + def test_holder_round_trip_faraday_cup_current_ledger_and_host_step(self): + h = ready(seed=3) + provide(h, 'au', 'au') + provide(h, 'cu', 'cu') + h.invoke('holder.mount_sample', holder_id='H1', sample_id='au', x_m=0.0, y_m=0.0) + h.invoke('holder.mount_sample', holder_id='H1', sample_id='cu', x_m=0.02, y_m=0.0) + out = h.invoke('holder.unmount_sample', holder_id='H1', sample_id='cu') + self.assertEqual(out['location'], 'bench') + self.assertIn('cu', h.read()['sample.bench_ids']) + self.assertNotIn('cu', h.holders['H1']['samples']) + on_stage(h, []) + h.invoke('ion_gun.set', on=True, energy_ev=2000.0, raster_m=0.004) + rejected(h, 'ion_gun.measure_current', 'NOT_ON_FARADAY_CUP') + h.invoke('stage.go_to', position='reference:faraday_cup') + h.step(60.0) + m = h.invoke('ion_gun.measure_current') + i_true = rt.ion_current_a(2000.0) + self.assertAlmostEqual(m['current_a'], i_true, delta=0.05 * i_true) + self.assertAlmostEqual(m['current_density_a_m2'], m['current_a'] / 0.004 ** 2, delta=1e-9 * m['current_density_a_m2']) + h.invoke('ion_gun.set', on=False, energy_ev=2000.0, raster_m=0.004) + wait(h, h.invoke('transfer.to_magazine', slot=1)['operation_id']) + self.assertEqual(h.magazine[1], 'H1') + h.invoke('flexilock.vent') + h.step(90.0) + h.invoke('flexilock.set_lid', open=True) + out = h.invoke('flexilock.unload_holder', slot=1) + self.assertEqual((out['holder_id'], h.holders['H1']['location'], h.magazine[1]), ('H1', 'bench', None)) + self.assertGreater(h.samples['au']['contamination_m'], 0.0) # back in laboratory air + led = h.invoke('ledger.read') + self.assertGreater(led['argon_admitted_mol'], 0.0) + self.assertLess(abs(led['argon_residual_mol']), 1e-9 * led['argon_admitted_mol']) + self.assertLess(abs(led['nitrogen_residual_mol']), 1e-9 * led['nitrogen_admitted_mol']) + t0 = h.time_s + self.assertAlmostEqual(h.invoke('sim.step', dt_s=2.5)['time_s'], t0 + 2.5, places=9) + self.assertAlmostEqual(h.time_s, t0 + 2.5, places=9) + + +def _chunks(T): + n = int(T / 0.37) + return [0.37] * n + [T - 0.37 * n] + + +class ReviewRound1Regressions(unittest.TestCase): + """Regression tests for the findings of the first independent runtime review (F01-F13).""" + + def test_f01_f02_gas_ledgers_close_through_transfers_with_argon_and_the_open_lid(self): + h = ready(seed=31) + provide(h, 'au', 'au') + on_stage(h, [('au', 0.0)]) + h.invoke('ion_gun.set', on=True, energy_ev=3000.0, raster_m=0.003) # argon in the analysis chamber + h.step(30.0) + wait(h, h.invoke('transfer.to_magazine', slot=1)['operation_id']) # the gate burst shares the chamber argon with the Flexi-lock + led = h.ledger() + self.assertLess(abs(led['argon_residual_mol']), 1e-9 * led['argon_admitted_mol']) + wait(h, h.invoke('transfer.to_stage', slot=1)['operation_id']) # a second burst with argon already in the Flexi-lock + wait(h, h.invoke('transfer.to_magazine', slot=1)['operation_id']) + h.invoke('ion_gun.set', on=False, energy_ev=3000.0, raster_m=0.003) + h.invoke('flexilock.vent') + h.step(90.0) + h.invoke('flexilock.set_lid', open=True) + h.step(5.0) # Flexi-lock nitrogen and argon escape into the laboratory + led = h.ledger() + self.assertGreater(led['nitrogen_released_mol'], 0.0) + self.assertLess(abs(led['nitrogen_residual_mol']), 1e-9 * led['nitrogen_admitted_mol']) + self.assertLess(abs(led['argon_residual_mol']), 1e-9 * led['argon_admitted_mol']) + + def test_f04_interrupted_transfer_keeps_the_gate_open_and_recovers(self): + h = ready(seed=32) + provide(h, 'au', 'au') + h.invoke('holder.mount_sample', holder_id='H1', sample_id='au', x_m=0.0, y_m=0.0) + h.invoke('flexilock.set_lid', open=True) + h.invoke('flexilock.load_holder', holder_id='H1', slot=1) + h.invoke('flexilock.set_lid', open=False) + h.invoke('flexilock.pump') + for _ in range(200): + h.step(10.0) + if h.fl_mode == 'pumped': + break + op = h.invoke('transfer.to_stage', slot=1)['operation_id'] + while h.transfer_op['phase'] != 'arm_out': + h.step(0.5) + h.step(3.0) + self.assertEqual(h.holders['H1']['location'], 'arm') + h.invoke('power.set', enabled=False) + h.step(10.0) + self.assertGreater(h.gate, 0.08) # the extended fork blocks the gate valve + self.assertGreater(h.arm, 0.0) + self.assertEqual(h.operations[op]['phase'], 'failed') + h.invoke('power.set', enabled=True) + h.step(rt.BOOT_S + 1.0) + self.assertEqual(h.error, 'TRANSFER_INTERRUPTED') + rejected(h, 'system.acknowledge', 'CAUSE_PERSISTS') + rejected(h, 'flexilock.vent', 'ERROR_PENDING') + rejected(h, 'transfer.to_stage', 'ERROR_PENDING', slot=2) + rop = h.invoke('transfer.recover')['operation_id'] + self.assertEqual(wait(h, rop), 'completed') + self.assertEqual((h.stage_holder, h.holders['H1']['location'], h.error, h.gate, h.arm), ('H1', 'stage', None, 0.0, 0.0)) + rejected(h, 'transfer.recover', 'NO_INTERRUPTED_TRANSFER') + + def test_f05_snapshot_count_rates_do_not_depend_on_dwell(self): + h = ready(seed=33) + provide(h, 'au', 'au') + on_stage(h, [('au', 0.0)]) + beam(h, emission=0.005) + go_sample(h, 0.0) + h.invoke('analyser.configure', lens_mode='hybrid', aperture='slot', pass_energy_ev=40.0) + means = [] + for dwell in (0.01, 5.0): + rid = spectrum(h, [dict(name='Au', start_be_ev=81.0, end_be_ev=87.0, step_ev=0.1, dwell_s=dwell, sweeps=1)], mode='snapshot') + be, y = arrays(h, rid, 'Au') + means.append(float(y.mean())) + self.assertAlmostEqual(means[0] / means[1], 1.0, delta=0.1) + + def test_f06_f07_host_chopping_while_moving_and_during_charging_transients(self): + def run(chunks): + h = ready(seed=34) + h.rng = QuietRng() + h.rng_acq = QuietRng() + provide(h, 'p1', 'pet', thick=1e-4) + provide(h, 'p2', 'al2o3', thick=1e-4) # sapphire: a second insulator that does not outgas + on_stage(h, [('p1', -0.02), ('p2', 0.02)]) + beam(h, emission=0.040) + h.invoke('stage.move', x_m=0.02, y_m=0.0, z_m=-1e-4, tilt_rad=0.0, rotation_rad=0.0) + for dt in chunks(30.0): + h.step(dt) + h.invoke('stage.move', x_m=-0.02, y_m=0.0, z_m=-1e-4, tilt_rad=0.0, rotation_rad=0.0) # the beam leaves p1 and reaches p2 while moving + for dt in chunks(30.0): + h.step(dt) + h.invoke('neutraliser.set', on=True, filament_current_a=0.4, charge_balance_v=3.3, filament_bias_v=1.0) + h.invoke('acquisition.spectrum', regions=[region('C 1s', 280.0, 300.0, 0.05, 0.02, 1)], mode='scanned') + for dt in chunks(4.0): + h.step(dt) + h.invoke('neutraliser.set', on=False, filament_current_a=0.4, charge_balance_v=3.3, filament_bias_v=1.0) # transient during the scan + for dt in chunks(30.0): + h.step(dt) + return {s_: h.v_surface[s_] for s_ in ('p1', 'p2')}, h.records['SP0001'], h.ledger() + (va, ra, la), (vb, rb, lb) = run(lambda T: [T]), run(_chunks) + for k in va: + self.assertAlmostEqual(va[k], vb[k], delta=1e-9 * max(1.0, abs(va[k])), msg=k) + self.assertEqual(ra['status'], 'completed') + ya, yb = np.array(ra['spectra'][0]['counts']), np.array(rb['spectra'][0]['counts']) + self.assertLess(float(np.max(np.abs(ya - yb))), 1e-6 * float(ya.max()) + 1.0) + self.assertAlmostEqual(la['photons_on_sample'], lb['photons_on_sample'], delta=1e-9 * la['photons_on_sample']) + self.assertAlmostEqual(la['charge_photoemitted_c'], lb['charge_photoemitted_c'], delta=1e-9 * la['charge_photoemitted_c']) + + def test_f08_flexilock_state_changes_at_exact_crossings(self): + def run(chunks): + h = ready(seed=35) + provide(h, 'au', 'au') + h.invoke('holder.mount_sample', holder_id='H1', sample_id='au', x_m=0.0, y_m=0.0) + h.invoke('flexilock.set_lid', open=True) + h.invoke('flexilock.load_holder', holder_id='H1', slot=1) + h.invoke('flexilock.set_lid', open=False) + h.invoke('flexilock.pump') + for dt in chunks(400.0): + h.step(dt) + h.invoke('flexilock.vent') + for dt in chunks(60.0): + h.step(dt) + return {e['code']: e['time_s'] for e in h.events if e['code'] in ('FL_PUMPED', 'FL_VENTED')}, h + (a, ha), (b, hb) = run(lambda T: [T]), run(_chunks) + self.assertEqual(set(a), {'FL_PUMPED', 'FL_VENTED'}) + for k in a: + self.assertAlmostEqual(a[k], b[k], delta=1e-6, msg=k) + t_vent0 = next(e['time_s'] for e in ha.events if e['code'] == 'FL_VENTING') + self.assertAlmostEqual(a['FL_VENTED'] - t_vent0, rt.VENT_TAU_S * math.log(1.0 / 0.02), delta=1e-3) # from vacuum to 98 % of atmosphere + + def test_f10_combination_holder_limits_the_sample_thickness(self): + h = configured() + provide(h, 'thick', 'au', thick=0.010) + rejected(h, 'holder.mount_sample', 'SAMPLE_TOO_THICK', holder_id='H3', sample_id='thick', x_m=0.0, y_m=0.0) + h.invoke('holder.mount_sample', holder_id='H1', sample_id='thick', x_m=0.0, y_m=0.0) + self.assertEqual((h.read()['holders']['H3']['type'], h.read()['holders']['H1']['type']), ('combination', 'dual_height')) + + def test_f12_spin_orbit_splittings_follow_photoemission_records(self): + """Doublet partners follow paired NIST SRD 20 records (element default and per chemical state), not X-ray absorption-edge differences.""" + lib = json.loads(Path(rt.LIBRARY_PATH).read_text()) + so = {el: next(iter(e['spin_orbit'].values())) for el, e in lib['elements'].items() if e.get('spin_orbit')} + self.assertAlmostEqual(so['Ag']['splitting_ev'], 6.0, delta=0.05) + self.assertAlmostEqual(so['Cl']['splitting_ev'], 1.6, delta=0.05) # the L2-L3 edge difference is 2.0 eV + nio = next(c for c in next(x for x in lib['substances'] if x['substance_id'] == 'nio')['components'] if c['element'] == 'Ni') + self.assertGreater(nio['doublet']['splitting_ev'], so['Ni']['splitting_ev'] + 0.5) # NiO 2p splitting exceeds the metal's + h = ready(seed=36) + provide(h, 'dummy', 'au') + on_stage(h, [('dummy', 0.0)]) + beam(h, emission=0.040) + clean_reference(h, 'Ag') + h.invoke('analyser.configure', lens_mode='hybrid', aperture='slot', pass_energy_ev=10.0) + rid = spectrum(h, [region('Ag 3d', 364.0, 378.0, 0.02, 0.1, 1)]) + fit = h.invoke('data.fit', record_id=rid, region='Ag 3d', shift_ev=0.0, components=[ + dict(label='3d5/2', be_ev=368.2, fwhm_ev=0.5, fix_position=False), dict(label='3d3/2', be_ev=374.2, fwhm_ev=0.5, fix_position=False)]) + c = {x['label']: x for x in fit['components']} + self.assertAlmostEqual(c['3d3/2']['be_ev'] - c['3d5/2']['be_ev'], 6.0, delta=0.06) + self.assertAlmostEqual(c['3d3/2']['area_cps_ev'] / c['3d5/2']['area_cps_ev'], 2.0 / 3.0, delta=0.08) + + def test_f09_f11_texts_quote_the_implemented_numbers_and_label_related_model_data(self): + texts = [] + + def walk(o): + if isinstance(o, str): + texts.append(o) + elif isinstance(o, dict): + for v in o.values(): + walk(v) + elif isinstance(o, list): + for v in o: + walk(v) + walk(_meta()) + joined = '\n'.join(texts) + for stale in ('0.20 eV', '≈0.0085×通能(slot', '向后欧拉', 'backward Euler', '能散0.15 eV', '混合长度1 nm', '释放注入的氩'): + self.assertNotIn(stale, joined) + related = ('0.48 eV', '0.68 eV', '760 kcps', '44 kcps', '精度2 µm', '2 µm精度', '误差2 µm') + bad = [t_ for t_ in texts if any(r in t_ for r in related) and '相关型号' not in t_] + self.assertEqual(bad, []) + + +def _stranded(seed, cancel=False): + """A to_stage transfer interrupted with the holder on the extended fork (power loss, or a user cancel).""" + h = ready(seed=seed) + provide(h, 'au', 'au') + h.invoke('holder.mount_sample', holder_id='H1', sample_id='au', x_m=0.0, y_m=0.0) + h.invoke('flexilock.set_lid', open=True) + h.invoke('flexilock.load_holder', holder_id='H1', slot=1) + h.invoke('flexilock.load_holder', holder_id='H2', slot=2) + h.invoke('flexilock.set_lid', open=False) + h.invoke('flexilock.pump') + for _ in range(200): + h.step(10.0) + if h.fl_mode == 'pumped': + break + h.register_principal('op', 'agent') + r = h.session('op').invoke(instance_id=h.instance_id, capability_id='transfer.to_stage', arguments=dict(slot=1), request_id='t1') + while h.transfer_op['phase'] != 'arm_out': + h.step(0.5) + h.step(3.0) + if cancel: + h.session('op').cancel(r['operation_id'], 'c1') + else: + h.invoke('power.set', enabled=False) + h.invoke('power.set', enabled=True) + h.step(rt.BOOT_S + 1.0) + assert h.holders['H1']['location'] == 'arm' and h.transfer_stranded is not None + return h + + +class ReviewRound2Regressions(unittest.TestCase): + """Regression tests for the findings of the second independent runtime review (F08 remainder, F14-F16).""" + + def test_f14_the_stranded_fork_survives_other_errors(self): + h = _stranded(41, cancel=True) + self.assertEqual(h.error, 'TRANSFER_INTERRUPTED') + h.error = 'COOLING_WATER_LOW' # a later latched error (cause already gone) takes the slot + self.assertEqual(h.invoke('system.acknowledge')['cleared'], 'COOLING_WATER_LOW') + self.assertEqual(h.error, 'TRANSFER_INTERRUPTED') # re-latched while the fork is stranded + h.error = None # even with the slot cleared by hand the refusals stay + rejected(h, 'transfer.to_stage', 'TRANSFER_INTERRUPTED', slot=2) + rejected(h, 'flexilock.vent', 'TRANSFER_INTERRUPTED') + rejected(h, 'flexilock.pump', 'TRANSFER_INTERRUPTED') + rejected(h, 'stage.move', 'TRANSFER_INTERRUPTED', x_m=0.01, y_m=0.0, z_m=0.0, tilt_rad=0.0, rotation_rad=0.0) + self.assertEqual(wait(h, h.invoke('transfer.recover')['operation_id']), 'completed') + self.assertEqual((h.stage_holder, h.holders['H1']['location'], h.gate, h.transfer_stranded), ('H1', 'stage', 0.0, None)) + + def test_f14_mains_fault_while_stranded(self): + h = _stranded(42) + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, mains_voltage_v=170.0)) + self.assertEqual(h.error, 'MAINS_FAULT') + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE)) + h.invoke('power.set', enabled=True) + self.assertEqual(h.error, 'TRANSFER_INTERRUPTED') + h.step(rt.BOOT_S + 1.0) + rejected(h, 'transfer.to_stage', 'ERROR_PENDING', slot=2) + self.assertEqual(wait(h, h.invoke('transfer.recover')['operation_id']), 'completed') + self.assertEqual((h.stage_holder, h.error), ('H1', None)) + + def test_f15_transfer_timeline_does_not_depend_on_host_chopping(self): + def run(chunks): + h = ready(seed=43) + provide(h, 'au', 'au') + h.invoke('holder.mount_sample', holder_id='H1', sample_id='au', x_m=0.0, y_m=0.0) + h.invoke('flexilock.set_lid', open=True) + h.invoke('flexilock.load_holder', holder_id='H1', slot=1) + h.invoke('flexilock.set_lid', open=False) + h.invoke('flexilock.pump') + for dt in chunks(600.0): + h.step(dt) + op = h.invoke('transfer.to_stage', slot=1)['operation_id'] + for dt in chunks(40.0): + h.step(dt) + return h.operations[op]['finished_s'], [(e['code'], e['time_s']) for e in h.events if e['kind'] in ('transfer', 'flexilock')] + (fa, ea), (fb, eb) = run(lambda T: [T]), run(_chunks) + self.assertAlmostEqual(fa, fb, delta=1e-6) + self.assertEqual([c for c, _ in ea], [c for c, _ in eb]) + for (c, ta), (_, tb) in zip(ea, eb): + self.assertAlmostEqual(ta, tb, delta=1e-6, msg=c) + + def test_f16_neutraliser_only_charging_while_moving_does_not_depend_on_host_chopping(self): + def run(chunks): + h = ready(seed=44) + provide(h, 'p1', 'pet', thick=1e-4) + provide(h, 'p2', 'al2o3', thick=1e-4) + on_stage(h, [('p1', -0.02), ('p2', 0.02)]) + h.invoke('neutraliser.set', on=True, filament_current_a=0.4, charge_balance_v=3.3, filament_bias_v=1.0) # X-ray off + h.invoke('stage.move', x_m=0.02, y_m=0.0, z_m=-1e-4, tilt_rad=0.0, rotation_rad=0.0) + for dt in chunks(15.0): + h.step(dt) + h.invoke('stage.move', x_m=-0.02, y_m=0.0, z_m=-1e-4, tilt_rad=0.0, rotation_rad=0.0) + for dt in chunks(30.0): + h.step(dt) + return {s_: h.v_surface[s_] for s_ in ('p1', 'p2')}, h.ledger()['charge_neutraliser_c'] + (va, qa), (vb, qb) = run(lambda T: [T]), run(_chunks) + for k in va: + self.assertAlmostEqual(va[k], vb[k], delta=1e-9 * max(1.0, abs(va[k])), msg=k) + self.assertAlmostEqual(qa, qb, delta=1e-9 * qa) + + def test_f08_empty_magazine_pump_down_crossings(self): + def run(chunks): + h = ready(seed=8) + h.invoke('flexilock.pump') + for dt in chunks(100.0): + h.step(dt) + h.invoke('flexilock.vent') + for dt in chunks(100.0): + h.step(dt) + return {e['code']: e['time_s'] for e in h.events if e['code'] in ('FL_PUMPED', 'FL_VENTED')} + a, b = run(lambda T: [T]), run(_chunks) + self.assertEqual(set(a), {'FL_PUMPED', 'FL_VENTED'}) + for k in a: + self.assertAlmostEqual(a[k], b[k], delta=1e-6, msg=k) + +# ---------------------------------------------------------------- declared effects (scenario states for the effect discovery) +RNGS = ['rng', 'rng_acq', 'rng_mount', 'rng_cal', 'rng_sample'] +_SC = {} + + +def _bench(h): + """Samples on the bench: SiO2/Si, Ta2O5/Ta, PET (insulator) and a gold foil; SiO2/Si, Ta2O5/Ta and PET on holder H1.""" + provide(h, 'sio2', 'si', [('sio2', 4.0e-9)], thick=5.25e-4) + provide(h, 'ta', 'ta', [('ta2o5', 30.0e-9)], thick=5.0e-4) + provide(h, 'pet', 'pet', thick=1.0e-4) + provide(h, 'au', 'au', form='foil', thick=1.0e-4) + for sid, x in (('sio2', -0.025), ('ta', 0.0), ('pet', 0.025)): + h.invoke('holder.mount_sample', holder_id='H1', sample_id=sid, x_m=x, y_m=0.0) + return h + + +def _pumped(h, tmax=3000.0): + for _ in range(int(tmax / 10.0)): + h.step(10.0) + if h.fl_mode == 'pumped': + return h + raise AssertionError(h.p_fl) + + +def _build(name): + if name == 'fresh': + return rt.KratosAxissupraRuntime() + if name == 'off': + return _bench(configured()) + if name == 'booting': + h = _scenario('off') + h.invoke('power.set', enabled=True) + h.step(10.0) + return h + if name == 'ready': + h = _scenario('off') + h.invoke('power.set', enabled=True) + h.step(rt.BOOT_S + 1.0) + return h + if name == 'lid_open': + h = _scenario('ready') + h.invoke('flexilock.set_lid', open=True) + h.invoke('flexilock.load_holder', holder_id='H2', slot=2) + return h + if name == 'vented_loaded': + h = _scenario('lid_open') + h.invoke('flexilock.load_holder', holder_id='H1', slot=1) + h.invoke('flexilock.set_lid', open=False) + return h + if name == 'fl_pumping': + h = _scenario('vented_loaded') + h.invoke('flexilock.pump') + h.step(30.0) + return h + if name == 'fl_pumped': + h = _scenario('vented_loaded') + h.invoke('flexilock.pump') + return _pumped(h) + if name == 'fl_venting': + h = _scenario('fl_pumped') + h.invoke('flexilock.vent') + h.step(5.0) + return h + if name == 'fl_leak': + h = _scenario('fl_pumped') + h.invoke('fault.inject', fault='flexilock_leak', active=True) + h.step(20.0) + return h + if name == 'transferring': + h = _scenario('fl_pumped') + h.invoke('transfer.to_stage', slot=1) + h.step(8.0) + return h + if name == 'on_stage': + h = _scenario('fl_pumped') + wait(h, h.invoke('transfer.to_stage', slot=1)['operation_id']) + return h + if name == 'to_magazine': + h = _scenario('on_stage') + h.invoke('transfer.to_magazine', slot=1) + h.step(8.0) + return h + if name == 'arm_stranded': + h = _scenario('fl_pumped') + op = h.invoke('transfer.to_stage', slot=1)['operation_id'] + while h.transfer_op is not None and h.transfer_op['phase'] != 'arm_out': + h.step(0.5) + h.step(1.0) + h.invoke('power.set', enabled=False) + h.invoke('power.set', enabled=True) + h.step(rt.BOOT_S + 1.0) + assert h.operations[op]['phase'] == 'failed' + return h + if name == 'arm_stranded_outage': # contract review r2: a 10 s outage lets both chambers drift before the fork is recovered + h = _scenario('fl_pumped') + op = h.invoke('transfer.to_stage', slot=1)['operation_id'] + while h.transfer_op is not None and h.transfer_op['phase'] != 'arm_out': + h.step(0.5) + h.step(3.0) + h.invoke('power.set', enabled=False) + h.step(10.0) + h.invoke('power.set', enabled=True) + h.step(rt.BOOT_S + 1.0) + assert h.operations[op]['phase'] == 'failed' and h.transfer_stranded is not None + return h + if name == 'unpowered_on_stage': + h = _scenario('on_stage') + h.invoke('power.set', enabled=False) + return h + if name == 'xray_ramping': + h = _scenario('on_stage') + h.invoke('xray.set_source', on=True, emission_a=0.015) + h.step(2.0) + return h + if name == 'beam': + h = beam(_scenario('on_stage')) + return go_sample(h, -0.025) + if name == 'beam_ion': + h = _scenario('beam') + h.step(3000.0) # PET outgassing decays first: argon on top of it would trip the X-ray vacuum interlock (1e-5 Pa) + h.invoke('ion_gun.set', on=True, energy_ev=3000.0, raster_m=0.003) + return h + if name == 'faraday': + h = _scenario('beam_ion') + h.invoke('stage.go_to', position='reference:faraday_cup') + h.step(60.0) + return h + if name == 'stage_moving': + h = _scenario('beam') + h.invoke('stage.move', x_m=0.0, y_m=0.0, z_m=-5.0e-4, tilt_rad=0.3, rotation_rad=0.2) + h.step(1.0) + return h + if name == 'acquiring': + h = _scenario('beam') + h.invoke('acquisition.spectrum', regions=[region('Si 2p', 96.0, 108.0, 0.1, 0.1, 1), region('O 1s', 526.0, 538.0, 0.1, 0.1, 1)], mode='scanned') + h.step(3.0) + return h + if name == 'snapshot': + h = _scenario('beam') + h.invoke('acquisition.spectrum', regions=[region('Si 2p', 98.0, 101.0, 0.05, 2.0, 3)], mode='snapshot') + h.step(1.5) + return h + if name == 'imaging': + h = _scenario('beam') + h.invoke('acquisition.image', be_ev=103.3, fov='fov400', pass_energy_ev=160.0, duration_s=60.0) + h.step(5.0) + return h + if name == 'auto_height': + h = _scenario('beam') + h.invoke('stage.auto_height') + h.step(2.0) + return h + if name == 'etching': + h = _scenario('beam_ion') + h.invoke('ion_gun.etch', duration_s=60.0) + h.step(5.0) + return h + if name == 'depth_profiling': + h = _scenario('beam_ion') + go_sample(h, 0.0) + h.invoke('depth_profile.start', levels=3, etch_s=20.0, regions=[region('Ta 4f', 20.0, 34.0, 0.2, 0.05, 1), region('O 1s', 526.0, 538.0, 0.2, 0.05, 1)]) + h.step(5.0) + return h + if name == 'depth_profiling_etch': # contract review r2: an etch stage of the depth profile (beam on) + h = _scenario('depth_profiling') + while not h.etching: + h.step(1.0) + h.step(2.0) + assert h.etching and h.acq['kind'] == 'depth_profile' + return h + if name == 'calibrating_etch': # contract review r2: the sputter clean of a reference sample during the calibration (beam on) + h = _scenario('calibrating') + while not h.etching: + h.step(1.0) + h.step(2.0) + assert h.etching and h.acq['kind'] == 'calibration' + return h + if name == 'calibrating': + h = _scenario('beam_ion') + h.invoke('calibration.energy_scale') + h.step(5.0) + return h + if name == 'calibrating_d110': + h = _scenario('beam_ion') + h.invoke('analyser.configure', lens_mode='hybrid', aperture='d110', pass_energy_ev=40.0) + h.invoke('calibration.energy_scale') + h.step(5.0) + return h + if name == 'beam_ion_d110': + h = _scenario('beam_ion') + h.invoke('analyser.configure', lens_mode='hybrid', aperture='d110', pass_energy_ev=40.0) + return h + if name == 'fl_pumped_stage_away': + h = _scenario('fl_pumped') + h.invoke('stage.move', x_m=0.020, y_m=0.005, z_m=-1.0e-3, tilt_rad=0.2, rotation_rad=0.3) + h.step(60.0) + return h + if name == 'xray_tripped': + h = _scenario('beam') + h.invoke('ion_gun.set', on=True, energy_ev=3000.0, raster_m=0.003) + h.step(5.0) + h.invoke('ion_gun.set', on=False, energy_ev=3000.0, raster_m=0.003) + h.step(30.0) + assert h.xray_fault == 'VACUUM_INTERLOCK' and not h.xray_on and h.p_sac < rt.XRAY_MAX_PA + return h + if name == 'fl_nearly_vented': + h = _scenario('fl_pumped') + h.invoke('flexilock.vent') + h.step(40.0) + assert h.fl_mode == 'venting' and h.p_fl >= rt.LID_OPEN_MIN_PA + return h + if name == 'charging': + h = _scenario('beam') + go_sample(h, 0.025) + return h + if name == 'neutralised': + h = _scenario('charging') + h.invoke('neutraliser.set', on=True, filament_current_a=0.4, charge_balance_v=3.3, filament_bias_v=1.0) + h.step(30.0) + return h + if name == 'chiller_fault': + h = _scenario('beam') + h.invoke('fault.inject', fault='chiller_failure', active=True) + h.step(2.0) + return h + if name == 'chiller_fault_cleared': + h = _scenario('chiller_fault') + h.invoke('fault.inject', fault='chiller_failure', active=False) + h.step(2.0) + return h + if name == 'sac_leak': + h = _scenario('beam') + h.invoke('fault.inject', fault='sac_leak', active=True) + h.step(30.0) + return h + if name == 'mains_fault': + h = _scenario('beam') + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, mains_voltage_v=170.0)) # outside AC 200 V +-10 %: the system drops out + assert h.error == 'MAINS_FAULT' and not h.power + return h + if name == 'mains_restored': + h = _scenario('mains_fault') + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE)) + return h + if name == 'faults_measuring': + h = _scenario('neutralised') + h.invoke('acquisition.spectrum', regions=[region('C 1s', 280.0, 296.0, 0.1, 0.1, 1)], mode='scanned') + for f in ('neutraliser_filament_failure', 'flexilock_leak'): + h.invoke('fault.inject', fault=f, active=True) + h.step(5.0) + assert h.acq is not None + return h + if name == 'measured': + h = _scenario('beam') + spectrum(h, [region('Si 2p', 96.0, 108.0, 0.2, 0.05, 1)]) + return h + raise KeyError(name) + + +def _scenario(name): + if name not in _SC: + _SC[name] = _build(name) + return copy.deepcopy(_SC[name]) + + +SCENARIOS = ['fresh', 'off', 'booting', 'ready', 'lid_open', 'vented_loaded', 'fl_pumping', 'fl_pumped', 'fl_venting', 'fl_leak', 'transferring', 'on_stage', + 'to_magazine', 'arm_stranded', 'unpowered_on_stage', 'xray_ramping', 'beam', 'beam_ion', 'faraday', 'stage_moving', 'acquiring', 'snapshot', 'imaging', + 'auto_height', 'etching', 'depth_profiling', 'calibrating', 'calibrating_d110', 'beam_ion_d110', 'fl_pumped_stage_away', 'xray_tripped', + 'fl_nearly_vented', 'charging', 'neutralised', 'chiller_fault', 'chiller_fault_cleared', 'sac_leak', 'mains_fault', + 'mains_restored', 'faults_measuring', 'measured', 'arm_stranded_outage', 'depth_profiling_etch', 'calibrating_etch'] +STEP_DTS = (0.4, 1.0, 3.0, 15.0, 120.0) +_NEUT = dict(filament_current_a=0.4, charge_balance_v=3.3, filament_bias_v=1.0) + + +def _variants(cap): + V = { + 'plant.configure': [dict(rt.PLANT_EXAMPLE), dict(room_k=300.15, mains_voltage_v=170.0, noise_seed=2)], + 'sample.provide': [dict(rt.SAMPLE_EXAMPLE, sample_id='new')], + 'fault.inject': [dict(fault=f, active=True) for f in rt.FAULTS] + [dict(fault=f, active=False) for f in rt.FAULTS], + 'power.set': [dict(enabled=True), dict(enabled=False)], 'system.acknowledge': [{}], + 'flexilock.vent': [{}], 'flexilock.pump': [{}], 'flexilock.set_lid': [dict(open=True), dict(open=False)], + 'holder.mount_sample': [dict(holder_id='H2', sample_id='au', x_m=0.0, y_m=0.0), dict(holder_id='H1', sample_id='au', x_m=0.0125, y_m=0.011)], + 'holder.unmount_sample': [dict(holder_id='H1', sample_id='sio2')], + 'flexilock.load_holder': [dict(holder_id='H1', slot=1), dict(holder_id='H3', slot=3)], 'flexilock.unload_holder': [dict(slot=1), dict(slot=2)], + 'transfer.to_stage': [dict(slot=1), dict(slot=2)], 'transfer.to_magazine': [dict(slot=1), dict(slot=3)], 'transfer.recover': [{}], + 'stage.move': [dict(x_m=0.0, y_m=0.0, z_m=-5.0e-4, tilt_rad=0.0, rotation_rad=0.0), dict(x_m=-0.025, y_m=0.002, z_m=-2.0e-4, tilt_rad=1.0, rotation_rad=0.5)], + 'stage.go_to': [dict(position='transfer'), dict(position='reference:Au'), dict(position='reference:faraday_cup')], + 'stage.auto_height': [{}], + 'xray.set_source': [dict(on=True, emission_a=0.015), dict(on=True, emission_a=0.040), dict(on=False, emission_a=0.015)], + 'analyser.configure': [dict(lens_mode='hybrid', aperture='slot', pass_energy_ev=20.0), dict(lens_mode='electrostatic', aperture='d110', pass_energy_ev=160.0)], + 'neutraliser.set': [dict(on=True, **_NEUT), dict(on=False, **_NEUT), dict(on=True, filament_current_a=1.0, charge_balance_v=5.0, filament_bias_v=2.0)], + 'ion_gun.set': [dict(on=True, energy_ev=4000.0, raster_m=0.003), dict(on=False, energy_ev=500.0, raster_m=0.002)], + 'ion_gun.etch': [dict(duration_s=30.0)], 'ion_gun.measure_current': [{}], + 'acquisition.spectrum': [dict(regions=[region('C 1s', 280.0, 296.0, 0.1, 0.1, 1), region('O 1s', 526.0, 538.0, 0.2, 0.05, 1)], mode='scanned'), + dict(regions=[region('Si 2p', 98.0, 101.0, 0.05, 0.5, 2)], mode='snapshot')], + 'acquisition.image': [dict(be_ev=932.6, fov='fov400', pass_energy_ev=160.0, duration_s=20.0), dict(be_ev=103.3, fov='fov200', pass_energy_ev=80.0, duration_s=20.0)], + 'depth_profile.start': [dict(levels=2, etch_s=10.0, regions=[region('O 1s', 526.0, 538.0, 0.2, 0.05, 1)])], + 'calibration.energy_scale': [{}], + 'sim.step': [dict(dt_s=0.5), dict(dt_s=30.0)], + } + return V.get(cap, []) + + +def _num(x): + return isinstance(x, (int, float)) and not isinstance(x, bool) + + +def _flat(v, prefix=''): + out = {} + if isinstance(v, dict): + for k, x in v.items(): + out.update(_flat(x, f'{prefix}.{k}')) + elif isinstance(v, list) and len(v) <= 64: + for i, x in enumerate(v): + out.update(_flat(x, f'{prefix}[{i}]')) + else: + out[prefix] = json.dumps(v, sort_keys=True, default=str) if isinstance(v, list) else v + return out + + +def _rel_changed(a, b, scale=None): + """Relative comparison (no absolute floor).""" + if _num(a) and _num(b): + return abs(a - b) > 1e-9 * (max(abs(a), abs(b)) if scale is None else scale) + 1e-300 + return _changed(a, b) + + +def _leaf_changed(a, b): + fa, fb = _flat(a), _flat(b) + return any(_rel_changed(fa.get(k, ''), fb.get(k, '')) for k in set(fa) | set(fb)) + + +def _step_differs(v1, a2, v0, b2): + """Does the step change the value differently with the call (v1 -> a2) than without it (v0 -> b2)? (leaf-wise, numeric increments)""" + f1, fa, f0, fb = _flat(v1), _flat(a2), _flat(v0), _flat(b2) + for leaf in set(f1) | set(fa) | set(f0) | set(fb): + x1, xa, x0, xb = (f.get(leaf, '') for f in (f1, fa, f0, fb)) + ca, cb = _rel_changed(x1, xa), _rel_changed(x0, xb) + if not (ca or cb): + continue + if ca and cb and all(_num(x) for x in (x1, xa, x0, xb)) and not _rel_changed(xa - x1, xb - x0, max(abs(x1), abs(xa), abs(x0), abs(xb))): + continue + if ca and cb and (x1, xa) == (x0, xb): + continue + if ca and cb and x1 == x0 and not _rel_changed(xa, xb): # a value that appears during the step: equal up to float rounding of the cuts + continue + return True + return False + + +class DeclaredEffects(unittest.TestCase): + def test_immediate_and_on_step_effects_are_declared(self): + """For every capability accepted in any scenario state: the slots it changes at once are declared effects, the slots whose change during the + following step differs from an identical run without the call are declared on_step effects, and the step itself only changes slots declared + as on_step effects of sim.step (noise-free and noisy runs; both runs draw identical noise during the step).""" + import random + missing_imm, missing_step = {}, {} + states = {n: _scenario(n) for n in SCENARIOS} + for noisy in (False, True): + for n, S in states.items(): + for i, name in enumerate(RNGS): + setattr(S, name, random.Random(7 + i) if noisy else QuietRng()) + for cap in rt.CAPS: + if cap in rt.UNSUPPORTED or rt.CAPS[cap]['kind'] in ('query', 'analysis'): + continue + for sname, S in states.items(): + for args in _variants(cap): + A = copy.deepcopy(S) + v0 = A.read('evaluator') + try: + _orig_invoke(A, cap, **args) + except rt.ActionRejected: + continue + v1 = A.read('evaluator') + if cap == 'sim.step': + for k in v0: + if _leaf_changed(v0[k], v1[k]) and k not in rt.ON_STEP['sim.step'] + rt.EFFECTS['sim.step']: + missing_step.setdefault('sim.step', set()).add(k) + continue + for k in v0: + if _changed(v0[k], v1[k]) and _leaf_changed(v0[k], v1[k]) and k not in rt.EFFECTS[cap]: + missing_imm.setdefault(cap, set()).add((sname, k)) + for dt in STEP_DTS: + A2, B2 = copy.deepcopy(A), copy.deepcopy(S) + for name in RNGS: + setattr(A2, name, copy.deepcopy(getattr(B2, name))) + A2.step(dt) + B2.step(dt) + a2, b2 = A2.read('evaluator'), B2.read('evaluator') + for k in v0: + if k not in rt.ON_STEP.get(cap, []) and _step_differs(v1[k], a2[k], v0[k], b2[k]): + missing_step.setdefault(cap, set()).add((sname, k)) + if k not in rt.ON_STEP['sim.step'] + ['clock.time_s'] and _leaf_changed(v0[k], b2[k]): + missing_step.setdefault('sim.step', set()).add((sname, k)) + self.assertEqual(missing_imm, {}) + self.assertEqual(missing_step, {}) + self.assertFalse([s for v in rt.ON_STEP.values() for s in v if rt.SLOTS[s]['origin'] == 'setpoint']) + + def test_every_device_capability_is_accepted_in_some_scenario(self): + """The discovery covers every executable capability (else its declared effects would be untested).""" + accepted = set() + for n in SCENARIOS: + S = _scenario(n) + for cap in rt.CAPS: + if cap in rt.UNSUPPORTED or rt.CAPS[cap]['kind'] in ('query', 'analysis') or cap in accepted: + continue + for args in _variants(cap): + try: + _orig_invoke(copy.deepcopy(S), cap, **args) + accepted.add(cap) + break + except rt.ActionRejected: + pass + todo = {c for c in rt.CAPS if c not in rt.UNSUPPORTED and rt.CAPS[c]['kind'] not in ('query', 'analysis')} + self.assertEqual(todo - accepted, set()) + + + +class ContractReviewRound1Regressions(unittest.TestCase): + def _follow(self, sname, cap, args, chunk=2.0, tmax=3600.0, tail=30.0): + """Run the call to completion (plus a tail) against an identical control run, comparing at every chunk boundary; returns the slots whose + evolution differs (transient changes included) and the control run's own changes.""" + S = _scenario(sname) + for name in RNGS: + setattr(S, name, QuietRng()) + A, B = copy.deepcopy(S), copy.deepcopy(S) + v0 = A.read('evaluator') + res = _orig_invoke(A, cap, **args) + v1 = A.read('evaluator') + oid = res.get('operation_id') if isinstance(res, dict) else None + differs, control, t, t_end = set(), set(), 0.0, tmax + while t < t_end - 1e-9: + A.step(chunk) + B.step(chunk) + t += chunk + a, b = A.read('evaluator'), B.read('evaluator') + differs |= {k for k in v0 if _step_differs(v1[k], a[k], v0[k], b[k])} + control |= {k for k in v0 if k != 'clock.time_s' and _leaf_changed(v0[k], b[k])} + if oid and A.operations[oid]['phase'] != 'running' and t_end == tmax: + t_end = t + tail + return differs, control, (A.operations[oid]['phase'] if oid else None) + + def test_C01_depth_profile_declares_the_transient_etch_stage(self): + """C01: the ion beam of the etch stages is on only for etch_s (here 4-14 s): it is an on-step effect even though it is off again at the + end, and so are its lamp and the ion current.""" + differs, control, phase = self._follow('beam_ion', 'depth_profile.start', _variants('depth_profile.start')[0]) + self.assertEqual(phase, 'completed') + self.assertTrue({'ion_gun.beam_on', 'panel.ion_gun_lamp', 'truth.ion_current_a'} <= differs) + self.assertEqual(differs - set(rt.ON_STEP['depth_profile.start']) - set(rt.EFFECTS['depth_profile.start']), set()) + self.assertEqual(control - set(rt.ON_STEP['sim.step']), set()) + + def test_C01_energy_calibration_declares_its_completion_effects(self): + """C01: the calibration result, the detector reading and the internal acquisitions appear only after the 120 s discovery windows.""" + differs, control, phase = self._follow('beam_ion', 'calibration.energy_scale', {}) + self.assertEqual(phase, 'completed') + self.assertTrue({'calibration.energy_scale', 'detector.count_rate_cps', 'acquisition.id', 'acquisition.kind'} <= differs) + self.assertEqual(differs - set(rt.ON_STEP['calibration.energy_scale']) - set(rt.EFFECTS['calibration.energy_scale']), set()) + self.assertIn('calibration.energy_scale', rt.ON_STEP['sim.step']) + + def test_C01_ion_gun_is_locked_by_a_running_depth_profile_or_calibration(self): + """Switching the gun off (or changing energy / raster) during a depth profile or calibration would let the routine continue with etch + stages without ion current: refused with ACQUISITION_RUNNING (ION_BEAM_ON while the beam is on), state unchanged.""" + for sname in ('depth_profiling', 'calibrating'): + S = _scenario(sname) + for name in RNGS: + setattr(S, name, QuietRng()) + self.assertIn(S.acq['kind'], ('depth_profile', 'calibration')) + for args in (dict(on=False, energy_ev=500.0, raster_m=0.002), dict(on=True, energy_ev=500.0, raster_m=0.002)): + A = copy.deepcopy(S) + self.assertTrue(rejected(A, 'ion_gun.set', 'ION_BEAM_ON' if A.etching else 'ACQUISITION_RUNNING', **args)) + A = copy.deepcopy(S) + while A.acq is not None and A.acq['kind'] in ('depth_profile', 'calibration'): + A.step(5.0) + _orig_invoke(A, 'ion_gun.set', on=False, energy_ev=500.0, raster_m=0.002) # accepted once the routine has finished + self.assertFalse(A.ion_on) + self.assertIn('ACQUISITION_RUNNING', rt.CAP_ERRORS['ion_gun.set']) + + def test_C08_xray_off_during_an_etch_stage_stops_the_beam_at_the_call(self): + """Contract review r2 C08: switching the X-ray source off while a depth profile or calibration is in an etch stage fails the routine and + stops the ion beam at the call (immediate effects of xray.set_source, not on-step ones).""" + for sname in ('depth_profiling_etch', 'calibrating_etch'): + A = _scenario(sname) + for name in RNGS: + setattr(A, name, QuietRng()) + before = A.read('evaluator') + self.assertTrue(before['ion_gun.beam_on']['value'] if isinstance(before['ion_gun.beam_on'], dict) else before['ion_gun.beam_on']) + op = A.acq['op'] + _orig_invoke(A, 'xray.set_source', on=False, emission_a=0.015) + after = A.read('evaluator') + val = (lambda v: v['value'] if isinstance(v, dict) and 'value' in v else v) + self.assertIs(val(after['ion_gun.beam_on']), False) + self.assertIs(val(after['panel.ion_gun_lamp']), False) + self.assertEqual(val(after['truth.ion_current_a']), 0.0) + self.assertEqual(A.operations[op]['phase'], 'failed') + self.assertTrue({'ion_gun.beam_on', 'panel.ion_gun_lamp', 'truth.ion_current_a'} <= set(rt.EFFECTS['xray.set_source'])) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_asset_lakeshore_8604vsm.py b/tests/test_asset_lakeshore_8604vsm.py new file mode 100644 index 0000000000000000000000000000000000000000..01b8c32b75b23abb2f66c7f50e5ca08b7267d4f9 --- /dev/null +++ b/tests/test_asset_lakeshore_8604vsm.py @@ -0,0 +1,180 @@ +"""Independent physical/temporal/protocol acceptance tests for CHEM143.""" +import copy,json,math,unittest +import numpy as np +from scripts.asset_runtime import lakeshore_8604vsm as m + +class VsmTests(unittest.TestCase): + def make(self,standard=False,sample=None,plant=None,lower=True): + r=m.LakeShore8604VsmRuntime('vsm_test');r.invoke('plant.configure',**(plant or m.PLANT_EXAMPLE));r.invoke('coil.configure',**m.COIL_EXAMPLE) + if sample is not False:r.invoke('standard.load' if standard else 'sample.load',**(m.STANDARD_EXAMPLE if standard else sample or m.SAMPLE_EXAMPLE)) + r.invoke('power.set',enabled=True) + if lower:r.invoke('sample.set_lift',lift_m=0.);r.step(3.5);r.invoke('vibration.configure',**m.VIBRATION_EXAMPLE) + return r + def finish(self,r,dt=20): + while r.phase=='running':r.step(dt) + return r._result() + def loop(self,r,method=None):r.invoke('method.configure',**(method or m.METHOD_EXAMPLE));r.invoke('acquisition.start');return self.finish(r) + def zero_raise(self,r): + r.invoke('field.set_target',field_t=0.,ramp_rate_t_s=1.);r.step(2.4);r.invoke('vibration.configure',**dict(m.VIBRATION_EXAMPLE,enabled=False));r.invoke('sample.set_lift',lift_m=.35);r.step(3.5) + def session(self,r,name='evaluator',role='evaluator'):r.register_principal(name,role);return r.session(name) + def call(self,s,c,a,rid=None):return s.invoke(instance_id=s._host.instance_id,capability_id=c,arguments=copy.deepcopy(a),request_id=rid or c+str(s._host.revision)) + def test_01_field_setpoint_does_not_advance_physics(self): + r=self.make(sample=False);t=r.time_s;r.invoke('field.set_target',field_t=1.,ramp_rate_t_s=1.);self.assertEqual(r._pos('field'),0);self.assertEqual(r.time_s,t);r.step(.3);self.assertAlmostEqual(r._pos('field'),.3,9);r.step(.7);self.assertAlmostEqual(r._pos('field'),1.,9) + def test_02_field_resolution_and_standard_gap_limit(self): + r=self.make(sample=False);r.invoke('field.set_target',field_t=.123456789,ramp_rate_t_s=1.);self.assertAlmostEqual(r.axes['field']['target'],.1234568,15) + with self.assertRaises(m.ActionRejected):r.invoke('field.set_target',field_t=2.61,ramp_rate_t_s=1.) + def test_03_real_10second_integration_window(self): + r=self.make();r.invoke('method.configure',**dict(m.METHOD_EXAMPLE,field_points_t=[0.],averaging_time_s=10.,settling_time_s=0.));r.invoke('acquisition.start');r.step(9.99);self.assertEqual(len(r.rows),0);r.step(.01);self.assertEqual(len(r.rows),1);self.assertAlmostEqual(r.rows[0]['window_end_s']-r.rows[0]['window_start_s'],10.) + def test_04_interval_mean_is_not_endpoint(self): + p=dict(m.PLANT_EXAMPLE,detector_tau_s=1.,voltage_offset_v=0.,voltage_gain=1.);r=self.make(plant=p);r.invoke('method.configure',**dict(m.METHOD_EXAMPLE,field_points_t=[0.],averaging_time_s=.1,settling_time_s=0.));r.invoke('acquisition.start');r.step(.1);target=r._sensitivity(True)*r._moment();expected=target*(1-(1-math.exp(-.1))/.1);self.assertAlmostEqual(r.rows[0]['in_phase_voltage_v'],expected,14);self.assertNotAlmostEqual(r.rows[0]['in_phase_voltage_v'],r.sensor,10) + def test_05_zero_and_small_signal_are_allowed(self): + s=dict(m.SAMPLE_EXAMPLE,mass_kg=0.);p=dict(m.PLANT_EXAMPLE,voltage_offset_v=0.);r=self.make(sample=s,plant=p);res=self.loop(r);self.assertEqual(res['phase'],'succeeded');self.assertTrue(all(row['moment_a_m2']==0 for row in r.rows));self.assertTrue(all(row['quality']=='below_documented_dynamic_range' for row in r.rows)) + def test_06_actual_range_overflow_not_clipped_success(self): + r=self.make();r.invoke('coil.configure',**dict(m.COIL_EXAMPLE,moment_range_a_m2=1e-5));res=self.loop(r);self.assertEqual(res['phase'],'failed');self.assertIsNone(r.rows[0]['moment_a_m2']);self.assertEqual(r.rows[0]['quality'],'overflow');self.assertGreater(r.ledger()['coil_joule_j'],0) + def test_07_measured_library_anchor_units(self): + r=self.make();record=m.library()['kuleuven_cf_300k'];self.assertAlmostEqual(sum(r.amplitudes),m.SAMPLE_EXAMPLE['mass_kg']*75.48749849);self.assertGreater(record['measured_specific_moment_max_abs_applied_field_t'],2.37) + def test_08_more_than_50_real_references_not_fake_loops(self): + records=m.library();chi=[x for x in records.values() if x.get('molar_susceptibility_m3_mol') is not None];self.assertGreaterEqual(len(chi),50);self.assertTrue(all(x.get('source') and x.get('evidence') for x in records.values()));self.assertGreaterEqual(len([x for x in records.values() if x.get('measured_hysteresis_sequence')]),5) + def test_09_crc_molar_chi_independent_si_conversion(self): + sample=dict(m.SAMPLE_EXAMPLE,reference_id='crc_cuso4_5h2o',magnetic_model='linear_susceptibility');r=self.make(sample=sample);rec=m.library()['crc_cuso4_5h2o'];expected=sample['mass_kg']/rec['molar_mass_kg_mol']*(1460*4*math.pi*1e-12)*.1/(4*math.pi*1e-7);self.assertAlmostEqual(r._moment(.1),expected,16) + def test_10_explicit_proxy_required_when_real_hysteresis_absent(self): + r=self.make(sample=False,lower=False);s=dict(m.SAMPLE_EXAMPLE,reference_id='crc_cuso4_5h2o') + with self.assertRaisesRegex(m.ActionRejected,'EXPLICIT_PROXY'):r.invoke('sample.load',**s) + def test_11_temperature_single_point_tolerance_and_wide_domain(self): + r=self.make();self.loop(r);self.assertGreater(r.sample_k,300.);self.assertTrue(r._temperature_valid());r.sample_k=301.;self.assertFalse(r._temperature_valid());self.assertIsNone(r.read()['moment.indicated_a_m2']) + s=dict(m.SAMPLE_EXAMPLE,reference_id='crc_cuso4_5h2o',magnetic_model='linear_susceptibility');q=self.make(sample=s);q.sample_k=300.01;self.assertFalse(q._temperature_valid()) + def test_12_temperature_zero_tolerance_fails_observation_after_heat(self): + r=self.make(sample=dict(m.SAMPLE_EXAMPLE,temperature_tolerance_k=0.));res=self.loop(r);self.assertEqual(res['error'],'REFERENCE_TEMPERATURE_RANGE');self.assertIsNone(res['rows'][0]['moment_a_m2']) + def test_13_hysterons_switch_at_actual_field_not_setpoint(self): + r=self.make();r.invoke('field.set_target',field_t=.1,ramp_rate_t_s=1.);self.assertTrue(all(x['state']==-1 for x in r.relays));r.step(.019);self.assertTrue(all(x['state']==-1 for x in r.relays));r.step(.002);self.assertEqual([x['state'] for x in r.relays],[1,-1,-1,-1,-1]) + def test_14_closed_cycle_loss_has_independent_rectangle_area(self): + r=self.make();r.invoke('field.set_target',field_t=.2,ramp_rate_t_s=1.);r.step(.2);initial=r.book['hysteresis_heat_j'] + for B in [-.2,.2]:r.invoke('field.set_target',field_t=B,ramp_rate_t_s=1.);r.step(.4) + expected=sum(4*a*x['coercive_field_t'] for a,x in zip(r.amplitudes,r.relays));self.assertAlmostEqual(r.book['hysteresis_heat_j']-initial,expected,12);self.assertLess(abs(r.ledger()['energy_residual_j']),1e-7) + def test_15_biased_relay_stores_energy_separately_from_heat(self): + s=dict(m.SAMPLE_EXAMPLE,relays=[dict(coercive_field_t=.05,bias_field_t=.01,weight=1.,initial_sign=-1)]);r=self.make(sample=s);r.invoke('field.set_target',field_t=.1,ramp_rate_t_s=1.);r.step(.1);amp=sum(r.amplitudes);self.assertAlmostEqual(r.book['hysteresis_heat_j'],.1*amp,12);self.assertAlmostEqual(r._magnetic_energy(),.01*amp,12);self.assertLess(abs(r.ledger()['energy_residual_j']),1e-7) + def test_16_inductor_and_joule_integrals_for_linear_ramp(self): + r=self.make(sample=False);p=r.plant;r.invoke('field.set_target',field_t=1.,ramp_rate_t_s=1.);r.step(1.);self.assertAlmostEqual(r.ledger()['coil_stored_j'],.5*p['coil_inductance_h']/p['field_per_current_t_a']**2);self.assertAlmostEqual(r.book['coil_joule_j'],p['coil_resistance_ohm']/p['field_per_current_t_a']**2/3);self.assertLess(abs(r.ledger()['energy_residual_j']),1e-7) + def test_17_magnet_passive_thermal_matches_independent_integral(self): + from scipy.integrate import quad + r=self.make(sample=False);p=r.plant;r.invoke('field.set_target',field_t=1.,ramp_rate_t_s=1.);r.step(1.);expected=quad(lambda t:p['coil_resistance_ohm']/p['field_per_current_t_a']**2*t*t*math.exp(-(1-t)*p['magnet_cooling_conductance_w_k']/p['magnet_thermal_capacity_j_k']),0,1)[0]/p['magnet_thermal_capacity_j_k'];self.assertAlmostEqual(r.magnet_k-p['ambient_k'],expected,12) + def test_18_controller_full_envelope_rejects_impossible_source(self): + for p in [dict(m.PLANT_EXAMPLE,field_per_current_t_a=.001),dict(m.PLANT_EXAMPLE,coil_resistance_ohm=10),dict(m.PLANT_EXAMPLE,coil_inductance_h=10)]: + r=m.LakeShore8604VsmRuntime() + with self.assertRaisesRegex(m.ActionRejected,'POWER_SUPPLY'):r.invoke('plant.configure',**p) + self.assertIsNone(r.plant) + def test_19_mass_volume_and_loaded_sensible_energy(self): + r=self.make(sample=False,lower=False);s=dict(m.SAMPLE_EXAMPLE,initial_temperature_k=299.8);r.invoke('sample.load',**s);expected=s['mass_kg']*s['specific_heat_capacity_j_kg_k']*(299.8-r.plant['ambient_k']);self.assertAlmostEqual(r.ledger()['sample_sensible_loaded_j'],expected);r.step(2);r.invoke('sample.remove');d=r.ledger();self.assertAlmostEqual(d['mass_residual_kg'],0);self.assertAlmostEqual(d['volume_residual_m3'],0);self.assertLess(abs(d['energy_residual_j']),1e-7) + def test_20_sample_removal_preserves_remaining_local_heat(self): + r=self.make();self.loop(r);self.zero_raise(r);t=r.sample_k;r.invoke('sample.remove');self.assertEqual(r.sample_k,t);self.assertAlmostEqual(r.ledger()['sample_thermal_j'],r.plant['sample_local_capacity_j_k']*(t-300));self.assertLess(abs(r.ledger()['energy_residual_j']),1e-7) + def test_21_cancel_keeps_magnetic_state_and_continued_coil_heat(self): + r=self.make();r.invoke('method.configure',**m.METHOD_EXAMPLE);r.invoke('acquisition.start');r.step(.5);r.invoke('acquisition.stop');rows=copy.deepcopy(r.rows);B=r._pos('field');states=[x['state'] for x in r.relays];q=r.book['coil_joule_j'];r.step(2);self.assertEqual(rows,r.rows);self.assertEqual(B,r._pos('field'));self.assertEqual(states,[x['state'] for x in r.relays]);self.assertGreater(r.book['coil_joule_j'],q) + def test_22_zero_field_poweroff_guard_and_display(self): + r=self.make();r.invoke('field.set_target',field_t=.1,ramp_rate_t_s=1);r.step(.1) + with self.assertRaisesRegex(m.ActionRejected,'ZERO_FIELD'):r.invoke('power.set',enabled=False) + self.assertTrue(r.power);r.invoke('field.set_target',field_t=0.,ramp_rate_t_s=1);r.step(.1);r.invoke('power.set',enabled=False);self.assertIsNone(r.read()['moment.indicated_a_m2']);self.assertIsNone(r.read()['field.indicated_t']) + def test_23_motion_finite_lift_rotation_and_storage(self): + r=self.make(lower=False);r.invoke('sample.set_lift',lift_m=0.);r.step(.2);self.assertAlmostEqual(r._pos('lift'),.33);r.step(3.3);r.invoke('sample.set_angle',angle_rad=7.);r.invoke('storage.set_open',opened=True);r.step(.2);self.assertAlmostEqual(r._pos('angle'),.2,6);self.assertAlmostEqual(r._pos('drawer'),.02);r.step(10);self.assertGreater(r._pos('angle'),2*math.pi);self.assertAlmostEqual(r.read()['sample.orientation_rad'],math.atan2(math.sin(r._pos('angle')),math.cos(r._pos('angle')))) + def test_24_rotation_projection_at_zero_field(self): + r=self.make();r.invoke('vibration.configure',**dict(m.VIBRATION_EXAMPLE,enabled=False));r.invoke('sample.set_angle',angle_rad=math.pi/2);r.step(2);self.assertAlmostEqual(r._moment(),0.,13) + def test_25_vibration_strobe_exact_host_phase(self): + r=self.make();r.step(.203);expected=.0005*math.sin(2*math.pi*82*r.time_s);self.assertAlmostEqual(r.read()['sample.vibration_z_m'],expected,15) + def test_26_loading_and_motion_interlocks(self): + r=self.make() + for c,a in [('sample.remove',{}),('sample.set_lift',{'lift_m':.35}),('sample.set_angle',{'angle_rad':1.})]: + before=r.read('evaluator') + with self.assertRaises(m.ActionRejected):r.invoke(c,**a) + self.assertEqual(before,r.read('evaluator')) + def test_27_real_calibration_uses_external_observed_voltage(self): + r=self.make(standard=True);r.invoke('calibration.start',reference_moment_a_m2=.00347,field_t=m.STANDARD_EXAMPLE['reference_field_t'],averaging_time_s=1.);res=self.finish(r);v1,v2=[x['in_phase_voltage_v'] for x in res['rows']];self.assertAlmostEqual(r.calibration_gain,2*.00347*r._sensitivity()/(v1-v2));self.assertAlmostEqual(r.calibration_gain,1/1.03,5);self.assertEqual(r.calibration_offset,(v1+v2)/2) + def test_28_wrong_external_standard_changes_gain_without_hidden_correction(self): + r=self.make(standard=True);r.invoke('calibration.start',reference_moment_a_m2=.00694,field_t=m.STANDARD_EXAMPLE['reference_field_t'],averaging_time_s=1.);self.finish(r);self.assertAlmostEqual(r.calibration_gain,2/1.03,5) + def test_29_coil_or_vibration_settings_invalidate_calibration(self): + r=self.make();r.calibration_valid=True;r.invoke('coil.configure',**m.COIL_EXAMPLE);self.assertFalse(r.calibration_valid);r.calibration_valid=True;r.invoke('vibration.configure',**dict(m.VIBRATION_EXAMPLE,frequency_hz=83));self.assertFalse(r.calibration_valid) + def test_30_external_loop_crossings_and_units(self): + rows=copy.deepcopy(m.CAPS['analysis.loop']['example_arguments']['rows']);res=m.analyze_loop(rows);self.assertTrue(all(abs(x['field_t'])<1e-12 for x in res['coercive_crossings']));self.assertTrue(all(abs(x['external_h_a_m'])<1e-6 for x in res['coercive_crossings']));self.assertAlmostEqual(m.infer_moment(.002,2.,.5,0.),.0005) + def test_31_forc_actual_paths_and_local_derivative(self): + r=self.make();r.invoke('forc.configure',**m.FORC_EXAMPLE);r.invoke('acquisition.start');res=self.finish(r);self.assertEqual(len(res['rows']),36);self.assertEqual(set(x['reversal_field_t'] for x in r.rows),set(m.FORC_EXAMPLE['reversal_fields_t']));self.assertEqual(len(m.analyze_forc(r.rows)['distribution']),36) + rows=copy.deepcopy(m.CAPS['analysis.forc']['example_arguments']['rows']);result=m.analyze_forc(rows);self.assertTrue(all(abs(x['density_a_m2_per_t2']-.0005)<1e-12 for x in result['distribution'])) + def test_32_forc_requires_reachable_model_saturation_and_valid_rows(self): + r=self.make();r.invoke('forc.configure',**dict(m.FORC_EXAMPLE,saturation_field_t=.01,reversal_fields_t=[-.1,-.08,-.05]));before=r.read('evaluator') + with self.assertRaisesRegex(m.ActionRejected,'SATURATION'):r.invoke('acquisition.start') + self.assertEqual(before,r.read('evaluator'));rows=copy.deepcopy(m.CAPS['analysis.forc']['example_arguments']['rows']);rows[0]['moment_a_m2']=None + with self.assertRaises(m.ActionRejected):m.analyze_forc(rows) + def test_33_partition_invariance_sixty_hz(self): + a=self.make();b=self.make() + for r in [a,b]:r.invoke('method.configure',**m.METHOD_EXAMPLE);r.invoke('acquisition.start') + a.step(4.) + for _ in range(240):b.step(1/60) + self.assertEqual(a.time_ns,b.time_ns);self.assertEqual(a.phase,b.phase) + for x,y in zip(a.rows,b.rows): + self.assertEqual(x['window_end_s'],y['window_end_s']);self.assertAlmostEqual(x['moment_a_m2'],y['moment_a_m2'],12) + self.assertAlmostEqual(a.book['source_energy_j'],b.book['source_energy_j'],9) + def test_34_reads_and_describe_are_pure(self): + r=self.make();s=self.session(r);before=copy.deepcopy(r.__dict__) + for _ in range(3):s.read(instance_id=r.instance_id);s.describe(instance_id=r.instance_id);r.step(0.) + self.assertEqual(before,r.__dict__) + def test_35_bad_inputs_and_busy_rejections_are_atomic(self): + r=self.make();r.invoke('method.configure',**m.METHOD_EXAMPLE);r.invoke('acquisition.start') + for c,a in [('field.set_target',dict(field_t=.1,ramp_rate_t_s=1.)),('sim.step',{'dt_s':float('nan')}),('sim.step',{'dt_s':True}),('sim.step',{'dt_s':-1}),('coil.configure',m.COIL_EXAMPLE)]: + before=copy.deepcopy(r.__dict__) + with self.assertRaises(m.ActionRejected):r.invoke(c,**a) + self.assertEqual(before,r.__dict__) + def test_36_dual_instances_do_not_share_material_memory_or_clock(self): + a=self.make();b=self.make(sample=dict(m.SAMPLE_EXAMPLE,proxy_specific_moment_a_m2_kg=20.));self.loop(a);self.assertEqual(b.time_s,3.5);self.assertTrue(all(x['state']==-1 for x in b.relays));self.assertNotEqual(a._moment(),b._moment()) + def test_37_public_results_redact_identity_even_evaluator_forward(self): + for role in ['agent','evaluator','debug']: + r=self.make();s=self.session(r,'person',role);self.call(s,'method.configure',m.METHOD_EXAMPLE);op=self.call(s,'acquisition.start',{})['operation_id'];self.finish(r);text=json.dumps(self.call(s,'acquisition.result',{})['result'])+json.dumps(s.poll(op));self.assertNotIn('kuleuven',text);self.assertNotIn('CoFe2O4',text);self.assertNotIn('1LDRAQ',text);self.assertIn('synthetic_forward_model',text) + if role=='agent':self.assertEqual(self.call(s,'provenance.read',{})['status'],'rejected') + else:self.assertIn('1LDRAQ',json.dumps(self.call(s,'provenance.read',{}))) + def test_38_owner_idempotence_and_request_conflict(self): + r=self.make();a=self.session(r,'a','agent');b=self.session(r,'b','agent');self.call(a,'method.configure',m.METHOD_EXAMPLE);first=self.call(a,'acquisition.start',{},'once');self.assertEqual(first,self.call(a,'acquisition.start',{},'once'));self.assertEqual(self.call(a,'acquisition.stop',{},'once')['error']['code'],'REQUEST_CONFLICT') + with self.assertRaises(m.ActionRejected):b.poll(first['operation_id']) + self.assertEqual(self.call(b,'acquisition.stop',{})['error']['code'],'ACCESS_DENIED');a.cancel(first['operation_id'],'cancel');self.assertEqual(a.cancel(first['operation_id'],'cancel')['status'],'succeeded') + def test_39_visibility_and_wrong_instance(self): + r=self.make();s=self.session(r,'a','agent');self.assertNotIn('truth.mass_kg',s.read(instance_id=r.instance_id)['observations']);self.assertNotIn('plant.configure',s.describe(instance_id=r.instance_id)['capabilities']) + with self.assertRaises(m.ActionRejected):s.read(instance_id='wrong') + with self.assertRaises(m.ActionRejected):s.read(instance_id=r.instance_id,state_ids=['truth.mass_kg']) + def test_40_completed_snapshot_survives_new_sample_and_calibration(self): + r=self.make();s=self.session(r);self.call(s,'method.configure',m.METHOD_EXAMPLE);op=self.call(s,'acquisition.start',{})['operation_id'];self.finish(r);old=s.poll(op);self.zero_raise(r);r.invoke('sample.remove');r.invoke('sample.load',**dict(m.SAMPLE_EXAMPLE,reference_id='crc_cuso4_5h2o',magnetic_model='linear_susceptibility'));r.invoke('calibration.clear');self.assertEqual(old,s.poll(op)) + def test_41_all_metadata_examples_and_actual_states_validate(self): + meta=m.export_lakeshore_8604vsm_contract_metadata() + for c in meta['capabilities'].values():m.validate(c['input_schema'],c['example_arguments']) + r=self.make();self.loop(r) + for key,value in r.read('evaluator').items():m.validate(meta['state_slots'][key]['value_schema'],value) + for result,schema in [(r._result(),m.RESULT),(r.ledger(),m.LEDGER),(m.analyze_loop(r.rows),m.LOOP_OUTPUT)]:m.validate(schema,result) + def test_42_unsupported_are_explicit(self): + r=self.make();s=self.session(r) + for c in m.UNSUPPORTED:self.assertEqual(self.call(s,c,{})['status'],'unsupported') + def test_43_calibration_async_owner_and_wait(self): + r=self.make(standard=True);s=self.session(r,'a','agent');out=self.call(s,'calibration.start',dict(reference_moment_a_m2=.00347,field_t=m.STANDARD_EXAMPLE['reference_field_t'],averaging_time_s=10.));r.step(1.);self.assertFalse(r.calibration_valid);self.assertEqual(s.poll(out['operation_id'])['status'],'running');s.cancel(out['operation_id'],'stop');self.assertFalse(r.calibration_valid) + def test_44_each_implemented_capability_executes_with_declared_output(self): + r=m.LakeShore8604VsmRuntime('complete');s=self.session(r);seen=set() + def call(c,a): + response=self.call(s,c,a);self.assertIn(response['status'],['succeeded','accepted'],(c,response));m.validate(m.CAPS[c]['output_schema'],response['result']);seen.add(c);return response + for c,a in [('plant.configure',m.PLANT_EXAMPLE),('coil.configure',m.COIL_EXAMPLE),('standard.load',m.STANDARD_EXAMPLE),('power.set',{'enabled':True}),('sample.set_angle',{'angle_rad':0.}),('storage.set_open',{'opened':True}),('sample.set_lift',{'lift_m':0.}),('sim.step',{'dt_s':3.5}),('vibration.configure',m.VIBRATION_EXAMPLE),('calibration.start',dict(reference_moment_a_m2=.00347,field_t=m.STANDARD_EXAMPLE['reference_field_t'],averaging_time_s=.2))]:call(c,a) + self.finish(r);call('field.set_target',dict(field_t=0.,ramp_rate_t_s=1.));r.step(2.4);r.invoke('vibration.configure',**dict(m.VIBRATION_EXAMPLE,enabled=False));r.invoke('sample.set_lift',lift_m=.35);r.step(3.5);call('sample.remove',{});call('sample.load',m.SAMPLE_EXAMPLE);r.invoke('sample.set_lift',lift_m=0.);r.step(3.5);r.invoke('vibration.configure',**m.VIBRATION_EXAMPLE) + call('method.configure',m.METHOD_EXAMPLE);call('acquisition.start',{});self.finish(r);loop=call('acquisition.result',{})['result'];call('analysis.loop',dict(rows=loop['rows']));call('forc.configure',m.FORC_EXAMPLE);call('acquisition.start',{});self.finish(r);call('analysis.forc',dict(rows=r.rows));call('analysis.moment',m.CAPS['analysis.moment']['example_arguments']);call('provenance.read',{});call('ledger.read',{});call('calibration.clear',{});call('acquisition.start',{});r.step(.1);call('acquisition.stop',{});self.assertEqual(seen,set(m.CAPS)-set(m.UNSUPPORTED)) + + def test_45_pending_lift_motion_blocks_field_before_first_step(self): + r=self.make();r.invoke('vibration.configure',**dict(m.VIBRATION_EXAMPLE,enabled=False));r.invoke('sample.set_lift',lift_m=.35);before=copy.deepcopy(r.__dict__) + with self.assertRaisesRegex(m.ActionRejected,'MEASUREMENT_POSITION'):r.invoke('field.set_target',field_t=.1,ramp_rate_t_s=1.) + self.assertEqual(before,r.__dict__) + def test_46_forc_reversal_labels_are_real_quantized_distinct_fields(self): + r=self.make();before=copy.deepcopy(r.__dict__) + with self.assertRaisesRegex(m.ActionRejected,'FORC_GRID'):r.invoke('forc.configure',**dict(m.FORC_EXAMPLE,reversal_fields_t=[-.12000001,-.12000002,-.12000003])) + self.assertEqual(before,r.__dict__);r.invoke('forc.configure',**dict(m.FORC_EXAMPLE,reversal_fields_t=[-.12000001,-.08000002,-.04000003]));r.invoke('acquisition.start');self.finish(r);self.assertEqual(set(x['reversal_field_t'] for x in r.rows),set(m.quant(x,m.FIELD_RESOLUTION_T) for x in [-.12,-.08,-.04])) + def test_47_all_actual_command_state_changes_are_declared(self): + r=self.make();s=self.session(r);meta=m.export_lakeshore_8604vsm_contract_metadata() + def checked(c,a): + before=r.read('evaluator');response=self.call(s,c,a);self.assertIn(response['status'],('succeeded','accepted'));after=r.read('evaluator');changed={k for k in before if before[k]!=after[k]};allowed={x['state_id'] for x in meta['capabilities'][c]['state_effects']};self.assertFalse(changed-allowed,(c,changed-allowed));return response + checked('method.configure',m.METHOD_EXAMPLE);checked('acquisition.start',{});checked('sim.step',{'dt_s':4.});checked('calibration.clear',{});checked('coil.configure',m.COIL_EXAMPLE);checked('field.set_target',{'field_t':0.,'ramp_rate_t_s':1.});checked('sim.step',{'dt_s':1.});checked('vibration.configure',dict(m.VIBRATION_EXAMPLE,enabled=False));checked('sample.set_angle',{'angle_rad':1.});checked('sim.step',{'dt_s':1.1});checked('sample.set_lift',{'lift_m':.35});checked('sim.step',{'dt_s':3.5});checked('sample.remove',{});checked('sample.load',m.SAMPLE_EXAMPLE);checked('power.set',{'enabled':False}) + + def test_48_all_available_molar_chi_records_drive_actual_samples(self): + count=0 + for record in m.library().values(): + if record.get('molar_susceptibility_m3_mol') is None:continue + sample=dict(m.SAMPLE_EXAMPLE,reference_id=record['id'],magnetic_model='linear_susceptibility',initial_temperature_k=299.);r=self.make(sample=sample,plant=dict(m.PLANT_EXAMPLE,ambient_k=299.),lower=False);expected=sample['mass_kg']/record['molar_mass_kg_mol']*record['molar_susceptibility_m3_mol']*.01/m.MU0;self.assertAlmostEqual(r._moment(.01),expected,14);count+=1 + self.assertGreaterEqual(count,50) + +if __name__=='__main__':unittest.main() diff --git a/tests/test_asset_lakeshore_measurereadym91.py b/tests/test_asset_lakeshore_measurereadym91.py new file mode 100644 index 0000000000000000000000000000000000000000..f98083f98540fb82154a639cc6de4738143bf04f --- /dev/null +++ b/tests/test_asset_lakeshore_measurereadym91.py @@ -0,0 +1,220 @@ +"""CHEM141 conventional Hall/vdP inverse, external field, real warmup and energy.""" +import copy,importlib.util,json,math,unittest +from pathlib import Path +import numpy as np +from scripts.asset_runtime import lakeshore_measurereadym91 as r +ROOT=Path(__file__).resolve().parents[1];spec=importlib.util.spec_from_file_location('m91_asset_tool',ROOT/'skills/chemistry-lab-assets/scripts/asset_tool.py');asset_tool=importlib.util.module_from_spec(spec);spec.loader.exec_module(asset_tool) +OBSERVED=[] +class Checked(r.LakeShoreMeasurereadyM91Runtime): + def invoke(self,k,**a): + before=self.read();out=super().invoke(k,**a);after=self.read();changed={x for x in after if after[x]!=before[x]} + assert not changed-set(r.CAPS[k]['effects']),(k,changed-set(r.CAPS[k]['effects'])) + assert not asset_tool.validate_value(out,r.CAPS[k]['output_schema']),(k,asset_tool.validate_value(out,r.CAPS[k]['output_schema'])) + OBSERVED.append((k,copy.deepcopy(a),copy.deepcopy(out)));return out + +def make(plant=None,sample=None,method=None,geometry=None,thermal=None,field=None,warm=True): + h=Checked() + for c,a in [('plant.configure',dict(r.PLANT_EXAMPLE,**(plant or {}))),('geometry.configure',dict(r.GEOMETRY_EXAMPLE,**(geometry or {}))),('thermal.configure',dict(r.THERMAL_EXAMPLE,**(thermal or {}))),('field.configure',dict(r.FIELD_EXAMPLE,**(field or {}))),('sample.load',dict(r.SAMPLE_EXAMPLE,**(sample or {}))),('power.set',{'enabled':True}),('sample.set_clamp',{'closed':True}),('thermal.set_temperature',{'temperature_k':r.PLANT_EXAMPLE['ambient_k']}),('field.set_target',{'field_t':.5}),('method.configure',dict(r.METHOD_EXAMPLE,**(method or {})))]:h.invoke(c,**a) + if warm:h.step(1800.) + return h + +def finish(h): + h.invoke('acquisition.start');h.step(h.expected_duration);return h.invoke('acquisition.result') +def paired(h): + rows=[];operations=[] + for B in [.5,-.5]: + h.invoke('field.set_target',field_t=B);h.step(3.);out=finish(h);assert out['phase']=='succeeded',out;rows+=out['rows'];operations.append(out) + a=dict(r.ANALYSIS_EXAMPLE,observations=[{k:x[k] for k in r.ANALYSIS_ROW['properties']} for x in rows]);return h.invoke('analysis.hall_vdp',**a),operations + +def remove(h): + if h.phase=='running':h.invoke('acquisition.stop') + h.invoke('sample.set_clamp',closed=False);h.step(.012/h.plant['clamp_speed_m_s']);h.invoke('sample.remove') +def sessions(h): + for n,role in [('student','agent'),('teacher','evaluator'),('other','agent')]:h.register_principal(n,role) + return h.session('student'),h.session('teacher'),h.session('other') +def call(s,c,a=None,rid='r1'):return s.invoke(instance_id=s._host.instance_id,capability_id=c,arguments=a or {},request_id=rid) +def snapshot(h): + keys=['plant','sample','geometry','thermal','field','field_target','field_actual','excitation_mode','voltage','programmed_voltage','current_limit','high_resistance_firmware_enabled','axes','power','target','method','calibration','rows','records','revision','time_ns','_clock_remainder_ns','_counter','_phase_index','_power_started_ns','_button_started_ns'] + return json.dumps(dict(state=h.read(),ledger=h._ledger(),x=h.x.tolist(),**{k:getattr(h,k) for k in keys}),sort_keys=True,allow_nan=False) + +class M91Tests(unittest.TestCase): + def budget(self,h,tol=1e-8): + for k,v in h.invoke('ledger.read').items(): + if 'error' in k:self.assertLess(abs(v),tol,(k,v)) + def reject(self,h,k,**a): + before=snapshot(h) + with self.assertRaises(r.ActionRejected):h.invoke(k,**a) + self.assertEqual(snapshot(h),before) + def test_01_full_real_warmup_and_no_skip(self): + h=make(warm=False);h.step(1799.);self.assertEqual(h.read()['warmup.elapsed_s'],1799.);self.reject(h,'acquisition.start');h.step(1.);self.assertTrue(h.read()['warmup.ready']);self.assertEqual(finish(h)['phase'],'succeeded') + def test_02_power_reset_but_repeated_on_does_not_reset(self): + h=make();h.invoke('power.set',enabled=True);self.assertEqual(h._warmup(),1800.);h.invoke('power.set',enabled=False);self.assertEqual(h._warmup(),0.);h.invoke('power.set',enabled=True);h.step(10.);self.assertEqual(h._warmup(),10.);self.reject(h,'acquisition.start') + def test_03_button_releases_and_manual_tilt_has_finite_speed(self): + h=make(warm=False);self.assertEqual(h.read()['power.position_m'],0.);h.invoke('ui.set_tilt',angle_rad=.26);self.assertEqual(h.read()['ui.tilt_rad'],0.);h.step(.05);self.assertAlmostEqual(h.read()['power.position_m'],.0015);self.assertAlmostEqual(h.read()['ui.tilt_rad'],.025);h.step(.05);self.assertEqual(h.read()['power.position_m'],0.);self.assertTrue(h.power);h.step(1.);self.assertEqual(h.read()['ui.tilt_rad'],.26) + def test_04_read_describe_and_zero_step_do_not_advance(self): + h=make();a,e,_=sessions(h);before=snapshot(h) + for _ in range(2):a.read(instance_id=h.instance_id);e.describe(asset_type_id=r.ASSET_TYPE_ID);h.step(0.) + self.assertEqual(snapshot(h),before) + def test_05_real_hall_library_has_signed_experimental_curves(self): + lib=r.library();self.assertGreaterEqual(len(lib),50) + for row in lib.values(): + self.assertTrue(row['source']);self.assertEqual(row['evidence'],'measured_literature') + for key,value in [('hall_coefficient','value_m3_C'),('resistivity','value_ohm_m')]: + self.assertGreaterEqual(len(row['curves'][key]),2);self.assertTrue(all(math.isfinite(p[value]) for p in row['curves'][key])) + self.assertGreater(r.transport(lib['starry_40927'],300)['hall_coefficient_m3_c'],0);self.assertLess(r.transport(lib['starry_36130'],300)['hall_coefficient_m3_c'],0) + def test_06_paper_temperature_domain_is_stricter_than_raw_grid(self): + p=r.library()['starry_40927'];self.assertIsNone(r.transport(p,299));self.assertIsNotNone(r.transport(p,300));h=make();remove(h);self.reject(h,'sample.load',**dict(r.SAMPLE_EXAMPLE,initial_temperature_k=299)) + def test_07_external_field_target_slew_and_response_are_not_instant(self): + h=make(field={'slew_t_s':.1,'response_tau_s':1.},warm=False);self.assertEqual(h.field_actual,0.);h.step(2);self.assertAlmostEqual(h.field_actual,.2,14);h.step(3);self.assertAlmostEqual(h.field_actual,.5-.1*math.exp(-1),14);self.reject(h,'field.set_target',field_t=3.) + def test_08_external_field_continues_when_m91_off(self): + h=make();h.invoke('power.set',enabled=False);h.invoke('field.set_target',field_t=-.5);before=h.field_actual;h.step(.2);self.assertLess(h.field_actual,before);self.assertFalse(h.power);h.step(3.);self.assertAlmostEqual(h.field_actual,-.5,6) + def test_09_vdp_forward_identity_all_asymmetries(self): + for Rs in [.1,1.,1e6]: + for u in [-5.,-.2,0.,.2,5.]: + a,b=r.vdp_resistances(Rs,u);self.assertAlmostEqual(math.exp(-math.pi*a/Rs)+math.exp(-math.pi*b/Rs),1.,14) + def test_10_external_inverse_uses_observations_without_sample(self): + h=Checked();a=dict(r.ANALYSIS_EXAMPLE,hall_factor=1.4);o=h.invoke('analysis.hall_vdp',**a);self.assertAlmostEqual(o['hall_coefficient_m3_c'],.001,12);self.assertAlmostEqual(o['vdp_resistance_a_ohm'],.2,12);self.assertAlmostEqual(o['vdp_resistance_b_ohm'],.3,12);self.assertAlmostEqual(math.exp(-math.pi*.2/o['sheet_resistance_ohm'])+math.exp(-math.pi*.3/o['sheet_resistance_ohm']),1.,12);self.assertAlmostEqual(o['assumed_single_carrier_density_m3']/o['hall_carrier_density_m3'],1.4);self.assertIsNone(h.sample) + def test_11_positive_hall_actual_reversal_fit(self): + h=make();o,ops=paired(h);truth=r.transport(h.record,300);self.assertLess(abs(o['hall_coefficient_m3_c']/truth['hall_coefficient_m3_c']-1),2e-5);self.assertLess(abs(o['resistivity_ohm_m']/truth['resistivity_ohm_m']-1),1e-5);self.assertEqual(o['carrier_type'],'hole_like_positive_hall');self.assertEqual([len(x['rows']) for x in ops],[9,9]);self.budget(h) + def test_12_negative_hall_is_measured_sign_not_seebeck_guess(self): + h=make(sample={'reference_id':'starry_36130'});o,_=paired(h);truth=r.transport(h.record,300);self.assertLess(o['hall_coefficient_m3_c'],0);self.assertLess(abs(o['hall_coefficient_m3_c']/truth['hall_coefficient_m3_c']-1),2e-4);self.assertLess(abs(o['resistivity_ohm_m']/truth['resistivity_ohm_m']-1),2e-5);self.assertEqual(o['carrier_type'],'electron_like_negative_hall');self.budget(h) + def test_13_reversal_removes_offsets_misalignment_and_linear_drift(self): + h=make(plant={'voltage_offset_a_v':5e-5,'voltage_offset_b_v':-4e-5,'voltage_offset_hall_v':8e-5,'voltage_drift_v_s':5e-8,'hall_misalignment_fraction':.3});o,_=paired(h);truth=r.transport(h.record,300);self.assertLess(abs(o['hall_coefficient_m3_c']/truth['hall_coefficient_m3_c']-1),2e-4);self.assertLess(o['fit_rms_v'],1e-9) + def test_14_microamp_range_programs_ten_picoamp(self): + h=make(method={'current_range_a':1e-6,'current_a':1e-11});self.assertAlmostEqual(h.programmed_current,1e-11,25);o=finish(h);self.assertEqual(o['phase'],'succeeded');self.assertAlmostEqual(o['rows'][1]['current_a'],1e-11,25) + def test_15_all_six_current_ranges_have_declared_resolution(self): + h=make() + for full in r.CURRENT_RANGES: + h.invoke('method.configure',**dict(r.METHOD_EXAMPLE,current_range_a=full,current_a=3.2e-5*full));self.assertAlmostEqual(h.programmed_current,3e-5*full,20) + self.reject(h,'method.configure',**dict(r.METHOD_EXAMPLE,current_range_a=1e-6,current_a=1.1e-6)) + def test_16_millivolt_range_accepts_microvolt_not_minimum_threshold(self): + h=make();o=finish(h);self.assertEqual(o['phase'],'succeeded');self.assertTrue(all(00));self.assertTrue(np.all(np.isfinite(y))) + if key!='seebeck':self.assertTrue(np.all(y>0)) + value=r.transport(lib['tematdb_00009'],305.,305.);self.assertAlmostEqual(value['seebeck_v_k'],1.8780087880629725e-4,13);self.assertAlmostEqual(value['resistivity_ohm_m'],8.038874346063209e-6,14) + def test_04_seebeck_is_temperature_integral(self): + row=r.library()['tematdb_00009'];t,y=r.curve_xy(row,'seebeck');hot=330.;cold=305.;expected=quad(lambda T:float(np.interp(T,t,y)),cold,hot,points=t[(t>cold)&(t s2 - 10) & (t < s2)].mean() + tau0 = m.ENG['response_time_s'][fb] + w = (t > s2 + 25) & (t < s2 + 25 + 3 * tau0) + tau = -1 / np.polyfit(t[w], np.log(np.abs(dp[w] - base)), 1)[0] + pre = dp[t < 55] + out[fb] = (tau, np.std(np.diff(pre)) / math.sqrt(2), pre.mean()) + self.assertAlmostEqual(out['high'][0], 8.0, delta=0.5) # documented: response time 8 s (63 % of the peak) + self.assertAlmostEqual(out['none'][0], 60.0, delta=4.0) + self.assertAlmostEqual(out['high'][1] / 4.184e-9, 0.15, delta=0.03) # documented: 0.15 ncal/s + self.assertLess(out['none'][1], out['high'][1]) + self.assertAlmostEqual((out['high'][2] - 5 * UC) / UC, -0.25, delta=0.03) # stirring friction lowers the baseline below the reference power + CHECKS.append(dict(check='response_noise_stirring', status='passed', tau_high_s=out['high'][0], tau_none_s=out['none'][0])) + + def test_iupac_ba_18_crown_6_and_heat_capacity(self): + dh = {} + for T in (288.15, 308.15): + r = Rig(seed=11) + inj = [dict(volume_m3=4e-10, duration_s=2.0, spacing_s=180.0)] + [dict(volume_m3=1.5e-9, duration_s=8.0, spacing_s=180.0)] * 24 + r.method(inj, T=T, pref=10.0, cell=1.0, syr=10.0) + r.prep('crown', None, {'18_crown_6': 1.0}) + r.prep('ba', None, {'ba2+': 10.0}) + r.step(2400) + r.load('crown', 'ba') + r.run('b') + res = r.an('b', control='fitted_offset') + p = pv(res) + dh[T] = p['dh'] + kd_ref = 1 / 5900.0 * 1000 * math.exp(-31420.0 / m.R_GAS * (1 / T - 1 / 298.15)) # van 't Hoff from the IUPAC values (approximate) + self.assertAlmostEqual(p['kd'] / kd_ref, 1.0, delta=0.2) + self.assertAlmostEqual(p['n'], 1.0, delta=0.03) + dcp = (dh[308.15] - dh[288.15]) / 20.0 + self.assertAlmostEqual((dh[288.15] + dh[308.15]) / 2, -31420.0, delta=1500.0) # IUPAC 2001: -31.42 kJ/mol at 298.15 K + self.assertTrue(60.0 < dcp < 190.0, dcp) # IUPAC 2001: dCp = 126 J/K/mol + CHECKS.append(dict(check='iupac_ba_crown', status='passed', dcp_j_k_mol=dcp)) + + +class Models(unittest.TestCase): + def test_competitive_displacement(self): + r = Rig(seed=5) + r.method(INJ(19), cell=0.02, syr=0.2) + r.prep('cell', ('phosphate', 20.0, 7.5), {'carbonic_anhydrase_ii': 0.02, 'sulfanilamide': 1.0}) + r.prep('az', buffer_from='cell', solutes={'acetazolamide': 0.2}) + r.load('cell', 'az') + r.run('c') + direct = pv(r.an('c', control='fitted_offset')) + comp = pv(r.an('c', model='competitive', control='fitted_offset', competitor=dict(kd_mol_m3=0.15, dh_j_mol=-33472.0, concentration_mol_m3=1.0))) + self.assertGreater(direct['kd'], 4 * 2e-5) # the weak competitor makes acetazolamide look weaker + self.assertAlmostEqual(comp['kd'] / 2e-5, 1.0, delta=0.25) # design example: KD 20 nM + self.assertAlmostEqual(comp['dh'], -50208.0, delta=2500.0) + self.assertGreater(direct['dh'], comp['dh'] + 15000.0) # apparent dH includes the displaced sulfanilamide + CHECKS.append(dict(check='competitive', status='passed', kd_mol_m3=comp['kd'])) + + def test_two_sets_and_sequential_sites(self): + r = Rig(seed=5) + r.call(r.E, 'interaction.define', interaction_id='a', model='sites', receptor='p2', ligand='l2', n=1.0, kd_mol_m3=1e-5, dh_j_mol=-40000.0, site='a') + r.call(r.E, 'interaction.define', interaction_id='b', model='sites', receptor='p2', ligand='l2', n=1.0, kd_mol_m3=5e-3, dh_j_mol=-15000.0, site='b') + r.call(r.E, 'interaction.define', interaction_id='sq', model='sequential', receptor='p3', ligand='l3', ks_mol_m3=[1e-3, 5e-2], dhs_j_mol=[-30000.0, -10000.0]) + r.stock('p2s', ('hepes', 20.0, 7.5), {'p2': 0.03}) + r.stock('l2s', ('hepes', 20.0, 7.5), {'l2': 0.6}) + r.stock('p3s', ('hepes', 20.0, 7.5), {'p3': 0.05}) + r.stock('l3s', ('hepes', 20.0, 7.5), {'l3': 1.0}) + r.method(INJ(19), cell=0.03, syr=0.6) + r.load('p2s', 'l2s') + r.run('t2') + two = pv(r.an('t2', model='two_sets_of_sites', control='fitted_offset')) + kds = sorted([(two['kd1'], two['dh1']), (two['kd2'], two['dh2'])]) + self.assertAlmostEqual(kds[0][0] / 1e-5, 1.0, delta=0.4) + self.assertAlmostEqual(kds[1][0] / 5e-3, 1.0, delta=0.4) + self.assertAlmostEqual(kds[0][1], -40000.0, delta=2500.0) + self.assertAlmostEqual(kds[1][1], -15000.0, delta=3000.0) + r.clean() + r.call(r.A, 'cleaning_tool.remove') + r.method(INJ(19), cell=0.05, syr=1.0) + r.load('p3s', 'l3s') + r.run('sq') + sq = pv(r.an('sq', model='sequential_binding_sites', sites=2, control='fitted_offset')) + self.assertAlmostEqual(sq['kd1'] / 1e-3, 1.0, delta=0.3) + self.assertAlmostEqual(sq['kd2'] / 5e-2, 1.0, delta=0.5) + self.assertAlmostEqual(sq['dh1'], -30000.0, delta=2000.0) + CHECKS.append(dict(check='two_sets_sequential', status='passed')) + + def test_dimer_dissociation(self): + r = Rig(seed=5) + r.call(r.E, 'interaction.define', interaction_id='dm', model='dimer', receptor='dimer_x', kd_mol_m3=0.1, dh_j_mol=40000.0) + r.stock('dx', ('hepes', 20.0, 7.5), {'dimer_x': 2.0}, vol=5e-7) + r.prep('buf', ('hepes', 20.0, 7.5)) + r.method(INJ(19, v=1.5e-9), cell=1e-6, syr=2.0) + r.load('buf', 'dx') + r.run('d') + res = r.an('d', model='dissociation', control='fitted_offset') + p = pv(res) + self.assertTrue(res['injections'][1]['heat_j'] > res['injections'][-1]['heat_j'] > 0) # endothermic dissociation, heats decrease + self.assertAlmostEqual(p['kd_dimer'] / 0.1, 1.0, delta=0.15) + self.assertAlmostEqual(p['dh_dissociation'], 40000.0, delta=2000.0) + CHECKS.append(dict(check='dimer_dissociation', status='passed')) + + def test_enzyme_kinetics_single_and_multiple_injection(self): + r = Rig(seed=5) + r.method([dict(volume_m3=1e-8, duration_s=30.0, spacing_s=7200.0)], pref=10.0, cell=3.3e-5, syr=262.0) + r.prep('inv', ('acetate', 100.0, 5.65), {'invertase': 3.3e-5}) + r.prep('suc', buffer_from='inv', solutes={'sucrose': 262.0}) + r.load('inv', 'suc') + r.run('sim') + sim = r.an('sim', model='enzyme_kinetics_single', exclude_injections=[]) + p = pv(sim) + self.assertAlmostEqual(p['dh'], -14950.0, delta=0.06 * 14950.0) # IUPAC 2001: sucrose hydrolysis -14.95 kJ/mol (+ sucrose dilution) + self.assertAlmostEqual(p['km'] / 25.0, 1.0, delta=0.35) + self.assertAlmostEqual(p['kcat'] / 600.0, 1.0, delta=0.35) + r2 = Rig(seed=6) + r2.method([dict(volume_m3=2e-9, duration_s=4.0, spacing_s=240.0)] * 10, cell=1e-6, syr=200.0) + r2.prep('inv', ('acetate', 100.0, 5.65), {'invertase': 1e-6}) + r2.prep('suc', buffer_from='inv', solutes={'sucrose': 200.0}) + r2.load('inv', 'suc') + r2.run('mim') + r2.call(r2.A, 'data.analyze', 'ENZYME_DH_REQUIRED', experiment_id='mim', model='enzyme_kinetics_multiple') + mim = pv(r2.an('mim', model='enzyme_kinetics_multiple', exclude_injections=[], enzyme_dh_j_mol=-14950.0)) + self.assertAlmostEqual(mim['km'] / 25.0, 1.0, delta=0.35) + self.assertAlmostEqual(mim['kcat'] / 600.0, 1.0, delta=0.3) + CHECKS.append(dict(check='enzyme_kinetics', status='passed', sim=p, mim=mim)) + + def test_proton_linkage_buffer_ionization_heat(self): + dh = {} + for b in ('tris', 'phosphate'): + r = Rig(seed=9) + r.call(r.E, 'interaction.define', interaction_id='ph1', model='sites', receptor='p4', ligand='l4', n=1.0, kd_mol_m3=1e-3, dh_j_mol=-20000.0, n_h=1.0) + r.stock('p4', (b, 50.0, 7.5), {'p4': 0.05}) + r.stock('l4', (b, 50.0, 7.5), {'l4': 0.6}, vol=5e-7) + r.method(INJ(19), cell=0.05, syr=0.6) + r.load('p4', 'l4') + r.run('x') + dh[b] = pv(r.an('x', control='fitted_offset'))['dh'] + expected = -(47450.0 - 3600.0) # released protons taken up by Tris vs phosphate (Goldberg 2002 dH_ion) + self.assertAlmostEqual((dh['tris'] - dh['phosphate']) / expected, 1.0, delta=0.12) + CHECKS.append(dict(check='proton_linkage', status='passed', dh_tris=dh['tris'], dh_phosphate=dh['phosphate'])) + + def test_propanol_dilution_heat(self): + r = Rig(seed=5) + r.method(INJ(8, sp=120.0), cell=1e-6, syr=100.0) + r.prep('w', None, None) + r.call(r.E, 'stock.provide', stock_id='prop', volume_m3=1e-6, buffer=None, components=[dict(species_id='propan_1_ol', concentration_mol_m3=100.0)]) + r.load('w', 'prop') + r.run('p') + res = r.an('p', control='none') + hxx, hxxx = m._dilution_params('propan_1_ol', 298.15) + expected = -(hxx * 0.1 + hxxx * 0.01) * 2e-9 * 100.0 # to infinite dilution (IUPAC virial coefficients) + self.assertAlmostEqual(res['injections'][1]['heat_j'] / expected, 1.0, delta=0.08) + CHECKS.append(dict(check='propanol_dilution', status='passed', heat_ucal=res['injections'][1]['heat_j'] / UC)) + + +class Artifacts(unittest.TestCase): + def test_buffer_mismatch_and_matched_control(self): + r = Rig(seed=5) + r.method(INJ(8), cell=1e-3, syr=1e-3, pref=10.0) + r.prep('tris', ('tris', 20.0, 8.0), vol=2e-6) + r.prep('hep', ('hepes', 20.0, 7.0)) + r.prep('tris2', buffer_from='tris') + r.load('tris', 'hep') + r.run('mm') + mis = r.an('mm') + self.assertLess(mis['injections'][2]['heat_j'] / UC, -50.0) # HEPES releases protons to Tris + self.assertIn('Possible Buffer Mismatch', mis['bin_comments']) + r.clean(cell_method='none', syringe_method='rinse') # otherwise the HEPES film left in the syringe contaminates the control + r.load('tris', 'tris2') + r.run('ok') + ok = r.an('ok') + self.assertLess(max(abs(i['heat_j']) for i in ok['injections'][1:]) / UC, 0.2) + ctl = r.an('mm', control='experiment', control_experiment_id='ok') + self.assertAlmostEqual(ctl['injections'][2]['heat_j'], mis['injections'][2]['heat_j'] - ok['injections'][2]['heat_j'], places=12) + CHECKS.append(dict(check='buffer_mismatch', status='passed')) + + def test_methanol_residue_after_interrupted_drying(self): + heats = {} + for stop in (None, 400.0): + r = Rig(seed=5) + op = r.clean(cell_method='none', syringe_method='rinse', stop_after=stop) + self.assertEqual(op['phase'], 'succeeded' if stop is None else 'cancelled') + self.assertEqual(r.v('truth.syringe_residue'), 'none' if stop is None else 'methanol') + r.method(INJ(5, sp=120.0), cell=1e-6, syr=1e-6) + r.prep('w', None, None) + r.prep('w2', None, None) + r.load('w', 'w2') + r.run('ww') + heats[stop] = [i['heat_j'] for i in r.an('ww')['injections'][1:]] + self.assertLess(max(abs(h) for h in heats[None]) / UC, 0.1) # water into water: small blank heats + self.assertLess(max(heats[400.0]) / UC, -10.0) # manual: residual methanol gives consistently large peaks + CHECKS.append(dict(check='methanol_residue', status='passed')) + + def test_reference_underfill_low_reference_power_spacing_and_poor_load(self): + r = Rig(seed=5, age=60 * 86400.0) + r.ca_edta(inj=INJ(10), eid='old_ref') + self.assertIn('High Initial Baseline', r.an('old_ref', control='fitted_offset')['bin_comments']) + r.away() + r.call(r.A, 'reference.refill') + self.assertAlmostEqual(r.v('truth.reference_volume_m3'), m.ENG['reference_full_m3']) + r2 = Rig(seed=5) + r2.ca_edta(inj=INJ(10), eid='lo', pref=0.5) + self.assertIn('Data Below Minimum', r2.an('lo', control='fitted_offset')['bin_comments']) + r3 = Rig(seed=5) + r3.call(r3.A, 'method.set', temperature_k=298.15, reference_power_w=5 * UC, feedback='none', stir_rate_hz=12.5, initial_delay_s=60.0, injections=INJ(12, sp=20.0), + cell_concentration_mol_m3=0.1, syringe_concentration_mol_m3=1.0) + r3.prep('edta', ('mes', 10.0, 5.6), {'edta': 0.1}) + r3.prep('ca', buffer_from='edta', solutes={'ca2+': 1.0}) + r3.load('edta', 'ca') + r3.run('sp') + self.assertIn('Injection Spacing Too Short', r3.an('sp', control='fitted_offset')['bin_comments']) + r4 = Rig(seed=5) + r4.method(INJ(10)) + r4.prep('edta', ('mes', 10.0, 5.6), {'edta': 0.1}) + r4.prep('ca', buffer_from='edta', solutes={'ca2+': 1.0}) + r4.away() + res = r4.call(r4.A, 'cell.load', solution_id='edta', volume_m3=1.5e-7)['result'] + self.assertIn('UNDERFILLED', res['warnings']) + r4.load_syringe('ca') + r4.move('cell') + r4.run('uf') + self.assertIn('Possible Poor Load', r4.an('uf', control='fitted_offset')['bin_comments']) + CHECKS.append(dict(check='bin_comments', status='passed')) + + def test_outgassing_of_non_degassed_sample(self): + dev = {} + for deg in (True, False): + r = Rig(seed=5) + r.method(INJ(6, sp=300.0), T=308.15) + r.prep('edta', ('mes', 10.0, 5.6), {'edta': 0.1}, degas=deg) + r.prep('ca', buffer_from='edta', solutes={'ca2+': 1.0}, degas=deg) + r.away() + res = r.call(r.A, 'cell.load', solution_id='edta', volume_m3=3e-7)['result'] + self.assertEqual('NOT_DEGASSED' in res['warnings'], not deg) + r.load_syringe('ca') + r.move('cell') + r.run('og') + e = r.R.experiments['og'] + t, dp = np.array(e['t']), np.array(e['dp']) + quiet = np.zeros(len(t), bool) + for i in e['injections']: + quiet |= (t > i['start_s'] + 60) & (t < i['start_s'] + 300) + x = dp[quiet] + dev[deg] = float(np.max(np.abs(x - np.median(x)))) + self.assertLess(dev[True], 0.004 * UC) + self.assertGreater(dev[False], 0.01 * UC) + CHECKS.append(dict(check='outgassing', status='passed')) + + def test_syringe_bubble_from_short_tube_and_purge(self): + r = Rig(seed=5) + r.method(INJ(8)) + r.prep('edta', ('mes', 10.0, 5.6), {'edta': 0.1}) + r.prep('ca', buffer_from='edta', solutes={'ca2+': 1.0}) + r.away() + r.call(r.A, 'cell.load', solution_id='edta', volume_m3=3e-7, rinse=True) + r.load_syringe('ca', tube=4.5e-8) + self.assertGreater(r.v('truth.syringe_bubble_m3'), 5e-10) + r.call(r.A, 'tube.remove') + r.call(r.A, 'tube.place', solution_id='ca', volume_m3=6e-8) + r.call(r.A, 'fpa.attach') + r.move('load') + op = r.call(r.A, 'syringe.purge_refill')['operation_id'] + r.until(lambda: r.R.operations[op]['phase'] != 'running') + self.assertEqual(r.v('truth.syringe_bubble_m3'), 0.0) + r.move('rest') + r.call(r.A, 'fpa.detach') + r.move('cell') + r.run('b') + vols = r.R.experiments['b']['truth']['volumes'] + self.assertAlmostEqual(vols[1] / 2e-9, 1.0, delta=0.02) + CHECKS.append(dict(check='syringe_bubble_purge', status='passed')) + + def test_carryover_rinse_and_cleaning(self): + r = Rig(seed=5) + r.ca_edta(inj=INJ(5), eid='a') + r.away() + r.call(r.A, 'cell.load', solution_id='edta', volume_m3=3e-7, rinse=False) + no_rinse = r.v('truth.cell_contamination_fraction') + r.call(r.A, 'cell.load', solution_id='edta', volume_m3=3e-7, rinse=True) + self.assertAlmostEqual(no_rinse, m.ENG['cell_residual_m3'] / m.V0) + self.assertAlmostEqual(r.v('truth.cell_contamination_fraction'), no_rinse * m.ENG['rinse_residual_factor']) + # the syringe keeps a film of the previous titrant unless it is cleaned + r.prep('w', None, None) + r.load_syringe('w') + self.assertGreater(r.v('truth.syringe_species_mol_m3').get('ca2+', 0.0), 0.01) + r.clean(cell_method='wash', syringe_method='rinse') + r.call(r.A, 'cleaning_tool.remove') + r.load_syringe('w') + self.assertLess(r.v('truth.syringe_species_mol_m3').get('ca2+', 0.0), 1e-3) + CHECKS.append(dict(check='carryover', status='passed')) + + def test_wash_module_bottles_overflow_and_no_flow(self): + r = Rig(seed=5, warm=10.0) + codes = [] + for _ in range(60): + op = r.clean(cell_method='wash', syringe_method='none') + if op['phase'] == 'failed': + codes.append(op['error']) + if op['error'] == 'NO_FLOW': + r.call(r.A, 'wash.refill', bottle='water') + else: + break + self.assertIn('NO_FLOW', codes) + self.assertEqual(codes[-1], 'WASH_OVERFLOW') + self.assertFalse(r.v('wash.pump_ok')) + self.assertIn('WASH_PUMP_SHUTDOWN', r.v('errors.active')) + r.call(r.A, 'clean.start', 'WASH_PUMP_SHUTDOWN', cell_method='wash', syringe_method='none') + r.call(r.A, 'wash.empty_waste') + r.call(r.A, 'wash.empty_overflow') + self.assertTrue(r.v('wash.pump_ok')) + led = r.call(r.E, 'ledger.read')['result']['ledger'] + self.assertAlmostEqual(led['waste_added_m3'] + led['overflow_added_m3'], led['water_used_m3'] + led['detergent_used_m3'] + led['methanol_used_m3'] + + sum(0 for _ in ()), delta=1e-6) + CHECKS.append(dict(check='wash_module', status='passed', failures=codes)) + + def test_power_loss_interrupts_run(self): + r = Rig(seed=5) + r.method(INJ(10)) + r.prep('edta', ('mes', 10.0, 5.6), {'edta': 0.1}) + r.prep('ca', buffer_from='edta', solutes={'ca2+': 1.0}) + r.load('edta', 'ca') + op = r.call(r.A, 'run.start', experiment_id='p')['operation_id'] + r.until(lambda: r.R.run is not None and r.R.run['inj'] >= 2) + r.call(r.E, 'fault.inject', fault='power_loss', active=True) + self.assertEqual(r.A.poll(op)['status'], 'failed') + self.assertEqual(r.A.poll(op)['result']['error'], 'POWER_OFF_INTERRUPT') + self.assertIsNone(r.v('dp.power_w')) + self.assertFalse(r.v('lamp.status')) + r.call(r.E, 'fault.inject', fault='power_loss', active=False) + self.assertTrue(r.v('power.enabled')) + CHECKS.append(dict(check='power_loss', status='passed')) + + +class ReviewRound1(unittest.TestCase): + """Regression tests for the round-1 runtime review (F-01 / F-02 / F-03 / F-05 / F-06 / F-07).""" + + def _ramp(self, rest, kon=None, seed=21): + r = Rig(seed=seed, warm=1800.0) + if kon: + r.call(r.E, 'interaction.define', interaction_id='slow', model='sites', receptor='p_s', ligand='l_s', n=1.0, kd_mol_m3=1e-3, dh_j_mol=-40000.0, + kon_m3_mol_s=kon) + r.stock('cell', ('tris', 50.0, 8.0), {'p_s': 0.05}) + r.stock('syr', ('tris', 50.0, 8.0), {'l_s': 0.5}, vol=5e-7) + cell, syr = 'cell', 'syr' + else: + r.prep('cell', ('tris', 50.0, 8.0)) + r.prep('syr', buffer_from='cell') + cell, syr = 'cell', 'syr' + r.load(cell, syr) + if rest: + r.move('rest') + h0 = r.R.ledger()['chemical_heat_j'] + r.call(r.A, 'temperature.set', temperature_k=318.15) + r.step(3600) + return r, r.R.ledger()['chemical_heat_j'] - h0 + + def test_temperature_ramp_books_no_reaction_heat(self): + _, in_cell = self._ramp(rest=False) + _, at_rest = self._ramp(rest=True) + self.assertLess(abs(in_cell) / UC, 0.05) # F-01: the stored-enthalpy change with temperature is sensible heat + self.assertLess(abs(at_rest) / UC, 0.05) + CHECKS.append(dict(check='ramp_no_reaction_heat', status='passed', in_cell_ucal=in_cell / UC, at_rest_ucal=at_rest / UC)) + + def test_slow_binding_heat_bounded_during_warm_up(self): + r, heat = self._ramp(rest=False, kon=1.0) + leaked = r.R.syr['leak'] # at most the leaked ligand can bind: 0.5 mol/m3 x leak x 40 kJ/mol + bound = 0.5 * leaked * 40000.0 + self.assertLess(abs(heat), bound * 1.05 + 0.05 * UC) # F-02: no heat from nothing while the temperature moves + CHECKS.append(dict(check='slow_binding_bounded', status='passed', heat_ucal=heat / UC, bound_ucal=bound / UC)) + + def test_equilibrium_follows_temperature_without_mixing(self): + r = Rig(seed=22, warm=1800.0) + r.prep('crown', None, {'18_crown_6': 5.0}) + r.prep('ba', None, {'ba2+': 5.0}) + r.prep('mix', None, None, vol=1e-6) + r.call(r.A, 'solution.prepare', solution_id='cb', volume_m3=1e-6, sources=[dict(source_id='crown', volume_m3=5e-7), dict(source_id='ba', volume_m3=5e-7)]) + r.away() + r.call(r.A, 'cell.load', solution_id='cb', volume_m3=3e-7) + r.step(1800) + b298 = r.v('truth.cell_bound_mol_m3')['ba_18crown6'] + r.call(r.A, 'temperature.set', temperature_k=318.15) + r.step(3600) + b318 = r.v('truth.cell_bound_mol_m3')['ba_18crown6'] + ka, _ = m._k_at(1 / 5900.0, -31420.0, 126.0, 298.15, r.v('truth.cell_content_temperature_k')) + sp = r.v('truth.cell_species_mol_m3') + Mt, Lt = sp['18_crown_6'] / 1000.0, sp['ba2+'] / 1000.0 + b = Mt + Lt + 1 / ka + eq = (b - math.sqrt(b * b - 4 * Mt * Lt)) / 2 * 1000.0 + self.assertLess(b318, b298) # F-03: exothermic binding weakens at 318 K and the cell follows + self.assertAlmostEqual(b318 / eq, 1.0, delta=0.01) + CHECKS.append(dict(check='equilibrium_follows_temperature', status='passed', bound_298=b298, bound_318=b318, eq_318=eq)) + + def test_passive_feedback_first_injection_not_distorted(self): + heats = {} + for fb in ('high', 'none'): + r = Rig(seed=23) + inj = [dict(volume_m3=4e-10, duration_s=0.8, spacing_s=400.0)] + [dict(volume_m3=2e-9, duration_s=4.0, spacing_s=400.0)] * 2 + r.method(inj, fb=fb) + r.prep('edta', ('mes', 10.0, 5.6), {'edta': 0.1}) + r.prep('ca', buffer_from='edta', solutes={'ca2+': 1.0}) + r.load('edta', 'ca') + r.run('e') + heats[fb] = [i['heat_j'] for i in r.an('e', exclude_injections=[])['injections']] + self.assertAlmostEqual(heats['none'][0] / heats['high'][0], 1.0, delta=0.15) # F-05: the stirring-start transient has settled + self.assertAlmostEqual(heats['none'][1] / heats['high'][1], 1.0, delta=0.05) + CHECKS.append(dict(check='passive_first_injection', status='passed', ratio=heats['none'][0] / heats['high'][0])) + + def test_syringe_bubble_conserves_volume_and_injects_air_last(self): + r = Rig(seed=24) + r.method(INJ(18)) + r.prep('edta', ('mes', 10.0, 5.6), {'edta': 0.1}) + r.prep('ca', buffer_from='edta', solutes={'ca2+': 1.0}) + r.away() + r.call(r.A, 'cell.load', solution_id='edta', volume_m3=3e-7, rinse=True) + r.load_syringe('ca', tube=3.0e-8) + liquid, bubble = r.v('truth.syringe_liquid_m3'), r.v('truth.syringe_bubble_m3') + self.assertAlmostEqual(liquid + bubble, m.V_SYR, delta=1e-12) + r.move('cell') + r.run('b') + vols = r.R.experiments['b']['truth']['volumes'] + self.assertLessEqual(sum(vols), liquid + 1e-12) # F-06: no more liquid delivered than loaded + self.assertAlmostEqual(vols[1] / 2e-9, 1.0, delta=0.05) # delivery follows the plunger while liquid remains + self.assertTrue(r.v('truth.cell_bubble')) # the air is injected last (cell bubble) + left = r.v('truth.syringe_liquid_m3') + r.v('truth.syringe_bubble_m3') + cap = (1 - r.v('syringe.plunger_position_m') / m.PLUNGER_STROKE) * m.V_SYR + self.assertLessEqual(left, cap + 1e-12) + res = r.an('b', control='fitted_offset') + self.assertTrue({'Possible Poor Load', 'Check Baseline'} & set(res['bin_comments']) or res['bin'] == 'Check data', res['bin_comments']) + CHECKS.append(dict(check='bubble_conservation', status='passed', delivered_m3=sum(vols), liquid_m3=liquid)) + + def test_ba_crown_with_control_subtraction(self): + dh = {} + for T in (288.15, 308.15): + r = Rig(seed=25) + inj = [dict(volume_m3=4e-10, duration_s=2.0, spacing_s=180.0)] + [dict(volume_m3=1.5e-9, duration_s=8.0, spacing_s=180.0)] * 24 + r.method(inj, T=T, pref=10.0, cell=1.0, syr=10.0) + r.prep('crown', None, {'18_crown_6': 1.0}) + r.prep('ba', None, {'ba2+': 10.0}, vol=2e-6) + r.prep('w', None, None) + r.step(2400) + r.load('w', 'ba') + r.run('ctl') + r.clean(cell_method='rinse', syringe_method='rinse') + r.call(r.A, 'cleaning_tool.remove') + r.load('crown', 'ba') + r.run('b') + dh[T] = pv(r.an('b', control='experiment', control_experiment_id='ctl'))['dh'] + dcp = (dh[308.15] - dh[288.15]) / 20.0 + self.assertTrue(95.0 < dcp < 165.0, dcp) # F-07: IUPAC 126 J/K/mol once the BaCl2 dilution is subtracted + CHECKS.append(dict(check='ba_crown_control_dcp', status='passed', dcp_j_k_mol=dcp)) + + +class ReviewRound2(unittest.TestCase): + """Regression tests for the round-2 runtime review (F2-01 / F2-02 / F2-03 / F2-05 / F2-06 / F2-07 / F2-08).""" + + def test_fix_bounds_and_models(self): + r = Rig(seed=31) + r.ca_edta(inj=INJ(8), eid='e') + r.call(r.A, 'data.analyze', 'INVALID_ARGUMENT', experiment_id='e', model='one_set_of_sites', fix=dict(kd=0.0)) # F2-01: schema bounds + r.call(r.A, 'data.analyze', 'INVALID_ARGUMENT', experiment_id='e', model='two_sets_of_sites', fix=dict(kd2=-1.0)) + r.call(r.A, 'data.analyze', 'INVALID_ARGUMENT', experiment_id='e', model='sequential_binding_sites', fix=dict(dh=-1e4)) # fix not applied there + r.call(r.A, 'data.analyze', 'INVALID_ARGUMENT', experiment_id='e', model='one_set_of_sites', fix=dict(n2=1.0)) + p = pv(r.an('e', fix=dict(n=1.0), control='fitted_offset')) + self.assertEqual(p['n'], 1.0) + CHECKS.append(dict(check='fix_bounds', status='passed')) + + def test_temperature_set_effects_declared_with_a_complex(self): + r = Rig(seed=32) + r.method(INJ(4)) + r.prep('edta', ('mes', 10.0, 5.6), {'edta': 0.1}) + r.prep('ca', buffer_from='edta', solutes={'ca2+': 1.0}) + r.call(r.A, 'solution.prepare', solution_id='mix', volume_m3=1e-6, sources=[dict(source_id='edta', volume_m3=5e-7), dict(source_id='ca', volume_m3=5e-8)]) + r.away() + r.call(r.A, 'cell.load', solution_id='mix', volume_m3=3e-7) + r.step(1800) + ZDeclaredEffects._check(self, r, 'temperature.set', dict(temperature_k=310.15)) # F2-07: pH and bound amounts follow the temperature + CHECKS.append(dict(check='temperature_set_declared', status='passed')) + + def test_kinetic_complex_relaxes_after_a_temperature_change(self): + r = Rig(seed=33, warm=1800.0) + r.call(r.E, 'interaction.define', interaction_id='slow2', model='sites', receptor='p_k', ligand='l_k', n=1.0, kd_mol_m3=1e-3, dh_j_mol=-40000.0, + kon_m3_mol_s=1.0, temperature_k=298.15) + r.stock('pk', ('hepes', 20.0, 7.5), {'p_k': 0.05, 'l_k': 0.05}) + r.away() + r.call(r.A, 'cell.load', solution_id='pk', volume_m3=3e-7) + r.step(3600) + b0 = r.v('truth.cell_bound_mol_m3')['slow2'] + r.call(r.A, 'temperature.set', temperature_k=313.15) + r.step(3600) + b1 = r.v('truth.cell_bound_mol_m3')['slow2'] + info = r.R.cell['eq'] + self.assertLess(b1, b0) # F2-03: the slow complex relaxes at rest + self.assertAlmostEqual(b1 / (info['kin_eq']['slow2'] * 1000.0), 1.0, delta=0.02) + CHECKS.append(dict(check='kinetic_relaxation_after_ramp', status='passed', bound_298=b0, bound_313=b1)) + + def test_bubble_keeps_the_programmed_spacing(self): + r = Rig(seed=34) + r.method(INJ(8, sp=40.0)) + r.prep('edta', ('mes', 10.0, 5.6), {'edta': 0.1}) + r.prep('ca', buffer_from='edta', solutes={'ca2+': 1.0}) + r.away() + r.call(r.A, 'cell.load', solution_id='edta', volume_m3=3e-7, rinse=True) + r.load_syringe('ca', tube=3.0e-8) # ~11 uL of air in the syringe + self.assertGreater(r.v('truth.syringe_bubble_m3'), 5e-9) + r.move('cell') + r.run('b') + st = [i['start_s'] for i in r.R.experiments['b']['injections']] + self.assertTrue(all(abs((b - a) - 40.0) < 1e-6 for a, b in zip(st, st[1:])), st) # F2-06 + CHECKS.append(dict(check='bubble_spacing', status='passed')) + + def test_passive_feedback_short_spacing_flagged(self): + r = Rig(seed=35) + r.call(r.A, 'method.set', temperature_k=298.15, reference_power_w=5 * UC, feedback='none', stir_rate_hz=12.5, initial_delay_s=60.0, injections=INJ(12, sp=150.0), + cell_concentration_mol_m3=0.1, syringe_concentration_mol_m3=1.0) + r.prep('edta', ('mes', 10.0, 5.6), {'edta': 0.1}) + r.prep('ca', buffer_from='edta', solutes={'ca2+': 1.0}) + r.load('edta', 'ca') + r.run('n') + self.assertIn('Injection Spacing Too Short', r.an('n', control='fitted_offset')['bin_comments']) # F2-08: 2.5 response times + CHECKS.append(dict(check='passive_spacing_flag', status='passed')) + + def test_first_injection_tip_heat_booked(self): + r = Rig(seed=36) + r.ca_edta(inj=INJ(4), eid='t') + tr = r.R.experiments['t']['truth'] + led = r.R.ledger()['chemical_heat_j'] + self.assertAlmostEqual(sum(tr['heat_j']) / led, 1.0, delta=0.05) # F2-02: heats per injection add up to the booked chemical heat + self.assertGreater(tr['heat_j'][0], 0.0) + CHECKS.append(dict(check='tip_heat', status='passed')) + + +class ReviewRound3(unittest.TestCase): + """Regression tests for the round-3 runtime review (F3-01..F3-05, F2-02 kinetic slug).""" + + def test_clean_dilution_run_has_no_poor_load_and_aligned_starts(self): + r = Rig(seed=41) + r.method(INJ(12, sp=120.0), cell=1e-6, syr=100.0) + r.prep('w', None, None) + r.call(r.E, 'stock.provide', stock_id='prop', volume_m3=1e-6, buffer=None, components=[dict(species_id='propan_1_ol', concentration_mol_m3=100.0)]) + r.load('w', 'prop') + r.run('p') + st = [i['start_s'] for i in r.R.experiments['p']['injections']] + self.assertTrue(all(x == round(x, 6) for x in st), st) # F3-01: on the 1e-6 s grid of the samples + self.assertNotIn('Possible Poor Load', r.an('p')['bin_comments']) + CHECKS.append(dict(check='aligned_starts_no_false_poor_load', status='passed')) + + def test_passive_long_spacing_not_flagged(self): + r = Rig(seed=42) + r.call(r.A, 'method.set', temperature_k=298.15, reference_power_w=5 * UC, feedback='none', stir_rate_hz=12.5, initial_delay_s=60.0, injections=INJ(18, sp=300.0), + cell_concentration_mol_m3=0.1, syringe_concentration_mol_m3=1.0) + r.prep('edta', ('mes', 10.0, 5.6), {'edta': 0.1}) + r.prep('ca', buffer_from='edta', solutes={'ca2+': 1.0}) + r.load('edta', 'ca') + r.run('n') + self.assertNotIn('Injection Spacing Too Short', r.an('n', control='fitted_offset')['bin_comments']) # F3-02: 5 response times + CHECKS.append(dict(check='passive_long_spacing', status='passed')) + + def test_fix_kd_range_and_offset_control(self): + r = Rig(seed=43) + r.ca_edta(inj=INJ(8), eid='e') + r.call(r.A, 'data.analyze', 'INVALID_ARGUMENT', experiment_id='e', model='one_set_of_sites', fix=dict(kd=5e-12)) # F3-03 + r.call(r.A, 'data.analyze', 'INVALID_ARGUMENT', experiment_id='e', model='one_set_of_sites', fix=dict(offset=-5000.0), control='none') # F3-04 + p = pv(r.an('e', fix=dict(offset=-5000.0), control='fitted_offset')) + self.assertEqual(p['offset'], -5000.0) + CHECKS.append(dict(check='fix_kd_offset', status='passed')) + + def test_bubble_volume_expelled_at_the_run_end(self): + r = Rig(seed=44) + inj = [dict(volume_m3=4e-10, duration_s=0.8, spacing_s=60.0)] + [dict(volume_m3=2e-9, duration_s=4.0, spacing_s=60.0)] * 7 + [dict(volume_m3=2e-9, duration_s=4.0, spacing_s=4.0)] + r.method(inj) + r.prep('edta', ('mes', 10.0, 5.6), {'edta': 0.1}) + r.prep('ca', buffer_from='edta', solutes={'ca2+': 1.0}) + r.away() + r.call(r.A, 'cell.load', solution_id='edta', volume_m3=3e-7, rinse=True) + r.load_syringe('ca', tube=3.0e-8) + r.move('cell') + r.run('b') + left = r.v('truth.syringe_liquid_m3') + r.v('truth.syringe_bubble_m3') + cap = (1 - r.v('syringe.plunger_position_m') / m.PLUNGER_STROKE) * m.V_SYR + self.assertLessEqual(left, cap + 1e-12) # F3-05: nothing left beyond the free volume + self.assertAlmostEqual(r.R.experiments['b']['truth']['volumes'][-1] / 2e-9, 1.0, delta=0.02) + CHECKS.append(dict(check='bubble_flush_at_end', status='passed')) + + def test_preformed_slow_complex_in_the_syringe_only_dissociates(self): + heats = {} + for kon in (None, 0.1): + r = Rig(seed=45) + a = dict(interaction_id='pc', model='sites', receptor='p_c', ligand='l_c', n=1.0, kd_mol_m3=5e-3, dh_j_mol=-40000.0) + if kon: + a['kon_m3_mol_s'] = kon + r.call(r.E, 'interaction.define', **a) + r.stock('cell', ('hepes', 20.0, 7.5), {}) + r.stock('syr', ('hepes', 20.0, 7.5), {'p_c': 0.2, 'l_c': 0.2}, vol=5e-7) + r.method(INJ(4, sp=600.0), cell=1e-6, syr=0.2) + r.load('cell', 'syr') + r.run('d') + heats[kon] = [i['heat_j'] for i in r.an('d', exclude_injections=[])['injections']] + self.assertTrue(all(h > 0 for h in heats[None][1:])) # dilution of the complex: endothermic dissociation + self.assertTrue(all(h > -0.02 * UC for h in heats[0.1][1:]), heats[0.1]) # F2-02: the slow complex only dissociates (no exothermic re-formation) + self.assertLessEqual(sum(heats[0.1][1:]), sum(heats[None][1:]) * 1.05) + CHECKS.append(dict(check='slow_complex_dissociation', status='passed', instant=heats[None], slow=heats[0.1])) + + +# ---------------------------------------------------------------- workflow preconditions +class Workflow(unittest.TestCase): + def test_load_workflow_preconditions(self): + r = Rig(seed=5, warm=10.0) + r.prep('edta', ('mes', 10.0, 5.6), {'edta': 0.1}) + r.prep('ca', buffer_from='edta', solutes={'ca2+': 1.0}, vol=5e-7) + r.call(r.A, 'cell.load', 'PIPETTE_IN_CELL', solution_id='edta', volume_m3=3e-7) + r.call(r.A, 'fpa.attach', 'PIPETTE_IN_CELL') + r.call(r.A, 'run.start', 'NO_METHOD', experiment_id='x') + r.method(INJ(4)) + r.call(r.A, 'run.start', 'CELL_EMPTY' if r.R.cell['mix']['V'] <= 0 else 'SYRINGE_NOT_LOADED', experiment_id='x') + r.move('rest') + r.call(r.A, 'fpa.detach', 'FPA_NOT_ATTACHED') + r.call(r.A, 'fpa.attach') + r.call(r.A, 'fpa.attach', 'FPA_ATTACHED') + r.call(r.A, 'pipette.move', 'FPA_ATTACHED', location='cell') + r.call(r.A, 'syringe.load', 'PLUNGER_NOT_DOWN') + r.call(r.A, 'syringe.plunger_down') + r.call(r.A, 'pipette.move', 'SYRINGE_BUSY', location='load') + r.until(lambda: r.R.plunger_target is None) + r.call(r.A, 'syringe.load', 'PIPETTE_NOT_AT_LOAD') + r.call(r.A, 'pipette.move', location='load') + r.call(r.A, 'pipette.move', 'PIPETTE_MOVING', location='rest') + r.until(lambda: r.R.pip['phase'] is None) + r.call(r.A, 'syringe.load', 'NO_TUBE') + r.call(r.A, 'tube.place', 'PIPETTE_IN_STATION', solution_id='ca', volume_m3=6e-8) + r.move('rest') + r.call(r.A, 'tube.remove', 'NO_TUBE') + r.call(r.A, 'tube.place', solution_id='ca', volume_m3=6e-8) + r.call(r.A, 'tube.place', 'TUBE_PRESENT', solution_id='ca', volume_m3=6e-8) + r.move('load') + r.call(r.A, 'tube.remove', 'PIPETTE_IN_STATION') + r.call(r.A, 'syringe.purge_refill', 'SYRINGE_NOT_LOADED') + r.call(r.A, 'wash.power_set', enabled=False) + r.call(r.A, 'syringe.load', 'WASH_MODULE_OFF') + r.call(r.A, 'wash.press_switch') + op = r.call(r.A, 'syringe.load')['operation_id'] + r.call(r.A, 'cell.load', 'INSTRUMENT_BUSY', solution_id='edta', volume_m3=3e-7) + r.call(r.A, 'wash.empty_waste', 'INSTRUMENT_BUSY') + r.call(r.A, 'fpa.detach', 'INSTRUMENT_BUSY') + r.until(lambda: r.R.operations[op]['phase'] != 'running') + self.assertEqual(r.v('syringe.state'), 'loaded') + r.call(r.A, 'cleaning_tool.insert') + r.call(r.A, 'cleaning_tool.insert', 'CLEANING_TOOL_INSERTED') + r.call(r.A, 'cell.load', 'CLEANING_TOOL_INSERTED', solution_id='edta', volume_m3=3e-7) + r.call(r.A, 'clean.start', 'PIPETTE_NOT_AT_CLEAN', cell_method='none', syringe_method='rinse') + r.call(r.A, 'clean.start', 'NOTHING_TO_CLEAN', cell_method='none', syringe_method='none') + r.call(r.A, 'cleaning_tool.remove') + r.call(r.A, 'cleaning_tool.remove', 'CLEANING_TOOL_NOT_INSERTED') + r.call(r.A, 'clean.start', 'CLEANING_TOOL_NOT_INSERTED', cell_method='wash', syringe_method='none') + r.call(r.A, 'cell.load', 'INSUFFICIENT_SOLUTION', solution_id='ca', volume_m3=4e-7, rinse=True) + r.call(r.A, 'cell.load', solution_id='edta', volume_m3=3e-7, rinse=True) + r.move('rest') + r.call(r.A, 'fpa.detach') + r.call(r.A, 'cleaning_tool.insert') + r.call(r.A, 'pipette.move', 'CLEANING_TOOL_INSERTED', location='cell') + r.call(r.A, 'cleaning_tool.remove') + r.call(r.A, 'run.start', 'PIPETTE_NOT_IN_CELL', experiment_id='x') + r.move('cell') + r.call(r.A, 'run.start', experiment_id='x') + r.call(r.A, 'run.start', 'RUN_IN_PROGRESS', experiment_id='y') + r.call(r.A, 'method.set', 'RUN_IN_PROGRESS', temperature_k=298.15, reference_power_w=5 * UC, feedback='high', stir_rate_hz=12.5, initial_delay_s=60.0, + injections=INJ(4), cell_concentration_mol_m3=0.1, syringe_concentration_mol_m3=1.0) + r.call(r.A, 'temperature.set', 'RUN_IN_PROGRESS', temperature_k=300.0) + r.call(r.A, 'pipette.move', 'RUN_IN_PROGRESS', location='rest') + r.call(r.A, 'reference.refill', 'RUN_IN_PROGRESS') + r.call(r.A, 'syringe.plunger_down', 'RUN_IN_PROGRESS') + r.call(r.A, 'clean.start', 'RUN_IN_PROGRESS', cell_method='wash', syringe_method='none') + r.call(r.A, 'cell.empty', 'RUN_IN_PROGRESS') + r.call(r.A, 'cleaning_tool.insert', 'RUN_IN_PROGRESS') + r.call(r.A, 'fpa.attach', 'RUN_IN_PROGRESS') + out = r.call(r.A, 'instrument.stop')['result'] + self.assertIn('run.start', out['stopped']) + r.call(r.A, 'run.start', 'ITEM_EXISTS', experiment_id='x') + r.call(r.A, 'data.analyze', 'NO_DATA', experiment_id='x', model='one_set_of_sites') + r.call(r.A, 'data.analyze', 'UNKNOWN_EXPERIMENT', experiment_id='nope', model='one_set_of_sites') + r.call(r.A, 'data.read', 'UNKNOWN_EXPERIMENT', experiment_id='nope') + r.call(r.A, 'method.set', 'METHOD_EXCEEDS_SYRINGE', temperature_k=298.15, reference_power_w=5 * UC, feedback='high', stir_rate_hz=12.5, initial_delay_s=60.0, + injections=[dict(volume_m3=2e-9, duration_s=4.0, spacing_s=150.0)] * 20, cell_concentration_mol_m3=0.1, syringe_concentration_mol_m3=1.0) + r.call(r.A, 'method.set', 'INVALID_SPACING', temperature_k=298.15, reference_power_w=5 * UC, feedback='high', stir_rate_hz=12.5, initial_delay_s=60.0, + injections=[dict(volume_m3=2e-9, duration_s=40.0, spacing_s=20.0)], cell_concentration_mol_m3=0.1, syringe_concentration_mol_m3=1.0) + r.call(r.A, 'autosampler.run_queue', 'UNSUPPORTED') + r.call(r.A, 'cell.auto_fill', 'UNSUPPORTED') + r.call(r.A, 'dsc.temperature_scan', 'UNSUPPORTED') + CHECKS.append(dict(check='load_workflow_preconditions', status='passed')) + + def test_solutions_species_and_dialysis(self): + r = Rig(seed=5, warm=10.0) + r.call(r.A, 'solution.prepare', 'UNKNOWN_SPECIES', solution_id='x', volume_m3=1e-6, solutes=[dict(species_id='mes', concentration_mol_m3=1.0)]) + r.call(r.A, 'solution.prepare', 'UNKNOWN_SPECIES', solution_id='x', volume_m3=1e-6, solutes=[dict(species_id='unobtainium', concentration_mol_m3=1.0)]) + r.call(r.A, 'solution.prepare', 'UNKNOWN_SOLUTION', solution_id='x', volume_m3=1e-6, buffer_from='nope') + r.call(r.A, 'solution.prepare', 'INVALID_ARGUMENT', solution_id='x', volume_m3=1e-6, buffer_from='nope', + buffer=dict(buffer_id='mes', concentration_mol_m3=10.0, ph=5.6)) + r.prep('a', ('tris', 20.0, 8.0), {'nacl': 150.0}) + r.call(r.A, 'solution.prepare', 'ITEM_EXISTS', solution_id='a', volume_m3=1e-6) + r.call(r.A, 'solution.prepare', 'VOLUME_OUT_OF_RANGE', solution_id='b', volume_m3=1e-7, sources=[dict(source_id='a', volume_m3=2e-7)]) + r.call(r.A, 'solution.prepare', 'INSUFFICIENT_SOLUTION', solution_id='b', volume_m3=5e-6, sources=[dict(source_id='a', volume_m3=3e-6)]) + r.call(r.E, 'stock.provide', stock_id='prot', volume_m3=2e-6, buffer=dict(buffer_id='phosphate', concentration_mol_m3=50.0, ph=7.0), + components=[dict(species_id='rnase_a', concentration_mol_m3=0.19)], label=[dict(species_id='rnase_a', concentration_mol_m3=0.2)]) + r.call(r.E, 'stock.provide', 'ITEM_EXISTS', stock_id='prot', volume_m3=1e-6, buffer=None, components=[]) + r.call(r.E, 'stock.provide', 'UNKNOWN_SPECIES', stock_id='p9', volume_m3=1e-6, buffer=None, components=[dict(species_id='tris', concentration_mol_m3=1.0)]) + out = r.call(r.A, 'solution.dialyze', solution_id='prot', buffer=dict(buffer_id='acetate', concentration_mol_m3=200.0, ph=5.5, nacl_mol_m3=200.0), + dialysate_id='dial')['result'] + self.assertEqual(out['dialysate_id'], 'dial') + s = r.R.solutions['prot']['c'] + self.assertEqual(set(s['buf']), {'acetate'}) # buffer exchanged, protein kept + self.assertAlmostEqual(s['n']['rnase_a'] / s['V'], 0.19, places=9) + r.call(r.A, 'solution.dialyze', 'ITEM_EXISTS', solution_id='prot', buffer=dict(buffer_id='acetate', concentration_mol_m3=200.0, ph=5.5), dialysate_id='dial') + r.call(r.A, 'solution.degas', 'UNKNOWN_SOLUTION', solution_id='nope') + lig = r.prep('cmp', buffer_from='dial', solutes={'2_cmp': 2.0}) + self.assertEqual(lig['ph_nominal'], 5.5) + r.call(r.E, 'interaction.define', 'INVALID_INTERACTION', interaction_id='bad', model='sites', receptor='x1') + r.call(r.E, 'interaction.define', 'INVALID_INTERACTION', interaction_id='bad', model='sites', receptor='tris', ligand='x2', kd_mol_m3=1.0) + r.call(r.E, 'interaction.define', 'ITEM_EXISTS', interaction_id='ca_edta_mes_ph56', model='dimer', receptor='x3', kd_mol_m3=1.0) + prov = r.call(r.A, 'provenance.read')['result'] + self.assertIn('ca_edta_mes_ph56', [i['interaction_id'] for i in prov['interactions']]) + self.assertGreaterEqual(len(prov['shelf_species']), 80) + self.assertEqual(r.call(r.A, 'experiments.list')['result']['experiments'], []) + CHECKS.append(dict(check='solutions_dialysis', status='passed')) + + +# ---------------------------------------------------------------- framework +class Framework(unittest.TestCase): + def test_sessions_isolation_and_idempotency(self): + r = Rig(seed=5) + A, B, E = r.A, r.B, r.E + r.call(A, 'fault.inject', 'ACCESS_DENIED', fault='cell_bubble', active=True) + r.call(A, 'stock.provide', 'ACCESS_DENIED', stock_id='s', volume_m3=1e-6, buffer=None, components=[]) + with self.assertRaises(m.ActionRejected): + A.read(instance_id=r.I, state_ids=['truth.cell_ph']) + r.method(INJ(6)) + r.prep('edta', ('mes', 10.0, 5.6), {'edta': 0.1}) + r.prep('ca', buffer_from='edta', solutes={'ca2+': 1.0}) + r.call(B, 'solution.degas', 'ACCESS_DENIED', solution_id='edta') + self.assertNotIn('edta', B.read(instance_id=r.I, state_ids=['solutions.available'])['observations']['solutions.available']['value']) + r.load('edta', 'ca') + op = r.call(A, 'run.start', experiment_id='mine')['operation_id'] + r.step(5) + r.call(B, 'instrument.stop', 'ACCESS_DENIED') + self.assertTrue(B.read(instance_id=r.I, state_ids=['operation.started_by_other_agent'])['observations']['operation.started_by_other_agent']['value']) + with self.assertRaises(m.ActionRejected): + B.poll(op) + r.until(lambda: r.R.operations[op]['phase'] != 'running', dt=2.0) + r.call(B, 'data.read', 'ACCESS_DENIED', experiment_id='mine') + r.call(B, 'data.analyze', 'ACCESS_DENIED', experiment_id='mine', model='one_set_of_sites') + self.assertEqual(r.call(B, 'experiments.list')['result']['experiments'], []) + self.assertEqual(len(r.call(A, 'experiments.list')['result']['experiments']), 1) + d = r.call(A, 'data.read', experiment_id='mine', max_points=200)['result'] + self.assertLessEqual(len(d['dp_w']), 200) + self.assertTrue(d['completed']) + ev = r.call(B, 'events.read', since_s=0.0)['result']['events'] + self.assertFalse(any(e['kind'] == 'fault' for e in ev)) + r1 = A.invoke(instance_id=r.I, capability_id='design.simulate', arguments=dict(n=1.0, kd_mol_m3=1e-3, dh_j_mol=-1e4, cell_concentration_mol_m3=0.1, + syringe_concentration_mol_m3=1.0, injection_volumes_m3=[2e-9] * 5), request_id='same') + r2 = A.invoke(instance_id=r.I, capability_id='design.simulate', arguments=dict(n=1.0, kd_mol_m3=1e-3, dh_j_mol=-1e4, cell_concentration_mol_m3=0.1, + syringe_concentration_mol_m3=1.0, injection_volumes_m3=[2e-9] * 5), request_id='same') + self.assertEqual(r1, r2) + r3 = A.invoke(instance_id=r.I, capability_id='design.simulate', arguments=dict(n=2.0, kd_mol_m3=1e-3, dh_j_mol=-1e4, cell_concentration_mol_m3=0.1, + syringe_concentration_mol_m3=1.0, injection_volumes_m3=[2e-9] * 5), request_id='same') + self.assertEqual(r3['error']['code'], 'REQUEST_CONFLICT') + SEEN.add(('design.simulate', 'REQUEST_CONFLICT')) + with self.assertRaises(m.ActionRejected): + A.write(instance_id=r.I, state_id='dp.power_w', value=1.0, request_id='w') + self.assertEqual(A.describe(instance_id=r.I)['asset_type_id'], m.ASSET_TYPE_ID) + self.assertNotIn('truth.cell_ph', A.describe(asset_type_id=m.ASSET_TYPE_ID)['state_slots']) + CHECKS.append(dict(check='sessions', status='passed')) + + def test_cancel_operations(self): + r = Rig(seed=5) + r.method(INJ(6)) + r.prep('edta', ('mes', 10.0, 5.6), {'edta': 0.1}) + r.prep('ca', buffer_from='edta', solutes={'ca2+': 1.0}) + r.load('edta', 'ca') + op = r.call(r.A, 'run.start', experiment_id='c')['operation_id'] + r.step(10) + out = r.A.cancel(op, 'cx') + self.assertEqual(out['result']['phase'], 'cancelled') + self.assertEqual(r.R.experiments['c']['state'], 'stopped') + with self.assertRaises(m.ActionRejected): + r.A.cancel(op, 'cy') + CHECKS.append(dict(check='cancel', status='passed')) + + def test_atomic_rejection(self): + r = Rig(seed=5, warm=10.0) + r.prep('a', ('mes', 10.0, 5.6), {'edta': 0.1}) + before = copy.deepcopy(r.R.read('evaluator')) + sol = copy.deepcopy(r.R.solutions) + r.call(r.A, 'solution.prepare', 'INSUFFICIENT_SOLUTION', solution_id='b', volume_m3=5e-6, sources=[dict(source_id='a', volume_m3=2e-6)]) + r.call(r.A, 'cell.load', 'PIPETTE_IN_CELL', solution_id='a', volume_m3=3e-7) + r.call(r.A, 'syringe.load', 'PLUNGER_NOT_DOWN') + self.assertEqual(r.R.read('evaluator'), before) + self.assertEqual(json.dumps(r.R.solutions, sort_keys=True, default=str), json.dumps(sol, sort_keys=True, default=str)) + CHECKS.append(dict(check='atomic_rejection', status='passed')) + + def test_step_partition_independence(self): + out = [] + for parts in ([90.0], [0.5] * 180, [2.0, 0.25, 0.25, 7.5, 80.0]): + r = Rig(seed=9, warm=1000.0) + r.method(INJ(3, sp=30.0)) + r.prep('edta', ('mes', 10.0, 5.6), {'edta': 0.1}) + r.prep('ca', buffer_from='edta', solutes={'ca2+': 1.0}) + r.load('edta', 'ca') + r.call(r.A, 'run.start', experiment_id='s') + r.until(lambda: r.R.run is not None and r.R.run['phase'] != 'equilibrating', dt=0.2) + for p in parts: + r.R.step(p) + out.append((r.R.read('evaluator'), r.R.ledger(), list(r.R.experiments['s']['dp']))) + self.assertEqual(out[0], out[1]) + self.assertEqual(out[0], out[2]) + CHECKS.append(dict(check='step_partition', status='passed')) + + +class MoreRejections(unittest.TestCase): + def test_power_plant_and_misc(self): + r = Rig(seed=5, power=False) + r.call(r.A, 'method.set', 'POWER_OFF', temperature_k=298.15, reference_power_w=5 * UC, feedback='high', stir_rate_hz=12.5, initial_delay_s=60.0, + injections=INJ(4), cell_concentration_mol_m3=0.1, syringe_concentration_mol_m3=1.0) + r.call(r.A, 'temperature.set', 'POWER_OFF', temperature_k=300.0) + r.call(r.A, 'syringe.plunger_down', 'POWER_OFF') + r.call(r.A, 'instrument.stop', 'POWER_OFF') + r.call(r.E, 'plant.configure', 'SEED_FIXED', room_k=295.15, mains_voltage_v=230.0, noise_seed=99) + r.call(r.E, 'plant.configure', room_k=295.15, mains_voltage_v=60.0, noise_seed=5) + r.call(r.A, 'power.set', 'MAINS_OUT_OF_RANGE', enabled=True) + r.call(r.A, 'power.press_switch', 'MAINS_OUT_OF_RANGE') + r.call(r.A, 'wash.power_set', 'MAINS_OUT_OF_RANGE', enabled=True) + r.call(r.A, 'wash.press_switch', 'MAINS_OUT_OF_RANGE') + r.call(r.E, 'plant.configure', room_k=295.15, mains_voltage_v=230.0, noise_seed=5) + r.call(r.A, 'power.press_switch') + r.call(r.A, 'power.press_switch') + self.assertFalse(r.v('power.enabled')) + r.call(r.A, 'power.set', enabled=True) + r.call(r.A, 'clean.start', 'WASH_MODULE_OFF', cell_method='wash', syringe_method='none') + r.call(r.A, 'reference.refill', 'UNKNOWN_SOLUTION', solution_id='nope') + r.call(r.A, 'tube.place', 'UNKNOWN_SOLUTION', solution_id='nope', volume_m3=6e-8) + r.prep('t', ('mes', 10.0, 5.6), vol=1e-7) + r.call(r.A, 'reference.refill', 'INSUFFICIENT_SOLUTION', solution_id='t') + r.call(r.A, 'tube.place', 'INSUFFICIENT_SOLUTION', solution_id='t', volume_m3=2e-7) + r0 = m.MalvernMicrocalpeaqRuntime() + r0.register_principal('a', 'agent') + s = r0.session('a') + for cap, args in [('power.set', dict(enabled=True)), ('solution.prepare', dict(solution_id='x', volume_m3=1e-6)), ('cell.load', dict(solution_id='x', volume_m3=3e-7)), + ('cell.empty', {}), ('reference.refill', {}), ('fpa.attach', {}), ('fpa.detach', {}), ('pipette.move', dict(location='rest')), + ('tube.place', dict(solution_id='x', volume_m3=6e-8)), ('tube.remove', {}), ('cleaning_tool.insert', {}), ('cleaning_tool.remove', {}), + ('wash.empty_waste', {}), ('wash.empty_overflow', {}), ('wash.refill', dict(bottle='water')), ('solution.degas', dict(solution_id='x')), + ('solution.dialyze', dict(solution_id='x', buffer=dict(buffer_id='mes', concentration_mol_m3=1.0, ph=6.0), dialysate_id='d')), + ('syringe.load', {}), ('syringe.purge_refill', {}), ('run.start', dict(experiment_id='x')), ('clean.start', dict(cell_method='wash', syringe_method='none')), + ('wash.power_set', dict(enabled=True)), ('wash.press_switch', {}), ('power.press_switch', {}), ('temperature.set', dict(temperature_k=300.0))]: + res = s.invoke(instance_id=r0.instance_id, capability_id=cap, arguments=args, request_id='p' + cap) + self.assertEqual(res['error']['code'], 'PLANT_REQUIRED', cap) + SEEN.add((cap, 'PLANT_REQUIRED')) + REJECTIONS.setdefault(cap, set()).add('PLANT_REQUIRED') + ev = m.MalvernMicrocalpeaqRuntime() + ev.register_principal('e', 'evaluator') + se = ev.session('e') + for cap, args in [('stock.provide', dict(stock_id='s', volume_m3=1e-6, buffer=None, components=[])), + ('interaction.define', dict(interaction_id='i', model='dimer', receptor='x', kd_mol_m3=1.0)), ('fault.inject', dict(fault='cell_bubble', active=True))]: + res = se.invoke(instance_id=ev.instance_id, capability_id=cap, arguments=args, request_id='p' + cap) + self.assertEqual(res['error']['code'], 'PLANT_REQUIRED', cap) + SEEN.add((cap, 'PLANT_REQUIRED')) + CHECKS.append(dict(check='more_rejections', status='passed')) + + +class Coverage(unittest.TestCase): + def test_remaining_capabilities(self): + r = Rig(seed=5) + r.call(r.A, 'temperature.set', temperature_k=303.15) + r.step(2400) + self.assertAlmostEqual(r.v('truth.jacket_temperature_k'), 303.15, delta=0.01) + r.call(r.E, 'interaction.define', interaction_id='ix', model='enzyme', receptor='e9', ligand='s9', km_mol_m3=1.0, kcat_s=10.0, dh_j_mol=-1e4) + r.away() + r.prep('w', None, None) + r.call(r.A, 'cell.load', solution_id='w', volume_m3=3e-7) + removed = r.call(r.A, 'cell.empty')['result']['removed_m3'] + self.assertGreater(removed, 2e-7) + r.call(r.A, 'reference.refill', solution_id=None) + r.call(r.A, 'wash.refill', bottle='methanol') + r.call(r.A, 'wash.refill', bottle='detergent') + r.call(r.A, 'wash.empty_overflow') + r.call(r.A, 'wash.empty_waste') + self.assertTrue(r.call(r.E, 'cell.inspect')['result']['volume_m3'] >= 0) + self.assertIn('residue', r.call(r.E, 'syringe.inspect')['result']) + self.assertIn('electrical_energy_j', r.call(r.E, 'ledger.read')['result']['ledger']) + r.call(r.E, 'fault.inject', fault='stir_motor_failure', active=True) + r.call(r.E, 'fault.inject', fault='stir_motor_failure', active=False) + r.call(r.E, 'fault.inject', fault='bottle_filter_clogged', active=True) + r.call(r.E, 'fault.inject', fault='reference_cell_empty', active=True) + r.step(1) + self.assertEqual(r.v('truth.reference_volume_m3'), 0.0) + r.call(r.A, 'reference.refill') + r.call(r.E, 'fault.inject', fault='syringe_damaged', active=True) + r.prep('ca', ('mes', 10.0, 5.6), {'ca2+': 1.0}) + r.load_syringe('ca') + self.assertIn('SYRINGE_FILL_FAILURE', r.v('errors.active')) + r.call(r.E, 'fault.inject', fault='wash_pump_failure', active=True) + r.call(r.A, 'cleaning_tool.insert') + op = r.call(r.A, 'clean.start', cell_method='rinse', syringe_method='none')['operation_id'] + r.step(2) + self.assertEqual(r.R.operations[op]['error'], 'NO_FLOW') + r.call(r.A, 'syringe.purge_refill', 'PIPETTE_NOT_AT_LOAD') + r.move('clean') + r.call(r.A, 'clean.start', 'FPA_NOT_ATTACHED', cell_method='none', syringe_method='rinse') + r.call(r.A, 'fpa.attach') + r.call(r.A, 'cleaning_tool.remove') + r.call(r.A, 'syringe.plunger_down') + CHECKS.append(dict(check='coverage', status='passed')) + + +# ---------------------------------------------------------------- declared effects (with / without-call discovery) +class ZDeclaredEffects(unittest.TestCase): + """Immediate state changes stay within EFFECTS; changes after a step stay within EFFECTS | ON_STEP (compared with the same host not called).""" + + def _check(self, rig, cap, args, session=None): + meta = m.export_malvern_microcalpeaq_contract_metadata()['capabilities'][cap] + eff = {e['state_id'] for e in meta['state_effects'] if e['timing'] == 'immediate'} + on_step = {e['state_id'] for e in meta['state_effects']} + base = copy.deepcopy(rig.R) + s0 = rig.R.read('evaluator') + res = (session or rig.A).invoke(instance_id=rig.I, capability_id=cap, arguments=args, request_id=f'eff_{cap}_{rig.n}') + rig.n += 1 + self.assertIn(res['status'], ('succeeded', 'accepted'), (cap, res['error'])) + s1 = rig.R.read('evaluator') + changed = {k for k in s0 if s0[k] != s1[k]} - {'operation.started_by_other_agent'} + self.assertTrue(changed <= eff, (cap, sorted(changed - eff))) + for dt in (2.0, 28.0, 270.0, 600.0): + rig.R.step(dt) + base.step(dt) + a, b = rig.R.read('evaluator'), base.read('evaluator') + diff = {k for k in a if a[k] != b[k]} + self.assertTrue(diff <= (eff | on_step), (cap, dt, sorted(diff - (eff | on_step)))) + + def _ctx(self): + r = Rig(seed=3, warm=1800.0) + r.method(INJ(5, sp=60.0)) + r.prep('edta', ('mes', 10.0, 5.6), {'edta': 0.1}, vol=2e-6) + r.prep('ca', buffer_from='edta', solutes={'ca2+': 1.0}) + return r + + def test_declared_effects_bench_and_load(self): + r = self._ctx() + for cap, args in [('method.set', dict(temperature_k=303.15, reference_power_w=8 * UC, feedback='low', stir_rate_hz=10.0, initial_delay_s=120.0, injections=INJ(5), + cell_concentration_mol_m3=0.1, syringe_concentration_mol_m3=1.0)), + ('temperature.set', dict(temperature_k=298.15)), ('solution.prepare', dict(solution_id='s2', volume_m3=1e-6, buffer=dict(buffer_id='tris', concentration_mol_m3=20.0, ph=8.0))), + ('solution.degas', dict(solution_id='edta')), ('reference.refill', {}), ('pipette.move', dict(location='rest'))]: + self._check(r, cap, args) + r.until(lambda: r.R.pip['phase'] is None) + for cap, args in [('cell.load', dict(solution_id='edta', volume_m3=3e-7, rinse=True)), ('tube.place', dict(solution_id='ca', volume_m3=6e-8)), ('fpa.attach', {}), + ('syringe.plunger_down', {}), ('cleaning_tool.insert', {}), ('cleaning_tool.remove', {})]: + self._check(r, cap, args) + r.until(lambda: r.R.plunger_target is None) + self._check(r, 'pipette.move', dict(location='load')) + r.until(lambda: r.R.pip['phase'] is None) + self._check(r, 'syringe.load', {}) + r.until(lambda: not r.R._running_ops()) + self._check(r, 'syringe.purge_refill', {}) + r.until(lambda: not r.R._running_ops()) + r.move('rest') + for cap, args in [('tube.remove', {}), ('fpa.detach', {}), ('cell.empty', {}), + ('solution.dialyze', dict(solution_id='s2', buffer=dict(buffer_id='hepes', concentration_mol_m3=20.0, ph=7.5), dialysate_id='dial')), + ('wash.power_set', dict(enabled=False)), ('wash.press_switch', {})]: + self._check(r, cap, args) + self._check(r, 'stock.provide', dict(stock_id='st', volume_m3=1e-6, buffer=None, components=[dict(species_id='propan_1_ol', concentration_mol_m3=500.0)]), session=r.E) + self._check(r, 'interaction.define', dict(interaction_id='ix', model='sites', receptor='px', ligand='ly', n=1.0, kd_mol_m3=1e-3, dh_j_mol=-4e4), session=r.E) + + def test_declared_effects_run_and_clean(self): + r = self._ctx() + r.load('edta', 'ca') + r.step(300) + self._check(r, 'run.start', dict(experiment_id='x1')) + r.until(lambda: r.R.run is not None and r.R.run['inj'] >= 1) + self._check(r, 'instrument.stop', {}) + r.away() + r.call(r.A, 'cleaning_tool.insert') + r.move('clean') + r.call(r.A, 'fpa.attach') + self._check(r, 'clean.start', dict(cell_method='wash', syringe_method='rinse')) + r.until(lambda: not r.R._running_ops()) + for cap, args in [('wash.empty_waste', {}), ('wash.empty_overflow', {}), ('wash.refill', dict(bottle='water'))]: + self._check(r, cap, args) + self._check(r, 'fault.inject', dict(fault='cell_bubble', active=True), session=r.E) + self._check(r, 'power.press_switch', {}) + self._check(r, 'power.set', dict(enabled=True)) + self._check(r, 'plant.configure', dict(room_k=297.15, mains_voltage_v=230.0, noise_seed=3), session=r.E) + + +class ZZRejectionCodes(unittest.TestCase): + def test_codes_are_declared(self): + meta = m.export_malvern_microcalpeaq_contract_metadata()['capabilities'] + missing = [(c, e) for c, e in sorted(SEEN) if e not in {x['code'] for x in meta[c]['errors']}] + missing += [(c, e) for c, es in sorted(REJECTIONS.items()) for e in sorted(es) if e not in {x['code'] for x in meta[c]['errors']}] + self.assertEqual(missing, []) + self.assertGreaterEqual(len(SEEN), 40) + CHECKS.append(dict(check='rejection_codes_declared', status='passed', codes=len(SEEN))) + + def test_zz_every_implemented_capability_called(self): + missing = sorted(k for k in m.CAPS if k not in m.UNSUPPORTED and k not in PROCESS_EVIDENCE) + self.assertEqual(missing, []) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_asset_microtrac_turbiscanlab.py b/tests/test_asset_microtrac_turbiscanlab.py new file mode 100644 index 0000000000000000000000000000000000000000..acc0c1aa640682e083e6c70ae1a8fffd73b2652e --- /dev/null +++ b/tests/test_asset_microtrac_turbiscanlab.py @@ -0,0 +1,147 @@ +"""CHEM-126 conservative dispersion, timed optical scans, data and ownership regression.""" +import copy,hashlib,importlib.util,json,math,sys,unittest +from pathlib import Path +from unittest import mock +import numpy as np +ROOT=Path(__file__).resolve().parents[1];sys.path.insert(0,str(ROOT/'scripts')) +from asset_runtime import microtrac_turbiscanlab as rt +OBSERVED=[] +def call(h,k,**a): + r=h.invoke(k,**a);OBSERVED.append((k,copy.deepcopy(a),copy.deepcopy(r)));return r +def setup(instance_id='turbiscan_test',plant=None,sample=None,method=None,full=False): + h=rt.MicrotracTurbiscanlabRuntime(instance_id);m=copy.deepcopy(rt.METHOD_EXAMPLE) + if not full:m.update(scan_end_m=.0028,scan_interval_s=.2,duration_s=.7) + m.update(method or {}) + for k,a in [('plant.configure',dict(rt.PLANT_EXAMPLE,**(plant or {}))),('sample.set_position',{'distance_m':.105}),('lid.set',{'opened':True}),('sample.load',dict(rt.SAMPLE_EXAMPLE,**(sample or {}))),('lid.set',{'opened':False}),('sample.set_position',{'distance_m':0.}),('power.set',{'enabled':True}),('method.configure',m)]:call(h,k,**a) + return h +def finish(h,seconds=150): + for _ in range(round(seconds/.1)): + h.step(.1) + if h.phase!='running':break + return call(h,'acquisition.result') +def unload(h): + call(h,'power.set',enabled=False);call(h,'sample.set_position',distance_m=.105);call(h,'lid.set',opened=True);call(h,'sample.remove') +class TestTurbiscanLab(unittest.TestCase): + def rejected(self,h,k,error='.',**a): + before=copy.deepcopy(h.__dict__) + with self.assertRaisesRegex(rt.ActionRejected,error):h.invoke(k,**a) + self.assertEqual(before,h.__dict__) + def ledger(self,h): + r=call(h,'ledger.read');self.assertLess(abs(r['particle_error_kg']),1e-12);self.assertLess(abs(r['liquid_error_kg']),1e-12);self.assertLess(abs(r['particle_volume_error_m3']),1e-15);self.assertLess(abs(r['thermal_error_j']),1e-7);return r + def test_01_full_source_anchored_timed_scans(self): + h=setup(full=True);call(h,'acquisition.start');r=finish(h);self.assertEqual(r['phase'],'succeeded');self.assertEqual(len(r['profiles']),4);self.assertLess(r['elapsed_s'],rt.METHOD_EXAMPLE['duration_s']);self.assertGreater(r['tsi'],0);self.assertIsNone(r['migration_velocity_m_s']);self.assertIn('migration_front_not_bracketed_in_two_scans',r['analysis_reasons']) + for p in r['profiles']: + self.assertEqual(len(p['height_m']),1871);self.assertTrue(np.allclose(np.diff(p['height_m']),20e-6,atol=1e-14));self.assertTrue(np.allclose(np.diff(p['point_time_s']),.002,atol=1e-12));self.assertGreater(p['end_time_s'],p['start_time_s']);self.assertAlmostEqual(p['point_time_s'][0],p['start_time_s']);self.assertAlmostEqual(p['point_time_s'][-1],p['end_time_s']);self.assertTrue(all(0<=x<=1 for x in p['transmission_fraction']+p['backscatter_fraction'])) + self.ledger(h) + def test_02_raw_reference_unchanged_and_unknown_T_not_zero(self): + path=rt.ASSET/'turbiscan_library.json';digest=hashlib.sha256(path.read_bytes()).hexdigest();h=setup();record=copy.deepcopy(h.reference);self.assertIsNone(record['values']['transmission_fraction']);self.assertEqual(len(record['values']['height_m']),1253);t,b,_=h._optical_point(.020);expected=float(np.interp(.020,record['values']['height_m'],record['values']['backscatter_fraction'][0]));self.assertAlmostEqual(b,expected,places=12);self.assertGreater(t,0);h.invoke('acquisition.start');r=finish(h);self.assertIn('T=unmeasured; engineering KM output',r['evidence']);self.assertEqual(h.reference,record);self.assertEqual(digest,hashlib.sha256(path.read_bytes()).hexdigest()) + def test_03_stokes_creaming_and_sedimentation_conserve(self): + for rho,direction in [(920.,1),(1800.,-1)]: + h=setup(sample={'particle_density_kg_m3':rho,'volume_fraction':.05,'aggregation_rate_s':0.,'accept_template_condition_transfer':True});initial=np.dot(h.phi,h.centers);h.step(30.);self.assertGreater(direction*(np.dot(h.phi,h.centers)-initial),0.);self.assertGreaterEqual(min(h.phi),0);self.assertLessEqual(max(h.phi),h.sample['maximum_packing_fraction']);self.ledger(h) + def test_04_noflux_packing_limiter_long_step_no_mass_clipping(self): + h=setup(sample={'volume_fraction':.5,'maximum_packing_fraction':.6,'particle_density_kg_m3':1800.,'particle_diameter_m':2e-4,'dynamic_viscosity_pa_s':.05,'aggregation_rate_s':0.,'extra_diffusion_m2_s':1e-7,'accept_template_condition_transfer':True});h.step(120.);self.assertGreaterEqual(min(h.phi),0.);self.assertLessEqual(max(h.phi),.6+1e-13);self.assertGreater(max(h.phi),.5);self.assertAlmostEqual(sum(h.phi),.5*len(h.phi),places=11);self.ledger(h) + def test_05_equal_density_stationary_no_random_TSI(self): + h=setup(sample={'particle_density_kg_m3':1000.,'aggregation_rate_s':0.});h.invoke('acquisition.start');r=finish(h);self.assertEqual(r['phase'],'succeeded');self.assertAlmostEqual(r['tsi'],0.,places=12);self.assertEqual(h.phi,[.75]*len(h.phi));self.ledger(h) + def test_06_aggregation_changes_optics_without_creating_mass(self): + h=setup(sample={'particle_density_kg_m3':1000.,'aggregation_rate_s':.1});before=h._optical_point(.02);mass=h._masses();h.step(10.);self.assertGreater(h.diameter,h.sample['particle_diameter_m']);self.assertNotEqual(before,h._optical_point(.02));self.assertEqual(mass,h._masses());self.ledger(h) + def test_07_two_flux_limits_and_large_optical_depth(self): + h=rt.MicrotracTurbiscanlabRuntime() + for k,s,L in [(0.,0.,.01),(0.,100.,.01),(100.,0.,.01),(1e6,1e6,.1),(1e-14,1e-14,.01)]: + x=call(h,'analysis.two_flux',absorption_m_inv=k,scattering_m_inv=s,path_m=L);self.assertTrue(all(math.isfinite(v) and 0<=v<=1 for v in x.values()));self.assertAlmostEqual(sum(x.values()),1.,places=12) + if k==0:self.assertAlmostEqual(x['transmittance'],1/(1+s*L));self.assertAlmostEqual(x['absorptance'],0.,places=12) + if s==0:self.assertAlmostEqual(x['transmittance'],math.exp(-k*L));self.assertEqual(x['hemispherical_reflectance'],0.) + def test_08_TSI_formula_fixed_auto_mask_and_no_100_clip(self): + h=rt.MicrotracTurbiscanlabRuntime();a=dict(transmission_fraction=[[.001,.1],[.003,.2],[.0005,.15]],backscatter_fraction=[[.6,.2],[.5,.4],[.55,.3]],channel='auto_baseline');r=call(h,'analysis.tsi',**a);self.assertTrue(np.allclose(r['tsi_series'],[0,10,15]));self.assertEqual(r['channels'],['backscatter','transmission']);a=dict(transmission_fraction=None,backscatter_fraction=[[0.],[1.],[0.],[1.]],channel='backscatter');self.assertEqual(call(h,'analysis.tsi',**a)['tsi'],300.) + def test_09_TSI_missing_channel_and_shape_atomic(self): + h=rt.MicrotracTurbiscanlabRuntime();self.rejected(h,'analysis.tsi','CHANNEL_UNAVAILABLE',transmission_fraction=None,backscatter_fraction=[[0.],[1.]],channel='auto_baseline');self.rejected(h,'analysis.tsi','INVALID_PROFILE_SHAPE',transmission_fraction=[[0.],[1.,2.]],backscatter_fraction=None,channel='transmission') + def test_10_setpoints_and_queries_do_not_advance_or_teleport(self): + h=setup(sample={'accept_template_condition_transfer':True});before=copy.deepcopy(h.__dict__);h.describe();h.session().read(instance_id=h.instance_id);h.invoke('acquisition.result');h.invoke('ledger.read');call(h,'reference.query',reference_id=rt.SAMPLE_EXAMPLE['reference_id']);self.assertEqual(before,h.__dict__);call(h,'thermal.set_temperature',temperature_k=300.15);call(h,'scan.move',position_m=.04);self.assertEqual(h.temperature,298.15);self.assertEqual(h.head,0);self.assertEqual(h.time_s,0);h.step(.1);self.assertGreater(h.temperature,298.15);self.assertAlmostEqual(h.head,.002) + def test_11_stiff_heater_exact_energy_and_no_overshoot(self): + h=setup(plant={'thermal_capacity_j_k':.1,'heater_gain_w_k':1e5,'heat_loss_w_k':0.,'temperature_sensor_tau_s':.001},sample={'accept_template_condition_transfer':True});call(h,'thermal.set_temperature',temperature_k=333.15);h.step(.1);self.assertGreater(h.temperature,298.15);self.assertLessEqual(h.temperature,333.15);h.step(3.);self.assertAlmostEqual(h.temperature,333.15,places=8);self.assertGreater(h.heater_energy,0);self.ledger(h);self.rejected(h,'sample.set_position','HOT_SAMPLE',distance_m=.105) + def test_12_passive_cooling_and_no_refrigeration(self): + h=setup(plant={'thermal_capacity_j_k':1.,'heat_loss_w_k':1.},sample={'accept_template_condition_transfer':True});self.rejected(h,'thermal.set_temperature','NO_ACTIVE_COOLING',temperature_k=298.14);h.invoke('thermal.set_temperature',temperature_k=305.15);h.step(2.);before=h.temperature;call(h,'power.set',enabled=False);h.step(1.);self.assertLess(h.temperature,before);self.assertGreaterEqual(h.temperature,298.15);self.ledger(h) + def test_13_host_partition_and_zero_step(self): + a=setup(instance_id='same');b=setup(instance_id='same');a.invoke('acquisition.start');b.invoke('acquisition.start');a.step(.7) + for _ in range(7):b.step(.1) + self.assertEqual(a.read(),b.read());self.assertEqual(a.profiles,b.profiles);before=copy.deepcopy(a.__dict__);a.step(0.);self.assertEqual(before,a.__dict__) + def test_14_dual_instance_independent(self): + a=setup(instance_id='a');b=setup(instance_id='b');before=copy.deepcopy(b.__dict__);a.invoke('acquisition.start');a.step(1.);self.assertEqual(before,b.__dict__) + def test_15_agent_truth_recovery_permissions(self): + h=setup();s=h.session();meta=s.describe(instance_id=h.instance_id);self.assertFalse(any(k.startswith('truth.') for k in meta['state_slots']));self.assertNotIn('sample.remove',meta['capabilities']);before=copy.deepcopy(h.__dict__) + for k,a in [('sample.remove',{}),('sample.load',rt.SAMPLE_EXAMPLE),('ledger.read',{}),('sim.step',{'dt_s':1.})]: + r=s.invoke(instance_id=h.instance_id,capability_id=k,arguments=a,request_id=k);self.assertEqual(r['error']['code'],'ACCESS_DENIED');self.assertEqual(before,h.__dict__) + with self.assertRaises(rt.ActionRejected):s.read(instance_id=h.instance_id,state_ids=['truth.particle_mass_kg']) + with self.assertRaises(rt.ActionRejected):h.register_principal('agent','evaluator') + def test_16_owner_poll_cancel_result_and_query_no_steal(self): + h=setup();h.register_principal('other');s=h.session();other=h.session('other');op=s.invoke(instance_id=h.instance_id,capability_id='acquisition.start',arguments={},request_id='start')['operation_id'];before=copy.deepcopy(h.__dict__) + for k in ['acquisition.result','acquisition.stop']: + r=other.invoke(instance_id=h.instance_id,capability_id=k,arguments={},request_id=k);self.assertEqual(r['error']['code'],'ACCESS_DENIED');self.assertEqual(before,h.__dict__) + with self.assertRaises(rt.ActionRejected):other.poll(op) + with self.assertRaises(rt.ActionRejected):other.cancel(op,'cancel') + self.assertIsNone(s.invoke(instance_id=h.instance_id,capability_id='acquisition.result',arguments={},request_id='q')['operation_id']);self.assertEqual(h._owners[op],'agent');self.assertEqual(s.cancel(op,'stop')['status'],'succeeded') + def test_17_idempotency_conflict_and_unknown_instance(self): + h=setup();s=h.session();a=dict(instance_id=h.instance_id,capability_id='scan.move',arguments={'position_m':.01},request_id='id');r=s.invoke(**a);before=copy.deepcopy(h.__dict__);self.assertEqual(r,s.invoke(**a));self.assertEqual(before,h.__dict__);a['arguments']={'position_m':.02};self.assertEqual(s.invoke(**a)['error']['code'],'REQUEST_CONFLICT');self.assertEqual(before,h.__dict__);a['instance_id']='other';self.assertEqual(s.invoke(**a)['error']['code'],'UNKNOWN_INSTANCE') + def test_18_cancel_freezes_partial_but_gravity_heat_continue(self): + h=setup(full=True,sample={'volume_fraction':.05,'particle_density_kg_m3':1800.,'accept_template_condition_transfer':True});h.invoke('thermal.set_temperature',temperature_k=298.2);h.invoke('acquisition.start');h.step(1.);mass=h._masses();phi=list(h.phi);temperature=h.temperature;head=h.head;call(h,'acquisition.stop');r=call(h,'acquisition.result');self.assertIsNotNone(r['partial_profile']);self.assertGreater(len(r['partial_profile']['height_m']),1);h.step(1.);self.assertEqual(h.head,head);self.assertNotEqual(h.phi,phi);self.assertGreater(h.temperature,temperature);self.assertEqual(r,h.invoke('acquisition.result'));self.assertTrue(np.allclose(mass,h._masses()));self.ledger(h) + def test_19_history_frozen_after_remove_reload_and_return_copy(self): + h=setup();s=h.session();op=s.invoke(instance_id=h.instance_id,capability_id='acquisition.start',arguments={},request_id='start')['operation_id'];finish(h);saved=s.poll(op);unload(h);call(h,'sample.load',**dict(rt.SAMPLE_EXAMPLE,aggregation_rate_s=.1));self.assertEqual(saved,s.poll(op));self.assertEqual(saved['result'],h.invoke('acquisition.result'));saved['result']['profiles'][0]['backscatter_fraction'][0]=99.;self.assertNotEqual(saved,s.poll(op)) + def test_20_geometry_volume_consistency_and_access(self): + h=setup();self.rejected(h,'lid.set','SAMPLE_ACCESS',opened=True);self.rejected(h,'sample.remove','SAMPLE_ACCESS');unload(h);self.rejected(h,'sample.load','VESSEL_VOLUME_HEIGHT',**dict(rt.SAMPLE_EXAMPLE,height_m=.002));volume=2e-6;call(h,'sample.load',**dict(rt.SAMPLE_EXAMPLE,volume_m3=volume,height_m=volume/(math.pi*(.0251/2)**2)));self.assertEqual(h.sample['volume_m3'],2e-6);self.rejected(h,'sample.set_position','LID_OPEN',distance_m=0.);self.ledger(h) + def test_21_source_flags_and_unknown_conditions_atomic(self): + h=setup();unload(h) + for extra,error in [(dict(accept_engineering=False),'MODEL_NOT_ACCEPTED'),(dict(accept_unknown_conditions=False),'UNKNOWN_REFERENCE_CONDITIONS'),(dict(reference_id='missing'),'INVALID_REFERENCE'),(dict(accept_concentrated_stokes_proxy=False),'CONCENTRATED_MODEL_NOT_ACCEPTED')]:self.rejected(h,'sample.load',error,**dict(rt.SAMPLE_EXAMPLE,**extra)) + lib=copy.deepcopy(rt.library());lib['substances'][rt.SAMPLE_EXAMPLE['reference_id']]['runtime_usable']=False + with mock.patch.object(rt,'library',return_value=lib):self.rejected(h,'sample.load','INVALID_REFERENCE',**rt.SAMPLE_EXAMPLE) + def test_22_true_reference_temperature_and_wavelength(self): + h=setup();unload(h);lib=copy.deepcopy(rt.library());r=lib['substances'][rt.SAMPLE_EXAMPLE['reference_id']];r['conditions']['wavelength_m']=600e-9 + with mock.patch.object(rt,'library',return_value=lib):self.rejected(h,'sample.load','REFERENCE_WAVELENGTH',**rt.SAMPLE_EXAMPLE) + r['conditions']['wavelength_m']=880e-9;r['conditions']['temperature_k']=308.15 + with mock.patch.object(rt,'library',return_value=lib):self.rejected(h,'sample.load','REFERENCE_CONDITIONS',**rt.SAMPLE_EXAMPLE) + def test_23_packing_size_and_stokes_model_domain(self): + h=setup();unload(h) + for extra,error in [(dict(maximum_packing_fraction=.6),'PACKING_RANGE'),(dict(particle_diameter_m=.001,particle_density_kg_m3=20000.,dynamic_viscosity_pa_s=.0001),'STOKES_REGIME'),(dict(scattering_m_inv=0.),'OPTICAL_ANCHOR_ZERO')]:self.rejected(h,'sample.load',error,**dict(rt.SAMPLE_EXAMPLE,**extra)) + def test_24_scan_domain_resolution_and_short_interval(self): + h=setup() + for extra,error in [(dict(scan_end_m=.055),'SCAN_RANGE'),(dict(scan_start_m=.00198),'SCAN_RANGE'),(dict(scan_end_m=.03942),'SCAN_RANGE'),(dict(scan_end_m=.00281),'SCAN_GRID_ALIGNMENT'),(dict(scan_interval_s=.1),'SCAN_INTERVAL_TOO_SHORT'),(dict(duration_s=.2),'INSUFFICIENT_SCANS'),(dict(tsi_channel='auto_baseline'),'UNMEASURED_TRANSMISSION_SELECTOR')]:self.rejected(h,'method.configure',error,**dict(h.method,**extra)) + self.rejected(h,'scan.move',position_m=.055001);self.rejected(h,'thermal.set_temperature',temperature_k=333.16) + def test_25_failure_elapsed_and_partial_profile_preserved(self): + h=setup(full=True,sample={'particle_diameter_m':.00099,'particle_density_kg_m3':1000.,'aggregation_rate_s':1.});h.invoke('acquisition.start');h.step(.1);r=call(h,'acquisition.result');self.assertEqual(r['phase'],'failed');self.assertEqual(r['error_code'],'PARTICLE_SIZE_MODEL_RANGE');self.assertAlmostEqual(r['elapsed_s'],.1);self.assertEqual(r['profiles'],[]);self.ledger(h);self.rejected(h,'acquisition.start','PARTICLE_SIZE_MODEL_RANGE') + def test_26_external_calibration_saturation_count(self): + h=setup();call(h,'sensor.calibrate',temperature_zero_k=.1,transmission_gain=1.,transmission_zero_fraction=0.,backscatter_gain=100.,backscatter_zero_fraction=0.);self.assertAlmostEqual(h.read()['thermal.indicated_k'],298.05);self.assertEqual(h.temperature,298.15);h.invoke('acquisition.start');r=finish(h);self.assertGreater(sum(x['saturated_points'] for x in r['profiles']),0);self.assertTrue(all(v==1 for p in r['profiles'] for v in p['backscatter_fraction'])) + def test_27_actual_front_timestamp_and_OLS(self): + h=setup();h.method['front_threshold_fraction']=.05;baseline=dict(height_m=[0.,.001,.002],point_time_s=[0.,1.,2.],backscatter_fraction=[.5,.5,.5]);h.profiles=[baseline];current=dict(height_m=[0.,.001,.002],point_time_s=[10.,11.,12.],backscatter_fraction=[.6,.55,.5]);front=h._front(current);self.assertAlmostEqual(front,.001);self.assertAlmostEqual(float(np.interp(front,current['height_m'],current['point_time_s'])),11.) + def test_28_invalid_numbers_busy_atomic(self): + h=setup() + for x in [True,float('nan'),float('inf'),-1.]:self.rejected(h,'scan.move',position_m=x) + before=copy.deepcopy(h.__dict__) + for dt in [True,float('nan'),float('inf'),-1.]: + with self.assertRaises(rt.ActionRejected):h.step(dt) + self.assertEqual(before,h.__dict__) + h.invoke('acquisition.start');self.rejected(h,'sample.set_position','BUSY',distance_m=.105);self.rejected(h,'method.configure','BUSY',**h.method) + def test_29_cleanup_service_and_truth_ledgers(self): + h=setup();self.rejected(h,'service.set','POWER_INTERLOCK',distance_m=.06);h.invoke('acquisition.start');finish(h);unload(h);call(h,'service.set',distance_m=.06);self.rejected(h,'power.set','NOT_READY',enabled=True);call(h,'service.set',distance_m=0.);self.assertAlmostEqual(h.particle_loaded,h.particle_recovered);self.assertAlmostEqual(h.liquid_loaded,h.liquid_recovered);self.ledger(h) + def test_30_all_unsupported_are_honest(self): + h=setup() + for k in rt.UNSUPPORTED:self.rejected(h,k,'UNSUPPORTED') + m=h.describe();self.assertEqual(m['capabilities']['particle_size.inverse_mie']['availability'],'unsupported');self.assertIn('20um',json.dumps(m));self.assertEqual(rt.WAVELENGTH,880e-9) + def test_31_actual_effects_declared(self): + meta=rt.export_microtrac_turbiscanlab_contract_metadata();original=rt.MicrotracTurbiscanlabRuntime.invoke + def audited(h,k,**a): + before=h.read();r=original(h,k,**a);after=h.read();changed={x for x in before if before[x]!=after[x]};declared={e['state_id'] for e in meta['capabilities'][k]['state_effects'] if e['timing']=='immediate'};self.assertFalse(changed-declared,(k,changed-declared));return r + with mock.patch.object(rt.MicrotracTurbiscanlabRuntime,'invoke',audited): + h=setup();call(h,'sensor.calibrate',**dict(rt.CAPS['sensor.calibrate']['example_arguments'],temperature_zero_k=.1));call(h,'thermal.set_temperature',temperature_k=298.2);call(h,'scan.move',position_m=.001);call(h,'acquisition.start');call(h,'sim.step',dt_s=.2);call(h,'acquisition.stop');unload(h);call(h,'service.set',distance_m=.06) + def test_31b_preset_heating_cannot_bypass_reference_temperature(self): + h=rt.MicrotracTurbiscanlabRuntime();h.invoke('plant.configure',**rt.PLANT_EXAMPLE);h.invoke('thermal.set_temperature',temperature_k=300.15);h.invoke('sample.set_position',distance_m=.105);h.invoke('lid.set',opened=True);lib=copy.deepcopy(rt.library());lib['substances'][rt.SAMPLE_EXAMPLE['reference_id']]['conditions']['temperature_k']=298.15 + with mock.patch.object(rt,'library',return_value=lib):h.invoke('sample.load',**rt.SAMPLE_EXAMPLE) + h.invoke('lid.set',opened=False);h.invoke('sample.set_position',distance_m=0.);h.invoke('power.set',enabled=True);h.step(10.);self.rejected(h,'acquisition.start','REFERENCE_TEMPERATURE') + def test_31c_source_cell_path_matches_library_schema(self): + h=setup();unload(h);lib=copy.deepcopy(rt.library());lib['substances'][rt.SAMPLE_EXAMPLE['reference_id']]['conditions']['cell_path_m']=.01 + with mock.patch.object(rt,'library',return_value=lib):self.rejected(h,'sample.load','REFERENCE_CONDITIONS',**rt.SAMPLE_EXAMPLE) + def test_32_actual_api_state_schemas(self): + spec=importlib.util.spec_from_file_location('turbiscan_asset_tool',ROOT/'skills/chemistry-lab-assets/scripts/asset_tool.py');tool=importlib.util.module_from_spec(spec);spec.loader.exec_module(tool);meta=rt.export_microtrac_turbiscanlab_contract_metadata();h=setup();call(h,'acquisition.start');call(h,'sim.step',dt_s=.7);call(h,'acquisition.result');self.ledger(h) + for k,c in rt.CAPS.items(): + if k in rt.UNSUPPORTED:continue + cases=[v for v in OBSERVED if v[0]==k];self.assertTrue(cases,k) + for _,a,r in cases:self.assertEqual(tool.validate_value(a,meta['capabilities'][k]['input_schema']),[],k);self.assertEqual(tool.validate_value(r,meta['capabilities'][k]['output_schema']),[],k) + for k,v in h.read().items():self.assertEqual(tool.validate_value(v,meta['state_slots'][k]['value_schema']),[],k) +if __name__=='__main__':unittest.main() diff --git a/tests/test_asset_mt_rc1mxhfcal.py b/tests/test_asset_mt_rc1mxhfcal.py new file mode 100644 index 0000000000000000000000000000000000000000..decbe646876060e3e93d04816be00d6f4ad5e47b --- /dev/null +++ b/tests/test_asset_mt_rc1mxhfcal.py @@ -0,0 +1,1073 @@ +"""CHEM-149 METTLER TOLEDO RC1mx + HFCal (AP01-2 glass reactor) runtime tests: python3 -m unittest tests/test_asset_mt_rc1mxhfcal.py + +Themes (pipeline.md): set points only write targets; read/describe/poll are pure; rejected preconditions leave the state +unchanged; two instances are isolated; agent/evaluator truth isolation; energy, mass and species conservation; real return +values validate against the contract schemas; async completion / cancellation residue. +Physics and instrument: the RC1e AP01-2 heating/cooling curves (empty reactor Tj mode, 1 L water Tr mode, emergency A) are +reproduced within tolerance and not an order of magnitude slower; |Tj - Tr| <= T diff max; the HFCal UA calibration, the +heat-capacity ramp and the heat-flow evaluation recover the true UA, heat capacity and the reaction heat of the acetic +anhydride hydrolysis (enthalpy derived from NIST enthalpies of formation); accumulation and MTSR; emergency programs A, B1 and +C with their triggers, actions, 0.1 K/s gradients, blocking and reset; stirrer torque limit and shaft mirror; discharge; +bubble-point and volume guards; quantised Pt100 readings; 2 s instrument cycle (host-step independence, PI stability bound); +power loss without cooling; request binding, ownership and unsupported capabilities. No native scene, robot or hardware claims. +""" +import copy +import importlib.util +import json +import math +import sys +import unittest +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT)) +from scripts.asset_runtime.mt_rc1mxhfcal import * # noqa: E402,F401,F403 +from scripts.asset_runtime import mt_rc1mxhfcal as rt # noqa: E402 + +PROCESS_EVIDENCE = {} +CHECKS = [] +_spec = importlib.util.spec_from_file_location('rc1mx_asset_tool', ROOT / 'skills/chemistry-lab-assets/scripts/asset_tool.py') +asset_tool = importlib.util.module_from_spec(_spec) +_spec.loader.exec_module(asset_tool) +_ispec = importlib.util.spec_from_file_location('rc1mx_interface', ROOT / 'outputs/expansion_batch04/t1_thermal/mt_rc1mxhfcal/interface_definition.py') +interface = importlib.util.module_from_spec(_ispec) +_ispec.loader.exec_module(interface) +OUT = ROOT / 'outputs/expansion_batch04/t1_thermal/mt_rc1mxhfcal' +QUIET = dict(tr_offset_k=0.0, tj_offset_k=0.0, tc_offset_k=0.0, sensor_noise_k=0.0) +FIT_PLANT = dict(PLANT_EXAMPLE, ambient_k=295.15, coolant_inlet_k=289.15, coolant_flow_m3_s=10e-3 / 60.0, **QUIET) +HYDROLYSIS = dict(reactions=[dict(reaction_id='acetic_anhydride_hydrolysis', log10_a=5.5, activation_energy_j_mol=46000.0, + orders=[dict(substance_id='acetic_anhydride', order=1.0), dict(substance_id='water', order=0.0)])], accept_priors=True) + + +def state(h): + s = h.read('evaluator') + s.pop('clock.time_s') + return s + + +def call(h, k, **a): + """Invoke through the runtime, validate the returned value and check that only declared slots changed immediately.""" + before = h.read('evaluator') + r = h.invoke(k, **a) + validate(CAPS[k]['output_schema'], r) + problems = asset_tool.validate_value(r, CAPS[k]['output_schema']) + if problems: + raise AssertionError(f'{k}: {problems}') + after = h.read('evaluator') + delta = {x for x in after if before[x] != after[x]} + if k != 'sim.step' and not delta <= set(CAPS[k]['effects']): + raise AssertionError(f'{k}: undeclared state changes {sorted(delta - set(CAPS[k]["effects"]))}') + PROCESS_EVIDENCE.setdefault(k, []).append(dict(time_s=h.time_s, result_keys=sorted(r) if isinstance(r, dict) else None, actual_call=True)) + return r + + +def rejected(test, h, code, k, **a): + before = copy.deepcopy(state(h)) + with test.assertRaises(ActionRejected) as e: + h.invoke(k, **a) + test.assertEqual(str(e.exception), code) + test.assertEqual(state(h), before, f'{k} rejection changed the state') + + +def plant(**kw): + h = MtRc1mxhfcalRuntime() + call(h, 'plant.configure', **dict(PLANT_EXAMPLE, **kw)) + call(h, 'power.set', enabled=True) + return h + + +def with_water(kg=0.8, rpm=250.0, T=313.15, **kw): + h = plant(**kw) + call(h, 'reactor.charge', substances=[dict(substance_id='water', mass_kg=kg)], temperature_k=T, viscosity_pa_s=0.00089, thermal_conductivity_w_m_k=0.6, accept_priors=True) + call(h, 'stirrer.set', rpm=rpm) + return h + + +def settle_tr(h, T=313.15, s=1800.0, controller='aqueous'): + call(h, 'thermostat.set_tr', end_k=T, ramp_s=0.0, controller=controller) + call(h, 'sim.step', dt_s=s) + + +def run_until(h, pred, limit_s, dt=2.0): + t = 0.0 + while not pred() and t < limit_s: + h.step(dt) + t += dt + return t + + +def digitised(plot, key): + d = json.loads((OUT / 'source_cache/rc1e_curves_digitized.json').read_text())['plots'][plot]['series'][key] + return sorted((a[0], a[1]) for a in d) + + +def first_time(series, level, after=0.0): + return next(t for t, T in series if t >= after and T >= level) + + +def calibrated_hydrolysis(noise=True, seed=7): + kw = dict(noise_seed=seed) if noise else dict(QUIET) + h = with_water(kg=0.8, T=313.15, **kw) + call(h, 'reaction.configure', **HYDROLYSIS) + e = call(h, 'experiment.start', name='hydrolysis')['experiment_id'] + settle_tr(h) + c1 = call(h, 'calibration.run', pre_s=600.0, heat_s=900.0, post_s=600.0)['operation_id'] + h.step(2200.0) + t0, q0 = h.time_s, h.ledger()['reaction_heat_j'] + call(h, 'dosing.start', substance_id='acetic_anhydride', rate_kg_s=1.5e-4, total_mass_kg=0.10209, feed_temperature_k=None) + h.step(3600.0) + t1, q1 = h.time_s, h.ledger()['reaction_heat_j'] + c2 = call(h, 'calibration.run', pre_s=600.0, heat_s=900.0, post_s=600.0)['operation_id'] + h.step(2200.0) + return h, e, c1, c2, t0, t1, q1 - q0 + + +class Rc1mxRuntimeTests(unittest.TestCase): + # ---------------------------------------------------------------- contract themes + def test01_read_and_describe_are_pure(self): + h = with_water() + s0, rev = state(h), h.revision + h.read('agent'); h.read('evaluator'); h.ledger() + self.assertEqual((state(h), h.revision, h.time_s), (s0, rev, h.time_s)) + h.register_principal('a1', 'agent') + d = h.session('a1').describe(instance_id=h.instance_id) + self.assertEqual(d['asset_type_id'], ASSET_TYPE_ID) + self.assertTrue(all(v['visibility'] == 'agent' for v in d['state_slots'].values())) + self.assertEqual(state(h), s0) + + def test02_setpoint_only_writes_target(self): + h = with_water(T=298.15) + T0 = h.read('evaluator')['truth.reactor_k'] + call(h, 'thermostat.set_tr', end_k=333.15, ramp_s=600.0, controller='aqueous') + s = h.read('evaluator') + self.assertEqual(s['truth.reactor_k'], T0) + self.assertEqual(s['thermostat.mode'], 'tr') + call(h, 'sim.step', dt_s=600.0) + self.assertGreater(h.read('evaluator')['truth.reactor_k'], T0 + 10.0) + + def test03_rejections_leave_state_unchanged(self): + h = MtRc1mxhfcalRuntime() + rejected(self, h, 'PLANT_REQUIRED', 'power.set', enabled=True) + call(h, 'plant.configure', **PLANT_EXAMPLE) + rejected(self, h, 'PLANT_ALREADY_CONFIGURED', 'plant.configure', **PLANT_EXAMPLE) + rejected(self, h, 'POWER_OFF', 'thermostat.set_tj', end_k=320.0, ramp_s=0.0) + call(h, 'power.set', enabled=True) + rejected(self, h, 'OUTSIDE_SAFETY_LIMITS', 'thermostat.set_tj', end_k=440.0, ramp_s=0.0) + rejected(self, h, 'VOLUME_BELOW_OPERATING_RANGE', 'thermostat.set_tr', end_k=320.0, ramp_s=0.0, controller='aqueous') + rejected(self, h, 'UNKNOWN_SUBSTANCE', 'reactor.charge', substances=[dict(substance_id='unobtainium', mass_kg=0.1)], temperature_k=298.15, + viscosity_pa_s=0.001, thermal_conductivity_w_m_k=0.5, accept_priors=True) + rejected(self, h, 'NOT_LIQUID', 'reactor.charge', substances=[dict(substance_id='water', mass_kg=0.1)], temperature_k=270.0, + viscosity_pa_s=0.001, thermal_conductivity_w_m_k=0.5, accept_priors=True) + rejected(self, h, 'VOLUME_ABOVE_OPERATING_RANGE', 'reactor.charge', substances=[dict(substance_id='water', mass_kg=2.1)], temperature_k=298.15, + viscosity_pa_s=0.001, thermal_conductivity_w_m_k=0.5, accept_priors=True) + rejected(self, h, 'OUTSIDE_STIRRER_RANGE', 'stirrer.set', rpm=20.0) + rejected(self, h, 'OUTSIDE_STIRRER_RANGE', 'stirrer.set', rpm=900.0) + rejected(self, h, 'TR_MODE_REQUIRED', 'calibration.run', pre_s=600.0, heat_s=600.0, post_s=600.0) + rejected(self, h, 'RATE_ABOVE_DOSING_UNIT', 'dosing.start', substance_id='water', rate_kg_s=0.01, total_mass_kg=0.1, feed_temperature_k=None) + rejected(self, h, 'INVALID_KINETICS', 'reaction.configure', reactions=[dict(reaction_id='acetic_anhydride_hydrolysis', log10_a=5.0, activation_energy_j_mol=4e4, + orders=[dict(substance_id='acetic_anhydride', order=1.0)])], accept_priors=True) + rejected(self, h, 'INVALID_SAFETY_SETTINGS', 'safety.configure', **dict(SAFETY_EXAMPLE, tr_min_k=400.0)) + rejected(self, h, 'NO_EMERGENCY', 'emergency.reset') + + def test04_two_instances_are_isolated(self): + a, b = with_water(), with_water(kg=1.2) + call(a, 'thermostat.set_tr', end_k=333.15, ramp_s=0.0, controller='aqueous') + a.step(900.0) + self.assertNotAlmostEqual(a.read('evaluator')['truth.reactor_k'], b.read('evaluator')['truth.reactor_k'], places=2) + self.assertEqual(b.read('evaluator')['thermostat.mode'], 'tj') + self.assertEqual(b.time_s, 0.0) + + def test05_agent_sees_no_truth(self): + h = with_water() + h.register_principal('a1', 'agent'); h.register_principal('ev', 'evaluator') + obs = h.session('a1').read(instance_id=h.instance_id)['observations'] + self.assertFalse([k for k in obs if k.startswith('truth.') or k in ('stirrer.angle_rad', 'drain.angle_rad')]) + self.assertTrue(all(k in h.session('ev').read(instance_id=h.instance_id)['observations'] for k in ('truth.ua_w_k', 'truth.composition_mol'))) + r = h.session('a1').invoke(instance_id=h.instance_id, capability_id='ledger.read', arguments={}, request_id='r1') + self.assertEqual(r['error']['code'], 'ACCESS_DENIED') + with self.assertRaises(ActionRejected): + h.session('a1').read(instance_id=h.instance_id, state_ids=['truth.reactor_k']) + + def test06_energy_ledger_closes(self): + h, *_ = calibrated_hydrolysis() + call(h, 'reactor.discharge', open=True) + h.step(600.0) + led = call(h, 'ledger.read') + scale = max(abs(led['heater_j']), abs(led['coolant_removed_j']), 1.0) + self.assertLess(abs(led['energy_residual_j']), 1e-9 * scale) + self.assertGreater(led['reaction_heat_j'], 5e4) + self.assertGreater(led['discharged_kg'], 0.0) + + def test07_mass_and_species_conservation(self): + h, *_ = calibrated_hydrolysis() + led = h.ledger() + self.assertLess(abs(led['mass_residual_kg']), 1e-12) + subs = rt.library()['substances'] + n = h.read('evaluator')['truth.composition_mol'] + # carbon balance: acetic anhydride (C4) dosed -> acetic acid (C2); all anhydride hydrolysed + self.assertAlmostEqual(n.get('acetic_acid', 0.0), 2 * 0.10209 / subs['acetic_anhydride']['M'], places=6) + self.assertLess(n.get('acetic_anhydride', 0.0), 1e-9) + for rid, r in rt.library()['reactions'].items(): + dm = sum(c * subs[s]['M'] for s, c in r['products'].items()) - sum(c * subs[s]['M'] for s, c in r['reactants'].items()) + self.assertLess(abs(dm), 2e-4, rid) # stoichiometric mass balance of every library reaction + prov = call(h, 'provenance.read') + self.assertEqual((prov['library'], prov['reactions']), (str(LIBRARY_PATH.relative_to(ROOT)), ['acetic_anhydride_hydrolysis'])) + self.assertEqual(set(prov['substances']), set(n)) + + # ---------------------------------------------------------------- thermostat against the manufacturer's curves + def test08_empty_reactor_tj_mode_follows_rc1e_curve1(self): + h = MtRc1mxhfcalRuntime() + call(h, 'plant.configure', **FIT_PLANT); call(h, 'power.set', enabled=True) + call(h, 'safety.configure', **dict(SAFETY_EXAMPLE, tj_max_k=503.15, tr_max_k=473.15)) + call(h, 'thermostat.set_tj', end_k=298.15, ramp_s=0.0); h.step(1800.0) + call(h, 'thermostat.set_tj', end_k=473.15, ramp_s=0.0) + t = run_until(h, lambda: h.read('evaluator')['truth.jacket_k'] >= 453.15, 7200.0) + man = digitised('curve1_empty_Tj_mode', 'Tj') + t_man = first_time(man, 180.0, 120.0) - first_time(man, 26.0, 120.0) + self.assertLess(abs(t / t_man - 1.0), 0.15, (t, t_man)) + h.step(900.0) + call(h, 'thermostat.set_tj', end_k=298.15, ramp_s=0.0) + tc = run_until(h, lambda: h.read('evaluator')['truth.jacket_k'] <= 333.15, 3600.0) + dn = [x for x in man if x[0] > 1800.0] + t_man_c = next(t_ for t_, T in dn if T <= 60.0) - next(t_ for t_, T in dn if T <= 199.0) + self.assertLess(abs(tc / t_man_c - 1.0), 0.3, (tc, t_man_c)) + + def test09_one_litre_water_tr_mode_follows_rc1e_curve2(self): + h = MtRc1mxhfcalRuntime() + call(h, 'plant.configure', **FIT_PLANT); call(h, 'power.set', enabled=True) + call(h, 'reactor.charge', substances=[dict(substance_id='water', mass_kg=0.995)], temperature_k=298.15, viscosity_pa_s=0.00089, thermal_conductivity_w_m_k=0.6, + accept_priors=True) + call(h, 'stirrer.set', rpm=200.0) + settle_tr(h, 298.15, 1200.0) + call(h, 'thermostat.set_tr', end_k=368.15, ramp_s=0.0, controller='aqueous') + t0 = h.time_s + diffs = [] + t40 = t90 = None + while h.time_s - t0 < 3600.0 and t90 is None: + h.step(2.0) + s = h.read('evaluator') + diffs.append(s['truth.jacket_k'] - s['truth.reactor_k']) + if t40 is None and s['truth.reactor_k'] >= 313.15: + t40 = h.time_s + if s['truth.reactor_k'] >= 363.15: + t90 = h.time_s + man = digitised('curve2_1L_water_Tr_mode', 'Tr') + t_man = first_time(man, 90.0, 240.0) - first_time(man, 40.0, 240.0) + self.assertLess(abs((t90 - t40) / t_man - 1.0), 0.15, ((t90 - t40), t_man)) + self.assertLessEqual(max(diffs), TDIFF_MAX_K + 0.5) # glass protection: Tj - Tr limited to 50 K + self.assertGreater(max(diffs), TDIFF_MAX_K - 3.0) # and the heater is really at the limit + + def test10_emergency_a_cools_about_twice_as_fast(self): + rates = {} + for emerg in (False, True): + h = MtRc1mxhfcalRuntime() + call(h, 'plant.configure', **FIT_PLANT); call(h, 'power.set', enabled=True) + call(h, 'safety.configure', **dict(SAFETY_EXAMPLE, tj_max_k=503.15, tr_max_k=473.15)) + call(h, 'thermostat.set_tj', end_k=473.15, ramp_s=0.0); h.step(3600.0) + T0 = h.read('evaluator')['truth.jacket_k'] + if emerg: + call(h, 'emergency.trigger') + else: + call(h, 'thermostat.set_tj', end_k=298.15, ramp_s=0.0) + h.step(60.0) + rates[emerg] = (T0 - h.read('evaluator')['truth.jacket_k']) / 60.0 + self.assertGreater(rates[True], 1.4 * rates[False], rates) # safety-valve bypass: fitted to the RC1e curve-4 collapse + self.assertGreater(rates[False], 0.5, rates) # K/s: RC1e curve 1 drops ~95 K in 2 min + + def test11_rates_not_an_order_of_magnitude_off(self): + cal = json.loads((OUT / 'thermal_calibration.json').read_text()) + for plot, r in cal['rate_check'].items(): + self.assertTrue(0.5 < r['model_over_manufacturer'] < 2.0, (plot, r)) + for k, v in cal['fitted'].items(): + if k in PLANT_FIT: + self.assertAlmostEqual(PLANT_FIT[k], v, delta=abs(v) * 1e-4, msg=k) + + def test12_tj_below_coolant_margin_warns_but_is_accepted(self): + h = plant(**QUIET) + call(h, 'safety.configure', **dict(SAFETY_EXAMPLE, tj_min_k=253.15, tr_min_k=253.15)) + call(h, 'thermostat.set_tj', end_k=290.15, ramp_s=0.0) + self.assertIn('TJ_BELOW_COOLANT_MARGIN', [e['code'] for e in h.events]) + self.assertEqual(h.read('evaluator')['thermostat.tj_setpoint_k'], 290.15) + + # ---------------------------------------------------------------- HFCal + def test13_ua_calibration_recovers_true_ua(self): + h = with_water(**QUIET) + settle_tr(h) + op = call(h, 'calibration.run', pre_s=600.0, heat_s=900.0, post_s=600.0)['operation_id'] + self.assertTrue(h.read('evaluator')['calibration.running']) + h.step(1200.0) + self.assertTrue(h.read('evaluator')['cal_heater.on']) + h.step(1000.0) + res = call(h, 'calibration.result', operation_id=op) + ua = h.read('evaluator')['truth.ua_w_k'] + self.assertEqual(res['phase'], 'succeeded') + self.assertLess(abs(res['ua_w_k'] / ua - 1.0), 0.02, (res['ua_w_k'], ua)) + self.assertEqual(h.read('evaluator')['calibration.ua_w_k'], res['ua_w_k']) + self.assertIsNotNone(res['uncertainty_w_k']) + + def test14_heat_capacity_ramp_recovers_true_heat_capacity(self): + h = with_water(kg=1.2, **QUIET) + settle_tr(h) + call(h, 'calibration.run', pre_s=600.0, heat_s=900.0, post_s=600.0); h.step(2200.0) + op = call(h, 'calibration.cp', delta_k=5.0, rate_k_min=0.5, hold_s=600.0)['operation_id'] + h.step(600.0 + 600.0 + 700.0) + res = call(h, 'calibration.result', operation_id=op) + C = h.read('evaluator')['truth.heat_capacity_j_k'] + self.assertEqual(res['phase'], 'succeeded') + self.assertLess(abs(res['heat_capacity_j_k'] / C - 1.0), 0.05, (res['heat_capacity_j_k'], C)) + + def test15_evaluation_recovers_reaction_heat_and_enthalpy(self): + for noise in (False, True): + h, e, c1, c2, t0, t1, q_true = calibrated_hydrolysis(noise=noise) + C = h.read('evaluator')['truth.heat_capacity_j_k'] + ev = call(h, 'calorimetry.evaluate', experiment_id=e, start_s=t0, end_s=t1, limiting_reagent_mol=1.0, heat_capacity_j_k=C) + self.assertEqual((ev['ua_basis'], ev['interpolation'], ev['quality']), ('bracketing_calibrations', 'dosed_mass', ['ok'])) + self.assertLess(abs(ev['heat_released_j'] / q_true - 1.0), 0.02, (ev['heat_released_j'], q_true)) + dh = rt.library()['reactions']['acetic_anhydride_hydrolysis']['dh'] + self.assertLess(abs(ev['reaction_enthalpy_j_mol'] / dh - 1.0), 0.03) + self.assertGreater(ev['final_thermal_conversion'], 0.99) + + def test16_accumulation_and_mtsr(self): + h, e, c1, c2, t0, t1, q_true = calibrated_hydrolysis(noise=False) + C = h.read('evaluator')['truth.heat_capacity_j_k'] + ev = h.invoke('calorimetry.evaluate', experiment_id=e, start_s=t0, end_s=t1, limiting_reagent_mol=None, heat_capacity_j_k=C) + self.assertIsNone(ev['reaction_enthalpy_j_mol']) + self.assertTrue(0.05 < ev['max_accumulation'] < 0.6, ev['max_accumulation']) + self.assertGreater(ev['max_mtsr_k'], 313.15) + self.assertAlmostEqual(ev['adiabatic_temperature_rise_k'], ev['heat_released_j'] / C, places=9) + pts = ev['points'] + self.assertTrue(all(0.0 <= p['accumulation'] <= 1.0 for p in pts)) + self.assertTrue(all(p['mtsr_k'] >= p['tr_k'] - 1e-9 for p in pts)) + + def test17_evaluation_requires_calibrations(self): + h = with_water(**QUIET) + e = call(h, 'experiment.start', name='x')['experiment_id'] + settle_tr(h, s=600.0) + rejected(self, h, 'UA_CALIBRATION_REQUIRED', 'calorimetry.evaluate', experiment_id=e, start_s=0.0, end_s=600.0, limiting_reagent_mol=None, heat_capacity_j_k=None) + call(h, 'calibration.run', pre_s=600.0, heat_s=900.0, post_s=600.0); h.step(2200.0) + rejected(self, h, 'HEAT_CAPACITY_REQUIRED', 'calorimetry.evaluate', experiment_id=e, start_s=0.0, end_s=600.0, limiting_reagent_mol=None, heat_capacity_j_k=None) + rejected(self, h, 'UNKNOWN_EXPERIMENT', 'calorimetry.evaluate', experiment_id='exp-99', start_s=0.0, end_s=600.0, limiting_reagent_mol=None, heat_capacity_j_k=None) + rejected(self, h, 'WINDOW_TOO_SHORT', 'calorimetry.evaluate', experiment_id=e, start_s=100.0, end_s=110.0, limiting_reagent_mol=None, heat_capacity_j_k=3000.0) + + def test18_calibration_fails_when_conditions_change(self): + h = with_water(**QUIET) + settle_tr(h) + op = call(h, 'calibration.run', pre_s=600.0, heat_s=900.0, post_s=600.0)['operation_id'] + h.step(700.0) + self.assertTrue(h.read('evaluator')['cal_heater.on']) + call(h, 'stirrer.set', rpm=300.0) + res = h.invoke('calibration.result', operation_id=op) + self.assertEqual((res['phase'], res['reason']), ('failed', 'CONDITIONS_CHANGED')) + s = h.read('evaluator') + self.assertFalse(s['cal_heater.on'] or s['calibration.running']) + self.assertIsNone(s['calibration.ua_w_k']) + + def test19_dosing_completion_and_cancellation_residue(self): + h = with_water(**QUIET) + op = call(h, 'dosing.start', substance_id='ethanol', rate_kg_s=1e-3, total_mass_kg=0.05, feed_temperature_k=293.15)['operation_id'] + self.assertEqual(h.operations[op]['phase'], 'running') + h.step(60.0) + self.assertEqual(h.operations[op]['phase'], 'succeeded') + self.assertAlmostEqual(h.ledger()['dosed_kg'], 0.05, places=12) + op2 = call(h, 'dosing.start', substance_id='ethanol', rate_kg_s=1e-3, total_mass_kg=0.05, feed_temperature_k=None)['operation_id'] + h.step(20.0) + res = call(h, 'dosing.stop') + self.assertEqual((res['phase'], res['reason']), ('cancelled', 'USER_CANCEL')) + self.assertAlmostEqual(res['dosed_kg'], 0.02, places=9) # partial dosing stays in the reactor + self.assertAlmostEqual(h.ledger()['dosed_kg'], 0.07, places=9) + self.assertFalse(h.read('evaluator')['dosing.active']) + rejected(self, h, 'NOT_DOSING', 'dosing.stop') + self.assertNotEqual(op, op2) + + # ---------------------------------------------------------------- safety system + def test20_limit_violations_trigger_programs(self): + h = with_water(T=298.15, **QUIET) + call(h, 'safety.configure', **dict(SAFETY_EXAMPLE, tr_max_k=313.15)) + call(h, 'thermostat.set_tj', end_k=333.15, ramp_s=0.0) + run_until(h, lambda: h.emergency is not None, 7200.0) + self.assertEqual((h.emergency['program'], h.emergency['cause']), ('A', 'TR_ABOVE_MAX')) + h2 = with_water(T=298.15, **QUIET) + call(h2, 'safety.configure', **dict(SAFETY_EXAMPLE, tr_min_k=293.15, tsafe_k=298.15, tj_min_k=253.15)) + call(h2, 'thermostat.set_tj', end_k=285.15, ramp_s=0.0) + run_until(h2, lambda: h2.emergency is not None, 7200.0) + self.assertEqual(h2.emergency['program'], 'C') + self.assertIn('TR_BELOW_MIN', h2.emergency['cause']) + + def test21_emergency_a_actions(self): + h = with_water(**QUIET) + call(h, 'safety.configure', **dict(SAFETY_EXAMPLE, rsafe_rpm=100.0)) + settle_tr(h) + call(h, 'calibration.run', pre_s=300.0, heat_s=300.0, post_s=300.0); h.step(400.0) + self.assertTrue(h.read('evaluator')['cal_heater.on']) + call(h, 'emergency.trigger') + h.step(4.0) + s = h.read('evaluator') + self.assertEqual((s['emergency.program'], s['status.ok'], s['safety_relay.closed'], s['thermostat.mode'], s['cal_heater.on']), ('A', False, False, 'tj', False)) + self.assertEqual((s['truth.heater_power_w'], s['truth.valve_opening'], h.safety_valve), (0.0, 1.0, True)) + self.assertEqual(s['stirrer.setpoint_rpm'], 100.0) # Rsafe + self.assertEqual(h.operations[h.calibrations[-1]['operation_id']]['phase'] if h.calibrations else 'failed', 'failed') + + def test22_emergency_blocks_changes_and_reset_needs_clear_cause(self): + h = with_water(T=298.15, **QUIET) + call(h, 'safety.configure', **dict(SAFETY_EXAMPLE, tr_max_k=313.15)) + call(h, 'thermostat.set_tj', end_k=333.15, ramp_s=0.0) + run_until(h, lambda: h.emergency is not None, 7200.0) + rejected(self, h, 'EMERGENCY_ACTIVE', 'thermostat.set_tj', end_k=300.0, ramp_s=0.0) + rejected(self, h, 'EMERGENCY_ACTIVE', 'stirrer.set', rpm=100.0) + rejected(self, h, 'EMERGENCY_ACTIVE', 'dosing.start', substance_id='water', rate_kg_s=1e-4, total_mass_kg=0.01, feed_temperature_k=None) + if h._active_causes(): + rejected(self, h, 'CAUSE_PERSISTS', 'emergency.reset') + run_until(h, lambda: not h._active_causes(), 3600.0) + call(h, 'emergency.reset') + s = h.read('evaluator') + self.assertEqual((s['emergency.active'], s['status.ok'], s['safety_relay.closed'], s['thermostat.mode']), (False, True, True, 'tj')) + + def test23_b1_and_c_move_to_tsafe_at_0p1_k_per_s(self): + h = with_water(T=333.15, **QUIET) + call(h, 'safety.configure', **dict(SAFETY_EXAMPLE, tsafe_k=303.15, rmin_rpm=50.0)) + call(h, 'thermostat.set_tj', end_k=333.15, ramp_s=0.0); h.step(600.0) + call(h, 'stirrer.set', rpm=0.0) + run_until(h, lambda: h.emergency is not None, 400.0) + self.assertEqual((h.emergency['program'], h.emergency['cause']), ('B1', 'STIRRER_OFF_3MIN')) + sp0 = h.read('evaluator')['thermostat.tj_setpoint_k'] + h.step(100.0) + sp1 = h.read('evaluator')['thermostat.tj_setpoint_k'] + self.assertAlmostEqual((sp0 - sp1) / 100.0, EMERGENCY_GRADIENT_K_S, delta=0.011) + h.step(600.0) + self.assertAlmostEqual(h.read('evaluator')['thermostat.tj_setpoint_k'], 303.15, places=6) + + def test24_tc_above_max_for_3_min_triggers_a(self): + h = with_water(**QUIET) + call(h, 'safety.configure', **dict(SAFETY_EXAMPLE, tc_max_k=285.15)) # coolant 16 C: the cold oil is above 12 C + h.step(10.0) + self.assertIn('TC_ABOVE_MAX', [e['code'] for e in h.events]) + self.assertIsNone(h.emergency) + h.step(TC_MAX_DELAY_S) + self.assertEqual((h.emergency['program'], h.emergency['cause']), ('A', 'TC_ABOVE_MAX_3MIN')) + + def test25_more_than_one_cause_triggers_a(self): + # RC1e 5.6: one C cause -> C; two causes in the same cycle -> A (cycle logic driven with crafted indicated values) + for low_tj, want in ((False, 'C'), (True, 'A')): + h = with_water(T=298.15, **QUIET) + h.step(4.0) + h.meas = dict(h.meas, tr=h.safety['tr_min_k'] - 1.0, tj=h.safety['tj_min_k'] - (1.0 if low_tj else -30.0)) + h._safety_cycle() + self.assertEqual(h.emergency['program'], want, h.emergency) + self.assertEqual('+' in h.emergency['cause'], low_tj) + + def test26_emergency_button_is_never_guarded(self): + h = with_water(**QUIET) + h.register_principal('a1', 'agent'); h.register_principal('a2', 'agent') + s1, s2 = h.session('a1'), h.session('a2') + r = s1.invoke(instance_id=h.instance_id, capability_id='experiment.start', arguments=dict(name='a1-run'), request_id='x1') + self.assertEqual(r['status'], 'succeeded') + r = s2.invoke(instance_id=h.instance_id, capability_id='thermostat.set_tj', arguments=dict(end_k=320.0, ramp_s=0.0), request_id='y1') + self.assertEqual(r['error']['code'], 'ACCESS_DENIED') + r = s2.invoke(instance_id=h.instance_id, capability_id='emergency.trigger', arguments={}, request_id='y2') + self.assertEqual((r['status'], r['result']['program']), ('succeeded', 'A')) + + # ---------------------------------------------------------------- stirrer, reactor, readings + def test27_glass_stirrer_torque_limit(self): + h = plant(**QUIET) + call(h, 'reactor.charge', substances=[dict(substance_id='glycerol', mass_kg=1.26)], temperature_k=298.15, viscosity_pa_s=1.4, thermal_conductivity_w_m_k=0.29, + accept_priors=True) + call(h, 'stirrer.set', rpm=600.0) + h.step(20.0) + s = h.read('evaluator') + self.assertLess(s['stirrer.indicated_rpm'], 600.0) + self.assertAlmostEqual(s['truth.stirrer_torque_nm'], GLASS_STIRRER_TORQUE_MAX_NM, delta=1e-3) + h2 = with_water(rpm=600.0, **QUIET) + h2.step(20.0) + self.assertEqual(h2.read('evaluator')['stirrer.indicated_rpm'], 600.0) + + def test28_stirrer_angle_mirror_modulo_one_turn(self): + h = with_water(rpm=240.0, **QUIET) + h.step(10.0) + a0 = h.read('evaluator')['stirrer.angle_rad'] + h.step(0.125) # 240 rpm = 4 rev/s: half a turn + a1 = h.read('evaluator')['stirrer.angle_rad'] + self.assertAlmostEqual((a1 - a0) % (2 * math.pi), math.pi, places=6) + self.assertTrue(0.0 <= a1 < STIRRER_JOINT_MAX_RAD) + + def test29_discharge_drains_and_switches_to_tj(self): + h = with_water(kg=0.8, **QUIET) + settle_tr(h, s=300.0) + call(h, 'reactor.discharge', open=True) + h.step(2.0) + self.assertTrue(h.read('evaluator')['drain.open']) + run_until(h, lambda: h.read('evaluator')['thermostat.mode'] == 'tj', 600.0) + self.assertIn('TR_SENSOR_NOT_IMMERSED', [e['code'] for e in h.events]) + h.step(120.0) + s = h.read('evaluator') + self.assertLess(s['truth.volume_m3'], 1e-9) + self.assertAlmostEqual(h.ledger()['discharged_kg'], 0.8, places=9) + call(h, 'reactor.discharge', open=False); h.step(2.0) + self.assertEqual(h.read('evaluator')['drain.angle_rad'], 0.0) + + def test30_bubble_point_guard(self): + h = plant(**QUIET) + call(h, 'reactor.charge', substances=[dict(substance_id='dichloromethane', mass_kg=0.9)], temperature_k=293.15, viscosity_pa_s=0.00041, thermal_conductivity_w_m_k=0.14, + accept_priors=True) + bp = h.read('evaluator')['truth.bubble_point_k'] + self.assertAlmostEqual(bp, rt.library()['substances']['dichloromethane']['tb'], places=3) + rejected(self, h, 'ABOVE_BUBBLE_POINT', 'thermostat.set_tr', end_k=bp - 1.0, ramp_s=0.0, controller='organic') + call(h, 'thermostat.set_tr', end_k=bp - 5.0, ramp_s=0.0, controller='organic') + + def test31_readings_are_quantised_with_offsets(self): + h = with_water(tr_offset_k=0.2, tj_offset_k=-0.1, sensor_noise_k=0.0) + h.step(600.0) + s = h.read('evaluator') + for k in ('reactor.indicated_k', 'jacket.indicated_k', 'cooling_oil.indicated_k'): + self.assertAlmostEqual(s[k] / RESOLUTION_K, round(s[k] / RESOLUTION_K), places=6) + h.step(0.5) # readings only change on the 2 s cycle + self.assertEqual(h.read('evaluator')['reactor.indicated_k'], s['reactor.indicated_k']) + self.assertAlmostEqual(s['reactor.indicated_k'] - s['truth.reactor_k'], 0.2, delta=0.02) + + def test32_host_step_independence(self): + a, b = with_water(), with_water() + for h, dt in ((a, 2.0), (b, 60.0)): + call(h, 'thermostat.set_tr', end_k=333.15, ramp_s=300.0, controller='aqueous') + for _ in range(int(1200 / dt)): + h.step(dt) + sa, sb = state(a), state(b) + for k in ('truth.reactor_k', 'truth.jacket_k', 'truth.cooling_oil_k', 'reactor.indicated_k'): + self.assertAlmostEqual(sa[k], sb[k], places=9, msg=k) + + def test33_pi_stability_bound(self): + self.assertLessEqual(KP_TJ_W_K * CYCLE_S / PLANT_FIT['C_J'], 0.5) + h = plant(**QUIET) + call(h, 'thermostat.set_tj', end_k=323.15, ramp_s=0.0) + h.step(1800.0) + tj = [] + for _ in range(60): + h.step(2.0); tj.append(h.read('evaluator')['truth.jacket_k']) + self.assertLess(max(tj) - min(tj), 0.05) + self.assertAlmostEqual(sum(tj) / len(tj), 323.15, delta=0.1) + + def test34_power_loss_means_no_cooling(self): + h, *_ = calibrated_hydrolysis(noise=False) + call(h, 'dosing.start', substance_id='acetic_anhydride', rate_kg_s=1e-3, total_mass_kg=0.05, feed_temperature_k=313.15) + h.step(30.0) + call(h, 'power.set', enabled=False) + T0 = h.read('evaluator')['truth.reactor_k'] + h.step(120.0) + s = h.read('evaluator') + self.assertGreater(s['truth.reactor_k'], T0 + 0.5) # reaction continues without cooling + self.assertEqual((s['truth.heater_power_w'], s['truth.valve_opening'], s['dosing.active'], s['reactor.indicated_k']), (0.0, 0.0, False, None)) + + def test35_kirchhoff_consistent_adiabatic_reaction(self): + h = MtRc1mxhfcalRuntime() + call(h, 'plant.configure', **dict(PLANT_EXAMPLE, **QUIET)) + call(h, 'reactor.charge', substances=[dict(substance_id='water', mass_kg=0.5), dict(substance_id='acetic_anhydride', mass_kg=0.05)], temperature_k=298.15, + viscosity_pa_s=0.001, thermal_conductivity_w_m_k=0.55, accept_priors=True) + call(h, 'reaction.configure', **HYDROLYSIS) + subs = rt.library()['substances'] + n0 = dict(h.n) + E0 = rt.formation_enthalpy(h.n) + h._C_r() * (h.T[0] - T_REF) + h._react(600.0) + E1 = rt.formation_enthalpy(h.n) + h._C_r() * (h.T[0] - T_REF) + self.assertAlmostEqual(E0, E1, delta=1e-6 * abs(E0)) + xi = n0['acetic_anhydride'] - h.n['acetic_anhydride'] + self.assertGreater(xi, 0.0) + self.assertAlmostEqual(h.led['reaction_heat_j'].value, -rt.library()['reactions']['acetic_anhydride_hydrolysis']['dh'] * xi, delta=1e-6) + self.assertIn('acetic_acid', h.n) + self.assertGreater(subs['acetic_acid']['cp_mol'], 0.0) + + # ---------------------------------------------------------------- host protocol + def test36_request_binding_and_unsupported(self): + h = with_water() + h.register_principal('a1', 'agent') + s = h.session('a1') + r1 = s.invoke(instance_id=h.instance_id, capability_id='stirrer.set', arguments=dict(rpm=300.0), request_id='q') + r2 = s.invoke(instance_id=h.instance_id, capability_id='stirrer.set', arguments=dict(rpm=300.0), request_id='q') + self.assertEqual(r1, r2) + r3 = s.invoke(instance_id=h.instance_id, capability_id='stirrer.set', arguments=dict(rpm=400.0), request_id='q') + self.assertEqual(r3['error']['code'], 'REQUEST_CONFLICT') + bad = s.invoke(instance_id=h.instance_id, capability_id='stirrer.set', arguments=dict(rpm=5.0), request_id='b') + self.assertEqual(s.invoke(instance_id=h.instance_id, capability_id='stirrer.set', arguments=dict(rpm=5.0), request_id='b'), bad) # rejections bind too + for k in UNSUPPORTED: + r = s.invoke(instance_id=h.instance_id, capability_id=k, arguments={}, request_id='u-' + k) + self.assertEqual((r['status'], r['error']['code']), ('unsupported', 'UNSUPPORTED')) + + def test37_ownership_of_experiments_and_operations(self): + h = with_water(**QUIET) + for p, v in (('a1', 'agent'), ('a2', 'agent'), ('ev', 'evaluator')): + h.register_principal(p, v) + s1, s2, ev = h.session('a1'), h.session('a2'), h.session('ev') + e = s1.invoke(instance_id=h.instance_id, capability_id='experiment.start', arguments=dict(name='mine'), request_id='1')['result']['experiment_id'] + h.step(20.0) + self.assertTrue(s2.read(instance_id=h.instance_id, state_ids=['experiment.started_by_other_agent'])['observations']['experiment.started_by_other_agent']['value']) + self.assertFalse(s1.read(instance_id=h.instance_id, state_ids=['experiment.started_by_other_agent'])['observations']['experiment.started_by_other_agent']['value']) + for k, a in (('experiment.data', dict(experiment_id=e)), ('experiment.end', dict(end_mode='keep', end_temperature_k=None)), ('stirrer.toggle', {}), + ('calibration.run', dict(pre_s=300.0, heat_s=300.0, post_s=300.0))): + self.assertEqual(s2.invoke(instance_id=h.instance_id, capability_id=k, arguments=a, request_id='2' + k)['error']['code'], 'ACCESS_DENIED', k) + self.assertEqual(ev.invoke(instance_id=h.instance_id, capability_id='experiment.data', arguments=dict(experiment_id=e), request_id='3')['status'], 'succeeded') + op = s1.invoke(instance_id=h.instance_id, capability_id='dosing.start', + arguments=dict(substance_id='water', rate_kg_s=1e-4, total_mass_kg=0.01, feed_temperature_k=None), request_id='4')['operation_id'] + with self.assertRaises(ActionRejected): + s2.poll(op) + self.assertEqual(s1.poll(op)['status'], 'running') + r = s1.cancel(op, 'c1') + self.assertEqual(r['result']['phase'], 'cancelled') + self.assertEqual(s1.cancel(op, 'c1'), r) # replay + with self.assertRaises(ActionRejected) as ex: + s1.cancel(op, 'c2') + self.assertEqual(str(ex.exception), 'NOT_RUNNING') + + def test38_calibration_cancel_leaves_no_ua(self): + h = with_water(**QUIET) + h.register_principal('a1', 'agent') + s = h.session('a1') + settle_tr(h, s=600.0) + op = s.invoke(instance_id=h.instance_id, capability_id='calibration.run', arguments=dict(pre_s=300.0, heat_s=300.0, post_s=300.0), request_id='k')['operation_id'] + h.step(400.0) + self.assertTrue(h.read('evaluator')['cal_heater.on']) + s.cancel(op, 'kc') + st = h.read('evaluator') + self.assertFalse(st['cal_heater.on'] or st['calibration.running']) + self.assertIsNone(st['calibration.ua_w_k']) + self.assertEqual(s.poll(op)['status'], 'cancelled') + + def test39_record_decimation_and_event_cap(self): + h = plant(**QUIET) + e = call(h, 'experiment.start', name='long')['experiment_id'] + h.step(MAX_POINTS * CYCLE_S + 200.0) + d = call(h, 'experiment.data', experiment_id=e) + self.assertLessEqual(len(d['points']), MAX_POINTS) + self.assertEqual(d['interval_s'], 2 * CYCLE_S) + for i in range(MAX_EVENTS + 5): + h._event('task', 'X', str(i)) + ev = call(h, 'events.read', since_s=0.0) + self.assertEqual((len(ev['events']), ev['dropped'] >= 5), (MAX_EVENTS, True)) + end = call(h, 'experiment.end', end_mode='cool_to', end_temperature_k=298.15) + self.assertEqual(end['experiment_id'], e) + self.assertEqual(h.read('evaluator')['thermostat.tj_setpoint_k'], 298.15) + + # ---------------------------------------------------------------- data, geometry and interface agreement + def test40_reaction_mass_library_is_real_data(self): + lib = json.loads(LIBRARY_PATH.read_text()) + good = [s for s in lib['substances'] if s['runtime_eligible'] and s['cp_liquid']['evidence'] == 'measured_literature' and s['density']['evidence'] == 'measured_literature'] + self.assertGreaterEqual(len(good), 50) + self.assertEqual(lib['coverage']['synthetic_records'], 0) + rx = lib['reactions'][0] + self.assertEqual((rx['evidence'], rx['kinetics']), ('derived', None)) + tv = json.loads((OUT / 'template_validation.json').read_text()) + self.assertEqual(tv['status'], 'passed') + + def test41_fill_table_agrees_with_geometry_and_documented_volumes(self): + v, hgt, a = rt.fill_table() + self.assertLess(abs(v[-1] / NOMINAL_VOLUME_M3 - 1.0), 0.05) # 2.5 L nominal (RC1e 9.5) + self.assertGreater(rt.liquid_height(OPERATING_VOLUME_M3[0]), interface.PROBE_TIP_Z - interface.REACTOR_BOTTOM_Z) # probes immersed at 0.5 L + self.assertLess(interface.REACTOR_BOTTOM_Z + rt.liquid_height(OPERATING_VOLUME_M3[1]), interface.JACKET_Z[1]) # 2 L still inside the jacket + self.assertGreater(rt.wetted_area(2e-3), 1.5 * rt.wetted_area(1e-3)) + + def test42_interface_keys_readouts_and_motion(self): + for key, (capability, args) in interface.KEY_COMMANDS.items(): + self.assertIn(capability, CAPS) + self.assertEqual(CAPS[capability]['visibility'], 'agent') + for r in interface.READOUTS: + self.assertIn(r['source']['bridge'][0], SLOTS) + for l in interface.LAMPS: + self.assertIn(l['source']['lamp']['bridge'], SLOTS) + for part, sid, cap_, kind, unit, hi in interface.MOTION: + self.assertIn(sid, SLOTS) + self.assertIn(cap_, CAPS) + self.assertEqual((interface.STIRRER_JOINT_MAX_RAD, interface.DRAIN_OPEN_RAD), (STIRRER_JOINT_MAX_RAD, DRAIN_OPEN_RAD)) + self.assertEqual((interface.AXIS_X, interface.AXIS_Y), (json.loads(MANIFEST_PATH.read_text())['reactor']['axis_xy_m'][0], + json.loads(MANIFEST_PATH.read_text())['reactor']['axis_xy_m'][1])) + + def test43_panel_keys_toggle(self): + h = with_water(**QUIET) + call(h, 'stirrer.toggle') + self.assertEqual(h.read('evaluator')['stirrer.setpoint_rpm'], 0.0) + call(h, 'stirrer.toggle') + self.assertEqual(h.read('evaluator')['stirrer.setpoint_rpm'], 250.0) + call(h, 'power.toggle') + self.assertFalse(h.read('evaluator')['power.enabled']) + call(h, 'power.toggle') + self.assertEqual(h.read('evaluator')['thermostat.mode'], 'tj') + h2 = plant() + rejected(self, h2, 'STIRRER_SETPOINT_REQUIRED', 'stirrer.toggle') + + def test44_contract_metadata_consistent(self): + m = export_mt_rc1mxhfcal_contract_metadata() + self.assertEqual(set(m['capabilities']), set(CAPS)) + self.assertEqual(set(m['state_slots']), set(SLOTS)) + for k, c in m['capabilities'].items(): + self.assertTrue(set(e['code'] for e in c['errors']) <= set(ERROR_ZH), k) + for p in c['preconditions']: + self.assertTrue(set(p['state_ids']) <= set(SLOTS), (k, p['state_ids'])) + self.assertTrue(set(OBSERVES.get(k, [])) <= set(SLOTS), k) + self.assertTrue(set(rt.ERRORS) <= set(ERROR_ZH)) + params = m['mechanisms']['rc1_heat_flow_calorimetry']['parameters'] + self.assertEqual(params['fit_u_w200']['evidence'], 'assumption') + self.assertIn('RC1e', params['fit_u_w200']['uncertainty']) + self.assertTrue(all(v['evidence'] in ('documented', 'measured', 'photo_estimate', 'assumption', 'unknown') for v in params.values())) + + def test45_safety_configure_checks_current_values_and_rmax(self): + h = with_water(rpm=500.0, T=313.15, **QUIET) + h.step(60.0) + rejected(self, h, 'LIMIT_VIOLATED_NOW', 'safety.configure', **dict(SAFETY_EXAMPLE, tr_max_k=300.0, tsafe_k=298.15)) + rejected(self, h, 'STIRRER_ABOVE_RMAX', 'safety.configure', **dict(SAFETY_EXAMPLE, rmax_rpm=400.0)) + call(h, 'safety.configure', **dict(SAFETY_EXAMPLE, rmax_rpm=600.0)) + rejected(self, h, 'OUTSIDE_STIRRER_RANGE', 'stirrer.set', rpm=700.0) + + def test46_pi_option_shows_integral_tail(self): + errs = {} + for ctl in ('aqueous', 'aqueous_pi'): + h = with_water(**QUIET) + settle_tr(h, controller=ctl) + op = call(h, 'calibration.run', pre_s=600.0, heat_s=900.0, post_s=600.0)['operation_id'] + h.step(2200.0) + r = h.invoke('calibration.result', operation_id=op) + errs[ctl] = (r['phase'], r['reason'], None if r['ua_w_k'] is None else abs(r['ua_w_k'] / h.read('evaluator')['truth.ua_w_k'] - 1.0)) + self.assertEqual(errs['aqueous'][:2], ('succeeded', None)) + self.assertLess(errs['aqueous'][2], 0.01) + # the documented P-only default gives the cleaner calibration: the PI tail either fails the steady-state check or biases UA more + self.assertTrue(errs['aqueous_pi'][:2] == ('failed', 'CALIBRATION_NOT_STEADY') or errs['aqueous_pi'][2] > errs['aqueous'][2], errs) + + def test47_charge_mixing_energy(self): + h = MtRc1mxhfcalRuntime() + call(h, 'plant.configure', **dict(PLANT_EXAMPLE, **QUIET)) + call(h, 'reactor.charge', substances=[dict(substance_id='water', mass_kg=0.5)], temperature_k=353.15, viscosity_pa_s=0.001, thermal_conductivity_w_m_k=0.6, + accept_priors=True) + C1 = h._C_r() + T1 = h.T[0] + call(h, 'reactor.charge', substances=[dict(substance_id='water', mass_kg=0.5)], temperature_k=293.15, viscosity_pa_s=0.001, thermal_conductivity_w_m_k=0.6, + accept_priors=True) + C2 = h._C_r() + half = C2 - C1 + self.assertAlmostEqual(h.T[0], (C1 * T1 + half * 293.15) / C2, places=9) + + # ---------------------------------------------------------------- independent review round 1 (2026-09-25): regression tests + def test48_b1_and_c_start_from_the_current_temperature(self): + h = with_water(kg=1.0, T=298.15, **QUIET) + call(h, 'safety.configure', **dict(SAFETY_EXAMPLE, rmin_rpm=30.0)) + call(h, 'thermostat.set_tr', end_k=353.15, ramp_s=0.0, controller='aqueous') + call(h, 'stirrer.set', rpm=0.0) # Tr step heating, stirrer switched off by the operator + run_until(h, lambda: h.read('evaluator')['emergency.program'] is not None, 400.0) + s = h.read('evaluator') + self.assertEqual((s['emergency.program'], s['emergency.cause']), ('B1', 'STIRRER_OFF_3MIN')) + self.assertLessEqual(s['thermostat.tj_setpoint_k'], s['jacket.indicated_k'] + 0.011) # ramp from the current Tj, not the cascade set point + tj0 = s['truth.jacket_k'] + rise = 0.0 + for _ in range(100): + h.step(2.0) + rise = max(rise, h.read('evaluator')['truth.jacket_k'] - tj0) + self.assertLess(rise, 0.5) + # C in the Tj mode from the current (indicated) Tj: a cold charge pulls Tr below Tr min while the jacket set point is elsewhere + h = with_water(kg=1.0, T=353.15, **QUIET) + call(h, 'thermostat.set_tj', end_k=353.15, ramp_s=0.0) + h.step(1800.0) + call(h, 'safety.configure', **dict(SAFETY_EXAMPLE, tr_min_k=340.15, tsafe_k=345.15, tr_max_k=393.15, tj_max_k=423.15)) + call(h, 'thermostat.set_tj', end_k=363.15, ramp_s=3600.0) + h.step(20.0) + call(h, 'reactor.charge', substances=[dict(substance_id='water', mass_kg=0.4)], temperature_k=275.15, viscosity_pa_s=0.00089, + thermal_conductivity_w_m_k=0.6, accept_priors=True) + run_until(h, lambda: h.read('evaluator')['emergency.program'] is not None, 20.0) + s = h.read('evaluator') + self.assertEqual((s['emergency.program'], s['emergency.cause']), ('C', 'TR_BELOW_MIN')) + self.assertLess(abs(s['thermostat.tj_setpoint_k'] - s['jacket.indicated_k']), 0.3) + + def test49_stirrer_emergencies_can_be_reset(self): + h = with_water(kg=1.0, T=298.15, **QUIET) + call(h, 'safety.configure', **dict(SAFETY_EXAMPLE, rmin_rpm=30.0)) + call(h, 'stirrer.set', rpm=0.0) + h.step(200.0) + self.assertEqual(h.read('evaluator')['emergency.program'], 'B1') + rejected(self, h, 'EMERGENCY_ACTIVE', 'stirrer.set', rpm=200.0) # no changes while the program is active (RC1e 5.5) + call(h, 'emergency.reset') # delayed cause: its delay restarts + s = h.read('evaluator') + self.assertIsNone(s['emergency.program']) + self.assertEqual(h._stir_off_since, h.time_s) + call(h, 'stirrer.set', rpm=200.0) + h.step(400.0) + self.assertIsNone(h.read('evaluator')['emergency.program']) + # Rsafe = 0: the program stops the stirrer, which is not a manual stop and does not block the reset + h = with_water(kg=1.0, T=298.15, **QUIET) + call(h, 'safety.configure', **dict(SAFETY_EXAMPLE, rmin_rpm=30.0, rsafe_rpm=0.0)) + h.step(10.0) + call(h, 'emergency.trigger') + h.step(240.0) + self.assertEqual(h.read('evaluator')['emergency.cause'], 'EMERGENCY_BUTTON') + call(h, 'emergency.reset') + h.step(400.0) + self.assertIsNone(h.read('evaluator')['emergency.program']) + # an immediate cause still blocks the reset + h = with_water(kg=1.0, T=298.15, **QUIET) + call(h, 'safety.configure', **dict(SAFETY_EXAMPLE, tr_max_k=393.15)) + h._enter_emergency('C', 'TEST') + h.meas = dict(h.meas, tr=250.0) # below Tr min in this cycle + rejected(self, h, 'CAUSE_PERSISTS', 'emergency.reset') + + def test50_tdiff_released_while_tr_rises_during_cooling(self): + h = with_water(kg=0.8, T=313.15, **QUIET) + call(h, 'reactor.charge', substances=[dict(substance_id='acetic_anhydride', mass_kg=0.3)], temperature_k=313.15, viscosity_pa_s=0.00089, + thermal_conductivity_w_m_k=0.6, accept_priors=True) + call(h, 'safety.configure', **dict(SAFETY_EXAMPLE, tdiff_max_k=10.0, tj_min_k=233.15, tr_max_k=393.15)) + call(h, 'thermostat.set_tr', end_k=313.15, ramp_s=0.0, controller='aqueous') + h.step(1200.0) + call(h, 'reaction.configure', **dict(HYDROLYSIS, reactions=[dict(HYDROLYSIS['reactions'][0], log10_a=5.0)])) + lifted, prev = 0, h.read('evaluator')['reactor.indicated_k'] + for _ in range(900): + h.step(2.0) + s = h.read('evaluator') + tr, tj = s['reactor.indicated_k'], s['thermostat.tj_setpoint_k'] + lifted += tr > prev and tj < tr - 10.0 - 1e-6 + prev = tr + self.assertGreater(lifted, 0) # RC1e 9.6: restriction not effective while Tr rises during cooling + # heating keeps the restriction: Tj set never above Tr + T diff max + h = with_water(kg=1.0, T=298.15, **QUIET) + call(h, 'safety.configure', **dict(SAFETY_EXAMPLE, tdiff_max_k=10.0)) + call(h, 'thermostat.set_tr', end_k=353.15, ramp_s=0.0, controller='aqueous') + for _ in range(300): + h.step(2.0) + s = h.read('evaluator') + self.assertLessEqual(s['thermostat.tj_setpoint_k'], s['reactor.indicated_k'] + 10.0 + 1e-9) + + def test51_bubble_point_guard_on_every_path(self): + h = with_water(kg=1.0, T=298.15, **QUIET) + call(h, 'safety.configure', **dict(SAFETY_EXAMPLE, tj_max_k=503.15, tr_max_k=473.15, tc_max_k=323.15)) + rejected(self, h, 'ABOVE_BUBBLE_POINT', 'thermostat.set_tj', end_k=423.15, ramp_s=0.0) + e = call(h, 'experiment.start', name='x')['experiment_id'] + rejected(self, h, 'ABOVE_BUBBLE_POINT', 'experiment.end', end_mode='cool_to', end_temperature_k=380.0) + self.assertTrue(e) + # volatile feed into a warm organic mass (ideal Raoult mixing): bubble point of the final composition below the Tr target + h = plant(**QUIET) + call(h, 'reactor.charge', substances=[dict(substance_id='toluene', mass_kg=0.8)], temperature_k=313.15, viscosity_pa_s=0.00056, + thermal_conductivity_w_m_k=0.13, accept_priors=True) + call(h, 'stirrer.set', rpm=250.0) + call(h, 'thermostat.set_tr', end_k=333.15, ramp_s=0.0, controller='organic') + h.step(1800.0) + rejected(self, h, 'ABOVE_BUBBLE_POINT', 'dosing.start', substance_id='diethyl_ether', rate_kg_s=1e-4, total_mass_kg=0.5, feed_temperature_k=293.15) + rejected(self, h, 'ABOVE_BUBBLE_POINT', 'reactor.charge', substances=[dict(substance_id='diethyl_ether', mass_kg=0.5)], temperature_k=293.15, + viscosity_pa_s=0.0005, thermal_conductivity_w_m_k=0.13, accept_priors=True) + call(h, 'dosing.start', substance_id='ethanol', rate_kg_s=1e-4, total_mass_kg=0.01, feed_temperature_k=None) # small, bubble point stays high + # a runaway that reaches the bubble point is flagged (no boiling model) + h = with_water(kg=0.8, T=333.15, **QUIET) + call(h, 'reactor.charge', substances=[dict(substance_id='acetic_anhydride', mass_kg=0.5)], temperature_k=333.15, viscosity_pa_s=0.00089, + thermal_conductivity_w_m_k=0.6, accept_priors=True) + call(h, 'reaction.configure', **dict(HYDROLYSIS, reactions=[dict(HYDROLYSIS['reactions'][0], log10_a=7.0)])) + call(h, 'power.set', enabled=False) # no cooling: adiabatic runaway + h.step(3600.0) + codes = [ev['code'] for ev in h.events] + self.assertIn('BOILING_NOT_MODELLED', codes) + self.assertTrue(h._boil_log) + + def test52_evaluation_flags_incomplete_reaction(self): + h = with_water(kg=0.8, T=313.15, noise_seed=7) + call(h, 'reaction.configure', **dict(HYDROLYSIS, reactions=[dict(HYDROLYSIS['reactions'][0], log10_a=4.0)])) + e = call(h, 'experiment.start', name='slow')['experiment_id'] + settle_tr(h) + call(h, 'calibration.run', pre_s=600.0, heat_s=900.0, post_s=600.0) + h.step(2200.0) + t0 = h.time_s + call(h, 'dosing.start', substance_id='acetic_anhydride', rate_kg_s=1.5e-4, total_mass_kg=0.10209, feed_temperature_k=None) + h.step(1800.0) + t1 = h.time_s + ev = call(h, 'calorimetry.evaluate', experiment_id=e, start_s=t0, end_s=t1, limiting_reagent_mol=1.0, heat_capacity_j_k=3700.0) + self.assertIn('reaction_incomplete_at_window_end', ev['quality']) + ev2 = call(h, 'calorimetry.evaluate', experiment_id=e, start_s=t0 + 600.0, end_s=t1, limiting_reagent_mol=1.0, heat_capacity_j_k=3700.0) + self.assertIn('reaction_running_at_window_start', ev2['quality']) + + def test53_cp_uses_the_measured_ramp_slope(self): + h = with_water(kg=1.0, T=313.15, noise_seed=3) + settle_tr(h, s=3600.0) + call(h, 'calibration.run', pre_s=900.0, heat_s=900.0, post_s=900.0) + h.step(2800.0) + for dk, rate, hold in [(2.0, 2.0, 300.0), (5.0, 0.5, 600.0)]: + hc = copy.deepcopy(h) + op = call(hc, 'calibration.cp', delta_k=dk, rate_k_min=rate, hold_s=hold)['operation_id'] + hc.step(2 * hold + dk / rate * 60 + 60) + r = hc.invoke('calibration.result', operation_id=op) + true = hc.read('evaluator')['truth.heat_capacity_j_k'] + self.assertTrue(r['phase'] != 'succeeded' or abs(r['heat_capacity_j_k'] / true - 1) <= 0.10, (dk, rate, r, true)) + if r['phase'] == 'succeeded': + self.assertGreater(r['measured_rate_k_s'], 0.0) + + def test54_short_calibrations_are_not_steady_or_honest(self): + for subs, mu, k in [([('water', 1.0)], 0.00089, 0.6), ([('glycerol', 0.75)], 1.4, 0.285)]: + h = plant(sensor_noise_k=0.003) + call(h, 'reactor.charge', substances=[dict(substance_id=s, mass_kg=m) for s, m in subs], temperature_k=313.15, viscosity_pa_s=mu, + thermal_conductivity_w_m_k=k, accept_priors=True) + call(h, 'stirrer.set', rpm=250.0) + settle_tr(h, s=3600.0) + op = call(h, 'calibration.run', pre_s=300.0, heat_s=300.0, post_s=300.0)['operation_id'] + h.step(960.0) + r = h.invoke('calibration.result', operation_id=op) + if r['phase'] == 'succeeded': + err = r['ua_w_k'] / h.read('evaluator')['truth.ua_w_k'] - 1 + self.assertLessEqual(abs(err), 3 * r['uncertainty_w_k'] / r['ua_w_k'] + 0.01, r) + else: + self.assertEqual(r['reason'], 'CALIBRATION_NOT_STEADY') + self.assertEqual(r['reason'], 'CALIBRATION_NOT_STEADY') # 0.6 L glycerol: 300 s stages are far from steady + + def test55_tc_above_40c_triggers_program_c(self): + h = plant(coolant_inlet_k=298.15, **QUIET) + call(h, 'safety.configure', **dict(SAFETY_EXAMPLE, tj_max_k=503.15, tr_max_k=473.15, tc_max_k=323.15)) + call(h, 'reactor.charge', substances=[dict(substance_id='glycerol', mass_kg=1.0)], temperature_k=298.15, viscosity_pa_s=0.9, + thermal_conductivity_w_m_k=0.285, accept_priors=True) + call(h, 'stirrer.set', rpm=200.0) + call(h, 'thermostat.set_tj', end_k=473.15, ramp_s=0.0) + h.step(2400.0) + call(h, 'thermostat.set_tj', end_k=298.15, ramp_s=0.0) + for _ in range(900): + h.step(2.0) + s = h.read('evaluator') + if s['cooling_oil.indicated_k'] > 313.15: + self.assertIsNotNone(s['emergency.program']) # RC1e 5.6: Tc outside (Tjoil min ... +40 C) -> C + self.assertIn('TC_OUTSIDE_LIMITS', [ev['message_zh'].split(':')[-1] for ev in h.events if ev['kind'] == 'emergency']) + + def test56_power_up_to_tsafe_with_last_stirrer_setting(self): + h = with_water(kg=1.0, T=330.15, noise_seed=3) + call(h, 'stirrer.set', rpm=200.0) + call(h, 'thermostat.set_tj', end_k=340.0, ramp_s=0.0) + h.step(600.0) + call(h, 'power.set', enabled=False) + h.step(600.0) + call(h, 'power.set', enabled=True) + s = h.read('evaluator') + self.assertEqual(s['thermostat.tj_setpoint_k'], SAFETY_EXAMPLE['tsafe_k']) # RC1e 5.9, and no leak of truth.jacket_k + self.assertNotEqual(s['thermostat.tj_setpoint_k'], s['truth.jacket_k']) + self.assertEqual(s['stirrer.setpoint_rpm'], 200.0) + + def test57_dosing_records_ownership_and_cp_cancel(self): + h = with_water(kg=0.8, T=313.15, noise_seed=5) + h.register_principal('a', 'agent'); h.register_principal('b', 'agent') + A, B = h.session('a'), h.session('b') + r = A.invoke(instance_id=h.instance_id, capability_id='dosing.start', arguments=dict(substance_id='ethanol', rate_kg_s=1.234e-4, total_mass_kg=0.05, + feed_temperature_k=None), request_id='d1') + op = r['operation_id'] + h.step(37.3) + polled = A.poll(op)['result']['dosed_kg'] + self.assertGreater(polled, 0.0) + self.assertAlmostEqual(polled / 1e-4, round(polled / 1e-4), places=6) # 0.1 g balance reading + self.assertEqual(polled, h.read('agent')['dosing.indicated_mass_kg']) + denied = B.invoke(instance_id=h.instance_id, capability_id='dosing.stop', arguments={}, request_id='s1') + self.assertEqual(denied['error']['code'], 'ACCESS_DENIED') + stop = A.invoke(instance_id=h.instance_id, capability_id='dosing.stop', arguments={}, request_id='s2')['result'] + self.assertAlmostEqual(stop['dosed_kg'] / 1e-4, round(stop['dosed_kg'] / 1e-4), places=6) + self.assertTrue(all(len(ev['message_zh'].split(':')[-1].rstrip('g').split('.')[-1]) <= 1 for ev in h.events if ev['code'].startswith('DOSING_C'))) + # cancelling a heat-capacity ramp holds the Tr set point where it is + settle_tr(h, s=1800.0) + call(h, 'calibration.run', pre_s=600.0, heat_s=900.0, post_s=600.0) + h.step(2200.0) + cp = A.invoke(instance_id=h.instance_id, capability_id='calibration.cp', arguments=dict(delta_k=5.0, rate_k_min=0.5, hold_s=300.0), request_id='c1')['operation_id'] + h.step(300.0 + 240.0) + A.cancel(cp, 'x1') + held = h.read('agent')['thermostat.tr_setpoint_k'] + h.step(600.0) + self.assertAlmostEqual(h.read('agent')['thermostat.tr_setpoint_k'], held, places=9) + self.assertLess(held, 313.15 + 5.0 - 1.0) + + def test58_small_review_items(self): + # stirrer angle independent of the host step partition during spin-up (exact for constant acceleration) + angles = [] + for dt in (2.0, 0.5, 0.01): + h = with_water(kg=1.0, T=298.15, rpm=0.0, **QUIET) + h.step(2.0) + call(h, 'stirrer.set', rpm=250.0) + n = int(round(6.0 / dt)) + for _ in range(n): + h.step(dt) + angles.append(h.stir_angle) + self.assertLess(max(abs(math.remainder(a - angles[0], 2 * math.pi)) for a in angles), 1e-6) + # a full drain leaves nothing on record + h = with_water(kg=0.8, T=313.15, **QUIET) + call(h, 'reactor.discharge', open=True) + h.step(3600.0) + self.assertEqual(h.read('agent')['reactor.charged_mass_kg'], 0.0) + # library() hands out copies; integral floats are integers (JSON Schema) + self.assertIsNot(rt.library(), rt.library()) + h = MtRc1mxhfcalRuntime() + call(h, 'plant.configure', **dict(PLANT_EXAMPLE, noise_seed=7.0)) + self.assertEqual(h.plant['noise_seed'], 7) + # library densities: the PubChem refractive index of anisole and the USP bound of glycerol are not used + subs = rt.library()['substances'] + self.assertAlmostEqual(subs['anisole']['rho'], 995.6, places=1) + self.assertAlmostEqual(subs['glycerol']['rho'], 1261.3, places=1) + + def test59_review_round2_items(self): + # F17: reading noise at the schema maximum never releases T diff max while Tr is falling + h = with_water(kg=1.0, T=333.15, sensor_noise_k=0.02, noise_seed=4) + call(h, 'safety.configure', **dict(SAFETY_EXAMPLE, tdiff_max_k=1.0, tr_max_k=393.15, tj_max_k=423.15)) + settle_tr(h, T=333.15) + call(h, 'thermostat.set_tr', end_k=303.15, ramp_s=10800.0, controller='aqueous') + prev = h.read('evaluator')['truth.reactor_k'] + for _ in range(2700): + h.step(2.0) + s = h.read('evaluator') + if s['truth.reactor_k'] < prev: + self.assertGreaterEqual(s['thermostat.tj_setpoint_k'], s['reactor.indicated_k'] - 1.0 - 1e-6) + prev = s['truth.reactor_k'] + # F18: a Tr-mode cool-down towards Tj min stays 1 K inside the limit and does not trip program C + h = with_water(kg=1.0, T=333.15, **QUIET) + settle_tr(h, T=333.15) + call(h, 'safety.configure', **dict(SAFETY_EXAMPLE, tj_min_k=298.15, tr_min_k=283.15, tsafe_k=303.15, tr_max_k=393.15, tj_max_k=423.15)) + call(h, 'thermostat.set_tr', end_k=305.15, ramp_s=0.0, controller='aqueous') + for _ in range(3600): + h.step(2.0) + self.assertGreaterEqual(h.read('evaluator')['thermostat.tj_setpoint_k'], 298.15 + 1.0 - 1e-9) + self.assertIsNone(h.read('evaluator')['emergency.program']) + # I08: Tsafe must stay below the bubble point (power-up and B1/C drive the mass towards it) + h = plant(**QUIET) + call(h, 'reactor.charge', substances=[dict(substance_id='diethyl_ether', mass_kg=0.5)], temperature_k=293.15, viscosity_pa_s=0.0002, + thermal_conductivity_w_m_k=0.13, accept_priors=True) + rejected(self, h, 'ABOVE_BUBBLE_POINT', 'safety.configure', **dict(SAFETY_EXAMPLE, tsafe_k=312.15)) + call(h, 'safety.configure', **dict(SAFETY_EXAMPLE, tsafe_k=298.15)) + # I09: a baseline-only window gets no reaction edge flags + h = with_water(kg=0.8, T=313.15, sensor_noise_k=0.02, noise_seed=5) + e = call(h, 'experiment.start', name='baseline')['experiment_id'] + settle_tr(h) + call(h, 'calibration.run', pre_s=600.0, heat_s=900.0, post_s=600.0) + h.step(2200.0) + t0 = h.time_s + h.step(1800.0) + ev = call(h, 'calorimetry.evaluate', experiment_id=e, start_s=t0, end_s=h.time_s, limiting_reagent_mol=None, heat_capacity_j_k=3700.0) + self.assertFalse({'reaction_incomplete_at_window_end', 'reaction_running_at_window_start'} & set(ev['quality']), ev['quality']) + + def test60_review_round3_items(self): + # F19: a small, slow reaction at the schema-maximum noise is still flagged as incomplete at the window end + h = with_water(kg=0.8, T=313.15, sensor_noise_k=0.02, noise_seed=2) + call(h, 'reaction.configure', **dict(HYDROLYSIS, reactions=[dict(HYDROLYSIS['reactions'][0], log10_a=4.0)])) + e = call(h, 'experiment.start', name='small')['experiment_id'] + settle_tr(h) + call(h, 'calibration.run', pre_s=600.0, heat_s=900.0, post_s=600.0) + h.step(2200.0) + t0 = h.time_s + call(h, 'dosing.start', substance_id='acetic_anhydride', rate_kg_s=1.5e-4, total_mass_kg=0.3 * 0.10209, feed_temperature_k=None) + h.step(1800.0) + ev = call(h, 'calorimetry.evaluate', experiment_id=e, start_s=t0, end_s=h.time_s, limiting_reagent_mol=0.3, heat_capacity_j_k=3700.0) + self.assertIn('reaction_incomplete_at_window_end', ev['quality']) + # I11: a Tj window narrower than the two 1 K cascade margins + 1 K is rejected + rejected(self, h, 'INVALID_SAFETY_SETTINGS', 'safety.configure', **dict(SAFETY_EXAMPLE, tj_min_k=300.0, tj_max_k=301.0)) + # I10: at default noise a slow runaway releases T diff max (threshold 0.06 K/min floor) + self.assertLess(TDIFF_RELEASE_K_S, 2e-3) + + def test61_edge_flags_on_decimated_records(self): + """F20: the evaluation statistics are defined in seconds, so a record thinned to 4 s spacing keeps both edge flags.""" + saved = rt.MAX_POINTS + rt.MAX_POINTS = 1500 # decimation after 50 min instead of 11 h + try: + h = with_water(kg=0.8, T=313.15, noise_seed=3) + e = call(h, 'experiment.start', name='long')['experiment_id'] + settle_tr(h, s=3000.0) + call(h, 'calibration.run', pre_s=600.0, heat_s=900.0, post_s=600.0) + h.step(2200.0) + self.assertEqual(h.experiment['interval'], 4.0) + call(h, 'reaction.configure', **HYDROLYSIS) + t0 = h.time_s + call(h, 'dosing.start', substance_id='acetic_anhydride', rate_kg_s=1.5e-4, total_mass_kg=0.10209, feed_temperature_k=None) + h.step(3600.0) + late = call(h, 'calorimetry.evaluate', experiment_id=e, start_s=t0 + 300.0, end_s=h.time_s, limiting_reagent_mol=1.0, heat_capacity_j_k=3700.0) + self.assertIn('reaction_running_at_window_start', late['quality']) + short = call(h, 'calorimetry.evaluate', experiment_id=e, start_s=t0, end_s=t0 + 600.0, limiting_reagent_mol=1.0, heat_capacity_j_k=3700.0) + self.assertIn('reaction_incomplete_at_window_end', short['quality']) + full = call(h, 'calorimetry.evaluate', experiment_id=e, start_s=t0, end_s=h.time_s, limiting_reagent_mol=1.0, heat_capacity_j_k=3700.0) + self.assertFalse({'reaction_running_at_window_start', 'reaction_incomplete_at_window_end'} & set(full['quality']), full['quality']) + finally: + rt.MAX_POINTS = saved + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_asset_nanosurf_naiostm.py b/tests/test_asset_nanosurf_naiostm.py new file mode 100644 index 0000000000000000000000000000000000000000..f829effb8b6bb5fb3b0175fbb2cb45a6251eb502 --- /dev/null +++ b/tests/test_asset_nanosurf_naiostm.py @@ -0,0 +1,1468 @@ +"""tests for CHEM-159 nanosurf_naiostm (Nanosurf NaioSTM scanning tunnelling microscope): python3 -m unittest tests/test_asset_nanosurf_naiostm.py + +Topics (pipeline.md): settings only write targets, read/describe are pure, rejected preconditions leave the state unchanged, two instances are +isolated, agent/evaluator truth isolation (truth slots, template and substance of the records, evaluator-only warnings and fault events, other +agents' records and operations), conservation (electrical energy = 30 W x powered time, motor travel, wire used, line and curve counts), real +return values validated against the declared schemas (asset_tool lint_schema / validate_value), asynchronous completion and cancellation +remnants, host-step independence, declared immediate and on_step effects (scenario states, short and long windows); plus the instrument (power +and LED, magnifying cover, tip removal / cutting / wire stock, sample mounting and cleaving, holder insertion / push / rotation / removal guards, +magnifier gap estimates, Advance / Retract / Home / Stop / Withdraw, advance into contact, dirty guides, the automatic approach: timing, found +extension, move speed too small, overshoot and crash with too large steps, insulators / oxides / 0 V running the tip into the surface) and the +physics: the exponential current-distance law and the apparent barrier from I-z, I-V shapes (metal, V-shaped graphite, semiconductor gaps with +the Fermi-level position, oxide), set-point quantisation and amplifier saturation, the HOPG lattice from the FFT against the hidden scanner +calibration, HOPG and Au(111) step heights with terrace levelling, the 1T-TaS2 CDW superlattice, constant height versus constant current, +thermal drift distortion settling, double-tip ghost images, cleaning pulse, tip pick-up, crashes, Z-range saturation, faults, ledgers, sessions. +""" +import copy +import json +import math +import sys +import unittest +from pathlib import Path + +import numpy as np + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / 'scripts')) +sys.path.insert(0, str(ROOT / 'skills/chemistry-lab-assets/scripts')) +from asset_runtime import nanosurf_naiostm as rt # noqa: E402 +import asset_tool # noqa: E402 + +CHECKS, PROCESS_EVIDENCE, REJECTIONS = [], {}, {} +_META = {} +_SC = {} + + +def _meta(): + if not _META: + _META.update(rt.export_nanosurf_naiostm_contract_metadata()) + return _META + + +def _changed(a, b): + return json.dumps(a, sort_keys=True, default=str) != json.dumps(b, sort_keys=True, default=str) + + +_orig_invoke = rt.NanosurfNaiostmRuntime.invoke + + +def _instrumented_invoke(self, capability_id, **a): + """Every successful call is checked against its declared output schema and immediate state effects (a call does not advance time); every + rejection code is recorded for the declaration check.""" + before = self.read('evaluator') if capability_id != 'sim.step' else None + t0 = self.t + try: + out = _orig_invoke(self, capability_id, **a) + except rt.ActionRejected as exc: + REJECTIONS.setdefault(capability_id, set()).add(str(exc)) + raise + meta = _meta()['capabilities'][capability_id] + errs = asset_tool.validate_value(out, meta['output_schema']) + if errs: + raise AssertionError(f'{capability_id} output violates its schema: {errs[:3]}') + if before is not None: + assert self.t == t0, capability_id + after = self.read('evaluator') + undeclared = {k for k in after if _changed(before[k], after[k])} - set(rt.EFFECTS.get(capability_id, [])) + if undeclared: + raise AssertionError(f'{capability_id} changed undeclared state immediately: {sorted(undeclared)}') + PROCESS_EVIDENCE.setdefault(capability_id, []).append(dict(arguments=copy.deepcopy(a), result_keys=sorted(out))) + return out + + +rt.NanosurfNaiostmRuntime.invoke = _instrumented_invoke + +HOPG = dict(sample_id='hopg', template_id='hopg_kit', seed=3, tilt_rad=[0.004, -0.002]) +GOLD = dict(sample_id='gold', template_id='gold_film_kit', seed=5, tilt_rad=[0.0, 0.0]) +AU111 = dict(sample_id='au111', template_id='au111_mica', seed=4, tilt_rad=[0.002, 0.0]) +MOS2 = dict(sample_id='mos2', template_id='mos2_crystal', seed=6, tilt_rad=[0.0, 0.0]) +TAS2 = dict(sample_id='tas2', template_id='tas2_1t_crystal', seed=7, tilt_rad=[0.0, 0.0]) +GLASS = dict(sample_id='glass', template_id='glass_slide', seed=8, tilt_rad=[0.0, 0.0]) +ALU = dict(sample_id='alu', template_id='al_foil', seed=9, tilt_rad=[0.0, 0.0]) +SAMPLES = (HOPG, GOLD, AU111, MOS2, TAS2, GLASS, ALU) +QUIET = dict(floor_vibration='quiet', temperature_stability_k=0.0) +ZC_HOPG = dict(setpoint_a=1e-9, tip_voltage_v=0.05, p_gain=1.0, i_gain=15.0) +SCAN = dict(image_size_m=50e-9, time_per_line_s=0.05, points=32, rotation_rad=0.0, offset_x_m=0.0, offset_y_m=0.0, slope_x_rad=0.0, slope_y_rad=0.0) +IV = dict(start_v=-0.5, range_v=1.0, mod_time_s=0.2, data_points=128, repetitions=1, positions_m=[[0.0, 0.0]], keep_z_controller=False) +IZ = dict(start_m=-1e-9, range_m=1.2e-9, mod_time_s=0.2, data_points=128, repetitions=1, positions_m=[[0.0, 0.0]]) + + +def configured(seed=1, samples=SAMPLES, **plant): + h = rt.NanosurfNaiostmRuntime() + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, noise_seed=seed, **plant)) + for s in samples: + h.invoke('sample.provide', **s) + return h + + +def ready(seed=1, **kw): + h = configured(seed, **kw) + h.invoke('power.set', enabled=True) + h.step(rt.BOOT_S + 1.0) + return h + + +def settle(h, limit=600.0): + t = 0.0 + while (h._holder_moving() or h.tip_work) and t < limit: + h.step(0.5) + t += 0.5 + return h + + +def holder_in(h, sample='hopg', distance=1.0e-3, angle=0.0): + """Mount the sample, insert the holder with the sample surface `distance` from the tip, put the cover back.""" + h.invoke('cover.lift') + stack = h.invoke('sample.mount', sample_id=sample)['stack_thickness_m'] + h.invoke('holder.insert', position_m=h.samples[sample]['stack_m'] + distance + (stack - stack), angle_rad=angle) + h.invoke('cover.place') + return h + + +def near(h, gap=0.12e-3): + g = h.read('evaluator')['truth.gap_m'] + r = h.invoke('approach.advance', duration_s=(g - gap) / rt.MOTOR_SPEED_M_S) + h.step(r['duration_s'] + 0.05) + return h + + +def wait_op(h, oid, tmax=4000.0, dt=1.0): + t = 0.0 + while h.operations[oid]['phase'] == 'running' and t < tmax: + h.step(dt) + t += dt + return h.operations[oid] + + +def engaged(seed=1, sample='hopg', zc=ZC_HOPG, speed=50.0, settle_s=0.0, **plant): + h = near(holder_in(ready(seed, **plant), sample)) + h.invoke('z_controller.set', **zc) + op = wait_op(h, h.invoke('approach.start', move_speed_percent=speed, max_steps=20000)['operation_id']) + assert op['phase'] == 'completed', op + if settle_s: + h.step(settle_s) + return h + + +def scan(h, **kw): + oid = h.invoke('scan.start', **dict(SCAN, **kw))['operation_id'] + wait_op(h, oid, dt=5.0) + return h.records[h.operations[oid]['record_id']] + + +def spec(h, cap, **kw): + base = IV if cap == 'spectroscopy.iv' else IZ + oid = h.invoke(cap, **dict(base, **kw))['operation_id'] + wait_op(h, oid) + return h.records[h.operations[oid]['record_id']] + + +def rejected(h, cap, code, **a): + before = h.read('evaluator') + rev = h.revision + with unittest.TestCase().assertRaises(rt.ActionRejected) as cm: + h.invoke(cap, **a) + assert str(cm.exception) == code, (cap, str(cm.exception), code) + after = h.read('evaluator') + assert not {k for k in after if _changed(before[k], after[k])}, (cap, 'changed state on rejection') + assert h.revision == rev + return True + + +def lattice_ring_power(img, px, a): + """Share of the image power in the ring of the (10) reflections of a hexagonal lattice of constant a (|k| = 2 / (sqrt3 a)).""" + z = rt.flatten_image(img, 'plane') + F = np.abs(np.fft.fft2(z)) ** 2 + k = np.fft.fftfreq(z.shape[0], px) + KX, KY = np.meshgrid(k, k) + kr = np.hypot(KX, KY) + k0 = 2 / (math.sqrt(3) * a) + ring = np.abs(kr - k0) < 0.12 * k0 + return float(F[ring].sum() / F.sum()) + + +def topo(rec, d='forward'): + return np.asarray(rec['data']['topography'][d], float)[:rec['meta']['lines_completed']] + + +def current(rec, d='forward'): + return np.asarray(rec['data']['current'][d], float)[:rec['meta']['lines_completed']] + + +# ---------------------------------------------------------------- scenario states (declared-effect checks) +def _build(name): + if name == 'fresh': + return configured() + if name == 'booting': + h = configured() + h.invoke('power.set', enabled=True) + h.step(3.0) + return h + if name == 'ready': + return ready() + if name == 'cover_off': + h = ready() + h.invoke('cover.lift') + return h + if name == 'tip_off': + h = _build('cover_off') + h.invoke('tip.remove') + return settle(h) + if name == 'tip_cutting': + h = _build('tip_off') + h.invoke('tip.prepare') + h.step(5.0) + return h + if name == 'mounted': + h = _build('cover_off') + h.invoke('sample.mount', sample_id='hopg') + return h + if name == 'holder_in': + h = ready() + h.invoke('cover.lift') + h.invoke('sample.mount', sample_id='hopg') + h.invoke('holder.insert', position_m=h.samples['hopg']['stack_m'] + 1.0e-3, angle_rad=0.0) + return h + if name == 'near': + return near(holder_in(ready(), 'hopg')) + if name == 'moving': + h = _build('near') + h.invoke('approach.retract', duration_s=2.0) + h.step(0.4) + return h + if name == 'approaching': + h = _build('near') + h.invoke('z_controller.set', **ZC_HOPG) + h.invoke('approach.start', move_speed_percent=50.0, max_steps=20000) + h.step(1.0) + return h + if name == 'engaged': + return engaged() + if name == 'scanning': + h = engaged() + h.invoke('scan.start', **dict(SCAN, points=64)) + h.step(2.0) + return h + if name == 'scanned': + h = engaged() + scan(h) + return h + if name == 'spec_running': + h = _build('scanned') + h.invoke('spectroscopy.iv', **dict(IV, repetitions=3)) + h.step(0.35) + return h + if name == 'spec_done': + h = _build('scanned') + spec(h, 'spectroscopy.iv') + spec(h, 'spectroscopy.iz') + return h + if name == 'dirty': + h = _build('near') + h.invoke('fault.inject', fault='approach_motor_dirty', active=True) + return h + if name == 'burst': + h = engaged() + h.invoke('fault.inject', fault='vibration_burst', active=True) + return h + if name == 'unpowered_holder': + h = _build('near') + h.invoke('power.set', enabled=False) + return h + if name == 'crashed': + h = near(holder_in(ready(), 'glass')) + h.invoke('z_controller.set', **ZC_HOPG) + wait_op(h, h.invoke('approach.start', move_speed_percent=50.0, max_steps=3000)['operation_id']) + return h + raise KeyError(name) + + +def _scenario(name): + if name not in _SC: + _SC[name] = _build(name) + return copy.deepcopy(_SC[name]) + + +SCENARIOS = ['fresh', 'booting', 'ready', 'cover_off', 'tip_off', 'tip_cutting', 'mounted', 'holder_in', 'near', 'moving', 'approaching', 'engaged', 'scanning', + 'scanned', 'spec_running', 'spec_done', 'dirty', 'burst', 'unpowered_holder', 'crashed'] +LONG_SCENARIOS = ['ready', 'holder_in', 'near', 'engaged', 'scanned'] +STEP_DTS = (0.4, 3.0, 25.0) + + +def _variants(cap): + V = { + 'plant.configure': [dict(rt.PLANT_EXAMPLE), dict(rt.PLANT_EXAMPLE, noise_seed=2, humidity=0.7, floor_vibration='busy', temperature_stability_k=0.2)], + 'sample.provide': [dict(rt.SAMPLE_EXAMPLE, sample_id='new')], + 'cover.lift': [{}], 'cover.place': [{}], 'tip.remove': [{}], 'tip.prepare': [{}], + 'sample.mount': [dict(sample_id='hopg'), dict(sample_id='gold')], 'sample.unmount': [{}], 'sample.cleave': [dict(sample_id='hopg'), dict(sample_id='mos2')], + 'holder.insert': [dict(position_m=0.0035, angle_rad=0.0), dict(position_m=0.008, angle_rad=1.0)], + 'holder.push': [dict(position_m=0.0045), dict(position_m=0.0030)], 'holder.rotate': [dict(angle_rad=0.7)], 'holder.remove': [{}], + 'maintenance.clean_guides': [{}], + 'power.set': [dict(enabled=True), dict(enabled=False)], 'power.press_button': [{}], + 'z_controller.set': [dict(ZC_HOPG), dict(setpoint_a=2e-9, tip_voltage_v=0.1, p_gain=0.0, i_gain=4.0)], + 'approach.advance': [dict(duration_s=0.2), dict(duration_s=2.0)], 'approach.retract': [dict(duration_s=0.5)], 'approach.home': [{}], 'approach.stop': [{}], + 'approach.withdraw': [dict(steps=10, move_speed_percent=50.0)], 'approach.start': [dict(move_speed_percent=50.0, max_steps=20000), dict(move_speed_percent=5.0, max_steps=50)], + 'scan.start': [dict(SCAN), dict(SCAN, image_size_m=4e-9, points=32, time_per_line_s=0.06)], + 'spectroscopy.iv': [dict(IV)], 'spectroscopy.iz': [dict(IZ)], + 'tip.cleaning_pulse': [{}], + 'analysis.flatten': [dict(record_id='IMG0001', channel='topography', direction='forward', method='plane')], + 'analysis.roughness': [dict(record_id='IMG0001', channel='topography', direction='forward', flatten='plane', region_px=None)], + 'analysis.line_profile': [dict(record_id='IMG0001', channel='current', direction='backward', flatten='none', start_px=[0, 10], end_px=[30, 10], points=32)], + 'analysis.step_height': [dict(record_id='IMG0001', channel='topography', direction='forward', flatten='terraces', method='regions', region_a_px=[0, 0, 8, 8], + region_b_px=[20, 20, 30, 30])], + 'analysis.lattice': [dict(record_id='IMG0001', channel='topography', direction='forward', region_px=None)], + 'analysis.iv': [dict(record_id='SPC0001', curve_index=0, branch='forward', threshold_a=10e-12)], + 'analysis.iz': [dict(record_id='SPC0002', curve_index=0, branch='forward', i_min_a=20e-12, i_max_a=50e-9)], + 'records.delete': [dict(record_id='IMG0001'), dict(record_id='SPC0001')], + 'fault.inject': [dict(fault=f, active=True) for f in rt.FAULTS] + [dict(fault=f, active=False) for f in rt.FAULTS], + 'sim.step': [dict(dt_s=0.5), dict(dt_s=30.0)], + } + return V.get(cap, []) + + +def _num(x): + return isinstance(x, (int, float)) and not isinstance(x, bool) + + +def _flat(v, prefix=''): + out = {} + if isinstance(v, dict): + for k, x in v.items(): + out.update(_flat(x, f'{prefix}.{k}')) + elif isinstance(v, list) and len(v) <= 64: + for i, x in enumerate(v): + out.update(_flat(x, f'{prefix}[{i}]')) + else: + out[prefix] = json.dumps(v, sort_keys=True, default=str) if isinstance(v, list) else v + return out + + +def _rel_changed(a, b, scale=None): + if _num(a) and _num(b): + return abs(a - b) > 1e-9 * (max(abs(a), abs(b)) if scale is None else scale) + 1e-300 + return _changed(a, b) + + +def _leaf_changed(a, b): + fa, fb = _flat(a), _flat(b) + return any(_rel_changed(fa.get(k, ''), fb.get(k, '')) for k in set(fa) | set(fb)) + + +def _step_differs(v1, a2, v0, b2): + """Does the step change the value differently with the call (v1 -> a2) than without it (v0 -> b2)? (leaf-wise, numeric increments)""" + f1, fa, f0, fb = _flat(v1), _flat(a2), _flat(v0), _flat(b2) + for leaf in set(f1) | set(fa) | set(f0) | set(fb): + x1, xa, x0, xb = (f.get(leaf, '') for f in (f1, fa, f0, fb)) + ca, cb = _rel_changed(x1, xa), _rel_changed(x0, xb) + if not (ca or cb): + continue + if ca and cb and all(_num(x) for x in (x1, xa, x0, xb)) and not _rel_changed(xa - x1, xb - x0, max(abs(x1), abs(xa), abs(x0), abs(xb))): + continue + if ca and cb and (x1, xa) == (x0, xb): + continue + if ca and cb and x1 == x0 and not _rel_changed(xa, xb): + continue + return True + return False + + +def _executable(cap): + return cap not in rt.UNSUPPORTED and cap not in rt.DECLARED and rt.CAPS[cap]['kind'] != 'query' + + +# ---------------------------------------------------------------- contract and schemas +class ContractAndSchemas(unittest.TestCase): + def test_module_identity(self): + self.assertEqual(rt.ASSET_TYPE_ID, 'instrument.nanosurf_naiostm') + self.assertEqual(rt.CATALOG_ID, 'CHEM-159') + self.assertEqual((rt.XY_RANGE_M, rt.Z_RANGE_M), (500e-9, 200e-9)) + self.assertAlmostEqual(rt.XY_RANGE_M / 2 ** 16, rt.XY_DAC_M, delta=0.05e-12) # 16-bit digital step, not accuracy + self.assertAlmostEqual(rt.Z_RANGE_M / 2 ** 16, rt.Z_DAC_M, delta=0.05e-12) + self.assertEqual((rt.CURRENT_RANGE_A, rt.SETPOINT_STEP_A, rt.TIP_VOLTAGE_RANGE_V), ((0.1e-9, 100e-9), 25e-12, (-10.0, 10.0))) + self.assertEqual((rt.MAX_POINTS, rt.LINE_RATE_MAX_HZ, rt.SAMPLE_MAX_DIAMETER_M, rt.SAMPLE_MAX_THICKNESS_M), (2048, 10.0, 0.010, 0.003)) + self.assertEqual((rt.BODY_DIMENSIONS_M, rt.MASS_KG, rt.POWER_W), ((0.204, 0.204, 0.104), 3.45, 30.0)) + self.assertGreaterEqual(len(rt.tunnel_lib()['subs']), 50) + self.assertEqual(len(rt.sample_templates()['templates']), 19) + + def test_schemas_lint_and_examples_validate(self): + m = _meta() + for k, c in m['capabilities'].items(): + for part in ('input_schema', 'output_schema'): + self.assertEqual(asset_tool.lint_schema(c[part]), [], (k, part)) + ex = rt.CAPS[k].get('example_arguments') + if ex is not None: + self.assertEqual(asset_tool.validate_value(ex, c['input_schema']), [], k) + rt.validate(rt.CAPS[k]['input_schema'], ex) + for k, s in m['state_slots'].items(): + self.assertEqual(asset_tool.lint_schema(s['value_schema']), [], k) + for name in ('fresh', 'ready', 'tip_off', 'holder_in', 'engaged', 'scanning', 'scanned', 'spec_done', 'crashed', 'approaching'): + v = _scenario(name).read('evaluator') + for k, x in v.items(): + self.assertEqual(asset_tool.validate_value(x, m['state_slots'][k]['value_schema']), [], (name, k)) + h = _scenario('spec_done') + for rid in h.records: + out = h.invoke('measurement.result', record_id=rid, channel=None, direction=None, region_px=None, max_values=4096) + self.assertEqual(asset_tool.validate_value(out, m['capabilities']['measurement.result']['output_schema']), [], rid) + + def test_metadata_references_are_consistent(self): + m = _meta() + slots = set(m['state_slots']) + for k, c in m['capabilities'].items(): + for e in c['state_effects']: + self.assertIn(e['state_id'], slots, (k, e)) + for x in c['observes']: + self.assertIn(x, slots, (k, x)) + for pre in c['preconditions']: + for x in pre['state_ids']: + self.assertIn(x, slots, (k, x)) + for x in c['execution']['completion_state_ids']: + self.assertIn(x, slots, (k, x)) + codes = [e['code'] for e in c['errors']] + self.assertEqual(len(codes), len(set(codes)), k) + for e in c['errors']: + self.assertIn(e['code'], rt.ERROR_ZH, (k, e['code'])) + for k in rt.CAPS: + self.assertIn(k, rt.CAP_SOURCES, k) + self.assertEqual(set(rt.PRECONDITIONS) - set(rt.CAPS), set()) + for k, v in list(rt.EFFECTS.items()) + list(rt.ON_STEP.items()): + self.assertIn(k, rt.CAPS) + self.assertEqual(set(v) - slots, set(), k) + for mech in m['mechanisms'].values(): + self.assertEqual(set(mech['state_ids']) - slots, set()) + manifest = json.loads((rt.ASSET_DIR / 'geometry_manifest.json').read_text()) + comps = {c['id'] if 'id' in c else c['name'] for c in manifest['components']} + used = {c for v in m['capabilities'].values() for c in v['component_ids']} | {s['component_ids'][0] for s in m['state_slots'].values()} + used |= set(m['mechanisms']['naiostm_stm']['component_ids']) + self.assertEqual(used - comps, set()) + + def test_declared_and_unsupported_capabilities(self): + h = ready() + for k in rt.UNSUPPORTED: + with self.assertRaises(rt.ActionRejected) as cm: + _orig_invoke(h, k) + self.assertEqual(str(cm.exception), 'UNSUPPORTED') + self.assertEqual(_meta()['capabilities'][k]['availability'], 'unsupported') + for k in rt.DECLARED: + with self.assertRaises(rt.ActionRejected) as cm: + _orig_invoke(h, k) + self.assertEqual(str(cm.exception), 'NOT_IMPLEMENTED') + c = _meta()['capabilities'][k] + self.assertEqual((c['availability'], c['implementation']['process'], c['binding']), ('declared', 'declared', None)) + h.register_principal('agent', 'agent') + s = h.session('agent') + r = s.invoke(instance_id=h.instance_id, capability_id='afm.scan', arguments={'x': 1}, request_id='u1') + self.assertEqual((r['status'], r['error']['code']), ('unsupported', 'UNSUPPORTED')) + r = s.invoke(instance_id=h.instance_id, capability_id='lithography.patterning', arguments={}, request_id='u2') + self.assertEqual((r['status'], r['error']['code']), ('unsupported', 'NOT_IMPLEMENTED')) + + def test_libraries_carry_evidence(self): + levels = {'documented', 'derived', 'assumption', 'unknown', 'not_applicable'} + documented_wf = 0 + for s in rt.tunnel_lib()['subs'].values(): + for f in ('work_function', 'band_gap', 'resistivity', 'stm_corrugation_m'): + self.assertIn(s[f]['evidence'], levels, (s['substance_id'], f)) + self.assertTrue(s[f]['source_ids'] or s[f]['evidence'] in ('unknown', 'not_applicable'), (s['substance_id'], f)) + documented_wf += s['work_function']['evidence'] == 'documented' + self.assertTrue(s['source'], s['substance_id']) + self.assertGreaterEqual(documented_wf, 35) + for t in rt.sample_templates()['templates'].values(): + self.assertIn(t['material'], rt.tunnel_lib()['subs']) + for k, v in t['topography'].items(): + if isinstance(v, dict): + self.assertIn(v['evidence'], ('documented', 'derived', 'assumption'), (t['template_id'], k)) + w, l = t['size_m']['value'] + span = math.hypot(w, l) if t['shape'] == 'square' else max(w, l) # circumscribed diameter + self.assertLessEqual(span, rt.SAMPLE_MAX_DIAMETER_M + 1e-12, t['template_id']) # manual: max. 10 mm diameter + + +# ---------------------------------------------------------------- host clock and purity +class HostClockAndPurity(unittest.TestCase): + def test_read_and_describe_do_not_advance_time(self): + h = _scenario('scanning') + h.register_principal('agent', 'agent') + s = h.session('agent') + t, rev = h.t, h.revision + before = h.read('evaluator') + for _ in range(3): + s.read(instance_id=h.instance_id) + s.describe(instance_id=h.instance_id) + self.assertEqual((h.t, h.revision), (t, rev)) + self.assertFalse(_changed(before, h.read('evaluator'))) + + def test_step_zero_and_negative(self): + h = ready() + rev = h.revision + h.step(0.0) + self.assertEqual(h.revision, rev) + for bad in (-1.0, float('nan'), True, rt.MAX_STEP_S * 2): + with self.assertRaises(rt.ActionRejected): + h.step(bad) + + def test_host_step_chopping_does_not_change_the_result(self): + A, B = _scenario('near'), _scenario('near') + for h in (A, B): + h.invoke('z_controller.set', **ZC_HOPG) + h.invoke('approach.start', move_speed_percent=50.0, max_steps=20000) + A.step(40.0) + for _ in range(160): + B.step(0.25) + for h in (A, B): + h.invoke('scan.start', **SCAN) + A.step(60.0) + for _ in range(24): + B.step(2.5) + va, vb = A.read('evaluator'), B.read('evaluator') + for k in va: + fa, fb = _flat(va[k]), _flat(vb[k]) + for leaf in set(fa) | set(fb): + x, y = fa.get(leaf), fb.get(leaf) + if _num(x) and _num(y): + self.assertAlmostEqual(x, y, delta=1e-9 * max(abs(x), abs(y), 1e-12) + 1e-18, msg=(k, leaf)) + else: + self.assertEqual(x, y, (k, leaf)) + ra, rb = A.records['IMG0001'], B.records['IMG0001'] + np.testing.assert_allclose(topo(ra), topo(rb), rtol=0, atol=1e-15) + + def test_reads_do_not_change_later_results(self): + A, B = _scenario('engaged'), _scenario('engaged') + for h in (A, B): + h.invoke('scan.start', **SCAN) + for _ in range(30): + A.read('evaluator') + A.step(1.0) + B.step(1.0) + np.testing.assert_array_equal(topo(A.records['IMG0001']), topo(B.records['IMG0001'])) + + def test_settings_only_write_targets(self): + h = _scenario('near') + q0 = h.holder['q'] + r = h.invoke('approach.retract', duration_s=2.0) + self.assertEqual(h.holder['q'], q0) # the motor moves only with the host clock + self.assertEqual(r, dict(travel_m=2.0 * rt.MOTOR_SPEED_M_S, duration_s=2.0)) # the command, not a position + self.assertAlmostEqual(h.read('evaluator')['holder.target_m'], q0 + 2.0 * rt.MOTOR_SPEED_M_S, places=12) + h.step(1.0) + self.assertAlmostEqual(h.holder['q'], q0 + rt.MOTOR_SPEED_M_S, places=12) + h = _scenario('ready') + h.invoke('z_controller.set', setpoint_a=1.010e-9, tip_voltage_v=0.3, p_gain=2.0, i_gain=10.0) + self.assertAlmostEqual(h.zc['setpoint_a'], 1.0e-9, places=18) # 25 pA steps + h.invoke('z_controller.set', setpoint_a=1.015e-9, tip_voltage_v=0.3, p_gain=2.0, i_gain=10.0) + self.assertAlmostEqual(h.zc['setpoint_a'], 1.025e-9, places=18) + + +# ---------------------------------------------------------------- instrument handling +class InstrumentHandling(unittest.TestCase): + def test_power_led_boot_and_power_loss(self): + h = configured() + v = h.read() + self.assertEqual((v['power.enabled'], v['power.led_on'], v['system.state'], v['probe_status.light']), (False, False, 'off', 'off')) + h.invoke('power.press_button') + self.assertEqual((h.read()['power.led_on'], h.read()['system.state']), (True, 'booting')) + rejected(h, 'z_controller.set', 'NOT_READY', **ZC_HOPG) + h.step(rt.BOOT_S - 0.5) + self.assertEqual(h.read()['system.state'], 'booting') + h.step(1.0) + self.assertEqual(h.read()['system.state'], 'ready') + h = _scenario('scanning') + h.invoke('power.set', enabled=False) + rec = h.records['IMG0002'] if 'IMG0002' in h.records else h.records['IMG0001'] + self.assertEqual(rec['status'], 'failed') + self.assertGreater(rec['meta']['lines_completed'], 0) + v = h.read() + self.assertEqual((v['approach.state'], v['zscanner.extension_m'], v['current.reading_a']), ('retracted', None, None)) # no readings without power + + def test_cover_tip_exchange_and_wire_stock(self): + h = ready() + rejected(h, 'tip.remove', 'COVER_ON') + h.invoke('cover.lift') + self.assertEqual(h.read()['cover.lift_m'], rt.COVER_LIFT_M) + rejected(h, 'tip.prepare', 'TIP_INSTALLED') + self.assertEqual(h.read('evaluator')['truth.tip']['kind'], 'sharp') # the factory tip gives atomic resolution + h.invoke('tip.remove') + self.assertTrue(h.read()['tip.handling']) + rejected(h, 'tip.prepare', 'MOTION_IN_PROGRESS') + settle(h) + self.assertFalse(h.read()['tip.installed']) + kinds = [] + for i in range(40): + h.invoke('tip.prepare') + settle(h) + self.assertTrue(h.read()['tip.installed']) + kinds.append(h.read('evaluator')['truth.tip']['kind']) + h.invoke('tip.remove') + settle(h) + self.assertAlmostEqual(h.read()['tip.wire_remaining_m'], rt.WIRE_LENGTH_M - 40 * rt.TIP_CUT_LENGTH_M, places=12) + self.assertEqual(h.ledger()['tips_prepared'], 40.0) + self.assertGreaterEqual(len(set(kinds)), 3) # sharp, double, blunt, unstable after cutting + h.wire_m = 0.003 + rejected(h, 'tip.prepare', 'WIRE_EXHAUSTED') + + def test_sample_mounting_and_cleaving(self): + h = ready() + h.invoke('cover.lift') + rejected(h, 'sample.cleave', 'NOT_CLEAVABLE', sample_id='gold') # manual: the gold sample cannot be cleaned + th = h.samples['hopg']['thickness_m'] + topo_before = h.samples['hopg']['surface'].evaluate(np.linspace(0, 2e-6, 50), np.zeros(50))[0] + h.invoke('sample.cleave', sample_id='hopg') + self.assertAlmostEqual(h.samples['hopg']['thickness_m'], th - rt.CLEAVE_LOSS_M, places=12) + topo_after = h.samples['hopg']['surface'].evaluate(np.linspace(0, 2e-6, 50), np.zeros(50))[0] + self.assertTrue(np.any(np.abs(topo_after - topo_before) > 1e-12)) # a fresh surface: new terraces + r = h.invoke('sample.mount', sample_id='hopg') + self.assertAlmostEqual(r['stack_thickness_m'], round(h.samples['hopg']['stack_m'] / 0.05e-3) * 0.05e-3, places=12) + rejected(h, 'sample.mount', 'HOLDER_OCCUPIED', sample_id='gold') + rejected(h, 'sample.cleave', 'SAMPLE_NOT_ON_BENCH', sample_id='hopg') + h.invoke('sample.unmount') + rejected(h, 'sample.unmount', 'HOLDER_EMPTY') + + def test_holder_guards_and_magnifier(self): + h = ready() + h.invoke('cover.lift') + h.invoke('sample.mount', sample_id='hopg') + stack = h.samples['hopg']['stack_m'] + rejected(h, 'holder.insert', 'COLLISION_RISK', position_m=stack + 0.05e-3, angle_rad=0.0) # judged by eye as 0.1 mm or less + h.invoke('holder.insert', position_m=stack + 1.0e-3, angle_rad=0.0) + rejected(h, 'holder.push', 'COLLISION_RISK', position_m=stack + 0.05e-3) # bias <= 1.4 and jitter <= 60 um: at most 0.13 mm seen + for dq in (0.12e-3, 0.16e-3, 0.2e-3, 0.24e-3, 0.3e-3): # the guard is the eye estimate of the new gap + c = copy.deepcopy(h) + want = c._eye_gap(c._hand_gap(stack + dq)) < rt.PUSH_MIN_GAP_M + if want: + rejected(c, 'holder.push', 'COLLISION_RISK', position_m=stack + dq) + else: + c.invoke('holder.push', position_m=stack + dq) + rejected(h, 'tip.remove', 'HOLDER_IN_HEAD') + rejected(h, 'sample.unmount', 'HOLDER_IN_HEAD') + m = h.invoke('magnifier.view') + self.assertEqual(m['magnification'], 1.0) # the magnifier is in the cover + h.invoke('cover.place') + rejected(h, 'holder.push', 'COVER_ON', position_m=stack + 0.8e-3) + m = h.invoke('magnifier.view') + g = h.read('evaluator')['truth.gap_m'] + self.assertEqual(m['magnification'], 10.0) + self.assertTrue(m['reflection_visible']) + self.assertEqual(m['tip_over'], 'sample') + self.assertAlmostEqual(m['gap_estimate_m'], round(h._seen_gap(g, True) / rt.MAGNIFIER_QUANT_M) * rt.MAGNIFIER_QUANT_M, delta=1e-15) + self.assertLess(abs(m['gap_estimate_m'] - g * h.holder['view_bias']), 0.5 * rt.MAGNIFIER_QUANT_M + 3 * rt.MAGNIFIER_SIGMA_M + 1e-12) + near(h, gap=10e-6) + self.assertTrue(h.invoke('magnifier.view')['appears_touching']) + + def test_motor_moves_stop_home_and_withdraw(self): + h = _scenario('near') + q = h.holder['q'] + h.invoke('approach.home') + h.step(2.0) + self.assertEqual(h.invoke('approach.stop'), dict(stopped=True)) + self.assertAlmostEqual(h.holder['q'], q + 2.0 * rt.MOTOR_SPEED_M_S, places=12) + h.step(5.0) + self.assertAlmostEqual(h.holder['q'], q + 2.0 * rt.MOTOR_SPEED_M_S, places=12) + h.invoke('approach.home') + settle(h) + self.assertAlmostEqual(h.holder['q'], rt.HOLDER_TRAVEL_M[1], places=12) + self.assertAlmostEqual(h.ledger()['motor_travel_m'], (h.samples['hopg']['stack_m'] + 1e-3 - q) + (rt.HOLDER_TRAVEL_M[1] - q), delta=1e-9) + h = engaged() + q = h.holder['q'] + r = h.invoke('approach.withdraw', steps=10, move_speed_percent=50.0) + self.assertEqual(h.read()['approach.state'], 'retracted') + self.assertEqual(r, dict(travel_m=10 * 150e-9, duration_s=10 * rt.CYCLE_S)) + rejected(h, 'approach.advance', 'MOTION_IN_PROGRESS', duration_s=1.0) + settle(h) + self.assertAlmostEqual(h.holder['q'] - q, 10 * 150e-9, places=15) + self.assertEqual(h.invoke('approach.stop'), dict(stopped=False)) + + def test_advance_into_contact_crashes_and_bends_the_tip(self): + h = _scenario('near') + g = h.read('evaluator')['truth.gap_m'] + h.invoke('approach.advance', duration_s=(g + 50e-6) / rt.MOTOR_SPEED_M_S) + settle(h) + v = h.read('evaluator') + self.assertEqual(v['truth.tip']['kind'], 'crashed') + self.assertAlmostEqual(v['truth.tip']['recess_m'], rt.BEND_M, delta=1e-9) # the motor stalls against the bent wire + self.assertEqual(h.ledger()['tip_crashes'], 1.0) + self.assertIn('TIP_CRASH', [e['code'] for e in h.events]) + + def test_dirty_guides_slow_the_motor_until_cleaned(self): + h = _scenario('dirty') + q = h.holder['q'] + h.invoke('approach.retract', duration_s=1.0) + settle(h) + self.assertAlmostEqual(h.holder['q'] - q, rt.MOTOR_SPEED_M_S * rt.DIRTY_MOTOR_FACTOR, places=12) + h.invoke('cover.lift') + h.invoke('approach.retract', duration_s=10.0) + settle(h) + rejected(h, 'maintenance.clean_guides', 'HOLDER_IN_HEAD') + h.invoke('holder.remove') + h.invoke('maintenance.clean_guides') + self.assertNotIn('approach_motor_dirty', h.read('evaluator')['truth.faults']) + + +# ---------------------------------------------------------------- approach +class Approach(unittest.TestCase): + def test_timing_and_found_extension(self): + h = _scenario('near') + h.invoke('z_controller.set', **ZC_HOPG) + g0 = h._gap_mech() + d = h._dset()[0] + oid = h.invoke('approach.start', move_speed_percent=50.0, max_steps=20000)['operation_id'] + self.assertEqual(h.read()['probe_status.light'], 'blinking') + wait_op(h, oid, dt=0.5) + zr = rt.Z_RANGE_M * (1 + h.cal['z']) # real Z range (hidden calibration) + k = math.ceil((g0 - zr - d) / 150e-9) + t_start = [e for e in h.events if e['code'] == 'APPROACH_STARTED'][-1]['time_s'] + t_done = [e for e in h.events if e['code'] == 'APPROACH_DONE'][-1]['time_s'] + self.assertAlmostEqual(t_done - t_start, (k + 1) * rt.CYCLE_S + rt.APPROACH_SETTLE_S, delta=1e-6) + self.assertAlmostEqual(h.ledger()['approach_steps'], float(k)) + v = h.read('evaluator') + self.assertEqual((v['approach.state'], v['probe_status.light']), ('engaged', 'green')) + self.assertGreater(v['zscanner.extension_m'], rt.Z_RANGE_M - 150e-9 / (1 + h.cal['z']) - 1e-10) # found during the last extension (nominal) + self.assertAlmostEqual(v['truth.gap_m'], d, delta=1e-12) + self.assertAlmostEqual(abs(v['current.reading_a']), 1e-9, delta=0.1e-9) + self.assertLess(k * rt.CYCLE_S, 20.0) # manual: 10-20 s from a fraction of a millimetre + + def test_small_move_speed_and_max_steps_fail(self): + h = _scenario('near') + h.invoke('z_controller.set', **ZC_HOPG) + oid = h.invoke('approach.start', move_speed_percent=5.0, max_steps=100)['operation_id'] + q = h.holder['q'] + self.assertEqual(wait_op(h, oid)['reason'], 'APPROACH_FAILED') + self.assertEqual(h.holder['q'], q) # below 10 % the stick-slip motor does not move + oid = h.invoke('approach.start', move_speed_percent=50.0, max_steps=100)['operation_id'] + self.assertEqual(wait_op(h, oid)['reason'], 'APPROACH_FAILED') + self.assertAlmostEqual(q - h.holder['q'], 100 * 150e-9, delta=1e-15) + self.assertEqual(h.read('evaluator')['truth.tip']['kind'], 'sharp') + + def test_too_large_steps_overshoot_or_crash(self): + outcomes = {} + for i in range(12): + h = _scenario('near') + h.invoke('z_controller.set', **ZC_HOPG) + h.holder['q'] += i * 37e-9 # different remaining gaps + oid = h.invoke('approach.start', move_speed_percent=95.0, max_steps=20000)['operation_id'] + x = h.op['extra']['outcome'] + wait_op(h, oid) + outcomes.setdefault(x, 0) + outcomes[x] += 1 + if x == 'crash_step': + self.assertEqual(h.read('evaluator')['truth.tip']['kind'], 'crashed') + self.assertEqual(h.read()['probe_status.light'], 'red') + if x == 'overshoot': + self.assertEqual(h.read()['probe_status.light'], 'red') + self.assertIn('found', outcomes) + self.assertTrue(outcomes.get('overshoot', 0) + outcomes.get('crash_step', 0) > 0, outcomes) + + def test_no_current_runs_the_tip_into_the_surface(self): + for sample, zc in (('glass', ZC_HOPG), ('alu', ZC_HOPG), ('hopg', dict(ZC_HOPG, tip_voltage_v=0.0))): + h = near(holder_in(ready(), sample)) + h.invoke('z_controller.set', **zc) + op = wait_op(h, h.invoke('approach.start', move_speed_percent=50.0, max_steps=3000)['operation_id']) + self.assertEqual(op['reason'], 'APPROACH_FAILED', sample) + v = h.read('evaluator') + self.assertEqual(v['truth.tip']['kind'], 'crashed', sample) + self.assertEqual(v['truth.gap_m'], rt.D_CONTACT_M, sample) + self.assertGreater(v['truth.tip']['recess_m'], 0.0) + self.assertEqual(h.ledger()['tip_crashes'], 1.0) + + def test_cancel_stops_the_holder(self): + h = _scenario('approaching') + h.register_principal('ev', 'evaluator') + s = h.session('ev') + oid = h.op['op'] + q = h.holder['q'] + r = s.cancel(oid, 'c1') + self.assertEqual((r['status'], r['result']['phase']), ('succeeded', 'cancelled')) + h.step(5.0) + self.assertEqual(h.holder['q'], q) + self.assertEqual(h.read()['approach.state'], 'retracted') + r = s.cancel(oid, 'c2') + self.assertEqual((r['status'], r['error']['code']), ('rejected', 'NOT_RUNNING')) + + +# ---------------------------------------------------------------- tunnelling physics +class TunnellingPhysics(unittest.TestCase): + def test_exponential_law_and_apparent_barrier(self): + m = rt.material('au') + phi = rt.barrier_ev(m, 0.4) + d = np.linspace(0.6e-9, 1.2e-9, 7) + i = np.abs(rt.tunnel_current(0.1, d, m, phi, 0.0254)) + slope = -np.polyfit(d, np.log(i), 1)[0] + self.assertAlmostEqual(slope / (2 * rt.KAPPA_1EV * math.sqrt(phi)), 1.0, delta=0.03) # ln I falls by 2 kappa per metre + h = engaged(**QUIET) + rec = spec(h, 'spectroscopy.iz') + a = h.invoke('analysis.iz', record_id=rec['record_id'], curve_index=0, branch='forward', i_min_a=20e-12, i_max_a=50e-9) + self.assertAlmostEqual(a['apparent_barrier_ev'], rt.barrier_ev(rt.material('hopg'), 0.4) * (1 + h.cal['z']) ** 2, delta=0.1) # nominal z axis + self.assertGreater(a['r2'], 0.99) + self.assertLess(a['apparent_barrier_ev'] / (1 + h.cal['z']) ** 2, rt.vacuum_barrier_ev(rt.material('hopg')) / 2) # air lowers the apparent barrier + + def test_iv_shapes_metal_semimetal_semiconductor_oxide(self): + kT = 0.0254 + V = np.linspace(-0.5, 0.5, 201) + def curve(sid, v_set=0.1, Vs=V): + m = rt.material(sid) + d = rt.setpoint_gap(m, v_set, 1e-9, 0.4, 295.15) + return np.array([float(rt.tunnel_current(v, np.array([d[0]]), m, rt.barrier_ev(m, 0.4), kT)[0]) for v in Vs]), d + au, _ = curve('au') + a = rt.iv_analysis(V, au, 1e-12) + self.assertAlmostEqual(a['normalized_conductance'][100], 1.0, delta=0.05) + self.assertLess(a['normalized_conductance'][-10], 1.25) # nearly ohmic at low bias + hopg, _ = curve('hopg', 0.05) + a = rt.iv_analysis(V, hopg, 1e-12) + self.assertGreater(a['normalized_conductance'][-10], 1.35) # V-shaped density of states of graphite + Vw = np.linspace(-2.5, 2.5, 501) + mos2, _ = curve('mos2', -1.5, Vw) + g = rt.iv_analysis(Vw, mos2, 10e-12)['gap'] + self.assertIsNotNone(g) + self.assertGreater(g['width_v'], 1.1) + self.assertLess(g['width_v'], 2.0) + self.assertLess(g['v_low'], 0.0) # n-type: the empty conduction band is closer to EF + self.assertGreater(g['v_high'], abs(g['v_low'])) + self.assertIsNone(rt.setpoint_gap(rt.material('al'), 0.1, 1e-9, 0.4, 295.15)) # passive oxide: no tunnelling + self.assertIsNone(rt.setpoint_gap(rt.material('glass'), 1.0, 1e-9, 0.4, 295.15)) + self.assertIsNotNone(rt.setpoint_gap(rt.material('cu'), 0.1, 1e-9, 0.4, 295.15)) # tarnish: tunnelling at a small gap + self.assertLess(rt.setpoint_gap(rt.material('cu'), 0.1, 1e-9, 0.4, 295.15)[0], rt.setpoint_gap(rt.material('au'), 0.1, 1e-9, 0.4, 295.15)[0]) + + def test_amplifier_saturation_and_iv_with_the_feedback_on_through_zero(self): + h = engaged(**QUIET) + rec = spec(h, 'spectroscopy.iz', start_m=0.0, range_m=0.9e-9) + self.assertIn('current_saturated', rec['warnings']) + c = rec['data']['curves'][0] + self.assertLessEqual(max(abs(x) for x in c['current_forward_a']), rt.I_SAT_A) + h = engaged(**QUIET) + rec = spec(h, 'spectroscopy.iv', start_v=-0.3, range_v=0.6, keep_z_controller=True) + self.assertEqual(h.read('evaluator')['truth.tip']['kind'], 'crashed') # at 0 V the feedback drives the tip into the surface + self.assertIn('z_forward_m', rec['data']['curves'][0]) + self.assertLessEqual(h.ledger()['tip_crashes'], 1.0) + + +# ---------------------------------------------------------------- imaging physics +class ImagingPhysics(unittest.TestCase): + def test_hopg_lattice_from_the_fft_against_the_hidden_calibration(self): + h = engaged(settle_s=3 * 3600.0, **QUIET) + rec = scan(h, image_size_m=4e-9, time_per_line_s=0.06, points=128) + self.assertEqual(rec['warnings'], []) + L = h.invoke('analysis.lattice', record_id=rec['record_id'], channel='topography', direction='forward', region_px=None) + a_true = rt.material('hopg')['a_s'] + cal = 1 + 0.5 * (h.cal['x'] + h.cal['y']) + self.assertIsNotNone(L['hexagonal_lattice_m']) + self.assertAlmostEqual(L['hexagonal_lattice_m'] * cal / a_true, 1.0, delta=0.035) # the image scale is the commanded one + self.assertAlmostEqual(L['hexagonal_lattice_m'], 0.25e-9, delta=0.015e-9) # manual: 0.25 nm between the bright hills + c = current(rec) + self.assertGreater(np.std(c) / np.mean(np.abs(c)), 0.05) # atomic contrast in the current + + def test_step_heights_with_terrace_levelling(self): + for sample, sid in (('hopg', 'hopg'), ('au111', 'au')): + h = engaged(sample=sample, zc=dict(ZC_HOPG, tip_voltage_v=0.5), settle_s=3600.0, **QUIET) + rec = scan(h, image_size_m=300e-9, time_per_line_s=0.1, points=256) + st = h.invoke('analysis.step_height', record_id=rec['record_id'], channel='topography', direction='forward', flatten='terraces', method='histogram', + region_a_px=None, region_b_px=None) + step = rt.material(sid)['step'] / (1 + h.cal['z']) # nominal Z output = real / (1 + cal_z) + n = round(st['step_m'] / step) + self.assertGreaterEqual(n, 1, sample) + self.assertAlmostEqual(st['step_m'] / (n * step), 1.0, delta=0.06, msg=sample) + + def test_tas2_charge_density_wave(self): + h = engaged(sample='tas2', zc=dict(ZC_HOPG, tip_voltage_v=0.1), settle_s=3600.0, **QUIET) + rec = scan(h, image_size_m=10e-9, time_per_line_s=0.06, points=192) + L = h.invoke('analysis.lattice', record_id=rec['record_id'], channel='topography', direction='forward', region_px=None) + cdw = rt.material('tas2_1t')['cdw']['period'] + cal = 1 + 0.5 * (h.cal['x'] + h.cal['y']) + self.assertAlmostEqual(L['hexagonal_lattice_m'] * cal / cdw, 1.0, delta=0.05) # sqrt13 a superlattice dominates + + def test_constant_height_versus_constant_current(self): + out = {} + for mode, gains in (('cc', dict(p_gain=1.0, i_gain=40.0)), ('ch', dict(rt.CONSTANT_HEIGHT_GAINS))): + h = engaged(settle_s=3600.0, **QUIET) + h.invoke('z_controller.set', **dict(ZC_HOPG, **gains)) + rec = scan(h, image_size_m=4e-9, time_per_line_s=0.06, points=128) + out[mode] = (np.std(rt.flatten_image(topo(rec), 'line_1')), np.std(current(rec)) / np.mean(np.abs(current(rec)))) + self.assertGreater(out['cc'][0], 2 * out['ch'][0]) # topography follows the atoms at high gain + self.assertGreater(out['ch'][1], 2 * out['cc'][1]) # current image at low gain (manual: I 4, P 0) + + def test_thermal_drift_distorts_early_images_and_settles(self): + shift, lat = {}, {} + for wait in (0.0, 3 * 3600.0): + h = engaged(settle_s=wait, floor_vibration='quiet', temperature_stability_k=0.0) + t0 = h.t + rec = scan(h, image_size_m=4e-9, time_per_line_s=0.06, points=128) + shift[wait] = float(np.linalg.norm(np.array(h._drift(h.t)[:2]) - np.array(h._drift(t0)[:2]))) # lateral drift during the image + lat[wait] = h.invoke('analysis.lattice', record_id=rec['record_id'], channel='topography', direction='forward', region_px=None)['hexagonal_lattice_m'] + self.assertGreater(shift[0.0], 0.3e-9) # comparable to the lattice: a distorted image + self.assertLess(shift[3 * 3600.0], 0.02e-9) # manual: stabilises within about an hour + a = rt.material('hopg')['a_s'] + self.assertIsNotNone(lat[3 * 3600.0]) + self.assertTrue(lat[0.0] is None or abs(lat[0.0] / a - 1) > abs(lat[3 * 3600.0] / a - 1)) + + def test_double_tip_ghost_and_cleaning_pulse(self): + base = engaged(settle_s=3600.0, **QUIET) + imgs = {} + for double in (False, True): + h = copy.deepcopy(base) + if double: + h.tip['second'] = dict(dx=0.61e-9, dy=0.37e-9, recess=0.0) # not a lattice vector: ghost atoms between the atoms + rec = scan(h, image_size_m=4e-9, time_per_line_s=0.06, points=128) + imgs[double] = rt.flatten_image(topo(rec), 'plane') + self.assertIn('double_tip', rec['warnings']) + self.assertGreater(np.std(imgs[True] - imgs[False]), 0.3 * np.std(imgs[False])) + h.register_principal('agent', 'agent') + s = h.session('agent') + r = s.invoke(instance_id=h.instance_id, capability_id='measurement.result', arguments=dict(record_id=rec['record_id'], channel=None, direction=None, region_px=None, + max_values=64), request_id='m1') + self.assertNotIn('double_tip', r['result']['record']['warnings']) # evaluator knowledge + kinds = set() + for _ in range(12): + h.invoke('tip.cleaning_pulse') + kinds.add(h.tip['kind']) + self.assertGreaterEqual(len(kinds), 2) + self.assertEqual(h.ledger()['cleaning_pulses'], 12.0) + + def test_crash_at_a_tall_grain_with_a_fast_low_gain_scan_and_z_saturation(self): + h = engaged(sample='gold', zc=dict(ZC_HOPG, tip_voltage_v=0.5, i_gain=1.0, p_gain=0.0), settle_s=600.0, **QUIET) + rec = scan(h, image_size_m=400e-9, time_per_line_s=0.05, points=128) + self.assertEqual(h.read('evaluator')['truth.tip']['kind'], 'crashed') + self.assertIn('tip_crash', rec['warnings']) + h = engaged(settle_s=600.0, **QUIET) + h.samples['hopg']['surface'].tilt = [0.9, 0.0] # a strongly tilted mounting + rec = scan(h, image_size_m=400e-9, time_per_line_s=0.1, points=64) + self.assertIn('z_range_exceeded', rec['warnings']) + + def test_topography_uses_the_16_bit_z_steps_and_line_rate_limit(self): + h = engaged(**QUIET) + rec = scan(h) + t = topo(rec) + np.testing.assert_allclose(t / rt.Z_DAC_M, np.round(t / rt.Z_DAC_M), atol=1e-3) + with self.assertRaises(rt.ActionRejected): + h.invoke('scan.start', **dict(SCAN, time_per_line_s=0.04)) # 10 Hz line rate: at least 0.05 s per line + rejected(h, 'scan.start', 'SCAN_OUT_OF_RANGE', **dict(SCAN, image_size_m=400e-9, offset_x_m=100e-9)) + + def test_tip_pickup_reduces_the_atomic_contrast(self): + rq = {} + for pick in (False, True): + h = engaged(settle_s=3600.0, **QUIET) + if pick: + h.invoke('fault.inject', fault='tip_pickup', active=True) + rec = scan(h, image_size_m=4e-9, time_per_line_s=0.06, points=64) + rq[pick] = lattice_ring_power(topo(rec), 4e-9 / 64, rt.material('hopg')['a_s']) + self.assertGreater(rq[False], 3 * rq[True]) + + +# ---------------------------------------------------------------- faults, records, analysis, ledgers, sessions +class FaultsRecordsLedgersSessions(unittest.TestCase): + def test_vibration_burst_and_thermal_disturbance(self): + noise = {} + for burst in (False, True): + h = engaged(settle_s=3600.0, **QUIET) + if burst: + h.invoke('fault.inject', fault='vibration_burst', active=True) + rec = scan(h, image_size_m=30e-9, time_per_line_s=0.05, points=64) # pixels >> lattice: the atomic corrugation averages out + noise[burst] = np.std(rt.flatten_image(topo(rec), 'terraces')) # the gap vibration is followed by the feedback (correlated noise) + self.assertGreater(noise[True], 3 * noise[False]) + h = engaged(settle_s=3600.0, **QUIET) + d0 = h._drift() + h.invoke('fault.inject', fault='thermal_disturbance', active=True) + h.step(600.0) + self.assertGreater(np.linalg.norm(np.array(h._drift()) - np.array(d0)), 30e-9) + + def test_cancel_keeps_lines_and_the_engagement(self): + h = _scenario('scanning') + h.register_principal('ev', 'evaluator') + s = h.session('ev') + oid = h.op['op'] + rid = h.op['record_id'] + h.step(0.3) + r = s.cancel(oid, 'x1') + self.assertEqual(r['status'], 'succeeded') + rec = h.records[rid] + self.assertEqual(rec['status'], 'cancelled') + self.assertGreater(rec['meta']['lines_completed'], 16) + self.assertEqual(h.read()['approach.state'], 'engaged') + r2 = s.cancel(oid, 'x1') + self.assertEqual(r2, r) + r3 = s.cancel(oid, 'x2') + self.assertEqual((r3['status'], r3['error']['code']), ('rejected', 'NOT_RUNNING')) + + def test_records_analysis_and_result_extraction(self): + h = _scenario('spec_done') + out = h.invoke('measurement.result', record_id='IMG0001', channel='current', direction='backward', region_px=[0, 0, 16, 16], max_values=64) + self.assertEqual((out['data']['shape'], out['data']['unit'], out['data']['factor']), ([8, 8], 'A', 2)) + f = h.invoke('analysis.flatten', record_id='IMG0001', channel='topography', direction='forward', method='terraces') + self.assertEqual(h.read()['result.last_record_id'], f['record_id']) + p = h.invoke('analysis.line_profile', record_id='IMG0001', channel='topography', direction='forward', flatten='plane', start_px=[0, 5], end_px=[31, 5], points=32) + self.assertAlmostEqual(p['distance_m'][-1], 31 * SCAN['image_size_m'] / 32, places=15) + spc = h.invoke('measurement.result', record_id='SPC0001', channel=None, direction=None, region_px=None, max_values=64) + self.assertEqual(spc['data']['units']['x'], 'V') + rejected(h, 'analysis.iz', 'RECORD_NOT_SUITABLE', record_id='SPC0001', curve_index=0, branch='forward', i_min_a=20e-12, i_max_a=50e-9) + rejected(h, 'analysis.iv', 'UNKNOWN_CURVE', record_id='SPC0001', curve_index=5, branch='forward', threshold_a=1e-11) + h.invoke('records.delete', record_id='IMG0001') + rejected(h, 'measurement.result', 'UNKNOWN_RECORD', record_id='IMG0001', channel=None, direction=None, region_px=None, max_values=64) + + def test_remaining_capabilities_through_the_api(self): + h = _scenario('spec_done') + st = h.invoke('analysis.roughness', record_id='IMG0001', channel='topography', direction='forward', flatten='plane', region_px=[0, 0, 16, 16]) + self.assertEqual(st['pixels'], 256) + a = h.invoke('analysis.iv', record_id='SPC0001', curve_index=0, branch='backward', threshold_a=5e-12) + self.assertEqual(len(a['voltage_v']), IV['data_points']) + self.assertEqual(h.invoke('ledger.read'), h.ledger()) + pv = h.invoke('provenance.read') + self.assertEqual(pv['libraries'], rt.library_sha256()) + self.assertEqual((pv['substances'], pv['sample_templates']), (len(rt.tunnel_lib()['subs']), len(rt.sample_templates()['templates']))) + t = h.t + self.assertAlmostEqual(h.invoke('sim.step', dt_s=2.5)['time_s'], t + 2.5, places=9) + h = _scenario('holder_in') + stack = h.samples['hopg']['stack_m'] + self.assertEqual(h.invoke('holder.push', position_m=stack + 0.6e-3)['position_m'], stack + 0.6e-3) + p = h._tip_point() + hp = float(h.samples['hopg']['surface'].evaluate(np.array([p[0]]), np.array([p[1]]))[0][0]) # mounting tilt and terraces at the tip spot + self.assertAlmostEqual(h.read('evaluator')['truth.gap_m'], 0.6e-3 - hp + h.tip['recess'] - h._drift()[2], delta=1e-12) + rejected(h, 'holder.push', 'COLLISION_RISK', position_m=stack + 0.05e-3) # seen by eye as 0.1 mm or less + self.assertEqual(h.invoke('holder.rotate', angle_rad=1.2)['angle_rad'], 1.2) + p1 = h._tip_point() + self.assertAlmostEqual(math.hypot(*p1), math.hypot(*h.tip['offset']), delta=1e-6) # the spot moves on a circle about the axis + g = h.read('evaluator')['truth.gap_m'] + g_t = (0.21e-3 - h._look_noise(False)) / h.holder['view_bias'] # seen by eye as 0.21 mm: pushed, too close to turn + h.invoke('holder.push', position_m=h.holder['q'] + g_t - g) + rejected(h, 'holder.rotate', 'COLLISION_RISK', angle_rad=0.3) # turning needs 0.3 mm + + def test_energy_and_count_ledgers_close(self): + h = _scenario('spec_done') + t_on = h.t - [e for e in h.events if e['code'] == 'POWER_ON'][0]['time_s'] + L = h.ledger() + self.assertAlmostEqual(L['electrical_energy_j'], rt.POWER_W * t_on, delta=1e-6) + self.assertEqual(L['scan_lines'], 2 * SCAN['points']) + self.assertEqual(L['spectroscopy_curves'], 2.0) + self.assertEqual((L['approaches'], L['holder_insertions']), (1.0, 1.0)) + + def test_two_instances_are_isolated(self): + a, b = _scenario('engaged'), _scenario('engaged') + a.invoke('scan.start', **SCAN) + a.step(20.0) + self.assertNotIn('IMG0001', b.records) + self.assertNotEqual(a.t, b.t) + + def test_agent_does_not_see_truth_or_foreign_objects(self): + h = _scenario('scanned') + h.register_principal('agent', 'agent') + h.register_principal('agent2', 'agent') + h.register_principal('ev', 'evaluator') + s, s2, ev = h.session('agent'), h.session('agent2'), h.session('ev') + v = s.read(instance_id=h.instance_id)['observations'] + self.assertFalse([k for k in v if k.startswith('truth.')]) + with self.assertRaises(rt.ActionRejected): + s.read(instance_id=h.instance_id, state_ids=['truth.tip']) + self.assertIn('truth.tip', ev.read(instance_id=h.instance_id)['observations']) + r = s.invoke(instance_id=h.instance_id, capability_id='measurement.result', arguments=dict(record_id='IMG0001', channel=None, direction=None, region_px=None, + max_values=64), request_id='r1') + self.assertEqual((r['result']['record']['template_source']['template_id'], r['result']['record']['template_source']['substance']), (None, None)) + r = s.invoke(instance_id=h.instance_id, capability_id='scan.start', arguments=dict(SCAN), request_id='r2') + self.assertEqual(r['status'], 'accepted') + rid = h.op['record_id'] + r = s2.invoke(instance_id=h.instance_id, capability_id='tip.cleaning_pulse', arguments={}, request_id='r3') + self.assertEqual(r['error']['code'], 'ACCESS_DENIED') + h.step(10.0) + r = s2.invoke(instance_id=h.instance_id, capability_id='measurement.result', arguments=dict(record_id=rid, channel=None, direction=None, region_px=None, + max_values=64), request_id='r4') + self.assertEqual(r['error']['code'], 'ACCESS_DENIED') + self.assertNotIn(rid, s2.invoke(instance_id=h.instance_id, capability_id='records.list', arguments={}, request_id='r5')['result']['records']) + ev_events = s.invoke(instance_id=h.instance_id, capability_id='events.read', arguments=dict(since_s=0.0), request_id='r6')['result']['events'] + self.assertFalse([e for e in ev_events if e['kind'] == 'fault']) + + def test_idempotent_requests_conflicts_and_large_replays(self): + h = _scenario('scanned') + h.register_principal('agent', 'agent') + s = h.session('agent') + a = s.invoke(instance_id=h.instance_id, capability_id='z_controller.set', arguments=dict(ZC_HOPG), request_id='q1') + b = s.invoke(instance_id=h.instance_id, capability_id='z_controller.set', arguments=dict(ZC_HOPG), request_id='q1') + self.assertEqual(a, b) + c = s.invoke(instance_id=h.instance_id, capability_id='z_controller.set', arguments=dict(ZC_HOPG, i_gain=3.0), request_id='q1') + self.assertEqual(c['error']['code'], 'REQUEST_CONFLICT') + scan(h, points=128) + big = dict(record_id='IMG0002', channel=None, direction=None, region_px=None, max_values=65536) + s.invoke(instance_id=h.instance_id, capability_id='measurement.result', arguments=big, request_id='L0') + for i in range(rt.LARGE_RESPONSE_KEEP + 2): + s.invoke(instance_id=h.instance_id, capability_id='measurement.result', arguments=dict(big, max_values=65536 - i - 1), request_id=f'L{i + 1}') + self.assertIsNone(h._requests[('agent', 'L0')][1]) + again = s.invoke(instance_id=h.instance_id, capability_id='measurement.result', arguments=big, request_id='L0') + self.assertEqual(again['status'], 'succeeded') + other = s.invoke(instance_id=h.instance_id, capability_id='records.list', arguments={}, request_id='L0') + self.assertEqual(other['error']['code'], 'REQUEST_CONFLICT') + + def test_defects_become_device_errors(self): + h = _scenario('engaged') + h.register_principal('agent', 'agent') + s = h.session('agent') + orig = rt.NanosurfNaiostmRuntime._cmd_tip_cleaning_pulse + try: + rt.NanosurfNaiostmRuntime._cmd_tip_cleaning_pulse = lambda self: 1 / 0 + r = s.invoke(instance_id=h.instance_id, capability_id='tip.cleaning_pulse', arguments={}, request_id='d1') + finally: + rt.NanosurfNaiostmRuntime._cmd_tip_cleaning_pulse = orig + self.assertEqual((r['status'], r['error']['code'], r['error']['side_effects']), ('rejected', 'DEVICE_ERROR', 'unknown')) + + +# ---------------------------------------------------------------- declared effects +class DeclaredEffects(unittest.TestCase): + def test_immediate_and_on_step_effects_are_declared(self): + missing_imm, missing_step = {}, {} + states = {n: _scenario(n) for n in SCENARIOS} + for cap in rt.CAPS: + if not _executable(cap): + continue + for sname, S in states.items(): + for args in _variants(cap): + A = copy.deepcopy(S) + v0 = A.read('evaluator') + try: + _orig_invoke(A, cap, **args) + except rt.ActionRejected: + continue + v1 = A.read('evaluator') + if cap == 'sim.step': + for k in v0: + if _leaf_changed(v0[k], v1[k]) and k not in rt.ON_STEP['sim.step'] + rt.EFFECTS['sim.step']: + missing_step.setdefault('sim.step', set()).add((sname, k)) + continue + for k in v0: + if _changed(v0[k], v1[k]) and _leaf_changed(v0[k], v1[k]) and k not in rt.EFFECTS.get(cap, []): + missing_imm.setdefault(cap, set()).add((sname, k)) + for dt in STEP_DTS: + A2, B2 = copy.deepcopy(A), copy.deepcopy(S) + A2.step(dt) + B2.step(dt) + a2, b2 = A2.read('evaluator'), B2.read('evaluator') + for k in v0: + if k not in rt.ON_STEP.get(cap, []) and _step_differs(v1[k], a2[k], v0[k], b2[k]): + missing_step.setdefault(cap, set()).add((sname, k)) + if k not in rt.ON_STEP['sim.step'] + ['clock.time_s'] and _leaf_changed(v0[k], b2[k]): + missing_step.setdefault('sim.step', set()).add((sname, k)) + self.assertEqual(missing_imm, {}) + self.assertEqual(missing_step, {}) + self.assertFalse([s for v in rt.ON_STEP.values() for s in v if rt.SLOTS[s]['origin'] == 'setpoint']) + + def test_every_executable_capability_is_accepted_in_some_scenario(self): + accepted = set() + for n in SCENARIOS: + S = _scenario(n) + for cap in rt.CAPS: + if not _executable(cap) or cap in accepted: + continue + for args in _variants(cap): + try: + _orig_invoke(copy.deepcopy(S), cap, **args) + accepted.add(cap) + break + except rt.ActionRejected: + pass + self.assertEqual({c for c in rt.CAPS if _executable(c)} - accepted, set()) + + def test_long_window_effects_of_operations_are_declared(self): + missing = {} + for sname in LONG_SCENARIOS: + S = _scenario(sname) + for cap in rt.CAPS: + if not _executable(cap) or cap == 'sim.step': + continue + for args in _variants(cap): + A = copy.deepcopy(S) + v0 = A.read('evaluator') + try: + res = _orig_invoke(A, cap, **args) + except rt.ActionRejected: + continue + oid = res.get('operation_id') if isinstance(res, dict) and cap in rt.ASYNC else None + v1 = A.read('evaluator') + B = copy.deepcopy(S) + t, t_end = 0.0, (1800.0 if oid else 120.0) + while t < t_end - 1e-9: + d = 0.25 if t < 5.0 - 1e-9 else 2.0 + A.step(d) + B.step(d) + t += d + a2, b2 = A.read('evaluator'), B.read('evaluator') + for k in v0: + if k not in rt.ON_STEP.get(cap, []) and _step_differs(v1[k], a2[k], v0[k], b2[k]): + missing.setdefault(cap, set()).add((sname, k)) + if oid and A.operations[oid]['phase'] != 'running' and t_end == 1800.0: + t_end = t + 5.0 + self.assertEqual(missing, {}) + + +# ---------------------------------------------------------------- hidden truth, motor model and feedback edge cases (independent review, round 1) +class HiddenTruthAndMotorModel(unittest.TestCase): + def test_advance_reports_the_command_not_the_gap_or_the_crash(self): + h = _scenario('near') + h.register_principal('agent', 'agent') + s = h.session('agent') + r = s.invoke(instance_id=h.instance_id, capability_id='approach.advance', arguments=dict(duration_s=2.0), request_id='a1') + self.assertEqual(r['result'], dict(travel_m=2.0 * rt.MOTOR_SPEED_M_S, duration_s=2.0)) + obs = s.read(instance_id=h.instance_id)['observations'] + self.assertNotIn('holder.position_m', obs) + self.assertNotIn('holder.target_m', obs) + h.step(1.0) # contact after 0.48 s, stalled 20 um later + self.assertEqual(h.read('evaluator')['truth.tip']['kind'], 'crashed') + self.assertTrue(s.read(instance_id=h.instance_id)['observations']['holder.moving']['value']) # the motor is still driven + h.step(1.1) + self.assertFalse(h.read()['holder.moving']) + ev = s.invoke(instance_id=h.instance_id, capability_id='events.read', arguments=dict(since_s=0.0), request_id='a2')['result']['events'] + self.assertFalse({'MOTOR_STALLED', 'TIP_CRASH'} & {e['code'] for e in ev}) + self.assertIn(('fault', 'MOTOR_STALLED'), [(e['kind'], e['code']) for e in h.events]) + self.assertAlmostEqual(h.read('evaluator')['truth.tip']['recess_m'], rt.BEND_M, delta=1e-9) + + def test_approach_does_not_publish_its_outcome(self): + bound = (20000 + 1) * rt.CYCLE_S + rt.APPROACH_SETTLE_S + for sample in ('hopg', 'glass'): + h = near(holder_in(ready(), sample)) + h.invoke('z_controller.set', **ZC_HOPG) + h.invoke('approach.start', move_speed_percent=50.0, max_steps=20000) + v = h.read() + self.assertNotIn('holder.target_m', v) + self.assertEqual((v['operation.progress'], v['operation.remaining_s']), (0.0, bound)) # the same bound for a found and a failing approach + h.step(1.0) + v = h.read() + self.assertAlmostEqual(v['operation.progress'], 50 / 20000, places=12) # cycles done / max steps + self.assertAlmostEqual(v['operation.remaining_s'], bound - 1.0, places=9) + self.assertTrue(v['holder.moving']) + + def test_rejected_insertion_leaves_the_holder_unchanged(self): + h = ready() + h.invoke('cover.lift') + h.invoke('sample.mount', sample_id='hopg') + rejected(h, 'holder.insert', 'COLLISION_RISK', position_m=h.samples['hopg']['stack_m'] + 0.05e-3, angle_rad=1.0) + self.assertEqual((h.holder['angle'], h.holder['location'], h.holder['q'], h.holder['view_bias']), (0.0, 'container', None, 1.0)) + + def test_no_current_while_engaged_drives_the_tip_into_the_surface(self): + h = engaged(**QUIET) + h.invoke('z_controller.set', **dict(ZC_HOPG, tip_voltage_v=0.0)) + self.assertEqual(h.read('evaluator')['truth.tip']['kind'], 'crashed') # the feedback extends at once + h.step(0.1) + v = h.read('evaluator') + self.assertEqual((v['truth.tip']['kind'], v['probe_status.light']), ('crashed', 'orange')) + self.assertAlmostEqual(v['truth.gap_m'], rt.D_CONTACT_M, delta=1e-18) # pressed back to point contact + self.assertEqual(h.ledger()['tip_crashes'], 1.0) + self.assertIn('TIP_CRASH', [e['code'] for e in h.events]) + h.invoke('z_controller.set', **ZC_HOPG) + h.step(0.1) + v = h.read('evaluator') + self.assertAlmostEqual(v['truth.gap_m'], v['truth.setpoint_gap_m'], delta=1e-12) # the feedback holds the set point again + self.assertEqual((h.ledger()['tip_crashes'], v['probe_status.light']), (1.0, 'green')) + + def test_high_tip_voltage_holds_the_tip_farther_away(self): + m = rt.material('ito') + d = rt.setpoint_gap(m, 10.0, 0.1e-9, 0.4, 295.15) + self.assertIsNotNone(d) + self.assertGreater(d[0], 5e-9) + i = abs(float(rt.tunnel_current(10.0, np.array([d[0]]), m, rt.barrier_ev(m, 0.4), rt.KB * 295.15 / rt.E_CH)[0])) + self.assertAlmostEqual(i / 0.1e-9, 1.0, delta=1e-6) + ito = dict(sample_id='ito', template_id='ito_glass', seed=2, tilt_rad=[0.0, 0.0]) + h = near(holder_in(ready(samples=SAMPLES + (ito,)), 'ito')) + h.invoke('z_controller.set', setpoint_a=0.1e-9, tip_voltage_v=10.0, p_gain=1.0, i_gain=15.0) + op = wait_op(h, h.invoke('approach.start', move_speed_percent=50.0, max_steps=20000)['operation_id']) + self.assertEqual(op['phase'], 'completed') + self.assertNotEqual(h.read('evaluator')['truth.tip']['kind'], 'crashed') + + def test_hand_guard_is_the_eye_estimate_not_the_exact_gap(self): + h = _scenario('holder_in') + b = h.holder['view_bias'] + q_now, g_now = h.holder['q'], h.read('evaluator')['truth.gap_m'] + lo, hi = q_now - g_now, q_now # rejected at contact, accepted here + for _ in range(60): + mid = 0.5 * (lo + hi) + try: + copy.deepcopy(h).invoke('holder.push', position_m=mid) + hi = mid + except rt.ActionRejected: + lo = mid + g_edge = g_now + (hi - q_now) + self.assertAlmostEqual(g_edge * b + h._look_noise(False), rt.EYE_TOUCH_M, delta=1e-9) # seen (g x bias + jitter) closer than 0.2 mm appears to touch + self.assertGreater(abs(g_edge - rt.PUSH_MIN_GAP_M), 1e-6) # not an oracle of the true 0.2 mm + + def test_z_output_and_topography_share_the_nominal_scale(self): + h = engaged(settle_s=600.0, **QUIET) + v = h.read('evaluator') + ext, cal = h._z_state()['ext'], h.cal['z'] + self.assertAlmostEqual(v['zscanner.extension_m'], ext / (1 + cal), delta=3 * rt.Z_DAC_M + 5 * rt.VIBRATION_M['quiet']) + self.assertAlmostEqual(v['zscanner.extension_m'] / rt.Z_DAC_M, round(v['zscanner.extension_m'] / rt.Z_DAC_M), places=6) # 16-bit grid + self.assertGreater(abs(v['zscanner.extension_m'] - ext), 10 * rt.Z_DAC_M) # not the real extension + rec = scan(h, image_size_m=20e-9, time_per_line_s=0.05, points=32) + self.assertAlmostEqual(rt.Z_RANGE_M / 2 - float(np.mean(topo(rec))), v['zscanner.extension_m'], delta=0.3e-9) # both nominal + + def test_extension_is_held_while_the_approach_settles(self): + h = _scenario('near') + h.invoke('z_controller.set', **ZC_HOPG) + h.invoke('approach.start', move_speed_percent=50.0, max_steps=20000) + x = h.op['extra'] + h.step(x['drive_end'] - h.t + 1e-6) # the engaging cycle is over, 0.5 s of settling left + self.assertIsNotNone(h.op) + exts = [] + for _ in range(20): + v = h.read('evaluator') + self.assertAlmostEqual(v['truth.gap_m'], x['d_found'], delta=1e-12) + exts.append(v['zscanner.extension_m']) + h.step(0.02) + self.assertLess(max(exts) - min(exts), 0.05e-9) # held, not sweeping + self.assertGreater(min(exts), 0.5 * rt.Z_RANGE_M) + + def test_empty_holder_approach_stays_within_the_travel(self): + h = ready() + h.invoke('cover.lift') + h.invoke('holder.insert', position_m=1.0e-3, angle_rad=0.0) + h.invoke('cover.place') + near(h) + h.invoke('z_controller.set', **ZC_HOPG) + wait_op(h, h.invoke('approach.start', move_speed_percent=50.0, max_steps=20000)['operation_id']) + q = h.read('evaluator')['holder.position_m'] + self.assertGreaterEqual(q, rt.HOLDER_TRAVEL_M[0]) + self.assertEqual(asset_tool.validate_value(q, _meta()['state_slots']['holder.position_m']['value_schema']), []) + + def test_dirty_guides_slow_a_move_already_running(self): + h = _scenario('near') + h.invoke('approach.retract', duration_s=4.0) + h.step(1.0) + q1 = h.holder['q'] + h.invoke('fault.inject', fault='approach_motor_dirty', active=True) + h.step(2.0) + self.assertAlmostEqual(h.holder['q'] - q1, 2.0 * rt.MOTOR_SPEED_M_S * rt.DIRTY_MOTOR_FACTOR, places=12) + h = _scenario('approaching') # during the automatic approach: smaller steps + step0 = h.op['extra']['step_m'] + h.invoke('fault.inject', fault='approach_motor_dirty', active=True) + self.assertAlmostEqual(h.op['extra']['step_m'], step0 * rt.DIRTY_MOTOR_FACTOR, places=15) + op = wait_op(h, h.op['op']) + self.assertEqual((op['phase'], h.read()['approach.state']), ('completed', 'engaged')) + + def test_sub_dac_pixels_are_flagged_and_a_slow_withdraw_books_no_steps(self): + h = engaged(**QUIET) + rec = scan(h, image_size_m=1e-9, time_per_line_s=0.05, points=256) + self.assertIn('pixel_below_xy_dac_step', rec['warnings']) + n0, trav0, q = h.ledger()['approach_steps'], h.ledger()['motor_travel_m'], h.holder['q'] + self.assertEqual(h.invoke('approach.withdraw', steps=100, move_speed_percent=5.0), dict(travel_m=0.0, duration_s=100 * rt.CYCLE_S)) + settle(h) + self.assertEqual((h.holder['q'], h.ledger()['approach_steps'], h.ledger()['motor_travel_m']), (q, n0, trav0)) + + def test_approach_output_is_the_commanded_ramp_even_after_a_run_in(self): + h = near(holder_in(ready(), 'glass')) + h.invoke('z_controller.set', **ZC_HOPG) + h.invoke('approach.start', move_speed_percent=50.0, max_steps=20000) + x = h.op['extra'] + t_touch = x['t_plan'] + math.ceil((x['q_start'] - h.holder['stop']['q_crash']) / x['step_m'] - 1e-9) * rt.CYCLE_S + for cycles_after in (-2, 0, 3, 50): + t = t_touch + (cycles_after + 0.95) * rt.CYCLE_S + h.step(t - h.t) + self.assertAlmostEqual(h.read()['zscanner.extension_m'], 0.95 * rt.Z_RANGE_M, delta=2 * rt.Z_DAC_M) # the ramp, before and after the contact + self.assertEqual(h.read('evaluator')['truth.tip']['kind'], 'crashed') + self.assertEqual(h.read('evaluator')['truth.gap_m'], rt.D_CONTACT_M) + + def test_looks_jitter_in_time_and_touching_uses_the_estimate(self): + h = _scenario('near') # cover on: the 10x magnifier + a, b = h.invoke('magnifier.view'), h.invoke('magnifier.view') + self.assertEqual(a, b) # the same look at the same time + g = h.read('evaluator')['truth.gap_m'] + seen = [g * h.holder['view_bias'] + h._look_noise(True, h.t + 0.1 * i) for i in range(20)] + self.assertGreater(np.std(seen), 0.3 * rt.MAGNIFIER_SIGMA_M) # looks at other times vary + self.assertLessEqual(max(abs(s - g * h.holder['view_bias']) for s in seen), 3 * rt.MAGNIFIER_SIGMA_M + 1e-15) + c = copy.deepcopy(h) + c.holder['view_bias'] = (25e-6 - c._look_noise(True)) / g # this look sees 25 um ... + self.assertGreater(g, 30e-6) # ... of a larger true gap + self.assertTrue(c.invoke('magnifier.view')['appears_touching']) + + def test_two_guards_leave_the_gap_uncertain_by_the_look_jitter(self): + h = _scenario('holder_in') + b, n = h.holder['view_bias'], h._look_noise(False) + q_now, g_now = h.holder['q'], h.read('evaluator')['truth.gap_m'] + + def edge(accept): + lo, hi = q_now - g_now, q_now + 1e-3 + for _ in range(60): + mid = 0.5 * (lo + hi) + if accept(mid): + hi = mid + else: + lo = mid + return hi + + def push_ok(q): + try: + copy.deepcopy(h).invoke('holder.push', position_m=q) + return True + except rt.ActionRejected: + return False + + def rotate_ok(q): + c = copy.deepcopy(h) + try: + c.invoke('holder.push', position_m=q) + c.invoke('holder.rotate', angle_rad=0.0) + return True + except rt.ActionRejected: + return False + q1, q2 = edge(push_ok), edge(rotate_ok) + b_solved = (0.25e-3 - 0.20e-3) / (q2 - q1) # the two thresholds give the bias ... + g_solved = 0.20e-3 / b_solved - (q1 - q_now) # ... but the gap only up to the jitter of the look + self.assertAlmostEqual(b_solved, b, delta=1e-6) + self.assertAlmostEqual(g_now - g_solved, -n / b, delta=1e-9) + + def test_every_insertion_is_looked_at_afresh(self): + h = _scenario('holder_in') + n1 = h._look_noise(False) + h.invoke('holder.remove') + stack = h.samples['hopg']['stack_m'] + for dq in (0.05e-3, 0.12e-3, 0.16e-3, 0.2e-3, 0.3e-3, 1.0e-3): # the insertion check uses the look at the new insertion + c = copy.deepcopy(h) + b_new = float(np.clip(1.0 + 0.15 * c._rng(29, c.seq['insert'] + 1).standard_normal(), 0.6, 1.4)) + c.holder.update(location='head', q=stack + dq, view_bias=b_new) + want = c._eye_gap(c._gap_mech(), c.seq['insert'] + 1) < rt.PUSH_MIN_GAP_M + c = copy.deepcopy(h) + if want: + rejected(c, 'holder.insert', 'COLLISION_RISK', position_m=stack + dq, angle_rad=0.0) + else: + c.invoke('holder.insert', position_m=stack + dq, angle_rad=0.0) + self.assertNotEqual(c._look_noise(False), n1) # a new look, not the jitter of the previous insertion + + def test_guard_and_magnifier_agree_with_the_cover_lifted(self): + h = _scenario('holder_in') + for dq in np.linspace(-0.9e-3, 0.0, 19): + c = copy.deepcopy(h) + q = h.holder['q'] + dq + est = c._eye_gap(c._hand_gap(q)) + try: + c.invoke('holder.push', position_m=q) + ok = True + except rt.ActionRejected: + ok = False + if ok: + m = c.invoke('magnifier.view') + self.assertFalse(m['appears_touching']) + self.assertGreaterEqual(m['gap_estimate_m'], rt.PUSH_MIN_GAP_M - 1e-15) + self.assertEqual(ok, est >= rt.PUSH_MIN_GAP_M) + + def test_dirty_guides_after_a_run_in_shorten_the_remaining_steps(self): + h = near(holder_in(ready(), 'glass')) + h.invoke('z_controller.set', **ZC_HOPG) + h.invoke('approach.start', move_speed_percent=50.0, max_steps=20000) + x = h.op['extra'] + t_touch = x['t_plan'] + math.ceil((x['q_start'] - h.holder['stop']['q_crash']) / x['step_m'] - 1e-9) * rt.CYCLE_S + h.step(t_touch + 2.5 * rt.CYCLE_S - h.t) + self.assertTrue(h.holder['stop']['crashed']) + h.invoke('fault.inject', fault='approach_motor_dirty', active=True) + q0 = h.holder['q'] + h.step(10 * rt.CYCLE_S) + self.assertAlmostEqual(q0 - h.holder['q'], 10 * 150e-9 * rt.DIRTY_MOTOR_FACTOR, delta=1e-15) + self.assertEqual(h.ledger()['tip_crashes'], 1.0) + + def test_readings_need_the_controller(self): + h = configured() + h.register_principal('agent', 'agent') + obs = h.session('agent').read(instance_id=h.instance_id)['observations'] + for k in ('zscanner.extension_m', 'current.reading_a'): + self.assertEqual((obs[k]['value'], obs[k]['quality']), (None, 'unavailable')) + h.invoke('power.set', enabled=True) + h.step(rt.BOOT_S - 1.0) + self.assertIsNone(h.read()['current.reading_a']) # still initialising + h.step(2.0) + self.assertEqual(h.read()['zscanner.extension_m'], 0.0) # ready, Z fully retracted + self.assertLess(abs(h.read()['current.reading_a']), 20e-12) # amplifier noise only + + +class ZZRejectionCodes(unittest.TestCase): + def test_every_observed_rejection_code_is_declared(self): + """Runs last (class name): every code raised by a device call anywhere in this test module is declared for that capability.""" + undeclared = {k: sorted(v - set(rt.CAP_ERRORS.get(k, [])) - {'INVALID_ARGUMENT', 'UNSUPPORTED', 'NOT_IMPLEMENTED', 'UNKNOWN_CAPABILITY'}) + for k, v in REJECTIONS.items()} + self.assertEqual({k: v for k, v in undeclared.items() if v}, {}) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_asset_netzsch_lfa467.py b/tests/test_asset_netzsch_lfa467.py new file mode 100644 index 0000000000000000000000000000000000000000..fe8d6344c6da751a098bc0ccfea4ecfbe25e632f --- /dev/null +++ b/tests/test_asset_netzsch_lfa467.py @@ -0,0 +1,132 @@ +"""Actual LFA process/protocol/analysis regression tests; no Isaac required.""" +import copy,json,math,sys,unittest +from pathlib import Path +import numpy as np +ROOT=Path(__file__).resolve().parents[1];sys.path.insert(0,str(ROOT/'scripts')) +from asset_runtime import netzsch_lfa467 as r +OBSERVED=[];STATES=[];SCHEMA_REPORT=[] +class Host(r.NetzschLfa467Runtime): + def invoke(self,k,**a): + before=self.read();out=super().invoke(k,**a);after=self.read();changed={s for s in after if after[s]!=before[s]} + if changed-set(r.CAPS[k]['effects']):raise AssertionError((k,'undeclared effects',changed-set(r.CAPS[k]['effects']))) + OBSERVED.append((k,copy.deepcopy(a),copy.deepcopy(out)));STATES.append(after);json.dumps(out,allow_nan=False);return out + def step(self,dt_s): + super().step(dt_s);STATES.append(self.read());json.dumps(STATES[-1],allow_nan=False) +def make(plant=None,sample=None,method=None): + h=Host();h.invoke('plant.configure',**dict(r.PLANT_EXAMPLE,cells=32,furnace_speed_m_s=.1,sampler_speed_m_s=.1,**(plant or {})));h.invoke('sample.load',**dict(r.SAMPLE_EXAMPLE,**(sample or {})));h.invoke('power.set',enabled=True) + for g in r.CHANNELS:h.invoke('gas.load',**dict(r.GAS_EXAMPLE,channel=g));h.invoke('gas.set_open',channel=g,opened=True) + h.invoke('coolant.load',**r.COOLANT_EXAMPLE);h.invoke('detector.set_enabled',enabled=True);h.invoke('pulse.charge',energy_j=1.,accept_optical_budget=True);h.invoke('furnace.set',opened=False);h.step(1.2);h.invoke('method.configure',**dict(r.METHOD_EXAMPLE,**(method or {})));return h + +def run(h):h.invoke('acquisition.start');h.step(1.);return h.invoke('acquisition.result') +def close(h): + if h.phase=='running':h.invoke('acquisition.stop') + h.invoke('thermal.disable');h.invoke('detector.set_enabled',enabled=False) + for g in r.CHANNELS:h.invoke('gas.set_open',channel=g,opened=False) + h.invoke('furnace.set',opened=True);h.step(1.2);h.invoke('sample.remove');h.invoke('pulse.discharge') + for g in r.CHANNELS:h.invoke('gas.unload',channel=g) + for tank in ['detector','furnace']: + if h.coolant_present[tank]:h.invoke('coolant.unload',reservoir=tank) + h.invoke('power.set',enabled=False);return h.invoke('ledger.read') + +class LfaTests(unittest.TestCase): + def assertBudget(self,h,tol=2e-8): + d=h.invoke('ledger.read') + for k,v in d.items(): + if 'error' in k:self.assertLess(abs(v),tol,(k,v)) + def test_01_idle_clock_configuration(self): + h=Host();h.step(.000005);self.assertEqual(h.time_s,.000005);self.assertIsNone(h.plant);h.invoke('plant.configure',**r.PLANT_EXAMPLE);self.assertFalse(h.read()['power.enabled']) + def test_02_zero_step_pure(self): + h=make(method={'equilibrium_dwell_s':0.,'pretrigger_s':0.});h.invoke('acquisition.start');before=h.read();h.invoke('sim.step',dt_s=0.);self.assertEqual(before,h.read());self.assertEqual(h.stage,'equilibrating') + def test_03_real_sic_observations(self): + h=make();out=run(h);self.assertEqual(out['phase'],'succeeded');self.assertGreater(max(x['temperature_k'] for x in out['rows'])-out['rows'][0]['temperature_k'],.1);self.assertNotIn('diffusivity_m2_s',out);self.assertBudget(h) + def test_04_real_alumina_slower(self): + a=make();b=make(sample={'reference_id':'nist_alumina','density_kg_m3':3984.,'heat_capacity_j_kg_k':755.});run(a);run(b);self.assertGreater(a.rows[210]['temperature_k']-a.rows[0]['temperature_k'],b.rows[210]['temperature_k']-b.rows[0]['temperature_k']);self.assertBudget(b) + def test_05_microsecond_cancel(self): + h=make(method={'equilibrium_dwell_s':0.,'pretrigger_s':0.,'pulse_width_s':10e-6,'sample_interval_s':.5e-6,'record_duration_s':.001});h.invoke('acquisition.start');h.step(5e-6);self.assertEqual(h.stage,'pulse');h.invoke('acquisition.stop');self.assertAlmostEqual(h.optical_emitted,.05,12);self.assertAlmostEqual(h.optical_stored,.95,12);self.assertGreater(len(h.rows),5);self.assertBudget(h) + def test_06_two_mhz_internal_clock(self): + h=make(method={'equilibrium_dwell_s':0.,'pretrigger_s':0.,'sample_interval_s':.5e-6,'record_duration_s':.001});start=h.time_s;h.invoke('acquisition.start');h.step(.1);self.assertEqual(h.time_s,start+.1);self.assertEqual(len(h.rows),2001);self.assertAlmostEqual(h.rows[1]['time_s']-h.rows[0]['time_s'],.5e-6,12) + def test_07_partition_invariance(self): + a=make(method={'equilibrium_dwell_s':0.});b=make(method={'equilibrium_dwell_s':0.});a.invoke('acquisition.start');b.invoke('acquisition.start');a.step(.3) + for dt in [.003,.008,.027,.062,.2]:b.step(dt) + np.testing.assert_allclose(a.theta,b.theta,atol=1e-10,rtol=1e-9);self.assertEqual(a.rows,b.rows);self.assertBudget(b) + def test_08_neumann_constant_stiff(self): + for hface in [0.,10.]: + m=r.thermal_modes(1e-5,1e-4,3000,1000,.002,hface,hface,64,20,0);q=np.full(65,5.);out=r.propagate_modes(m,q,0,0,120);np.testing.assert_allclose(out['temperature_delta_k'],q,atol=1e-11,rtol=0);self.assertLess(abs(out['stored_change_j']),1e-10) + def test_09_neumann_continuum_convergence(self): + t=np.array([.0005,.001,.003,.01]);exact=r.parker_response(5e-5*t/.002**2);errs=[] + for n in [32,64]: + m=r.thermal_modes(.002,1,3000,1000,5e-5,0,0,n,20,0);q=np.zeros(n+1);q[1]=1/m['C'][1];out=r.propagate_modes(m,q,0,0,float(t[-1]),sample_times_s=t);errs.append(max(abs(out['rear_delta_k']*.002*3e6-exact))) + self.assertLess(errs[1],errs[0]*.3) + def test_10_robin_conservation(self): + m=r.thermal_modes(.002,1e-4,3000,1000,5e-5,25,60,64,20,.1);q=np.linspace(1,10,65);o=r.propagate_modes(m,q,3,2,.25);self.assertAlmostEqual(o['heat_input_j']-o['ambient_j'],o['stored_change_j'],places=9) + def test_11_detector_resonance(self): + tau=.02;A,B,_,_=r.detector_kernels(np.array([-1/tau,0.]),[.001,.1],tau);np.testing.assert_allclose(A[0],np.array([.001,.1])/tau*np.exp(-np.array([.001,.1])/tau),rtol=1e-12);self.assertTrue(np.all(np.isfinite(B))) + def test_12_sensor_saturation_not_clip(self): + h=make(plant={'detector_maximum_k':298.16});out=run(h);self.assertTrue(any(x['temperature_k'] is None for x in out['rows']));self.assertGreater(h._rear(),298.16) + def test_13_gain_calibration_independent(self): + h=make(plant={'detector_gain':2.,'detector_offset_k':3.});h.invoke('sensor.calibrate',**dict(r.CALIBRATION_EXAMPLE,temperature_gain_correction=.5,temperature_zero_k=3.));out=run(h);self.assertAlmostEqual(out['rows'][0]['temperature_k'],298.15,places=5) + def test_14_parker_external(self): + h=Host();t=np.linspace(0,.1,1001);args=dict(time_s=t.tolist(),temperature_k=(300+r.parker_response(5e-5*t/.002**2)).tolist(),thickness_m=.002,pulse_time_s=0.,baseline_k=300.,plateau_k=301.,accept_adiabatic_instant_pulse=True);a=h.invoke('analysis.parker',**args);self.assertLess(abs(a['diffusivity_m2_s']/5e-5-1),1e-4) + def test_15_parker_missing_gap(self): + out=r.analyze_parker([0,.01,.02,.03],[300,300.1,None,301],.002,0,300,301,True);self.assertIsNone(out['diffusivity_m2_s']) + def test_16_finite_pulse_external_fit(self): + h=Host();t=np.linspace(-.001,.08,301);a=dict(r.FIT_EXAMPLE,time_s=t.tolist(),temperature_k=(300+1000*r.finite_profile(t,4e-5,.002,2.5e6,30,15,.001,.0002,32)).tolist(),pulse_width_s=.001,volumetric_capacity_j_m3_k=2.5e6,front_loss_w_m2_k=30.,rear_loss_w_m2_k=15.,detector_tau_s=.0002,cells=32);out=h.invoke('analysis.finite_pulse',**a);self.assertLess(abs(out['diffusivity_m2_s']/4e-5-1),1e-5);self.assertLess(out['fit_rms_k'],1e-7) + def test_17_conductivity_external(self): + h=Host();o=h.invoke('analysis.conductivity',**r.CAPS['analysis.conductivity']['example_arguments']);self.assertAlmostEqual(o['conductivity_w_m_k'],112.97) + def test_18_reference_exact_and_domain(self): + h=make(plant={'cooler':'LN2'});out=h.invoke('reference.query',reference_id='nist_sic');self.assertEqual(json.loads(out['reference_json'])['values'],r.library()['substances']['nist_sic']['values']);self.assertRaisesRegex(r.ActionRejected,'REFERENCE_TEMPERATURE',h.invoke,'method.configure',**dict(r.METHOD_EXAMPLE,temperature_k=280.)) + def test_19_size_and_unknown_atomic(self): + h=Host();h.invoke('plant.configure',**r.PLANT_EXAMPLE);before=h.read() + for patch in [{'thickness_m':.007},{'diameter_m':.005},{'bad':1},{'density_kg_m3':float('nan')}]:self.assertRaises(r.ActionRejected,h.invoke,'sample.load',**dict(r.SAMPLE_EXAMPLE,**patch));self.assertEqual(before,h.read()) + def test_20_pulse_grid_and_record_limit(self): + h=make() + for patch in [{'pulse_width_s':10.5e-6},{'sample_interval_s':.5e-6,'record_duration_s':1.},{'pulse_width_s':.0015,'record_duration_s':.001}]:self.assertRaises(r.ActionRejected,h.invoke,'method.configure',**dict(r.METHOD_EXAMPLE,**patch)) + def test_21_detector_inventory_fault(self): + h=make(method={'equilibrium_dwell_s':0.});h.invoke('detector.set_enabled',enabled=False);h.invoke('coolant.unload',reservoir='detector');h.invoke('coolant.load',**dict(r.COOLANT_EXAMPLE,amount_kg=1e-9));h.invoke('detector.set_enabled',enabled=True);out=run(h);self.assertEqual(out['error_code'],'DETECTOR_COOLANT_EXHAUSTED');self.assertEqual(h.coolant_remaining['detector'],0.);self.assertBudget(h) + def test_22_gas_fault_and_channels(self): + h=make(method={'equilibrium_dwell_s':0.});h.invoke('gas.set_open',channel='protective',opened=False);h.invoke('gas.unload',channel='protective');h.invoke('gas.load',**dict(r.GAS_EXAMPLE,channel='protective',amount_mol=1e-12));h.invoke('gas.set_open',channel='protective',opened=True);o=run(h);self.assertEqual(o['error_code'],'GAS_EXHAUSTED');self.assertBudget(h) + def test_23_furnace_ln2_finite(self): + h=make(plant={'cooler':'LN2'});h.invoke('coolant.load',**dict(r.COOLANT_EXAMPLE,reservoir='furnace',amount_kg=1e-10));h.invoke('thermal.set_temperature',temperature_k=295.,rate_k_s=.5);h.step(.1);self.assertEqual(h.coolant_remaining['furnace'],0.);self.assertFalse(h.thermal_enabled);self.assertBudget(h) + def test_24_detector_cooler_domain(self): + h=make(plant={'cooler':'LN2','detector':'InSb'});self.assertRaisesRegex(r.ActionRejected,'CONFIGURATION_TEMPERATURE_RANGE',h.invoke,'thermal.set_temperature',temperature_k=295.,rate_k_s=.5) + def test_25_passive_cooling_no_ambient_clip(self): + h=make();h.invoke('thermal.set_temperature',temperature_k=303.15,rate_k_s=50/60);h.step(1.);self.assertGreater(h._furnace(),298.15);h.invoke('thermal.disable');h.invoke('thermal.set_cooling',enabled=True);a=h._furnace();h.step(1.);self.assertLess(h._furnace(),a);self.assertGreaterEqual(h._furnace(),298.15);self.assertBudget(h) + def test_26_optical_finite_capacity(self): + h=make();before=h._ledger();self.assertRaisesRegex(r.ActionRejected,'OPTICAL_CAPACITY',h.invoke,'pulse.charge',energy_j=10.,accept_optical_budget=True);self.assertEqual(before,h._ledger());h.invoke('pulse.discharge');self.assertRaisesRegex(r.ActionRejected,'INSUFFICIENT_OPTICAL',h.invoke,'acquisition.start') + def test_27_heat_domain_rejection_preserves_energy(self): + h=make(method={'pulse_energy_j':1.},plant={'maximum_local_temperature_rise_k':.01});out=run(h);self.assertEqual(out['error_code'],'PULSE_LINEAR_DOMAIN');self.assertEqual(h.optical_emitted,0.);self.assertBudget(h) + def test_28_timeout_preserves_heating(self): + h=make(method={'temperature_k':303.15,'timeout_s':.05});out=run(h);self.assertEqual(out['error_code'],'TIMEOUT');self.assertGreater(h.heater_input,0);self.assertBudget(h) + def test_29_frozen_cancel_restart(self): + h=make();h.invoke('acquisition.start');h.step(.21);h.invoke('acquisition.stop');old=h.invoke('acquisition.result');op=old['operation_id'];h.step(.2);self.assertEqual(old,h.invoke('acquisition.result'));h.invoke('method.configure',**dict(r.METHOD_EXAMPLE,equilibrium_tolerance_k=.5));h.invoke('acquisition.start');h.step(1);self.assertEqual(old,h.records[op]);self.assertEqual(h.phase,'succeeded') + def test_30_emergency_and_reset(self): + h=make();h.invoke('acquisition.start');h.step(.21);h.invoke('emergency.stop');self.assertEqual(h.error,'SOFTWARE_STOP');self.assertFalse(h._detector_ready());h.invoke('emergency.reset');self.assertFalse(h.emergency) + def test_31_motion_16slots_and_access(self): + h=make();self.assertRaisesRegex(r.ActionRejected,'FURNACE_NOT_OPEN',h.invoke,'sampler.select',position=16);h.invoke('furnace.set',opened=True);h.step(1.2);h.invoke('sampler.select',position=16);self.assertNotEqual(h.sampler_x,h.sampler_target_x);h.step(1);self.assertEqual((h.sampler_x,h.sampler_y),(-.028,-.028));self.assertRaisesRegex(r.ActionRejected,'SAMPLE_ACCESS',h.invoke,'sample.remove');h.invoke('sampler.select',position=1);h.step(1);self.assertEqual((h.sampler_x,h.sampler_y),(.028,.028)) + def test_32_mass_heat_cleanup(self): + h=make();run(h);d=close(h);self.assertEqual(d['sample_present_kg'],0);self.assertGreater(d['recovered_sensible_j'],0);self.assertBudget(h) + def test_33_session_truth_permissions(self): + h=make();s=h.session();desc=s.describe(instance_id=h.instance_id);self.assertNotIn('truth.alpha_m2_s',desc['state_slots']);self.assertNotIn('plant.configure',desc['capabilities']);self.assertRaisesRegex(r.ActionRejected,'ACCESS_DENIED',s.read,instance_id=h.instance_id,state_ids=['truth.alpha_m2_s']);out=s.invoke(instance_id=h.instance_id,capability_id='ledger.read',arguments={},request_id='x');self.assertEqual(out['error']['code'],'ACCESS_DENIED') + def test_34_owner_poll_cancel_result(self): + h=make();h.register_principal('other');a=h.session();b=h.session('other');out=a.invoke(instance_id=h.instance_id,capability_id='acquisition.start',arguments={},request_id='s');op=out['operation_id'];self.assertRaisesRegex(r.ActionRejected,'ACCESS_DENIED',b.poll,op);self.assertRaisesRegex(r.ActionRejected,'ACCESS_DENIED',b.cancel,op,'c');self.assertEqual(b.invoke(instance_id=h.instance_id,capability_id='acquisition.result',arguments={},request_id='r')['error']['code'],'ACCESS_DENIED');self.assertEqual(a.cancel(op,'c')['status'],'succeeded');self.assertEqual(a.poll(op)['status'],'cancelled') + def test_35_idempotence_conflict(self): + h=make();s=h.session();a=dict(instance_id=h.instance_id,capability_id='acquisition.start',arguments={},request_id='same');x=s.invoke(**a);self.assertEqual(s.invoke(**a),x);bad=s.invoke(**dict(a,capability_id='acquisition.stop'));self.assertEqual(bad['error']['code'],'REQUEST_CONFLICT');s.cancel(x['operation_id'],'c');self.assertEqual(s.cancel(x['operation_id'],'c')['status'],'succeeded') + def test_36_no_query_clock(self): + h=make();before=h.read();rev=h.revision;h.invoke('reference.query',reference_id='nist_sic');h.invoke('acquisition.result');h.invoke('ledger.read');h.session().read(instance_id=h.instance_id);self.assertEqual(h.read(),before);self.assertEqual(h.revision,rev) + def test_37_instances_isolated(self): + a=make();b=make();a.invoke('acquisition.start');a.step(.4);self.assertEqual(b.phase,'idle');self.assertEqual(b.time_s,1.2);self.assertEqual(b.optical_emitted,0.) + def test_38_unknown_roles_targets_writes(self): + h=make();s=h.session();self.assertRaises(r.ActionRejected,h.session,'unknown');self.assertRaises(r.ActionRejected,s.read,instance_id='bad');self.assertRaises(r.ActionRejected,s.write,instance_id=h.instance_id,state_id='thermal.target_k',value=300.,request_id='w');self.assertEqual(s.invoke(instance_id=h.instance_id,capability_id='wrong',arguments={},request_id='a')['status'],'rejected') + def test_39_unsupported_and_atomic(self): + h=make();before=h.read() + for k in r.UNSUPPORTED:self.assertRaisesRegex(r.ActionRejected,'UNSUPPORTED',h.invoke,k) + self.assertEqual(before,h.read()) + def test_40_all_schema_json(self): + meta=r.export_netzsch_lfa467_contract_metadata();self.assertEqual(set(meta['state_slots']),set(r.SLOTS));json.dumps(meta,allow_nan=False);h=make();run(h);json.dumps(h.session('evaluator').read(instance_id=h.instance_id),allow_nan=False) + def test_41_resource_subns(self): + h=make();h.invoke('gas.set_open',channel='purge2',opened=False);h.invoke('gas.unload',channel='purge2');h.invoke('gas.load',**dict(r.GAS_EXAMPLE,channel='purge2',amount_mol=1e-18));h.invoke('gas.set_open',channel='purge2',opened=True);h.step(1e-9);self.assertEqual(h.gas_remaining['purge2'],0);self.assertBudget(h) + def test_42_flow_public_and_condition_acceptance(self): + h=make();h.invoke('gas.set_flow',channel='purge1',flow_m3_s=50e-6/60);self.assertRaises(r.ActionRejected,h.invoke,'method.configure',**dict(r.METHOD_EXAMPLE,accept_condition_transfer=False));self.assertEqual(h.gas_flow['purge1'],50e-6/60) + def test_43_power_loss_partial(self): + h=make(method={'equilibrium_dwell_s':0.,'pretrigger_s':0.,'pulse_width_s':10e-6});h.invoke('acquisition.start');h.step(5e-6);h.invoke('power.set',enabled=False);self.assertEqual(h.error,'POWER_LOSS');self.assertAlmostEqual(h.optical_emitted,.05,12);self.assertBudget(h) +if __name__=='__main__':unittest.main() diff --git a/tests/test_asset_netzsch_mmc315.py b/tests/test_asset_netzsch_mmc315.py new file mode 100644 index 0000000000000000000000000000000000000000..c4db218b08245432a8dde1904364db33c61f6897 --- /dev/null +++ b/tests/test_asset_netzsch_mmc315.py @@ -0,0 +1,783 @@ +"""CHEM-148 NETZSCH MMC 315 Nexus ARC module runtime tests: python3 -m unittest tests/test_asset_netzsch_mmc315.py + +Themes (pipeline.md): setpoints only write targets; read/describe/poll are pure; rejected preconditions leave the state +unchanged; two instances are isolated; agent/evaluator truth isolation and result redaction; energy and mole conservation; +real return values validate against the contract schemas; async completion / cancellation. +Physics: the NETZSCH HWS example (20 % DTBP in toluene, Ti sphere): onset, dT, phi, dT_ad, heat and pressure step; HWS +detection against the analytic threshold temperature; adiabatic tracking limited to the documented 50 K/min; Iso-Fixed / +Iso-Track / ramp exotherm detection; end criteria (self-heat rate net of the programme) and the 150 bar limit; drift of an +inert sample below the threshold; Townsend-Tou evaluation with quality flags; vapour pressure continuous across Tc; +1 s instrument cycle (host-step independence, stable PI); over-range guards; data reduction; request binding. +No native scene, robot or hardware claims. +""" +import copy +import importlib.util +import json +import math +import sys +import unittest +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT)) +from scripts.asset_runtime.netzsch_mmc315 import * # noqa: E402,F401,F403 +from scripts.asset_runtime import netzsch_mmc315 as rt # noqa: E402 + +PROCESS_EVIDENCE = {} +CHECKS = [] +_spec = importlib.util.spec_from_file_location('mmc315_asset_tool', ROOT / 'skills/chemistry-lab-assets/scripts/asset_tool.py') +asset_tool = importlib.util.module_from_spec(_spec) +_spec.loader.exec_module(asset_tool) +_ispec = importlib.util.spec_from_file_location('mmc315_interface', ROOT / 'outputs/expansion_batch04/t1_thermal/netzsch_mmc315/interface_definition.py') +interface = importlib.util.module_from_spec(_ispec) +_ispec.loader.exec_module(interface) +DTBP = 'di_tbutyl_peroxide' +CALIBRATED = dict(sample_tc_offset_k=0.0, jacket_tc_offset_k=0.0, tc_noise_k=0.001) # light containers (small C_s) need a quiet zero-mismatch pair +LIB = json.loads(LIBRARY_PATH.read_text()) + + +def call(h, k, **a): + """Invoke through the runtime, validate the returned value and check that only declared slots changed immediately.""" + before = h.read('debug') + r = h.invoke(k, **a) + validate(CAPS[k]['output_schema'], r) + problems = asset_tool.validate_value(r, CAPS[k]['output_schema']) + if problems: + raise AssertionError(f'{k}: {problems}') + after = h.read('debug') + delta = {x for x in after if before[x] != after[x]} + if k != 'sim.step' and not delta <= set(CAPS[k]['effects']): + raise AssertionError(f'{k}: undeclared state changes {sorted(delta - set(CAPS[k]["effects"]))}') + PROCESS_EVIDENCE.setdefault(k, []).append(dict(time_s=h.time_s, result_keys=sorted(r), actual_call=True)) + return r + + +def configured(plant=None, method=None, power=True): + h = NetzschMmc315Runtime() + call(h, 'plant.configure', **dict(PLANT_EXAMPLE, **(plant or {}))) + call(h, 'method.configure', **dict(METHOD_EXAMPLE, **(method or {}))) + if power: + call(h, 'power.set', enabled=True) + return h + + +def loaded(load=None, h=None, **kw): + h = h or configured(**kw) + call(h, 'lid.set', open=True); h.step(3.0) + call(h, 'sample.load', **dict(LOAD_EXAMPLE, **(load or {}))) + call(h, 'lid.set', open=False); h.step(3.0) + return h + + +def run(h, limit_h=60.0, dt=60.0): + call(h, 'test.start') + t = 0.0 + while h._test_active() and t < limit_h * 3600: + call(h, 'sim.step', dt_s=dt) + t += dt + return call(h, 'test.result') + + +def threshold_temperature(tpl, dT_obs, thr_k_min): + """Temperature at which the zero-conversion adiabatic self-heat rate equals the threshold (first-order template kinetics).""" + k = thr_k_min / 60.0 / dT_obs + return tpl['kinetics']['Ea_J_mol'] / (GAS_CONSTANT * math.log(tpl['kinetics']['A_per_s'] / k)) + + +class ConstantsAndLibrary(unittest.TestCase): + def test01_identity_and_documented_constants(self): + self.assertEqual(ASSET_TYPE_ID, 'instrument.netzsch_mmc315') + self.assertEqual(CATALOG_ID, 'CHEM-148') + self.assertAlmostEqual(TRACKING_RATE_K_S * 60, 50.0) + self.assertAlmostEqual(MAX_TEMPERATURE_K, 773.15) + self.assertAlmostEqual(MAX_PRESSURE_PA, 150e5) + self.assertEqual(CONTAINER_VOLUME_RANGE_M3, (0.5e-6, 8.5e-6)) + self.assertAlmostEqual(TEMPERATURE_READABILITY_K, 0.01) + self.assertAlmostEqual(PRESSURE_READABILITY_PA, 1000.0) + + def test02_interface_geometry_agrees_with_runtime(self): + self.assertAlmostEqual(interface.TRAY_TRAVEL_M, TRAY_TRAVEL_M) + self.assertAlmostEqual(interface.LID_OPEN_RAD, LID_OPEN_RAD) + self.assertAlmostEqual(interface.POWER_SWITCH_ON_RAD, POWER_SWITCH_ON_RAD) + self.assertAlmostEqual(interface.CONTAINER_VOLUME_M3, CONTAINER_VOLUME_RANGE_M3[1]) + self.assertAlmostEqual(interface.CONTAINER_MASS_KG, LOAD_EXAMPLE['container_mass_kg']) + for part, sid, capid, *_ in interface.MOTION: + self.assertIn(sid, SLOTS); self.assertIn(capid, CAPS) + for r in interface.READOUTS: + self.assertIn(r['source']['bridge'][0], SLOTS) + self.assertEqual(SLOTS[r['source']['bridge'][0]]['visibility'], 'agent') + for lamp in interface.LAMPS: + self.assertIn(lamp['source']['lamp']['bridge'], SLOTS) + + def test03_template_library_real_and_complete(self): + self.assertGreaterEqual(LIB['coverage']['distinct_substances'], 50) + self.assertEqual(LIB['coverage']['synthetic_records'], 0) + for t in LIB['templates']: + self.assertEqual(t['evidence'], 'measured_manufacturer') + self.assertTrue(t['measurements'] and all(m['source']['sha256'] for m in t['measurements'])) + self.assertGreater(t['kinetics']['A_per_s'], 0); self.assertGreater(t['kinetics']['Ea_J_mol'], 5e4) + self.assertTrue(t['heat_of_decomposition_J_per_g'] is None or t['cas'] == '110-05-4') + dtbp = templates()[DTBP] + self.assertAlmostEqual(dtbp['arc_reference']['thermal_inertia_phi'], 1.48) + report = json.loads((ROOT / 'outputs/expansion_batch04/t1_thermal/netzsch_mmc315/template_validation.json').read_text()) + self.assertEqual(report['status'], 'passed') + + def test04_vapour_pressure_follows_nist_toluene(self): + self.assertAlmostEqual(solvent_vapour_pressure_pa('toluene', 383.78) / 1e5, 1.013, delta=0.02) # normal boiling point 383.8 K + p200 = solvent_vapour_pressure_pa('toluene', 473.15) / 1e5 + self.assertAlmostEqual(p200, 10 ** (4.54436 - 1738.123 / (473.15 + 0.394)), places=6) + gap = [solvent_vapour_pressure_pa('toluene', T) for T in (384.66, 400.0, 420.0)] + self.assertTrue(gap[0] < gap[1] < gap[2]) # monotone across the bridged gap + Tc = LIB['solvents']['toluene']['critical_temperature_K'] + lo, hi = solvent_vapour_pressure_pa('toluene', Tc - 1e-6), solvent_vapour_pressure_pa('toluene', Tc + 1e-6) + self.assertLess(abs(hi / lo - 1), 1e-6) # continued smoothly above Tc + self.assertLess(solvent_vapour_pressure_pa('toluene', 600.0), solvent_vapour_pressure_pa('toluene', 620.0)) + self.assertEqual(solvent_vapour_pressure_pa('none', 450.0), 0.0) + + def test05_exact_thermal_step_conserves_energy(self): + Cj, Cs, G, Gsj, P, Q, Ta = 1200.0, 17.8, 0.15, 0.06, 300.0, 0.5, 296.15 + Tj, Ts, iu, ix = thermal_step(Cj, Cs, G, Gsj, P, Q, Ta, 320.0, 300.0, 7.3) + self.assertAlmostEqual(P * 7.3 + Q * 7.3 - G * iu, Cj * (Tj - 320.0) + Cs * (Ts - 300.0), delta=1e-8) + self.assertAlmostEqual(Q * 7.3 + Gsj * ix, Cs * (Ts - 300.0), delta=1e-8) + # millisecond sub-steps keep full relative accuracy of the integrals (trapezoid is O(dt^3) exact here) + dt = 1e-3 + Tj, Ts, iu, ix = thermal_step(Cj, Cs, G, Gsj, P, Q, Ta, 520.0, 519.0, dt) + self.assertLess(abs(iu / ((520.0 - Ta + Tj - Ta) / 2 * dt) - 1), 1e-12) + self.assertLess(abs(ix / ((520.0 - 519.0 + Tj - Ts) / 2 * dt) - 1), 1e-9) + + def test06_nth_order_update_is_exact_and_continuous_in_n(self): + y, k, dt = 0.7, 3e-3, 40.0 + self.assertAlmostEqual(nth_order_remaining(y, k, dt, 1.0), y * math.exp(-k * dt), places=15) + for n in (1.0 + 2e-12, 1.0 - 2e-12, 1.0 + 1e-7): + self.assertLess(abs(nth_order_remaining(y, k, dt, n) / (y * math.exp(-k * dt)) - 1), 1e-6, n) + self.assertAlmostEqual(nth_order_remaining(y, k, dt, 2.0), 1.0 / (1.0 / y + k * dt), places=14) + self.assertEqual(nth_order_remaining(0.01, 1.0, 10.0, 0.5), 0.0) # n < 1: complete within dt + self.assertAlmostEqual(nth_order_remaining(0.5, 0.01, 1.0, 0.5), (math.sqrt(0.5) - 0.005) ** 2, places=14) + + +class RuntimeContract(unittest.TestCase): + def test10_configuration_only_writes_targets(self): + h = configured() + T0 = h.T_s + call(h, 'method.configure', **dict(METHOD_EXAMPLE, start_temperature_k=373.15)) + self.assertEqual(h.T_s, T0) + self.assertFalse(h.read('agent')['test.running']) + + def test11_read_describe_poll_do_not_advance_time(self): + h = loaded() + h.register_principal('agent', 'agent') + s = h.session('agent') + r = s.invoke(instance_id='mmc315_01', capability_id='test.start', arguments={}, request_id='x1') + h.step(1800.0) + t0, rev = h.time_ns, h.revision + before = copy.deepcopy(h.read('debug')) + for _ in range(3): + s.read(instance_id='mmc315_01'); s.describe(instance_id='mmc315_01'); s.poll(r['operation_id']) + call(h, 'test.result'); call(h, 'analysis.kinetics', **CAPS['analysis.kinetics']['example_arguments']) + self.assertEqual((h.time_ns, h.revision), (t0, rev)) + self.assertEqual(before, h.read('debug')) + + def test12_rejections_leave_state_unchanged(self): + h = configured() + cases = [('test.start', {}, 'NO_SAMPLE'), ('sample.load', dict(LOAD_EXAMPLE), 'LID_NOT_OPEN'), ('sample.unload', {}, 'NO_SAMPLE'), + ('test.stop', {}, 'NOT_RUNNING'), ('plant.configure', dict(PLANT_EXAMPLE), 'PLANT_ALREADY_CONFIGURED'), ('module.scanning', {}, 'UNSUPPORTED'), + ('method.configure', dict(METHOD_EXAMPLE, end_temperature_k=313.15), 'INVALID_METHOD'), + ('method.configure', dict(METHOD_EXAMPLE, mode='iso_fixed'), 'INVALID_METHOD'), + ('method.configure', dict(METHOD_EXAMPLE, cool_to_k=PLANT_EXAMPLE['ambient_k'] + 2.0), 'COOL_TARGET_BELOW_AMBIENT'), + ('method.configure', dict(METHOD_EXAMPLE, search_min=2.0), 'INVALID_ARGUMENT'), + ('method.configure', dict(METHOD_EXAMPLE, wait_min=1.0), 'INVALID_ARGUMENT')] + for k, a, code in cases: + before = copy.deepcopy(h.read('debug')) + with self.assertRaises(ActionRejected) as e: + h.invoke(k, **a) + self.assertEqual(str(e.exception), code, k) + self.assertEqual(before, h.read('debug'), k) + call(h, 'lid.set', open=True); h.step(3.0) + for load, code in ((dict(template_id='nope'), 'UNKNOWN_TEMPLATE'), (dict(sample_cp_j_kg_k=None), 'SAMPLE_HEAT_CAPACITY_REQUIRED'), + (dict(template_id='dicumyl_peroxide'), 'HEAT_OF_DECOMPOSITION_REQUIRED'), (dict(gas_yield_mol_per_mol=None), 'GAS_YIELD_REQUIRED'), + (dict(sample_mass_kg=8e-3), 'CONTAINER_OVERFILLED'), (dict(accept_priors=False), 'ENGINEERING_ACCEPTANCE_REQUIRED'), + (dict(reactant_mass_fraction=1.0, solvent='none', heat_of_decomposition_j_kg=1e7, sample_cp_j_kg_k=500.0), 'ADIABATIC_RISE_OUT_OF_MODEL_RANGE')): + with self.assertRaises(ActionRejected) as e: + h.invoke('sample.load', **dict(LOAD_EXAMPLE, **load)) + self.assertEqual(str(e.exception), code) + with self.assertRaises(ActionRejected) as e: + h.invoke('plant.configure', **PLANT_EXAMPLE) + bad = NetzschMmc315Runtime() + for plant, code in ((dict(jacket_heater_max_w=400.0), 'TRACKING_RATE_NOT_REACHABLE'), (dict(jacket_heat_capacity_j_k=100.0), 'CONTROLLER_UNSTABLE'), + (dict(controller_gain_w_k=5000.0), 'CONTROLLER_UNSTABLE'), (dict(sample_tc_offset_k=0.06, jacket_tc_offset_k=-0.06), 'THERMOCOUPLE_MISMATCH')): + with self.assertRaises(ActionRejected) as e: + bad.invoke('plant.configure', **dict(PLANT_EXAMPLE, **plant)) + self.assertEqual(str(e.exception), code) + # a method configured before the plant is re-checked at start + late = NetzschMmc315Runtime() + late.invoke('method.configure', **dict(METHOD_EXAMPLE, cool_to_k=298.15)) + call(late, 'plant.configure', **PLANT_EXAMPLE) + call(late, 'power.set', enabled=True) + loaded(h=late) + with self.assertRaises(ActionRejected) as e: + late.invoke('test.start') + self.assertEqual(str(e.exception), 'COOL_TARGET_BELOW_AMBIENT') + + def test13_two_instances_isolated(self): + a, b = loaded(), configured() + call(a, 'test.start'); a.step(7200.0) + self.assertAlmostEqual(b.T_s, PLANT_EXAMPLE['ambient_k']) + self.assertIsNone(b.sample) + self.assertGreater(a.T_s, PLANT_EXAMPLE['ambient_k'] + 10) + + def test14_agent_truth_isolation_and_redaction(self): + h = loaded() + h.register_principal('agent', 'agent'); h.register_principal('eval', 'evaluator') + ag, ev = h.session('agent'), h.session('eval') + obs = ag.read(instance_id='mmc315_01')['observations'] + self.assertTrue(all(SLOTS[k]['visibility'] == 'agent' for k in obs)) + self.assertFalse(any(k.startswith('truth.') or k.endswith('_m') or k.endswith('_rad') for k in obs)) + with self.assertRaises(ActionRejected): + ag.read(instance_id='mmc315_01', state_ids=['truth.conversion']) + for k in ('ledger.read', 'provenance.read', 'sample.load', 'tray.move', 'sim.step', 'plant.configure'): + self.assertEqual(ag.invoke(instance_id='mmc315_01', capability_id=k, arguments=CAPS[k]['example_arguments'], request_id='r' + k)['error']['code'], 'ACCESS_DENIED') + r = ag.invoke(instance_id='mmc315_01', capability_id='test.start', arguments={}, request_id='s1') + h.step(20 * 3600.0) + res = ag.invoke(instance_id='mmc315_01', capability_id='test.result', arguments={}, request_id='q1')['result'] + self.assertNotIn(DTBP, json.dumps(res)) + self.assertIn('evaluator provenance.read', res['template_source']) + prov = ev.invoke(instance_id='mmc315_01', capability_id='provenance.read', arguments={}, request_id='p1')['result'] + self.assertIn(DTBP, prov['loaded_template']) + self.assertEqual(prov['operations'][0]['operation_id'], r['operation_id']) + d = ag.describe(instance_id='mmc315_01') + self.assertFalse(any(v['visibility'] != 'agent' for v in d['capabilities'].values())) + n = len(rt.LIMITATIONS) + d['capabilities']['test.result']['limitations'].append('mutated') + self.assertEqual(len(rt.LIMITATIONS), n) + + def test15_foreign_agent_guard(self): + h = loaded() + for p in ('a1', 'a2'): + h.register_principal(p, 'agent') + s1, s2 = h.session('a1'), h.session('a2') + s1.invoke(instance_id='mmc315_01', capability_id='test.start', arguments={}, request_id='x') + h.step(600.0) + for k, a in [('test.stop', {}), ('test.result', {}), ('method.configure', dict(METHOD_EXAMPLE)), ('power.set', {'enabled': False})]: + self.assertEqual(s2.invoke(instance_id='mmc315_01', capability_id=k, arguments=a, request_id='y' + k)['error']['code'], 'ACCESS_DENIED', k) + own = lambda s_: s_.read(instance_id='mmc315_01', state_ids=['test.started_by_other_agent'])['observations']['test.started_by_other_agent']['value'] # noqa: E731 + self.assertEqual((own(s1), own(s2)), (False, True)) + self.assertEqual(s1.invoke(instance_id='mmc315_01', capability_id='test.stop', arguments={}, request_id='z')['status'], 'succeeded') + + def test16_request_dedupe_poll_cancel(self): + h = loaded() + h.register_principal('agent', 'agent') + s = h.session('agent') + r1 = s.invoke(instance_id='mmc315_01', capability_id='method.configure', arguments=dict(METHOD_EXAMPLE), request_id='same') + self.assertEqual(r1, s.invoke(instance_id='mmc315_01', capability_id='method.configure', arguments=dict(METHOD_EXAMPLE), request_id='same')) + self.assertEqual(s.invoke(instance_id='mmc315_01', capability_id='method.configure', arguments=dict(METHOD_EXAMPLE, step_k=5.0), request_id='same')['error']['code'], + 'REQUEST_CONFLICT') + op = s.invoke(instance_id='mmc315_01', capability_id='test.start', arguments={}, request_id='s')['operation_id'] + h.step(3 * 3600.0) + self.assertEqual(s.poll(op)['status'], 'running') + n = len(h.test['points']) + c = s.cancel(op, 'c1') + self.assertEqual((c['status'], c['result']['phase']), ('succeeded', 'cancelled')) + self.assertEqual(s.cancel(op, 'c1'), c) + res = s.poll(op) + self.assertEqual(res['status'], 'cancelled') + self.assertEqual(len(res['result']['points']), n) + with self.assertRaises(ActionRejected) as e: + s.cancel(op, 'c2') + self.assertEqual(str(e.exception), 'NOT_RUNNING') + with self.assertRaises(ActionRejected) as e: + s.cancel(op, 'c2') # replay of the recorded rejection + self.assertEqual(str(e.exception), 'NOT_RUNNING') + self.assertEqual(s.invoke(instance_id='mmc315_01', capability_id='test.result', arguments={}, request_id='c2')['error']['code'], 'REQUEST_CONFLICT') + # a rejected request binds its request_id as well + rej = s.invoke(instance_id='mmc315_01', capability_id='test.stop', arguments={}, request_id='rej') + self.assertEqual(rej['error']['code'], 'NOT_RUNNING') + self.assertEqual(s.invoke(instance_id='mmc315_01', capability_id='test.stop', arguments={}, request_id='rej'), rej) + self.assertEqual(s.invoke(instance_id='mmc315_01', capability_id='method.configure', arguments=dict(METHOD_EXAMPLE), request_id='rej')['error']['code'], + 'REQUEST_CONFLICT') + with self.assertRaises(ActionRejected) as e: + s.poll('mmc315_01:test:99') + self.assertEqual(str(e.exception), 'UNKNOWN_OPERATION') + with self.assertRaises(ActionRejected): + s.write(instance_id='mmc315_01', state_id='test.step_target_k', value=400.0, request_id='w') + + def test17_unsupported_options_are_explicit(self): + h = configured() + for k in UNSUPPORTED: + with self.assertRaises(ActionRejected) as e: + h.invoke(k) + self.assertEqual(str(e.exception), 'UNSUPPORTED') + + +class Physics(unittest.TestCase): + def test20_dtbp_hws_reproduces_the_netzsch_example(self): + h = loaded(method=dict(end_temperature_k=503.15)) + res = run(h) + ref = templates()[DTBP]['arc_reference'] + self.assertEqual((res['phase'], res['validity']), ('succeeded', 'valid')) + e = res['exotherms'][0] + self.assertLess(abs(e['onset_temperature_k'] - 273.15 - ref['detection_temperature_C']), 3.0) + self.assertLess(abs(e['delta_t_observed_k'] / ref['delta_T_observed_K'] - 1), 0.03) + self.assertAlmostEqual(e['phi'], ref['thermal_inertia_phi'], delta=0.005) + self.assertLess(abs(e['delta_t_adiabatic_k'] / ref['delta_T_adiabatic_K'] - 1), 0.03) + self.assertLess(abs(e['specific_heat_of_reaction_j_kg_sample'] / 1e3 / ref['specific_heat_of_reaction_J_per_g_sample'] - 1), 0.03) + self.assertLess(abs((e['pressure_after_pa'] - e['pressure_before_pa']) / 1e5 - ref['pressure_step_bar']), 3.0) + tk = templates()[DTBP]['kinetics'] + self.assertLess(abs(e['kinetics']['activation_energy_j_mol'] / tk['Ea_J_mol'] - 1), 0.03) # Townsend-Tou recovers the template + self.assertLess(abs(e['kinetics']['log10_a_per_s'] - math.log10(tk['A_per_s'])), 0.4) + self.assertEqual((e['conditions'], e['kinetics']['quality']), ('adiabatic', 'ok')) + self.assertFalse(e['tracking_rate_exceeded']) + for x in (e['onset_temperature_k'], e['end_temperature_k'], e['max_temperature_k'], e['temperature_at_max_rate_k'], res['max_temperature_k']): + self.assertLess(abs(x / TEMPERATURE_READABILITY_K - round(x / TEMPERATURE_READABILITY_K)), 1e-6) # published values are readings + for x in (e['pressure_before_pa'], e['pressure_after_pa'], res['max_pressure_pa']): + self.assertLess(abs(x / PRESSURE_READABILITY_PA - round(x / PRESSURE_READABILITY_PA)), 1e-6) + self.assertLessEqual(e['temperature_at_max_rate_k'], e['max_temperature_k']) + self.assertEqual((res['exotherm_count'], res['exotherms_dropped']), (len(res['exotherms']), 0)) + PROCESS_EVIDENCE['dtbp_netzsch_example'] = dict(onset_C=e['onset_temperature_k'] - 273.15, dT=e['delta_t_observed_k'], dT_ad=e['delta_t_adiabatic_k'], + pressure_step_bar=(e['pressure_after_pa'] - e['pressure_before_pa']) / 1e5, + Ea_kJ_mol=e['kinetics']['activation_energy_j_mol'] / 1e3, lgA=e['kinetics']['log10_a_per_s']) + + def test21_detection_temperature_follows_the_threshold(self): + # dicumyl peroxide 30 % in toluene with an explicit host heat prior: detection within one HWS step above the analytic threshold temperature + tpl = templates()['dicumyl_peroxide'] + load = dict(template_id='dicumyl_peroxide', sample_mass_kg=4.0e-3, reactant_mass_fraction=0.30, heat_of_decomposition_j_kg=1.2e6, gas_yield_mol_per_mol=0.5) + h = loaded(load=load, method=dict(end_temperature_k=493.15, step_k=5.0)) + res = run(h) + s = h.sample + dT_obs = s['m_r'] * s['dH'] / s['C_s'] + T_thr = threshold_temperature(tpl, dT_obs, METHOD_EXAMPLE['threshold_k_min']) + on = res['exotherms'][0]['onset_temperature_k'] + self.assertTrue(T_thr - 2.0 <= on <= T_thr + 5.0 + 2.0, (on, T_thr)) + self.assertLess(abs(res['exotherms'][0]['delta_t_observed_k'] / dT_obs - 1), 0.05) + # a higher threshold detects later + h2 = loaded(load=load, method=dict(end_temperature_k=493.15, step_k=5.0, threshold_k_min=0.2)) + self.assertGreater(run(h2)['exotherms'][0]['onset_temperature_k'], on + 5.0) + + def test22_inert_sample_drift_stays_below_threshold(self): + h = loaded(load=dict(reactant_mass_fraction=0.0, gas_yield_mol_per_mol=None), method=dict(end_temperature_k=423.15)) + res = run(h) + self.assertEqual(res['validity'], 'no_exotherm_detected') + pts = res['points'] + late = [] # search points after the settling third of each search segment + for i, p in enumerate(pts): + if p['stage'] == 'search' and p['self_heat_rate_k_min'] is not None: + j = i + while j > 0 and pts[j - 1]['stage'] == 'search': + j -= 1 + if p['time_s'] - pts[j]['time_s'] >= METHOD_EXAMPLE['search_min'] * 60.0 / 3.0 + 120.0: + late.append(p['self_heat_rate_k_min']) + thr = METHOD_EXAMPLE['threshold_k_min'] + self.assertTrue(late and max(abs(r) for r in late) < thr, late[:20]) # displayed 2 min rate: noisy but below + drift = PLANT_EXAMPLE['sample_jacket_conductance_w_k'] * (PLANT_EXAMPLE['sample_tc_offset_k'] - PLANT_EXAMPLE['jacket_tc_offset_k']) / h.sample['C_s'] * 60.0 + self.assertLess(abs(sum(late) / len(late) - drift), 0.25 * thr) # mean = offset-mismatch drift + self.assertAlmostEqual(h.sample['alpha'], 0.0) + + def test23_tracking_rate_limit_is_flagged(self): + # 100 % DTBP (no solvent) in a light container: self-heating far above the documented 50 K/min tracking rate + load = dict(sample_mass_kg=1.0e-3, reactant_mass_fraction=1.0, solvent='none', container_mass_kg=4.0e-3, gas_yield_mol_per_mol=0.3) + h = loaded(load=load, plant=CALIBRATED, method=dict(end_temperature_k=673.15, max_rate_k_min=50.0, max_pressure_pa=MAX_PRESSURE_PA)) + res = run(h) + e = res['exotherms'][0] + self.assertTrue(e['tracking_rate_exceeded'] or res['terminal_reason'] in ('END_RATE_REACHED', 'PRESSURE_LIMIT_EXCEEDED', 'END_PRESSURE_REACHED')) + self.assertIn(res['validity'], ('end_rate_reached', 'end_pressure_reached', 'pressure_limit_exceeded', 'valid')) + + def test24_end_pressure_and_hard_limit(self): + load = dict(sample_mass_kg=5.0e-3, reactant_mass_fraction=0.30, gas_yield_mol_per_mol=2.0) + res = run(loaded(load=load, method=dict(end_temperature_k=503.15, max_pressure_pa=20e5))) + self.assertEqual((res['phase'], res['validity'], res['terminal_reason']), ('succeeded', 'end_pressure_reached', 'END_PRESSURE_REACHED')) + self.assertLess(res['max_pressure_pa'], 25e5) + for e in res['exotherms']: # truncated by the end pressure + if not e['complete']: + self.assertEqual(e['kinetics']['quality'], 'incomplete_exotherm') + h = loaded(load=dict(load, gas_yield_mol_per_mol=10.0), method=dict(end_temperature_k=503.15, max_pressure_pa=MAX_PRESSURE_PA)) + res = run(h) + self.assertIn(res['terminal_reason'], ('PRESSURE_LIMIT_EXCEEDED', 'END_PRESSURE_REACHED')) + + def test25_iso_modes_and_ramp(self): + iso = dict(mode='iso_fixed', iso_temperature_k=373.15, iso_hours=6.0, end_temperature_k=493.15) + res = run(loaded(method=iso)) + self.assertEqual(res['validity'], 'no_exotherm_detected') + self.assertTrue(any(abs(p['sample_k'] - 373.15) < 0.6 for p in res['points'] if p['stage'] == 'iso')) + track = dict(iso, mode='iso_track', iso_temperature_k=398.15, iso_hours=30.0) + res = run(loaded(method=track)) + self.assertEqual(res['validity'], 'valid') + self.assertEqual(res['exotherms'][0]['conditions'], 'adiabatic') + self.assertGreater(res['exotherms'][0]['delta_t_observed_k'], 60.0) + ramp = dict(mode='ramp', heat_rate_k_min=1.0, end_temperature_k=433.15) + res = run(loaded(load=dict(reactant_mass_fraction=0.0, gas_yield_mol_per_mol=None), method=ramp)) + self.assertEqual(res['validity'], 'no_exotherm_detected') + temps = [p['jacket_k'] for p in res['points'] if p['stage'] == 'ramp'] + slope_ = (temps[-1] - temps[10]) / ((len(temps) - 11) * METHOD_EXAMPLE['data_interval_s'] / 60.0) + self.assertLess(abs(slope_ - 1.0), 0.1) + + def test25b_iso_fixed_and_ramp_detect_self_heating(self): + # Iso-Fixed at 125 degC: DTBP self-heats above the 0.02 K/min threshold; the jacket holds, the event is non-adiabatic + res = run(loaded(method=dict(mode='iso_fixed', iso_temperature_k=398.15, iso_hours=30.0, end_temperature_k=493.15))) + self.assertEqual(res['validity'], 'valid') + e = res['exotherms'][0] + self.assertEqual((e['conditions'], e['delta_t_adiabatic_k'], e['heat_released_j'], e['kinetics']['quality']), ('isothermal_jacket', None, None, 'not_adiabatic')) + self.assertGreater(e['max_excess_over_jacket_k'], 0.3) + # a 2 K/min ramp: the runaway overtakes the jacket, the instrument changes to adiabatic mode and resumes the ramp afterwards + h = loaded(method=dict(mode='ramp', heat_rate_k_min=2.0, end_temperature_k=563.15)) + res = run(h) + e = res['exotherms'][0] + self.assertEqual(e['conditions'], 'adiabatic') + self.assertGreater(e['delta_t_observed_k'], 40.0) + self.assertGreater(h.sample['alpha'], 0.99) + stages = [p['stage'] for p in res['points']] + first = stages.index('exotherm') + self.assertIn('ramp', stages[stages.index('ramp', first) if 'ramp' in stages[first:] else len(stages):]) # ramp resumes after the event + self.assertEqual(res['terminal_reason'], 'RAMP_COMPLETE') + + def test26_conservation_and_unloading(self): + h = loaded() + res = run(h, limit_h=40.0) + L = call(h, 'ledger.read') + prov = call(h, 'provenance.read') + self.assertIn(DTBP, prov['loaded_template']) + self.assertEqual(len(prov['operations']), 1) + self.assertLess(abs(L['energy_residual_j']), 1e-9 * max(1.0, L['heater_energy_j'] + L['reaction_heat_j'])) + self.assertLess(abs(L['reactant_residual_mol']), 1e-12 * L['reactant_loaded_mol']) + self.assertLess(abs(L['gas_residual_mol']), 1e-12 * max(L['gas_generated_mol'], 1e-30)) + self.assertAlmostEqual(L['reaction_heat_j'], h.sample['n_r0'] * h.sample['alpha'] * h.sample['M_r'] * h.sample['dH'], delta=1e-6) + call(h, 'lid.set', open=True); h.step(3.0) + out = call(h, 'sample.unload') + self.assertAlmostEqual(out['vented_gas_mol'], L['gas_generated_mol'], delta=1e-12) + L2 = h.ledger() + self.assertLess(abs(L2['energy_residual_j']), 1e-9 * max(1.0, L2['heater_energy_j'])) + self.assertEqual(L2['gas_in_container_mol'], 0.0) + self.assertEqual(res['phase'], 'succeeded') + + def test27_interlocks_and_hot_unload(self): + h = loaded() + call(h, 'test.start') + for k, a, code in (('tray.move', dict(extend=True), 'TEST_ACTIVE'), ('lid.set', dict(open=True), 'TEST_ACTIVE'), ('sample.unload', {}, 'TEST_ACTIVE')): + with self.assertRaises(ActionRejected) as e: + h.invoke(k, **a) + self.assertEqual(str(e.exception), code) + h.step(3 * 3600.0) + call(h, 'test.stop') + call(h, 'lid.set', open=True); h.step(3.0) + self.assertGreater(h.T_s, UNLOAD_MAX_K) + with self.assertRaises(ActionRejected) as e: + h.invoke('sample.unload') + self.assertEqual(str(e.exception), 'SAMPLE_TOO_HOT') + while h.T_s > UNLOAD_MAX_K: + h.step(600.0) + call(h, 'sample.unload') + h2 = loaded() + call(h2, 'tray.move', extend=True); h2.step(0.5) + with self.assertRaises(ActionRejected) as e: + h2.invoke('test.start') + self.assertEqual(str(e.exception), 'TRAY_NOT_DOCKED') + h2.step(5.0); call(h2, 'tray.move', extend=False); h2.step(5.0) + self.assertTrue(h2.read('agent')['tray.docked']) + + def test28_power_off_cancels_and_step_splitting(self): + h = loaded() + call(h, 'test.start'); h.step(3600.0) + call(h, 'power.set', enabled=False) + self.assertEqual(call(h, 'test.result')['validity'], 'cancelled') + self.assertIsNone(h.read('agent')['sample.indicated_k']) + a, b = loaded(), loaded() + call(a, 'test.start'); call(b, 'test.start') + a.step(6 * 3600.0) + for _ in range(360): + b.step(60.0) + self.assertEqual(a.time_ns, b.time_ns) + self.assertEqual((a.T_s, a.T_j, a.test['stage'], len(a.test['points'])), (b.T_s, b.T_j, b.test['stage'], len(b.test['points']))) # same 1 s cycle grid + c = loaded() + call(c, 'test.start') + for _ in range(int(3600 / 0.7)): + c.step(0.7) # host steps off the cycle grid + a2 = loaded(); call(a2, 'test.start'); a2.step(c.time_s - a2.time_s) + self.assertLess(abs(a2.T_s - c.T_s), 1e-3) + + def test29_analysis_kinetics_pure_function(self): + tk = templates()[DTBP]['kinetics'] + T0, Tf = 383.0, 473.0 + temps, rates = [], [] + for i in range(1, 60): + T = T0 + (Tf - T0) * i / 60 + k = tk['A_per_s'] * math.exp(-tk['Ea_J_mol'] / (GAS_CONSTANT * T)) + temps.append(T); rates.append(k * (Tf - T) * 60.0) + out = call(configured(), 'analysis.kinetics', temperatures_k=temps, self_heat_rates_k_min=rates, onset_temperature_k=T0, final_temperature_k=Tf, phi=1.48, n=1.0) + self.assertAlmostEqual(out['activation_energy_j_mol'], tk['Ea_J_mol'], delta=1.0) + self.assertAlmostEqual(out['log10_a_per_s'], math.log10(tk['A_per_s']), delta=1e-4) + self.assertAlmostEqual(out['delta_t_adiabatic_k'], 1.48 * 90.0) + with self.assertRaises(ActionRejected): + configured().invoke('analysis.kinetics', temperatures_k=temps, self_heat_rates_k_min=rates[:-1], onset_temperature_k=T0, final_temperature_k=Tf, phi=1.48, n=1.0) + + def test30_panel_readings_carry_measurement_noise(self): + h = loaded() + call(h, 'test.start') + diffs = [] + for _ in range(200): + h.step(15.0) + a = h.read('agent') + self.assertEqual(a, h.read('agent')) + diffs.append(a['sample.indicated_k'] - h.T_s) + mean = sum(diffs) / len(diffs) + sd = math.sqrt(sum((d - mean) ** 2 for d in diffs) / len(diffs)) + self.assertGreater(sd, 0.002) # noisy, not the quantised truth + self.assertLess(abs(mean - PLANT_EXAMPLE['sample_tc_offset_k']), 0.005) + self.assertLess(max(abs(d) for d in diffs), 0.05) + + def test31_metadata_exports_every_capability_and_slot(self): + meta = export_netzsch_mmc315_contract_metadata() + self.assertEqual(set(meta['capabilities']), set(CAPS)) + self.assertEqual(set(meta['state_slots']), set(SLOTS)) + slots = meta['state_slots'] + pre = {json.dumps(c['preconditions'], ensure_ascii=False, sort_keys=True) for c in meta['capabilities'].values() if c['preconditions']} + self.assertGreater(len(pre), 7) + for k, c in meta['capabilities'].items(): + validate(c['input_schema'], c['example_arguments']) + for e in c['errors']: + self.assertNotEqual(e['meaning_zh'], e['code'], k) + for sid in c['observes'] + [x for p in c['preconditions'] for x in p['state_ids']]: + self.assertIn(sid, slots, k) + if c['visibility'] == 'agent': + self.assertTrue(all(slots[sid]['visibility'] == 'agent' for sid in c['observes']), k) + self.assertTrue(c['source_ids'], k) + for k, s in slots.items(): + if s['origin'] == 'process_truth': + self.assertIn(s['visibility'], ('evaluator', 'debug')) + params = meta['mechanisms']['arc_calorimetry']['parameters'] + for k in ('iso_temperature_k', 'sample_cp_j_kg_k', 'heat_of_decomposition_j_kg', 'gas_yield_mol_per_mol'): + self.assertIn(k, params) + for k in ('sample_cp_j_kg_k', 'container_cp_j_kg_k', 'gas_yield_mol_per_mol'): + self.assertIn('反推', params[k]['meaning_zh'], k) + self.assertIn('TEST_ACTIVE', [e['code'] for e in meta['capabilities']['sample.unload']['errors']]) + self.assertIn('plant.configured', meta['capabilities']['sample.load']['preconditions'][0]['state_ids']) + for k in ('test.stop', 'power.set'): + self.assertIn('test.exotherm_count', CAPS[k]['effects']) + + def test32_end_rate_ignores_programmed_heating(self): + inert = dict(reactant_mass_fraction=0.0, gas_yield_mol_per_mol=None) + res = run(loaded(load=inert, method=dict(end_temperature_k=373.15, heat_rate_k_min=2.0, max_rate_k_min=1.0))) + self.assertNotEqual(res['terminal_reason'], 'END_RATE_REACHED') + res = run(loaded(load=inert, method=dict(mode='ramp', heat_rate_k_min=5.0, max_rate_k_min=5.0, end_temperature_k=423.15))) + self.assertIn(res['terminal_reason'], ('END_TEMPERATURE_REACHED', 'RAMP_COMPLETE')) + self.assertEqual(res['validity'], 'no_exotherm_detected') + + def test33_shortest_search_window_still_detects(self): + res = run(loaded(method=dict(search_min=5.0, wait_min=15.0, end_temperature_k=503.15))) + ref = templates()[DTBP]['arc_reference'] + e = res['exotherms'][0] + self.assertLess(abs(e['onset_temperature_k'] - 273.15 - ref['detection_temperature_C']), 3.0) + self.assertGreater(e['delta_t_observed_k'], 80.0) + + def test34_controller_stable_and_host_step_independent(self): + plant = dict(jacket_heat_capacity_j_k=400.0, controller_gain_w_k=200.0) # loop gain exactly at the 0.5 bound + inert = dict(reactant_mass_fraction=0.0, gas_yield_mol_per_mol=None) + runs = [] + for dt in (60.0, 1.0): + h = loaded(load=inert, plant=plant, method=dict(end_temperature_k=373.15)) + runs.append((run(h, dt=dt), h)) + for res, h in runs: + self.assertEqual(res['validity'], 'no_exotherm_detected') + self.assertEqual(runs[0][0], runs[1][0]) # identical record: 1 s cycle, not host steps + + def test35_pressure_continuous_across_tc_and_readings_saturate(self): + h = loaded(load=dict(reactant_mass_fraction=0.0, gas_yield_mol_per_mol=None)) + Tc = LIB['solvents']['toluene']['critical_temperature_K'] + lo, hi = h._pressure_true(Tc - 1e-4), h._pressure_true(Tc + 1e-4) + self.assertLess(abs(hi / lo - 1), 1e-5) + self.assertEqual(h._ind_p(400e5), 150e5) + self.assertEqual(h._ind_T(2000.0), TC_RANGE_MAX_K) + + def test36_overtemperature_cut_off(self): + load = dict(sample_mass_kg=3.0e-3, reactant_mass_fraction=1.0, solvent='none', liquid_density_kg_m3=796.0, sample_cp_j_kg_k=2000.0, + heat_of_decomposition_j_kg=2.5e6, gas_yield_mol_per_mol=0.1) + res = run(loaded(load=load, plant=CALIBRATED, method=dict(end_temperature_k=673.15, max_rate_k_min=50.0, max_pressure_pa=MAX_PRESSURE_PA))) + self.assertIn(res['terminal_reason'], ('TEMPERATURE_LIMIT_EXCEEDED', 'END_RATE_REACHED', 'END_TEMPERATURE_REACHED')) + h = loaded(load=load, plant=CALIBRATED, method=dict(end_temperature_k=673.15, max_rate_k_min=50.0, max_pressure_pa=MAX_PRESSURE_PA)) + call(h, 'test.start'); h.step(2.0) + h.T_s = OVERTEMPERATURE_K + 1.0 # white-box: force the cut-off path + h.step(2.0) + r = call(h, 'test.result') + self.assertEqual((r['phase'], r['validity'], r['terminal_reason']), ('failed', 'temperature_limit_exceeded', 'TEMPERATURE_LIMIT_EXCEEDED')) + + def test37_exotherm_overflow_is_counted(self): + h = loaded() + call(h, 'test.start'); h.step(5.0) + for _ in range(MAX_EXOTHERMS + 3): # white-box: open/close more events than recorded + h._open_exotherm(h._meas_Ts(), h._meas_p(), 'adiabatic'); h._close_exotherm(complete=True) + h.test['stage'] = 'heat' + r = call(h, 'test.result') + self.assertEqual((len(r['exotherms']), r['exotherm_count'], r['exotherms_dropped']), (MAX_EXOTHERMS, MAX_EXOTHERMS + 3, 3)) + self.assertEqual(h.read('agent')['test.exotherm_count'], MAX_EXOTHERMS + 3) + + def test38_long_hws_reduces_data_instead_of_failing(self): + inert = dict(reactant_mass_fraction=0.0, gas_yield_mol_per_mol=None, solvent='none') # non-volatile inert: no solvent pressure at 500 degC + res = run(loaded(load=inert, method=dict(start_temperature_k=323.15, end_temperature_k=773.15, data_interval_s=5.0)), limit_h=80.0) + self.assertEqual((res['phase'], res['validity']), ('succeeded', 'no_exotherm_detected')) + self.assertLessEqual(len(res['points']), MAX_POINTS) + self.assertGreater(res['data_interval_s'], 5.0) + + def test39_tracking_follows_at_most_50_k_per_min(self): + load = dict(sample_mass_kg=1.0e-3, reactant_mass_fraction=1.0, solvent='none', container_mass_kg=4.0e-3, gas_yield_mol_per_mol=0.3) + h = loaded(load=load, plant=dict(CALIBRATED, jacket_heater_max_w=5000.0), method=dict(end_temperature_k=673.15, max_rate_k_min=50.0, max_pressure_pa=MAX_PRESSURE_PA)) + call(h, 'test.start') + hist, fastest = [], 0.0 + while h._test_active() and h.time_s < 40 * 3600: + h.step(5.0) + hist.append((h.time_s, h.T_j)) + if len(hist) > 6: + t0, T0 = hist[-7] + fastest = max(fastest, (h.T_j - T0) / (h.time_s - t0) * 60.0) + self.assertLess(fastest, 50.0 * 1.05) + self.assertGreater(fastest, 20.0) + + def test40_iso_track_detection_not_early(self): + tpl = templates()[DTBP] + quiet = dict(tc_noise_k=0.0, pressure_noise_pa=0.0, sample_tc_offset_k=0.0, jacket_tc_offset_k=0.0) + # quiet plant: conversion during the slow approach (~8 %) and one search window put detection ~1 K above the zero-conversion threshold; + # default plant: the thermocouple offset mismatch heats the sample by ~0.003 K/min and detects ~1 K earlier + for plant, lo, hi in ((quiet, 0.1, 1.5), (None, 1.5, 3.0)): + h = loaded(plant=plant, method=dict(mode='iso_track', iso_temperature_k=373.15, iso_hours=40.0, end_temperature_k=493.15)) + res = run(h) + s = h.sample + T_thr = threshold_temperature(tpl, s['m_r'] * s['dH'] / s['C_s'], METHOD_EXAMPLE['threshold_k_min']) + on = res['exotherms'][0]['onset_temperature_k'] + self.assertTrue(T_thr - lo <= on <= T_thr + hi, (plant, on, T_thr)) + + def test41_jacket_mode_programme_and_sealed_air(self): + h = loaded() + p0 = h.read('agent')['pressure.indicated_pa'] + self.assertLess(abs(p0 - PLANT_EXAMPLE['ambient_pressure_pa'] - PLANT_EXAMPLE['pressure_offset_pa']), 3 * PLANT_EXAMPLE['pressure_noise_pa'] + 1000.0) + call(h, 'test.start') + seen = {} + while h._test_active() and h.time_s < 12 * 3600: + h.step(30.0) + a = h.read('agent') + seen.setdefault(a['test.stage'], set()).add((a['jacket.mode'], a['test.step_target_k'] is None)) + self.assertEqual(seen['search'], {('adiabatic_tracking', False)}) + self.assertEqual(seen['wait'], {('isothermal_hold', False)}) + self.assertTrue(seen['exotherm'] <= {('adiabatic_tracking', True)}) + + def test43_iso_time_enforced_during_events(self): + h = loaded(method=dict(mode='iso_fixed', iso_temperature_k=398.15, iso_hours=2.0, end_temperature_k=493.15)) + call(h, 'test.start') + start = h.time_s + while h._test_active() and h.time_s - start < 40 * 3600: + h.step(60.0) + if h.test['stage'] == 'cool': + break + self.assertEqual(h.test['end_reason'], 'ISO_TIME_ELAPSED') + self.assertLess(h.time_s - start, 2.0 * 3600 + 120.0) + r = call(h, 'test.result') + self.assertTrue(r['exotherms'] and r['exotherms'][0]['conditions'] == 'isothermal_jacket') + + def test44_iso_approach_detects_runaways(self): + # at 150 degC DTBP runs away while the jacket is still approaching / settling at the iso temperature + res = run(loaded(method=dict(mode='iso_track', iso_temperature_k=423.15, iso_hours=6.0, end_temperature_k=563.15))) + e = res['exotherms'][0] + self.assertEqual(e['conditions'], 'adiabatic') + self.assertGreater(e['delta_t_observed_k'], 40.0) + h = loaded(method=dict(mode='iso_fixed', iso_temperature_k=423.15, iso_hours=6.0, end_temperature_k=563.15)) + res = run(h) + e = res['exotherms'][0] + self.assertEqual(e['conditions'], 'isothermal_jacket') + self.assertGreater(e['max_excess_over_jacket_k'], 5.0) # the peak, not only the tail + self.assertGreater(e['delta_t_observed_k'], 0.5) + + def test45_hws_heat_step_runaway_is_recorded(self): + load = dict(sample_mass_kg=1.0e-3, reactant_mass_fraction=1.0, solvent='none', container_mass_kg=4.0e-3, gas_yield_mol_per_mol=0.3) + res = run(loaded(load=load, plant=CALIBRATED, method=dict(start_temperature_k=433.15, end_temperature_k=673.15, max_rate_k_min=50.0, max_pressure_pa=MAX_PRESSURE_PA))) + self.assertTrue(res['exotherms'], res['terminal_reason']) + self.assertEqual(res['exotherms'][0]['conditions'], 'adiabatic') + self.assertLess(res['exotherms'][0]['onset_temperature_k'], 433.15) # detected during the first heat step + + def test46_lab_ambient_and_owner_flag_per_role(self): + h = loaded() + h.register_principal('a1', 'agent'); h.register_principal('ev', 'evaluator') + a1, ev = h.session('a1'), h.session('ev') + val = lambda s_, k: s_.read(instance_id='mmc315_01', state_ids=[k])['observations'][k]['value'] # noqa: E731 + self.assertEqual(val(a1, 'lab.ambient_k'), PLANT_EXAMPLE['ambient_k']) + self.assertIsNone(NetzschMmc315Runtime().read('agent')['lab.ambient_k']) + a1.invoke(instance_id='mmc315_01', capability_id='test.start', arguments={}, request_id='go') + h.step(60.0) + self.assertEqual((val(a1, 'test.started_by_other_agent'), val(ev, 'test.started_by_other_agent')), (False, False)) + self.assertEqual(ev.invoke(instance_id='mmc315_01', capability_id='test.stop', arguments={}, request_id='st')['status'], 'succeeded') + + def test47_noise_bound_and_no_false_events(self): + with self.assertRaises(ActionRejected) as e: + NetzschMmc315Runtime().invoke('plant.configure', **dict(PLANT_EXAMPLE, tc_noise_k=0.03)) + self.assertEqual(str(e.exception), 'INVALID_ARGUMENT') + inert = dict(reactant_mass_fraction=0.0, gas_yield_mol_per_mol=None) + for seed in (1, 2, 3): + plant = dict(tc_noise_k=TC_NOISE_MAX_K, noise_seed=seed, sample_tc_offset_k=0.01, jacket_tc_offset_k=-0.01) # noise and pair at their bounds + for method in (dict(end_temperature_k=383.15), dict(mode='iso_fixed', iso_temperature_k=398.15, iso_hours=3.0, end_temperature_k=493.15)): + h = loaded(load=inert, plant=plant, method=method) + lim = h.read('agent')['test.detection_limit_k_min'] + call(h, 'method.configure', **dict(METHOD_EXAMPLE, **method, threshold_k_min=1.05 * lim)) # the noisiest accepted plant + res = run(h, limit_h=20.0) + self.assertEqual((res['phase'], res['validity']), ('succeeded', 'no_exotherm_detected'), (seed, method)) + + def test48_detection_limit_uses_plant_sample_and_search(self): + strong = dict(sample_jacket_conductance_w_k=2.0, jacket_heater_max_w=5000.0) + for pair in (dict(sample_tc_offset_k=0.01, jacket_tc_offset_k=-0.01), dict(sample_tc_offset_k=0.0, jacket_tc_offset_k=0.0)): + h = loaded(plant=dict(strong, **pair)) # G_sj/C_s amplifies drift and injected noise + self.assertGreater(h.read('agent')['test.detection_limit_k_min'], METHOD_EXAMPLE['threshold_k_min']) + with self.assertRaises(ActionRejected) as e: + h.invoke('test.start') + self.assertEqual(str(e.exception), 'THRESHOLD_BELOW_DETECTION_LIMIT') + h = loaded() + lim = h.read('agent')['test.detection_limit_k_min'] + self.assertAlmostEqual(lim, detection_limit_k_min(PLANT_EXAMPLE, h.sample['C_s'], METHOD_EXAMPLE['search_min']), places=12) + self.assertLess(lim, METHOD_EXAMPLE['threshold_k_min']) # the NETZSCH example is usable + for f, ok in ((0.999, False), (1.001, True)): # the slot is exactly the refusal boundary + call(h, 'method.configure', **dict(METHOD_EXAMPLE, threshold_k_min=f * lim)) + if ok: + call(h, 'test.start'); self.assertTrue(h._test_active()) + else: + with self.assertRaises(ActionRejected) as e: + h.invoke('test.start') + self.assertEqual(str(e.exception), 'THRESHOLD_BELOW_DETECTION_LIMIT') + + def test51_slope_standard_error_matches_tracking_data(self): + # stationary adiabatic storage of an inert sample: the spread of 180 s regression slopes follows the analytic standard error + import statistics + plant = dict(tc_noise_k=0.003, sample_jacket_conductance_w_k=2.0, jacket_heater_max_w=5000.0, sample_tc_offset_k=0.0, jacket_tc_offset_k=0.0) + h = loaded(load=dict(reactant_mass_fraction=0.0, gas_yield_mol_per_mol=None), plant=plant, + method=dict(mode='iso_track', iso_temperature_k=348.15, iso_hours=30.0, end_temperature_k=493.15, threshold_k_min=1.0, search_min=240.0)) + call(h, 'test.start'); h.step(2 * 3600) + t0, buf = h.time_s, [] + for _ in range(4 * 60): + h.step(60.0) + buf.extend(q for q in h.rate_buf if q[0] > (buf[-1][0] if buf else t0)) + sl = [slope(buf[i:i + 180]) for i in range(0, len(buf) - 180, 180)] + sd = statistics.pstdev(sl) + analytic = slope_standard_error(0.003, 2.0, h.sample['C_s'], 180.0) / INJECTION_FACTOR * 1.0 + pure = math.sqrt(24 * 0.003 ** 2 * TC_NOISE_TAU_S / 180.0 ** 3 + 0.01 ** 2 / 180.0 ** 3 + (2.0 / h.sample['C_s'] * 2 * 0.003 * math.sqrt(TC_NOISE_TAU_S / 180.0)) ** 2) + self.assertTrue(0.7 * pure < sd < 1.3 * pure, (sd, pure, analytic)) + self.assertGreater(slope_standard_error(0.003, 2.0, h.sample['C_s'], 180.0), sd) # the limit uses a larger (safe) value + + def test50_iso_fixed_event_ends_with_a_pair_at_the_bound(self): + plant = dict(tc_noise_k=TC_NOISE_MAX_K, sample_tc_offset_k=0.01, jacket_tc_offset_k=-0.01) + # at 150 degC DTBP is consumed within a few hours (at 125 degC the tail lasts > 20 h, so an event there rightly stays open) + h = loaded(plant=plant, method=dict(mode='iso_fixed', iso_temperature_k=423.15, iso_hours=12.0, end_temperature_k=563.15, threshold_k_min=0.1)) + res = run(h) + e = res['exotherms'][0] + self.assertTrue(e['complete']) # ends on its own, well before the 12 h + self.assertGreater(h.sample['alpha'], 0.999) + self.assertEqual(res['terminal_reason'], 'ISO_TIME_ELAPSED') + + def test49_iso_track_runaway_past_the_ageing_time_completes(self): + h = loaded(method=dict(mode='iso_track', iso_temperature_k=398.15, iso_hours=1.0, end_temperature_k=493.15)) + res = run(h) + e = res['exotherms'][0] + self.assertTrue(e['complete']) + self.assertEqual((e['conditions'], e['kinetics']['quality']), ('adiabatic', 'ok')) + self.assertGreater(e['delta_t_observed_k'], 60.0) + self.assertEqual(res['terminal_reason'], 'ISO_TIME_ELAPSED') + + def test42_weak_exotherm_fit_is_flagged(self): + load = dict(reactant_mass_fraction=0.004) + res = run(loaded(load=load, method=dict(end_temperature_k=503.15))) + qualities = {e['kinetics']['quality'] for e in res['exotherms']} + self.assertTrue(not res['exotherms'] or qualities - {'ok'} or all(40e3 <= e['kinetics']['activation_energy_j_mol'] <= 400e3 for e in res['exotherms'])) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_asset_newera_ne1000.py b/tests/test_asset_newera_ne1000.py new file mode 100644 index 0000000000000000000000000000000000000000..801cdb956f9cb823f7097f7e59e6980113077c15 --- /dev/null +++ b/tests/test_asset_newera_ne1000.py @@ -0,0 +1,1295 @@ +"""tests for CHEM-184 newera_ne1000 (New Era NE-1000 single-syringe programmable pump): python3 -m unittest tests/test_asset_newera_ne1000.py + +Themes: contract consistency (slots, effects, errors raised vs declared); agent / evaluator truth isolation; idempotent request ids; two instances +isolated; step-partition independence; rejected calls leave the state unchanged; every output validated against its schema and every success +changes only declared slots; speed limits (5.1005 cm/min, 0.004205 cm/hr) against the manual's syringe table; dispensed volume by the set +diameter vs true delivery by the true diameter; compliance start-up lag and tail flow with an air bubble; occlusion, collar and bottom-out stall +(StAL, paused, any key clears); withdrawal from a reservoir, air intake and cavitation; 41-phase programs (RAT, PAS, LPS/LOP, FIL, INC/DEC, JMP, +EVN, OUT, CLD, STP); TTL inputs held >= 100 ms; keypad editing with the 2 s commit, oor, ----, LoC-; RS-232 Basic protocol; power-on clearing and +power-failure restart; purge at top speed; idle skipping exact; liquid ledger closes.""" +import json +import math +import re +import sys +import unittest +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / 'scripts')) +from asset_runtime import newera_ne1000 as rt # noqa: E402 + +INST = 'newera_ne1000_01' +CHECKS = [] +SEEN_CAPS = set() +PROCESS_EVIDENCE = {} +MH = 1e-6 / 3600.0 +UH = 1e-9 / 3600.0 +ML = 1e-6 + + +def _differ(x, y): + if isinstance(x, float) and isinstance(y, float): + return abs(x - y) > 1e-12 * max(1.0, abs(x), abs(y)) + return json.dumps(x, sort_keys=True, default=str) != json.dumps(y, sort_keys=True, default=str) + + +class Rig: + def __init__(self, seed=1, instance=INST, **plant): + self.h = rt.NeweraNe1000Runtime(instance) + self.h.register_principal('agent', 'agent') + self.h.register_principal('eval', 'evaluator') + self.A = self.h.session('agent') + self.E = self.h.session('eval') + self.n = 0 + self.inst = instance + self.call(self.E, 'plant.configure', **dict(rt.PLANT_EXAMPLE, noise_seed=seed, **plant)) + + def call(self, sess, cap, expect='succeeded', **args): + self.n += 1 + before, t0 = self.h.read('evaluator'), self.h.t + r = sess.invoke(instance_id=self.inst, capability_id=cap, arguments=args, request_id=f'r{self.n}') + after = self.h.read('evaluator') + changed = {k for k in after if _differ(after[k], before[k])} - {'clock.time_s'} + if expect == 'succeeded': + assert r['status'] == 'succeeded', (cap, r['error']) + rt.validate(rt.CAPS[cap]['output_schema'], r['result']) + allowed = set(rt.EFFECTS.get(cap, [])) | (set(rt.ON_STEP['sim.step']) if cap == 'sim.step' else set()) + extra = changed - allowed + assert not extra, (cap, sorted(extra)) + if cap != 'sim.step': + assert self.h.t == t0, cap + SEEN_CAPS.add(cap) + PROCESS_EVIDENCE.setdefault(cap, []).append(dict(arguments=json.dumps(args, sort_keys=True, default=str)[:200], time_s=t0, status=r['status'])) + return r['result'] + assert r['status'] in ('rejected', 'unsupported'), (cap, r['status'], r.get('result')) + assert r['error']['code'] == expect, (cap, r['error']['code'], expect) + assert not changed, (cap, 'rejected call changed', sorted(changed)) + assert expect in [e['code'] for e in rt.export_newera_ne1000_contract_metadata()['capabilities'][cap]['errors']], (cap, expect) + return r + + def step(self, s): + self.call(self.E, 'sim.step', dt_s=float(s)) + + def read(self, *ids, who=None): + sess = who or self.E + o = sess.read(instance_id=self.inst, state_ids=list(ids) if ids else None)['observations'] + return {k: v['value'] for k, v in o.items()} if not ids or len(ids) > 1 else o[ids[0]]['value'] + + def truth(self): + return self.read('truth.process') + + def on(self): + self.call(self.A, 'power.set', on=True) + + def setup(self, syringe='bd_60ml', fill=50 * ML, air=0.0, liquid='water', tubing='ptfe_0p8mm', length=0.5, needle='none', back=0.0, reservoir=0.0, power=True): + if power: + self.on() + self.call(self.A, 'syringe.load', syringe=syringe, liquid_id=liquid, fill_volume_m3=fill, air_volume_m3=air) + self.call(self.A, 'outlet.connect', tubing=tubing, tubing_length_m=length, needle=needle, backpressure_pa=back, reservoir_liquid_m3=reservoir) + if power: + self.call(self.A, 'syringe.set_diameter', diameter_m=rt.SYR[syringe]['inside_diameter_m']) + + def key(self, k): + return self.call(self.A, 'keypad.press', key=k)['display'] + + def serial(self, cmd): + return self.call(self.A, 'serial.send', command=cmd)['response'] + + def ledger(self): + return self.call(self.E, 'ledger.read')['ledger'] + + def events(self, who=None): + return [e['code'] for e in self.call(who or self.E, 'events.read', since_s=0.0)['events']] + + +def _balance(test, L): + test.assertLess(abs(L['liquid_balance_m3']), 1e-15 + 1e-12 * L['placed_m3'], L) + test.assertLess(abs(L['geometric_balance_m3']), 1e-15 + 1e-12 * L['placed_m3'], L) # barrel volume behind the plunger = liquid + air - compression + + +def _raised_codes(): + src = Path(rt.__file__).read_text() + funcs = {} + for m in re.finditer(r'\n def (\w+)\(self[^\n]*\n(.*?)(?=\n def |\n# ----|\nclass |\ndef )', src, re.S): + funcs[m.group(1)] = m.group(2) + own = {k: set(re.findall(r"ActionRejected\('([A-Z_]+)'\)", v)) for k, v in funcs.items()} + calls = {k: set(re.findall(r'self\.(_\w+)\(', v)) & set(funcs) for k, v in funcs.items()} + out = {} + for k in funcs: + if not k.startswith('_cmd_'): + continue + seen, todo, codes = set(), [k], set() + while todo: + f = todo.pop() + if f in seen: + continue + seen.add(f) + codes |= own.get(f, set()) + todo += [g for g in calls.get(f, ()) if g not in ('_cmd_sim_step', 'step', '_tick')] + out[k] = codes + name = {'_cmd_' + c.replace('.', '_'): c for c in rt.CAPS} + swallowed = {'keypad.press': {'ALARM_ACTIVE', 'NOT_APPLICABLE', 'OUT_OF_RANGE', 'DIAMETER_NOT_SET', 'PROGRAM_OPERATING', 'UNITS_WHILE_PUMPING', 'ALREADY_RUNNING'}, + 'serial.send': {'ALARM_ACTIVE', 'NOT_APPLICABLE', 'OUT_OF_RANGE', 'DIAMETER_NOT_SET', 'PROGRAM_OPERATING', 'UNITS_WHILE_PUMPING', 'ALREADY_RUNNING', + 'UNKNOWN_COMMAND'}, + 'power.set': {'DIAMETER_NOT_SET'}, 'power.toggle': {'DIAMETER_NOT_SET'}, 'fault.inject': {'DIAMETER_NOT_SET'}} + # keypad and RS-232 errors become display messages / '?' replies; the power-failure restart is guarded by `if self.diameter` + return {name[k]: v - swallowed.get(name[k], set()) for k, v in out.items() if k in name} + + +class Contract(unittest.TestCase): + def test_metadata_slots_effects_consistent(self): + m = rt.export_newera_ne1000_contract_metadata() + for k, c in m['capabilities'].items(): + for e in c['state_effects']: + self.assertIn(e['state_id'], m['state_slots'], (k, e)) + for p in c['preconditions']: + for s in p['state_ids']: + self.assertIn(s, m['state_slots'], (k, s)) + for s in rt.SCENE_MIRRORED: + self.assertIn(s, rt.SLOTS) + self.assertEqual(rt.SLOTS[s]['visibility'], 'agent') + units = {p['unit'] for p in m['mechanisms']['syringe_pump_process']['parameters'].values()} + self.assertFalse(units & {'in', 'cm/min', 'lbf'}, units) + CHECKS.append(dict(id='metadata_consistent')) + + def test_declared_errors_cover_raised_codes(self): + m = rt.export_newera_ne1000_contract_metadata() + for cap, codes in _raised_codes().items(): + declared = {e['code'] for e in m['capabilities'][cap]['errors']} + self.assertFalse(codes - declared, (cap, codes - declared)) + + def test_unsupported_capabilities(self): + g = Rig() + for k in rt.UNSUPPORTED: + r = g.A.invoke(instance_id=INST, capability_id=k, arguments={}, request_id='u' + k) + self.assertEqual((r['status'], r['error']['code']), ('unsupported', 'UNSUPPORTED')) + + def test_agent_truth_isolation(self): + g = Rig() + obs = g.A.read(instance_id=INST)['observations'] + self.assertFalse([k for k in obs if k.startswith('truth.')]) + for cap, args in (('truth.inspect', {}), ('ledger.read', {}), ('fault.inject', dict(fault='occlusion', active=True)), ('sim.step', dict(dt_s=1.0)), + ('plant.configure', dict(rt.PLANT_EXAMPLE)), ('medium.configure', dict(syringe_id_error=0.01))): + r = g.A.invoke(instance_id=INST, capability_id=cap, arguments=args, request_id='x' + cap) + self.assertEqual(r['error']['code'], 'ACCESS_DENIED') + d = g.A.describe(instance_id=INST) + self.assertNotIn('truth.inspect', d['capabilities']) + self.assertNotIn('truth.process', d['state_slots']) + g.setup(fill=20 * ML, reservoir=0.0) + g.call(g.A, 'direction.set', direction='WDR') + g.call(g.A, 'rate.set', rate_m3_s=500 * MH, units='MH') + g.call(g.A, 'pump.run') + g.step(20.0) # draws air from an empty outlet: truth event only + self.assertIn('AIR_DRAWN', g.events()) + self.assertNotIn('AIR_DRAWN', g.events(g.A)) + + def test_idempotent_request_ids(self): + g = Rig() + r1 = g.A.invoke(instance_id=INST, capability_id='power.toggle', arguments={}, request_id='same') + r2 = g.A.invoke(instance_id=INST, capability_id='power.toggle', arguments={}, request_id='same') + self.assertEqual(r1, r2) + self.assertTrue(g.read('power.on')) + r3 = g.A.invoke(instance_id=INST, capability_id='power.set', arguments=dict(on=False), request_id='same') + self.assertEqual(r3['error']['code'], 'REQUEST_CONFLICT') + + def test_two_instances_isolated(self): + a, b = Rig(instance='a'), Rig(instance='b') + a.setup() + a.call(a.A, 'rate.set', rate_m3_s=100 * MH, units='MH') + a.call(a.A, 'pump.run') + a.step(30.0) + self.assertGreater(a.read('pusher.position_m'), 0.0) + self.assertFalse(b.read('power.on')) + self.assertEqual(b.read('pusher.position_m'), 0.0) + self.assertIsNone(b.read('syringe.state')) + + def test_step_partition_independence(self): + def run(parts): + g = Rig(seed=7) + g.setup(fill=30 * ML, air=0.5 * ML, needle='27g', back=2.0e4, reservoir=50 * ML) + g.call(g.A, 'phase.set_function', function='RAT', rate_m3_s=300 * MH, rate_units='MH', volume_m3=2 * ML, direction='INF') + g.call(g.A, 'phase.select', phase=2) + g.call(g.A, 'phase.set_function', function='PAS', parameter=7) + g.call(g.A, 'phase.select', phase=3) + g.call(g.A, 'phase.set_function', function='RAT', rate_m3_s=600 * MH, rate_units='MH', volume_m3=1 * ML, direction='WDR') + g.call(g.A, 'phase.select', phase=4) + g.call(g.A, 'phase.set_function', function='STP') + g.call(g.A, 'pump.run') + for dt in parts: + g.step(dt) + r = g.h.read('evaluator') + return json.dumps({k: r[k] for k in r if k != 'clock.time_s'}, sort_keys=True, default=float), g.ledger() + a, la = run([60.0]) + b, lb = run([0.05] * 1200) + c, lc = run([7.33] * 8 + [1.36]) + self.assertEqual(a, b) + self.assertEqual(a, c) + self.assertEqual(json.dumps(la, sort_keys=True), json.dumps(lb, sort_keys=True)) + + def test_rejections_change_nothing(self): + g = Rig() + g.call(g.A, 'rate.set', expect='POWER_OFF', rate_m3_s=10 * MH) + g.call(g.A, 'syringe.unload', expect='NO_SYRINGE') + g.call(g.A, 'syringe.load', expect='OVERFILL', syringe='bd_10ml', liquid_id='water', fill_volume_m3=11 * ML) + g.call(g.A, 'syringe.load', expect='SYRINGE_TOO_LONG', syringe='monoject_140ml', liquid_id='water', fill_volume_m3=140 * ML) + g.call(g.A, 'ttl.set', expect='NOT_AN_INPUT', pin=5, level=0) + g.on() + g.call(g.A, 'rate.set', expect='DIAMETER_NOT_SET', rate_m3_s=10 * MH) + g.call(g.A, 'pump.run', expect='DIAMETER_NOT_SET') + g.call(g.A, 'pump.purge', expect='DIAMETER_NOT_SET', on=True) + g.call(g.A, 'syringe.set_diameter', diameter_m=0.02659) + g.call(g.A, 'rate.set', expect='OUT_OF_RANGE', rate_m3_s=1800 * MH) # 5.1005 cm/min x 5.553 cm2 = 1699 mL/h + g.call(g.A, 'rate.set', expect='OUT_OF_RANGE', rate_m3_s=0.01 * MH) # below 0.004205 cm/hr + g.call(g.A, 'phase.select', phase=2) + g.call(g.A, 'phase.set_function', function='JMP', parameter=1) + g.call(g.A, 'rate.set', expect='NOT_APPLICABLE', rate_m3_s=10 * MH) + g.call(g.A, 'volume.set', expect='NOT_APPLICABLE', volume_m3=1 * ML) + g.call(g.A, 'phase.set_function', expect='OUT_OF_RANGE', function='LOP', parameter=0) + g.call(g.A, 'phase.select', phase=1) + g.call(g.A, 'rate.set', rate_m3_s=100 * MH, units='MH') + g.call(g.A, 'pump.run') + g.call(g.A, 'pump.run', expect='ALREADY_RUNNING') + g.call(g.A, 'syringe.set_diameter', expect='PROGRAM_OPERATING', diameter_m=0.02) + g.call(g.A, 'rate.set', expect='UNITS_WHILE_PUMPING', rate_m3_s=1 * ML / 60.0, units='MM') + g.call(g.A, 'pump.purge', expect='PROGRAM_OPERATING', on=True) + g.call(g.A, 'syringe.load', expect='PROGRAM_OPERATING', syringe='bd_10ml', liquid_id='water', fill_volume_m3=1 * ML) + g.call(g.E, 'plant.configure', expect='SEED_FIXED', **dict(rt.PLANT_EXAMPLE, noise_seed=99)) + g.call(g.E, 'fault.inject', fault='mains_outage', active=True) + g.call(g.A, 'pump.stop', expect='POWER_OFF') + + +class Delivery(unittest.TestCase): + def test_speed_limits_match_syringe_table(self): + """The max rate of every syringe in the manual's 12.7 table is area x 5.1005 cm/min (rounded in the table).""" + for k, s in rt.SYR.items(): + area = math.pi * s['inside_diameter_m'] ** 2 / 4.0 + self.assertAlmostEqual(area * rt.V_MAX / s['max_rate_m3_s'], 1.0, delta=0.012, msg=k) + g = Rig() + g.setup() + a = math.pi * 0.02659 ** 2 / 4.0 + g.call(g.A, 'rate.set', rate_m3_s=a * rt.V_MAX * (1 - 1e-12), units='MH') + g.call(g.A, 'rate.set', rate_m3_s=a * rt.V_MIN * (1 + 1e-9), units='UH') + self.assertAlmostEqual(rt.V_MAX, 5.1005e-2 / 60.0, places=12) + self.assertAlmostEqual(rt.V_MIN, 0.004205e-2 / 3600.0, places=15) + + def test_volume_target_time_and_display(self): + g = Rig() + g.setup() + g.call(g.A, 'rate.set', rate_m3_s=100 * MH, units='MH') + g.call(g.A, 'volume.set', volume_m3=5 * ML) + g.call(g.A, 'pump.run') + self.assertTrue(g.read('indicator.pumping')) + self.assertEqual(g.read('display.text'), '100.0') + g.step(179.9) + self.assertEqual(g.read('run.state'), 'running') + g.step(0.2) + self.assertEqual(g.read('run.state'), 'stopped') # 5 mL at 100 mL/h = 180 s + self.assertAlmostEqual(g.read('volume.dispensed')['infused_m3'], 5 * ML, delta=1e-15) + self.assertAlmostEqual(g.truth()['delivered_m3'], 5 * ML, delta=0.01 * ML) + self.assertFalse(g.read('indicator.pumping')) + self.assertTrue(g.read('indicator.ml') and g.read('indicator.hr')) + self.assertIn('PROGRAM_END', g.events()) + g.step(10.0) + self.assertAlmostEqual(g.truth()['delivered_m3'], 5 * ML, delta=1e-12) # relaxed: the compressed volume has left + dx = g.read('pusher.position_m') - (rt.X_ZERO - 50 * ML / (math.pi * 0.02659 ** 2 / 4.0)) + self.assertAlmostEqual(dx, 5 * ML / (math.pi * 0.02659 ** 2 / 4.0), delta=1e-12) + _balance(self, g.ledger()) + + def test_true_diameter_error_changes_delivery_not_display(self): + g = Rig() + g.call(g.E, 'medium.configure', syringe_id_error=0.02) + g.setup() + g.call(g.A, 'rate.set', rate_m3_s=600 * MH, units='MH') + g.call(g.A, 'volume.set', volume_m3=10 * ML) + g.call(g.A, 'pump.run') + g.step(80.0) + self.assertAlmostEqual(g.read('volume.dispensed')['infused_m3'], 10 * ML, delta=1e-15) + self.assertAlmostEqual(g.truth()['delivered_m3'] / (10 * ML), 1.02 ** 2, delta=1e-6) + self.assertEqual(g.truth()['syringe']['true_inside_diameter_m'], 0.02659 * 1.02) + g.call(g.E, 'medium.configure', expect='SYRINGE_LOADED', syringe_id_error=0.0) + _balance(self, g.ledger()) + + def test_air_bubble_lag_and_tail_flow(self): + g = Rig() + g.setup(fill=40 * ML, air=2 * ML, needle='30g', tubing='ptfe_0p5mm', length=2.0) + g.call(g.A, 'rate.set', rate_m3_s=50 * MH, units='MH') + g.call(g.A, 'pump.run') + g.step(10.0) + T = g.call(g.E, 'truth.inspect')['process'] + self.assertLess(T['delivered_m3'], 0.9 * g.read('volume.dispensed')['infused_m3']) # the bubble compresses first (tau = R C ~ 40 s) + self.assertGreater(T['pressure_pa'], 5e3) + g.step(600.0) + g.call(g.A, 'pump.stop') + d_stop = g.truth()['delivered_m3'] + g.step(600.0) + self.assertGreater(g.truth()['delivered_m3'], d_stop + 1e-9) # tail flow after the motor stops + self.assertLess(abs(g.truth()['pressure_pa']), 1.0) + self.assertAlmostEqual(g.truth()['delivered_m3'], g.read('volume.dispensed')['infused_m3'], delta=1e-12) + _balance(self, g.ledger()) + + def test_backpressure_and_viscosity_raise_force(self): + g = Rig() + g.setup(syringe='bd_10ml', fill=8 * ML, needle='30g', back=1.0e5, liquid='glycerol' if 'glycerol' in rt.LIQ else 'ethylene_glycol') + g.call(g.A, 'rate.set', rate_m3_s=30 * MH, units='MH') + g.call(g.A, 'pump.run') + g.step(5.0) + T = g.truth() + a = math.pi * rt.SYR['bd_10ml']['inside_diameter_m'] ** 2 / 4.0 + self.assertGreater(T['pressure_pa'], 1.0e5) + self.assertAlmostEqual(T['force_n'], T['pressure_pa'] * a + rt.ENG['friction_n']['plastic'], delta=1e-6) + + +class Stall(unittest.TestCase): + def test_occlusion_stalls_and_any_key_clears(self): + g = Rig() + g.setup() + g.call(g.A, 'rate.set', rate_m3_s=200 * MH, units='MH') + g.call(g.A, 'pump.run') + g.step(5.0) + g.call(g.E, 'fault.inject', fault='occlusion', active=True) + for _ in range(600): + g.step(1.0) + if g.read('alarm.state'): + break + self.assertEqual(g.read('alarm.state'), 'stall') + self.assertEqual(g.read('display.text'), 'StAL') + self.assertEqual(g.read('run.state'), 'paused') + self.assertFalse(g.read('indicator.pumping')) + T = g.truth() + self.assertGreater(abs(T['force_n']) + rt.ENG['friction_n']['plastic'], rt.max_force(200 * MH / (math.pi * 0.02659 ** 2 / 4.0))) # standing: pressure load + x = g.read('pusher.position_m') + g.step(30.0) + self.assertEqual(g.read('pusher.position_m'), x) + g.call(g.A, 'rate.set', expect='ALARM_ACTIVE', rate_m3_s=100 * MH) + g.key('rate') + self.assertIsNone(g.read('alarm.state')) + self.assertEqual(g.read('run.state'), 'paused') + self.assertIn('STALL', g.events(g.A)) + _balance(self, g.ledger()) + + def test_collar_and_bottom_out(self): + g = Rig() + g.setup(syringe='bd_10ml', fill=5 * ML) + x0 = g.read('pusher.position_m') + g.call(g.A, 'collar.set', expect='BEHIND_PUSHER', position_m=x0 - 0.001) + g.call(g.A, 'collar.set', position_m=x0 + 0.010) + self.assertAlmostEqual(g.read('collar.joint_m'), x0 + 0.010) + g.call(g.A, 'rate.set', rate_m3_s=300 * MH, units='MH') + g.call(g.A, 'pump.run') + g.step(60.0) + self.assertEqual(g.read('alarm.state'), 'stall') + self.assertAlmostEqual(g.read('pusher.position_m'), x0 + 0.010, delta=1e-12) + g.key('start') # clears the alarm only + g.call(g.A, 'collar.set', position_m=None) + self.assertAlmostEqual(g.read('collar.joint_m'), rt.COLLAR_PARK) # parked against the holder block (4.46 in) + g.call(g.A, 'pump.run') + g.step(120.0) + self.assertEqual(g.read('alarm.state'), 'stall') + self.assertAlmostEqual(g.read('pusher.position_m'), rt.X_ZERO, delta=1e-12) # plunger bottomed + self.assertLess(g.truth()['syringe']['liquid_m3'], 1e-12) + self.assertIn('stall', ' '.join(e['message_zh'] for e in g.call(g.A, 'events.read')['events'] if e['code'] == 'STALL') + 'stall') + _balance(self, g.ledger()) + + def test_motor_failure_stalls(self): + g = Rig() + g.setup() + g.call(g.E, 'fault.inject', fault='motor_failure', active=True) + g.call(g.A, 'rate.set', rate_m3_s=100 * MH, units='MH') + g.call(g.A, 'pump.run') + g.step(1.0) + self.assertEqual(g.read('alarm.state'), 'stall') + + +class Withdraw(unittest.TestCase): + def test_withdraw_from_reservoir_then_air(self): + g = Rig() + g.setup(fill=10 * ML, reservoir=5 * ML) + g.call(g.A, 'direction.set', direction='WDR') + self.assertTrue(g.read('indicator.withdraw')) + g.call(g.A, 'rate.set', rate_m3_s=600 * MH, units='MH') + g.call(g.A, 'volume.set', volume_m3=8 * ML) + g.call(g.A, 'pump.run') + g.step(60.0) + S = g.truth()['syringe'] + self.assertAlmostEqual(S['liquid_m3'], 15 * ML, delta=1e-9) + self.assertGreater(S['air_m3_atm'], 2.5 * ML) + self.assertEqual(g.read('volume.dispensed')['withdrawn_m3'], 8 * ML) + L = g.ledger() + self.assertGreater(L['air_in_m3'], 2.5 * ML) + _balance(self, L) + + def test_cavitation_on_fast_withdrawal_through_fine_needle(self): + g = Rig() + g.setup(fill=5 * ML, needle='30g', tubing='ptfe_0p5mm', length=1.0, reservoir=100 * ML, liquid='glycerol' if 'glycerol' in rt.LIQ else 'water') + g.call(g.A, 'direction.set', direction='WDR') + g.call(g.A, 'rate.set', rate_m3_s=1500 * MH, units='MH') + g.call(g.A, 'pump.run') + g.step(5.0) + T = g.truth() + self.assertTrue(T['syringe']['cavitated']) + self.assertAlmostEqual(T['pressure_pa'], rt.ENG['cavitation_abs_pa'] - rt.PLANT_EXAMPLE['pressure_pa'], delta=1.0) + self.assertGreater(g.ledger()['gas_formed_m3'], 0.0) + self.assertIn('CAVITATION', g.events()) + _balance(self, g.ledger()) + + +class Program(unittest.TestCase): + def _phase(self, g, n, **kw): + g.call(g.A, 'phase.select', phase=n) + g.call(g.A, 'phase.set_function', **kw) + + def test_rate_pause_loop_stop(self): + g = Rig() + g.setup(reservoir=100 * ML) + self._phase(g, 1, function='LPS') + self._phase(g, 2, function='RAT', rate_m3_s=360 * MH, rate_units='MH', volume_m3=1 * ML, direction='INF') + self._phase(g, 3, function='PAS', parameter=5) + self._phase(g, 4, function='LOP', parameter=3) + self._phase(g, 5, function='OUT', parameter=1) + self._phase(g, 6, function='STP') + g.call(g.A, 'pump.run') + g.step(10.0) + self.assertEqual(g.read('run.state'), 'pause_timer') + g.step(1.0) + self.assertEqual(g.read('display.text'), 'PS04') + g.step(4.0) + self.assertEqual((g.read('run.state'), g.read('run.phase')), ('running', 2)) + g.step(60.0) + self.assertEqual(g.read('run.state'), 'stopped') + self.assertAlmostEqual(g.read('volume.dispensed')['infused_m3'], 3 * ML, delta=1e-15) + self.assertEqual(g.read('ttl.state')['outputs']['5'], 1) + + def test_fill_inc_dec_jump(self): + g = Rig() + g.setup(fill=30 * ML, reservoir=100 * ML) + self._phase(g, 1, function='RAT', rate_m3_s=600 * MH, rate_units='MH', volume_m3=2 * ML, direction='INF') + self._phase(g, 2, function='INC', rate_m3_s=600 * MH, rate_units='MH', volume_m3=1 * ML, direction='INF') + self._phase(g, 3, function='DEC', rate_m3_s=900 * MH, rate_units='MH', volume_m3=0.5 * ML, direction='INF') + self._phase(g, 4, function='FIL', rate_m3_s=1200 * MH, rate_units='MH') + self._phase(g, 5, function='JMP', parameter=7) + self._phase(g, 6, function='BEP') + self._phase(g, 7, function='STP') + g.call(g.A, 'pump.run') + g.step(12.1) + self.assertEqual(g.read('run.phase'), 2) + self.assertAlmostEqual(g.read('pump.rate_m3_s'), 1200 * MH, delta=1e-15) + g.step(3.0) + self.assertEqual(g.read('run.phase'), 3) + self.assertAlmostEqual(g.read('pump.rate_m3_s'), 300 * MH, delta=1e-15) + g.step(6.0) + self.assertEqual(g.read('run.phase'), 4) + self.assertEqual(g.read('pump.direction'), 'WDR') + g.step(12.0) + self.assertEqual(g.read('run.state'), 'stopped') + self.assertAlmostEqual(g.read('volume.dispensed')['withdrawn_m3'], 3.5 * ML, delta=1e-15) # FIL refills all 3.5 mL dispensed since the last clear + self.assertNotIn('BEEP', g.events()) + _balance(self, g.ledger()) + + def test_out_of_range_phase_alarm(self): + g = Rig() + g.setup() + self._phase(g, 1, function='RAT', rate_m3_s=1500 * MH, rate_units='MH', volume_m3=1 * ML, direction='INF') + self._phase(g, 2, function='INC', rate_m3_s=500 * MH, rate_units='MH', volume_m3=1 * ML, direction='INF') + g.call(g.A, 'pump.run') + g.step(3.0) + self.assertEqual(g.read('alarm.state'), 'out_of_range') + self.assertEqual(g.read('display.text'), 'or02') + + def test_ttl_trigger_needs_100ms_and_event_trap(self): + g = Rig() + g.setup() + self._phase(g, 1, function='EVN', parameter=3) + self._phase(g, 2, function='RAT', rate_m3_s=100 * MH, rate_units='MH', volume_m3=0.0, direction='INF') + self._phase(g, 3, function='RAT', rate_m3_s=50 * MH, rate_units='MH', volume_m3=0.0, direction='INF') + g.call(g.A, 'ttl.set', pin=2, level=0) + g.step(0.05) + g.call(g.A, 'ttl.set', pin=2, level=1) # 50 ms glitch: ignored + g.step(1.0) + self.assertEqual(g.read('run.state'), 'stopped') + g.call(g.A, 'ttl.set', pin=2, level=0) + g.step(0.2) + self.assertEqual((g.read('run.state'), g.read('run.phase')), ('running', 2)) + g.call(g.A, 'ttl.set', pin=4, level=0) + g.step(0.2) + self.assertEqual(g.read('run.phase'), 3) + self.assertAlmostEqual(g.read('pump.rate_m3_s'), 50 * MH, delta=1e-15) + self.assertEqual(g.read('ttl.state')['outputs']['7'], 1) + + def test_pause_resume_and_cancel(self): + g = Rig() + g.setup() + g.call(g.A, 'rate.set', rate_m3_s=360 * MH, units='MH') + g.call(g.A, 'volume.set', volume_m3=2 * ML) + g.call(g.A, 'pump.run') + g.step(10.0) + g.call(g.A, 'pump.stop') + self.assertEqual(g.read('run.state'), 'paused') + g.step(30.0) + g.call(g.A, 'pump.run') + g.step(10.0) + self.assertEqual(g.read('run.state'), 'stopped') # resumed: 2 mL total, not 2 mL more + self.assertAlmostEqual(g.read('volume.dispensed')['infused_m3'], 2 * ML, delta=1e-15) + g.call(g.A, 'pump.run') + g.step(5.0) + g.key('start') + self.assertEqual(g.read('run.state'), 'paused') + g.key('rate') # any other key cancels the pause + self.assertEqual(g.read('run.state'), 'stopped') + + +class Interface(unittest.TestCase): + def test_keypad_edit_commit_and_messages(self): + g = Rig() + g.setup() + self.assertEqual(g.key('diameter'), '26.59') + self.assertEqual(g.key('rate'), '0.000') + g.key('up1') + g.key('up1') + self.assertEqual(g.read('display.text'), '2.000') + g.step(1.0) + self.assertEqual(g.h.phases[0]['rate_m3_s'], 0.0) + g.step(1.1) + self.assertAlmostEqual(g.h.phases[0]['rate_m3_s'], 2 * MH, delta=1e-18) # stored 2 s after the last arrow key + g.key('diameter') + self.assertTrue(g.read('indicator.mm')) + self.assertEqual(g.read('display.text'), '26.59') + g.key('volume') + self.assertEqual(g.read('display.text'), ' oFF') + g.key('volume') + self.assertTrue(g.read('indicator.dispensed')) + g.call(g.A, 'setup.configure', keypad_lockout=True) + self.assertEqual(g.key('up1'), 'LoC-') + g.key('rate') + g.call(g.A, 'setup.configure', keypad_lockout=False) + g.call(g.A, 'phase.select', phase=2) + g.call(g.A, 'phase.set_function', function='PAS', parameter=5) + g.call(g.A, 'phase.select', phase=1) + g.call(g.A, 'pump.run') + g.key('volume') + self.assertEqual(g.key('up1'), '----') # not applicable while pumping + + def test_dispensed_clear_and_rollover_display(self): + g = Rig() + g.setup() + g.call(g.A, 'rate.set', rate_m3_s=1200 * MH, units='MH') + g.call(g.A, 'volume.set', volume_m3=1 * ML) + g.call(g.A, 'pump.run') + g.step(4.0) + g.key('volume') + g.key('volume') + self.assertEqual(g.read('display.text'), '1.000') + g.key('up2') + self.assertEqual(g.read('volume.dispensed')['infused_m3'], 0.0) + self.assertIn('DISPENSED_CLEARED', g.events(g.A)) + + def test_serial_basic_protocol(self): + g = Rig() + g.setup(power=False) + g.on() + self.assertEqual(g.serial('VER'), '00A?R') # first reply after power-up reports the reset + self.assertEqual(g.serial('VER'), '00SNE1000V3.923') + self.assertTrue(g.read('indicator.rs232')) + self.assertEqual(g.serial('DIA26.59'), '00S') + self.assertEqual(g.serial('DIA'), '00S26.59') + self.assertEqual(g.serial('RAT100MH'), '00S') + self.assertEqual(g.serial('RAT'), '00S100.0MH') + self.assertEqual(g.serial('RAT9999MH'), '00S?OOR') + self.assertEqual(g.serial('VOL2.5'), '00S') + self.assertEqual(g.serial('XYZ'), '00S?') + self.assertEqual(g.serial('5RUN'), '') # another pump's address + self.assertEqual(g.serial('RUN'), '00I') + g.step(30.0) + self.assertEqual(g.serial('DIS'), '00II0.833W0.000ML') + self.assertEqual(g.serial('STP'), '00P') + self.assertEqual(g.serial('STP'), '00S') + + def test_power_cycle_clears_dispensed_and_power_failure_restart(self): + g = Rig() + g.setup() + g.call(g.A, 'rate.set', rate_m3_s=100 * MH, units='MH') + g.call(g.A, 'pump.run') + g.step(30.0) + g.call(g.A, 'power.set', on=False) + g.call(g.A, 'power.set', on=True) + self.assertEqual(g.read('volume.dispensed')['infused_m3'], 0.0) + self.assertEqual(g.read('run.state'), 'stopped') + g.call(g.A, 'setup.configure', power_failure=True) + g.call(g.A, 'pump.run') + g.step(10.0) + g.call(g.E, 'fault.inject', fault='mains_outage', active=True) + x = g.read('pusher.position_m') + g.step(60.0) + self.assertEqual(g.read('pusher.position_m'), x) + self.assertEqual(g.read('display.text'), '') + g.call(g.E, 'fault.inject', fault='mains_outage', active=False) + self.assertEqual(g.read('run.state'), 'running') # power-failure mode restarts the program + _balance(self, g.ledger()) + + def test_purge_top_speed(self): + g = Rig() + g.setup() + g.call(g.A, 'pump.purge', on=True) + self.assertEqual(g.read('display.text'), 'PurG') + g.step(2.0) + self.assertAlmostEqual(g.read('pump.rate_m3_s'), rt.V_MAX * math.pi * 0.02659 ** 2 / 4.0, delta=1e-15) + g.call(g.A, 'pump.purge', on=False) + self.assertEqual(g.read('run.state'), 'stopped') + self.assertAlmostEqual(g.read('volume.dispensed')['infused_m3'], 2.0 * rt.V_MAX * math.pi * 0.02659 ** 2 / 4.0, delta=1e-12) + + def test_toggle_clear_program_and_dispensed(self): + g = Rig() + g.call(g.A, 'power.toggle') + self.assertTrue(g.read('power.on')) + g.setup(power=False) + g.call(g.A, 'syringe.set_diameter', diameter_m=0.02659) + g.call(g.A, 'phase.select', phase=3) + g.call(g.A, 'phase.set_function', function='BEP') + g.call(g.A, 'rate.set', expect='NOT_APPLICABLE', rate_m3_s=10 * MH) + g.call(g.A, 'phase.select', phase=1) + g.call(g.A, 'rate.set', rate_m3_s=360 * MH, units='MH') + g.call(g.A, 'volume.set', volume_m3=0.5 * ML) + g.call(g.A, 'pump.run') + g.step(10.0) + g.call(g.A, 'volume.clear', direction='WDR') + self.assertAlmostEqual(g.read('volume.dispensed')['infused_m3'], 0.5 * ML, delta=1e-15) + g.call(g.A, 'volume.clear', direction='BOTH') + self.assertEqual(g.read('volume.dispensed')['infused_m3'], 0.0) + self.assertEqual(g.call(g.A, 'program.clear')['phases'], 1) + self.assertIsNone(g.read('program.state')['phases'][2]) + g.call(g.A, 'power.toggle') + self.assertFalse(g.read('power.on')) + self.assertEqual(g.read('display.text'), '') + + def test_idle_skip_exact_and_fast(self): + import time + g = Rig() + g.setup() + t0 = time.time() + g.step(30 * 86400.0) + self.assertLess(time.time() - t0, 1.0) + self.assertEqual(g.read('clock.time_s'), 30 * 86400.0) + g.call(g.A, 'syringe.unload') + _balance(self, g.ledger()) + + +class RoundOneFixes(unittest.TestCase): + """Regression tests of the round-1 review findings (R1-*, C1-*, G1-*).""" + + def test_cavitation_conserves_volume(self): # R1-01 + g = Rig() + g.setup(fill=10 * ML, tubing='ptfe_0p5mm', length=2.0, needle='30g', reservoir=100 * ML) + g.call(g.A, 'direction.set', direction='WDR') + g.call(g.A, 'rate.set', rate_m3_s=1500 * MH, units='MH') + g.call(g.A, 'pump.run') + for _ in range(4): + g.step(10.0) + S = g.truth()['syringe'] + self.assertGreater(S['liquid_m3'], 10 * ML) # liquid comes in while the plunger is pulled + _balance(self, g.ledger()) + self.assertTrue(S['cavitated']) + g.call(g.A, 'pump.stop') + g.step(600.0) + _balance(self, g.ledger()) + + def test_rate_change_acts_on_the_running_phase(self): # R1-02 + g = Rig() + g.setup() + g.call(g.A, 'phase.set_function', function='RAT', rate_m3_s=600 * MH, rate_units='MH', volume_m3=0.5 * ML, direction='INF') + g.call(g.A, 'phase.select', phase=2) + g.call(g.A, 'phase.set_function', function='RAT', rate_m3_s=50 * 1e-9 / 60.0, rate_units='UM', volume_m3=0.0, direction='INF') + g.call(g.A, 'phase.select', phase=1) + g.call(g.A, 'pump.run') + g.step(4.0) + g.serial('VER') + self.assertEqual(g.read('run.phase'), 2) + self.assertTrue(g.read('indicator.ul') and g.read('indicator.min')) # units of the executing phase + self.assertEqual(g.serial('RAT'), '00I50.00UM') + self.assertEqual(g.serial('RAT60'), '00I') # 60 uL/min in phase 2 units, not mL/h of phase 1 + self.assertAlmostEqual(g.read('pump.rate_m3_s'), 60e-9 / 60.0, delta=1e-18) + ph = g.read('program.state')['phases'] + self.assertAlmostEqual(ph[0]['rate_m3_s'], 600 * MH, delta=1e-18) + self.assertAlmostEqual(ph[1]['rate_m3_s'], 50e-9 / 60.0, delta=1e-18) # RS-232 while operating: not stored (manual 6.1) + g.call(g.A, 'rate.set', rate_m3_s=70e-9 / 60.0) + self.assertAlmostEqual(g.read('program.state')['phases'][1]['rate_m3_s'], 70e-9 / 60.0, delta=1e-18) + g.call(g.A, 'rate.set', rate_m3_s=0.0) # R1-04: a rate of 0.0 stops the pump + self.assertEqual(g.read('run.state'), 'stopped') + self.assertFalse(g.read('indicator.pumping')) + + def test_keypad_follows_the_manual(self): # R1-03 + g = Rig() + g.setup() + g.call(g.A, 'rate.set', rate_m3_s=360 * MH, units='MH') + g.call(g.A, 'volume.set', volume_m3=0.1 * ML) + g.call(g.A, 'phase.select', phase=2) + g.call(g.A, 'phase.set_function', function='PAS', parameter=0) + g.call(g.A, 'phase.select', phase=1) + g.call(g.A, 'pump.run') + g.step(1.5) + self.assertEqual(g.read('display.text'), 'PAUS') + g.key('volume') # PS:00 - any key but Start resets + self.assertEqual((g.read('run.state'), g.read('run.phase')), ('stopped', 1)) + g.call(g.A, 'pump.run') + g.key('start') + g.call(g.A, 'phase.set_function', function='RAT', rate_m3_s=360 * MH, rate_units='MH', volume_m3=0.0, direction='INF') + g.call(g.A, 'pump.run') + g.step(2.0) + g.key('start') + self.assertEqual(g.read('run.state'), 'paused') + g.key('rate') + g.key('up1') # an arrow cancels the pause in any mode (manual 7.7) + self.assertEqual(g.read('run.state'), 'stopped') + g.step(2.2) + g.key('rate') # rate shown: Rate again -> units change mode + self.assertEqual(g.read('display.text'), 'UntS') + g.key('up1') + g.step(2.2) + ph = g.read('program.state')['phases'][0] + self.assertEqual((ph['rate_units'], round(ph['rate_m3_s'] / (1e-9 / 60.0), 6)), ('UM', 460.0)) # 460 mL/h -> 460 uL/min (in range: stored) + g.call(g.A, 'setup.configure', keypad_lockout=True) + self.assertEqual(g.key('diameter'), '26.59') # locked: settings can still be reviewed + self.assertEqual(g.key('up1'), 'LoC-') + g.key('rate') + g.call(g.A, 'ttl.set', pin=6, level=0) # the Lockout Disable Key grounds pin 6 + g.step(0.2) + self.assertNotEqual(g.key('up1'), 'LoC-') + + def test_units_change_mode(self): # R1-03 (6.6.1) + g = Rig() + g.setup() + g.call(g.A, 'rate.set', rate_m3_s=5 * MH, units='MH') + g.key('rate') + self.assertEqual(g.read('display.text'), 'UntS') + g.key('up1') # MH -> UM + self.assertTrue(g.read('indicator.ul') and g.read('indicator.min')) + g.key('volume') # a non-arrow key stores the units + ph = g.read('program.state')['phases'][0] + self.assertEqual(ph['rate_units'], 'UM') + self.assertAlmostEqual(ph['rate_m3_s'], 5e-9 / 60.0, delta=1e-20) # the displayed number stays + + def test_hidden_back_pressure_and_stall_values(self): # C1-01 + g = Rig() + g.setup() + g.call(g.E, 'medium.configure', backpressure_pa=3.0e5) + self.assertEqual(g.read('outlet.state', who=g.A)['backpressure_pa'], 0.0) + g.call(g.A, 'rate.set', rate_m3_s=1600 * MH, units='MH') + g.call(g.A, 'pump.run') + g.step(5.0) + self.assertEqual(g.read('alarm.state'), 'stall') + msgs = [e['message_zh'] for e in g.call(g.A, 'events.read')['events'] if e['code'] == 'STALL'] + self.assertTrue(msgs and not any(ch.isdigit() for m in msgs for ch in m), msgs) + self.assertIn('STALL_FORCE', g.events()) + self.assertNotIn('STALL_FORCE', g.events(g.A)) + + def test_program_edit_resets_a_paused_program(self): # C1-02 + g = Rig() + g.setup() + g.call(g.A, 'rate.set', rate_m3_s=360 * MH, units='MH') + g.call(g.A, 'volume.set', volume_m3=5 * ML) + g.call(g.A, 'pump.run') + g.step(2.0) + g.call(g.A, 'pump.stop') + self.assertEqual(g.read('run.state'), 'paused') + g.call(g.A, 'program.clear') # declared run.state effect + self.assertEqual(g.read('run.state'), 'stopped') + + def test_event_order_and_power_cycle(self): # R1-05, R1-06 + g = Rig() + g.setup() + g.call(g.A, 'rate.set', rate_m3_s=1200 * MH, units='MH') + g.call(g.A, 'volume.set', volume_m3=0.01 * ML) + g.step(0.15) + g.call(g.A, 'pump.run') + g.step(1.0) + ev = g.call(g.E, 'events.read')['events'] + t_run = max(e['time_s'] for e in ev if e['code'] == 'RUN') + t_end = max(e['time_s'] for e in ev if e['code'] == 'PROGRAM_END') + self.assertGreaterEqual(t_end, t_run) + g.call(g.E, 'fault.inject', fault='motor_failure', active=True) + g.call(g.A, 'volume.set', volume_m3=0.0) + g.call(g.A, 'pump.run') + g.step(1.0) + self.assertEqual(g.read('alarm.state'), 'stall') + g.call(g.A, 'power.toggle') + g.call(g.A, 'power.toggle') + self.assertIsNone(g.read('alarm.state')) # alarms do not survive a power cycle + g.call(g.E, 'fault.inject', fault='motor_failure', active=False) + g.call(g.A, 'pump.run') + g.step(1.0) + d = g.read('volume.dispensed')['infused_m3'] + g.call(g.A, 'pump.stop') + g.call(g.A, 'syringe.set_diameter', diameter_m=0.02659) # same diameter: nothing cleared + self.assertEqual(g.read('volume.dispensed')['infused_m3'], d) + + def test_serial_setup_commands(self): # C1-03 + g = Rig() + g.setup() + g.serial('VER') + self.assertEqual(g.serial('TRG LE'), '00S') + self.assertEqual(g.serial('TRG'), '00SLE') + self.assertEqual(g.serial('DIN1'), '00S') + self.assertEqual(g.serial('ROM1'), '00S') + self.assertEqual(g.read('setup.state')['direction_input'], 1) + self.assertEqual(g.read('setup.state')['motor_output'], 1) + self.assertEqual(g.serial('BUZ13'), '00S') + self.assertEqual(g.serial('DIRSTK'), '00S?NA') + for k in ('ttl.override_trigger', 'direction.sticky', 'program.entry_lockout'): # R1-07 + self.assertIn(k, rt.UNSUPPORTED) + + +class RoundTwoFixes(unittest.TestCase): + """Regression tests of the round-2 review findings (R2-*, C2-*).""" + + def test_ttl_start_without_diameter_is_ignored(self): # R2-01 + g = Rig() + g.setup(power=False) + g.on() + g.call(g.A, 'ttl.set', pin=2, level=0) + g.step(1.0) # sim.step is not rejected + self.assertEqual(g.read('run.state'), 'stopped') + self.assertIn('TRIGGER_IGNORED', g.events(g.A)) + + def test_collar_in_the_way_and_no_backward_jump(self): # R2-02 + g = Rig() + g.on() + g.call(g.A, 'collar.set', position_m=0.10) + g.call(g.A, 'syringe.load', expect='COLLAR_IN_THE_WAY', syringe='bd_60ml', liquid_id='water', fill_volume_m3=1 * ML) + g.call(g.A, 'collar.set', position_m=None) + g.call(g.A, 'syringe.load', syringe='bd_60ml', liquid_id='water', fill_volume_m3=1 * ML) + g.call(g.A, 'syringe.set_diameter', diameter_m=0.02659) + g.call(g.A, 'pump.purge', on=True) + x = [] + for _ in range(30): + g.step(0.1) + x.append(g.read('pusher.position_m')) + self.assertTrue(all(b >= a - 1e-15 for a, b in zip(x, x[1:]))) + self.assertAlmostEqual(x[-1], rt.X_ZERO, delta=1e-12) + _balance(self, g.ledger()) + + def test_read_does_not_change_the_program(self): # R2-03 + g = Rig() + g.setup() + g.call(g.A, 'rate.set', rate_m3_s=600 * MH, units='MH') + g.call(g.A, 'volume.set', volume_m3=0.1 * ML) + g.call(g.A, 'phase.select', phase=2) + g.read() + g.h.read('agent') + self.assertIsNone(g.h.phases[1]) + g.call(g.A, 'phase.select', phase=1) + g.call(g.A, 'pump.run') + g.step(2.0) + self.assertEqual((g.read('run.state'), g.read('alarm.state')), ('stopped', None)) # empty phase 2 = implied stop + + def test_restart_after_zero_rate(self): # R2-04 + g = Rig() + g.setup() + g.call(g.A, 'rate.set', rate_m3_s=600 * MH, units='MH') + g.call(g.A, 'pump.run') + g.step(1.0) + g.serial('VER') + g.serial('RAT0') # RS-232 while operating: stops, not stored + self.assertEqual(g.read('run.state'), 'stopped') + g.call(g.A, 'pump.run') + g.step(1.0) + self.assertTrue(g.read('indicator.pumping')) + self.assertAlmostEqual(g.read('pump.rate_m3_s'), 600 * MH, delta=1e-18) + + def test_disturbance_survives_a_reconnect(self): # C2-01 + g = Rig() + g.setup() + g.call(g.E, 'medium.configure', backpressure_pa=1.0e5) + g.call(g.A, 'outlet.connect', tubing='ptfe_0p8mm', tubing_length_m=0.5, needle='none', backpressure_pa=0.0) + g.step(2.0) + self.assertAlmostEqual(g.truth()['backpressure_pa'], 1.0e5) + self.assertEqual(g.read('outlet.state', who=g.A)['backpressure_pa'], 0.0) + + +class RoundThreeFixes(unittest.TestCase): + """Regression tests of the round-3 review findings (R3-*, C3-*).""" + + def test_rate_change_kept_paused_is_used_on_resume(self): # R3-01 + g = Rig() + g.setup() + g.call(g.A, 'rate.set', rate_m3_s=100 * MH, units='MH') + g.call(g.A, 'pump.run') + g.step(1.0) + g.call(g.A, 'pump.stop') + g.serial('VER') + self.assertEqual(g.serial('RATC50'), '00P') + self.assertEqual(g.read('run.state'), 'paused') + g.call(g.A, 'pump.run') + g.step(0.5) + self.assertAlmostEqual(g.read('pump.rate_m3_s'), 50 * MH, delta=1e-18) + self.assertEqual(g.read('display.text'), '50.00') + + def test_look_and_refused_paths_do_not_create_phases(self): # R3-02 + g = Rig() + g.setup() + g.call(g.A, 'rate.set', rate_m3_s=600 * MH, units='MH') + g.call(g.A, 'volume.set', volume_m3=0.5 * ML) + g.call(g.A, 'phase.select', phase=2) + g.key('diameter') + g.key('rate') + g.call(g.A, 'phase.select', phase=1) + g.call(g.A, 'pump.run') + g.key('direction') # refused while running a volume phase: '----' + g.call(g.A, 'ttl.set', pin=3, level=0) + g.step(0.2) + self.assertIsNone(g.h.phases[1]) + g.step(5.0) + self.assertEqual((g.read('run.state'), g.read('alarm.state')), ('stopped', None)) + self.assertIn('PROGRAM_END', g.events(g.A)) + + def test_disturbance_cleared_by_the_evaluator(self): # C3-01 + g = Rig() + g.setup() + g.call(g.E, 'medium.configure', backpressure_pa=1.0e5) + g.call(g.E, 'medium.configure', clear_backpressure=True) + g.step(1.0) + self.assertEqual(g.truth()['backpressure_pa'], 0.0) + m = rt.export_newera_ne1000_contract_metadata()['capabilities']['medium.configure'] + self.assertTrue(any('clear_backpressure' in x for x in m['limitations']), m['limitations']) + + +class RoundFourFixes(unittest.TestCase): + """Regression tests of the round-4 review findings (R4-*, C4-*, G4-*).""" + + def _prog(self, g, phases): + for n, kw in enumerate(phases, 1): + g.call(g.A, 'phase.select', phase=n) + g.call(g.A, 'phase.set_function', **kw) + g.call(g.A, 'phase.select', phase=1) + + def test_stop_and_resume_inside_a_pause(self): # R4-01 + g = Rig() + g.setup() + self._prog(g, [dict(function='RAT', rate_m3_s=600 * MH, rate_units='MH', volume_m3=0.1 * ML, direction='INF'), dict(function='PAS', parameter=10), + dict(function='RAT', rate_m3_s=600 * MH, rate_units='MH', volume_m3=0.1 * ML, direction='INF')]) + g.call(g.A, 'pump.run') + g.step(2.0) + self.assertEqual(g.read('run.state'), 'pause_timer') + g.call(g.A, 'pump.stop') + g.step(5.0) + g.call(g.A, 'pump.run') + self.assertEqual(g.read('run.state'), 'pause_timer') # the time left of PS:10 (8.6 s) continues + g.step(8.0) + self.assertEqual(g.read('run.phase'), 2) + g.step(1.0) + self.assertEqual(g.read('run.phase'), 3) + g2 = Rig() + g2.setup() + self._prog(g2, [dict(function='PAS', parameter=0), dict(function='RAT', rate_m3_s=600 * MH, rate_units='MH', volume_m3=0.1 * ML, direction='INF')]) + g2.call(g2.A, 'pump.run') + g2.call(g2.A, 'pump.stop') + g2.call(g2.A, 'pump.run') + self.assertEqual(g2.read('run.state'), 'user_wait') # PS:00 waits again + g2.call(g2.A, 'pump.run') + g2.step(2.0) + self.assertEqual(g2.read('run.state'), 'stopped') + + def test_rate_c_while_paused(self): # R4-02 + g = Rig() + g.setup() + self._prog(g, [dict(function='RAT', rate_m3_s=100 * MH, rate_units='MH', volume_m3=0.0, direction='INF')]) + g.call(g.A, 'pump.run') + g.step(1.0) + g.call(g.A, 'pump.stop') + g.serial('VER') + g.serial('RATC0') # a rate of 0 stops: the pause is cancelled + self.assertEqual(g.read('run.state'), 'stopped') + g2 = Rig() + g2.setup() + self._prog(g2, [dict(function='RAT', rate_m3_s=100 * MH, rate_units='MH', volume_m3=0.1 * ML, direction='INF'), + dict(function='INC', rate_m3_s=20 * MH, rate_units='MH', volume_m3=0.0, direction='INF')]) + g2.call(g2.A, 'pump.run') + g2.step(5.0) + g2.call(g2.A, 'pump.stop') + g2.serial('VER') + self.assertEqual(g2.serial('RATC50'), '00P?NA') # RAT C changes a paused RATE phase only + g2.call(g2.A, 'pump.run') + g2.step(1.0) + self.assertAlmostEqual(g2.read('pump.rate_m3_s'), 120 * MH, delta=1e-18) + + def test_units_mode_without_change_creates_nothing(self): # R4-03 + g = Rig() + g.setup() + g.call(g.A, 'volume.set', volume_m3=0.1 * ML) + g.call(g.A, 'rate.set', rate_m3_s=600 * MH, units='MH') + g.call(g.A, 'phase.select', phase=2) + g.key('rate') + g.step(2.5) + self.assertIsNone(g.h.phases[1]) + + def test_reverse_of_the_running_phase(self): # R4-04 + g = Rig() + g.setup(reservoir=20 * ML) + self._prog(g, [dict(function='RAT', rate_m3_s=600 * MH, rate_units='MH', volume_m3=0.1 * ML, direction='INF'), + dict(function='RAT', rate_m3_s=600 * MH, rate_units='MH', volume_m3=0.0, direction='INF')]) + g.call(g.A, 'pump.run') + g.step(2.0) + self.assertEqual(g.read('run.phase'), 2) + g.call(g.A, 'direction.set', direction='REV') + self.assertEqual(g.read('pump.direction'), 'WDR') + x = g.read('pusher.position_m') + g.step(1.0) + self.assertLess(g.read('pusher.position_m'), x) + + def test_direction_while_paused_cancels_the_pause(self): # R4-05, R4-06 + g = Rig() + g.setup(reservoir=20 * ML) + g.call(g.A, 'rate.set', rate_m3_s=600 * MH, units='MH') + g.call(g.A, 'pump.run') + g.step(1.0) + g.call(g.A, 'pump.stop') + self.assertEqual(g.read('pump.direction'), 'INF') + g.call(g.A, 'direction.set', direction='WDR') + self.assertEqual((g.read('run.state'), g.read('pump.direction')), ('stopped', 'WDR')) + x = g.read('pusher.position_m') + g.call(g.A, 'pump.run') + g.step(1.0) + self.assertLess(g.read('pusher.position_m'), x) # the new direction is used + + def test_external_start_drops_a_pending_units_change(self): # R4-07 + g = Rig() + g.setup() + g.call(g.A, 'rate.set', rate_m3_s=100 * MH, units='MH') + g.key('rate') + g.key('up1') + g.call(g.A, 'pump.run') + g.step(3.0) + self.assertEqual(g.read('program.state')['phases'][0]['rate_units'], 'MH') + + def test_idle_skip_after_a_disturbance(self): # G4-01 + def run(skip): + g = Rig() + g.setup() + g.call(g.A, 'rate.set', rate_m3_s=600 * MH, units='MH') + g.call(g.A, 'pump.run') + g.step(1.0) + g.call(g.A, 'pump.stop') + g.call(g.E, 'medium.configure', backpressure_pa=3.0e5) + if skip: + g.step(600.0) + else: + for _ in range(6000): + g.step(0.1) + return g.ledger() + a, b = run(True), run(False) + self.assertEqual(a['delivered_m3'], b['delivered_m3']) + self.assertEqual(a['drawn_m3'], b['drawn_m3']) + + +class RoundFiveFixes(unittest.TestCase): + """Regression tests of the round-5 review findings (R5-*).""" + + def test_stall_resume_after_an_earlier_pause_stop(self): # R5-01 + g = Rig() + g.setup() + prog = [dict(function='PAS', parameter=2), dict(function='RAT', rate_m3_s=600 * MH, rate_units='MH', volume_m3=2 * ML, direction='INF')] + for n, kw in enumerate(prog, 1): + g.call(g.A, 'phase.select', phase=n) + g.call(g.A, 'phase.set_function', **kw) + g.call(g.A, 'phase.select', phase=1) + g.call(g.A, 'pump.run') + g.call(g.A, 'pump.stop') # stop inside PS:02 + g.call(g.A, 'pump.run') + g.step(4.0) + g.call(g.E, 'fault.inject', fault='occlusion', active=True) + g.step(20.0) + self.assertEqual(g.read('alarm.state'), 'stall') + g.call(g.E, 'fault.inject', fault='occlusion', active=False) + g.key('rate') + g.call(g.A, 'pump.run') + self.assertEqual(g.read('run.state'), 'running') # resumes pumping, not the expired pause + g.step(30.0) + self.assertAlmostEqual(g.read('volume.dispensed')['infused_m3'], 2 * ML, delta=1e-15) + + def test_dir_query_start_direction_and_run_n(self): # R5-02, R5-03, R5-04 + g = Rig() + g.setup(reservoir=20 * ML) + g.call(g.A, 'direction.set', direction='WDR') + g.call(g.A, 'rate.set', rate_m3_s=600 * MH, units='MH') + g.call(g.A, 'pump.run') + g.step(1.0) + g.call(g.A, 'pump.stop') + g.serial('VER') + self.assertEqual(g.serial('DIR'), '00PWDR') + g.call(g.A, 'pump.stop') + prog = [dict(function='PAS', parameter=0), dict(function='RAT', rate_m3_s=600 * MH, rate_units='MH', volume_m3=0.1 * ML, direction='INF'), + dict(function='RAT', rate_m3_s=300 * MH, rate_units='MH', volume_m3=0.1 * ML, direction='INF')] + for n, kw in enumerate(prog, 1): + g.call(g.A, 'phase.select', phase=n) + g.call(g.A, 'phase.set_function', **kw) + g.call(g.A, 'phase.select', phase=1) + g.call(g.A, 'pump.run') + self.assertEqual(g.read('run.state'), 'user_wait') + self.assertFalse(g.read('indicator.withdraw')) # no stale WDR from the earlier run + g.call(g.A, 'pump.run', phase=3) # RUN 3 at PS:00 starts at phase 3 + self.assertEqual(g.read('run.phase'), 3) + + +class RoundSixFixes(unittest.TestCase): + """Regression tests of the round-6 review findings (G6-*, R6-*).""" + + def test_pin7_and_force_follow_a_stop_at_once(self): # G6-01 + g = Rig() + g.setup() + g.call(g.A, 'setup.configure', motor_output=1) + for n, kw in enumerate([dict(function='PAS', parameter=5), dict(function='RAT', rate_m3_s=600 * MH, rate_units='MH', volume_m3=0.1 * ML, direction='INF')], 1): + g.call(g.A, 'phase.select', phase=n) + g.call(g.A, 'phase.set_function', **kw) + g.call(g.A, 'phase.select', phase=1) + g.call(g.A, 'pump.run') + g.step(1.0) + self.assertEqual(g.read('ttl.state')['outputs']['7'], 1) # ROM 1: high during the pause timer + g.call(g.A, 'pump.stop') + self.assertEqual(g.read('ttl.state')['outputs']['7'], 0) + g.step(100.0) + self.assertEqual(g.read('ttl.state')['outputs']['7'], 0) + g2 = Rig() + g2.setup() + g2.call(g2.A, 'rate.set', rate_m3_s=100 * MH, units='MH') + g2.call(g2.E, 'fault.inject', fault='occlusion', active=True) + g2.call(g2.A, 'pump.run') + g2.step(1.0) + g2.call(g2.A, 'pump.stop') + g2.step(10.0) + T = g2.truth() + self.assertAlmostEqual(T['force_n'], T['pressure_pa'] * math.pi * 0.02659 ** 2 / 4.0, delta=1e-9) # no running friction + + def test_no_purge_while_paused(self): # R6-01 + g = Rig() + g.setup() + g.call(g.A, 'rate.set', rate_m3_s=100 * MH, units='MH') + g.call(g.A, 'pump.run') + g.step(1.0) + g.call(g.A, 'pump.stop') + g.call(g.A, 'pump.purge', expect='PROGRAM_OPERATING', on=True) + + def test_paused_inc_phase_shows_the_actual_rate(self): # R6-02 + g = Rig() + g.setup() + for n, kw in enumerate([dict(function='RAT', rate_m3_s=100 * MH, rate_units='MH', volume_m3=0.01 * ML, direction='INF'), + dict(function='INC', rate_m3_s=20 * MH, rate_units='MH', volume_m3=0.0, direction='INF')], 1): + g.call(g.A, 'phase.select', phase=n) + g.call(g.A, 'phase.set_function', **kw) + g.call(g.A, 'phase.select', phase=1) + g.call(g.A, 'pump.run') + g.step(2.0) + g.call(g.A, 'pump.stop') + self.assertEqual(g.read('display.text'), '120.0') + g.serial('VER') + self.assertEqual(g.serial('RAT'), '00P120.0MH') + + +class RoundSevenFixes(unittest.TestCase): + """Regression tests of the round-7 review findings (R7-*).""" + + def test_no_event_jump_during_a_purge(self): # R7-01 + g = Rig() + g.setup(reservoir=20 * ML) + g.call(g.A, 'pump.purge', on=True) + g.serial('VER') + g.serial('RUNE3') + self.assertEqual(g.read('run.state'), 'purging') + g.call(g.A, 'pump.purge', on=False) + self.assertEqual(g.read('run.state'), 'stopped') + + def test_malformed_serial_commands(self): # R7-02 + g = Rig() + g.setup() + g.serial('VER') + g.call(g.A, 'phase.select', phase=2) + for cmd in ('RUN42', 'RUN99', 'RUN0', 'RUNE42', 'FUNJMP1.5', 'FUNRAT9.9', 'FUNOUT.5', 'FUNIF1.2', 'FUNLOP2.5'): + self.assertEqual(g.serial(cmd), '00S?OOR', cmd) + self.assertIsNone(g.h.phases[1]) + self.assertEqual(g.read('run.state'), 'stopped') + + def test_purge_in_the_currently_set_direction(self): # R7-03 + g = Rig() + g.setup(reservoir=20 * ML) + g.call(g.A, 'phase.select', phase=2) + g.call(g.A, 'phase.set_function', function='RAT', rate_m3_s=100 * MH, rate_units='MH', volume_m3=0.0, direction='WDR') + self.assertEqual(g.read('pump.direction'), 'WDR') + x = g.read('pusher.position_m') + g.call(g.A, 'pump.purge', on=True) + g.step(0.5) + self.assertLess(g.read('pusher.position_m'), x) + + +class RoundEightFixes(unittest.TestCase): + """Regression tests of the round-8 review findings (R8-*).""" + + def test_changes_during_a_purge_go_to_the_selected_phase(self): # R8-01 + g = Rig() + g.setup(reservoir=20 * ML) + g.call(g.A, 'volume.set', volume_m3=1 * ML) # phase 1: a volume phase + g.call(g.A, 'phase.select', phase=2) + g.call(g.A, 'phase.set_function', function='RAT', rate_m3_s=500e-9 / 60.0, rate_units='UM', volume_m3=0.0, direction='INF') + g.call(g.A, 'pump.purge', on=True) + g.serial('VER') + self.assertEqual(g.serial('RAT'), '00X500.0UM') + g.call(g.A, 'direction.set', direction='WDR') + g.call(g.A, 'rate.set', rate_m3_s=400e-9 / 60.0) + ph = g.read('program.state')['phases'] + self.assertEqual((ph[1]['direction'], ph[0]['direction']), ('WDR', 'INF')) + self.assertAlmostEqual(ph[1]['rate_m3_s'], 400e-9 / 60.0, delta=1e-20) + self.assertEqual(g.read('pump.direction'), 'WDR') + x = g.read('pusher.position_m') + g.step(0.5) + self.assertLess(g.read('pusher.position_m'), x) + + def test_fun_parameter_replies(self): # R8-02 + g = Rig() + g.setup() + g.serial('VER') + for cmd in ('FUNPAS100', 'FUNJMP123', 'FUNRAT12', 'FUNLPS3'): + self.assertEqual(g.serial(cmd), '00S?OOR', cmd) + self.assertEqual(g.serial('FUNPAS10'), '00S') + + +class RoundNineFixes(unittest.TestCase): + """Round 9 passed with minor findings, fixed directly (R9-01, G9-01).""" + + def test_purge_rate_rules(self): # R9-01 + g = Rig() + g.setup() + g.call(g.A, 'rate.set', rate_m3_s=100 * MH, units='MH') + g.call(g.A, 'pump.purge', on=True) + g.call(g.A, 'rate.set', expect='UNITS_WHILE_PUMPING', rate_m3_s=50e-9 / 60.0, units='UM') + g.call(g.A, 'rate.set', rate_m3_s=0.0) + self.assertEqual(g.read('run.state'), 'stopped') + self.assertIn('STOPPED_ZERO_RATE', g.events(g.A)) + + def test_occluded_line_skip_equals_ticking(self): # G9-01 + def run(skip): + g = Rig() + g.setup() + g.call(g.A, 'rate.set', rate_m3_s=600 * MH, units='MH') + g.call(g.E, 'fault.inject', fault='occlusion', active=True) + g.call(g.A, 'pump.run') + g.step(2.0) + g.call(g.A, 'pump.stop') + g.call(g.A, 'pump.stop') + g.call(g.A, 'outlet.connect', tubing='ptfe_1p6mm', tubing_length_m=2.0, needle='none', backpressure_pa=0.0) + if skip: + g.step(100.0) + else: + for _ in range(1000): + g.step(0.1) + g.call(g.E, 'fault.inject', fault='occlusion', active=False) + g.step(60.0) + return g.ledger() + a, b = run(True), run(False) + self.assertEqual((a['delivered_m3'], a['drawn_m3']), (b['delivered_m3'], b['drawn_m3'])) + _balance(self, a) + + +class ZCoverage(unittest.TestCase): + def test_all_capabilities_exercised(self): + missing = set(rt.CAPS) - set(rt.UNSUPPORTED) - SEEN_CAPS - {'events.read'} + if len(SEEN_CAPS) > 5: + self.assertFalse(missing, sorted(missing)) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_asset_novocontrol_alphat.py b/tests/test_asset_novocontrol_alphat.py new file mode 100644 index 0000000000000000000000000000000000000000..2a8a128a9b8fa93b27663804d2498236a1b618f4 --- /dev/null +++ b/tests/test_asset_novocontrol_alphat.py @@ -0,0 +1,166 @@ +"""CHEM140 finite-dwell complex spectroscopy, actual OSL and conserved active energy.""" +import copy,importlib.util,json,math,unittest +from pathlib import Path +import numpy as np +from scripts.asset_runtime import novocontrol_alphat as r +ROOT=Path(__file__).resolve().parents[1];spec=importlib.util.spec_from_file_location('alpha_asset_tool',ROOT/'skills/chemistry-lab-assets/scripts/asset_tool.py');asset_tool=importlib.util.module_from_spec(spec);spec.loader.exec_module(asset_tool) +OBSERVED=[] +class Checked(r.NovocontrolAlphatRuntime): + def invoke(self,k,**a): + before=self.read();out=super().invoke(k,**a);after=self.read();changed={x for x in after if after[x]!=before[x]} + assert not changed-set(r.CAPS[k]['effects']),(k,changed-set(r.CAPS[k]['effects'])) + assert not asset_tool.validate_value(out,r.CAPS[k]['output_schema']),(k,asset_tool.validate_value(out,r.CAPS[k]['output_schema'])) + OBSERVED.append((k,copy.deepcopy(a),copy.deepcopy(out)));return out + +def make(plant=None,sample=None,method=None,geometry=None,thermal=None): + h=Checked();h.invoke('plant.configure',**dict(r.PLANT_EXAMPLE,**(plant or {})));h.invoke('geometry.configure',**dict(r.GEOMETRY_EXAMPLE,**(geometry or {})));h.invoke('thermal.configure',**dict(r.THERMAL_EXAMPLE,**(thermal or {})));h.invoke('sample.load',**dict(r.SAMPLE_EXAMPLE,**(sample or {})));h.invoke('power.set',enabled=True);h.invoke('sample.set_clamp',closed=True);h.step(1.);h.invoke('thermal.set_temperature',temperature_k=r.PLANT_EXAMPLE['ambient_k']);h.invoke('method.configure',**dict(r.METHOD_EXAMPLE,**(method or {})));return h + +def finish(h): + h.invoke('acquisition.start');remaining=h.expected_duration + while remaining>0: + step=min(remaining,86400.);h.step(step);remaining-=step + return h.invoke('acquisition.result') +def calibrate(h): + observations={} + for mode in ['open','short','load']: + h.invoke('fixture.select_load',mode=mode,load_resistance_ohm=1000.);observations[mode]=finish(h)['rows'] + records=[h.invoke('calibration.solve',frequency_hz=f,open_measured_ohm=observations['open'][i]['raw_impedance_ohm'],short_measured_ohm=observations['short'][i]['raw_impedance_ohm'],load_measured_ohm=observations['load'][i]['raw_impedance_ohm'],load_resistance_ohm=1000.) for i,f in enumerate(h.method['frequencies_hz'])] + h.invoke('calibration.apply',records=records);h.invoke('fixture.select_load',mode='sample',load_resistance_ohm=1000.);return observations,records + +def remove(h): + if h.phase=='running':h.invoke('acquisition.stop') + h.invoke('sample.set_clamp',closed=False);h.step(1.);h.invoke('sample.remove') +def sessions(h): + for n,role in [('student','agent'),('teacher','evaluator'),('other','agent')]:h.register_principal(n,role) + return h.session('student'),h.session('teacher'),h.session('other') +def call(s,c,a=None,rid='r1'):return s.invoke(instance_id=s._host.instance_id,capability_id=c,arguments=a or {},request_id=rid) +def snapshot(h):return json.dumps(dict(state=h.read(),plant=h.plant,sample=h.sample,geometry=h.geometry,thermal=h.thermal,ledger=h._ledger(),rows=h.rows,records=h.records,revision=h.revision,calibration=h.calibration,method=h.method,x=h.x.tolist(),detector=[r.pack(z) for z in h.detector]),sort_keys=True,allow_nan=False) + +class AlphaTests(unittest.TestCase): + def budget(self,h,tol=1e-8): + for k,v in h.invoke('ledger.read').items(): + if 'error' in k:self.assertLess(abs(v),tol,(k,v)) + def reject(self,h,k,**a): + before=snapshot(h) + with self.assertRaises(r.ActionRejected):h.invoke(k,**a) + self.assertEqual(snapshot(h),before) + def test_01_target_and_clamp_do_not_teleport(self): + h=make();before=h.x.copy();h.invoke('thermal.set_temperature',temperature_k=295.2);np.testing.assert_array_equal(h.x,before);h.invoke('sample.set_clamp',closed=False);self.assertEqual(h.clamp,0.);h.step(.5);self.assertAlmostEqual(h.clamp,.0125,12);self.assertGreater(h._temperature(0),293.2);self.budget(h) + def test_02_read_describe_zero_are_pure(self): + h=make();a,e,_=sessions(h);before=snapshot(h) + for _ in range(2):a.read(instance_id=h.instance_id);e.describe(asset_type_id=r.ASSET_TYPE_ID);h.step(0.) + self.assertEqual(snapshot(h),before) + def test_03_real_static_library_is_not_fake_spectra(self): + lib=r.library();self.assertGreaterEqual(len(lib),50) + for row in lib.values():self.assertGreater(row['relative_permittivity_static'],1.);self.assertTrue(row['source']);self.assertTrue(row['evidence']);self.assertEqual(row['curves'],[]);self.assertIsNone(row['relaxation_time_s']) + row=lib['water_crc_7732_18_5'];self.assertEqual(row['relative_permittivity_static'],80.1);self.assertEqual(row['reference_temperature_K'],293.2) + def test_04_c0_and_debye_series_rc_identity(self): + diameter=.02;thickness=.001;c0=r.vacuum_capacitance(diameter,thickness);self.assertAlmostEqual(c0,r.EPS0*math.pi*.01**2/.001,22);f=1000.;w=2*math.pi*f;delta=80.1-4.9;tau=1e-4;branch=1/(tau/(c0*delta)+1/(1j*w*c0*delta));expected=1j*w*c0*4.9+branch+5e-6*math.pi*.01**2/.001;actual=1j*w*c0*r.dielectric_response(80.1,4.9,tau,5e-6,f);self.assertAlmostEqual(abs(actual-expected),0.,20) + def test_05_inverse_uses_external_complex_vi_only(self): + h=Checked();out=h.invoke('analysis.dielectric',**r.ANALYSIS_EXAMPLE);c0=r.vacuum_capacitance(.02,.001);self.assertAlmostEqual(out['epsilon_real'],1e-6/(2*math.pi*1000*c0),9);self.assertAlmostEqual(out['tan_delta'],.01,12);self.assertIsNone(h.sample) + def test_06_source_fifty_ohm_loading(self): + h=make(method={'frequencies_hz':[4e7],'source_voltage_rms_v':1.});c=h._circuit(f=4e7);self.assertLess(abs(c['voltage']),.5);self.assertAlmostEqual(abs(complex(1.)-c['voltage']-50*c['current']),0.,12);self.assertEqual(r.SOURCE_RESISTANCE_OHM,50.) + def test_07_rms_active_power_has_no_half_factor(self): + h=make();c=h._circuit(f=1000.);generator,source,parasitic,reference,sample=c['power'];self.assertAlmostEqual(generator,(.3*c['current'].conjugate()).real,16);self.assertAlmostEqual(generator,source+parasitic+reference+sample,16);self.assertAlmostEqual(source,abs(c['current'])**2*50.,20) + def test_08_real_frequency_wait_and_point_order(self): + h=make();h.invoke('acquisition.start');self.assertEqual(h.rows,[]);h.step(.1);self.assertEqual(h.rows,[]);h.step(.010000001);self.assertEqual(len(h.rows),1);self.assertEqual(h.rows[0]['frequency_hz'],10.);h.step(h.expected_duration-h.elapsed);self.assertEqual(h.phase,'succeeded');self.assertEqual([row['frequency_hz'] for row in h.rows],h.method['frequencies_hz']);self.budget(h) + def test_09_minimum_frequency_requires_days_of_simulated_time(self): + h=make(method={'frequencies_hz':[3e-6],'settling_s':0.});h.invoke('acquisition.start');self.assertGreaterEqual(h.expected_duration,1/3e-6);h.step(1000.);self.assertEqual(h.rows,[]);remaining=h.expected_duration-h.elapsed + while remaining>0: + dt=min(86400.,remaining);h.step(dt);remaining-=dt + self.assertEqual(h.phase,'succeeded');self.assertEqual(len(h.rows),1);self.assertGreater(h.rows[0]['point_duration_s'],333333.);self.budget(h,1e-7) + def test_10_no_fast_option_rate(self): + h=make(method={'frequencies_hz':[1e6,2e6],'settling_s':0.});out=finish(h);self.assertTrue(all(row['point_duration_s']>=1/10.5 for row in out['rows']));self.assertGreater(h.expected_duration,.19) + def test_11_voltage_boundary_is_conservative(self): + h=make();h.invoke('method.configure',**dict(r.METHOD_EXAMPLE,frequencies_hz=[9999999.],source_voltage_rms_v=3.));self.reject(h,'method.configure',**dict(r.METHOD_EXAMPLE,frequencies_hz=[1e7],source_voltage_rms_v=1.00001));self.reject(h,'method.configure',**dict(r.METHOD_EXAMPLE,frequencies_hz=[4e7],source_voltage_rms_v=3.));h.invoke('method.configure',**dict(r.METHOD_EXAMPLE,frequencies_hz=[1e7,4e7],source_voltage_rms_v=1.));self.reject(h,'method.configure',**dict(r.METHOD_EXAMPLE,frequencies_hz=[4.01e7])) + def test_12_current_converter_overflow_is_not_clipping(self): + h=make(method={'frequencies_hz':[1000.],'source_voltage_rms_v':3.});h.invoke('fixture.select_load',mode='short',load_resistance_ohm=1000.);h.invoke('acquisition.start');self.assertGreater(abs(h._circuit()['current']),.04);self.assertEqual(h._observed(),(None,None));h.step(h.expected_duration);self.assertEqual(h.phase,'failed');self.assertEqual(h.error,'CURRENT_CONVERTER_OVERFLOW');self.assertIsNone(h.rows[0]['current_rms']);self.assertGreater(h.electrical_energy[1],0);self.budget(h) + def test_13_zero_excitation_has_no_fabricated_impedance(self): + h=make(method={'source_voltage_rms_v':0.});self.reject(h,'acquisition.start');self.assertEqual(h.electrical_energy.sum(),0.) + def test_14_actual_open_short_load_observations(self): + h=make();observations,records=calibrate(h);self.assertEqual(len(records),5);self.assertGreater(abs(r.unpack(observations['open'][2]['raw_impedance_ohm'])),1e6);self.assertLess(abs(r.unpack(observations['short'][2]['raw_impedance_ohm'])),1.);self.assertAlmostEqual(abs(r.unpack(observations['load'][2]['raw_impedance_ohm'])),1000.2,places=2);self.assertGreater(h._ledger()['reference_load_heat_j'],0);self.budget(h) + def test_15_external_osl_recovery_with_complex_gains(self): + h=make(plant={'voltage_gain_magnitude':1.12,'voltage_gain_phase_rad':.015,'current_gain_magnitude':.93,'current_gain_phase_rad':-.011});calibrate(h);h.invoke('method.configure',**dict(r.METHOD_EXAMPLE,require_calibration=True));o=finish(h) + for row in o['rows']: + expected=r.dielectric_response(80.1,4.9,1e-11,5e-6,row['frequency_hz']);self.assertTrue(row['calibration_applied']);self.assertLess(abs(row['epsilon_real']-expected.real),.01);self.assertLess(abs(row['epsilon_loss']+expected.imag)/max(abs(expected.imag),1.),1e-6) + self.budget(h) + def test_16_calibration_really_changes_observed_inverse(self): + h=make();uncorrected=finish(h)['rows'][-1]['epsilon_real'];calibrate(h);corrected=finish(h)['rows'][-1]['epsilon_real'];self.assertGreater(abs(uncorrected-80.1),.5);self.assertLess(abs(corrected-80.1),1e-5) + def test_17_missing_frequency_calibration_is_not_extrapolated(self): + h=make();calibrate(h);h.invoke('method.configure',**dict(r.METHOD_EXAMPLE,frequencies_hz=[123.],require_calibration=True));self.reject(h,'acquisition.start');h.invoke('calibration.clear');self.assertFalse(h.calibration) + def test_18_osl_external_solver_never_reads_hidden_state(self): + h=Checked();zseries=.5+2j;yp=1e-5+2e-5j;gain=1.2+.1j;raw=lambda z:gain*(zseries+1/(1/z+yp));zo=gain*(zseries+1/yp);zs=gain*zseries;zl=raw(1000.);fit=h.invoke('calibration.solve',frequency_hz=1000.,open_measured_ohm=r.pack(zo),short_measured_ohm=r.pack(zs),load_measured_ohm=r.pack(zl),load_resistance_ohm=1000.);unknown=1234.-987j;self.assertAlmostEqual(abs(r.correct_impedance(raw(unknown),fit)-unknown),0.,9);self.assertIsNone(h.plant) + def test_19_loss_conductivity_is_not_just_dc(self): + h=make(sample={'relaxation_time_s':1e-4,'dc_conductivity_s_m':0.},method={'frequencies_hz':[1000.]});calibrate(h);o=finish(h);row=o['rows'][0];self.assertGreater(row['conductivity_real_s_m'],0.);self.assertEqual(h.sample['dc_conductivity_s_m'],0.);self.assertAlmostEqual(row['conductivity_real_s_m'],2*math.pi*1000*r.EPS0*row['epsilon_loss'],15) + def test_20_zero_loss_ideal_debye_constant_passive(self): + e=r.dielectric_response(80.1,80.1,1e-4,0.,1000.);self.assertEqual(e.imag,0.);self.assertEqual(e.real,80.1) + def test_21_sample_loss_and_thermal_energy_balance(self): + h=make(method={'frequencies_hz':[1000.],'source_voltage_rms_v':1.,'cycles_per_point':1000});h.invoke('thermal.disable');T=h._temperature(1);finish(h);self.assertGreater(h._temperature(1),T);self.assertGreater(h._ledger()['sample_dielectric_heat_j'],0);self.budget(h) + def test_22_external_thermal_system_is_bounded_and_time_driven(self): + h=make(thermal={'heating_limit_w':.1});h.invoke('thermal.set_temperature',temperature_k=303.15);before=h.x[2];h.step(2.);self.assertAlmostEqual(h.x[2]-before,.2,8);self.budget(h);self.reject(h,'thermal.set_temperature',temperature_k=400.) + def test_23_loading_unloading_sensible_mass_volume(self): + h=make(plant={'ambient_k':293.15});expected_mass=1000*math.pi*.01**2*.001;self.assertAlmostEqual(h._mass(),expected_mass,15);self.assertAlmostEqual(h.loaded_sensible,expected_mass*4180*.05,10);self.budget(h);remove(h);self.assertEqual(h._volume(),0);self.assertAlmostEqual(h.mass_removed,expected_mass,15);self.assertGreater(h.removed_sensible,0);self.budget(h) + def test_24_loaded_geometry_is_immutable(self): + h=make();self.reject(h,'geometry.configure',diameter_m=.03,thickness_m=.001);remove(h);h.invoke('geometry.configure',diameter_m=.03,thickness_m=.001);h.invoke('sample.load',**r.SAMPLE_EXAMPLE);self.assertAlmostEqual(h._volume(),math.pi*.015**2*.001,18);self.budget(h) + def test_25_open_clamp_has_external_heat_boundary(self): + h=make();h.invoke('thermal.set_temperature',temperature_k=298.2);h.invoke('sample.set_clamp',closed=False);Ts=h._temperature(1);h.step(1.);self.assertEqual(h._temperature(1),Ts);self.assertGreater(h._temperature(0),Ts);self.budget(h) + def test_26_temperature_invalidates_static_reference(self): + h=make();h.invoke('thermal.set_temperature',temperature_k=298.2);h.step(20.);self.assertGreater(h._temperature(1),294.);self.reject(h,'acquisition.start');self.budget(h) + def test_27_cancel_freezes_complete_points_and_cuts_source(self): + h=make();h.invoke('acquisition.start');h.step(.15);h.invoke('acquisition.stop');rows=copy.deepcopy(h.rows);energy=h.electrical_energy.copy();self.assertEqual(len(rows),1);h.step(1.);self.assertEqual(h.rows,rows);np.testing.assert_array_equal(h.electrical_energy,energy);self.assertEqual(h.read()['excitation.source_voltage_rms_v'],0.);self.budget(h) + def test_28_power_off_retains_dissipated_heat(self): + h=make();h.invoke('acquisition.start');h.step(.05);h.invoke('power.set',enabled=False);energy=h.electrical_energy.copy();thermal=h.x.copy();h.step(1.);self.assertEqual(h.phase,'cancelled');np.testing.assert_array_equal(h.electrical_energy,energy);self.assertEqual(h.x[2],thermal[2]);self.assertEqual(h.read()['measured.current_rms_a'],None);self.budget(h) + def test_29_sixty_hz_partition_preserves_clock_and_rows(self): + a=make();b=make() + for h in (a,b):h.invoke('acquisition.start') + a.step(1.) + for _ in range(60):b.step(1/60) + self.assertEqual(a.time_ns,b.time_ns);self.assertEqual(a.rows,b.rows);np.testing.assert_allclose(a.x,b.x,rtol=1e-11,atol=1e-15);np.testing.assert_allclose(a.electrical_energy,b.electrical_energy,rtol=1e-13,atol=1e-20);self.budget(a);self.budget(b) + def test_30_invalid_arguments_are_atomic(self): + h=make() + for dt in [True,-1.,float('inf'),float('nan')]: + before=snapshot(h) + with self.assertRaises(r.ActionRejected):h.step(dt) + self.assertEqual(snapshot(h),before) + self.reject(h,'method.configure',**dict(r.METHOD_EXAMPLE,cycles_per_point=1.5));self.reject(h,'method.configure',**dict(r.METHOD_EXAMPLE,frequencies_hz=[100.,100.]));self.reject(h,'thermal.set_temperature',temperature_k=True);self.reject(h,'sample.set_clamp',closed=True,extra=1) + def test_31_busy_and_clamp_preconditions(self): + h=make();h.invoke('acquisition.start');self.reject(h,'sample.set_clamp',closed=False);self.reject(h,'fixture.select_load',mode='short',load_resistance_ohm=1000.);self.reject(h,'method.configure',**r.METHOD_EXAMPLE);self.reject(h,'calibration.clear');h.invoke('acquisition.stop');self.reject(h,'sample.remove') + def test_32_double_instances_are_independent(self): + a=make();b=make(sample={'reference_id':'ethanol_crc_64_17_5'});before=snapshot(b);finish(a);self.assertEqual(snapshot(b),before);calibrate(b);o=finish(b);self.assertLess(abs(o['rows'][-1]['epsilon_real']-25.3),1e-5) + def test_33_identity_and_hidden_state_filtering(self): + h=make();a,e,_=sessions(h);self.assertNotIn('truth.dc_conductivity_s_m',a.read(instance_id=h.instance_id)['observations']);self.assertIn('truth.sample_k',e.read(instance_id=h.instance_id)['observations']);self.assertNotIn('sample.load',a.describe(instance_id=h.instance_id)['capabilities']);self.assertEqual(call(a,'sample.load',r.SAMPLE_EXAMPLE)['error']['code'],'ACCESS_DENIED') + with self.assertRaises(r.ActionRejected):h.session('unknown') + with self.assertRaises(r.ActionRejected):a.read(instance_id=h.instance_id,state_ids=['truth.sample_k']) + def test_34_request_dedup_and_owner_cancellation(self): + h=make();a,e,b=sessions(h);start=call(a,'acquisition.start');self.assertEqual(start,call(a,'acquisition.start'));self.assertEqual(call(a,'power.set',{'enabled':True})['error']['code'],'REQUEST_CONFLICT');self.assertEqual(call(b,'acquisition.stop')['error']['code'],'ACCESS_DENIED');self.assertEqual(call(b,'power.set',{'enabled':False},'off')['error']['code'],'ACCESS_DENIED');h.step(.15);op=start['operation_id'];reply=a.cancel(op,'cancel');self.assertEqual(reply,a.cancel(op,'cancel'));self.assertEqual(a.poll(op)['status'],'cancelled') + def test_35_public_results_redacted_even_for_evaluator_forward(self): + h=make();a,e,_=sessions(h);op=call(a,'acquisition.start')['operation_id'];h.step(h.expected_duration) + for payload in [call(a,'acquisition.result',rid='a'),call(e,'acquisition.result',rid='e'),a.poll(op)]: + text=json.dumps(payload);self.assertNotIn('water_crc',text);self.assertNotIn('7732',text);self.assertNotIn('original_row',text) + self.assertEqual(call(a,'provenance.read',rid='p')['error']['code'],'ACCESS_DENIED');self.assertEqual(call(e,'provenance.read',rid='p')['result']['reference_id'],'water_crc_7732_18_5') + def test_36_source_snapshot_survives_new_sample(self): + h=make();old=finish(h);remove(h);self.assertIsNone(h.invoke('provenance.read')['reference_id']);h.invoke('sample.load',**dict(r.SAMPLE_EXAMPLE,reference_id='ethanol_crc_64_17_5'));self.assertEqual(h.invoke('acquisition.result'),old) + def test_37_assumptions_and_unsupported_are_explicit(self): + h=Checked();self.reject(h,'plant.configure',**dict(r.PLANT_EXAMPLE,accept_engineering=False));h.invoke('plant.configure',**r.PLANT_EXAMPLE);h.invoke('geometry.configure',**r.GEOMETRY_EXAMPLE);self.reject(h,'thermal.configure',**dict(r.THERMAL_EXAMPLE,accept_external_engineering_system=False));h.invoke('thermal.configure',**r.THERMAL_EXAMPLE);self.reject(h,'sample.load',**dict(r.SAMPLE_EXAMPLE,accept_spectrum_assumption=False));self.reject(h,'sample.load',**dict(r.SAMPLE_EXAMPLE,accept_thermal_assumption=False)) + for c in r.UNSUPPORTED:self.reject(h,c) + def test_38_degenerate_calibration_and_analysis_rejected(self): + h=make();same=dict(r.OSL_EXAMPLE,load_measured_ohm=r.OSL_EXAMPLE['short_measured_ohm']);self.reject(h,'calibration.solve',**same);self.reject(h,'analysis.dielectric',**dict(r.ANALYSIS_EXAMPLE,current_rms=r.pack(0.)));self.reject(h,'analysis.dielectric',**dict(r.ANALYSIS_EXAMPLE,current_rms=r.pack(-1j)));record=r.solve_osl(**r.OSL_EXAMPLE);self.reject(h,'calibration.apply',records=[record,record]) + def test_39_contract_schemas_and_actual_outputs(self): + h=make();meta=h.describe() + for key,c in meta['capabilities'].items():self.assertEqual(asset_tool.lint_schema(c['input_schema']),[],key);self.assertEqual(asset_tool.lint_schema(c['output_schema']),[],key);self.assertEqual(asset_tool.validate_value(c['example_arguments'],c['input_schema']),[],key) + for key,args,result in OBSERVED:self.assertEqual(asset_tool.validate_value(result,meta['capabilities'][key]['output_schema']),[],key) + for key,value in h.read().items():self.assertEqual(asset_tool.validate_value(value,meta['state_slots'][key]['value_schema']),[],key) + def test_40_all_implemented_session_entries(self): + h=Checked();h.register_principal('eval','evaluator');s=h.session('eval');seen=set();plan=[('plant.configure',r.PLANT_EXAMPLE),('geometry.configure',r.GEOMETRY_EXAMPLE),('thermal.configure',r.THERMAL_EXAMPLE),('sample.load',r.SAMPLE_EXAMPLE),('power.set',{'enabled':True}),('sample.set_clamp',{'closed':True}),('sim.step',{'dt_s':1.}),('thermal.set_temperature',{'temperature_k':293.2}),('method.configure',r.METHOD_EXAMPLE),('fixture.select_load',{'mode':'sample','load_resistance_ohm':1000.}),('calibration.solve',r.OSL_EXAMPLE),('calibration.apply',{'records':[r.solve_osl(**r.OSL_EXAMPLE)]}),('calibration.clear',{}),('acquisition.start',{}),('sim.step',{'dt_s':.15}),('acquisition.stop',{}),('acquisition.result',{}),('analysis.dielectric',r.ANALYSIS_EXAMPLE),('provenance.read',{}),('ledger.read',{}),('thermal.disable',{}),('sample.set_clamp',{'closed':False}),('sim.step',{'dt_s':1.}),('sample.remove',{}),('power.set',{'enabled':False})] + for i,(cap,args) in enumerate(plan): + reply=call(s,cap,args,str(i));self.assertIn(reply['status'],('succeeded','accepted'),(cap,reply));self.assertEqual(asset_tool.validate_value(reply['result'],r.CAPS[cap]['output_schema']),[],cap);seen.add(cap) + self.assertEqual(seen,set(r.CAPS)-set(r.UNSUPPORTED));self.budget(h) + + + def test_41_capacitance_lower_range_is_unavailable(self): + record=next(v for v in r.library().values() if v['relative_permittivity_static']<2.5 and v['reference_temperature_K']==293.2) + h=make(plant={'fixture_parallel_capacitance_f':1e-18,'fixture_parallel_conductance_s':0.,'fixture_series_resistance_ohm':0.,'fixture_series_inductance_h':0.},sample={'reference_id':record['id'],'epsilon_infinity':1.,'relaxation_time_s':1e-15,'dc_conductivity_s_m':0.},geometry={'diameter_m':.001,'thickness_m':.02},method={'frequencies_hz':[1000.]});out=finish(h);self.assertEqual(out['phase'],'failed');self.assertEqual(out['error_code'],'MEASUREMENT_RANGE');self.assertIsNone(out['rows'][0]['epsilon_real']);self.budget(h) + def test_42_impedance_upper_range_after_real_long_wait(self): + h=make(plant={'fixture_parallel_capacitance_f':1e-18,'fixture_parallel_conductance_s':0.},sample={'dc_conductivity_s_m':0.},method={'frequencies_hz':[3e-6],'settling_s':0.});out=finish(h);self.assertEqual(out['phase'],'failed');self.assertEqual(out['error_code'],'MEASUREMENT_RANGE');self.assertGreater(abs(r.unpack(out['rows'][0]['impedance_ohm'])),2e14);self.assertGreater(out['elapsed_s'],333333.);self.budget(h) + +if __name__=='__main__':unittest.main(verbosity=2) diff --git a/tests/test_asset_park_nx10.py b/tests/test_asset_park_nx10.py new file mode 100644 index 0000000000000000000000000000000000000000..26124ca5efcc1c8b174f273cd18d9f430360936c --- /dev/null +++ b/tests/test_asset_park_nx10.py @@ -0,0 +1,2018 @@ +"""tests for CHEM-158 park_nx10 (Park Systems NX10 AFM): python3 -m unittest tests/test_asset_park_nx10.py + +Topics (pipeline.md): set points only write targets, read/describe are pure, rejected preconditions leave the state unchanged, two instances +are isolated, agent/evaluator truth isolation (truth slots, template substances of the sample, evaluator-only warnings and fault events, +other agents' records and operations), conservation (electrical energy = 200 W x powered time, beam time, stage / scanner travel, line and +curve counts), real return values validated against the declared schemas (asset_tool lint_schema / validate_value), asynchronous completion +and cancellation remnants, host-step independence, declared immediate and on_step effects (scenario states, short and long windows); plus +the instrument (initialisation, SLD beam and PSPD alignment with the knobs, head removal and probe exchange, Z-stage interlock, touch stop and +crash, camera focus, collision guards, automatic approach and its failure modes) and the physics: sphere-cone tip dilation, the calibration +grating (step height 100 +- 7 nm and pitch), HOPG atomic steps, feedback dynamics (error with scan speed and gain, parachuting, oscillation +above the critical gain, Z-range saturation), noise floor with the acoustic enclosure and isolation, thermal drift after loading, tapping +phase contrast of a PS/PMMA blend, True Non-Contact operating point (drive side of the resonance), contact-mode indentation and tip wear, +force-distance curves (jump-in, DMT pull-off, humidity), thermal-tune spring constant and its error propagation from the sensitivity, +sensitivity from force curves, DMT fit of the modulus, frequency sweep, and SmartAnalysis-like flattening / roughness / profiles / steps. +""" +import copy +import json +import math +import sys +import unittest +from pathlib import Path + +import numpy as np + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / 'scripts')) +sys.path.insert(0, str(ROOT / 'skills/chemistry-lab-assets/scripts')) +from asset_runtime import park_nx10 as rt # noqa: E402 +import asset_tool # noqa: E402 + +CHECKS, PROCESS_EVIDENCE, REJECTIONS = [], {}, {} +_META = {} +_SC = {} + + +def _meta(): + if not _META: + _META.update(rt.export_park_nx10_contract_metadata()) + return _META + + +def _changed(a, b): + return json.dumps(a, sort_keys=True, default=str) != json.dumps(b, sort_keys=True, default=str) + + +_orig_invoke = rt.ParkNx10Runtime.invoke + + +def _instrumented_invoke(self, capability_id, **a): + """Every successful call is checked against its declared output schema and immediate state effects (a call does not advance time); every + rejection code is recorded for the declaration check.""" + before = self.read('evaluator') if capability_id != 'sim.step' else None + t0 = self.t + try: + out = _orig_invoke(self, capability_id, **a) + except rt.ActionRejected as exc: + REJECTIONS.setdefault(capability_id, set()).add(str(exc)) + raise + meta = _meta()['capabilities'][capability_id] + errs = asset_tool.validate_value(out, meta['output_schema']) + if errs: + raise AssertionError(f'{capability_id} output violates its schema: {errs[:3]}') + if before is not None: + assert self.t == t0, capability_id + after = self.read('evaluator') + undeclared = {k for k in after if _changed(before[k], after[k])} - set(rt.EFFECTS.get(capability_id, [])) + if undeclared: + raise AssertionError(f'{capability_id} changed undeclared state immediately: {sorted(undeclared)}') + PROCESS_EVIDENCE.setdefault(capability_id, []).append(dict(arguments=copy.deepcopy(a), result_keys=sorted(out))) + return out + + +rt.ParkNx10Runtime.invoke = _instrumented_invoke + +GRATING = dict(sample_id='grating', template_id='calibration_grating_xyz', seed=7, tilt_rad=[0.002, -0.001]) +HOPG = dict(sample_id='hopg', template_id='hopg', seed=3, tilt_rad=[0.0005, 0.0]) +MICA = dict(sample_id='mica', template_id='mica', seed=5, tilt_rad=[0.0, 0.0]) +BLEND = dict(sample_id='blend', template_id='ps_pmma_blend', seed=11, tilt_rad=[0.0, 0.0]) +AUNP = dict(sample_id='aunp', template_id='au_np_on_mica', seed=2, tilt_rad=[0.0, 0.0]) +SIO2 = dict(sample_id='sio2', template_id='sio2_on_si', seed=4, tilt_rad=[0.0, 0.0]) +PMMA = dict(sample_id='pmma', template_id='pmma_film_on_si', seed=6, tilt_rad=[0.0, 0.0]) +WAFER = dict(sample_id='wafer', template_id='si_wafer', seed=8, tilt_rad=[0.0, 0.0]) +TALL = dict(sample_id='tall', template_id='grating_1d_20nm', seed=9, tilt_rad=[0.0, 0.0], topography_overrides=dict(height_m=18e-6, pitch_m=10e-6, edge_width_m=4e-6)) +SAMPLES = (GRATING, HOPG, MICA, BLEND, AUNP, SIO2, PMMA, WAFER, TALL) +PROBES = (('tap1', 'ac160ts'), ('tap2', 'tap300al_g'), ('cont1', 'contal_g'), ('multi1', 'multi75al_g'), ('nc1', 'nchr')) +SCAN = dict(size_m=5e-6, pixels_x=64, pixels_y=64, rate_hz=2.0, angle_rad=0.0, offset_x_m=0.0, offset_y_m=0.0, setpoint_force_n=None, setpoint_amplitude_m=16e-9, + z_servo_gain=1.0, save_retrace=False, retract_after=False) + + +def configured(seed=1, samples=SAMPLES, probes=PROBES, **plant): + h = rt.ParkNx10Runtime() + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, noise_seed=seed, **plant)) + for s in samples: + h.invoke('sample.provide', **s) + for pid, tid in probes: + h.invoke('probe.provide', probe_id=pid, type_id=tid) + return h + + +def ready(seed=1, **kw): + h = configured(seed, **kw) + h.invoke('power.set', enabled=True) + h.step(rt.BOOT_S + 1.0) + return h + + +def settle(h, limit=600.0): + t = 0.0 + while (h._xy_moving() or h._z_moving() or h._f_moving() or h.head_move or h.exchange) and t < limit: + h.step(0.5) + t += 0.5 + assert not (h._xy_moving() or h._z_moving() or h._f_moving() or h.head_move or h.exchange) + return h + + +def mount(h, pid): + """Raise the Z stage, take the head off, exchange the probe, put the head back, switch the beam on (as an operator would).""" + if h.qz < 0.004: + h.invoke('z_stage.move', z_m=0.005) + settle(h) + if h.beam_switch: + h.invoke('beam.set', on=False) # manual: beam off before the head is unmounted + h.invoke('head.remove') + settle(h) + if h.mounted is not None: + h.invoke('probe.unmount') + settle(h) + h.invoke('probe.mount', probe_id=pid) + settle(h) + h.invoke('head.attach') + settle(h) + h.invoke('beam.set', on=True) + return h + + +def align(h, inset=12e-6): + """Agent-level beam alignment: centre the PSPD from the VERTICAL / LATERAL readings, put the SLD spot `inset` inside the cantilever end from + the camera, centre the PSPD again (knob gains as declared).""" + def centre(): + from scipy.special import erfinv + for _ in range(3): + r = h.read() + I = r['pspd.intensity_v'] + for knob, key in (('pspd_y', 'pspd.vertical_v'), ('pspd_x', 'pspd.lateral_v')): + v = h.read()[key] + u = float(erfinv(max(-0.999, min(0.999, v / I)))) * rt.PSPD_SPOT_W_M + h.invoke('head.turn_knob', knob=knob, turns=max(-5.0, min(5.0, -u / rt.KNOB_PSPD_M_PER_TURN))) + centre() + cam = h.invoke('camera.read') + dx, dy = cam['spot_offset_m'] + h.invoke('head.turn_knob', knob='beam_x', turns=(-inset - dx) / rt.KNOB_BEAM_M_PER_TURN) + h.invoke('head.turn_knob', knob='beam_y', turns=-dy / rt.KNOB_BEAM_M_PER_TURN) + centre() + return h + + +def dynamic(h, mode='tapping', db=None, above=1.0003, amplitude=20e-9): + """Configure a dynamic mode, sweep the resonance and set the drive slightly above the peak.""" + pr = h._probe() + db = db or pr['type_id'] + h.invoke('head.configure', mode=mode, cantilever_db=db) + f0 = rt.probe_nominal(db)['f0'] + op = h.invoke('ncm.frequency_sweep', start_hz=0.7 * f0, stop_hz=1.3 * f0, points=2048)['operation_id'] + wait(h, op) + rec = h.records[h.operations[op]['record_id']] + fpk = rec['data']['peak_hz'] + op = h.invoke('ncm.frequency_sweep', start_hz=fpk * 0.99, stop_hz=fpk * 1.01, points=1024)['operation_id'] + wait(h, op) + fpk = h.records[h.operations[op]['record_id']]['data']['peak_hz'] + h.invoke('ncm.set_drive', frequency_hz=fpk * above, amplitude_m=amplitude) + return h + + +def wait(h, op, tmax=4000.0, dt=1.0): + t = 0.0 + while h.operations[op]['phase'] == 'running' and t < tmax: + h.step(dt) + t += dt + assert h.operations[op]['phase'] != 'running', op + rid = h.operations[op]['record_id'] + return h.records[rid] if rid else h.operations[op] + + +def near(h, gap=100e-6): + """Lower the Z stage to `gap` above the surface under the tip (the operator judges it from the camera focus; here from the touch point).""" + h.invoke('z_stage.move', z_m=h._touch_point() + gap) + return settle(h) + + +def engage(h, sample=GRATING, mode='tapping', setpoint=16e-9, gain=1.0, offset=(0.0, 0.0)): + if h.on_chuck == sample['sample_id'] and h.engaged is not None: + return h, None + if h.on_chuck != sample['sample_id']: + if h.on_chuck is not None: + if h.engaged is not None: + h.invoke('retract', distance_m=100e-6) + h.invoke('z_stage.move', z_m=min(rt.Z_STAGE_LIMITS_M[1], h.qz + 0.004)) + settle(h) + h.invoke('sample.remove', sample_id=h.on_chuck) + h.invoke('sample.place', sample_id=sample['sample_id'], offset_x_m=offset[0], offset_y_m=offset[1]) + near(h) + a = dict(setpoint_force_n=setpoint if mode == 'contact' else None, setpoint_amplitude_m=None if mode == 'contact' else setpoint, z_servo_gain=gain) + op = h.invoke('approach', **a)['operation_id'] + wait(h, op) + return h, op + + +def tapping_engaged(seed=1, sample=GRATING, probe='tap1', **kw): + h = ready(seed, **kw) + mount(h, probe) + align(h) + dynamic(h) + engage(h, sample) + assert h.engaged is not None + return h + + +def contact_engaged(seed=1, sample=GRATING, probe='cont1', setpoint=5e-9, **kw): + h = ready(seed, **kw) + mount(h, probe) + align(h) + h.invoke('head.configure', mode='contact', cantilever_db=h._probe()['type_id']) + engage(h, sample, mode='contact', setpoint=setpoint) + assert h.engaged is not None + return h + + +def scan(h, **kw): + a = dict(SCAN, **kw) + if h.mode == 'contact': + a['setpoint_amplitude_m'] = None + a['setpoint_force_n'] = a['setpoint_force_n'] or 5e-9 + op = h.invoke('scan.start', **a)['operation_id'] + return wait(h, op, dt=5.0) + + +def img(rec, ch='height', d='trace', flatten='none'): + return rt.flatten_image(np.asarray(rec['data'][ch][d], float)[:rec['meta']['lines_completed']], flatten) + + +def rejected(h, cap, code, **a): + before = h.read('evaluator') + rev = h.revision + led = h.ledger() + try: + h.invoke(cap, **a) + except rt.ActionRejected as exc: + assert str(exc) == code, (cap, str(exc), code) + assert not _changed(h.read('evaluator'), before), cap + assert h.revision == rev, cap + assert not _changed(h.ledger(), led), cap + return True + raise AssertionError(f'{cap} was not rejected (expected {code})') + + +def set_true_calibration(h): + """Evaluator shortcut: write the hidden true k and sensitivity into the calibration table (to test physics independent of calibration).""" + pr = h._probe() + h.invoke('calibration.set', spring_constant_n_m=pr['truth']['k'], sensitivity_v_per_m=h._optics()['S']) + + +def _close(a, b, rel=1e-9): + if isinstance(a, dict) and isinstance(b, dict): + return a.keys() == b.keys() and all(_close(a[k], b[k], rel) for k in a) + if isinstance(a, (list, tuple)) and isinstance(b, (list, tuple)): + return len(a) == len(b) and all(_close(x, y, rel) for x, y in zip(a, b)) + if isinstance(a, float) or isinstance(b, float): + if isinstance(a, float) and isinstance(b, float) and math.isnan(a) and math.isnan(b): + return True + return abs(a - b) <= rel * max(abs(a), abs(b), 1e-300) + return a == b + + +# ---------------------------------------------------------------- scenario states (declared-effect checks) +def _build(name): + if name == 'fresh': + return configured() + if name == 'booting': + h = configured() + h.invoke('power.set', enabled=True) + h.step(5.0) + return h + if name == 'ready': + return ready() + if name == 'head_off': + h = ready() + h.invoke('z_stage.move', z_m=0.005) + settle(h) + h.invoke('head.remove') + return settle(h) + if name == 'head_off_mounted': + h = _build('mounted') + h.invoke('head.remove') + return settle(h) + if name == 'exchanging': + h = _build('head_off') + h.invoke('probe.mount', probe_id='tap1') + h.step(5.0) + return h + if name == 'mounted': + h = ready() + return mount(h, 'tap1') + if name == 'aligned': + h = mount(ready(), 'tap1') + align(h) + dynamic(h) + h.invoke('sample.place', sample_id='grating', offset_x_m=0.0, offset_y_m=0.0) + return h + if name == 'near': + return near(_build('aligned')) + if name == 'approaching': + h = _build('near') + h.invoke('approach', setpoint_force_n=None, setpoint_amplitude_m=16e-9, z_servo_gain=1.0) + h.step(1.0) + return h + if name == 'engaged': + h = _build('near') + wait(h, h.invoke('approach', setpoint_force_n=None, setpoint_amplitude_m=16e-9, z_servo_gain=1.0)['operation_id']) + return h + if name == 'scanning': + h = _build('engaged') + h.invoke('scan.start', **dict(SCAN, pixels_y=64, rate_hz=2.0)) + h.step(12.0) + return h + if name == 'scanned': + h = _build('engaged') + scan(h) + return h + if name == 'fd_running': + h = _build('scanned') + h.invoke('fd.acquire', z_range_m=100e-9, rate_hz=1.0, trigger_force_n=300e-9, dwell_s=0.0, count=4, positions_m=[[0.0, 0.0]]) + h.step(1.5) + return h + if name == 'fd_done': + h = _build('scanned') + wait(h, h.invoke('fd.acquire', z_range_m=100e-9, rate_hz=1.0, trigger_force_n=300e-9, dwell_s=0.0, count=2, positions_m=[[0.0, 0.0]])['operation_id']) + return h + if name == 'tuning': + h = _build('aligned') + h.invoke('calibration.thermal_tune', temperature_k=295.15, averages=50) + h.step(2.0) + return h + if name == 'sweeping': + h = _build('aligned') + h.invoke('ncm.frequency_sweep', start_hz=250e3, stop_hz=330e3, points=512) + h.step(2.0) + return h + if name == 'contact_engaged': + return contact_engaged(sample=SIO2) + if name == 'nc_engaged': + h = mount(ready(), 'nc1') + align(h) + dynamic(h, mode='non_contact', amplitude=10e-9, above=1.0008) + engage(h, SIO2, setpoint=9.5e-9) + return h + if name == 'moving': + h = _build('aligned') + h.invoke('stage.move_xy', x_m=0.004, y_m=-0.002) + h.invoke('focus.move', position_m=0.010) + h.step(0.5) + return h + if name == 'z_moving': + h = _build('aligned') + h.invoke('z_stage.move', z_m=0.008) + h.step(0.5) + return h + if name == 'sld_fault': + h = _build('engaged') + h.invoke('fault.inject', fault='sld_failure', active=True) + return h + if name == 'sld_cleared': + h = _build('sld_fault') + h.invoke('fault.inject', fault='sld_failure', active=False) + return h + if name == 'z_stall': + h = _build('aligned') + h.invoke('fault.inject', fault='z_stage_stall', active=True) + h.invoke('z_stage.move', z_m=0.008) + return h + if name == 'burst': + h = _build('engaged') + h.invoke('fault.inject', fault='vibration_burst', active=True) + return h + if name == 'unpowered_mounted': + h = _build('aligned') + h.invoke('power.set', enabled=False) + return h + raise KeyError(name) + + +def _scenario(name): + if name not in _SC: + _SC[name] = _build(name) + return copy.deepcopy(_SC[name]) + + +SCENARIOS = ['fresh', 'booting', 'ready', 'head_off', 'head_off_mounted', 'exchanging', 'mounted', 'aligned', 'near', 'approaching', 'engaged', 'scanning', 'scanned', 'fd_running', + 'fd_done', 'tuning', 'sweeping', 'contact_engaged', 'nc_engaged', 'moving', 'z_moving', 'sld_fault', 'sld_cleared', 'z_stall', 'burst', 'unpowered_mounted'] +LONG_SCENARIOS = ['ready', 'aligned', 'near', 'engaged', 'scanned', 'contact_engaged'] +STEP_DTS = (0.4, 3.0, 25.0) + + +def _variants(cap): + V = { + 'plant.configure': [dict(rt.PLANT_EXAMPLE), dict(rt.PLANT_EXAMPLE, noise_seed=2, humidity=0.7, acoustic_enclosure=False, vibration_isolation=False)], + 'sample.provide': [dict(rt.SAMPLE_EXAMPLE, sample_id='new')], + 'probe.provide': [dict(probe_id='newp', type_id='nchr')], + 'sample.place': [dict(sample_id='grating', offset_x_m=0.0, offset_y_m=0.0), dict(sample_id='mica', offset_x_m=0.002, offset_y_m=0.0)], + 'sample.remove': [dict(sample_id='grating')], + 'power.set': [dict(enabled=True), dict(enabled=False)], 'power.press_button': [{}], + 'beam.set': [dict(on=True), dict(on=False)], 'beam.press_switch': [{}], + 'head.remove': [{}], 'head.attach': [{}], 'probe.mount': [dict(probe_id='tap1'), dict(probe_id='tap2')], 'probe.unmount': [{}], + 'head.configure': [dict(mode='tapping', cantilever_db='ac160ts'), dict(mode='contact', cantilever_db='contal_g')], + 'head.turn_knob': [dict(knob='beam_x', turns=0.1), dict(knob='pspd_y', turns=-0.5), dict(knob='optics_x', turns=1.0)], + 'head.set_knob': [dict(knob='beam_y', turns_total=0.2), dict(knob='pspd_x', turns_total=-1.0)], + 'stage.move_xy': [dict(x_m=0.003, y_m=0.0), dict(x_m=0.0, y_m=0.0)], + 'z_stage.move': [dict(z_m=0.006), dict(z_m=-0.0099)], + 'focus.move': [dict(position_m=0.004)], + 'ncm.frequency_sweep': [dict(start_hz=250e3, stop_hz=330e3, points=256)], + 'ncm.set_drive': [dict(frequency_hz=287.5e3, amplitude_m=20e-9)], + 'approach': [dict(setpoint_force_n=None, setpoint_amplitude_m=16e-9, z_servo_gain=1.0), dict(setpoint_force_n=5e-9, setpoint_amplitude_m=None, z_servo_gain=1.0)], + 'retract': [dict(distance_m=100e-6)], + 'scan.start': [dict(SCAN, pixels_y=32), dict(SCAN, pixels_y=32, setpoint_force_n=5e-9, setpoint_amplitude_m=None)], + 'fd.acquire': [dict(z_range_m=100e-9, rate_hz=2.0, trigger_force_n=100e-9, dwell_s=0.0, count=1, positions_m=[[0.0, 0.0]])], + 'calibration.thermal_tune': [dict(temperature_k=295.15, averages=20)], + 'calibration.sensitivity': [dict(record_id='FD0001', curve_index=0, branch='approach')], + 'calibration.set': [dict(spring_constant_n_m=30.0, sensitivity_v_per_m=None)], + 'analysis.flatten': [dict(record_id='IMG0001', channel='height', direction='trace', method='plane')], + 'analysis.roughness': [dict(record_id='IMG0001', channel='height', direction='trace', flatten='plane', region_px=None)], + 'analysis.line_profile': [dict(record_id='IMG0001', channel='height', direction='trace', flatten='plane', start_px=[0, 10], end_px=[60, 10], points=64)], + 'analysis.step_height': [dict(record_id='IMG0001', channel='height', direction='trace', flatten='plane_upper', method='histogram', region_a_px=None, region_b_px=None)], + 'analysis.fd_fit': [dict(record_id='FD0001', curve_index=0, branch='retract', model='dmt', tip_radius_m=10e-9, sample_poisson_ratio=0.17, tip_modulus_pa=169e9, + tip_poisson_ratio=0.27)], + 'records.delete': [dict(record_id='IMG0001'), dict(record_id='FS0001'), dict(record_id='FD0001')], + 'system.acknowledge': [{}], + 'fault.inject': [dict(fault=f, active=True) for f in rt.FAULTS] + [dict(fault=f, active=False) for f in rt.FAULTS], + 'sim.step': [dict(dt_s=0.5), dict(dt_s=30.0)], + } + return V.get(cap, []) + + +def _num(x): + return isinstance(x, (int, float)) and not isinstance(x, bool) + + +def _flat(v, prefix=''): + out = {} + if isinstance(v, dict): + for k, x in v.items(): + out.update(_flat(x, f'{prefix}.{k}')) + elif isinstance(v, list) and len(v) <= 64: + for i, x in enumerate(v): + out.update(_flat(x, f'{prefix}[{i}]')) + else: + out[prefix] = json.dumps(v, sort_keys=True, default=str) if isinstance(v, list) else v + return out + + +def _rel_changed(a, b, scale=None): + if _num(a) and _num(b): + return abs(a - b) > 1e-9 * (max(abs(a), abs(b)) if scale is None else scale) + 1e-300 + return _changed(a, b) + + +def _leaf_changed(a, b): + fa, fb = _flat(a), _flat(b) + return any(_rel_changed(fa.get(k, ''), fb.get(k, '')) for k in set(fa) | set(fb)) + + +def _step_differs(v1, a2, v0, b2): + """Does the step change the value differently with the call (v1 -> a2) than without it (v0 -> b2)? (leaf-wise, numeric increments)""" + f1, fa, f0, fb = _flat(v1), _flat(a2), _flat(v0), _flat(b2) + for leaf in set(f1) | set(fa) | set(f0) | set(fb): + x1, xa, x0, xb = (f.get(leaf, '') for f in (f1, fa, f0, fb)) + ca, cb = _rel_changed(x1, xa), _rel_changed(x0, xb) + if not (ca or cb): + continue + if ca and cb and all(_num(x) for x in (x1, xa, x0, xb)) and not _rel_changed(xa - x1, xb - x0, max(abs(x1), abs(xa), abs(x0), abs(xb))): + continue + if ca and cb and (x1, xa) == (x0, xb): + continue + if ca and cb and x1 == x0 and not _rel_changed(xa, xb): + continue + return True + return False + + +def _executable(cap): + return cap not in rt.UNSUPPORTED and rt.CAPS[cap]['kind'] != 'query' + + +# ---------------------------------------------------------------- contract and schemas +class ContractAndSchemas(unittest.TestCase): + def test_module_identity(self): + self.assertEqual(rt.ASSET_TYPE_ID, 'instrument.park_nx10') + self.assertEqual(rt.CATALOG_ID, 'CHEM-158') + self.assertEqual(rt.XY_SCAN_RANGE_M, 50e-6) + self.assertEqual(rt.Z_SCAN_RANGE_M, 15e-6) + self.assertEqual(2 * rt.XY_STAGE_HALF_M, 0.020) + self.assertEqual(rt.Z_STAGE_RANGE_M, 0.025) + self.assertAlmostEqual(rt.Z_STAGE_LIMITS_M[1] - rt.Z_STAGE_LIMITS_M[0], rt.Z_STAGE_RANGE_M, places=12) + self.assertEqual((rt.SAMPLE_OPEN_MAX_M, rt.SAMPLE_MAX_THICKNESS_M), (0.100, 0.020)) + self.assertEqual(len(rt.nanomech()['subs']), 66) + self.assertGreaterEqual(len(rt.probes()['types']), 12) + self.assertEqual(len(rt.sample_templates()['templates']), 15) + + def test_schemas_lint_and_examples_validate(self): + m = _meta() + for k, c in m['capabilities'].items(): + for part in ('input_schema', 'output_schema'): + self.assertEqual(asset_tool.lint_schema(c[part]), [], (k, part)) + ex = rt.CAPS[k].get('example_arguments') + if ex is not None: + self.assertEqual(asset_tool.validate_value(ex, c['input_schema']), [], k) + rt.validate(rt.CAPS[k]['input_schema'], ex) + for k, s in m['state_slots'].items(): + self.assertEqual(asset_tool.lint_schema(s['value_schema']), [], k) + for name in ('fresh', 'ready', 'aligned', 'engaged', 'scanning', 'scanned', 'fd_done', 'contact_engaged', 'nc_engaged', 'sld_fault'): + v = _scenario(name).read('evaluator') + for k, x in v.items(): + self.assertEqual(asset_tool.validate_value(x, m['state_slots'][k]['value_schema']), [], (name, k)) + h = _scenario('fd_done') + for rid in h.records: + out = h.invoke('measurement.result', record_id=rid, channel=None, direction=None, region_px=None, max_values=4096) + self.assertEqual(asset_tool.validate_value(out, m['capabilities']['measurement.result']['output_schema']), [], rid) + + def test_metadata_references_are_consistent(self): + m = _meta() + slots = set(m['state_slots']) + for k, c in m['capabilities'].items(): + for e in c['state_effects']: + self.assertIn(e['state_id'], slots, (k, e)) + for x in c['observes']: + self.assertIn(x, slots, (k, x)) + for pre in c['preconditions']: + for x in pre['state_ids']: + self.assertIn(x, slots, (k, x)) + for x in c['execution']['completion_state_ids']: + self.assertIn(x, slots, (k, x)) + codes = [e['code'] for e in c['errors']] + self.assertEqual(len(codes), len(set(codes)), k) + for e in c['errors']: + self.assertIn(e['code'], rt.ERROR_ZH, (k, e['code'])) + for k in rt.CAPS: + self.assertIn(k, rt.CAP_SOURCES, k) + self.assertEqual(set(rt.PRECONDITIONS) - set(rt.CAPS), set()) + for k, v in list(rt.EFFECTS.items()) + list(rt.ON_STEP.items()): + self.assertIn(k, rt.CAPS) + self.assertEqual(set(v) - slots, set(), k) + for mech in m['mechanisms'].values(): + self.assertEqual(set(mech['state_ids']) - slots, set()) + manifest = ROOT / 'assets/expansion_batch04/t3_analytical/park_nx10/geometry_manifest.json' + raw = json.loads(manifest.read_text()).get('components', []) if manifest.exists() else [] + comps = set(raw) if isinstance(raw, dict) else {c['id'] for c in raw} + if len(comps) > 5: # the real geometry (not the scaffold box) + used = {c for v in m['capabilities'].values() for c in v['component_ids']} | {s['component_ids'][0] for s in m['state_slots'].values()} + self.assertEqual(used - comps, set()) + + def test_unsupported_capabilities_report_unsupported(self): + h = ready() + for k in rt.UNSUPPORTED: + with self.assertRaises(rt.ActionRejected) as cm: + _orig_invoke(h, k) + self.assertEqual(str(cm.exception), 'UNSUPPORTED') + self.assertEqual(_meta()['capabilities'][k]['availability'], 'unsupported') + h.register_principal('agent', 'agent') + s = h.session('agent') + r = s.invoke(instance_id=h.instance_id, capability_id='kpfm.scan', arguments={'bias_v': 1.0}, request_id='u1') + self.assertEqual((r['status'], r['error']['code']), ('unsupported', 'UNSUPPORTED')) + + def test_libraries_carry_evidence(self): + for s in rt.nanomech()['subs'].values(): + for f in ('youngs_modulus', 'poisson_ratio', 'ambient_surface_energy', 'water_contact_angle', 'hamaker_constant', 'loss_tangent'): + self.assertIn(s[f]['evidence'], ('documented', 'derived', 'assumption'), (s['substance_id'], f)) + self.assertTrue(s[f]['source_ids'], (s['substance_id'], f)) + for t in rt.sample_templates()['templates'].values(): + for k, v in t['topography'].items(): + if isinstance(v, dict): + self.assertIn(v['evidence'], ('documented', 'assumption'), (t['template_id'], k)) + for pid in rt.probes()['types']: + nom = rt.probe_nominal(pid) + self.assertGreater(nom['L'], 20e-6, pid) + self.assertLess(nom['L'], 600e-6, pid) + c = rt.BEAM_FACTOR * math.sqrt((rt.E_SIN if nom['material'] == 'Si3N4' else rt.E_SI) / (rt.RHO_SIN if nom['material'] == 'Si3N4' else rt.RHO_SI)) + if 'length_m' in nom['derived'] and 'thickness_m' in nom['derived']: + E = rt.E_SIN if nom['material'] == 'Si3N4' else rt.E_SI + self.assertAlmostEqual(E * nom['w'] * nom['t'] ** 3 / (4 * nom['L'] ** 3) / nom['k'], 1.0, places=6) + self.assertAlmostEqual(c * nom['t'] / nom['L'] ** 2 / nom['f0'], 1.0, places=6) + + +# ---------------------------------------------------------------- host clock and purity +class HostClockAndPurity(unittest.TestCase): + def test_read_and_describe_do_not_advance_time(self): + h = _scenario('scanning') + h.register_principal('agent', 'agent') + s = h.session('agent') + t, rev = h.t, h.revision + before = h.read('evaluator') + for _ in range(3): + s.read(instance_id=h.instance_id) + s.describe(instance_id=h.instance_id) + h.invoke('camera.read') + h.invoke('records.list') + self.assertEqual((h.t, h.revision), (t, rev)) + self.assertFalse(_changed(before, h.read('evaluator'))) + + def test_step_zero_and_negative(self): + h = _scenario('engaged') + t = h.t + h.step(0.0) + self.assertEqual(h.t, t) + for bad in (-1.0, float('nan'), float('inf'), rt.MAX_STEP_S * 2, True): + with self.assertRaises(rt.ActionRejected): + h.step(bad) + self.assertEqual(h.t, t) + + def test_host_step_chopping_does_not_change_the_result(self): + """The same scan, force curves and drift with coarse and fine host steps: identical images and curves (blocks of 16 lines, per-line noise).""" + outs = [] + for chop in (0.37, 7.0, 40.0): + h = _scenario('engaged') + op = h.invoke('scan.start', **dict(SCAN, pixels_y=48))['operation_id'] + t = 0.0 + while h.operations[op]['phase'] == 'running': + h.step(chop) + t += chop + rec = h.records[h.operations[op]['record_id']] + op2 = h.invoke('fd.acquire', z_range_m=100e-9, rate_hz=2.0, trigger_force_n=100e-9, dwell_s=0.1, count=3, positions_m=[[0.0, 0.0]])['operation_id'] + while h.operations[op2]['phase'] == 'running': + h.step(chop) + fd = h.records[h.operations[op2]['record_id']] + h.step(123.4 - (h.t % 1.0)) + outs.append((img(rec), img(rec, 'phase'), fd['data']['curves'][2]['deflection_retract_v'], h._probe()['radius'], h.read('evaluator')['truth.drift_m'])) + for o in outs[1:]: + self.assertTrue(np.allclose(o[0], outs[0][0], rtol=0, atol=1e-15)) + self.assertTrue(np.allclose(o[1], outs[0][1], rtol=0, atol=1e-12)) + self.assertTrue(np.allclose(o[2], outs[0][2], rtol=0, atol=1e-12)) + self.assertAlmostEqual(o[3], outs[0][3], delta=1e-18) + + def test_reads_do_not_change_later_results(self): + a, b = _scenario('engaged'), _scenario('engaged') + oa = a.invoke('scan.start', **SCAN)['operation_id'] + ob = b.invoke('scan.start', **SCAN)['operation_id'] + for _ in range(10): + a.read('evaluator') + a.invoke('camera.read') + a.step(3.3) + b.step(3.3) + wait(a, oa) + wait(b, ob) + self.assertTrue(np.array_equal(img(a.records['IMG0001']), img(b.records['IMG0001']))) + + def test_set_points_only_write_targets(self): + h = _scenario('aligned') + xy, qz, qf = list(h.xy), h.qz, h.qf + r = h.invoke('stage.move_xy', x_m=0.004, y_m=-0.003) + self.assertEqual(h.xy, xy) + self.assertEqual(h.read()['stage.xy_target_m'], [0.004, -0.003]) + self.assertAlmostEqual(r['duration_s'], math.hypot(0.004, 0.003) / rt.XY_STAGE_SPEED_M_S) + rejected(h, 'z_stage.move', 'MOTION_IN_PROGRESS', z_m=qz + 0.001) # one motorized stage at a time (F13) + settle(h) + self.assertTrue(np.allclose(h.read()['stage.xy_m'], [0.004, -0.003], atol=1e-12)) + h.invoke('z_stage.move', z_m=qz + 0.001) + rejected(h, 'stage.move_xy', 'MOTION_IN_PROGRESS', x_m=0.0, y_m=0.0) + h.invoke('focus.move', position_m=0.012) + self.assertEqual((h.qz, h.qf), (qz, qf)) + h.step(0.5) + self.assertAlmostEqual(h.qz, qz + 0.5 * rt.Z_STAGE_MAX_SPEED_M_S, places=12) + self.assertAlmostEqual(h.qf, qf + 0.5 * rt.FOCUS_SPEED_M_S, places=12) + settle(h) + self.assertAlmostEqual(h.qz, qz + 0.001, places=12) + self.assertAlmostEqual(h.qf, 0.012, places=12) + # the resolution of the XY stage (5 um) rounds the target + self.assertAlmostEqual(h.invoke('stage.move_xy', x_m=0.0012344, y_m=0.0)['target_m'][0], 0.001235, places=15) + + +# ---------------------------------------------------------------- instrument +class PowerBeamHeadProbe(unittest.TestCase): + def test_boot_power_beam_and_power_loss(self): + h = configured() + rejected(h, 'head.configure', 'POWER_OFF', mode='tapping', cantilever_db='ac160ts') + h.invoke('power.set', enabled=True) + self.assertEqual(h.state, 'booting') + rejected(h, 'stage.move_xy', 'NOT_READY', x_m=0.001, y_m=0.0) + h.step(rt.BOOT_S - 0.5) + self.assertEqual(h.state, 'booting') + h.step(1.0) + self.assertEqual(h.state, 'ready') + mount(h, 'tap1') + self.assertTrue(h.read()['beam.emitting']) + h.invoke('beam.press_switch') + self.assertFalse(h.read()['beam.emitting']) + self.assertEqual(h.read()['pspd.intensity_v'], 0.0) + h.invoke('beam.press_switch') + align(h) + dynamic(h) + engage(h) + op = h.invoke('scan.start', **SCAN)['operation_id'] + rejected(h, 'beam.set', 'MEASUREMENT_RUNNING', on=False) + h.step(20.0) + h.invoke('power.set', enabled=False) + rec = h.records[h.operations[op]['record_id']] + self.assertEqual((h.operations[op]['phase'], rec['status']), ('failed', 'failed')) + self.assertEqual(rec['meta']['lines_completed'], 40) # the lines scanned before the power loss are kept + self.assertTrue(np.isfinite(img(rec)).all()) + self.assertIsNone(h.engaged) + self.assertEqual(h.read()['zscanner.extension_m'], 0.0) + self.assertFalse(h.read()['beam.emitting']) + + def test_head_removal_probe_exchange_and_prealignment(self): + h = ready() + rejected(h, 'probe.mount', 'HEAD_ATTACHED', probe_id='tap1') + h.invoke('sample.place', sample_id='grating', offset_x_m=0.0, offset_y_m=0.0) + rejected(h, 'z_stage.move', 'INTENSITY_LOW', z_m=rt.Z_STAGE_LIMITS_M[0]) # no probe: the interlock stops the descent + h.invoke('head.remove') + self.assertEqual(h.read()['head.state'], 'moving') + rejected(h, 'head.attach', 'MOTION_IN_PROGRESS') + h.step(rt.HEAD_SWAP_S) + self.assertEqual(h.read()['head.state'], 'removed') + h.invoke('probe.mount', probe_id='tap1') + self.assertTrue(h.read()['probe.exchanging']) + rejected(h, 'probe.mount', 'MOTION_IN_PROGRESS', probe_id='tap2') + h.step(rt.PROBE_MOUNT_S) + self.assertEqual(h.read()['probe.mounted'], dict(probe_id='tap1', type_id='ac160ts')) + rejected(h, 'probe.mount', 'PROBE_MOUNTED', probe_id='tap2') + h.invoke('head.attach') + settle(h) + h.invoke('beam.set', on=True) + cam = h.invoke('camera.read') + self.assertTrue(cam['cantilever_in_view'] and cam['spot_visible']) + off = cam['spot_offset_m'] + self.assertLess(abs(off[0] + rt.PREALIGN_INSET_M), 4 * rt.PREALIGN_SIGMA_M) # pre-aligned: the spot lands near the end + self.assertLess(abs(off[1]), 4 * rt.PREALIGN_SIGMA_M) + self.assertGreater(h.read()['pspd.intensity_v'], 0.5) + # a second probe of the same box: new mounting offsets, the knobs keep their positions + k0 = dict(h.knobs) + h.invoke('z_stage.move', z_m=0.005) + settle(h) + h.invoke('beam.set', on=False) + h.invoke('head.remove') + settle(h) + h.invoke('probe.unmount') + settle(h) + self.assertIn('tap1', h.read()['probe.box_ids']) + h.invoke('probe.mount', probe_id='tap2') + settle(h) + h.invoke('head.attach') + settle(h) + h.invoke('beam.set', on=True) + self.assertEqual(h.knobs, k0) + self.assertEqual(h.faults, set()) + self.assertNotEqual(h.invoke('camera.read')['spot_offset_m'], off) + self.assertEqual(h.ledger()['probe_exchanges'], 3.0) + self.assertEqual(h.ledger()['head_swaps'], 4.0) + + def test_head_handling_rules_of_the_manual(self): + h = mount(ready(), 'tap1') + h.invoke('z_stage.move', z_m=0.006) + settle(h) + h.invoke('focus.move', position_m=rt.FOCUS_REF_M + 0.003) + settle(h) + rejected(h, 'head.remove', 'FOCUS_TOO_LOW') + h.invoke('focus.move', position_m=rt.FOCUS_REF_M) + settle(h) + self.assertTrue(h.beam_switch) + h.invoke('head.remove') # with the beam switch on: the beam diode is damaged + self.assertIn('sld_failure', h.faults) + self.assertEqual(h.error, 'SLD_FAILURE') + self.assertIn('SLD_DAMAGED', [e['code'] for e in h.events]) + settle(h) + h.invoke('head.attach') + settle(h) + self.assertFalse(h.read()['beam.emitting']) + h.invoke('fault.inject', fault='sld_failure', active=False) # evaluator: the diode is replaced + h.invoke('system.acknowledge') + self.assertTrue(h.read()['beam.emitting']) + self.assertEqual(h.invoke('power.press_button')['enabled'], False) + self.assertEqual(h.invoke('power.press_button')['state'], 'booting') + + def test_beam_alignment_intensity_sensitivity_and_pspd(self): + h = mount(ready(), 'tap1') + align(h) + pr = h._probe() + r = h.read() + self.assertLess(abs(r['pspd.vertical_v']), rt.PSPD_CENTRE_TOL_V) + self.assertLess(abs(r['pspd.lateral_v']), rt.PSPD_CENTRE_TOL_V) + self.assertGreater(r['pspd.intensity_v'], 2.0) # coated lever, aligned: 2-3 V (manual) + # intensity versus the spot position along the cantilever: falls off the end and toward the chip; sensitivity follows 2 xi - xi^2 + rows = [] + for dx in (-60e-6, -30e-6, 0.0, 30e-6): + a = copy.deepcopy(h) + a.invoke('head.turn_knob', knob='beam_x', turns=dx / rt.KNOB_BEAM_M_PER_TURN) + o = a._optics() + rows.append((o['x'], o['I'], o['S'])) + self.assertGreater(rows[0][1], rows[3][1]) # 30 um beyond the free end the spot misses the lever + self.assertLess(rows[3][1], 0.2) + for x, I, S in rows: + xi = min(1.0, max(0.0, 1 + x / pr['truth']['L'])) + self.assertAlmostEqual(S, rt.SENSITIVITY_V_PER_M_100UM * I / 2.5 * pr['truth']['lever_gain'] * max(2 * xi - xi * xi, 0.02) * 100e-6 / pr['truth']['L'], delta=1e-6 * S) + # sideways off the lever: intensity drops with the Gaussian overlap + a = copy.deepcopy(h) + a.invoke('head.turn_knob', knob='beam_y', turns=(pr['truth']['w'] / 2 + 3 * rt.SPOT_SIGMA_M) / rt.KNOB_BEAM_M_PER_TURN) + self.assertLess(a.read()['pspd.intensity_v'], 0.05 * r['pspd.intensity_v']) + # the PSPD knobs move VERTICAL / LATERAL through the erf response and saturate at +-INTENSITY + a = copy.deepcopy(h) + a.invoke('head.turn_knob', knob='pspd_y', turns=0.1) + v1 = a.read()['pspd.vertical_v'] + I = a.read()['pspd.intensity_v'] + self.assertAlmostEqual(v1, I * math.erf(0.1 * rt.KNOB_PSPD_M_PER_TURN / rt.PSPD_SPOT_W_M + (a._optics()['p_v'] - 0.1 * rt.KNOB_PSPD_M_PER_TURN) / rt.PSPD_SPOT_W_M), delta=1e-9) + a.invoke('head.turn_knob', knob='pspd_y', turns=8.0) + self.assertAlmostEqual(a.read()['pspd.vertical_v'], I, delta=1e-3 * I) + rejected(a, 'head.turn_knob', 'KNOB_LIMIT', knob='pspd_y', turns=5.0) + self.assertEqual(a.invoke('head.set_knob', knob='pspd_y', turns_total=0.0)['turns_total'], 0.0) # absolute setting (scene knob coupling) + self.assertEqual(a.read()['knob.pspd_y_turns'], 0.0) + rejected(a, 'head.set_knob', 'KNOB_LIMIT', knob='pspd_x', turns_total=12.0) + # an uncoated backside reflects less (manual: about 1 V instead of 2-3 V) + self.assertFalse(rt.probe_nominal('cdt_contr')['reflective']) + self.assertEqual(rt.INTENSITY_UNCOATED_V, 1.0) + + def test_z_stage_interlock_touch_stop_and_crash(self): + h = mount(ready(), 'cont1') + align(h) + h.invoke('sample.place', sample_id='sio2', offset_x_m=0.0, offset_y_m=0.0) + a = copy.deepcopy(h) + a.invoke('head.turn_knob', knob='beam_y', turns=4.0) # the spot off the lever + rejected(a, 'z_stage.move', 'INTENSITY_LOW', z_m=a.qz - 0.001) + a.invoke('z_stage.move', z_m=a.qz + 0.001) # up is always allowed + # touch stop with the beam aligned + q_touch = h._touch_point() + r0 = h._probe()['radius'] + h.invoke('z_stage.move', z_m=rt.Z_STAGE_LIMITS_M[0]) + settle(h) + self.assertAlmostEqual(h.qz, q_touch - rt.TOUCH_OVERSHOOT_M, delta=1e-12) + self.assertAlmostEqual(h._probe()['radius'], r0 + rt.TOUCH_WEAR_M, delta=1e-15) + self.assertEqual(h._probe()['damage'], 'none') + self.assertIn('TOUCH_STOP', [e['code'] for e in h.events]) + rejected(h, 'stage.move_xy', 'COLLISION_RISK', x_m=0.001, y_m=0.0) # the tip rests on the surface + rejected(h, 'sample.remove', 'COLLISION_RISK', sample_id='sio2') + # with the PSPD saturated the touch is not detected: the cantilever breaks + b = mount(ready(), 'cont1') + align(b) + b.invoke('sample.place', sample_id='sio2', offset_x_m=0.0, offset_y_m=0.0) + b.invoke('head.turn_knob', knob='pspd_y', turns=3.0) + self.assertGreater(abs(b.read()['pspd.vertical_v']), rt.PSPD_TOUCH_LIMIT * b.read()['pspd.intensity_v']) + q_touch = b._touch_point() + b.invoke('z_stage.move', z_m=rt.Z_STAGE_LIMITS_M[0]) + settle(b) + self.assertAlmostEqual(b.qz, q_touch - rt.CRASH_OVERTRAVEL_M, delta=1e-12) + self.assertEqual(b._probe()['damage'], 'cantilever_broken') + self.assertEqual(b.read()['pspd.intensity_v'], 0.0) + self.assertEqual(b.ledger()['tip_crashes'], 1.0) + + def test_camera_focus_depth_of_field(self): + h = mount(ready(), 'tap1') + align(h) + h.invoke('sample.place', sample_id='grating', offset_x_m=0.0, offset_y_m=0.0) + near(h, 500e-6) + cam = h.invoke('camera.read') + self.assertGreater(cam['cantilever_sharpness'], 0.99) # focus stage at its reference: the lever is sharp + self.assertLess(cam['sample_sharpness'], 1e-6) + gap_to_lever = 500e-6 + h._probe()['truth']['tip_height'] + h.invoke('focus.move', position_m=rt.FOCUS_REF_M + gap_to_lever) # focus down onto the sample surface + settle(h) + cam = h.invoke('camera.read') + self.assertGreater(cam['sample_sharpness'], 0.99) + self.assertLess(cam['cantilever_sharpness'], 1e-6) + self.assertFalse(cam['spot_visible']) # the blurred lever: the spot is not located + h.invoke('focus.move', position_m=rt.FOCUS_REF_M + gap_to_lever + rt.DEPTH_OF_FIELD_M) + settle(h) + self.assertAlmostEqual(h.invoke('camera.read')['sample_sharpness'], math.exp(-1.0), delta=1e-6) + # the optics knobs pan the view: the lever leaves the 480 x 360 um field + h.invoke('head.turn_knob', knob='optics_y', turns=2.5) + self.assertFalse(h.invoke('camera.read')['cantilever_in_view']) + + def test_collision_guards_and_sample_area(self): + h = mount(ready(), 'tap1') + big = dict(sample_id='wafer_big', template_id='si_wafer', seed=1, tilt_rad=[0.0, 0.0]) + h.invoke('sample.provide', **big) + self.assertEqual(h.samples['wafer_big']['mount'], 'holder') # 10 mm pieces go on the magnetic holder + rejected(h, 'sample.place', 'SAMPLE_OUT_OF_AREA', sample_id='grating', offset_x_m=0.02, offset_y_m=0.0) + h.invoke('z_stage.move', z_m=h._top_z(h.samples['grating']) - rt.TIP_Z0 + 0.001) # 1 mm above the top of the sample to come + settle(h) + rejected(h, 'sample.place', 'COLLISION_RISK', sample_id='grating', offset_x_m=0.0, offset_y_m=0.0) + h.invoke('z_stage.move', z_m=0.005) + settle(h) + h.invoke('sample.place', sample_id='grating', offset_x_m=0.0, offset_y_m=0.0) + rejected(h, 'sample.place', 'CHUCK_OCCUPIED', sample_id='mica', offset_x_m=0.0, offset_y_m=0.0) + near(h, 50e-6) + rejected(h, 'head.remove', 'COLLISION_RISK') + rejected(h, 'stage.move_xy', 'COLLISION_RISK', x_m=0.009, y_m=0.0) # the sample edge would pass under the tip + h.invoke('stage.move_xy', x_m=0.001, y_m=0.0) # on the same sample + with self.assertRaises(rt.ActionRejected): + _orig_invoke(h, 'sample.provide', sample_id='huge', template_id='si_wafer', seed=1, tilt_rad=[0.0, 0.0], topography_overrides={'pitch_m': 1e-6}) + + +class ApproachAndFeedback(unittest.TestCase): + def test_approach_timing_final_extension_and_gap(self): + h = mount(ready(), 'tap1') + align(h) + dynamic(h) + h.invoke('sample.place', sample_id='grating', offset_x_m=0.0, offset_y_m=0.0) + near(h, 300e-6) + gap = h.read('evaluator')['truth.gap_m'] + self.assertAlmostEqual(gap, 300e-6, delta=0.2e-6) + op = h.invoke('approach', setpoint_force_n=None, setpoint_amplitude_m=16e-9, z_servo_gain=1.0)['operation_id'] + self.assertEqual(h.read()['engage.state'], 'approaching') + self.assertEqual(h.read()['zscanner.extension_m'], rt.Z_SCAN_RANGE_M) # the scanner is extended during the descent + dur = h.op['duration_s'] + self.assertAlmostEqual(dur, (gap - rt.Z_SCAN_RANGE_M + rt.Z_SCAN_RANGE_M / 2) / rt.APPROACH_SPEED_M_S + rt.APPROACH_SETTLE_S, delta=0.05) + h.step(dur / 2) + self.assertLess(h.read('evaluator')['truth.gap_m'], gap / 2 + 1e-6) + wait(h, op) + r = h.read('evaluator') + self.assertEqual(r['engage.state'], 'engaged') + self.assertAlmostEqual(r['zscanner.extension_m'], rt.Z_SCAN_RANGE_M * rt.APPROACH_TARGET_EXTENSION, delta=5e-9) + self.assertGreater(r['truth.tip_force_n'], 0.0) + rejected(h, 'stage.move_xy', 'ENGAGED', x_m=0.001, y_m=0.0) + rejected(h, 'head.turn_knob', 'ENGAGED', knob='beam_x', turns=0.1) + h.invoke('retract', distance_m=rt.RETRACT_DISTANCE_M) + settle(h) + self.assertIsNone(h.engaged) + self.assertAlmostEqual(h.read('evaluator')['truth.gap_m'], rt.RETRACT_DISTANCE_M + (h._floor_under_tip() and 0.0) + 7.5e-6 + - (h.engaged or {}).get('x', 0.0) + (r['truth.gap_m'] or 0.0), delta=3e-6) + + def test_contact_crash_and_dynamic_false_engage(self): + h = mount(ready(), 'cont1') + align(h) + h.invoke('head.configure', mode='contact', cantilever_db='contal_g') + h.invoke('head.turn_knob', knob='pspd_y', turns=2.5) + h.invoke('sample.place', sample_id='sio2', offset_x_m=0.0, offset_y_m=0.0) + near(h) + op = h.invoke('approach', setpoint_force_n=5e-9, setpoint_amplitude_m=None, z_servo_gain=1.0)['operation_id'] + wait(h, op) + self.assertEqual((h.operations[op]['phase'], h.operations[op]['reason']), ('failed', 'APPROACH_FAILED')) + self.assertEqual(h._probe()['damage'], 'tip_broken') + self.assertIsNone(h.engaged) + settle(h) + self.assertGreater(h.read('evaluator')['truth.gap_m'], 50e-6) # SmartScan lifts the head after the failure + g = mount(ready(), 'tap1') + align(g) + dynamic(g) + g.invoke('head.turn_knob', knob='pspd_y', turns=2.5) + _, op = engage(g, GRATING) + self.assertEqual(g.operations[op]['phase'], 'completed') + self.assertTrue(g.engaged['false']) + rec = scan(g) + self.assertIn('false_engage', rec['warnings']) + self.assertIn('error_saturated', rec['warnings']) + self.assertLess(np.ptp(img(rec)), 1e-9) # nothing imaged: the tip hovers far above + + def test_feedback_error_speed_gain_parachuting_and_oscillation(self): + h = _scenario('engaged') + err = {} + for gain, rate in ((0.3, 2.0), (1.0, 2.0), (3.0, 2.0), (1.0, 0.5)): + rec = scan(h, z_servo_gain=gain, rate_hz=rate, save_retrace=True) + err[(gain, rate)] = float(np.std(img(rec, 'error'))) + if (gain, rate) == (0.3, 2.0): + slow = rec + self.assertGreater(err[(0.3, 2.0)], err[(1.0, 2.0)]) + self.assertGreater(err[(1.0, 2.0)], err[(3.0, 2.0)]) + self.assertGreater(err[(1.0, 2.0)], err[(1.0, 0.5)]) + self.assertIn('error_saturated', slow['warnings']) # the tip parachutes off the pit walls at low gain + t, r = img(slow, 'height', 'trace'), img(slow, 'height', 'retrace') + self.assertGreater(float(np.std(t - r)), 3e-9) # trace and retrace differ where the feedback lags + m = _scenario('engaged') + m.invoke('retract', distance_m=100e-6) + settle(m) + engage(m, MICA) + below = scan(m, size_m=1e-6, z_servo_gain=3.0) + above = scan(m, size_m=1e-6, z_servo_gain=8.0) + self.assertGreater(float(np.std(img(above, 'error'))), 10 * float(np.std(img(below, 'error')))) # above the critical gain 4 of tapping + + def test_z_range_saturation(self): + h = _scenario('engaged') + h.invoke('retract', distance_m=200e-6) + settle(h) + engage(h, TALL) + rec = scan(h, size_m=40e-6, pixels_x=64, pixels_y=32, rate_hz=1.0) + self.assertIn('z_scanner_saturated', rec['warnings']) + z = img(rec) + self.assertLessEqual(float(np.ptp(z)), rt.Z_SCAN_RANGE_M + 1e-9) + + def test_scan_limits(self): + h = _scenario('engaged') + rejected(h, 'scan.start', 'TIP_SPEED_TOO_HIGH', **dict(SCAN, size_m=50e-6, rate_hz=3.0)) + rejected(h, 'scan.start', 'SCAN_OUT_OF_RANGE', **dict(SCAN, size_m=40e-6, offset_x_m=10e-6, rate_hz=1.0)) + rejected(h, 'scan.start', 'SCAN_OUT_OF_RANGE', **dict(SCAN, size_m=40e-6, angle_rad=math.pi / 4, rate_hz=1.0)) + rejected(h, 'scan.start', 'SIMULATION_LIMIT', **dict(SCAN, pixels_x=4096, pixels_y=2048, rate_hz=0.1)) + rejected(h, 'scan.start', 'SETPOINT_REQUIRED', **dict(SCAN, setpoint_force_n=5e-9, setpoint_amplitude_m=None)) + rejected(h, 'scan.start', 'SETPOINT_OUT_OF_RANGE', **dict(SCAN, setpoint_amplitude_m=25e-9)) + + +# ---------------------------------------------------------------- physics +class ImagingPhysics(unittest.TestCase): + def test_tip_dilation_of_a_sphere_matches_the_analytic_envelope(self): + """A sphere of radius r imaged by a spherical apex R: apparent surface = sphere of radius r + R about the particle centre (apex contour).""" + r, R, px, m = 10e-9, 8e-9, 1e-9, 20 + n = 61 + 2 * m + x = (np.arange(n) - n // 2) * px + X, Y = np.meshgrid(x, x) + g = np.where(X ** 2 + Y ** 2 < r * r, r + np.sqrt(np.maximum(r * r - X ** 2 - Y ** 2, 0.0)), 0.0) + alpha = math.radians(20.0) + hd = rt.dilate_grid(g, px, px, R, alpha, m) + xi = x[m:-m] + env = np.where(np.abs(xi) < r + R, r + np.sqrt(np.maximum((r + R) ** 2 - xi ** 2, 0.0)) - R, 0.0) + line = hd[hd.shape[0] // 2] + core = np.abs(xi) < 0.95 * (r + R) * math.cos(alpha) # contact on the spherical cap of the tip + self.assertLess(float(np.max(np.abs(line[core] - np.maximum(env[core], 0.0)))), 0.6e-9) + self.assertAlmostEqual(float(line.max()), 2 * r, delta=1e-12) + half = xi[line > r] + self.assertAlmostEqual(float(half.max() - half.min()), 2 * math.sqrt((r + R) ** 2 - R * R), delta=2 * px) + + def test_calibration_grating_step_height_and_pitch(self): + h = _scenario('engaged') + rec = scan(h, size_m=10e-6, pixels_x=128, pixels_y=128, rate_hz=1.0) + st = h.invoke('analysis.step_height', record_id=rec['record_id'], channel='height', direction='trace', flatten='plane_upper', method='histogram', + region_a_px=None, region_b_px=None) + self.assertAlmostEqual(st['step_m'], 100e-9, delta=7e-9) # manual: 100 nm +- 7 nm + z = img(rec, flatten='plane_upper') + prof = z.mean(axis=0) - z.mean() + spec = np.abs(np.fft.rfft(prof)) + k = int(np.argmax(spec[1:])) + 1 + self.assertAlmostEqual(10e-6 / k, 3e-6, delta=0.4e-6) # 3 um pitch + line_biased = h.invoke('analysis.step_height', record_id=rec['record_id'], channel='height', direction='trace', flatten='line_1', method='histogram', + region_a_px=None, region_b_px=None) + self.assertGreater(abs(line_biased['step_m'] - 100e-9), 20e-9) # line flattening through the pits biases it (as in XEI) + + def test_hopg_monatomic_step(self): + """Step height from two narrow regions on either side of each step edge after levelling on one terrace (as in XEI): the interlayer spacing 0.335 nm.""" + h = tapping_engaged(sample=HOPG) + rec = scan(h, size_m=1.2e-6, pixels_x=128, pixels_y=128, rate_hz=1.0) + z = img(rec) + s = copy.deepcopy(h._sample()) + s['tilt_rad'] = [0.0, 0.0] + s['topography'] = dict(s['topography'], rq_m=0.0) + ideal = rt.Surface(s) + n = 128 + u = (np.arange(n) + 0.5) * 1.2e-6 / n - 0.6e-6 + U, V = np.meshgrid(u, u) + p0 = h._tip_in_sample() + dr = h._drift(h.records[rec['record_id']]['started_s']) + lev = np.round(ideal.evaluate(p0[0] + U + dr[0], p0[1] + V + dr[1])[0] / 0.335e-9) + z = z - rt._plane_fit(z, lev == np.median(lev)) # level the image on one terrace (plane by region) + steps = [] + for j in range(n): + for i in np.nonzero(np.diff(lev[j]))[0]: + if 12 <= i < n - 12 and len(set(lev[j, i - 11:i + 13].tolist())) == 2: + steps.append((np.median(z[j, i + 3:i + 11]) - np.median(z[j, i - 9:i - 1])) / (lev[j, i + 1] - lev[j, i])) + self.assertGreater(len(steps), 20) + self.assertAlmostEqual(float(np.median(steps)), 0.335e-9, delta=0.04e-9) + terrace = z[lev == np.median(lev)] + self.assertLess(float(np.std(rt.flatten_image(z, 'plane')[lev == np.median(lev)])), 0.12e-9) + self.assertGreater(terrace.size, 100) + + + def test_phase_contrast_and_height_of_a_ps_pmma_blend(self): + h = tapping_engaged(sample=BLEND) + rec = scan(h, size_m=10e-6, pixels_x=128, pixels_y=128, rate_hz=0.5) + H, P = img(rec, flatten='plane'), img(rec, 'phase') + s = h._sample()['surface'] + n = 128 + u = (np.arange(n) + 0.5) * 10e-6 / n - 5e-6 + U, V = np.meshgrid(u, u) + p0 = h._tip_in_sample() + dr = h._drift(h.records[rec['record_id']]['started_s']) + _, mat = s.evaluate(p0[0] + U + dr[0], p0[1] + V + dr[1]) + dh = float(np.median(H[mat == 0]) - np.median(H[mat == 1])) + dphi = float(np.median(P[mat == 1]) - np.median(P[mat == 0])) + self.assertAlmostEqual(dh, 12e-9, delta=2e-9) # PMMA domains 12 nm lower (template) + self.assertGreater(abs(dphi), math.radians(0.5)) # dissipation contrast of PS / PMMA + mp = h.engaged['mp'] + self.assertGreater(mp['mats'][1]['E_dis'], mp['mats'][0]['E_dis']) # PMMA: larger surface energy -> adhesion hysteresis + self.assertGreater(dphi, 0.0) + self.assertTrue(np.all(P < math.pi / 2 + 1e-3)) # repulsive regime: phase lag below 90 deg + + def test_true_non_contact_operating_point_and_drive_side(self): + nc = _scenario('nc_engaged') + mp = nc.engaged['mp'] + self.assertEqual(mp['regime'], 'non_contact') + gap = mp['mats'][0]['gap'] + self.assertTrue(0.3e-9 < gap < 5e-9, gap) + self.assertLess(nc.read('evaluator')['truth.tip_force_n'], 2e-9) # attractive van der Waals force, below 2 nN + rec = scan(nc, size_m=2e-6, setpoint_amplitude_m=9.5e-9) + self.assertTrue(np.all(img(rec, 'phase') > math.pi / 2)) # attractive regime: phase lag above 90 deg + self.assertNotIn('nc_contact_regime', rec['warnings']) + r0 = nc._probe()['radius'] + for _ in range(3): + scan(nc, size_m=2e-6, setpoint_amplitude_m=9.5e-9) + self.assertLess(nc._probe()['radius'] - r0, 0.2e-9) # practically no wear + # the drive below the resonance: the attraction raises the amplitude first, the operating point does not exist + h = mount(ready(), 'nc1') + align(h) + dynamic(h, mode='non_contact', amplitude=10e-9, above=0.9992) + engage(h, SIO2, setpoint=9.5e-9) + self.assertEqual(h.engaged['mp']['regime'], 'contact_regime') + self.assertIn('NC_CONTACT_REGIME', [e['code'] for e in h.events]) + rec = scan(h, size_m=2e-6, setpoint_amplitude_m=9.5e-9) + self.assertIn('nc_contact_regime', rec['warnings']) + # table physics: frequency shift of small amplitudes is -f0 F' / 2k + k, f0, C, D = 40.0, 3e5, 1e-28, 5e-9 + self.assertAlmostEqual(float(rt.nc_shift(np.array([D]), np.array([0.01e-9]), k, f0, C)[0]), -f0 * (2 * C / (D + 0.01e-9) ** 3) / (2 * k), delta=1e-3 * abs(f0 * 2 * C / D ** 3 / (2 * k))) + + def test_contact_mode_indentation_and_tip_wear(self): + h = contact_engaged(sample=SIO2, setpoint=10e-9) + r0 = h._probe()['radius'] + for _ in range(2): + scan(h, size_m=10e-6, rate_hz=2.0, setpoint_force_n=10e-9) + worn_hard = h._probe()['radius'] - r0 + p = contact_engaged(sample=PMMA, setpoint=10e-9) + r1 = p._probe()['radius'] + for _ in range(2): + scan(p, size_m=10e-6, rate_hz=2.0, setpoint_force_n=10e-9) + worn_soft = p._probe()['radius'] - r1 + self.assertGreater(worn_hard, 1e-9) + self.assertGreater(worn_hard, 1.5 * worn_soft) # Archard-type wear scales with the sample hardness + t = _scenario('engaged') + tr0 = t._probe()['radius'] + for _ in range(2): + scan(t, size_m=10e-6, rate_hz=2.0) + self.assertLess((t._probe()['radius'] - tr0) / 11.4e-9, worn_hard / r0) # tapping wears less than contact + # the load indents the softer film more (DMT), visible in the true force and offsets + mh, ms = h.engaged['mp'], p.engaged['mp'] + self.assertGreater(-ms['mats'][0]['offset'] - ms['d_set'], -mh['mats'][0]['offset'] - mh['d_set']) + # the feedback holds VERTICAL = V_free + dV on the erf response of the photodiode (F07): true load = k x deflection at that signal + o = h._optics() + dV = 10e-9 * h.cal['sensitivity_v_per_m'] / h.cal['spring_constant_n_m'] + V_free = float(rt.pspd_signal(o['I'], o['p_v'], o['S'], 0.0)) + d = rt.pspd_inverse(o['I'], o['p_v'], o['S'], V_free + dV) + self.assertAlmostEqual(h.read('evaluator')['truth.tip_force_n'], h._probe()['truth']['k'] * d, delta=1e-15) + self.assertAlmostEqual(h.read()['pspd.vertical_v'], V_free + dV, delta=1e-9) + + def test_noise_floor_with_enclosure_isolation_and_bursts(self): + rq = {} + for enc in (True, False): + h = tapping_engaged(sample=MICA, acoustic_enclosure=enc, vibration_isolation=enc) + rec = scan(h, size_m=500e-9, pixels_x=128, pixels_y=128, rate_hz=2.0) + rq[enc] = float(np.std(img(rec, flatten='line_1'))) + self.assertLess(rq[True], 0.05e-9) # mica about 0.03 nm with enclosure and isolation + self.assertGreater(rq[False], 1.4 * rq[True]) + h.invoke('fault.inject', fault='vibration_burst', active=True) + rec = scan(h, size_m=500e-9, pixels_x=128, pixels_y=128, rate_hz=2.0) + self.assertGreater(float(np.std(img(rec, flatten='line_1'))), 5 * rq[False]) + self.assertGreaterEqual(rt.Z_DETECTOR_NOISE_M, 0.02e-9) + + def test_thermal_drift_settles_after_loading(self): + h = tapping_engaged(sample=AUNP, acoustic_enclosure=False) + def shift(a, b): + A, B = np.fft.fft2(a - a.mean()), np.fft.fft2(b - b.mean()) + c = np.fft.ifft2(A * np.conj(B)).real + j, i = np.unravel_index(np.argmax(c), c.shape) + n = a.shape[0] + return math.hypot((i + n // 2) % n - n // 2, (j + n // 2) % n - n // 2) + early = [img(scan(h, size_m=500e-9, pixels_x=128, pixels_y=128, rate_hz=1.0), flatten='line_1') for _ in range(2)] + d0 = h.read('evaluator')['truth.drift_m'] + h.step(4 * 3600.0) + late = [img(scan(h, size_m=500e-9, pixels_x=128, pixels_y=128, rate_hz=1.0), flatten='line_1') for _ in range(2)] + self.assertGreaterEqual(shift(early[1], early[0]), 1.0) # nm per minute right after loading + self.assertLess(shift(late[1], late[0]), shift(early[1], early[0])) + d1 = h.read('evaluator')['truth.drift_m'] + self.assertGreater(math.hypot(d1[0] - d0[0], d1[1] - d0[1]), 0.0) + + +class SpectroscopyAndCalibration(unittest.TestCase): + def test_thermal_tune_recovers_k_and_propagates_the_sensitivity_error(self): + h = mount(ready(), 'cont1') + align(h) + h.invoke('head.configure', mode='contact', cantilever_db='contal_g') + tr = h._probe()['truth'] + S = h._optics()['S'] + h.invoke('calibration.set', spring_constant_n_m=None, sensitivity_v_per_m=S) + rec = wait(h, h.invoke('calibration.thermal_tune', temperature_k=295.15, averages=200)['operation_id']) + fit = rec['data']['fit'] + self.assertAlmostEqual(fit['spring_constant_n_m'] / tr['k'], 1.0, delta=0.05) + self.assertAlmostEqual(fit['resonance_hz'] / tr['f0'], 1.0, delta=0.002) + self.assertAlmostEqual(fit['quality_factor'] / tr['Q'], 1.0, delta=0.15) + self.assertEqual(h.cal['spring_constant_source'], 'thermal_tune') + h.invoke('calibration.set', spring_constant_n_m=None, sensitivity_v_per_m=1.2 * S) + k2 = wait(h, h.invoke('calibration.thermal_tune', temperature_k=295.15, averages=200)['operation_id'])['data']['fit']['spring_constant_n_m'] + self.assertAlmostEqual(k2 / fit['spring_constant_n_m'], 1.44, delta=0.08) # k ~ S^2 + h.invoke('calibration.set', spring_constant_n_m=None, sensitivity_v_per_m=S) + k3 = wait(h, h.invoke('calibration.thermal_tune', temperature_k=320.0, averages=200)['operation_id'])['data']['fit']['spring_constant_n_m'] + self.assertAlmostEqual(k3 / fit['spring_constant_n_m'], 320.0 / 295.15, delta=0.06) # the user-entered temperature scales k + # a wrong cantilever entry puts the resonance outside the window + h.invoke('head.configure', mode='contact', cantilever_db='ac160ts') + rec = wait(h, h.invoke('calibration.thermal_tune', temperature_k=295.15, averages=50)['operation_id']) + self.assertIn('no_resonance_in_window', rec['warnings']) + + def test_sensitivity_from_force_curves_and_the_pull_off(self): + h = mount(ready(humidity=0.40), 'cont1') + align(h) + h.invoke('head.configure', mode='contact', cantilever_db='contal_g') + set_true_calibration(h) + engage(h, SIO2, mode='contact', setpoint=2e-9) + fd = wait(h, h.invoke('fd.acquire', z_range_m=200e-9, rate_hz=1.0, trigger_force_n=4e-9, dwell_s=0.0, count=2, positions_m=[[0.0, 0.0]])['operation_id']) + r = h.invoke('calibration.sensitivity', record_id=fd['record_id'], curve_index=0, branch='approach') + self.assertAlmostEqual(r['sensitivity_v_per_m'] / h._optics()['S'], 1.0, delta=0.02) # hard sample, soft lever, small deflection + self.assertGreater(r['r2'], 0.999) + c = fd['data']['curves'][0] + self.assertAlmostEqual(-min(c['force_retract_n']) / c['_truth']['adhesion_n'], 1.0, delta=0.08) + self.assertLess(min(c['force_approach_n']), 0.0) # jump-in to contact + self.assertTrue(c['triggered']) + # more humidity: capillary condensation adds adhesion + w = mount(ready(humidity=0.70), 'cont1') + align(w) + w.invoke('head.configure', mode='contact', cantilever_db='contal_g') + set_true_calibration(w) + engage(w, SIO2, mode='contact', setpoint=2e-9) + fdw = wait(w, w.invoke('fd.acquire', z_range_m=300e-9, rate_hz=1.0, trigger_force_n=4e-9, dwell_s=0.0, count=1, positions_m=[[0.0, 0.0]])['operation_id']) + self.assertGreater(-min(fdw['data']['curves'][0]['force_retract_n']), 1.3 * -min(c['force_retract_n'])) + # analytic check of the branches: pull-off at z_rel = F_ad / k, jump-in at 1.5 (2C / k)^(1/3) + k, R, Es, Fad, C = 0.2, 10e-9, 50e9, 5e-9, 1e-19 * 10e-9 / 6 + z = np.linspace(60e-9, -30e-9, 4000) + d_app, d_ret, info = rt.fd_branches(z, k, R, Es, Fad, C) + self.assertAlmostEqual(info['pull_off_z_m'], Fad / k, delta=1e-15) + self.assertAlmostEqual(float(np.min(k * d_ret)), -Fad, delta=0.02 * Fad) + self.assertAlmostEqual(info['jump_in_z_m'], 1.5 * (2 * C / k) ** (1 / 3), delta=1e-15) + + def test_dmt_fit_recovers_the_modulus_of_a_polymer_film(self): + h = mount(ready(), 'multi1') + align(h) + h.invoke('head.configure', mode='contact', cantilever_db='multi75al_g') + set_true_calibration(h) + engage(h, PMMA, mode='contact', setpoint=2e-9) + fd = wait(h, h.invoke('fd.acquire', z_range_m=80e-9, rate_hz=1.0, trigger_force_n=60e-9, dwell_s=0.0, count=1, positions_m=[[0.0, 0.0]])['operation_id']) + c = fd['data']['curves'][0] + m = rt.material('pmma') + fit = h.invoke('analysis.fd_fit', record_id=fd['record_id'], curve_index=0, branch='retract', model='dmt', tip_radius_m=c['_truth']['tip_radius_m'], + sample_poisson_ratio=m['nu'], tip_modulus_pa=169e9, tip_poisson_ratio=0.27) + self.assertAlmostEqual(fit['reduced_modulus_pa'] / c['_truth']['reduced_modulus_pa'], 1.0, delta=0.25) + self.assertAlmostEqual(fit['sample_modulus_pa'] / m['E'], 1.0, delta=0.3) + self.assertAlmostEqual(fit['adhesion_n'] / c['_truth']['adhesion_n'], 1.0, delta=0.1) + hz = h.invoke('analysis.fd_fit', record_id=fd['record_id'], curve_index=0, branch='approach', model='hertz', tip_radius_m=c['_truth']['tip_radius_m'], + sample_poisson_ratio=m['nu'], tip_modulus_pa=169e9, tip_poisson_ratio=0.27) + self.assertGreater(hz['reduced_modulus_pa'], 0.0) + rejected(h, 'analysis.fd_fit', 'UNKNOWN_CURVE', record_id=fd['record_id'], curve_index=5, branch='retract', model='dmt', tip_radius_m=10e-9, + sample_poisson_ratio=0.35, tip_modulus_pa=169e9, tip_poisson_ratio=0.27) + + def test_frequency_sweep_and_drive(self): + h = mount(ready(), 'tap1') + align(h) + rejected(h, 'ncm.frequency_sweep', 'MODE_NOT_CONFIGURED', start_hz=250e3, stop_hz=330e3, points=512) + h.invoke('head.configure', mode='contact', cantilever_db='ac160ts') + rejected(h, 'ncm.set_drive', 'MODE_NOT_DYNAMIC', frequency_hz=3e5, amplitude_m=20e-9) + h.invoke('head.configure', mode='tapping', cantilever_db='ac160ts') + tr = h._probe()['truth'] + rec = wait(h, h.invoke('ncm.frequency_sweep', start_hz=tr['f0'] * 0.98, stop_hz=tr['f0'] * 1.02, points=2048)['operation_id']) + self.assertAlmostEqual(rec['data']['peak_hz'] / tr['f0'], 1.0, delta=1e-4) + self.assertAlmostEqual(rec['data']['quality_factor_estimate'] / tr['Q'], 1.0, delta=0.15) + ph = np.asarray(rec['data']['phase_rad']) + self.assertLess(ph[0], 0.3) + self.assertGreater(ph[-1], math.pi - 0.3) + rejected(h, 'ncm.set_drive', 'DRIVE_OFF_RESONANCE', frequency_hz=tr['f0'] * 1.5, amplitude_m=50e-9) + h.invoke('ncm.set_drive', frequency_hz=tr['f0'], amplitude_m=20e-9) + self.assertAlmostEqual(h.read()['ncm.amplitude_m'], 20e-9, delta=1e-12) + h.invoke('calibration.set', spring_constant_n_m=None, sensitivity_v_per_m=2 * h.cal['sensitivity_v_per_m']) + self.assertAlmostEqual(h.read()['ncm.amplitude_m'], 10e-9, delta=1e-12) # the displayed amplitude follows the calibration + + +# ---------------------------------------------------------------- faults, cancellation, data +class FaultsCancelAndData(unittest.TestCase): + def test_sld_failure_during_a_scan_keeps_the_scanned_lines(self): + h = _scenario('engaged') + op = h.invoke('scan.start', **SCAN)['operation_id'] + h.step(9.0) + h.invoke('fault.inject', fault='sld_failure', active=True) + rec = h.records['IMG0001'] + self.assertEqual((h.operations[op]['phase'], h.operations[op]['reason'], rec['status']), ('failed', 'SLD_FAILURE', 'failed')) + self.assertEqual(rec['meta']['lines_completed'], 18) # 9 s at 2 Hz, including the partial block + self.assertTrue(np.isnan(np.asarray(rec['data']['height']['trace'])[18:]).all()) + self.assertIsNone(h.engaged) + self.assertEqual(h.error, 'SLD_FAILURE') + rejected(h, 'system.acknowledge', 'CAUSE_PERSISTS') + rejected(h, 'z_stage.move', 'ERROR_PENDING', z_m=0.001) + h.invoke('fault.inject', fault='sld_failure', active=False) + self.assertEqual(h.invoke('system.acknowledge')['cleared'], 'SLD_FAILURE') + self.assertTrue(h.read()['beam.emitting']) + + def test_cancel_keeps_lines_and_the_engagement(self): + h = _scenario('engaged') + h.register_principal('a', 'agent') + s = h.session('a') + r = s.invoke(instance_id=h.instance_id, capability_id='scan.start', arguments=SCAN, request_id='s1') + h.step(20.25) + c = s.cancel(r['operation_id'], 'c1') + self.assertEqual(c['result']['phase'], 'cancelled') + self.assertEqual(s.cancel(r['operation_id'], 'c1'), c) # idempotent + c2 = s.cancel(r['operation_id'], 'c2') # a refused cancel answers like invoke (F11) + self.assertEqual((c2['status'], c2['error']['code'], c2['error']['side_effects']), ('rejected', 'NOT_RUNNING', 'none')) + self.assertEqual(s.cancel(r['operation_id'], 'c2'), c2) + rec = h.records['IMG0001'] + self.assertEqual((rec['status'], rec['meta']['lines_completed']), ('cancelled', 40)) + self.assertIsNotNone(h.engaged) + # cancelling an approach stops the Z stage where it is + a = _scenario('near') + op = a.invoke('approach', setpoint_force_n=None, setpoint_amplitude_m=16e-9, z_servo_gain=1.0)['operation_id'] + a.step(0.7) + q = a.qz + a._cancel_op(a.operations[op]) + a.step(5.0) + self.assertEqual(a.qz, q) + self.assertIsNone(a.engaged) + # a cancelled thermal tune leaves the calibration unchanged + t = _scenario('tuning') + cal = dict(t.cal) + t._cancel_op(t.operations[t.op['op']]) + self.assertEqual(t.cal, cal) + self.assertEqual(t.records['TT0001']['data'], {}) + + def test_stage_stalls_and_the_broken_tip(self): + h = _scenario('aligned') + h.invoke('fault.inject', fault='xy_stage_stall', active=True) + h.invoke('stage.move_xy', x_m=0.003, y_m=0.0) + self.assertEqual((h.error, h.xy), ('XY_STAGE_FAULT', [0.0, 0.0])) + h.invoke('fault.inject', fault='xy_stage_stall', active=False) + h.invoke('system.acknowledge') + z = _scenario('near') + op = z.invoke('approach', setpoint_force_n=None, setpoint_amplitude_m=16e-9, z_servo_gain=1.0)['operation_id'] + z.step(0.5) + z.invoke('fault.inject', fault='z_stage_stall', active=True) + self.assertEqual((z.operations[op]['phase'], z.operations[op]['reason'], z.error), ('failed', 'Z_STAGE_FAULT', 'Z_STAGE_FAULT')) + # a broken tip (evaluator) blurs the image of the gold particles + b = tapping_engaged(sample=AUNP) + sharp = img(scan(b, size_m=500e-9, pixels_x=128, pixels_y=128, rate_hz=1.0)) + b.invoke('fault.inject', fault='tip_broken', active=True) + self.assertEqual(b._probe()['damage'], 'tip_broken') + blunt = img(scan(b, size_m=500e-9, pixels_x=128, pixels_y=128, rate_hz=1.0)) + above = [float(np.mean(z - np.percentile(z, 10, axis=1, keepdims=True) > 5e-9)) for z in (sharp, blunt)] # substrate level per line (drift) + self.assertGreater(above[1], 3.0 * above[0]) # the 20 nm particles look much wider + + def test_records_delete_full_and_result_extraction(self): + h = _scenario('scanned') + r = h.invoke('measurement.result', record_id='IMG0001', channel='phase', direction='trace', region_px=[8, 8, 40, 24], max_values=128) + self.assertEqual(r['data']['unit'], 'rad') + self.assertLessEqual(r['data']['shape'][0] * r['data']['shape'][1], 128) + self.assertEqual(r['data']['factor'], 2) + rejected(h, 'measurement.result', 'CHANNEL_NOT_RECORDED', record_id='IMG0001', channel='height', direction='retrace', region_px=None, max_values=128) + rejected(h, 'measurement.result', 'REGION_OUT_OF_RANGE', record_id='IMG0001', channel='height', direction='trace', region_px=[0, 0, 65, 10], max_values=128) + f = h.invoke('analysis.flatten', record_id='IMG0001', channel='height', direction='trace', method='plane_upper') + pr = h.invoke('measurement.result', record_id=f['record_id'], channel=None, direction=None, region_px=None, max_values=65536) + self.assertEqual(pr['record']['kind'], 'processed') + self.assertAlmostEqual(pr['data']['stats']['mean'], float(np.mean(rt.flatten_image(img(h.records['IMG0001']), 'plane_upper'))), delta=1e-12) + self.assertEqual(h.invoke('records.delete', record_id=f['record_id'])['remaining'], len(h.records)) + rejected(h, 'records.delete', 'UNKNOWN_RECORD', record_id=f['record_id']) + h.records.update({f'X{i:04d}': dict(h.records['IMG0001'], record_id=f'X{i:04d}') for i in range(rt.MAX_RECORDS - len(h.records))}) + rejected(h, 'analysis.flatten', 'RECORDS_FULL', record_id='IMG0001', channel='height', direction='trace', method='plane') + rejected(h, 'scan.start', 'RECORDS_FULL', **SCAN) + + +class AnalysisFunctions(unittest.TestCase): + def test_flatten_roughness_profile_and_regions(self): + yy, xx = np.mgrid[0:64, 0:64] + rng = np.random.default_rng(1) + noise = rng.standard_normal((64, 64)) * 1e-9 + z = 3e-9 + 2e-10 * xx - 1e-10 * yy + noise + f = rt.flatten_image(z, 'plane') + self.assertLess(abs(float(np.polyfit(np.arange(64), f.mean(axis=0), 1)[0])), 1e-12) + st = rt.roughness_stats(f) + self.assertAlmostEqual(st['rq_m'], float(np.std(noise)), delta=0.03e-9) + self.assertAlmostEqual(st['ra_m'], st['rq_m'] * math.sqrt(2 / math.pi), delta=0.05e-9) # Gaussian surface: Ra = Rq sqrt(2 / pi) + self.assertAlmostEqual(st['rku'], 3.0, delta=0.3) + self.assertAlmostEqual(st['rsk'], 0.0, delta=0.2) + for order in (0, 1, 2): + ff = rt.flatten_image(z + 5e-9 * ((xx / 63.0) * 2 - 1) ** order, f'line_{order}') + self.assertLess(float(np.max(np.abs(ff.mean(axis=1)))), 1e-12) + p = rt.line_profile(np.tile(np.arange(10.0), (5, 1)), (0, 2), (9, 2), 19) + self.assertTrue(np.allclose(p, np.linspace(0, 9, 19))) + two = np.where(xx < 32, 0.0, 7e-9) + noise * 0.1 + self.assertAlmostEqual(rt.step_height_histogram(two)['step_m'], 7e-9, delta=0.1e-9) + small, fac = rt.downsample(np.arange(100.0).reshape(10, 10), 25) + self.assertEqual((small.shape, fac), ((5, 5), 2)) + self.assertAlmostEqual(small[0, 0], np.mean([0, 1, 10, 11])) + + def test_image_analysis_capabilities(self): + h = _scenario('scanned') + rr = h.invoke('analysis.roughness', record_id='IMG0001', channel='height', direction='trace', flatten='plane', region_px=[0, 0, 32, 32]) + self.assertEqual(rr['pixels'], 32 * 32) + lp = h.invoke('analysis.line_profile', record_id='IMG0001', channel='height', direction='trace', flatten='plane', start_px=[0, 10], end_px=[63, 10], + points=64) + self.assertAlmostEqual(lp['distance_m'][-1], 63 * 5e-6 / 64, delta=1e-15) + rg = h.invoke('analysis.step_height', record_id='IMG0001', channel='height', direction='trace', flatten='plane', method='regions', region_a_px=[0, 0, 4, 4], + region_b_px=[20, 20, 30, 30]) + self.assertEqual(rg['method'], 'regions') + rejected(h, 'analysis.step_height', 'REGION_REQUIRED', record_id='IMG0001', channel='height', direction='trace', flatten='plane', method='regions', + region_a_px=None, region_b_px=None) + rejected(h, 'analysis.roughness', 'REGION_OUT_OF_RANGE', record_id='IMG0001', channel='height', direction='trace', flatten='plane', region_px=[0, 0, 1, 1]) + rejected(h, 'analysis.roughness', 'RECORD_NOT_SUITABLE', record_id='FS0001', channel='height', direction='trace', flatten='plane', region_px=None) + + +# ---------------------------------------------------------------- ledgers, isolation, sessions +class LedgersIsolationSessions(unittest.TestCase): + def test_energy_travel_and_count_ledgers_close(self): + h = configured() + h.invoke('power.set', enabled=True) + h.step(100.0) + mount(h, 'tap1') + align(h) + dynamic(h) + engage(h) + scan(h, pixels_y=32) + led = h.ledger() + self.assertAlmostEqual(led['electrical_energy_j'], rt.ELECTRONICS_POWER_W * h.t, delta=1e-6) + self.assertAlmostEqual(led['scan_lines'], 32.0) + self.assertAlmostEqual(led['scanner_path_m'], 32 * 2 * SCAN['size_m'], delta=1e-15) + self.assertEqual(led['approaches'], 1.0) + z_moves = h.led['z_stage_travel_m'].value() + self.assertGreater(z_moves, 0.005) + h.invoke('power.set', enabled=False) + e0, t0 = h.ledger()['electrical_energy_j'], h.t + h.step(50.0) + self.assertEqual(h.ledger()['electrical_energy_j'], e0) # no energy while off + self.assertEqual(h.ledger()['beam_on_s'], led['beam_on_s'] + 0.0 * (h.t - t0)) + + def test_two_instances_are_isolated(self): + a, b = _scenario('engaged'), _scenario('engaged') + a.invoke('fault.inject', fault='vibration_burst', active=True) + scan(a) + self.assertNotIn('IMG0001', b.records) + self.assertEqual(b.faults, set()) + self.assertNotEqual(a.ledger()['scan_lines'], b.ledger()['scan_lines']) + + def test_agent_does_not_see_truth_templates_or_evaluator_warnings(self): + h = _scenario('near') + h.register_principal('agent', 'agent') + h.register_principal('eval', 'evaluator') + s, e = h.session('agent'), h.session('eval') + iid = h.instance_id + obs = s.read(instance_id=iid)['observations'] + self.assertFalse([k for k in obs if k.startswith('truth.')]) + with self.assertRaises(rt.ActionRejected): + s.read(instance_id=iid, state_ids=['truth.probe']) + self.assertEqual(s.invoke(instance_id=iid, capability_id='fault.inject', arguments=dict(fault='tip_broken', active=True), request_id='f1')['error']['code'], + 'ACCESS_DENIED') + d = s.describe(instance_id=iid) + self.assertNotIn('fault.inject', d['capabilities']) + self.assertFalse([k for k in d['state_slots'] if k.startswith('truth.')]) + h.invoke('head.turn_knob', knob='pspd_y', turns=2.5) + r = s.invoke(instance_id=iid, capability_id='approach', arguments=dict(setpoint_force_n=None, setpoint_amplitude_m=16e-9, z_servo_gain=1.0), request_id='a1') + wait(h, r['operation_id']) + r = s.invoke(instance_id=iid, capability_id='scan.start', arguments=SCAN, request_id='s1') + wait(h, r['operation_id']) + mine = s.invoke(instance_id=iid, capability_id='measurement.result', arguments=dict(record_id='IMG0001', channel=None, direction=None, region_px=None, + max_values=256), request_id='m1')['result'] + full = e.invoke(instance_id=iid, capability_id='measurement.result', arguments=dict(record_id='IMG0001', channel=None, direction=None, region_px=None, + max_values=256), request_id='m2')['result'] + self.assertIn('false_engage', full['record']['warnings']) + self.assertNotIn('false_engage', mine['record']['warnings']) + self.assertEqual(mine['record']['template_source'], dict(library='sample_library.json', template_id=None, substances=[])) + self.assertEqual(full['record']['template_source']['template_id'], 'calibration_grating_xyz') + self.assertNotIn('false_engage', s.poll(r['operation_id'])['result']['warnings']) + ev = s.invoke(instance_id=iid, capability_id='events.read', arguments=dict(since_s=0.0), request_id='e1')['result']['events'] + self.assertFalse([x for x in ev if x['kind'] == 'fault']) + self.assertTrue([x for x in e.invoke(instance_id=iid, capability_id='events.read', arguments=dict(since_s=0.0), request_id='e2')['result']['events'] + if x['code'] == 'FALSE_ENGAGE']) + + def test_records_and_control_belong_to_their_agent(self): + h = _scenario('engaged') + for n in ('a', 'b'): + h.register_principal(n, 'agent') + a, b = h.session('a'), h.session('b') + iid = h.instance_id + r = a.invoke(instance_id=iid, capability_id='scan.start', arguments=SCAN, request_id='s1') + self.assertEqual(b.invoke(instance_id=iid, capability_id='retract', arguments=dict(distance_m=1e-4), request_id='x')['error']['code'], 'ACCESS_DENIED') + self.assertTrue(b.read(instance_id=iid)['observations']['operation.started_by_other_agent']['value']) + self.assertIsNone(b.read(instance_id=iid)['observations']['operation.id']['value']) + with self.assertRaises(rt.ActionRejected): + b.poll(r['operation_id']) + wait(h, r['operation_id']) + self.assertEqual(b.invoke(instance_id=iid, capability_id='measurement.result', arguments=dict(record_id='IMG0001', channel=None, direction=None, region_px=None, + max_values=256), request_id='r')['error']['code'], 'ACCESS_DENIED') + self.assertNotIn('IMG0001', b.invoke(instance_id=iid, capability_id='records.list', arguments={}, request_id='l')['result']['records']) + self.assertEqual(b.invoke(instance_id=iid, capability_id='records.delete', arguments=dict(record_id='IMG0001'), request_id='d')['error']['code'], 'ACCESS_DENIED') + self.assertIsNone(b.read(instance_id=iid)['observations']['result.last_record_id']['value'] if 'FS0002' not in h.records else None) + ok = a.invoke(instance_id=iid, capability_id='analysis.flatten', arguments=dict(record_id='IMG0001', channel='height', direction='trace', method='plane'), + request_id='f') + self.assertEqual(h._owners[ok['result']['record_id']], 'a') + again = a.invoke(instance_id=iid, capability_id='analysis.flatten', arguments=dict(record_id='IMG0001', channel='height', direction='trace', method='plane'), + request_id='f') + self.assertEqual(again, ok) # same request id: the same response, no new record + self.assertEqual(a.invoke(instance_id=iid, capability_id='analysis.flatten', arguments=dict(record_id='IMG0001', channel='phase', direction='trace', + method='plane'), request_id='f')['error']['code'], 'REQUEST_CONFLICT') + + def test_queries_and_bookkeeping(self): + h = _scenario('fd_done') + led = h.invoke('ledger.read') + self.assertEqual(led, h.ledger()) + self.assertEqual(led['force_curves'], 2.0) + prov = h.invoke('provenance.read') + self.assertEqual(set(prov['libraries']), {'nanomechanical_library.json', 'probe_library.json', 'sample_library.json'}) + self.assertEqual((prov['substances'], prov['sample_templates']), (66, 15)) + t = h.t + self.assertAlmostEqual(h.invoke('sim.step', dt_s=2.5)['time_s'], t + 2.5, places=9) + self.assertEqual(h.invoke('records.list')['records'], sorted(h.records)) + ev = h.invoke('events.read', since_s=t) + self.assertTrue(all(e['time_s'] >= t for e in ev['events'])) + cam = h.invoke('camera.read') + self.assertEqual(cam['field_of_view_m'], list(rt.FIELD_OF_VIEW_M)) + self.assertEqual(h.invoke('system.acknowledge')['cleared'], None) + + def test_defects_become_device_errors(self): + h = _scenario('scanned') + h.register_principal('a', 'agent') + s = h.session('a') + h.records['IMG0001']['data'] = None # a corrupted record + r = s.invoke(instance_id=h.instance_id, capability_id='analysis.roughness', arguments=dict(record_id='IMG0001', channel='height', direction='trace', + flatten='plane', region_px=None), request_id='x') + self.assertEqual((r['status'], r['error']['code'], r['error']['side_effects']), ('rejected', 'DEVICE_ERROR', 'unknown')) + + +# ---------------------------------------------------------------- declared effects +class DeclaredEffects(unittest.TestCase): + def test_immediate_and_on_step_effects_are_declared(self): + """For every capability accepted in any scenario state: the slots it changes at once are declared effects, the slots whose change during the + following step differs from an identical run without the call are declared on_step effects, and the step itself only changes slots declared + as on_step effects of sim.step (the runtime noise is seeded by record and line counters, so both runs draw identical noise).""" + missing_imm, missing_step = {}, {} + states = {n: _scenario(n) for n in SCENARIOS} + for cap in rt.CAPS: + if not _executable(cap): + continue + for sname, S in states.items(): + for args in _variants(cap): + A = copy.deepcopy(S) + v0 = A.read('evaluator') + try: + _orig_invoke(A, cap, **args) + except rt.ActionRejected: + continue + v1 = A.read('evaluator') + if cap == 'sim.step': + for k in v0: + if _leaf_changed(v0[k], v1[k]) and k not in rt.ON_STEP['sim.step'] + rt.EFFECTS['sim.step']: + missing_step.setdefault('sim.step', set()).add((sname, k)) + continue + for k in v0: + if _changed(v0[k], v1[k]) and _leaf_changed(v0[k], v1[k]) and k not in rt.EFFECTS.get(cap, []): + missing_imm.setdefault(cap, set()).add((sname, k)) + for dt in STEP_DTS: + A2, B2 = copy.deepcopy(A), copy.deepcopy(S) + A2.step(dt) + B2.step(dt) + a2, b2 = A2.read('evaluator'), B2.read('evaluator') + for k in v0: + if k not in rt.ON_STEP.get(cap, []) and _step_differs(v1[k], a2[k], v0[k], b2[k]): + missing_step.setdefault(cap, set()).add((sname, k)) + if k not in rt.ON_STEP['sim.step'] + ['clock.time_s'] and _leaf_changed(v0[k], b2[k]): + missing_step.setdefault('sim.step', set()).add((sname, k)) + self.assertEqual(missing_imm, {}) + self.assertEqual(missing_step, {}) + self.assertFalse([s for v in rt.ON_STEP.values() for s in v if rt.SLOTS[s]['origin'] == 'setpoint']) + + def test_every_executable_capability_is_accepted_in_some_scenario(self): + accepted = set() + for n in SCENARIOS: + S = _scenario(n) + for cap in rt.CAPS: + if not _executable(cap) or cap in accepted: + continue + for args in _variants(cap): + try: + _orig_invoke(copy.deepcopy(S), cap, **args) + accepted.add(cap) + break + except rt.ActionRejected: + pass + self.assertEqual({c for c in rt.CAPS if _executable(c)} - accepted, set()) + + def test_long_window_effects_of_operations_are_declared(self): + """Every accepted asynchronous call is followed until its operation has left 'running' (+ 5 s), every other call for 120 s, comparing with + the identical run without the call every 0.25 s for the first 5 s and every 2 s after.""" + missing = {} + for sname in LONG_SCENARIOS: + S = _scenario(sname) + for cap in rt.CAPS: + if not _executable(cap) or cap == 'sim.step': + continue + for args in _variants(cap): + A = copy.deepcopy(S) + v0 = A.read('evaluator') + try: + res = _orig_invoke(A, cap, **args) + except rt.ActionRejected: + continue + oid = res.get('operation_id') if isinstance(res, dict) and cap in rt.ASYNC else None + v1 = A.read('evaluator') + B = copy.deepcopy(S) + t, t_end = 0.0, (1800.0 if oid else 120.0) + while t < t_end - 1e-9: + d = 0.25 if t < 5.0 - 1e-9 else 2.0 + A.step(d) + B.step(d) + t += d + a2, b2 = A.read('evaluator'), B.read('evaluator') + for k in v0: + if k not in rt.ON_STEP.get(cap, []) and _step_differs(v1[k], a2[k], v0[k], b2[k]): + missing.setdefault(cap, set()).add((sname, k)) + if oid and A.operations[oid]['phase'] != 'running' and t_end == 1800.0: + t_end = t + 5.0 + self.assertEqual(missing, {}) + + +class ReviewRound1Fixes(unittest.TestCase): + """Regression tests of the independent review round 1 (runtime F01-F12, contract C02-C04).""" + + def test_F01_F02_F12_topography_parameters_are_bounded_and_work_limited(self): + h = configured(samples=(), probes=()) + for i, (tid, ov) in enumerate([('hopg', {'terrace_width_m': 0.0}), ('ps_pmma_blend', {'domain_size_m': 0.0}), ('calibration_grating_xyz', {'pitch_m': 0.0}), + ('au_np_on_mica', {'diameter_m': 0.0}), ('graphene_on_sio2', {'flake_size_m': 0.0}), ('dna_on_mica', {'width_m': 0.0}), + ('dna_on_mica', {'persistence_length_m': 0.0}), ('mica', {'corr_length_m': 0.0}), + ('calibration_grating_xyz', {'pitch_m': 1e-6, 'edge_width_m': 0.9e-6}), # edges wider than the box + ('au_np_on_mica', {'diameter_m': 3e-9, 'diameter_sd_m': 2e-9})]): # spread above a third + rejected(h, 'sample.provide', 'INVALID_ARGUMENT', sample_id=f'b{i}', template_id=tid, seed=1, tilt_rad=[0.0, 0.0], topography_overrides=ov) + for i, (tid, ov) in enumerate([('graphene_on_sio2', {'flake_size_m': 5e-8}), ('au_np_on_mica', {'diameter_m': 2e-9, 'diameter_sd_m': 0.0, 'coverage': 0.5}), + ('dna_on_mica', {'width_m': 5e-10, 'coverage': 0.9})]): + rejected(h, 'sample.provide', 'SIMULATION_LIMIT', sample_id=f'w{i}', template_id=tid, seed=1, tilt_rad=[0.0, 0.0], topography_overrides=ov) + for tid, tpl in rt.sample_templates()['templates'].items(): # every library template is in range and cheap + w = rt.topography_work(rt.flatten_topography(tpl['topography'])) + self.assertTrue(w is not None and w <= 1.0, (tid, w)) + # the smallest accepted objects keep a read fast; a defect inside read becomes DEVICE_ERROR, never a raw exception + import time + g = ready(samples=(dict(sample_id='g', template_id='dna_on_mica', seed=1, tilt_rad=[0.0, 0.0], topography_overrides={'width_m': 1e-9}),), probes=()) + g.invoke('sample.place', sample_id='g', offset_x_m=0.0, offset_y_m=0.0) + g.register_principal('a', 'agent') + a = g.session('a') + t0 = time.time() + for _ in range(5): + a.read(instance_id=g.instance_id, state_ids=['clock.time_s']) + self.assertLess(time.time() - t0, 5.0) + g._pspd = lambda: 1 / 0 + with self.assertRaises(rt.ActionRejected) as ctx: + a.read(instance_id=g.instance_id) + self.assertEqual(str(ctx.exception), 'DEVICE_ERROR') + + def test_F03_xy_moves_check_the_whole_path_and_a_resting_tip(self): + h = ready() + mount(h, 'cont1') + align(h) + h.invoke('sample.place', sample_id='grating', offset_x_m=0.0, offset_y_m=0.0) + settle(h) + h.invoke('stage.move_xy', x_m=-0.0095, y_m=0.0) + settle(h) + h.invoke('z_stage.move', z_m=rt.Z_STAGE_LIMITS_M[0]) # touch stop on the holder beside the sample + settle(h) + self.assertEqual(h.events[-1]['code'], 'TOUCH_STOP') + rejected(h, 'stage.move_xy', 'COLLISION_RISK', x_m=0.0095, y_m=0.0) # the tip rests on the holder + h.invoke('z_stage.move', z_m=h.qz + 0.5e-3) + settle(h) + self.assertLess(h._tip_z(), h._top_z(h._sample())) # still below the sample top + rejected(h, 'stage.move_xy', 'COLLISION_RISK', x_m=0.0095, y_m=0.0) # the sample lies on the path + h.invoke('stage.move_xy', x_m=-0.0090, y_m=0.0) # along the holder: allowed + settle(h) + h.invoke('z_stage.move', z_m=h.qz + 3e-3) + settle(h) + h.invoke('stage.move_xy', x_m=0.0095, y_m=0.0) # high above everything: allowed + settle(h) + self.assertTrue(np.allclose(h.read()['stage.xy_m'], [0.0095, 0.0], atol=1e-12)) + + def test_F04_the_approach_holds_the_tip_after_the_trigger(self): + h = ready() + mount(h, 'tap1') + align(h) + dynamic(h) + h.invoke('sample.place', sample_id='grating', offset_x_m=0.0, offset_y_m=0.0) + settle(h) + near(h) + op = h.invoke('approach', setpoint_force_n=None, setpoint_amplitude_m=16e-9, z_servo_gain=1.0)['operation_id'] + rows = [] + while h.operations[op]['phase'] == 'running': + h.step(0.25) + ev = h.read('evaluator') + rows.append((ev['truth.gap_m'], ev['zscanner.extension_m'], h._tip_z(), ev['engage.state'])) + before = [r for r in rows if r[0] is not None] + after = [r for r in rows if r[0] is None and r[3] == 'approaching'] + self.assertTrue(before and after) + self.assertGreater(min(r[0] for r in before), 0.0) # never inside the sample + ext = [r[1] for r in after] + self.assertTrue(all(b <= a + 1e-15 for a, b in zip(ext, ext[1:]))) # the Z detector falls continuously ... + self.assertAlmostEqual(ext[-1], rt.Z_SCAN_RANGE_M * rt.APPROACH_TARGET_EXTENSION, delta=1e-9) # ... to half extension + self.assertLess(max(r[2] for r in after) - min(r[2] for r in after), 1e-10) # the tip stays at the operating point + self.assertAlmostEqual(h.read()['zscanner.extension_m'], rt.Z_SCAN_RANGE_M * rt.APPROACH_TARGET_EXTENSION, delta=1e-9) + + def test_F05_the_drive_belongs_to_the_mounted_probe(self): + h = tapping_engaged() + pr = h._probe() + self.assertAlmostEqual(h.engaged['mp']['A_free'], + h.drive['A_res'] * float(rt.lorentz_amp(h.drive['frequency_hz'], pr['truth']['f0'], pr['truth']['Q'])), delta=1e-15) + h.invoke('retract', distance_m=100e-6) + settle(h) + mount(h, 'multi1') + align(h) + self.assertIsNone(h.read()['ncm.drive']) # the exchange clears the drive + h.invoke('head.configure', mode='tapping', cantilever_db='multi75al_g') + near(h) + rejected(h, 'approach', 'DRIVE_NOT_SET', setpoint_force_n=None, setpoint_amplitude_m=16e-9, z_servo_gain=1.0) + dynamic(h, db='multi75al_g') + shown = h.read()['ncm.amplitude_m'] + rejected(h, 'approach', 'SETPOINT_OUT_OF_RANGE', setpoint_force_n=None, setpoint_amplitude_m=shown * 1.01, z_servo_gain=1.0) + h.invoke('head.configure', mode='tapping', cantilever_db='ac160ts') # another database entry clears it too + self.assertIsNone(h.read()['ncm.drive']) + + def test_F06_error_channels_are_volts(self): + h = tapping_engaged() + rec = scan(h, pixels_x=64, pixels_y=32) + e = np.asarray(rec['data']['error']['trace'], float) + S = h._optics()['S'] + self.assertEqual(rec['meta']['channel_units']['error'], 'V') + self.assertGreater(np.nanstd(e), 1e-4) # lock-in amplitude signal (V), not metres + self.assertLess(np.nanstd(e) / S, 5e-9) + c = contact_engaged(sample=SIO2) + rc = scan(c, pixels_x=64, pixels_y=32) + self.assertGreater(np.nanstd(np.asarray(rc['data']['error']['trace'], float)), 1e-5) + + def test_F07_the_contact_set_point_is_held_on_the_erf_response(self): + c = ready() + mount(c, 'cont1') + align(c) + c.invoke('head.configure', mode='contact', cantilever_db='contal_g') + from scipy.special import erfinv + c.invoke('head.turn_knob', knob='pspd_y', turns=float(erfinv(-0.85)) * rt.PSPD_SPOT_W_M / rt.KNOB_PSPD_M_PER_TURN) + V_free = c.read()['pspd.vertical_v'] + self.assertAlmostEqual(V_free / c.read()['pspd.intensity_v'], -0.85, delta=1e-6) + c.invoke('sample.place', sample_id='wafer', offset_x_m=0.0, offset_y_m=0.0) + settle(c) + near(c) + wait(c, c.invoke('approach', setpoint_force_n=20e-9, setpoint_amplitude_m=None, z_servo_gain=1.0)['operation_id']) + o = c._optics() + V_set = V_free + 20e-9 * c.cal['sensitivity_v_per_m'] / c.cal['spring_constant_n_m'] + self.assertAlmostEqual(c.read()['pspd.vertical_v'], V_set, delta=1e-9) # the engaged VERTICAL is the set point + d = rt.pspd_inverse(o['I'], o['p_v'], o['S'], V_set) + self.assertAlmostEqual(c.read('evaluator')['truth.tip_force_n'], c._probe()['truth']['k'] * d, delta=1e-15) + self.assertGreater(c.read('evaluator')['truth.tip_force_n'], 1.3 * 20e-9 * c._probe()['truth']['k'] / c.cal['spring_constant_n_m'] + * c.cal['sensitivity_v_per_m'] / o['S']) # the erf slope is lower off-centre: more load + + def test_F08_a_touch_stopped_tip_rests_on_the_surface(self): + d = ready() + mount(d, 'cont1') + align(d) + d.invoke('head.configure', mode='contact', cantilever_db='contal_g') + d.invoke('sample.place', sample_id='wafer', offset_x_m=0.0, offset_y_m=0.0) + settle(d) + near(d, gap=50e-6) + d.invoke('z_stage.move', z_m=d.qz - 200e-6) + settle(d) + ev = d.read('evaluator') + self.assertEqual((d.events[-1]['code'], ev['truth.gap_m']), ('TOUCH_STOP', 0.0)) + self.assertAlmostEqual(ev['truth.tip_force_n'], d._probe()['truth']['k'] * rt.TOUCH_OVERSHOOT_M, delta=1e-12) + o = d._optics() + self.assertAlmostEqual(ev['pspd.vertical_v'], float(rt.pspd_signal(o['I'], o['p_v'], o['S'], rt.TOUCH_OVERSHOOT_M)), delta=1e-12) + rejected(d, 'calibration.thermal_tune', 'TIP_IN_CONTACT', temperature_k=295.15, averages=10) + rejected(d, 'approach', 'TIP_IN_CONTACT', setpoint_force_n=5e-9, setpoint_amplitude_m=None, z_servo_gain=1.0) + d.invoke('z_stage.move', z_m=d.qz + 100e-6) + settle(d) + ev = d.read('evaluator') + self.assertGreater(ev['truth.gap_m'], 90e-6) + self.assertIsNone(ev['truth.tip_force_n']) + self.assertAlmostEqual(ev['pspd.vertical_v'], float(rt.pspd_signal(o['I'], o['p_v'], o['S'], 0.0)), delta=1e-12) + + def test_F09_record_memory_and_large_replays_are_bounded(self): + h = tapping_engaged() + old = rt.RECORD_MEMORY_BYTES + try: + rt.RECORD_MEMORY_BYTES = h._record_bytes() + 4 * 64 * 64 * 4 * 2 - 1 # one more 64 x 64 image with retrace does not fit + rejected(h, 'scan.start', 'RECORDS_FULL', **dict(SCAN, save_retrace=True)) + finally: + rt.RECORD_MEMORY_BYTES = old + rec = scan(h, pixels_x=128, pixels_y=128) + h.register_principal('ev', 'evaluator') + e = h.session('ev') + args = dict(record_id=rec['record_id'], channel=None, direction=None, region_px=None, max_values=65536) + first = e.invoke(instance_id=h.instance_id, capability_id='measurement.result', arguments=args, request_id='q0') + self.assertEqual(e.invoke(instance_id=h.instance_id, capability_id='measurement.result', arguments=args, request_id='q0'), first) + for i in range(1, rt.LARGE_RESPONSE_KEEP + 3): + e.invoke(instance_id=h.instance_id, capability_id='measurement.result', arguments=args, request_id=f'q{i}') + self.assertLessEqual(len(h._large_requests['ev']), rt.LARGE_RESPONSE_KEEP) + self.assertIsNone(h._requests[('ev', 'q0')][1]) # the oldest large result is no longer held, + self.assertEqual(e.invoke(instance_id=h.instance_id, capability_id='records.delete', arguments=dict(record_id=rec['record_id']), + request_id='q0')['error']['code'], 'REQUEST_CONFLICT') # but its request id stays bound (F17) + again = e.invoke(instance_id=h.instance_id, capability_id='measurement.result', arguments=args, request_id='q0') + self.assertEqual(again['result'], first['result']) # a replayed read-only query gives the same result + + def test_F10_a_truncated_tip_footprint_is_flagged_for_the_evaluator(self): + h = tapping_engaged(sample=TALL) + h.register_principal('a', 'agent') + a = h.session('a') + r = a.invoke(instance_id=h.instance_id, capability_id='scan.start', request_id='fp', + arguments=dict(SCAN, size_m=2e-6, pixels_x=512, pixels_y=16, rate_hz=1.0)) + h.step(20.0) + rec = h.records[h.operations[r['operation_id']]['record_id']] + self.assertIn('tip_footprint_truncated', rec['warnings']) + seen = a.invoke(instance_id=h.instance_id, capability_id='measurement.result', request_id='fp2', + arguments=dict(record_id=rec['record_id'], channel='height', direction='trace', region_px=None, max_values=64)) + self.assertNotIn('tip_footprint_truncated', seen['result']['record']['warnings']) + + def test_F11_a_refused_cancel_answers_with_the_response_envelope(self): + h = _scenario('engaged') + h.register_principal('a', 'agent') + h.register_principal('b', 'agent') + a, b = h.session('a'), h.session('b') + r = a.invoke(instance_id=h.instance_id, capability_id='scan.start', arguments=SCAN, request_id='s1') + c = b.cancel(r['operation_id'], 'x1') + self.assertEqual((c['status'], c['error']['code'], c['error']['side_effects']), ('rejected', 'ACCESS_DENIED', 'none')) + self.assertEqual(h.operations[r['operation_id']]['phase'], 'running') + self.assertEqual(a.cancel('OP9999', 'x2')['error']['code'], 'UNKNOWN_OPERATION') + + def test_C02_C03_C04_contract_texts_and_latched_stage_faults(self): + m = rt.export_park_nx10_contract_metadata() + slots, caps = m['state_slots'], m['capabilities'] + self.assertIn('逆时针', slots['knob.beam_x_turns']['meaning_zh']) + self.assertIn('逆时针', caps['head.turn_knob']['input_schema']['properties']['turns']['x-reference-conditions']) + self.assertTrue(slots['truth.drift_m'].get('reference_conditions')) + codes = lambda k: {e['code'] for e in caps[k]['errors']} # noqa: E731 + self.assertNotIn('XY_STAGE_FAULT', codes('stage.move_xy')) + self.assertNotIn('Z_STAGE_FAULT', codes('z_stage.move') | codes('retract')) + self.assertNotIn('MOTION_IN_PROGRESS', codes('ncm.set_drive')) + h = ready() + h.invoke('fault.inject', fault='xy_stage_stall', active=True) + out = h.invoke('stage.move_xy', x_m=0.004, y_m=0.0) # accepted, the stall is latched + self.assertEqual((out['duration_s'], out['target_m'], h.read()['system.error_code']), (0.0, [0.0, 0.0], 'XY_STAGE_FAULT')) + + +class ReviewRound2Fixes(unittest.TestCase): + """Regression tests of the independent review round 2 (runtime F13-F19, contract C06-C08).""" + + def _over_holder_below_the_sample_top(self, xy): + h = ready() + mount(h, 'cont1') + align(h) + h.invoke('sample.place', sample_id='grating', offset_x_m=0.0, offset_y_m=0.0) + settle(h) + h.invoke('stage.move_xy', x_m=xy[0], y_m=xy[1]) + settle(h) + h.invoke('z_stage.move', z_m=rt.Z_STAGE_LIMITS_M[0]) # touch stop on the holder + settle(h) + h.invoke('z_stage.move', z_m=h.qz + 0.5e-3) + settle(h) + self.assertLess(h._tip_z(), h._top_z(h._sample())) + return h + + def test_F13_one_motorized_stage_at_a_time(self): + h = self._over_holder_below_the_sample_top((-0.0095, 0.0)) + h.invoke('z_stage.move', z_m=h.qz - 0.4e-3) # still above the holder + rejected(h, 'stage.move_xy', 'MOTION_IN_PROGRESS', x_m=0.0, y_m=0.0) + settle(h) + h.invoke('stage.move_xy', x_m=-0.0090, y_m=0.0) + rejected(h, 'z_stage.move', 'MOTION_IN_PROGRESS', z_m=rt.Z_STAGE_LIMITS_M[0]) + settle(h) + self.assertGreaterEqual(h.read('evaluator')['truth.gap_m'] if h.read('evaluator')['truth.gap_m'] is not None else 1.0, 0.0) + + def test_F14_a_path_clipping_a_sample_corner_is_refused(self): + # sample-frame segment p(t) = (2.5 mm - 5 um + t, 2.5 mm - 5 um - t), |t| <= 1 mm: it cuts the corner of the 5 x 5 mm grating by a 14 um chord + a, b = (-0.001495, -0.003495), (-0.003495, -0.001495) + h = self._over_holder_below_the_sample_top(a) + rejected(h, 'stage.move_xy', 'COLLISION_RISK', x_m=b[0], y_m=b[1]) + self.assertTrue(rt._segment_hits_box((0.002495 - 0.001, 0.002495 + 0.001), (0.002495 + 0.001, 0.002495 - 0.001), 0.0025, 0.0025)) + self.assertFalse(rt._segment_hits_box((0.002505 - 0.001, 0.002505 + 0.001), (0.002505 + 0.001, 0.002505 - 0.001), 0.0025, 0.0025)) + + def test_F15_F16_a_broken_lever_carries_no_load_and_a_pressed_tip_is_not_lowered_again(self): + d = ready() + mount(d, 'cont1') + align(d) + d.invoke('sample.place', sample_id='wafer', offset_x_m=0.0, offset_y_m=0.0) + settle(d) + near(d, gap=50e-6) + d.invoke('z_stage.move', z_m=d.qz - 200e-6) + settle(d) + n_touch, r0 = sum(e['code'] == 'TOUCH_STOP' for e in d.events), d._probe()['radius'] + rejected(d, 'z_stage.move', 'TIP_IN_CONTACT', z_m=d.qz - 50e-6) # F16: no second touch stop, no extra wear + self.assertEqual((sum(e['code'] == 'TOUCH_STOP' for e in d.events), d._probe()['radius']), (n_touch, r0)) + c = ready() + mount(c, 'cont1') + align(c) + c.invoke('sample.place', sample_id='wafer', offset_x_m=0.0, offset_y_m=0.0) + settle(c) + near(c, gap=50e-6) + from scipy.special import erfinv + c.invoke('head.turn_knob', knob='pspd_y', turns=float(erfinv(0.95)) * rt.PSPD_SPOT_W_M / rt.KNOB_PSPD_M_PER_TURN) # PSPD far off: no touch detection + c.invoke('z_stage.move', z_m=c.qz - 200e-6) + settle(c) + self.assertEqual(c._probe()['damage'], 'cantilever_broken') + self.assertIsNone(c.read('evaluator')['truth.tip_force_n']) # F15 + + def test_F17_an_evicted_request_id_stays_bound_to_its_query(self): + h = tapping_engaged() + rec = scan(h, pixels_x=128, pixels_y=128) + h.register_principal('ev', 'evaluator') + e = h.session('ev') + args = dict(record_id=rec['record_id'], channel=None, direction=None, region_px=None, max_values=65536) + first = e.invoke(instance_id=h.instance_id, capability_id='measurement.result', arguments=args, request_id='q0') + for i in range(1, rt.LARGE_RESPONSE_KEEP + 2): + e.invoke(instance_id=h.instance_id, capability_id='measurement.result', arguments=args, request_id=f'q{i}') + c = e.invoke(instance_id=h.instance_id, capability_id='records.delete', arguments=dict(record_id=rec['record_id']), request_id='q0') + self.assertEqual(c['error']['code'], 'REQUEST_CONFLICT') + self.assertIn(rec['record_id'], h.records) + self.assertEqual(e.invoke(instance_id=h.instance_id, capability_id='measurement.result', arguments=args, request_id='q0')['result'], first['result']) + + def test_F18_topography_statistics_only_for_the_height_channel(self): + h = tapping_engaged() + rec = scan(h, pixels_x=64, pixels_y=32) + rejected(h, 'analysis.roughness', 'INVALID_ARGUMENT', record_id=rec['record_id'], channel='error', direction='trace', flatten='line_1', region_px=None) + rejected(h, 'analysis.step_height', 'INVALID_ARGUMENT', record_id=rec['record_id'], channel='phase', direction='trace', flatten='line_1', + method='histogram', region_a_px=None, region_b_px=None) + f = h.invoke('analysis.flatten', record_id=rec['record_id'], channel='error', direction='trace', method='line_1') + self.assertIsNone(f['stats']) + self.assertEqual(h.records[f['record_id']]['meta']['unit'], 'V') + self.assertIsNotNone(h.invoke('analysis.flatten', record_id=rec['record_id'], channel='height', direction='trace', method='line_1')['stats']) + + def test_C06_C07_C08_error_meanings_drift_frame_and_the_flatten_memory_cap(self): + m = rt.export_park_nx10_contract_metadata() + err = {e['code']: e['meaning_zh'] for e in m['capabilities']['sample.provide']['errors']} + self.assertIn('程序化形貌对象过多', err['SIMULATION_LIMIT']) + self.assertIn('2048', {e['code']: e['meaning_zh'] for e in m['capabilities']['scan.start']['errors']}['SIMULATION_LIMIT']) + self.assertIn('针尖相对样品', m['state_slots']['truth.drift_m']['reference_conditions']) + h = configured(samples=(), probes=()) + h.register_principal('ev', 'evaluator') + r = h.session('ev').invoke(instance_id=h.instance_id, capability_id='sample.provide', request_id='p', + arguments=dict(sample_id='g', template_id='graphene_on_sio2', seed=1, tilt_rad=[0.0, 0.0], topography_overrides={'flake_size_m': 5e-8})) + self.assertEqual(r['error']['code'], 'SIMULATION_LIMIT') + self.assertIn('程序化形貌对象过多', r['error']['message']) + t = tapping_engaged() + rec = scan(t, pixels_x=64, pixels_y=32) + old = rt.RECORD_MEMORY_BYTES + try: + rt.RECORD_MEMORY_BYTES = t._record_bytes() + 4 * 64 * 32 - 1 + rejected(t, 'analysis.flatten', 'RECORDS_FULL', record_id=rec['record_id'], channel='height', direction='trace', method='plane') + finally: + rt.RECORD_MEMORY_BYTES = old + + +class ReviewRound3Fixes(unittest.TestCase): + """Regression tests of the independent review round 3 (runtime F20, F21; contract C11, C12).""" + + def test_F20_the_path_guard_includes_the_sample_tilt(self): + tilted = dict(sample_id='tilted', template_id='si_wafer', seed=3, tilt_rad=[0.02, 0.0]) + h = ready(samples=(tilted,), probes=(('cont1', 'contal_g'),)) + mount(h, 'cont1') + align(h) + h.invoke('sample.place', sample_id='tilted', offset_x_m=0.0, offset_y_m=0.0) + settle(h) + near(h, 50e-6) # 50 um above the surface at the centre + rejected(h, 'stage.move_xy', 'COLLISION_RISK', x_m=-0.004, y_m=0.0) # uphill: the surface rises 80 um under the path + h.invoke('stage.move_xy', x_m=0.004, y_m=0.0) # downhill: allowed + settle(h) + self.assertGreater(h.read('evaluator')['truth.gap_m'], 50e-6) + self.assertGreater(h._top_z_max(h._sample()) - h._top_z(h._sample()), 0.02 * 0.005 - 1e-12) # the tilted top counts in the clearances + + def test_F21_no_focus_move_while_the_head_slides(self): + h = ready() + h.invoke('z_stage.move', z_m=0.005) + settle(h) + h.invoke('head.remove') + self.assertEqual(h.read()['head.state'], 'moving') + rejected(h, 'focus.move', 'MOTION_IN_PROGRESS', position_m=0.015) + settle(h) + h.invoke('focus.move', position_m=rt.FOCUS_REF_M) + + def test_C11_C12_record_and_topography_limit_meanings(self): + m = rt.export_park_nx10_contract_metadata() + meaning = lambda k, c: {e['code']: e['meaning_zh'] for e in m['capabilities'][k]['errors']}[c] # noqa: E731 + self.assertIn('2 GiB', meaning('scan.start', 'RECORDS_FULL')) + self.assertIn('2 GiB', meaning('analysis.flatten', 'RECORDS_FULL')) + for k in ('fd.acquire', 'calibration.thermal_tune', 'ncm.frequency_sweep'): + self.assertNotIn('GiB', meaning(k, 'RECORDS_FULL')) # these only meet the 200-record limit + self.assertNotIn('400', meaning('sample.provide', 'SIMULATION_LIMIT')) # no unreachable cause + + +class ReviewRound4Fixes(unittest.TestCase): + """Regression tests of the independent review round 4 (runtime F22, F23; contract C13).""" + + def test_F22_the_step_staircase_slope_counts_in_the_path_guard(self): + h = ready() + mount(h, 'cont1') + align(h) + h.invoke('sample.place', sample_id='hopg', offset_x_m=0.0, offset_y_m=0.0) + settle(h) + near(h, 1.5e-6) # 1.5 um above the terraces at the centre + d = rt.sample_templates()['templates']['hopg']['topography']['direction_rad'] + d = d['value'] if isinstance(d, dict) else d + up = (-0.0045 * math.cos(d), -0.0045 * math.sin(d)) # the staircase rises along +u of the sample frame + rejected(h, 'stage.move_xy', 'COLLISION_RISK', x_m=round(up[0], 5), y_m=round(up[1], 5)) + h.invoke('stage.move_xy', x_m=round(-up[0], 5), y_m=round(-up[1], 5)) # downhill: allowed + settle(h) + self.assertGreater(h.read('evaluator')['truth.gap_m'], 1.5e-6) + g = configured(samples=(), probes=()) + rejected(g, 'sample.provide', 'INVALID_ARGUMENT', sample_id='steep', template_id='hopg', seed=1, tilt_rad=[0.0, 0.0], + topography_overrides={'step_height_m': 1e-7, 'terrace_width_m': 1e-6}) # slope 0.1: not an atomic-step surface + g.invoke('sample.provide', sample_id='vicinal', template_id='hopg', seed=1, tilt_rad=[0.0, 0.0], topography_overrides={'step_height_m': 1e-8}) + self.assertAlmostEqual(math.hypot(*g.samples['vicinal']['surface'].mean_slope()), 1e-8 / 8e-7, delta=1e-12) + + def test_F23_the_head_does_not_slide_while_the_focus_moves(self): + h = ready() + h.invoke('z_stage.move', z_m=0.005) + settle(h) + h.invoke('focus.move', position_m=0.014) + rejected(h, 'head.remove', 'MOTION_IN_PROGRESS') + settle(h) + h.invoke('focus.move', position_m=rt.FOCUS_REF_M) + settle(h) + h.invoke('head.remove') + settle(h) + h.invoke('focus.move', position_m=0.009) + rejected(h, 'head.attach', 'MOTION_IN_PROGRESS') + + def test_C13_clearance_texts_name_the_highest_point(self): + caps = rt.export_park_nx10_contract_metadata()['capabilities'] + for k in ('sample.place', 'sample.remove', 'head.remove', 'head.attach'): + self.assertIn('最高点', caps[k]['function_zh'] if 'function_zh' in caps[k] else json.dumps(caps[k], ensure_ascii=False)) + self.assertIn('沿直线路径', json.dumps(caps['stage.move_xy'], ensure_ascii=False)) + + +class ZZRejectionCodes(unittest.TestCase): + def test_every_observed_rejection_code_is_declared(self): + """Runs last (class name): every code raised by a device call anywhere in this test module is declared for that capability.""" + undeclared = {k: sorted(v - set(rt.CAP_ERRORS.get(k, [])) - {'INVALID_ARGUMENT', 'UNSUPPORTED', 'UNKNOWN_CAPABILITY'}) + for k, v in REJECTIONS.items()} + self.assertEqual({k: v for k, v in undeclared.items() if v}, {}) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_asset_peak_precisionhydrogen.py b/tests/test_asset_peak_precisionhydrogen.py new file mode 100644 index 0000000000000000000000000000000000000000..4e855483f9751c1cd6c47c4f10009e230cd14ae0 --- /dev/null +++ b/tests/test_asset_peak_precisionhydrogen.py @@ -0,0 +1,424 @@ +"""tests for CHEM-196 peak_precisionhydrogen (PEAK Scientific Precision Hydrogen Trace 500): python3 -m unittest tests/test_asset_peak_precisionhydrogen.py + +Themes: contract consistency (slots, effects, errors raised vs declared); agent / evaluator truth isolation; idempotent request ids; two instances +isolated; step-partition independence; rejected calls leave the state unchanged; every output validated against its schema and every success +changes only declared slots; Faraday production at the set pressure up to 500 sccm; power-up diagnostics and leak test (about 6 min), internal +leak -> leak test failure / standby leak check; demand above capacity or external leak -> LOW_PRESSURE shutdown; overpressure switch; +depressurise and restart; water: loading pump, bottle running dry -> WATER_LOW, refill, de-ionizer breakthrough -> WATER_QUALITY; dryer dew point +after the 24 h run-in; O2 purity and membrane crossover; hydrogen and water ledgers closing exactly.""" +import json +import math +import re +import sys +import unittest +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / 'scripts')) +from asset_runtime import peak_precisionhydrogen as rt # noqa: E402 + +INST = 'peak_precisionhydrogen_01' +CHECKS = [] +SEEN_CAPS = set() +PROCESS_EVIDENCE = {} +GC = dict(demand_sccm=150.0, min_pressure_pa=2.5e5) + + +def _differ(x, y): + if isinstance(x, float) and isinstance(y, float): + return abs(x - y) > 1e-12 * max(1.0, abs(x), abs(y)) + return json.dumps(x, sort_keys=True, default=str) != json.dumps(y, sort_keys=True, default=str) + + +class Rig: + def __init__(self, seed=1, instance=INST, **plant): + self.h = rt.PeakPrecisionhydrogenRuntime(instance) + self.h.register_principal('agent', 'agent') + self.h.register_principal('eval', 'evaluator') + self.A = self.h.session('agent') + self.E = self.h.session('eval') + self.n = 0 + self.inst = instance + self.call(self.E, 'plant.configure', **dict(rt.PLANT_EXAMPLE, noise_seed=seed, **plant)) + + def call(self, sess, cap, expect='succeeded', **args): + self.n += 1 + before, t0 = self.h.read('evaluator'), self.h.t + r = sess.invoke(instance_id=self.inst, capability_id=cap, arguments=args, request_id=f'r{self.n}') + after = self.h.read('evaluator') + changed = {k for k in after if _differ(after[k], before[k])} - {'clock.time_s'} + if expect == 'succeeded': + assert r['status'] == 'succeeded', (cap, r['error']) + rt.validate(rt.CAPS[cap]['output_schema'], r['result']) + if cap != 'sim.step': + extra = changed - set(rt.EFFECTS.get(cap, [])) + assert not extra, (cap, sorted(extra)) + assert self.h.t == t0, cap + SEEN_CAPS.add(cap) + PROCESS_EVIDENCE.setdefault(cap, []).append(dict(arguments=json.dumps(args, sort_keys=True, default=str)[:200], time_s=t0, status=r['status'])) + return r['result'] + assert r['status'] in ('rejected', 'unsupported'), (cap, r['status'], r.get('result')) + assert r['error']['code'] == expect, (cap, r['error']['code'], expect) + assert not changed, (cap, 'rejected call changed', sorted(changed)) + assert expect in [e['code'] for e in rt.export_peak_precisionhydrogen_contract_metadata()['capabilities'][cap]['errors']], (cap, expect) + return r + + def step(self, s): + self.call(self.E, 'sim.step', dt_s=float(s)) + + def read(self, *ids, who=None): + sess = who or self.E + o = sess.read(instance_id=self.inst, state_ids=list(ids) if ids else None)['observations'] + return {k: v['value'] for k, v in o.items()} if not ids or len(ids) > 1 else o[ids[0]]['value'] + + def ready(self): + self.call(self.A, 'power.set', on=True) + self.step(rt.DOC['leak_test_s'] + 10.0) + + def until(self, pred, limit, every=0.5): + t = 0.0 + while not pred() and t < limit: + self.step(every) + t += every + return t + + def ledger(self): + return self.call(self.E, 'ledger.read')['ledger'] + + +def _raised_codes(): + src = Path(rt.__file__).read_text() + funcs = {} + for m in re.finditer(r'\n def (\w+)\(self[^\n]*\n(.*?)(?=\n def |\n# ----|\nclass |\ndef )', src, re.S): + funcs[m.group(1)] = m.group(2) + own = {k: set(re.findall(r"ActionRejected\('([A-Z_]+)'\)", v)) for k, v in funcs.items()} + calls = {k: set(re.findall(r'self\.(_\w+)\(', v)) & set(funcs) for k, v in funcs.items()} + out = {} + for k in funcs: + if not k.startswith('_cmd_'): + continue + seen, todo, codes = set(), [k], set() + while todo: + f = todo.pop() + if f in seen: + continue + seen.add(f) + codes |= own.get(f, set()) + todo += [g for g in calls.get(f, ()) if g not in ('_cmd_sim_step', 'step', '_tick')] + out[k[5:].replace('_', '.', 1)] = codes + return out + + +def _balance(test, L): + test.assertAlmostEqual(L['h2_initial_mol'] + L['h2_made_mol'], + L['h2_stored_mol'] + L['h2_delivered_mol'] + L['h2_external_leak_mol'] + L['h2_internal_leak_mol'] + L['h2_vented_mol'], + delta=1e-9 * (L['h2_initial_mol'] + L['h2_made_mol'])) + test.assertAlmostEqual(L['water_initial_kg'] + L['water_added_kg'], L['water_in_tank_kg'] + L['water_in_bottle_kg'] + L['water_electrolysed_kg'] + L['water_lost_kg'], + delta=1e-9 * (L['water_initial_kg'] + L['water_added_kg'])) + + +class Contract(unittest.TestCase): + def test_metadata_slots_effects_consistent(self): + meta = rt.export_peak_precisionhydrogen_contract_metadata() + slots = set(meta['state_slots']) + self.assertEqual(slots, set(rt.SLOTS)) + for k, c in meta['capabilities'].items(): + for e in c['state_effects']: + self.assertIn(e['state_id'], slots, k) + self.assertTrue({'INVALID_ARGUMENT', 'REQUEST_CONFLICT', 'UNKNOWN_INSTANCE'} <= {e['code'] for e in c['errors']}, k) + self.assertTrue(rt.SCENE_MIRRORED <= slots) + for name, p in meta['mechanisms']['pem_hydrogen_generation']['parameters'].items(): + self.assertEqual(name, name.lower()) + self.assertIn(p['evidence'], ('documented', 'assumption'), name) + + def test_declared_errors_cover_raised_codes(self): + meta = rt.export_peak_precisionhydrogen_contract_metadata() + for cap, codes in _raised_codes().items(): + declared = {e['code'] for e in meta['capabilities'][cap]['errors']} + self.assertTrue(codes <= declared, (cap, sorted(codes - declared))) + + def test_unsupported_capabilities(self): + g = Rig() + for k in rt.UNSUPPORTED: + g.call(g.A, k, expect='UNSUPPORTED') + + def test_agent_truth_isolation(self): + g = Rig() + g.ready() + self.assertFalse(any(k.startswith('truth.') for k in g.read(who=g.A))) + r = g.A.invoke(instance_id=INST, capability_id='truth.inspect', arguments={}, request_id='x') + self.assertEqual(r['error']['code'], 'ACCESS_DENIED') + r = g.A.invoke(instance_id=INST, capability_id='consumer.set', arguments=GC, request_id='y') + self.assertEqual(r['error']['code'], 'ACCESS_DENIED') + g.call(g.E, 'fault.inject', fault='membrane_crossover', active=True) + self.assertFalse(any(e['kind'] in ('fault', 'truth') for e in g.call(g.A, 'events.read', since_s=0.0)['events'])) + + def test_idempotent_request_ids(self): + g = Rig() + a = g.A.invoke(instance_id=INST, capability_id='power.set', arguments=dict(on=True), request_id='same') + b = g.A.invoke(instance_id=INST, capability_id='power.set', arguments=dict(on=True), request_id='same') + self.assertEqual(a, b) + c = g.A.invoke(instance_id=INST, capability_id='power.set', arguments=dict(on=False), request_id='same') + self.assertEqual(c['error']['code'], 'REQUEST_CONFLICT') + + def test_two_instances_isolated(self): + a, b = Rig(instance='i1'), Rig(instance='i2') + a.ready() + self.assertFalse(b.read('power.on')) + + def test_step_partition_independence(self): + runs = [] + for parts in ([1200.0], [0.3, 7.7, 400.0, 792.0], [0.5] * 40 + [1180.0]): + g = Rig(seed=7) + g.call(g.E, 'consumer.set', **GC) + g.call(g.A, 'power.set', on=True) + for p in parts: + g.step(p) + v = g.read() + v.pop('clock.time_s') + runs.append(json.dumps(v, sort_keys=True, default=str)) + self.assertEqual(runs[0], runs[1]) + self.assertEqual(runs[0], runs[2]) + + def test_rejections_change_nothing(self): + g = Rig() + r = rt.PeakPrecisionhydrogenRuntime('fresh') + r.register_principal('e', 'evaluator') + self.assertEqual(r.session('e').invoke(instance_id='fresh', capability_id='power.set', arguments=dict(on=True), request_id='p')['error']['code'], 'PLANT_REQUIRED') + g.call(g.E, 'plant.configure', expect='SEED_FIXED', **dict(rt.PLANT_EXAMPLE, noise_seed=2)) + g.call(g.A, 'cycle.start', expect='POWER_OFF') + g.call(g.A, 'settings.configure', expect='POWER_OFF', pressure_set_pa=4e5) + g.call(g.A, 'water.refill', expect='BOTTLE_OVERFLOW', volume_m3=0.002) + g.call(g.A, 'power.set', on=True) + g.call(g.A, 'cycle.start', expect='DIAGNOSTICS_RUNNING') + g.call(g.A, 'output.depressurise', expect='DIAGNOSTICS_RUNNING') + g.call(g.A, 'alarm.mute', expect='NO_ALARM') + g.call(g.A, 'deioniser.replace', expect='POWER_ON') + g.call(g.A, 'settings.configure', expect='INVALID_ARGUMENT', pressure_set_pa=8e5) + g.call(g.E, 'fault.inject', expect='INVALID_ARGUMENT', fault='alien', active=True) + + +class Physics(unittest.TestCase): + def test_diagnostics_start_and_faraday(self): + g = Rig() + g.call(g.A, 'power.set', on=True) + g.step(1.0) + self.assertEqual(g.read('state.current'), 'diagnostics') + self.assertIsNotNone(g.read('state.remaining_s')) + t = g.until(lambda: g.read('state.current') == 'standby', 900.0, 1.0) + self.assertAlmostEqual(t, 360.0, delta=15.0) + self.assertTrue(g.read('indicator.ok')) + g.call(g.E, 'consumer.set', **GC) + g.call(g.A, 'cycle.toggle') + g.step(900.0) + tg = g.read('truth.gas') + self.assertAlmostEqual(tg['delivered_sccm'], 150.0, delta=0.5) + self.assertAlmostEqual(g.read('flow.percent'), 30.0, delta=0.5) + cell = g.read('truth.cell') + self.assertAlmostEqual(cell['current_a'], 2 * rt.F_CONST * (1 + rt.ENG['psa_purge_fraction']) * tg['product_mol_s'], delta=1e-9) + self.assertAlmostEqual(g.read('pressure.delivery_pa'), g.read('pressure.set_pa'), delta=0.3e5) + g.call(g.A, 'settings.configure', units='bar') + self.assertAlmostEqual(g.read('display.pressure'), round(g.read('pressure.delivery_pa') / 1e5, 1), delta=0.11) + g.call(g.A, 'cycle.stop') + self.assertEqual(g.read('state.current'), 'standby') + _balance(self, g.ledger()) + + def test_internal_leak_fails_leak_test_and_standby_check(self): + g = Rig() + g.call(g.E, 'fault.inject', fault='internal_leak', active=True) + g.ready() + self.assertEqual(g.read('state.current'), 'fault') + self.assertIn('LEAK_TEST_FAILED', g.read('alarms.active')) + self.assertTrue(g.read('indicator.fault')) + self.assertTrue(g.read('alarm.audible')) + g.call(g.A, 'alarm.mute') + self.assertFalse(g.read('alarm.audible')) + g.call(g.A, 'cycle.start', expect='FAULT_ACTIVE') + h = Rig() + h.ready() + h.step(300.0) + h.call(h.E, 'fault.inject', fault='internal_leak', active=True) + h.step(300.0) + self.assertIn('INTERNAL_LEAK', h.read('alarms.active')) + _balance(self, h.ledger()) + + def test_low_pressure_shutdown_and_overpressure(self): + g = Rig() + g.ready() + g.call(g.E, 'consumer.set', demand_sccm=800.0, min_pressure_pa=2e5) + g.call(g.A, 'cycle.start') + g.step(1500.0) + self.assertIn('LOW_PRESSURE', g.read('alarms.active')) + self.assertEqual(g.read('truth.gas')['product_mol_s'], 0.0) + g.call(g.A, 'output.depressurise') + g.step(60.0) + self.assertTrue(g.read('indicator.depressurised')) + self.assertLess(g.read('pressure.delivery_pa'), 0.2e5) + g.call(g.E, 'consumer.set', demand_sccm=100.0, min_pressure_pa=2e5, external_leak_sccm_at_5bar=0.0) + g.call(g.A, 'cycle.start') + g.step(900.0) + self.assertEqual(g.read('state.current'), 'running') + o = Rig() + o.ready() + o.call(o.A, 'settings.configure', pressure_set_pa=6.89e5) + o.call(o.E, 'fault.inject', fault='pressure_sensor_drift', active=True) + o.step(900.0) + self.assertIn('OVERPRESSURE', o.read('alarms.active')) + _balance(self, g.ledger()) + + def test_water_loading_refill_and_deioniser(self): + g = Rig(bottle_water_m3=0.0002) + g.ready() + g.step(600.0) # stand-by reaches the set pressure first + g.call(g.E, 'consumer.set', demand_sccm=450.0, min_pressure_pa=2e5) + g.call(g.A, 'cycle.start') + g.step(3 * 86400.0) + self.assertIn('WATER_LOW', g.read('alarms.active')) + self.assertTrue(g.read('indicator.water')) + self.assertEqual(g.read('truth.gas')['product_mol_s'], 0.0) + g.call(g.A, 'water.refill', volume_m3=0.003, conductivity_s_m=5e-5) + g.step(600.0) + self.assertNotIn('WATER_LOW', g.read('alarms.active')) + self.assertGreater(g.read('truth.gas')['product_mol_s'], 0.0) + _balance(self, g.ledger()) + d = Rig(feed_conductivity_s_m=5e-4, bottle_volume_m3=0.02, bottle_water_m3=0.02) + d.ready() + d.step(600.0) + d.call(d.E, 'consumer.set', demand_sccm=450.0, min_pressure_pa=2e5) + d.call(d.A, 'cycle.start') + for _ in range(12): + d.step(5 * 86400.0) + if 'WATER_QUALITY' in d.read('alarms.active'): + break + d.call(d.A, 'water.refill', volume_m3=0.02 - d.read('truth.water')['bottle_m3']) + self.assertIn('WATER_QUALITY', d.read('alarms.active')) + d.call(d.A, 'power.toggle') + d.call(d.A, 'deioniser.replace') + d.call(d.A, 'power.set', on=True) + d.step(rt.DOC['leak_test_s'] + 60.0) + self.assertNotIn('WATER_QUALITY', d.read('alarms.active')) + + def test_dryer_run_in_and_purity(self): + g = Rig() + g.ready() + d0 = g.read('truth.gas')['dew_point_k'] + g.step(24 * 3600.0) + tg = g.read('truth.gas') + self.assertLess(tg['dew_point_k'], 273.15 - 72.0) + self.assertGreater(d0, tg['dew_point_k'] + 40.0) + self.assertGreaterEqual(tg['purity'], rt.DOC['purity']) + g.call(g.E, 'fault.inject', fault='membrane_crossover', active=True) + self.assertLess(g.call(g.E, 'truth.inspect')['gas']['purity'], rt.DOC['purity']) + + +class ReviewR1(unittest.TestCase): + """Round-1 review fixes: no LOW_PRESSURE while still pressurising, leak-test timing after a long water check, tank conductivity with its own + de-ioniser loop, PI pressure control, CELL_FAULT latches, mute only for sounding alarms, bottle re-declaration.""" + def test_no_low_pressure_while_still_rising(self): + g = Rig() + g.ready() + g.call(g.A, 'output.depressurise') + g.step(60.0) + g.call(g.A, 'settings.configure', pressure_set_pa=6.89e5) + g.call(g.E, 'consumer.set', demand_sccm=400.0, min_pressure_pa=1e5) + g.call(g.A, 'cycle.start') + g.step(1500.0) + self.assertNotIn('LOW_PRESSURE', g.read('alarms.active')) + self.assertEqual(g.read('state.current'), 'running') + + def test_long_water_check_then_leak_test_passes(self): + g = Rig(bottle_water_m3=0.0) + g.h.tank = 0.2 * rt.ENG['tank_volume_m3'] + g.call(g.A, 'power.set', on=True) + g.step(1000.0) + n_low = sum(e['code'] == 'WATER_LOW' for e in g.call(g.A, 'events.read', since_s=0.0)['events']) + self.assertEqual(n_low, 1) + g.call(g.A, 'water.refill', volume_m3=0.003) + g.step(rt.DOC['leak_test_s'] + 120.0) + self.assertEqual(g.read('state.current'), 'standby', g.read('alarms.active')) + + def test_refill_does_not_change_the_cell_water_at_once(self): + g = Rig(feed_conductivity_s_m=5e-4) + g.ready() + k0 = g.read('truth.water')['cell_water_conductivity_s_m'] + g.call(g.A, 'water.refill', volume_m3=0.0005, conductivity_s_m=5e-6) + self.assertEqual(g.read('truth.water')['cell_water_conductivity_s_m'], k0) + + def test_pi_control_holds_the_set_pressure_under_load(self): + g = Rig() + g.ready() + g.step(600.0) + g.call(g.E, 'consumer.set', demand_sccm=490.0, min_pressure_pa=2e5) + g.call(g.A, 'cycle.start') + g.step(1800.0) + self.assertAlmostEqual(g.read('pressure.delivery_pa'), g.read('pressure.set_pa'), delta=0.03e5) + + def test_cell_fault_latches_and_mute_needs_a_sounding_alarm(self): + g = Rig() + g.ready() + g.call(g.A, 'alarm.mute', expect='NO_ALARM') + g.call(g.E, 'fault.inject', fault='cell_failure', active=True) + g.step(1.0) + self.assertEqual(g.read('state.current'), 'fault') + g.call(g.A, 'cycle.start', expect='FAULT_ACTIVE') + g.call(g.A, 'alarm.mute') + g.call(g.E, 'plant.configure', **dict(rt.PLANT_EXAMPLE, bottle_volume_m3=0.001), expect='BOTTLE_OVERFLOW') + + +class ReviewR2(unittest.TestCase): + """Round-2 minors fixed directly: anti-windup (no overshoot above 6.9 bar), LOW_PRESSURE only when the pressure cannot recover, cell failure at + power-up reported as CELL_FAULT, silent notices do not cancel the mute.""" + def test_no_overshoot_from_integral_windup(self): + g = Rig() + g.ready() + g.call(g.A, 'output.depressurise') + g.step(60.0) + g.call(g.A, 'settings.configure', pressure_set_pa=6.89e5) + g.call(g.E, 'consumer.set', demand_sccm=0.0, min_pressure_pa=0.0) + g.call(g.A, 'cycle.start') + peak = 0.0 + for _ in range(60): + g.step(60.0) + peak = max(peak, g.read('truth.gas')['internal_pressure_abs_pa'] - rt.PLANT_EXAMPLE['pressure_pa']) + self.assertLess(peak, rt.DOC['max_pressure_pa'] + 3e3, peak) + + def test_497_sccm_held_when_pressurised_but_not_from_empty(self): + g = Rig() + g.ready() + g.step(600.0) # stand-by at the set pressure + g.call(g.E, 'consumer.set', demand_sccm=497.0, min_pressure_pa=1e5) + g.call(g.A, 'cycle.start') + g.step(2 * 3600.0) + self.assertNotIn('LOW_PRESSURE', g.read('alarms.active')) + h = Rig() + h.ready() + h.call(h.A, 'output.depressurise') + h.step(60.0) + h.call(h.E, 'consumer.set', demand_sccm=497.0, min_pressure_pa=1e5) + h.call(h.A, 'cycle.start') + h.step(3600.0) + self.assertIn('LOW_PRESSURE', h.read('alarms.active')) # 3 sccm net: hours to reach the set pressure + + def test_cell_failure_at_power_up_and_silent_notice_keeps_mute(self): + g = Rig() + g.call(g.E, 'fault.inject', fault='cell_failure', active=True) + g.call(g.A, 'power.set', on=True) + g.step(rt.DOC['leak_test_s'] + 30.0) + self.assertIn('CELL_FAULT', g.read('alarms.active')) + self.assertNotIn('LEAK_TEST_FAILED', g.read('alarms.active')) + g.call(g.A, 'alarm.mute') + g.h.di_age = rt.DOC['deioniser_interval_s'] + 1.0 # a silent notice appears + g.step(1.0) + self.assertFalse(g.read('alarm.audible')) + + +class ZCoverage(unittest.TestCase): + def test_all_capabilities_exercised(self): + implemented = {k for k in rt.CAPS if k not in rt.UNSUPPORTED} + missing = implemented - SEEN_CAPS + if len(SEEN_CAPS) > 5: + self.assertFalse(missing, sorted(missing)) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_asset_rigaku_xtalabsynergy.py b/tests/test_asset_rigaku_xtalabsynergy.py new file mode 100644 index 0000000000000000000000000000000000000000..41b4201b64bc7aa8010aaf9ae1c04fcf706b43f9 --- /dev/null +++ b/tests/test_asset_rigaku_xtalabsynergy.py @@ -0,0 +1,1128 @@ +"""tests for CHEM-161 rigaku_xtalabsynergy (Rigaku XtaLAB Synergy-R with the HyPix-6000HE detector): python3 -m unittest tests/test_asset_rigaku_xtalabsynergy.py + +Topics (pipeline.md): settings only write targets, read/describe are pure, rejected preconditions leave the state unchanged, two instances are +isolated, agent/evaluator truth isolation (truth slots, the substance of the records, fault events, other agents' records and operations), +conservation (electrical energy, X-ray and filament hours, frames and exposure, crystal dose), real return values validated against the declared +schemas (asset_tool lint_schema / validate_value), asynchronous completion and cancellation remnants, host-step independence, declared immediate +and on_step effects; plus the instrument (boot, the safety circuit with doors, Doors OK, emergency stop, X-ray key, Motion Enable; the generator +with its vacuum, spin-up, ramps, power limit and trips; shutter; divergence slit; detector threshold; the goniometer speeds, the collision model +and routed moves; crystal mounting, camera and centring; Cryostream cooling, icing) and the physics (Bragg positions and the cell, Lorentz and +polarisation, Cu versus Mo, divergence and distance, fluorescence and the energy threshold, absorption, temperature factors and thermal expansion, +radiation decay, count-rate overloads, frames and the beam-stop shadow) and the processing (pre-experiment and FFT indexing, reduction, Laue +class and space group, What is this? and the refinement, strategies, indexing failures of twinned, polycrystalline and amorphous samples). +""" +import copy +import json +import math +import sys +import unittest +from pathlib import Path + +import numpy as np + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / 'scripts')) +sys.path.insert(0, str(ROOT / 'skills/chemistry-lab-assets/scripts')) +from asset_runtime import rigaku_xtalabsynergy as rt # noqa: E402 +import asset_tool # noqa: E402 + +CHECKS, PROCESS_EVIDENCE, REJECTIONS = [], {}, {} +_META = {} +DEG = rt.DEG + + +def _meta(): + if not _META: + _META.update(rt.export_rigaku_xtalabsynergy_contract_metadata()) + return _META + + +def _changed(a, b): + return json.dumps(a, sort_keys=True, default=str) != json.dumps(b, sort_keys=True, default=str) + + +_orig_invoke = rt.RigakuXtalabsynergyRuntime.invoke + + +def _instrumented_invoke(self, capability_id, **a): + """Every successful call is checked against its declared output schema and immediate state effects (a call does not advance time); every + rejection code is recorded for the declaration check.""" + before = self.read('evaluator') if capability_id != 'sim.step' else None + t0 = self.t + try: + out = _orig_invoke(self, capability_id, **a) + except rt.ActionRejected as exc: + REJECTIONS.setdefault(capability_id, set()).add(str(exc)) + raise + meta = _meta()['capabilities'][capability_id] + errs = asset_tool.validate_value(json.loads(json.dumps(out, default=float)), meta['output_schema']) + if errs: + raise AssertionError(f'{capability_id} output violates its schema: {errs[:3]}') + if before is not None: + assert self.t == t0, capability_id + after = self.read('evaluator') + undeclared = {k for k in after if _changed(before[k], after[k])} - set(rt.EFFECTS.get(capability_id, [])) + if undeclared: + raise AssertionError(f'{capability_id} changed undeclared state immediately: {sorted(undeclared)}') + PROCESS_EVIDENCE.setdefault(capability_id, []).append(dict(arguments=json.loads(json.dumps(a, default=float)), result_keys=sorted(out))) + return out + + +rt.RigakuXtalabsynergyRuntime.invoke = _instrumented_invoke + +PLANT = dict(rt.PLANT_EXAMPLE) +ASPIRIN = dict(sample_id='asp', substance_id='aspirin', size_m=[1.5e-4, 1.2e-4, 1.0e-4], mosaicity_rad=0.6 * DEG, seed=3) +NACL = dict(sample_id='salt', substance_id='nacl', size_m=[1.0e-4, 1.0e-4, 1.0e-4], mosaicity_rad=0.3 * DEG, seed=4) + + +def configured(seed=1, target='Cu', samples=(ASPIRIN,), **plant): + h = rt.RigakuXtalabsynergyRuntime() + h.invoke('plant.configure', **dict(PLANT, noise_seed=seed, target=target, **plant)) + for s in samples: + h.invoke('sample.provide', **s) + return h + + +def ready(seed=1, **kw): + h = configured(seed, **kw) + h.invoke('power.set', enabled=True) + h.step(rt.BOOT_S + rt.TURBO_S + 1.0) + return h + + +def wait_op(h, oid, tmax=20000.0, dt=5.0): + t = 0.0 + while h.operations[oid]['phase'] == 'running' and t < tmax: + h.step(dt) + t += dt + return h.operations[oid] + + +def mounted(seed=1, sample='asp', cold=True, center=True, **kw): + h = ready(seed, **kw) + h.invoke('door.open', door='left', angle_rad=1.6) + h.invoke('motion_enable.hold', held=True) + wait_op(h, h.invoke('goniometer.mount_position')['operation_id']) + h.invoke('crystal.mount', sample_id=sample) + if cold: + h.invoke('cryostream.set', temperature_k=100.0, ramp_k_s=0.1) + if center: + wait_op(h, h.invoke('crystal.center')['operation_id']) + h.invoke('motion_enable.hold', held=False) + h.invoke('door.close', door='left') + h.invoke('safety.doors_ok') + if cold: + h.step(3600.0) + return h + + +def xray(h, kv=40e3, ma=30e-3): + if not h.armed: + h.invoke('safety.doors_ok') + h.invoke('xray.set_key', angle_rad=math.pi / 2) + h.invoke('xray.on', voltage_v=kv, current_a=ma) + h.step(rt.SPINUP_S + 30.0) + assert h.xr['state'] == 'on', h.xr + return h + + +def rejected(h, cap, code, **a): + before = h.read('evaluator') + with_ = None + try: + h.invoke(cap, **a) + except rt.ActionRejected as exc: + with_ = str(exc) + after = h.read('evaluator') + assert with_ == code, (cap, with_, code) + assert not any(_changed(before[k], after[k]) for k in before if k != 'truth.flux_ph_s'), cap + return True + + +RUN = dict(omega_start_rad=-30 * DEG, omega_end_rad=30 * DEG, kappa_rad=0.0, phi_rad=0.0, theta_rad=0.0, distance_m=0.045, exposure_s=0.2) + + +def collect(h, runs=(RUN,), fw=0.5 * DEG): + oid = h.invoke('data.collect', runs=[dict(r) for r in runs], strategy_record_id=None, frame_width_rad=fw)['operation_id'] + wait_op(h, oid) + return h.operations[oid]['record_id'] + + +def full_dataset(h, fw=0.5 * DEG, distance=0.045, expo=(0.2, 0.1, 0.4)): + pre = wait_op(h, h.invoke('experiment.pre_experiment', exposure_s=expo[0], frame_width_rad=fw, distance_m=distance)['operation_id']) + idx = h.records[pre['record_id']]['data']['auto_index']['record_id'] + lam = rt.line_data(h.plant['target'])['lam1'] + st = h.invoke('strategy.calculate', record_id=idx, resolution_m=max(0.84e-10, lam / 1.7), completeness=0.95, redundancy=2.0, exposure_low_s=expo[1], + exposure_high_s=expo[2], frame_width_rad=fw, distance_m=distance) + oid = h.invoke('data.collect', runs=None, strategy_record_id=st['record_id'], frame_width_rad=fw)['operation_id'] + wait_op(h, oid) + return h.operations[oid]['record_id'], idx, st + + +class ContractAndSchemas(unittest.TestCase): + def test_module_identity(self): + self.assertEqual(rt.ASSET_TYPE_ID, 'instrument.rigaku_xtalabsynergy') + self.assertEqual(rt.CATALOG_ID, 'CHEM-161') + self.assertEqual((rt.NX, rt.NY), (775, 803)) + self.assertAlmostEqual(rt.NX * rt.PIXEL_M, rt.ACTIVE_M[0], places=9) + self.assertAlmostEqual(rt.NY * rt.PIXEL_M, rt.ACTIVE_M[1], places=9) + + def test_schemas_lint_and_examples_validate(self): + meta = _meta() + for k, c in meta['capabilities'].items(): + for sch in ('input_schema', 'output_schema'): + self.assertEqual(asset_tool.lint_schema(c[sch]), [], (k, sch)) + if c['availability'] == 'implemented': + self.assertEqual(asset_tool.validate_value(c['example_arguments'], c['input_schema']), [], k) + for k, s in meta['state_slots'].items(): + self.assertEqual(asset_tool.lint_schema(s['value_schema']), [], k) + + def test_metadata_references_are_consistent(self): + meta = _meta() + slots = set(meta['state_slots']) + comps = {p['id'] for p in json.loads((rt.ASSET_DIR / 'geometry_manifest.json').read_text())['components']} + for k, c in meta['capabilities'].items(): + for e in c['state_effects']: + self.assertIn(e['state_id'], slots, k) + for x in c['observes']: + self.assertIn(x, slots, k) + for pre in c['preconditions']: + for x in pre['state_ids']: + self.assertIn(x, slots, k) + for cid in c['component_ids']: + self.assertIn(cid, comps, (k, cid)) + for k, s in meta['state_slots'].items(): + for cid in s['component_ids']: + self.assertIn(cid, comps, (k, cid)) + for cid in meta['mechanisms']['xtalab_synergy_r']['component_ids']: + self.assertIn(cid, comps) + + def test_declared_and_unsupported_capabilities(self): + h = configured() + for k in rt.DECLARED: + with self.assertRaises(rt.ActionRejected) as e: + h.invoke(k) + self.assertEqual(str(e.exception), 'NOT_IMPLEMENTED') + for k in rt.UNSUPPORTED: + with self.assertRaises(rt.ActionRejected) as e: + h.invoke(k) + self.assertEqual(str(e.exception), 'UNSUPPORTED') + + def test_libraries_carry_evidence(self): + lib = rt.crystal_lib() + self.assertGreaterEqual(len(lib), 50) + for sid, e in lib.items(): + self.assertTrue(e['cod_id'] and e['cif_sha256'] and e['evidence'] == 'documented', sid) + m = rt.substance_model(sid) + self.assertAlmostEqual(float(m['occ'].sum()), sum(e['cell_content'].values()), delta=1e-6 + 1e-3 * sum(e['cell_content'].values()), msg=sid) + sc = rt.scatter_lib() + self.assertEqual(sc['counts']['elements'], 92) + self.assertAlmostEqual(sc['lines']['Cu']['Ka1']['wavelength_m'], 1.540593e-10, delta=2e-15) + self.assertAlmostEqual(sc['lines']['Mo']['Ka1']['wavelength_m'], 0.709317e-10, delta=2e-15) + self.assertAlmostEqual(rt.element('Fe')['k_edge_ev'], 7112.0, delta=5) + prov = configured().invoke('provenance.read')['libraries'] + self.assertEqual(set(prov), {'crystal_structure_library', 'xray_scattering_library'}) + + def test_structure_factors_obey_the_space_group(self): + for sid in ('aspirin', 'calcite', 'nacl', 'sucrose'): + e = rt.crystal_lib()[sid] + A, u = rt.model_at(sid, 150.0) + H = np.array([[1, 2, 3], [2, 1, 1], [3, 0, 2], [1, 1, 1], [2, 3, 4]]) + F0 = np.abs(rt.structure_factors(sid, H, A, u, 'Cu_Ka1')) ** 2 + for R, t in rt._symops(e): + Fr = np.abs(rt.structure_factors(sid, np.round(H @ R).astype(int), A, u, 'Cu_Ka1')) ** 2 + np.testing.assert_allclose(Fr, F0, rtol=1e-9, atol=1e-9) + A, u = rt.model_at('nacl', 295.0) + f = np.abs(rt.structure_factors('nacl', np.array([[2, 0, 0], [1, 1, 1], [1, 0, 0]]), A, u, 'Mo_Ka1')) + self.assertGreater(f[0], f[1]) # (200): Na + Cl in phase; (111): out of phase + self.assertLess(f[2], 1e-6) # (100) forbidden by F centring + + +class HostClockAndPurity(unittest.TestCase): + def test_read_and_describe_do_not_advance_time(self): + h = ready() + s = h.register_principal('agent', 'agent') or h.session('agent') + t = h.t + s.read(instance_id=rt.INSTANCE_ID) + s.describe(instance_id=rt.INSTANCE_ID) + h.read('evaluator') + self.assertEqual(h.t, t) + + def test_step_zero_and_negative(self): + h = configured() + h.step(0) + self.assertEqual(h.t, 0.0) + with self.assertRaises(rt.ActionRejected): + h.step(-1.0) + with self.assertRaises(rt.ActionRejected): + h.step(float('nan')) + + def test_settings_only_write_targets(self): + h = mounted(cold=False) + h.invoke('xray.set_key', angle_rad=math.pi / 2) + out = h.invoke('xray.on', voltage_v=40e3, current_a=30e-3) + self.assertEqual(out['state'], 'starting') + self.assertEqual(h.read()['xray.voltage_v'], 0.0) + h.step(rt.SPINUP_S + 1.0) + self.assertEqual(h.read()['xray.state'], 'ramping') + h.step(20.0) + self.assertEqual((h.read()['xray.state'], h.read()['xray.voltage_v']), ('on', 40000.0)) + h.invoke('cryostream.set', temperature_k=150.0, ramp_k_s=0.1) + self.assertAlmostEqual(h.read()['cryostream.gas_temperature_k'], PLANT['room_k'], delta=0.06) + h.step(600.0) + self.assertAlmostEqual(h.read()['cryostream.gas_temperature_k'], PLANT['room_k'] - 60.0, delta=0.1) + self.assertEqual(h.read()['cryostream.state'], 'ramping') + + def test_host_step_chopping_does_not_change_the_result(self): + outs = [] + for chop in (None, 7.0): + h = xray(mounted(seed=2)) + oid = h.invoke('data.collect', runs=[dict(RUN, omega_end_rad=0.0)], strategy_record_id=None, frame_width_rad=0.5 * DEG)['operation_id'] + if chop is None: + h.step(200.0) + else: + for _ in range(int(200 / chop)): + h.step(chop) + h.step(200.0 - chop * int(200 / chop)) + rec = h.records[h.operations[oid]['record_id']] + o = rec['runs'][0]['obs'] + outs.append((round(h.t, 9), o['n'], float(o['i_obs'].sum()), h.read('evaluator')['truth.crystal']['dose_gy'])) + self.assertEqual(outs[0][:3], outs[1][:3]) + self.assertAlmostEqual(outs[0][3], outs[1][3], delta=1e-6 * max(1.0, outs[0][3])) + + def test_reads_do_not_change_later_results(self): + res = [] + for reads in (False, True): + h = xray(mounted(seed=3)) + oid = h.invoke('data.collect', runs=[dict(RUN, omega_end_rad=-20 * DEG)], strategy_record_id=None, frame_width_rad=0.5 * DEG)['operation_id'] + for _ in range(10): + h.step(3.0) + if reads: + h.read('evaluator'); h.invoke('camera.view'); h.invoke('ledger.read') + h.step(100.0) + rec = h.records[h.operations[oid]['record_id']] + res.append(float(rec['runs'][0]['obs']['i_obs'].sum())) + self.assertEqual(res[0], res[1]) + + +class SafetyAndGenerator(unittest.TestCase): + def test_boot_vacuum_and_power_loss(self): + h = configured() + h.invoke('power.press_button') + self.assertEqual(h.read()['system.state'], 'booting') + h.step(rt.BOOT_S + 0.5) + self.assertEqual(h.read()['system.state'], 'ready') + self.assertFalse(h.read()['xray.vacuum_ready']) + h.step(rt.TURBO_S) + self.assertTrue(h.read()['xray.vacuum_ready']) + self.assertIsNotNone(h.read()['xray.voltage_v']) + h.invoke('power.press_button') + r = h.read() + self.assertEqual((r['power.enabled'], r['system.state'], r['xray.voltage_v']), (False, 'off', None)) + + def test_doors_ok_and_xray_interlocks(self): + h = ready() + h.invoke('door.open', door='right', angle_rad=1.0) + rejected(h, 'safety.doors_ok', 'DOORS_OPEN') + h.invoke('door.close', door='right') + h.invoke('safety.doors_ok') + self.assertTrue(h.read()['safety.armed']) + rejected(h, 'xray.on', 'KEY_OFF', voltage_v=40e3, current_a=30e-3) + h.invoke('xray.set_key', angle_rad=math.pi / 2) + rejected(h, 'xray.on', 'POWER_LIMIT', voltage_v=60e3, current_a=30e-3) + rejected(h, 'xray.on', 'SETTING_STEP', voltage_v=40.5e3, current_a=30e-3) + h.invoke('door.open', door='left', angle_rad=0.5) + self.assertFalse(h.read()['safety.armed']) + rejected(h, 'xray.on', 'SAFETY_NOT_ARMED', voltage_v=40e3, current_a=30e-3) + h.invoke('door.close', door='left') + h.invoke('safety.doors_ok') + h.invoke('xray.on', voltage_v=50e3, current_a=24e-3) + h.step(rt.SPINUP_S + 30.0) + self.assertEqual(h.read()['xray.state'], 'on') + self.assertAlmostEqual(h.read()['xray.voltage_v'], 50e3) + h.invoke('xray.standby') + h.step(30.0) + self.assertEqual((h.read()['xray.state'], h.read()['xray.voltage_v']), ('standby', 20e3)) + + def test_trips_key_emergency_stop_chiller_vacuum_filament(self): + h = xray(ready()) + h.invoke('xray.set_key', angle_rad=0.0) + self.assertEqual(h.read()['xray.state'], 'off') + h = xray(ready(seed=4)) + h.invoke('safety.emergency_stop') + r = h.read() + self.assertEqual((r['xray.state'], r['safety.estop_latched'], r['safety.armed']), ('off', True, False)) + rejected(h, 'safety.doors_ok', 'EMERGENCY_STOP') + h.invoke('safety.reset_emergency_stop') + h.invoke('safety.doors_ok') + h = xray(ready(seed=5)) + h.invoke('fault.inject', fault='chiller_failure', active=True) + self.assertEqual(h.read()['xray.state'], 'off') + rejected(h, 'xray.on', 'COOLING_WATER', voltage_v=40e3, current_a=30e-3) + h = xray(ready(seed=6)) + h.invoke('fault.inject', fault='vacuum_loss', active=True) + self.assertEqual(h.read()['xray.state'], 'off') + h.invoke('fault.inject', fault='vacuum_loss', active=False) + h.step(rt.PUMPDOWN_S - 5.0) + self.assertFalse(h.read()['xray.vacuum_ready']) + h.step(10.0) + self.assertTrue(h.read()['xray.vacuum_ready']) + h = xray(ready(seed=7)) + h.invoke('fault.inject', fault='filament_failure', active=True) + rejected(h, 'xray.on', 'FILAMENT_FAILURE', voltage_v=40e3, current_a=30e-3) + rejected(h, 'maintenance.replace_filament', 'POWER_ON') + h.invoke('power.set', enabled=False) + h.invoke('maintenance.replace_filament') + h.invoke('power.set', enabled=True) + h.step(rt.BOOT_S + rt.TURBO_S + 5.0) + self.assertFalse(h.read()['xray.vacuum_ready']) # vented by the filament change + h.step(rt.PUMPDOWN_S) + self.assertTrue(h.read()['xray.vacuum_ready']) + + def test_filament_life_ends_the_emission(self): + h = xray(ready(seed=8)) + life = h.filament_life_s + self.assertTrue(0.9 * rt.FILAMENT_INTERVAL_S <= life <= 1.1 * rt.FILAMENT_INTERVAL_S) + while h.t < life + 100.0: + h.step(min(rt.MAX_STEP_S, life + 100.0 - h.t)) + self.assertEqual(h.read()['xray.state'], 'off') + self.assertIn('filament_failure', h.read('evaluator')['truth.faults']) + + def test_shutter_divergence_threshold(self): + h = ready() + rejected(h, 'shutter.open', 'XRAY_NOT_STABLE') + h.invoke('safety.doors_ok') + xray(h) + h.invoke('shutter.open') + self.assertGreater(h.read('evaluator')['truth.flux_ph_s'], 0) + f10 = h.read('evaluator')['truth.flux_ph_s'] + h.invoke('optics.set_divergence', divergence_rad=1e-3) + self.assertAlmostEqual(h.read('evaluator')['truth.flux_ph_s'] / f10, 0.01, delta=1e-9) + h.invoke('door.open', door='left', angle_rad=0.4) + self.assertFalse(h.read()['shutter.open']) + rejected(h, 'detector.set_threshold', 'THRESHOLD_OUT_OF_RANGE', threshold_ev=7900.0) + h.invoke('detector.set_threshold', threshold_ev=7000.0) + self.assertAlmostEqual(h.read()['detector.threshold_ev'], 7000.0) + + def test_flux_follows_the_generator_setting(self): + f1 = rt.source_flux('Cu', 40e3, 30e-3, 10e-3) + self.assertAlmostEqual(f1, rt.FLUX_REF['Cu']['flux'], delta=1e-6 * f1) + self.assertGreater(rt.source_flux('Cu', 50e3, 24e-3, 10e-3), f1) + self.assertEqual(rt.source_flux('Mo', 19e3, 30e-3, 10e-3), 0.0) # below the Mo K edge no K-alpha + self.assertAlmostEqual(rt.source_flux('Cu', 40e3, 15e-3, 10e-3) / f1, 0.5, delta=1e-9) + + + def test_ramps_keep_the_load_within_1_2_kw(self): + for (kv0, ma0), (kv1, ma1) in (((60e3, 20e-3), (40e3, 30e-3)), ((40e3, 30e-3), (60e3, 20e-3)), ((40e3, 30e-3), (35e3, 20e-3)), ((50e3, 24e-3), (46e3, 26e-3))): + h = xray(ready(seed=2), kv0, ma0) + e0, t0 = h.ledger()['electrical_energy_j'], h.t + h.invoke('xray.set', voltage_v=kv1, current_a=ma1) + plan = dict(h.xr['ramp']) + worst = max(np.prod(rt.ramp_values(plan, t0 + plan['dur'] * i / 2000)) for i in range(2001)) + self.assertLessEqual(worst, rt.POWER_MAX_W + 1e-6, (kv0, ma0, kv1, ma1)) + span = plan['dur'] + 3.0 + for _ in range(int(span / 0.5)): + h.step(0.5) + self.assertLessEqual(np.prod(h._xray_kv_ma()), rt.POWER_MAX_W + 1e-6) + self.assertEqual(h.xr['state'], 'on') + d1, d2 = plan['d1'], plan['dur'] - plan['d1'] # the load is linear in each phase: midpoint integrals are exact + ramp = d1 * np.prod(rt.ramp_values(plan, t0 + d1 / 2)) + d2 * np.prod(rt.ramp_values(plan, t0 + d1 + d2 / 2)) + expected = rt.ELECTRONICS_W * (h.t - t0) + (ramp + kv1 * ma1 * (h.t - t0 - plan['dur'])) / rt.GENERATOR_EFFICIENCY + self.assertAlmostEqual(h.ledger()['electrical_energy_j'] - e0, expected, delta=1e-6 * expected) + + def test_a_key_at_its_stop_is_accepted_as_float32(self): + h = ready() + h.register_principal('a1', 'agent') + s = h.session('a1') + r = s.invoke(instance_id=rt.INSTANCE_ID, capability_id='xray.set_key', arguments={'angle_rad': float(np.float32(math.pi / 2))}, request_id='k1') + self.assertEqual(r['status'], 'succeeded', r['error']) + self.assertEqual(h.read('evaluator')['xray.key_angle_rad'], math.pi / 2) + r = s.invoke(instance_id=rt.INSTANCE_ID, capability_id='xray.set_key', arguments={'angle_rad': math.pi / 2 + 1e-5}, request_id='k2') + self.assertEqual(r['error']['code'], 'INVALID_ARGUMENT') + + +class GoniometerAndCollisions(unittest.TestCase): + def test_move_timing_follows_the_axis_speeds(self): + h = ready() + h.invoke('safety.doors_ok') + out = h.invoke('goniometer.move', omega_rad=20 * DEG, kappa_rad=0.0, phi_rad=90 * DEG, theta_rad=30 * DEG, distance_m=0.070) + self.assertAlmostEqual(out['duration_s'], max(2.0, 4.5, 3.0, 3.8), delta=1e-6) + h.step(2.0) + self.assertAlmostEqual(h.read()['goniometer.omega_rad'], 20 * DEG, delta=1e-9) + self.assertAlmostEqual(h.read()['goniometer.phi_rad'], 40 * DEG, delta=1e-9) + h.step(3.0) + r = h.read() + self.assertFalse(r['goniometer.moving']) + self.assertAlmostEqual(r['detector.distance_m'], 0.070, delta=1e-12) + + def test_collision_model_refuses_and_routes(self): + hit, names = rt.collisions([0.0], [0.0], [0.0], [rt.DIST_MIN_M]) + self.assertFalse(hit[0], names) + hit, names = rt.collisions([180 * DEG], [0.0], [0.0], [rt.DIST_MIN_M]) + self.assertTrue(hit[0]) + self.assertTrue(any('detector' in n or 'arm' in n or 'carriage' in n for n in names[0])) + hit, names = rt.collisions([0.0], [120 * DEG], [0.0], [0.05]) + self.assertTrue(any('collimator' in n for n in names[0])) + h = ready() + h.invoke('safety.doors_ok') + rejected(h, 'goniometer.move', 'COLLISION_PREDICTED', omega_rad=180 * DEG, kappa_rad=0.0, phi_rad=0.0, theta_rad=0.0, distance_m=0.032) + self.assertNotIn('collisions_refused', h.ledger()) # a refusal writes nothing + legs = rt.plan_route(dict(omega=0.0, kappa=60 * DEG, phi=0.0, theta=0.0, distance=0.1), dict(omega=40 * DEG, kappa=-60 * DEG, phi=0.0, theta=-60 * DEG, distance=0.1)) + if legs is not None: + for a, b in legs: + self.assertIsNone(rt.path_collision(a, b)) + + def test_motion_with_open_door_needs_motion_enable(self): + h = ready() + h.invoke('door.open', door='left', angle_rad=1.0) + rejected(h, 'goniometer.move', 'MOTION_ENABLE_REQUIRED', omega_rad=10 * DEG, kappa_rad=0.0, phi_rad=0.0, theta_rad=0.0, distance_m=0.1) + h.invoke('motion_enable.hold', held=True) + oid = h.invoke('goniometer.move', omega_rad=30 * DEG, kappa_rad=0.0, phi_rad=0.0, theta_rad=0.0, distance_m=0.1)['operation_id'] + h.step(1.0) + h.invoke('motion_enable.hold', held=False) + self.assertEqual(h.operations[oid]['phase'], 'failed') + self.assertEqual(h.operations[oid]['reason'], 'MOTION_ENABLE_RELEASED') + om = h.read()['goniometer.omega_rad'] + self.assertTrue(0 < om < 30 * DEG) + h.step(10.0) + self.assertEqual(h.read()['goniometer.omega_rad'], om) + + def test_stop_keeps_the_pose(self): + h = ready() + h.invoke('safety.doors_ok') + h.invoke('goniometer.move', omega_rad=40 * DEG, kappa_rad=0.0, phi_rad=0.0, theta_rad=0.0, distance_m=0.032) + h.step(2.0) + h.invoke('goniometer.stop') + self.assertAlmostEqual(h.read()['goniometer.omega_rad'], 20 * DEG, delta=1e-9) + rejected(h, 'goniometer.stop', 'NOT_MOVING') + + + def test_enclosure_walls_limit_the_detector_arm(self): + hit, names = rt.collisions([0.0], [0.0], [-90 * DEG], [rt.DIST_MAX_M]) + self.assertTrue(hit[0] and any('enclosure_front' in n for n in names[0]), names[0]) + hit, names = rt.collisions([0.0], [0.0], [90 * DEG], [rt.DIST_MAX_M]) + self.assertTrue(hit[0] and any('enclosure_rear' in n for n in names[0]), names[0]) + hit, names = rt.collisions([0.0, 0.0], [0.0, 0.0], [0.0, -60 * DEG], [rt.DIST_MAX_M, 0.060]) # reachable poses stay free + self.assertFalse(hit.any(), names) + h = ready() + h.invoke('safety.doors_ok') + rejected(h, 'goniometer.move', 'COLLISION_PREDICTED', omega_rad=0.0, kappa_rad=0.0, phi_rad=0.0, theta_rad=-90 * DEG, distance_m=0.15) + + def test_refused_moves_write_nothing(self): + h = ready() + h.invoke('safety.doors_ok') + led, ev = h.ledger(), len(h.events) + rejected(h, 'goniometer.move', 'COLLISION_PREDICTED', omega_rad=180 * DEG, kappa_rad=0.0, phi_rad=0.0, theta_rad=0.0, distance_m=0.032) + self.assertEqual(h.ledger(), led) + self.assertEqual(len(h.events), ev) + + +class CrystalHandling(unittest.TestCase): + def test_mount_guards_camera_and_centring(self): + h = ready() + rejected(h, 'crystal.mount', 'DOOR_CLOSED', sample_id='asp') + h.invoke('door.open', door='left', angle_rad=1.6) + rejected(h, 'crystal.mount', 'NOT_AT_MOUNT_POSITION', sample_id='asp') + h.invoke('motion_enable.hold', held=True) + wait_op(h, h.invoke('goniometer.mount_position')['operation_id']) + h.invoke('crystal.mount', sample_id='asp') + rejected(h, 'crystal.mount', 'SAMPLE_NOT_ON_BENCH', sample_id='asp') + off0 = np.linalg.norm(h.read('evaluator')['truth.crystal']['offset_m']) + self.assertTrue(0.1e-3 <= off0 <= rt.MOUNT_OFFSET_MAX_M) + v = h.invoke('camera.view') + self.assertTrue(v['crystal_present']) + self.assertAlmostEqual(np.hypot(*v['offset_m']), 0, delta=off0 + 1e-5) + for x in v['offset_m'] + v['size_m']: + self.assertAlmostEqual(x / rt.CAMERA_QUANT_M, round(x / rt.CAMERA_QUANT_M), delta=1e-6) + wait_op(h, h.invoke('crystal.center')['operation_id']) + off1 = np.linalg.norm(h.read('evaluator')['truth.crystal']['offset_m']) + self.assertLess(off1, 5 * rt.CENTER_RESIDUAL_M) + self.assertAlmostEqual(h.read()['goniometer.phi_rad'], 0.0, delta=1e-9) + v2 = h.invoke('camera.view') + self.assertLess(np.hypot(*v2['offset_m']), 3e-5) + h.invoke('crystal.unmount') + self.assertIn('asp', h.read()['sample.bench_ids']) + + def test_cryostream_cools_the_crystal_and_icing_with_the_door_open(self): + h = mounted(cold=True) + self.assertAlmostEqual(h.read('evaluator')['truth.crystal']['temperature_k'], 100.0 + rt.CRYO_OFFSET_K, delta=0.05) + self.assertEqual(h.read()['cryostream.state'], 'stable') + h.invoke('door.open', door='left', angle_rad=1.6) + h.step(600.0) + ice = h.read('evaluator')['truth.crystal']['ice_m3'] + self.assertAlmostEqual(ice, rt.ICE_RATE_M3_S * 600.0 * PLANT['humidity'] / 0.4, delta=1e-18) + h.invoke('cryostream.stop') + h.step(600.0) + c = h.read('evaluator')['truth.crystal'] + self.assertAlmostEqual(c['temperature_k'], PLANT['room_k'], delta=0.1) + self.assertEqual(c['ice_m3'], 0.0) + + def test_nitrogen_supply(self): + h = configured(nitrogen_available=False) + rejected(h, 'cryostream.set', 'NITROGEN_UNAVAILABLE', temperature_k=100.0, ramp_k_s=0.1) + h = configured(seed=2) + h.invoke('cryostream.set', temperature_k=100.0, ramp_k_s=0.1) + h.invoke('fault.inject', fault='nitrogen_empty', active=True) + self.assertEqual(h.read()['cryostream.state'], 'off') + + +class DiffractionPhysics(unittest.TestCase): + def test_bragg_positions_lorentz_and_polarisation(self): + rng = np.random.default_rng(1) + cr = dict(sid='aspirin', U=rt.random_rotation(rng), U2=None, frac2=0.0, offset=np.zeros(3), size=np.array([1e-4] * 3), mosaic=0.5 * DEG, defect='none', + inverted=False, T=100.0, dose_gy=0.0, ice_m3=0.0) + src = dict(target='Cu', flux=rt.source_flux('Cu', 40e3, 30e-3, 10e-3), divergence=10e-3, threshold_frac=0.5) + run = dict(omega_start=-30 * DEG, omega_end=30 * DEG, kappa=0.0, phi=0.0, theta=0.0, distance=0.05, frame_width_rad=0.5 * DEG, exposure_s=0.5) + o = simulate(cr, src, run) + H, F2, A, _ = rt.reflection_set('aspirin', 100, 'Cu', False) + d_hkl = 1 / np.linalg.norm(o['h'] @ rt.reciprocal(A).T, axis=1) + lam = rt.line_data('Cu')['lam1'] + np.testing.assert_allclose(lam / (2 * np.sin(o['tth'] / 2)), d_hkl, rtol=1e-9) # Bragg's law for every spot + s1, t = rt.pixel_rays(0.0, 0.05, o['x'], o['y']) + np.testing.assert_allclose(o['L'], 1 / np.abs(s1[:, 1]), rtol=1e-6) # L = 1 / |e . (s0 x s1)| + np.testing.assert_allclose(o['P'], (1 + s1[:, 0] ** 2) / 2, rtol=1e-9) + self.assertTrue(np.all(o['x'] >= 0) and np.all(o['x'] < rt.NX)) + + def test_cu_versus_mo_and_distance(self): + rng = np.random.default_rng(2) + cr = base_crystal('aspirin', rng) + runs = dict(omega_start=-30 * DEG, omega_end=30 * DEG, kappa=0.0, phi=0.0, theta=0.0, distance=0.045, frame_width_rad=0.5 * DEG, exposure_s=0.5) + cu = simulate(cr, dict(target='Cu', flux=1e9, divergence=10e-3, threshold_frac=0.5), runs) + mo = simulate(cr, dict(target='Mo', flux=1e9, divergence=10e-3, threshold_frac=0.5), runs) + self.assertLess(mo['d'].min(), cu['d'].min()) # shorter wavelength reaches higher resolution + self.assertGreater(cu['S'].sum() / len(cu['S']), mo['S'].sum() / len(mo['S'])) # lambda^3: stronger per reflection with Cu + far = simulate(cr, dict(target='Cu', flux=1e9, divergence=10e-3, threshold_frac=0.5), dict(runs, distance=0.120)) + self.assertLess(far['d'].min(), 1e-9) + self.assertGreater(far['d'].min(), cu['d'].min()) # the detector covers a smaller 2theta range + + def test_divergence_changes_spot_size_and_flux(self): + rng = np.random.default_rng(3) + cr = base_crystal('aspirin', rng) + r = dict(omega_start=-20 * DEG, omega_end=20 * DEG, kappa=0.0, phi=0.0, theta=0.0, distance=0.1, frame_width_rad=0.5 * DEG, exposure_s=0.5) + a = simulate(cr, dict(target='Cu', flux=rt.source_flux('Cu', 40e3, 30e-3, 10e-3), divergence=10e-3, threshold_frac=0.5), r) + b = simulate(cr, dict(target='Cu', flux=rt.source_flux('Cu', 40e3, 30e-3, 1e-3), divergence=1e-3, threshold_frac=0.5), r) + self.assertLess(np.median(b['sig_px']), 0.8 * np.median(a['sig_px'])) + self.assertLess(np.median(b['sig_om']), np.median(a['sig_om'])) + + def test_fluorescence_and_the_energy_threshold(self): + rng = np.random.default_rng(4) + fe = base_crystal('fe_acac3', rng) + r = dict(omega_start=-5 * DEG, omega_end=5 * DEG, kappa=0.0, phi=0.0, theta=0.0, distance=0.05, frame_width_rad=0.5 * DEG, exposure_s=1.0) + src = dict(target='Cu', flux=2.5e9, divergence=10e-3, threshold_frac=0.5) + bg_lo = rt.background_terms(fe, src, r, 0.4) + bg_hi = rt.background_terms(fe, dict(src, threshold_frac=7000.0 / rt.line_data('Cu')['e1']), r, 0.4) + self.assertTrue(bg_lo['fluo'] and bg_lo['fluo'][0][0] == rt.element('Fe')['ka1_ev']) + x, y = np.array([150.0, 600.0]), np.array([150.0, 650.0]) + lo = rt.background_rate(bg_lo, 0.0, 0.05, x, y) + hi = rt.background_rate(bg_hi, 0.0, 0.05, x, y) + self.assertTrue(np.all(hi < 0.35 * lo)) # Fe K-alpha (6.4 keV) rejected above 7 keV + asp = rt.background_terms(base_crystal('aspirin', rng), src, r, 0.4) + self.assertEqual(asp['fluo'], []) + mo = rt.background_terms(fe, dict(src, target='Mo'), r, 0.4) + self.assertTrue(mo['fluo']) # Fe fluoresces under Mo as well + + def test_temperature_factors_expansion_and_decay(self): + H, F2c, Ac, _ = rt.reflection_set('aspirin', 100, 'Cu', False) + H2, F2w, Aw, _ = rt.reflection_set('aspirin', 295, 'Cu', False) + self.assertGreater(abs(np.linalg.det(Aw)), abs(np.linalg.det(Ac))) + dmap = {tuple(h): f for h, f in zip(H2, F2w)} + d = 1 / np.linalg.norm(H @ rt.reciprocal(Ac).T, axis=1) + hi = [i for i in np.nonzero(d < 1.0e-10)[0] if tuple(H[i]) in dmap] + self.assertGreater(sum(F2c[i] for i in hi), 1.3 * sum(dmap[tuple(H[i])] for i in hi)) # high-angle intensity stronger when cold + self.assertAlmostEqual(rt.decay_half_dose(100.0), rt.DECAY_HALF_DOSE_GY['cold'][1], delta=1.0) + self.assertLess(rt.decay_half_dose(295.0), rt.decay_half_dose(100.0)) + + def test_absorption_depends_on_mu_and_path(self): + rng = np.random.default_rng(5) + light = base_crystal('aspirin', rng) + heavy = base_crystal('k2ptcl4', rng) + mu_l = rt.mu_linear('aspirin', 'Cu_Ka1', rt.substance_model('aspirin')['A'])[0] + mu_h = rt.mu_linear('k2ptcl4', 'Cu_Ka1', rt.substance_model('k2ptcl4')['A'])[0] + d0 = np.array([[1.0, 0.0, 0.0]]) + tl = rt.crystal_absorption(light, mu_l, d0, d0)[0] + th = rt.crystal_absorption(heavy, mu_h, d0, d0)[0] + self.assertTrue(0.8 < tl < 1.0 and th < 0.2 and th < tl) + + def test_count_rate_losses_and_overloads(self): + rng = np.random.default_rng(6) + cr = base_crystal('nacl', rng, T=295.0, size=3e-4) + run = dict(omega_start=-30 * DEG, omega_end=30 * DEG, kappa=0.0, phi=0.0, theta=0.0, distance=0.032, frame_width_rad=0.2 * DEG, exposure_s=0.1) + home = simulate(cr, dict(target='Mo', flux=rt.source_flux('Mo', 50e3, 24e-3, 3e-3), divergence=3e-3, threshold_frac=0.5), run) + self.assertFalse(home['overload'].any()) # a 1.2 kW source stays inside the counting range + self.assertTrue(np.all(home['S_meas'] <= home['S_meas_ideal'] + 1e-9)) + hot = simulate(cr, dict(target='Mo', flux=100 * rt.source_flux('Mo', 50e3, 24e-3, 3e-3), divergence=3e-3, threshold_frac=0.5), run) + self.assertTrue(hot['overload'].any()) # a 100x brighter beam saturates the strongest pixels + ratio = hot['S_meas'] / np.maximum(hot['S_meas_ideal'], 1e-30) + self.assertLess(float(ratio[hot['overload']].min()), 0.92) # paralysable dead time: measured = true exp(-n tau / 2) + + def test_frames_and_the_beam_stop_shadow(self): + h = xray(mounted(seed=9, sample='salt', samples=(ASPIRIN, NACL))) + rid = collect(h, runs=[dict(RUN, exposure_s=0.5, distance_m=0.032)], fw=0.5 * DEG) + f1 = h.invoke('frame.read', record_id=rid, run_index=0, frame_index=10, binning=4, region_px=None) + f2 = h.invoke('frame.read', record_id=rid, run_index=0, frame_index=10, binning=4, region_px=None) + self.assertEqual(f1['counts'], f2['counts']) # deterministic + c = np.array(f1['counts']) + self.assertEqual(c.shape, (201, 194)) + self.assertTrue(np.all(c >= 0) and c.sum() > 0) + cx, cy = rt.NX // 2, rt.NY // 2 # beam-stop shadow at the direct-beam position + reg = h.invoke('frame.read', record_id=rid, run_index=0, frame_index=10, binning=1, region_px=[cx - 5, cy - 5, cx + 5, cy + 5]) + self.assertEqual(int(np.array(reg['counts']).sum()), 0) + rejected(h, 'frame.read', 'SIMULATION_LIMIT', record_id=rid, run_index=0, frame_index=10, binning=2, region_px=None) + rejected(h, 'frame.read', 'UNKNOWN_FRAME', record_id=rid, run_index=0, frame_index=999, binning=4, region_px=None) + + +def base_crystal(sid, rng, T=100.0, size=1e-4): + return dict(sid=sid, U=rt.random_rotation(rng), U2=None, frac2=0.0, offset=np.zeros(3), size=np.array([size] * 3), mosaic=0.5 * DEG, defect='none', + inverted=False, T=T, dose_gy=0.0, ice_m3=0.0) + + +def simulate(cr, src, run, frames=None): + n = frames or int(round(abs(run['omega_end'] - run['omega_start']) / run['frame_width_rad'])) + return rt.simulate_run(cr, src, run, n, (1, 2, 3), 0.4)['obs'] + + +def pipeline(sid, target, seed, inverted=False, size=1.2e-4, mosaic=0.5, dims=None, sample_seed=None, expo=(0.2, 0.1, 0.4)): + """Mounted crystal, generator on, pre-experiment -> strategy -> collection -> reduction -> What is this? (the review probes).""" + s = dict(sample_id='x', substance_id=sid, size_m=list(dims or [size, size * 0.9, size * 0.8]), mosaicity_rad=mosaic * DEG, + seed=seed if sample_seed is None else sample_seed, inverted=inverted) + kv, ma = (40e3, 30e-3) if target == 'Cu' else (50e3, 24e-3) + h = xray(mounted(seed=seed, sample='x', samples=(s,), target=target), kv, ma) + ds, idx, st = full_dataset(h, expo=expo) + red = h.invoke('processing.reduce', record_id=ds, index_record_id=None) + return h, st, red, h.invoke('processing.what_is_this', record_id=red['record_id']) + + +class Processing(unittest.TestCase): + def test_pre_experiment_strategy_collection_reduction_and_what_is_this(self): + h = xray(mounted(seed=11)) + ds, idx, st = full_dataset(h) + ir = h.records[idx]['data']['result'] + self.assertTrue(ir['indexed']) + self.assertGreater(ir['indexation_ratio'], 0.95) + self.assertGreater(st['predicted_completeness'], 0.9) + red = h.invoke('processing.reduce', record_id=ds, index_record_id=None) + rr = h.records[red['record_id']]['data']['result'] + self.assertEqual(rr['laue_class'], '2/m') + self.assertEqual(rr['space_group_number'], 14) + lib = rt.crystal_lib()['aspirin']['cell_angstrom_deg'] + got = sorted([rr['cell']['a_m'] * 1e10, rr['cell']['b_m'] * 1e10, rr['cell']['c_m'] * 1e10]) + np.testing.assert_allclose(got, sorted(lib[:3]), rtol=0.005) + self.assertLess(rr['r_int'], 0.10) + w = h.invoke('processing.what_is_this', record_id=red['record_id']) + self.assertTrue(w['matched']) + self.assertEqual(w['name'], 'aspirin') + self.assertLess(w['r1'], 0.08) + res = h.invoke('measurement.result', record_id=red['record_id'], max_values=500) + self.assertLessEqual(len(res['data']['reflections']['hkl']), 100) + + def test_cubic_and_trigonal_lattices(self): + for sample, target, number, laue in ((NACL, 'Mo', 225, 'm-3m'), (dict(ASPIRIN, sample_id='cal', substance_id='calcite'), 'Mo', 167, '-3m')): + h = xray(mounted(seed=12, sample=sample['sample_id'], samples=(sample,), target=target), 50e3, 24e-3) + ds, idx, st = full_dataset(h) + red = h.invoke('processing.reduce', record_id=ds, index_record_id=None) + rr = h.records[red['record_id']]['data']['result'] + self.assertEqual((rr['laue_class'], rr['space_group_number']), (laue, number), sample['substance_id']) + self.assertTrue(h.invoke('processing.what_is_this', record_id=red['record_id'])['matched']) + + def test_indexing_failures(self): + for defect, reason in (('polycrystalline', 'NO_LATTICE'), ('amorphous', 'NO_PEAKS')): + s = dict(ASPIRIN, sample_id='bad', defect=defect) + h = xray(mounted(seed=13, sample='bad', samples=(s,))) + pre = wait_op(h, h.invoke('experiment.pre_experiment', exposure_s=0.2, frame_width_rad=0.5 * DEG, distance_m=0.045)['operation_id']) + ai = h.records[pre['record_id']]['data']['auto_index'] + self.assertFalse(ai['indexed'], defect) + self.assertIn(ai['reason'], (reason, 'TOO_FEW_PEAKS', 'NO_LATTICE'), defect) + s = dict(ASPIRIN, sample_id='new', listed_in_database=False) + h = xray(mounted(seed=14, sample='new', samples=(s,))) + pre = wait_op(h, h.invoke('experiment.pre_experiment', exposure_s=0.2, frame_width_rad=0.5 * DEG, distance_m=0.045)['operation_id']) + idx = h.records[pre['record_id']]['data']['auto_index']['record_id'] + self.assertTrue(h.records[idx]['data']['result']['indexed']) + self.assertFalse(h.invoke('processing.what_is_this', record_id=idx)['matched']) + + def test_twinned_crystal_is_flagged_by_the_refinement(self): + s = dict(ASPIRIN, sample_id='tw', defect='twin', twin_fraction=0.45) + h = xray(mounted(seed=15, sample='tw', samples=(s,))) + pre = wait_op(h, h.invoke('experiment.pre_experiment', exposure_s=0.2, frame_width_rad=0.5 * DEG, distance_m=0.045)['operation_id']) + ai = h.records[pre['record_id']]['data']['auto_index'] + if not ai['indexed']: # the indexing already fails on the two lattices + self.assertIn(ai['reason'], ('LOW_INDEXATION', 'NO_LATTICE')) + return + ds, idx, st = full_dataset(h) + try: + red = h.invoke('processing.reduce', record_id=ds, index_record_id=None) + except rt.ActionRejected: + return + w = h.invoke('processing.what_is_this', record_id=red['record_id']) + rr = h.records[red['record_id']]['data']['result'] + self.assertTrue((not w['matched']) or (w['r1'] is None) or w['r1'] > 0.08 or rr['r_int'] > 0.10, (w, rr['r_int'])) + + def test_security_mode_and_cancellation_keep_frames(self): + h = xray(mounted(seed=16)) + oid = h.invoke('data.collect', runs=[RUN], strategy_record_id=None, frame_width_rad=0.5 * DEG)['operation_id'] + h.step(10.0) + h.invoke('door.open', door='left', angle_rad=0.3) + op = h.operations[oid] + self.assertEqual((op['phase'], op['reason']), ('failed', 'SECURITY_MODE')) + rec = h.records[op['record_id']] + self.assertEqual(rec['status'], 'failed') + self.assertTrue(0 < rec['meta']['frames_recorded'] < 120) + self.assertFalse(h.read()['shutter.open']) + h.invoke('door.close', door='left') + h.invoke('safety.doors_ok') + oid = h.invoke('data.collect', runs=[RUN], strategy_record_id=None, frame_width_rad=0.5 * DEG)['operation_id'] + h.step(8.0) + h._cancel_op(h.operations[oid]) + rec = h.records[h.operations[oid]['record_id']] + self.assertEqual(rec['status'], 'cancelled') + self.assertGreater(rec['meta']['frames_recorded'], 0) + + + def test_what_is_this_refines_every_indexing_of_the_lattice(self): + for sid in ('pentaerythritol', 'naclo3'): # 4/m in a 4/mmm lattice, m-3 in m-3m: two indexings fit the metric + h, st, red, w = pipeline(sid, 'Mo', 21) + ref = h.records[w['record_id']]['data']['result']['refinement'] + self.assertTrue(w['matched'], sid) + self.assertLess(w['r1'], 0.08, sid) + self.assertEqual(ref['settings_tested'], 2, sid) + + def test_space_group_inside_the_laue_class_and_ambiguous_ties(self): + h, st, red, w = pipeline('cscl', 'Mo', 21) + rr = h.records[red['record_id']]['data']['result'] + self.assertEqual((rr['laue_class'], rr['space_group_number']), ('m-3m', 221)) + self.assertFalse(red['space_group_ambiguous']) + h, st, red, w = pipeline('zns', 'Mo', 21) + rr = h.records[red['record_id']]['data']['result'] + self.assertTrue(red['space_group_ambiguous']) + self.assertEqual(sorted([rr['space_group']] + rr['space_group_alternatives']), ['F -4 3 m', 'F m -3 m']) + + def test_runs_of_different_exposure_are_normalised(self): + for sid, laue, number in (('quartz', '-3m', 154), ('epsomite', 'mmm', 19)): + h, st, red, w = pipeline(sid, 'Cu', 21) # strategy exposures 0.1 s and 0.4 s + rr = h.records[red['record_id']]['data']['result'] + self.assertEqual((rr['laue_class'], rr['space_group_number']), (laue, number), sid) + self.assertLess(w['r1'], 0.05, sid) + + def test_strategy_prediction_matches_the_reduction(self): + h, st, red, w = pipeline('aspirin', 'Cu', 21) # pseudo-orthorhombic metric (a ~ c); the pre-experiment Laue test gives 2/m + it = h.records[red['record_id']]['internal'] + d_t = max(0.84e-10, rt.line_data('Cu')['lam1'] / 1.7) + achieved = float(np.sum(it['d'] >= d_t) / rt.expected_unique(it['A_conv'], it['P'], it['ops_c'], d_t)) + self.assertLess(abs(achieved - st['predicted_completeness']), 0.03, (achieved, st['predicted_completeness'])) + self.assertEqual(h.records[st['record_id']]['data']['result']['laue_order_assumed'], 4) + + def test_flack_parameter_distinguishes_the_enantiomorphs(self): + for inverted, x0 in ((False, 0.0), (True, 1.0)): + h, st, red, w = pipeline('epsomite', 'Cu', 21, inverted=inverted) # P2(1)2(1)2(1), chiral; S and Mg scatter anomalously at Cu + self.assertLess(abs(w['flack_x'] - x0), max(0.1, 3 * w['flack_su']), (inverted, w['flack_x'], w['flack_su'])) + h, st, red, w = pipeline('nacl', 'Mo', 12) + self.assertIsNone(w['flack_x']) # centrosymmetric model + + + def test_pa3_in_both_indexings_of_the_m3m_lattice(self): + for sid, seed in (('sni4', 21), ('alum', 22)): # m-3 in an m-3m lattice: the glide test runs in both indexings + h, st, red, w = pipeline(sid, 'Mo', seed, mosaic=0.6, dims=(1.2e-4, 1.0e-4, 0.9e-4)) + rr = h.records[red['record_id']]['data']['result'] + self.assertEqual((rr['laue_class'], rr['space_group_number']), ('m-3', 205), sid) + + def test_absorbing_crystals_keep_their_laue_class(self): + for sid, laue, number in (('zno', '6/mmm', 186), ('cisplatin', '2/m', 14)): # mu d about 3 with Mo: empirical absorption surface + h, st, red, w = pipeline(sid, 'Mo', 21, mosaic=0.6, dims=(1.2e-4, 1.0e-4, 0.9e-4)) + rr = h.records[red['record_id']]['data']['result'] + self.assertEqual((rr['laue_class'], rr['space_group_number']), (laue, number), sid) + self.assertLess(w['r1'], 0.05, sid) + + def test_pseudo_symmetry_is_rejected_by_the_group_check(self): + for seed, sample_seed in ((21, None), (24, None), (23, 3)): # I-4 with a pseudo-cubic F metric; seed 23 / sample 3 once crashed in conventional_cell + h, st, red, w = pipeline('pentaerythritol', 'Cu', seed, mosaic=0.6, dims=(1.2e-4, 1.0e-4, 0.9e-4), sample_seed=sample_seed) + rr = h.records[red['record_id']]['data']['result'] + self.assertEqual((rr['laue_class'], rr['space_group_number']), ('4/m', 82), seed) + self.assertLess(w['r1'], 0.06, seed) + self.assertEqual(w['name'], 'pentaerythritol') + + def test_true_symmetry_of_well_measured_crystals_is_kept(self): + for sid, target, laue, numbers in (('mgo', 'Mo', 'm-3m', (225,)), ('calcite', 'Cu', '-3m', (167,)), ('quartz', 'Cu', '-3m', (152, 154))): + h, st, red, w = pipeline(sid, target, 22, mosaic=0.6, dims=(1.2e-4, 1.0e-4, 0.9e-4)) + rr = h.records[red['record_id']]['data']['result'] + self.assertEqual(rr['laue_class'], laue, sid) + self.assertIn(rr['space_group_number'], numbers, sid) + self.assertLess(w['r1'], 0.06, sid) + + def test_space_group_setting_maps_the_cell_to_the_symbol(self): + h, st, red, w = pipeline('aragonite', 'Mo', 21, mosaic=0.6, dims=(1.2e-4, 1.0e-4, 0.9e-4), sample_seed=3) + rr = h.records[red['record_id']]['data']['result'] + it = h.records[red['record_id']]['internal'] + self.assertEqual((rr['space_group'], rr['space_group_number']), ('P n m a', 62)) + T = np.array(rr['space_group_setting']) + self.assertTrue(np.array_equal(T, np.round(T)) and abs(round(np.linalg.det(T))) == 1) + c = rr['cell'] + G = np.diag([c['a_m'] ** 2, c['b_m'] ** 2, c['c_m'] ** 2]) + np.testing.assert_allclose(np.sqrt(np.diag(T @ G @ T.T)) * 1e10, (5.7407, 4.9611, 7.9672), rtol=6e-3) # Pnma aragonite (a, b, c) + Hs = np.round(it['H'] @ T.T).astype(int) # h' = T h: the indices in the setting of the symbol + strong = it['I'] > 5 * it['sigma'] + h_, k_, l_ = Hs[strong].T + bad = ((h_ == 0) & ((k_ + l_) % 2 == 1)) | ((l_ == 0) & (h_ % 2 == 1)) | ((h_ == 0) & (l_ == 0) & (k_ % 2 == 1)) # 0kl k+l, hk0 h, 0k0 k (Pnma) + self.assertEqual(int(bad.sum()), 0) + self.assertGreater(int(((h_ == 0) | (l_ == 0)).sum()), 20) + + def test_noise_dominated_data_do_not_create_symmetry(self): + weak = dict(mosaic=1.2, dims=(4e-5, 3.5e-5, 3e-5), expo=(0.1, 0.05, 0.1)) # I/sigma ~ 1: 0.04 mm, 1.2 deg, short frames (Mo) + allowed = {'glucose': {'mmm', '2/m', '-1'}, 'epsomite': {'mmm', '2/m', '-1'}, 'pentaerythritol': {'4/m', '2/m', '-1'}} + for sid, seed in (('glucose', 29), ('glucose', 32), ('epsomite', 29), ('pentaerythritol', 29)): + h, st, red, w = pipeline(sid, 'Mo', seed, **weak) + rr = h.records[red['record_id']]['data']['result'] + self.assertIn(rr['laue_class'], allowed[sid], (sid, seed)) # pseudo-tetragonal / pseudo-cubic metrics: no false rotations accepted + search = [t for t in rr['laue_tests'] if t.get('group_check') == 'search'][0] + self.assertGreater(search['r_int_p1'], 0.086, (sid, seed)) # really noise-dominated: the cap of the element bound is active + self.assertTrue(all(t['bound'] <= max(rt.LAUE_ELEM_CAP, rt.LAUE_ELEM_NOISE_K * (t['noise'] or 0.0)) + 1e-12 + for t in rr['laue_tests'] if 'group_check' not in t)) + tested = [t['bound'] for t in rr['laue_tests'] if 'group_check' not in t and t['pairs'] >= rt.LAUE_MIN_PAIRS and t['r'] is not None] + self.assertAlmostEqual(search['element_max'], max(tested + [search['element_bound_base']]), delta=1e-12) # the largest bound applied + + def test_origin_choice_two_is_reported(self): + for sid, seed in (('spinel', 29), ('si', 25)): + h, st, red, w = pipeline(sid, 'Mo', seed, mosaic=0.6, dims=(1.2e-4, 1.0e-4, 0.9e-4)) + rr = h.records[red['record_id']]['data']['result'] + self.assertEqual((rr['space_group'], rr['space_group_number']), ('F d -3 m :2', 227), sid) + self.assertEqual(rr['space_group_origin_alternatives'], ['F d -3 m :1'], sid) + self.assertFalse(rr['space_group_ambiguous'], sid) + + def test_cell_coincidences_are_resolved_by_the_intensities(self): + h, st, red, w = pipeline('si', 'Mo', 27, mosaic=0.6, dims=(1.2e-4, 1.0e-4, 0.9e-4), sample_seed=3) # a = 5.431 A, within the cell error of ZnS 5.409 A + res = h.records[w['record_id']]['data']['result'] + self.assertEqual(w['name'], 'silicon') + self.assertLess(w['r1'], 0.02) + names = [m['name_en'] for m in res['matches']] + self.assertIn('sphalerite', names) + self.assertEqual(res['ranked_by'], 'refined wR2 of the cell matches') + self.assertEqual(res['refinement']['models_refined'], len(res['matches'])) + self.assertGreater(min(m['refined_r1'] for m in res['matches'][1:]), 0.1) + + +class WeakCrystalsAndLattices(unittest.TestCase): + def test_weak_crystal_pre_experiment_ends_and_the_clock_runs(self): + for sid, seed in (('aspirin', 32), ('pentaerythritol', 32), ('aspirin', 29)): # once LinAlgError inside sim.step: the operation never ended + s = dict(sample_id='x', substance_id=sid, size_m=[4e-5, 3.5e-5, 3e-5], mosaicity_rad=1.2 * DEG, seed=seed) + h = xray(mounted(seed=seed, sample='x', samples=(s,), target='Mo'), 50e3, 24e-3) + h.register_principal('ev', 'evaluator') + h.register_principal('ag', 'agent') + r0 = h.session('ag').invoke(instance_id=h.instance_id, capability_id='experiment.pre_experiment', + arguments=dict(exposure_s=0.1, frame_width_rad=0.5 * DEG, distance_m=0.045), request_id='pre') + self.assertEqual(r0['status'], 'accepted') + for i in range(4): + t0 = h.t + resp = h.session('ev').invoke(instance_id=h.instance_id, capability_id='sim.step', arguments=dict(dt_s=600.0), request_id=f'st{i}') + self.assertEqual(resp['status'], 'succeeded', resp.get('error')) + self.assertAlmostEqual(h.t - t0, 600.0, delta=1e-6) + self.assertIsNone(h.op) + pre = [x for x in h.records.values() if x['kind'] == 'pre_experiment'][0] + self.assertEqual(pre['status'], 'completed') + self.assertIn(pre['data']['auto_index']['reason'] if not pre['data']['auto_index']['indexed'] else 'indexed', + ('indexed', 'NO_PEAKS', 'TOO_FEW_PEAKS', 'NO_LATTICE', 'LOW_INDEXATION')) + + def test_conventional_cell_of_every_candidate_group(self): + E = np.eye(3, dtype=int) + key = lambda M: np.round(M).astype(int).tobytes() # noqa: E731 + names = {('triclinic', 1), ('monoclinic', 2), ('orthorhombic', 4), ('tetragonal', 4), ('tetragonal', 8), ('hexagonal', 3), ('hexagonal', 6), + ('hexagonal', 12), ('cubic', 12), ('cubic', 24)} + for sid in ('adp', 'epsomite', 'glucose', 'pentaerythritol', 'aspirin', 'nacl', 'quartz'): + A = rt.database_cells()[sid]['A_red'] + lat = {key(M): np.round(M).astype(int) for M in rt.metric_ops(A)} + props = [M for M in lat.values() if round(np.linalg.det(M)) > 0 and not np.array_equal(M, E)] + groups = {} + for i in range(len(props)): + for j in range(i, len(props)): + G = rt._closure([props[i], props[j]]) + ks = frozenset(key(g) for g in G) + if ks <= set(lat) | {key(E)}: + groups[ks] = G + for G in groups.values(): + L = [np.array(g) for g in G] + [-np.array(g) for g in G] + try: + Ac, P, system, cen = rt.conventional_cell(A, L) + except rt.ConventionalCellError: + continue # the callers fall back to the triclinic cell + Pinv = np.linalg.inv(P) + self.assertTrue(all(np.allclose(np.linalg.inv(Pinv @ M @ P), np.round(np.linalg.inv(Pinv @ M @ P))) for M in L), (sid, system)) + self.assertIn((system, len(G)), names, (sid, system, len(G))) + + +class IndexFallback(unittest.TestCase): + def test_triclinic_fallback_of_the_indexing_is_recorded(self): + h = xray(mounted(seed=13)) + rid = collect(h, runs=[dict(RUN, omega_end_rad=-20 * DEG)]) + real = rt.conventional_cell + + def failing(A, ops): # fault injection: the metric symmetry cannot be converted + if len(ops) > 2: + raise rt.ConventionalCellError('injected') + return real(A, ops) + base = h.invoke('processing.index', record_id=rid, threshold_i_sigma=5.0) + order = h.records[base['record_id']]['data']['result']['lattice_symmetry_order'] + self.assertGreater(order, 2) + rt.conventional_cell = failing + try: + ix = h.invoke('processing.index', record_id=rid, threshold_i_sigma=5.0) + finally: + rt.conventional_cell = real + rec = h.records[ix['record_id']] + self.assertEqual(rec['data']['result']['crystal_system'], 'triclinic') + self.assertEqual(rec['data']['result']['lattice_symmetry_order'], 2) + self.assertEqual(rec['data']['result']['metric_symmetry_order_unconverted'], order) + self.assertIn('lattice_symmetry_not_converted', rec['warnings']) + self.assertNotIn('lattice_symmetry_not_converted', h.records[base['record_id']]['warnings']) + + +class RecordsLedgersSessions(unittest.TestCase): + def test_energy_and_count_ledgers_close(self): + h = xray(mounted(seed=17, cold=False)) + e0, t0 = h.ledger()['electrical_energy_j'], h.t + h.step(100.0) + self.assertAlmostEqual(h.ledger()['electrical_energy_j'] - e0, (rt.ELECTRONICS_W + 40e3 * 30e-3 / rt.GENERATOR_EFFICIENCY) * 100.0, delta=1e-6) + rid = collect(h, runs=[dict(RUN, omega_end_rad=-20 * DEG)]) + led = h.ledger() + self.assertEqual(led['frames'], 20.0) + self.assertAlmostEqual(led['exposure_s'], 20 * 0.2, delta=1e-9) + self.assertAlmostEqual(led['crystal_dose_gy'], h.read('evaluator')['truth.crystal']['dose_gy'], delta=1e-6) + self.assertGreater(led['crystal_dose_gy'], 0.0) + self.assertEqual(led['xray_on_s'], led['filament_s']) + + def test_two_instances_are_isolated(self): + a, b = xray(mounted(seed=18, cold=False)), mounted(seed=18, cold=False) + collect(a, runs=[dict(RUN, omega_end_rad=-20 * DEG)]) + self.assertEqual(b.ledger()['frames'], 0.0) + self.assertEqual(b.records, {}) + + def test_agent_does_not_see_truth_or_foreign_objects(self): + h = xray(mounted(seed=19, cold=False)) + h.register_principal('a1', 'agent'); h.register_principal('a2', 'agent'); h.register_principal('ev', 'evaluator') + s1, s2, ev = h.session('a1'), h.session('a2'), h.session('ev') + obs = s1.read(instance_id=rt.INSTANCE_ID)['observations'] + self.assertFalse(any(k.startswith('truth.') for k in obs)) + with self.assertRaises(rt.ActionRejected): + s1.read(instance_id=rt.INSTANCE_ID, state_ids=['truth.crystal']) + r = s1.invoke(instance_id=rt.INSTANCE_ID, capability_id='sample.provide', arguments=dict(ASPIRIN, sample_id='x2'), request_id='q1') + self.assertEqual(r['error']['code'], 'ACCESS_DENIED') + r = s1.invoke(instance_id=rt.INSTANCE_ID, capability_id='data.collect', arguments=dict(runs=[dict(RUN, omega_end_rad=-20 * DEG)], strategy_record_id=None, + frame_width_rad=0.5 * DEG), request_id='q2') + self.assertEqual(r['status'], 'accepted') + r2 = s2.invoke(instance_id=rt.INSTANCE_ID, capability_id='goniometer.move', arguments=dict(rt.POSE_EXAMPLE), request_id='q3') + self.assertEqual(r2['error']['code'], 'ACCESS_DENIED') + self.assertIsNone(s2.read(instance_id=rt.INSTANCE_ID)['observations']['operation.id']['value']) + h.step(100.0) + rid = h.operations[r['operation_id']]['record_id'] + res = s1.invoke(instance_id=rt.INSTANCE_ID, capability_id='measurement.result', arguments=dict(record_id=rid, max_values=100), request_id='q4') + self.assertIsNone(res['result']['record']['template_source']['substance_id']) + ev_res = ev.invoke(instance_id=rt.INSTANCE_ID, capability_id='measurement.result', arguments=dict(record_id=rid, max_values=100), request_id='q5') + self.assertEqual(ev_res['result']['record']['template_source']['substance_id'], 'aspirin') + r3 = s2.invoke(instance_id=rt.INSTANCE_ID, capability_id='measurement.result', arguments=dict(record_id=rid, max_values=100), request_id='q6') + self.assertEqual(r3['error']['code'], 'ACCESS_DENIED') + self.assertNotIn(rid, s2.invoke(instance_id=rt.INSTANCE_ID, capability_id='records.list', arguments={}, request_id='q7')['result']['records']) + h.invoke('fault.inject', fault='icing', active=True) + ev_events = s1.invoke(instance_id=rt.INSTANCE_ID, capability_id='events.read', arguments=dict(since_s=0.0), request_id='q8')['result']['events'] + self.assertFalse(any(e['kind'] == 'fault' for e in ev_events)) + + def test_idempotent_requests_and_conflicts(self): + h = ready(seed=20) + h.register_principal('a1', 'agent') + s = h.session('a1') + r1 = s.invoke(instance_id=rt.INSTANCE_ID, capability_id='safety.doors_ok', arguments={}, request_id='same') + r2 = s.invoke(instance_id=rt.INSTANCE_ID, capability_id='safety.doors_ok', arguments={}, request_id='same') + self.assertEqual(r1, r2) + r3 = s.invoke(instance_id=rt.INSTANCE_ID, capability_id='power.set', arguments=dict(enabled=False), request_id='same') + self.assertEqual(r3['error']['code'], 'REQUEST_CONFLICT') + self.assertTrue(h.power) + + def test_defects_become_device_errors(self): + h = ready(seed=21) + h.register_principal('a1', 'agent') + s = h.session('a1') + orig = h._cmd_camera_view + h._cmd_camera_view = lambda: 1 / 0 + r = s.invoke(instance_id=rt.INSTANCE_ID, capability_id='camera.view', arguments={}, request_id='z') + self.assertEqual(r['error']['code'], 'DEVICE_ERROR') + h._cmd_camera_view = orig + + def test_remaining_capabilities_through_the_api(self): + h = xray(mounted(seed=22, cold=False)) + rid = collect(h, runs=[dict(RUN, omega_end_rad=-20 * DEG)]) + h.invoke('processing.index', record_id=rid, threshold_i_sigma=5.0) + h.invoke('records.list') + h.invoke('events.read', since_s=0.0) + h.invoke('measurement.result', record_id=rid, max_values=200) + h.invoke('xray.set', voltage_v=45e3, current_a=26e-3) + h.step(10.0) + h.invoke('shutter.close') + h.invoke('xray.off') + h.invoke('records.delete', record_id=rid) + self.assertNotIn(rid, h.records) + h.invoke('power.set', enabled=False) + h.invoke('sim.step', dt_s=1.0) + + + def test_agent_ledger_hides_the_crystal_dose(self): + h = xray(mounted(seed=17, cold=False)) + h.invoke('shutter.open') + h.step(30.0) + h.register_principal('a1', 'agent') + h.register_principal('ev', 'evaluator') + a = h.session('a1').invoke(instance_id=rt.INSTANCE_ID, capability_id='ledger.read', arguments={}, request_id='l1')['result']['ledger'] + e = h.session('ev').invoke(instance_id=rt.INSTANCE_ID, capability_id='ledger.read', arguments={}, request_id='l2')['result']['ledger'] + self.assertNotIn('crystal_dose_gy', a) + self.assertGreater(e['crystal_dose_gy'], 0.0) + self.assertEqual({k: v for k, v in e.items() if k != 'crystal_dose_gy'}, a) + + def test_agent_summaries_come_from_measurements(self): + h = xray(mounted(seed=5)) + rid = collect(h, runs=[dict(RUN, exposure_s=1.0)]) + rr = h.records[rid]['runs'][0] + o = rr['obs'] + out = h.invoke('measurement.result', record_id=rid, max_values=64) + self.assertEqual(out['data']['runs'][0]['spots_measured'], int(np.sum(o['i_obs'] / o['sigma'] > 3))) + idx = h.invoke('processing.index', record_id=rid, threshold_i_sigma=5.0) + est = h.records[idx['record_id']]['data']['result']['resolution_estimate_m'] + sel = o['i_obs'] / o['sigma'] > 3 + s1, _ = rt.pixel_rays(rr['run']['theta'], rr['run']['distance'], o['x_obs'][sel], o['y_obs'][sel]) + lam = rt.line_data(h.plant['target'])['lam1'] + d_meas = lam / (2 * np.sin(np.arccos(np.clip(s1[:, 0], -1, 1)) / 2)) + self.assertAlmostEqual(est, float(np.percentile(d_meas, 2)), delta=1e-18) + + +class ZDeclaredEffects(unittest.TestCase): + def test_on_step_changes_are_declared(self): + cases = { + 'goniometer.move': lambda h: h.invoke('goniometer.move', omega_rad=20 * DEG, kappa_rad=0.0, phi_rad=0.5, theta_rad=0.2, distance_m=0.06), + 'xray.on': lambda h: (h.invoke('xray.set_key', angle_rad=math.pi / 2), h.invoke('xray.on', voltage_v=40e3, current_a=30e-3)), + 'cryostream.set': lambda h: h.invoke('cryostream.set', temperature_k=150.0, ramp_k_s=0.1), + 'data.collect': lambda h: (xray(h), h.step(1.0), h.invoke('data.collect', runs=[dict(RUN, omega_end_rad=-20 * DEG)], strategy_record_id=None, + frame_width_rad=0.5 * DEG)), + } + for cap, fn in cases.items(): + for window in (3.0, 60.0): + base = mounted(seed=23, cold=False) + other = mounted(seed=23, cold=False) + if cap == 'data.collect': + xray(base); base.step(1.0) + fn(other) + before_b, before_o = base.read('evaluator'), other.read('evaluator') + base.step(window); other.step(window) + after_b, after_o = base.read('evaluator'), other.read('evaluator') + diff = {k for k in after_o if _changed(after_o[k], before_o[k]) and not _changed(after_b[k], before_b[k])} + allowed = set(rt.ON_STEP.get(cap, [])) | set(rt.EFFECTS.get(cap, [])) | {'clock.time_s', 'truth.flux_ph_s'} + if cap in ('xray.on', 'data.collect'): + allowed |= set(rt.ON_STEP['xray.on']) | {'truth.filament_remaining_s'} + self.assertFalse(diff - allowed, (cap, window, sorted(diff - allowed))) + + def test_every_executable_capability_was_accepted(self): + implemented = [k for k in rt.CAPS if k not in rt.UNSUPPORTED and k not in rt.DECLARED] + missing = [k for k in implemented if k not in PROCESS_EVIDENCE] + self.assertEqual(missing, [], missing) + + def test_rejection_codes_are_declared(self): + meta = _meta()['capabilities'] + for cap, codes in REJECTIONS.items(): + declared = {e['code'] for e in meta[cap]['errors']} + self.assertFalse(codes - declared - {'INVALID_ARGUMENT'}, (cap, sorted(codes - declared))) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_asset_seal_aa500.py b/tests/test_asset_seal_aa500.py new file mode 100644 index 0000000000000000000000000000000000000000..d6e85d850c7d24ea6fbbbe925d06e6ed4212e716 --- /dev/null +++ b/tests/test_asset_seal_aa500.py @@ -0,0 +1,897 @@ +"""tests for CHEM-172 seal_aa500 (SEAL AA500 segmented continuous flow analyzer, 4 nutrient channels + AS2 sampler): +python3 -m unittest tests/test_asset_seal_aa500.py + +Themes: contract consistency (slots, effects, errors raised vs declared); agent / evaluator truth isolation and foreign-agent ownership; idempotent +request ids; two instances isolated; step-partition independence; rejected calls leave the state unchanged; every output validated against its +schema and every success changes only declared slots; EPA stock recipes against PubChem formulas; manifold design rule (top of range about 0.8 AU) +and the EPA 366.0 silicate manifold flows; start-up / shutdown programs, motorised platen and bath warm-up; transport delay and steady-state peak; +linear calibration and recovery of a mixed water sample; carry-over (EPA 366.0 high / low / low) grows when the wash time is cut; throughput limit +(120 samples / h); auto-dilution of over-range samples; quadratic fit above 1.2 AU; drift correction; cadmium reduction efficiency (nitrite / +nitrate check), air in the cadmium coil and activation; chlorine poisoning; arsenate and iron on phosphate; salinity refractive-index blank and +colour; bath temperature and colour development; LED wavelength mismatch and flow-cell path length; pump-tube wear; reagent empty, leak, probe +blocked, LED failure, bath runaway; power cut during a run; raw trace bubbles; interlocks (lid, platen, cover, lamp); manifold / method changes.""" +import json +import math +import re +import sys +import unittest +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / 'scripts')) +from asset_runtime import seal_aa500 as rt # noqa: E402 + +INST = 'seal_aa500_01' +CHECKS = [] +SEEN_CAPS = set() +PROCESS_EVIDENCE = {} +TOPS = dict(nitrate_stock=0.0028, ammonium_stock=0.006, phosphate_stock=0.008, silicate_stock=0.026) # kg/m3 element at the top standard +LEVELS = [0.0, 0.1, 0.25, 0.5, 0.75, 1.0] +CH_OF = dict(nitrate_stock='ch1', ammonium_stock='ch2', phosphate_stock='ch3', silicate_stock='ch4') + + +def _differ(x, y): + if isinstance(x, float) and isinstance(y, float): + return abs(x - y) > 1e-12 * max(1.0, abs(x), abs(y)) + return x != y + + +class Rig: + def __init__(self, seed=1, room=295.15, mains=230.0, instance=INST): + self.h = rt.SealAa500Runtime(instance) + self.h.register_principal('agent', 'agent') + self.h.register_principal('eval', 'evaluator') + self.A = self.h.session('agent') + self.E = self.h.session('eval') + self.n = 0 + self.inst = instance + self.call(self.E, 'plant.configure', room_k=room, mains_voltage_v=mains, noise_seed=seed) + + def call(self, sess, cap, expect='succeeded', **args): + """Instrumented call: outputs validated against the declared schema; a success changes only declared immediate slots and never the clock; + a rejection leaves every slot unchanged and returns a declared error code.""" + self.n += 1 + before, t0 = self.h.read('evaluator'), self.h.t + r = sess.invoke(instance_id=self.inst, capability_id=cap, arguments=args, request_id=f'r{self.n}') + after = self.h.read('evaluator') + changed = {k for k in after if _differ(after[k], before[k])} - {'clock.time_s'} + if expect == 'succeeded': + assert r['status'] == 'succeeded', (cap, r['error']) + rt.validate(rt.CAPS[cap]['output_schema'], r['result']) + if cap != 'sim.step': + extra = changed - set(rt.EFFECTS.get(cap, [])) + assert not extra, (cap, sorted(extra)) + assert self.h.t == t0, cap + SEEN_CAPS.add(cap) + PROCESS_EVIDENCE.setdefault(cap, []).append(dict(arguments=json.dumps(args, sort_keys=True, default=str)[:200], time_s=t0, status=r['status'])) + return r['result'] + assert r['status'] in ('rejected', 'unsupported'), (cap, r['status'], r.get('result')) + assert r['error']['code'] == expect, (cap, r['error']['code'], expect) + assert not changed, (cap, 'rejected call changed', sorted(changed)) + assert expect in [e['code'] for e in rt.export_seal_aa500_contract_metadata()['capabilities'][cap]['errors']], (cap, expect) + return r + + def step(self, s): + self.call(self.E, 'sim.step', dt_s=float(s)) + + def read(self, *ids, who=None): + sess = who or self.E + o = sess.read(instance_id=self.inst, state_ids=list(ids) if ids else None)['observations'] + return {k: v['value'] for k, v in o.items()} if not ids or len(ids) > 1 else o[ids[0]]['value'] + + def kits(self, *names, volume=3e-3): + for k in names or rt.KITS: + self.call(self.E, 'kit.provide', kit=k, volume_m3=volume) + + def reagents(self, volume=4e-4): + for c, ch in self.h.ch.items(): + for rg in ch['reagents']: + self.call(self.A, 'reagent.load', channel=c, reagent=rg, volume_m3=volume) + + def ready(self, power=True, kits=True): + if kits: + self.kits() + self.reagents() + if power: + self.call(self.A, 'power.set', on=True) + self.call(self.A, 'system.startup') + for _ in range(90): + self.step(60.0) + if self.read('system.state') == 'ready': + return self.h.t + raise AssertionError('never ready') + + def standards(self, tops=None, levels=LEVELS, rack='S', first=1, prefix='std'): + tops = dict(TOPS if tops is None else tops) + for i, f in enumerate(levels): + comps = [dict(source_id=k, volume_m3=1e-4 * v / rt.STOCK_NOMINAL[k] * f) for k, v in tops.items() if f > 0] + comps.append(dict(source_id='wash_water', volume_m3=1e-4 - sum(x['volume_m3'] for x in comps))) + self.call(self.A, 'standard.prepare', standard_id=f'{prefix}{i}', volume_m3=1e-4, components=comps) + self.call(self.A, 'sampler.load', rack=rack, position=first + i, item_id=f'{prefix}{i}', volume_m3=1e-5) + return [dict(rack=rack, position=first + i, type='calibrant') for i in range(len(levels))] + + def sample(self, sid, pos, rack='A', volume=1e-5, **comp): + self.call(self.E, 'sample.provide', sample_id=sid, volume_m3=max(5e-5, volume), composition=comp) + self.call(self.A, 'sampler.load', rack=rack, position=pos, item_id=sid, volume_m3=volume) + return dict(rack=rack, position=pos, type='sample') + + def wash_cup(self, pos=22): + if ('S', pos) not in self.h.racks: + self.call(self.A, 'sampler.load', rack='S', position=pos, item_id='wash_water', volume_m3=1e-5) + return dict(rack='S', position=pos, type='baseline') + + def run(self, cups, sample_s=60.0, wash_s=30.0, **kw): + self.call(self.A, 'run.start', cups=cups, sample_s=sample_s, wash_s=wash_s, **kw) + for _ in range(2000): + if self.read('run.status')['state'] not in ('running', 'draining'): + break + self.step(60.0) + return self.call(self.A, 'data.results') + + def conc(self, res, cup, ch): + return next(r for r in res['results'] if r['cup'] == cup and r['channel'] == ch) + + +def _raised_codes(): + """Error codes each command can raise: its own ActionRejected calls plus those of the helpers it calls (static scan of the module source).""" + src = Path(rt.__file__).read_text() + funcs = {} + for m in re.finditer(r'\n def (\w+)\(self[^\n]*\n(.*?)(?=\n def |\n# ----|\nclass |\n _NOCOPY)', src, re.S): + funcs[m.group(1)] = m.group(2) + own = {k: set(re.findall(r"ActionRejected\('([A-Z_]+)'\)", v)) for k, v in funcs.items()} + calls = {k: set(re.findall(r'self\.(_\w+)\(', v)) & set(funcs) for k, v in funcs.items()} + out = {} + for k in funcs: + if not k.startswith('_cmd_'): + continue + seen, todo, codes = set(), [k], set() + while todo: + f = todo.pop() + if f in seen: + continue + seen.add(f) + codes |= own.get(f, set()) + todo += [g for g in calls.get(f, ()) if g not in ('_cmd_sim_step', 'step', '_tick')] + out[k[5:].replace('_', '.', 1)] = codes + return out + + +_READY = {} + + +def ready_rig(seed=1): + """A started-up rig with the mixed calibrants on the standard rack (re-used read-only by several tests through deep copies would be costly; + built fresh per call).""" + g = Rig(seed=seed) + g.ready() + cal = g.standards() + return g, cal + + +class Contract(unittest.TestCase): + def test_metadata_slots_effects_and_mirrors_consistent(self): + meta = rt.export_seal_aa500_contract_metadata() + slots = set(meta['state_slots']) + self.assertEqual(slots, set(rt.SLOTS)) + for k, c in meta['capabilities'].items(): + for e in c['state_effects']: + self.assertIn(e['state_id'], slots, k) + for x in c['observes']: + self.assertIn(x, slots, k) + for pre in c['preconditions']: + self.assertTrue(set(pre['state_ids']) <= slots, k) + self.assertTrue({'INVALID_ARGUMENT', 'REQUEST_CONFLICT', 'UNKNOWN_INSTANCE'} <= {e['code'] for e in c['errors']}, k) + self.assertTrue(c['function_zh']) + self.assertIn(c['kind'], ('query', 'device_command', 'robot_skill', 'simulation', 'analysis', 'configuration')) + self.assertIn(c['model_effects']['mode'], ('none', 'direct', 'coupled', 'host_required')) + self.assertTrue(rt.SCENE_MIRRORED <= slots) + for k in rt.SCENE_MIRRORED: + self.assertEqual(meta['state_slots'][k]['visibility'], 'agent', k) + mech = meta['mechanisms']['segmented_flow_process'] + for name, p in mech['parameters'].items(): + self.assertEqual(name, name.lower()) + self.assertIn(p['evidence'], ('documented', 'assumption'), name) + self.assertEqual(len(meta['capabilities']), 40) + + def test_declared_errors_cover_raised_codes(self): + meta = rt.export_seal_aa500_contract_metadata() + for cap, codes in _raised_codes().items(): + if cap not in meta['capabilities']: + cap = next(k for k in meta['capabilities'] if k.replace('.', '_') == cap.replace('.', '_')) + declared = {e['code'] for e in meta['capabilities'][cap]['errors']} + self.assertTrue(codes <= declared, (cap, sorted(codes - declared))) + + def test_unsupported_capabilities(self): + g = Rig() + for k in rt.UNSUPPORTED: + r = g.A.invoke(instance_id=INST, capability_id=k, arguments={}, request_id='u-' + k) + self.assertEqual(r['status'], 'unsupported') + self.assertEqual(r['error']['code'], 'UNSUPPORTED') + + def test_agent_truth_isolation(self): + g = Rig() + d = g.A.describe(instance_id=INST) + self.assertFalse(any(k.startswith('truth.') for k in d['state_slots'])) + self.assertFalse(any(c['visibility'] != 'agent' for c in d['capabilities'].values())) + for c in d['capabilities'].values(): + self.assertFalse(any(e['state_id'].startswith('truth.') for e in c['state_effects'])) + with self.assertRaises(rt.ActionRejected): + g.A.read(instance_id=INST, state_ids=['truth.streams']) + for cap, args in (('truth.inspect', {}), ('sim.step', dict(dt_s=1.0)), ('kit.provide', dict(kit='wash_water')), + ('sample.provide', dict(sample_id='x', volume_m3=1e-5, composition={}))): + r = g.A.invoke(instance_id=INST, capability_id=cap, arguments=args, request_id='x-' + cap) + self.assertEqual(r['error']['code'], 'ACCESS_DENIED', cap) + self.assertIn('truth.streams', g.E.describe(instance_id=INST)['state_slots']) + g.call(g.E, 'fault.inject', fault='probe_blocked', active=True) + ev = g.call(g.A, 'events.read', since_s=0.0)['events'] + self.assertFalse(any(e['kind'] == 'fault' for e in ev)) + self.assertTrue(any(e['kind'] == 'fault' for e in g.call(g.E, 'events.read', since_s=0.0)['events'])) + + def test_foreign_agent_ownership(self): + g = Rig() + g.h.register_principal('agent2', 'agent') + B = g.h.session('agent2') + g.kits('nitrate_stock', 'wash_water') + g.call(g.A, 'standard.prepare', standard_id='mine', volume_m3=1e-4, components=[dict(source_id='nitrate_stock', volume_m3=1e-7)]) + g.call(g.A, 'sampler.load', rack='S', position=1, item_id='mine', volume_m3=1e-5) + r = B.invoke(instance_id=INST, capability_id='sampler.load', arguments=dict(rack='S', position=2, item_id='mine', volume_m3=1e-5), request_id='b1') + self.assertEqual(r['error']['code'], 'ACCESS_DENIED') + r = B.invoke(instance_id=INST, capability_id='standard.prepare', arguments=dict(standard_id='b', volume_m3=1e-4, + components=[dict(source_id='mine', volume_m3=1e-5)]), request_id='b2') + self.assertEqual(r['error']['code'], 'ACCESS_DENIED') + r = B.invoke(instance_id=INST, capability_id='sampler.unload', arguments=dict(rack='S', position=1), request_id='b3') + self.assertEqual(r['error']['code'], 'ACCESS_DENIED') + r = B.invoke(instance_id=INST, capability_id='run.start', arguments=dict(cups=[dict(rack='S', position=1, type='sample')], sample_s=40.0, wash_s=20.0), + request_id='b4') + self.assertEqual(r['error']['code'], 'ACCESS_DENIED') + self.assertNotIn('mine', B.read(instance_id=INST, state_ids=['samples.available'])['observations']['samples.available']['value']) + # evaluator-provided stocks are shared; agent 2 prepares its own standard + r = B.invoke(instance_id=INST, capability_id='standard.prepare', arguments=dict(standard_id='theirs', volume_m3=1e-4, + components=[dict(source_id='nitrate_stock', volume_m3=1e-7)]), request_id='b5') + self.assertEqual(r['status'], 'succeeded') + g.call(g.A, 'sampler.unload', rack='S', position=1) + r = B.invoke(instance_id=INST, capability_id='sampler.load', arguments=dict(rack='S', position=1, item_id='theirs', volume_m3=1e-5), request_id='b6') + self.assertEqual(r['status'], 'succeeded') + + def test_idempotent_request_ids(self): + g = Rig() + g.kits('wash_water') + args = dict(rack='A', position=3, item_id='wash_water', volume_m3=5e-6) + r1 = g.A.invoke(instance_id=INST, capability_id='sampler.load', arguments=args, request_id='same') + snap = g.h.read('evaluator') + r2 = g.A.invoke(instance_id=INST, capability_id='sampler.load', arguments=args, request_id='same') + self.assertEqual(r1, r2) + self.assertEqual(snap, g.h.read('evaluator')) + r3 = g.A.invoke(instance_id=INST, capability_id='sampler.load', arguments=dict(args, position=4), request_id='same') + self.assertEqual(r3['error']['code'], 'REQUEST_CONFLICT') + r4 = g.A.invoke(instance_id=INST, capability_id='sampler.load', arguments=args, request_id='other') + self.assertEqual(r4['error']['code'], 'POSITION_OCCUPIED') + + def test_two_instances_isolated(self): + a, b = Rig(instance='aa500_a'), Rig(instance='aa500_b', room=300.15) + a.call(a.A, 'power.set', on=True) + self.assertFalse(b.read('power.on')) + with self.assertRaises(rt.ActionRejected): + a.A.read(instance_id='aa500_b') + r = a.A.invoke(instance_id='aa500_b', capability_id='power.set', arguments=dict(on=True), request_id='z') + self.assertEqual(r['error']['code'], 'UNKNOWN_INSTANCE') + + def test_step_partition_independence(self): + def run(steps): + g = Rig(seed=5) + g.kits() + g.reagents() + g.call(g.A, 'power.set', on=True) + g.call(g.A, 'system.startup') + for s in steps: + g.step(s) + r = g.read() + return r['detector.absorbance'], r['baths.temperature_k'], r['system.state'], r['truth.streams']['ch1']['equivalent_mol_m3'] + total = 1500.0 + a = run([total]) + b = run([7.0, 53.0, 1000.0, 0.5, 439.5]) + c = run([total / 30.0] * 30) + d = run([0.05] * 2000 + [1400.0]) # the scene advances the runtime in 0.05 s environment steps + e = run([0.37, 13.11, 486.52, 1000.0]) + self.assertEqual(a, b) + self.assertEqual(a, c) + self.assertEqual(a, d) + self.assertEqual(a, e) + + def test_rejections_change_nothing(self): + g = Rig() + r = rt.SealAa500Runtime('fresh') + r.register_principal('e', 'evaluator') + out = r.session('e').invoke(instance_id='fresh', capability_id='power.set', arguments=dict(on=True), request_id='p') + self.assertEqual(out['error']['code'], 'PLANT_REQUIRED') + g.call(g.E, 'plant.configure', expect='SEED_FIXED', room_k=295.15, mains_voltage_v=230.0, noise_seed=2) + g.call(g.A, 'system.startup', expect='POWER_OFF') + g.call(g.A, 'sampler.move', expect='POWER_OFF', target='wash') + g.kits('wash_water', 'reagents_nitrate_nitrite') + g.kits('nitrate_stock', volume=1e-6) + g.call(g.A, 'standard.prepare', expect='VOLUME_OUT_OF_RANGE', standard_id='s', volume_m3=1e-5, components=[dict(source_id='wash_water', volume_m3=2e-5)]) + g.call(g.A, 'standard.prepare', expect='UNKNOWN_ITEM', standard_id='s', volume_m3=1e-4, components=[dict(source_id='nope', volume_m3=1e-5)]) + g.call(g.A, 'standard.prepare', expect='INSUFFICIENT_VOLUME', standard_id='s', volume_m3=1e-4, components=[dict(source_id='nitrate_stock', volume_m3=2e-6)]) + g.call(g.A, 'sampler.load', expect='UNKNOWN_ITEM', rack='A', position=1, item_id='nitrate_nitrite:colour_reagent', volume_m3=1e-6) + g.call(g.A, 'sampler.load', expect='INVALID_ARGUMENT', rack='S', position=30, item_id='wash_water', volume_m3=1e-6) + g.call(g.A, 'sampler.load', rack='S', position=1, item_id='wash_water', volume_m3=1e-6) + g.call(g.A, 'sampler.load', expect='POSITION_OCCUPIED', rack='S', position=1, item_id='wash_water', volume_m3=1e-6) + g.call(g.A, 'sampler.unload', expect='POSITION_EMPTY', rack='S', position=2) + g.call(g.A, 'reagent.load', expect='WRONG_REAGENT', channel='ch2', reagent='colour_reagent', volume_m3=1e-4) + g.call(g.A, 'reagent.load', expect='UNKNOWN_ITEM', channel='ch2', reagent='complexing_reagent', volume_m3=1e-4) + g.call(g.A, 'reagent.load', expect='BOTTLE_FULL', channel='ch1', reagent='colour_reagent', volume_m3=1e-3) + g.call(g.A, 'cadmium.activate', expect='NO_CADMIUM', channel='ch3') + g.call(g.A, 'cadmium.activate', expect='UNKNOWN_ITEM', channel='ch1') + g.call(g.A, 'pumptube.install', expect='UNKNOWN_METHOD', channel='ch1', method_id='nope') + g.call(g.A, 'pumptube.install', expect='METHOD_NOT_SUPPORTED', channel='ch1', method_id='MT508_A085_chloride') + g.call(g.A, 'pumptube.install', expect='WRONG_MANIFOLD', channel='ch1', method_id='MT507_A026_nitrate_nitrite') + g.call(g.A, 'pumptube.install', expect='PUMP_LID_CLOSED', channel='ch1', method_id='MT508_A047_nitrite') + g.call(g.A, 'led.install', expect='COVER_CLOSED', channel='ch1', wavelength_m=660e-9) + g.call(g.A, 'power.set', on=True) + g.call(g.A, 'platen.set', engaged=True) + g.call(g.A, 'pump.lid_set', expect='PLATEN_ENGAGED', open=True) + g.call(g.A, 'channel.configure', expect='TUBES_MISMATCH', channel='ch1', method_id='MT508_A047_nitrite') + g.call(g.A, 'run.start', expect='PUMP_NOT_FLOWING', cups=[dict(rack='S', position=1, type='baseline')], sample_s=40.0, wash_s=20.0) + g.call(g.A, 'lamp.set', channel='ch1', on=True) + g.call(g.A, 'cover.set', expect='LAMP_ON', channel='ch1', open=True) + g.call(g.A, 'run.stop', expect='NO_RUN') + g.call(g.A, 'data.recalculate', expect='NO_RUN', fit='auto', carryover_correction=True, drift_correction=True) + g.call(g.E, 'fault.inject', expect='INVALID_ARGUMENT', fault='bath_failure', active=True, channel='ch1') + g.call(g.E, 'fault.inject', expect='INVALID_ARGUMENT', fault='led_failure', active=True) + g.call(g.E, 'fault.inject', expect='NO_CADMIUM', fault='cadmium_air', active=True, channel='ch2') + g.call(g.E, 'plant.configure', room_k=295.15, mains_voltage_v=180.0, noise_seed=1) + self.assertFalse(g.read('power.on')) + g.call(g.A, 'power.set', expect='MAINS_OUT_OF_RANGE', on=True) + g.call(g.A, 'power.press_switch', expect='MAINS_OUT_OF_RANGE') + + +class Physics(unittest.TestCase): + def test_epa_stock_recipes_and_nominal_labels(self): + for kit, (sid, species, mass) in rt.STOCKS.items(): + e = rt.substances()[sid] + true = mass * e['element_mass_fraction'] + self.assertAlmostEqual(true / rt.STOCK_NOMINAL[kit], 1.0, delta=1.5e-3, msg=kit) + g = Rig() + g.kits('nitrate_stock', 'wash_water') + out = g.call(g.A, 'standard.prepare', standard_id='n1', volume_m3=1e-4, components=[dict(source_id='nitrate_stock', volume_m3=1e-7), + dict(source_id='wash_water', volume_m3=9.99e-5)]) + self.assertAlmostEqual(out['nominal_kg_m3']['ch1'], 0.001, places=12) + self.assertAlmostEqual(g.read('truth.items')['n1']['composition']['nitrate_n'], 0.001, delta=2e-6) + + def test_manifold_design_rule_and_epa366_silicate_flows(self): + for c, m in rt.DEFAULT_METHOD.items(): + tb = rt.design_manifold(m, 0.010) + eps = rt.methods()[m]['chemistry']['molar_absorptivity_m2_mol'] + a_top = eps * 0.010 * rt.method_range(m)['high_mol'] * tb['sample_fraction'] + self.assertTrue(0.5 < a_top < 1.2, (c, a_top)) + tb = rt.design_manifold('MT508_A030_silicate', 0.010) + q = {k: v * 6e7 for k, v in tb['reagents_m3_s'].items()} + self.assertAlmostEqual(q['molybdate'], 0.41, places=9) + self.assertAlmostEqual(q['oxalic_acid'], 0.32, places=9) + self.assertAlmostEqual(tb['air_m3_s'] * 6e7, 0.25, places=9) + # the 50 mm cell for the low range: the design picks a smaller sample fraction for the same top absorbance + self.assertLess(rt.design_manifold('MT508_A029_phosphate', 0.050)['sample_fraction'], rt.design_manifold('MT508_A029_phosphate', 0.010)['sample_fraction']) + + def test_startup_platen_baths_and_shutdown(self): + g = Rig() + g.kits() + g.reagents() + g.call(g.A, 'power.set', on=True) + g.call(g.A, 'system.startup') + self.assertEqual(g.read('pump.platen_position_m'), 0.0) + self.assertEqual(g.read('pump.rotor_velocity_rad_s'), 0.0) + g.step(4.0) + self.assertAlmostEqual(g.read('pump.platen_position_m'), 0.004, places=9) + g.step(1.0) + self.assertAlmostEqual(g.read('pump.rotor_velocity_rad_s'), 2 * math.pi * 10 / 60, places=9) + self.assertEqual(g.read('system.state'), 'starting') + g.step(590.0) + self.assertEqual(g.read('channels.status')['ch1']['valve'], 'wash') + g.step(10.0) + self.assertEqual(g.read('channels.status')['ch1']['valve'], 'reagent') + t = None + for _ in range(60): + g.step(60.0) + if g.read('system.state') == 'ready': + t = g.h.t + break + self.assertTrue(t is not None and 1200.0 <= t <= 2700.0, t) + self.assertTrue(all(abs(v - 310.15) <= 0.5 for v in g.read('baths.temperature_k').values())) + st = g.read('channels.status') + self.assertTrue(all(s['led_warm'] for s in st.values())) + g.call(g.A, 'system.shutdown') + self.assertEqual(g.read('pump.speed'), 'fast') + g.step(899.0) + self.assertEqual(g.read('system.state'), 'shutting_down') + g.step(10.0) + r = g.read() + self.assertEqual(r['system.state'], 'idle') + self.assertFalse(r['pump.running']) + self.assertFalse(r['pump.platen_engaged']) + self.assertFalse(any(s['led_on'] for s in r['channels.status'].values())) + g.step(10.0) + self.assertEqual(g.read('pump.platen_position_m'), 0.0) + g.call(g.A, 'pump.lid_set', open=True) + self.assertAlmostEqual(g.read('pump.lid_angle_rad'), 1.2) + g.call(g.A, 'system.startup', expect='PUMP_LID_OPEN') + + def test_transport_delay_and_steady_state_peak(self): + g, cal = ready_rig() + g.call(g.A, 'sampler.move', target='position', rack='S', position=6, probe_down=True) + t0 = g.h.t + fl = g.h._flows('ch3') + delay = g.h._delay_s(fl) + self.assertTrue(40.0 < delay < 200.0, delay) + base = g.read('detector.absorbance')['ch3'] + g.step(delay - 10.0) + self.assertLess(g.read('detector.absorbance')['ch3'] - base, 0.01) + g.step(120.0) + a = g.read('detector.absorbance')['ch3'] + g.step(60.0) + b = g.read('detector.absorbance')['ch3'] + self.assertGreater(a - base, 0.5) + self.assertAlmostEqual(a, b, delta=0.01) + tr = g.call(g.E, 'truth.inspect')['state']['streams']['ch3'] + eq = 0.008 / (rt.MW['P'] * 1e-3) * fl['fraction'] + self.assertAlmostEqual(tr['equivalent_mol_m3'] / eq, 1.0, delta=0.04) + self.assertGreater(g.h.t, t0) + # probe position mirrors + x, y = rt.rack_position_xy('S', 6) + self.assertAlmostEqual(g.read('sampler.probe_x_m'), x) + self.assertAlmostEqual(g.read('sampler.probe_y_m'), y) + self.assertAlmostEqual(g.read('sampler.probe_z_m'), rt.PROBE_TRAVEL_Z) + g.call(g.A, 'sampler.unload', expect='PROBE_IN_TUBE', rack='S', position=6) + g.call(g.A, 'sampler.move', target='home') + g.step(5.0) + self.assertEqual((g.read('sampler.probe_x_m'), g.read('sampler.probe_z_m')), (0.0, 0.0)) + + def test_calibration_and_mixed_sample_recovery(self): + g, cal = ready_rig(seed=3) + s = g.sample('river', 1, nitrate_n=0.0012, nitrite_n=0.0001, ammonium_n=0.0015, phosphate_p=0.002, silicate_si=0.012) + res = g.run([g.wash_cup()] + cal + [s, dict(rack='S', position=4, type='drift'), g.wash_cup()]) + for c, v in res['calibration'].items(): + self.assertEqual(v['order'], 1, c) + self.assertGreater(v['r2'], 0.999, c) + truth = dict(ch1=0.0013 * 0.99, ch2=0.0015, ch3=0.002, ch4=0.012) + for c, tv in truth.items(): + found = g.conc(res, 8, c)['concentration_kg_m3'] + self.assertAlmostEqual(found / tv, 1.0, delta=0.05, msg=c) # single injection, RSD about 1 % (EPA 366.0) + self.assertEqual(res['state'], 'completed') + led = g.call(g.E, 'ledger.read')['ledger'] + q_s = sum(g.h._flows(c)['sample'] for c in rt.CHANNELS) + self.assertAlmostEqual(led['sample_used_m3'] / (q_s * 60.0 * 10), 1.0, delta=0.05) + self.assertGreater(led['nitrate_reduced_mol'], 0.0) + + def test_repeatability_and_detection_limit(self): + g, cal = ready_rig(seed=11) + mid = [dict(rack='S', position=4, type='sample') for _ in range(7)] + blanks = [dict(rack='S', position=1, type='sample') for _ in range(7)] + res = g.run([g.wash_cup()] + cal + mid + blanks + [g.wash_cup()], sample_s=40.0, wash_s=20.0) + for c in rt.CHANNELS: + v = [g.conc(res, 8 + i, c)['concentration_kg_m3'] for i in range(7)] + m = sum(v) / 7 + sd = math.sqrt(sum((x - m) ** 2 for x in v) / 6) + self.assertLess(sd / m, 0.02, c) + self.assertGreater(sd / m, 0.0005, c) + b = [g.conc(res, 15 + i, c)['concentration_kg_m3'] for i in range(7)] + mb = sum(b) / 7 + mdl = 3.14 * math.sqrt(sum((x - mb) ** 2 for x in b) / 6) + self.assertLess(mdl, 0.03 * rt.method_range(rt.DEFAULT_METHOD[c])['high_mol'] * {'ch4': 0.028, 'ch3': 0.031}.get(c, 0.014), c) + PROCESS_EVIDENCE.setdefault('repeatability', []).append(dict(note='7 replicate mid standards, 7 blanks')) + + def test_carryover_grows_with_shorter_wash_and_throughput_limit(self): + def k_of(sample_s, wash_s): + g, _ = ready_rig(seed=4) + hi = dict(rack='S', position=6, type='carryover_high') + lo = dict(rack='S', position=1, type='carryover_low') + res = g.run([g.wash_cup()] + [hi, lo, dict(lo)] + [g.wash_cup()], sample_s=sample_s, wash_s=wash_s) + g.call(g.A, 'run.start', expect='RATE_TOO_HIGH', cups=[lo], sample_s=20.0, wash_s=5.0) + return res, g + res, g = k_of(60.0, 30.0) + self.assertEqual(res['calibration'], {}) + k_long = g.h._corrected(g.h.last_run)['ch3']['carryover'] + _, g2 = k_of(25.0, 7.0) + k_short = g2.h._corrected(g2.h.last_run)['ch3']['carryover'] + self.assertLess(k_long, 0.02) + self.assertGreater(k_short, k_long) + self.assertGreater(k_short, 0.005) + + def test_auto_dilution_and_over_range(self): + g, cal = ready_rig(seed=6) + s = g.sample('hot', 1, nitrate_n=0.010, ammonium_n=0.002, phosphate_p=0.003, silicate_si=0.010) + res = g.run([g.wash_cup()] + cal + [s, g.wash_cup()], auto_dilute=True, dilution_factor=10.0) + rows = [r for r in res['results'] if r['rack'] == 'A'] + orig = next(r for r in rows if r['channel'] == 'ch1' and 'AUTO_DILUTED' not in r['flags']) + redo = next(r for r in rows if r['channel'] == 'ch1' and 'AUTO_DILUTED' in r['flags']) + self.assertIn('OVER_RANGE', orig['flags']) + self.assertEqual(redo['dilution'], 10.0) + self.assertAlmostEqual(redo['concentration_kg_m3'] / (0.010 * 0.99), 1.0, delta=0.05) + codes = [e['code'] for e in g.call(g.A, 'events.read', since_s=0.0)['events']] + self.assertIn('AUTO_DILUTION', codes) + + def test_quadratic_fit_above_threshold_and_recalculate(self): + g = Rig(seed=8) + g.ready() + g.call(g.A, 'run.start', expect='POSITION_EMPTY', cups=[dict(rack='S', position=1, type='baseline')], sample_s=40.0, wash_s=20.0) + tops = dict(TOPS, phosphate_stock=0.016) # twice the range: the top calibrants pass 1.2 AU (Beer-Lambert stays linear here) + cal = g.standards(tops=tops) + res = g.run([g.wash_cup()] + cal + [g.wash_cup()]) + self.assertEqual(res['calibration']['ch3']['order'], 2) + lin = g.call(g.A, 'data.recalculate', fit='linear', carryover_correction=True, drift_correction=True) + self.assertEqual(lin['calibration']['ch3']['order'], 1) + self.assertEqual(g.call(g.A, 'data.results')['calibration']['ch3']['order'], 1) + + def test_drift_correction(self): + g = Rig(seed=9) + g.ready() + cal = g.standards() + g.call(g.E, 'fault.inject', fault='pump_tube_worn', active=True, channel='ch2') + g.call(g.E, 'fault.inject', fault='pump_tube_worn', active=False, channel='ch2') + s = g.sample('w', 1, ammonium_n=0.003) + drift = dict(rack='S', position=4, type='drift') + # sensitivity drops after the calibration (sample tube wear): drift standards before and after the sample correct it + cups = [g.wash_cup()] + cal + [drift, s, drift, g.wash_cup()] + g.call(g.A, 'run.start', cups=cups, sample_s=60.0, wash_s=30.0) + while g.h.run['index'] < 8: # the sampler is about to take the sample cup + g.step(1.0) + g.call(g.E, 'fault.inject', fault='pump_tube_worn', active=True, channel='ch2') + while g.read('run.status')['state'] in ('running', 'draining'): + g.step(60.0) + on = g.conc(g.call(g.A, 'data.results'), 9, 'ch2')['concentration_kg_m3'] + off = g.call(g.A, 'data.recalculate', fit='auto', carryover_correction=True, drift_correction=False) + off = g.conc(g.call(g.A, 'data.results'), 9, 'ch2')['concentration_kg_m3'] + self.assertLess(abs(on / 0.003 - 1.0), abs(off / 0.003 - 1.0)) + self.assertLess(off / 0.003, 0.95) + + def test_cadmium_efficiency_check_air_and_activation(self): + def eff(prep=None): + g = Rig(seed=12) + g.ready() + if prep: + prep(g) + g.call(g.A, 'standard.prepare', standard_id='no2', volume_m3=1e-4, components=[dict(source_id='nitrite_stock', volume_m3=2e-7), + dict(source_id='wash_water', volume_m3=9.98e-5)]) + g.call(g.A, 'standard.prepare', standard_id='no3', volume_m3=1e-4, components=[dict(source_id='nitrate_stock', volume_m3=2e-7), + dict(source_id='wash_water', volume_m3=9.98e-5)]) + g.call(g.A, 'sampler.load', rack='S', position=1, item_id='no2', volume_m3=1e-5) + g.call(g.A, 'sampler.load', rack='S', position=2, item_id='no3', volume_m3=1e-5) + res = g.run([g.wash_cup(), dict(rack='S', position=1, type='nitrite_check'), dict(rack='S', position=2, type='nitrate_check'), g.wash_cup()]) + return g.h.last_run['calibration'] if g.h.last_run.get('calibration') else None, g, res + _, g, _ = eff() + e0 = g.h._corrected(g.h.last_run)['ch1']['peaks'] + r0 = e0[2] / e0[1] + self.assertAlmostEqual(r0, 0.99, delta=0.04) + self.assertNotIn('CADMIUM_EFFICIENCY_LOW', g.read('warnings.active')) + + def air(g): + g.call(g.E, 'fault.inject', fault='cadmium_air', active=True, channel='ch1') + g.step(300.0) + _, g2, _ = eff(air) + e1 = g2.h._corrected(g2.h.last_run)['ch1']['peaks'] + self.assertLess(e1[2] / e1[1], 0.8) + g2.call(g2.A, 'cadmium.activate', expect='REAGENTS_FLOWING', channel='ch1') + g2.call(g2.A, 'valve.set', channel='ch1', position='wash') + g2.call(g2.A, 'cadmium.activate', channel='ch1') + self.assertAlmostEqual(g2.h.ch['ch1']['cd_eff'], 0.99, delta=0.01) + self.assertNotIn('cadmium_air:ch1', g2.read('truth.faults')) + + def test_cadmium_efficiency_low_warning_from_results(self): + g = Rig(seed=13) + g.ready() + g.h.ch['ch1']['cd_eff'] = 0.6 # an exhausted coil (test set-up) + for sid, kit in (('no2', 'nitrite_stock'), ('no3', 'nitrate_stock')): + g.call(g.A, 'standard.prepare', standard_id=sid, volume_m3=1e-4, components=[dict(source_id=kit, volume_m3=2e-7)]) + g.call(g.A, 'sampler.load', rack='S', position=1, item_id='no2', volume_m3=1e-5) + g.call(g.A, 'sampler.load', rack='S', position=2, item_id='no3', volume_m3=1e-5) + res = g.run([g.wash_cup(), dict(rack='S', position=1, type='nitrite_check'), dict(rack='S', position=2, type='nitrate_check'), g.wash_cup()]) + self.assertIn('CADMIUM_EFFICIENCY_LOW', g.read('warnings.active')) + self.assertIsNotNone(res) + + def test_chlorine_poisons_cadmium(self): + g = Rig(seed=14) + g.ready() + s = g.sample('cl', 1, nitrate_n=0.001, chlorine=0.05) + e0 = g.h.ch['ch1']['cd_eff'] + g.run([g.wash_cup(), s, g.wash_cup()]) + self.assertLess(g.h.ch['ch1']['cd_eff'], e0 - 0.02) + + def test_phosphate_interferences_arsenate_and_iron(self): + g, cal = ready_rig(seed=15) + s0 = g.sample('p', 1, phosphate_p=0.002) + s1 = g.sample('pas', 2, phosphate_p=0.002, arsenate_as=0.004) + s2 = g.sample('pfe', 3, phosphate_p=0.002, iron=0.02) + s3 = g.sample('psal', 4, phosphate_p=0.002, salinity=35.0) + res = g.run([g.wash_cup()] + cal + [s0, s1, s2, s3, g.wash_cup()]) + p0, p1, p2, p3 = (g.conc(res, 8 + i, 'ch3')['concentration_kg_m3'] for i in range(4)) + self.assertAlmostEqual(p0 / 0.002, 1.0, delta=0.05) + self.assertAlmostEqual((p1 - p0) / (0.004 / rt.MW['As'] * rt.MW['P']), 1.0, delta=0.1) # equimolar arsenate response + self.assertLess(p2, 0.8 * p0) + self.assertGreater(p3, p0 + 0.00003) # refractive-index blank adds + + def test_bath_temperature_controls_colour(self): + g = Rig(seed=16) + g.ready() + hot = g.h.ch['ch2']['phi'] + g.call(g.A, 'bath.set', channel='ch2', temperature_k=None) + g.step(3600.0) + self.assertLess(g.h.ch['ch2']['bath_T'], 296.0) + self.assertLess(g.h.ch['ch2']['phi'], hot * 0.9) + g.call(g.A, 'bath.set', channel='ch2', temperature_k=310.15) + g.call(g.E, 'fault.inject', fault='bath_failure', active=True, channel='ch2') + g.step(3600.0) + self.assertGreater(g.read('baths.temperature_k')['ch2'], 314.0) + + def test_led_wavelength_and_flowcell_path(self): + def peak(setup): + g = Rig(seed=17) + g.kits() + g.reagents() + g.call(g.A, 'power.set', on=True) + setup(g) + g.call(g.A, 'system.startup') + for _ in range(60): + g.step(60.0) + if g.read('system.state') == 'ready': + break + cal = g.standards(levels=[0.0, 0.25]) + g.call(g.A, 'sampler.move', target='position', rack='S', position=2, probe_down=True) + base = g.read('detector.absorbance')['ch3'] + g.step(300.0) + return g.read('detector.absorbance')['ch3'] - base + + def swap(wl=None, cell=None): + def f(g): + g.call(g.A, 'cover.set', channel='ch3', open=True) + self.assertAlmostEqual(g.read('cover.ch3_angle_rad'), 1.3) + g.call(g.A, 'lamp.set', expect='COVER_OPEN', channel='ch3', on=True) + if wl: + g.call(g.A, 'led.install', channel='ch3', wavelength_m=wl) + if cell: + g.call(g.A, 'flowcell.install', channel='ch3', path_m=cell) + g.call(g.A, 'cover.set', channel='ch3', open=False) + return f + ref = peak(lambda g: None) + wrong = peak(swap(wl=540e-9)) + long = peak(swap(cell=0.030)) + self.assertLess(wrong, 0.1 * ref) + self.assertAlmostEqual(long / ref, 3.0, delta=0.15) + + def test_pumptube_change_method_and_configure(self): + g = Rig(seed=18) + g.call(g.A, 'pump.lid_set', open=True) + out = g.call(g.A, 'pumptube.install', channel='ch1', method_id='MT508_A047_nitrite') + self.assertGreater(out['sample_fraction'], 0.0) + g.call(g.A, 'power.set', on=True) + g.call(g.A, 'channel.configure', channel='ch1', method_id='MT508_A047_nitrite') + st = g.read('channels.status')['ch1'] + self.assertEqual((st['chemistry'], st['seal_method']), ('nitrite', 'A047')) + self.assertAlmostEqual(st['range_kg_m3'][1], 0.0008) + self.assertEqual(st['result_basis'], 'N') + self.assertEqual(g.read('channels.status')['ch4']['range_basis'], 'SiO2') + g.call(g.A, 'platen.set', expect='PUMP_LID_OPEN', engaged=True) + g.call(g.A, 'pump.set', expect='PUMP_LID_OPEN', running=True) + g.call(g.A, 'pump.lid_set', open=False) + g.call(g.A, 'platen.set', engaged=True) + g.call(g.A, 'pump.set', running=True, speed='normal') + g.step(5.0) + g.call(g.A, 'flowcell.install', expect='COVER_CLOSED', channel='ch2', path_m=0.05) + g.call(g.A, 'cover.set', channel='ch2', open=True) + g.call(g.A, 'flowcell.install', expect='PUMP_RUNNING', channel='ch2', path_m=0.05) + g.call(g.A, 'pump.set', running=False) + g.call(g.A, 'flowcell.install', channel='ch2', path_m=0.05) + g.call(g.A, 'lamp.set', channel='ch2', on=False) + g.call(g.A, 'cover.set', channel='ch2', open=False) + self.assertEqual(g.read('cover.ch2_angle_rad'), 0.0) + + def test_faults_reagent_empty_leak_probe_led(self): + g, cal = ready_rig(seed=19) + a0 = g.read('detector.absorbance')['ch2'] + g.call(g.E, 'fault.inject', fault='reagent_empty', active=True, channel='ch2') + g.step(400.0) + self.assertLess(g.read('detector.absorbance')['ch2'], a0 - 0.02) # reagent blank disappears + g.call(g.E, 'fault.inject', fault='reagent_empty', active=False, channel='ch2') + g.call(g.E, 'fault.inject', fault='led_failure', active=True, channel='ch4') + g.step(1.0) + self.assertIsNone(g.read('detector.absorbance')['ch4']) + g.call(g.E, 'fault.inject', fault='led_failure', active=False, channel='ch4') + g.call(g.E, 'fault.inject', fault='probe_blocked', active=True) + g.call(g.A, 'sampler.move', target='position', rack='S', position=6, probe_down=True) + b0 = g.read('detector.absorbance')['ch3'] + g.step(300.0) + self.assertLess(abs(g.read('detector.absorbance')['ch3'] - b0), 0.03) + g.call(g.E, 'fault.inject', fault='probe_blocked', active=False) + g.call(g.E, 'fault.inject', fault='leak', active=True) + g.step(1.0) + self.assertIn('LEAK', g.read('warnings.active')) + self.assertFalse(g.read('pump.running')) + self.assertEqual(g.read('pump.rotor_velocity_rad_s'), 0.0) + g.call(g.A, 'pump.set', expect='LEAK_DETECTED', running=True) + + def test_reagent_consumption_and_low_warning(self): + g = Rig(seed=20) + g.kits() + g.reagents(volume=5e-6) + g.call(g.A, 'power.set', on=True) + g.call(g.A, 'system.startup') + g.step(1500.0) + lv = g.read('reagents.levels_m3')['ch1'] + self.assertTrue(any(v < 1e-6 for v in lv.values())) + self.assertIn('REAGENT_LOW_ch1', g.read('warnings.active')) + led = g.call(g.E, 'ledger.read')['ledger'] + self.assertAlmostEqual(led['reagent_used_m3'], 5e-6 * sum(len(ch['reagents']) for ch in g.h.ch.values()) - sum(sum(v.values()) for v in g.read('reagents.levels_m3').values()), + delta=1e-12) + + def test_power_cut_during_run_keeps_completed_cups(self): + g, cal = ready_rig(seed=21) + g.call(g.A, 'run.start', cups=[g.wash_cup()] + cal, sample_s=60.0, wash_s=30.0) + while g.read('run.status')['completed'] < 3: + g.step(30.0) + g.call(g.A, 'power.press_switch') + r = g.read('run.status') + self.assertEqual(r['state'], 'stopped') + self.assertGreaterEqual(r['completed'], 3) + self.assertEqual(g.read('system.state'), 'off') + res = g.call(g.A, 'data.results') + self.assertEqual(res['state'], 'stopped') + self.assertEqual(len({x['cup'] for x in res['results']}), r['completed']) # R1-03: completed cups keep their results + self.assertFalse(g.read('pump.running')) # R1-04: the pump motor stops with the power + g.call(g.A, 'power.press_switch') + self.assertTrue(g.read('lamp.power')) + self.assertFalse(g.read('pump.running')) + + def test_run_stop_and_raw_trace_bubbles(self): + g, cal = ready_rig(seed=22) + g.call(g.A, 'run.start', cups=[g.wash_cup()] + cal, sample_s=60.0, wash_s=30.0) + g.call(g.A, 'sampler.move', expect='RUN_ACTIVE', target='home') + g.call(g.A, 'sampler.unload', expect='RUN_ACTIVE', rack='S', position=6) + g.call(g.A, 'system.startup', expect='BUSY') + g.step(600.0) + out = g.call(g.A, 'run.stop') + self.assertEqual(out['state'], 'stopped') + deb = g.call(g.A, 'data.read_trace', channel='ch3', kind='debubbled', max_points=500) + raw = g.call(g.A, 'data.read_trace', channel='ch3', kind='raw', max_points=500) + self.assertEqual(len(deb['time_s']), 500) + spikes = sum(1 for a, b in zip(deb['absorbance'], raw['absorbance']) if b - a > 0.5) + self.assertGreater(spikes, 20) + self.assertLess(max(deb['absorbance']), 1.0) + + def test_led_warmup_drift_settles(self): + g = Rig(seed=23) + g.kits() + g.reagents() + g.call(g.A, 'power.set', on=True) + g.call(g.A, 'system.startup') + g.step(10.0) + early = g.h.ch['ch1']['A_meas'] - g.h.ch['ch1']['A_true'] + g.step(1800.0) + late = g.h.ch['ch1']['A_meas'] - g.h.ch['ch1']['A_true'] - g.h.ch['ch1']['drift'] + self.assertGreater(early, 5e-4) + self.assertLess(abs(late), 1e-3) + + def test_events_provenance_ledger(self): + g, cal = ready_rig(seed=24) + res = g.run([g.wash_cup()] + cal[:2] + [g.wash_cup()], sample_s=40.0, wash_s=20.0) + codes = [e['code'] for e in g.call(g.A, 'events.read', since_s=0.0)['events']] + for c in ('POWER_ON', 'STARTUP', 'REAGENTS_ON', 'READY', 'RUN_START', 'RUN_COMPLETED'): + self.assertIn(c, codes) + prov = g.call(g.A, 'provenance.read') + self.assertEqual({x['name'] for x in prov['libraries']}, {'methods', 'substances', 'instrument'}) + self.assertGreaterEqual(len(prov['methods']), 70) + led = g.call(g.E, 'ledger.read')['ledger'] + self.assertGreater(led['waste_m3'], led['sample_used_m3'] + led['reagent_used_m3'] - 1e-12) + out = g.call(g.A, 'sampler.unload', rack='S', position=1) + self.assertGreater(out['removed_m3'], 0.0) + self.assertEqual(res['run_id'], 'run001') + + +class ReviewRound1(unittest.TestCase): + def test_mains_drop_during_run_declared_effects(self): # R1-02 + g, cal = ready_rig(seed=31) + g.call(g.A, 'run.start', cups=[g.wash_cup()] + cal[:2], sample_s=40.0, wash_s=20.0) + g.step(30.0) + g.call(g.E, 'plant.configure', room_k=295.15, mains_voltage_v=150.0, noise_seed=31) + self.assertEqual(g.read('run.status')['state'], 'stopped') + self.assertEqual(g.read('pump.rotor_velocity_rad_s'), 0.0) + + def test_run_stop_sets_cadmium_warning_declared(self): # R1-07 + g = Rig(seed=32) + g.ready() + g.h.ch['ch1']['cd_eff'] = 0.6 + for sid, kit in (('no2', 'nitrite_stock'), ('no3', 'nitrate_stock')): + g.call(g.A, 'standard.prepare', standard_id=sid, volume_m3=1e-4, components=[dict(source_id=kit, volume_m3=2e-7)]) + g.call(g.A, 'sampler.load', rack='S', position=1, item_id='no2', volume_m3=1e-5) + g.call(g.A, 'sampler.load', rack='S', position=2, item_id='no3', volume_m3=1e-5) + g.call(g.A, 'run.start', cups=[g.wash_cup(), dict(rack='S', position=1, type='nitrite_check'), dict(rack='S', position=2, type='nitrate_check'), g.wash_cup()], + sample_s=40.0, wash_s=20.0) + while g.read('run.status')['completed'] < 3: + g.step(30.0) + g.call(g.A, 'run.stop') + self.assertIn('CADMIUM_EFFICIENCY_LOW', g.read('warnings.active')) + + def test_detector_saturates_and_flags(self): # R1-13 + g, cal = ready_rig(seed=33) + s = g.sample('conc', 1, nitrate_n=0.5, ammonium_n=0.5, phosphate_p=0.5, silicate_si=0.5) + g.call(g.A, 'sampler.move', target='position', rack='A', position=1, probe_down=True) + g.step(300.0) + self.assertTrue(all(v <= rt.ENG['detector_full_scale_au'] + 1e-12 for v in g.read('detector.absorbance').values())) + g.call(g.A, 'sampler.move', target='home') + g.step(200.0) + res = g.run([g.wash_cup()] + cal + [s, g.wash_cup()]) + row = g.conc(res, 8, 'ch1') + self.assertIn('DETECTOR_SATURATED', row['flags']) + self.assertIsNone(row['concentration_kg_m3']) + + def test_missing_tube_and_short_sample_flags(self): # R1-05 + g, cal = ready_rig(seed=34) + s1 = g.sample('a', 1, phosphate_p=0.002) + s2 = g.sample('b', 2, volume=4e-7, phosphate_p=0.002) # 0.4 ml: the 0.7 ml/min sample lines run it dry during a 60 s sample + g.call(g.A, 'run.start', cups=[g.wash_cup()] + cal + [s1, s2, dict(rack='B', position=5, type='sample'), g.wash_cup()], expect='POSITION_EMPTY', + sample_s=60.0, wash_s=30.0) + res = g.run([g.wash_cup()] + cal + [s1, s2, g.wash_cup()]) + self.assertIn('SAMPLE_SHORT', g.conc(res, 9, 'ch3')['flags']) + g2, cal2 = ready_rig(seed=35) + s = g2.sample('a', 1, phosphate_p=0.002) + g2.call(g2.A, 'run.start', cups=[g2.wash_cup()] + cal2 + [s, g2.wash_cup()], sample_s=40.0, wash_s=20.0) + g2.call(g2.A, 'sampler.unload', expect='RUN_ACTIVE', rack='A', position=1) + g2.h.racks.pop(('A', 1)) # a tube taken away by hand (test set-up) + while g2.read('run.status')['state'] in ('running', 'draining'): + g2.step(60.0) + self.assertIn('NO_TUBE', g2.conc(g2.call(g2.A, 'data.results'), 8, 'ch3')['flags']) + + def test_liquid_ledger_closes_with_probe_up(self): # R1-06 + g = Rig(seed=36) + g.ready() + led0 = g.call(g.E, 'ledger.read')['ledger'] + g.call(g.A, 'sampler.move', target='home') + g.step(600.0) + led1 = g.call(g.E, 'ledger.read')['ledger'] + d = {k: led1[k] - led0[k] for k in led0} + self.assertAlmostEqual(d['waste_m3'], d['wash_used_m3'] + d['reagent_used_m3'] + d['sample_used_m3'], delta=1e-10) + + def test_epa366_cycle_is_60_per_hour(self): # R1-10 + g, cal = ready_rig(seed=37) + out = g.call(g.A, 'run.start', cups=[g.wash_cup()], sample_s=40.0, wash_s=20.0) + self.assertAlmostEqual(out['throughput_per_s'] * 3600.0, 60.0, places=9) + t0 = g.h.t + while g.read('run.status')['state'] in ('running', 'draining'): + g.step(0.5) + cups = g.h.last_run['cups'] + self.assertAlmostEqual(cups[0]['t_end'] - cups[0]['t_start'], 40.0, places=6) + + +class ReviewRound2(unittest.TestCase): + def test_clipped_calibrant_excluded_and_flagged(self): # R2-06 + g = Rig(seed=41) + g.ready() + tops = dict(TOPS, nitrate_stock=0.016) # 0 / 3.2 / ... / 16 mg N/l: the top calibrants clip at full scale + cal = g.standards(tops=tops, levels=[0.0, 0.25, 0.5, 0.75, 1.0]) + s = g.sample('mid', 1, nitrate_n=0.006) + res = g.run([g.wash_cup()] + cal + [s, g.wash_cup()], sample_s=40.0, wash_s=20.0) + flagged = [r for r in res['results'] if r['type'] == 'calibrant' and r['channel'] == 'ch1' and 'DETECTOR_SATURATED' in r['flags']] + self.assertGreaterEqual(len(flagged), 1) + self.assertLess(res['calibration']['ch1']['max_conc'], 0.0159) + row = g.conc(res, 7, 'ch1') + self.assertAlmostEqual(row['concentration_kg_m3'] / (0.006 * 0.99), 1.0, delta=0.06) + + def test_no_tube_row_has_no_concentration(self): # R2-07 + g, cal = ready_rig(seed=42) + s = g.sample('a', 1, phosphate_p=0.002) + g.call(g.A, 'run.start', cups=[g.wash_cup()] + cal + [s, g.wash_cup()], sample_s=40.0, wash_s=20.0) + g.h.racks.pop(('A', 1)) + while g.read('run.status')['state'] in ('running', 'draining'): + g.step(60.0) + row = g.conc(g.call(g.A, 'data.results'), 8, 'ch3') + self.assertIn('NO_TUBE', row['flags']) + self.assertIsNone(row['concentration_kg_m3']) + + +class ZCoverage(unittest.TestCase): + def test_all_capabilities_exercised(self): + implemented = {k for k in rt.CAPS if k not in rt.UNSUPPORTED} + missing = implemented - SEEN_CAPS + if len(SEEN_CAPS) > 5: + self.assertFalse(missing, sorted(missing)) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_asset_shimadzu_ags10knxd.py b/tests/test_asset_shimadzu_ags10knxd.py new file mode 100644 index 0000000000000000000000000000000000000000..097d476e1173b0e83977688312d9c05024608fdb --- /dev/null +++ b/tests/test_asset_shimadzu_ags10knxd.py @@ -0,0 +1,183 @@ +"""Observed-process / independent physical / protocol tests for CHEM-144 only.""" +import copy,hashlib,json,math,sys,unittest,subprocess +from pathlib import Path +import numpy as np +ROOT=Path(__file__).resolve().parents[1];sys.path.insert(0,str(ROOT)) +from scripts.asset_runtime.shimadzu_ags10knxd import * +PROCESS_EVIDENCE={};CHECKS=[] +def call(h,k,**a): + before=h.read('debug');v=h.invoke(k,**a);validate(CAPS[k]['output_schema'],v);after=h.read('debug') + delta={s for s in after if before[s]!=after[s]};declared=set(CAPS[k]['effects']) + if not delta<=declared:raise AssertionError(f'{k}: undeclared immediate effects {delta-declared}') + PROCESS_EVIDENCE.setdefault(k,[]).append(dict(time_s=h.time_s,phase=h.phase,result_keys=list(v),actual_call=True));return v + +def ready(instance='test',plant=None,sample=None,fixture=None,close=True): + h=ShimadzuAgs10knxdRuntime(instance) + call(h,'plant.configure',**dict(PLANT_EXAMPLE,**(plant or {})));call(h,'fixture.configure',**dict(FIXTURE_EXAMPLE,**(fixture or {})));call(h,'sample.load',**dict(SAMPLE_EXAMPLE,**(sample or {})));call(h,'power.set',enabled=True) + if close: + for side in ['upper','lower']:call(h,'grip.set_closed',which=side,closed=True) + h.step(.61);call(h,'force.zero');return h + +def start(h,**method):call(h,'method.configure',**dict(METHOD_EXAMPLE,**method));return call(h,'acquisition.start') +def analysis(h,**args):return call(h,'analysis.tensile',**dict(CAPS['analysis.tensile']['example_arguments'],rows=h.rows,**args)) +class AGSTest(unittest.TestCase): + def check(self,condition,key): + self.assertTrue(condition,key);CHECKS.append(dict(check_id=key,status='passed')) + def reject(self,h,k,code=None,**a): + before=copy.deepcopy(h.__dict__) + with self.assertRaises(ActionRejected) as ctx:h.invoke(k,**a) + if code:self.assertEqual(str(ctx.exception),code) + self.assertEqual(before,h.__dict__) + def balanced(self,h,tol=1e-8): + b=call(h,'ledger.read');self.check(abs(b['energy_residual_j'])0 for p in row['curves']['resistivity'])) + self.assertIsNone(r.reference_rho(lib['starry_40927'],299));self.assertAlmostEqual(r.reference_rho(lib['starry_40927'],300)[0],4.9076758e-4,12) + def test_06_center_green_matches_closed_form_and_historical_table(self): + for u,tab in [(4,2.9289),(5,3.3625),(7.5,3.9273),(10,4.1716),(15,4.3646),(20,4.4364),(40,4.5076)]: + actual=1/r.disk_transfer_coefficient(u*.001,.001,0,0);closed=math.pi/math.log(2*(u*u+3)/(u*u-3));self.assertAlmostEqual(actual,closed,12);self.assertLess(abs(actual-tab),5e-4) + self.assertAlmostEqual(1/r.disk_transfer_coefficient(1e5,.001,0,0),math.pi/math.log(2),12) + def test_07_insulating_circle_has_independent_zero_normal_flux(self): + R=.05;points=r.probe_points(.03,.005,.00127);a,b=points[0],points[-1];phi=lambda z:-(r.disk_kernel(z,a,R)-r.disk_kernel(z,b,R))/(2*math.pi);delta=R*1e-5 + for angle in np.linspace(0,2*math.pi,49)[:-1]: + unit=complex(math.cos(angle),math.sin(angle));derivative=(phi((R+delta)*unit)-phi((R-delta)*unit))/(2*delta);self.assertLess(abs(R*derivative),2e-9) + def test_08_green_reciprocity_for_off_center_contacts(self): + R=.05;p=r.probe_points(.031,.013,.00127) + def transfer(a,b,c,d):return -(r.disk_kernel(p[c],p[a],R)-r.disk_kernel(p[c],p[b],R)-r.disk_kernel(p[d],p[a],R)+r.disk_kernel(p[d],p[b],R))/(2*math.pi) + self.assertAlmostEqual(transfer(0,3,1,2),transfer(1,2,0,3),14);self.assertAlmostEqual(transfer(0,2,1,3),transfer(1,3,0,2),14) + def test_09_geometry_rotational_and_scale_invariance(self): + base=r.disk_transfer_coefficient(.1,.00127,.031,.008) + for angle in [.3,1.2,2.7]: + z=complex(.031,.008)*complex(math.cos(angle),math.sin(angle));self.assertAlmostEqual(r.disk_transfer_coefficient(.1,.00127,z.real,z.imag,orientation_rad=angle),base,13) + self.assertAlmostEqual(r.disk_transfer_coefficient(.2,.00254,.062,.016),base,13) + def test_10_external_near_edge_inverse_corrects_bias(self): + h=Checked();x=.046;rows=external_rows(250.,x=x);o=h.invoke('analysis.sheet_resistance',**dict(r.ANALYSIS_EXAMPLE,x_m=x,observations=rows));self.assertAlmostEqual(o['sheet_resistance_ohm_sq'],250.,10);naive=(rows[0]['voltage_v']-rows[1]['voltage_v'])/(rows[0]['current_a']-rows[1]['current_a'])*math.pi/math.log(2);self.assertGreater(naive,250.*1.01);self.assertIsNone(h.sample) + def test_11_probe_footprint_and_thin_layer_domain_rejected(self): + with self.assertRaises(r.ActionRejected):r.disk_transfer_coefficient(.1,.00127,.049,0) + h=make();remove(h);self.reject(h,'sample.load',**dict(r.SAMPLE_EXAMPLE,conducting_thickness_m=.0005)) + def test_12_actual_calibration_waits_180_seconds_and_fits_observation(self): + h=make(standard=True);h.invoke('calibration.start',reference_sheet_resistance_ohm_sq=100.);h.step(179.9);self.assertIsNone(h.calibration_gain);self.assertEqual(h.phase,'running');h.step(100.);self.assertEqual(h.phase,'succeeded');self.assertGreaterEqual(h.elapsed,180.);self.assertLess(abs(h.calibration_gain-1/1.03),2e-6);self.assertGreater(h._ledger()['source_input_j'],0);self.budget(h) + def test_13_calibration_uses_supplied_standard_not_hidden_gain(self): + h=make(standard=True);out=finish(h,'calibration',reference=110.);self.assertAlmostEqual(h.calibration_gain,110/out['rows'][0]['sheet_resistance_ohm_sq'],14);self.assertGreater(abs(h.calibration_gain-1/1.03),.09) + def test_14_replacing_probe_invalidates_calibration(self): + h=make(standard=True);finish(h,'calibration');open_home(h);h.invoke('probe.configure',**dict(r.PROBE_EXAMPLE,spacing_m=.001016));self.assertIsNone(h.calibration_gain);h.invoke('map.configure',**r.MAP_EXAMPLE);h.invoke('method.configure',**r.METHOD_EXAMPLE);h.invoke('enclosure.set_open',opened=False);h.step(3.);self.reject(h,'acquisition.start') + def test_15_mapping_throughput_is_at_least_1p2s_per_point_plus_motion(self): + h=make(method={'auto_current':False});out=finish(h);self.assertEqual(out['phase'],'succeeded');self.assertEqual(len(out['rows']),5);self.assertGreater(out['elapsed_s'],5*1.2);previous=0. + for row in out['rows']:self.assertGreaterEqual(row['time_s']-previous,1.2);previous=row['time_s'];self.assertEqual(len(row['observations']),4) + self.assertTrue(h._raised());self.budget(h) + def test_16_autorange_only_first_site_and_fixed_current_afterward(self): + h=make();out=finish(h);self.assertEqual(out['phase'],'succeeded');self.assertGreater(len(out['auto_trials']),1);self.assertLessEqual(len(out['auto_trials']),9);currents={abs(p['current_a']) for row in out['rows'] for p in row['observations']};self.assertEqual(len(currents),1);self.assertAlmostEqual(next(iter(currents)),out['selected_current_a'],12);self.assertTrue(all(x['time_s'].05 for x in rows));self.assertGreater(np.ptp([x['sample_k'] for x in rows]),.8);a=call(h,'analysis.modulated_cp',time_s=[x['elapsed_s'] for x in rows],heatflow_w=[x['heatflow_w'] for x in rows],temperature_k=[x['sample_k'] for x in rows],sample_mass_kg=2e-6,period_s=60.,accept_apparatus_response=True);self.assertTrue(math.isfinite(a['apparent_cp_real_j_kg_k']));self.ledger(h) + def test_25_power_off_blanks_and_passive_heat_persists(self): + h=setup();call(h,'thermal.disable');before=h.furnace;call(h,'power.set',enabled=False);self.assertEqual(h.furnace,before);self.assertIsNone(h.read()['heatflow.indicated_w']);self.assertEqual(h.read()['panel.temperature_text'],'');step(h,1.);self.assertLess(h.furnace,before);self.ledger(h) + def test_26_emergency_freezes_partial_and_requires_cold_reset(self): + h=setup();call(h,'acquisition.start');step(h,1.);call(h,'emergency.stop');self.assertEqual(h.phase,'failed');self.assertEqual(h.error,'SOFTWARE_STOP');self.assertFalse(h.gas_open);r=call(h,'acquisition.result');self.rejected(h,'emergency.reset','HOT_CELL');cool(h);call(h,'emergency.reset');self.assertEqual(r,call(h,'acquisition.result'));self.assertEqual(h.phase,'failed');self.ledger(h) + def test_27_timeout_and_sampling_terminal_at_actual_event(self): + h=setup(method=quick(timeout_s=.235),warm=False);r=run(h);self.assertEqual(r['error_code'],'TIMEOUT');self.assertAlmostEqual(r['elapsed_s'],.235);self.assertAlmostEqual(r['rows'][-1]['elapsed_s'],.235);self.ledger(h) + def test_28_frozen_result_survives_material_method_calibration_changes(self): + h=setup(method=quick(),warm=False);r=run(h);cleanup(h);call(h,'sensor.calibrate',**dict(rt.CALIBRATION_EXAMPLE,sample_flow_gain_correction=2.));call(h,'method.configure',**dict(rt.METHOD_EXAMPLE));call(h,'sample.load',**dict(rt.SAMPLE_EXAMPLE,reference_id='naphthalene_nist'));self.assertEqual(r,call(h,'acquisition.result'));self.assertEqual(r,h.records[r['operation_id']]) + def test_29_queries_do_not_take_owner(self): + h=setup(method=quick(),warm=False);s=h.session();op=s.invoke(instance_id=h.instance_id,capability_id='acquisition.start',arguments={},request_id='start')['operation_id'];step(h,.3);before=state(h);s.poll(op);s.read(instance_id=h.instance_id);h.describe();call(h,'ledger.read');self.assertEqual(before,state(h));r=s.invoke(instance_id=h.instance_id,capability_id='acquisition.result',arguments={},request_id='query');self.assertIsNone(r['operation_id']);self.assertEqual(h._owners[op],'agent') + def test_30_session_idempotence_other_owner_and_conflict(self): + h=setup(method=quick(),warm=False);h.register_principal('other');a=h.session();b=h.session('other');args=dict(instance_id=h.instance_id,capability_id='acquisition.start',arguments={},request_id='start');r=a.invoke(**args);self.assertEqual(r,a.invoke(**args));op=r['operation_id'];self.assertEqual(b.invoke(**dict(args,capability_id='acquisition.result',request_id='query'))['error']['code'],'ACCESS_DENIED') + for fn in [lambda:b.poll(op),lambda:b.cancel(op,'x')]: + with self.assertRaises(rt.ActionRejected):fn() + self.assertEqual(a.invoke(**dict(args,capability_id='power.set',arguments={'enabled':False}))['error']['code'],'REQUEST_CONFLICT');c=a.cancel(op,'cancel');self.assertEqual(c,a.cancel(op,'cancel')) + def test_31_stale_cancel_does_not_cancel_new_run(self): + h=setup(method=quick(),warm=False);s=h.session();a=dict(instance_id=h.instance_id,capability_id='acquisition.start',arguments={},request_id='s1');op=s.invoke(**a)['operation_id'];c=s.cancel(op,'cancel');op2=s.invoke(**dict(a,request_id='s2'))['operation_id'];self.assertNotEqual(op,op2);self.assertEqual(c,s.cancel(op,'cancel'));self.assertEqual(h.phase,'running') + with self.assertRaisesRegex(rt.ActionRejected,'REQUEST_CONFLICT'):s.cancel(op2,'cancel') + def test_32_agent_truth_recovery_and_json_boundaries(self): + h=setup(method=quick(),warm=False);s=h.session();d=s.describe(instance_id=h.instance_id);self.assertTrue(all(not k.startswith('truth.') for k in d['state_slots']));self.assertNotIn('sample.remove',d['capabilities']);self.assertNotIn('ledger.read',d['capabilities']) + for k in ['sample.load','sample.remove','gas.load','ledger.read','sim.step','plant.configure']: + before=state(h);r=s.invoke(instance_id=h.instance_id,capability_id=k,arguments=rt.CAPS[k]['example_arguments'],request_id=k);self.assertEqual(r['error']['code'],'ACCESS_DENIED');self.assertEqual(state(h),before) + with self.assertRaises(rt.ActionRejected):s.read(instance_id=h.instance_id,state_ids=['truth.liquid_fraction']) + with self.assertRaises(rt.ActionRejected):s.write(instance_id=h.instance_id,state_id='thermal.target_k',value=400.,request_id='write') + op=s.invoke(instance_id=h.instance_id,capability_id='acquisition.start',arguments={},request_id='s')['operation_id'];step(h,12.);r=s.poll(op);payload=json.dumps(r,allow_nan=False) + for hidden in ['truth.','liquid_fraction','sample_mass_kg','fusion_enthalpy_j_kg']:self.assertNotIn('"'+hidden,payload) + def test_33_two_instances_fixed_partition_and_zero_host_step(self): + a=setup('a',method=quick(),warm=False);b=setup('b',method=quick(),warm=False);call(a,'acquisition.start');call(b,'acquisition.start');step(a,1.3) + for dt in [.03,.07,.25,.15,.4,.4]:step(b,dt) + self.assertEqual(a.read(),b.read());self.assertEqual(a.rows,b.rows);before=state(b);step(a,.1);self.assertEqual(state(b),before);call(a,'sim.step',dt_s=0.) + def test_34_large_host_step_keeps_event_rows_and_exact_time(self): + a=setup('a',method=quick(),warm=False);b=setup('b',method=quick(),warm=False);call(a,'acquisition.start');call(b,'acquisition.start');step(a,20.) + for _ in range(200):step(b,.1) + self.assertEqual(a.read(),b.read());self.assertEqual(a.rows,b.rows);self.assertEqual(a.phase,'succeeded');self.assertEqual(a.elapsed,11.);self.ledger(a) + def test_35_reference_only_unknown_and_assumptions_rejected(self): + h=rt.TaDsc2500Runtime();call(h,'plant.configure',**rt.PLANT_EXAMPLE);self.rejected(h,'sample.load','MODEL_NOT_ACCEPTED',**dict(rt.SAMPLE_EXAMPLE,accept_engineering=False));self.rejected(h,'sample.load','MODEL_NOT_ACCEPTED',**dict(rt.SAMPLE_EXAMPLE,accept_reversible_phase_change=False));self.rejected(h,'sample.load','CONDITION_TRANSFER_NOT_ACCEPTED',**dict(rt.SAMPLE_EXAMPLE,accept_condition_transfer=False));self.rejected(h,'sample.load','INVALID_REFERENCE',**dict(rt.SAMPLE_EXAMPLE,reference_id='missing'));rid=next(k for k,v in rt.library()['substances'].items() if not v.get('runtime_usable'));self.rejected(h,'sample.load','INVALID_REFERENCE',**dict(rt.SAMPLE_EXAMPLE,reference_id=rid));self.rejected(h,'gas.load','REFERENCE_CONDITIONS_NOT_ACCEPTED',**dict(rt.GAS_EXAMPLE,accept_reference_conditions=False)) + def test_36_loading_external_heat_and_removal_keeps_pan_energy(self): + h=rt.TaDsc2500Runtime();call(h,'plant.configure',**rt.PLANT_EXAMPLE);call(h,'sample.load',**dict(rt.SAMPLE_EXAMPLE,initial_temperature_k=308.15));expected=2e-6*233*10;self.assertAlmostEqual(h.loaded_energy,expected);self.assertGreater(h.sample_temperature,298.15);self.assertLess(h.sample_temperature,308.15);self.ledger(h);call(h,'sample.remove');self.assertGreater(h.sample_energy,0.);self.ledger(h) + def test_37_start_requires_observed_equilibrium_and_resource(self): + h=setup(warm=False);self.rejected(h,'acquisition.start','START_NOT_EQUILIBRATED');call(h,'method.configure',**dict(rt.METHOD_EXAMPLE,**quick()));call(h,'gas.set_open',opened=False);self.rejected(h,'acquisition.start','NO_GAS');call(h,'lid.set',opened=True);step(h,2.1);self.rejected(h,'thermal.set_temperature','NOT_READY',temperature_k=400.,rate_k_s=1.) + def test_38_program_modulation_bounds_unknown_methods_explicit(self): + h=setup(warm=False,method=quick());self.rejected(h,'method.configure','MODULATION_SAMPLING',**dict(h.method,modulation_amplitude_k=.1,start_temperature_k=300.,modulation_period_s=1.,sample_interval_s=.1));self.rejected(h,'method.configure','PROGRAM_RATE',**dict(h.method,modulation_amplitude_k=1.,start_temperature_k=300.,modulation_period_s=2.));call(h,'method.configure',**dict(h.method,segments=[dict(target_k=298.15,rate_k_s=.1,hold_s=0.)]));self.rejected(h,'acquisition.start','EMPTY_PROGRAM') + for k in rt.UNSUPPORTED:self.rejected(h,k,'UNSUPPORTED') + def test_39_run_repeated_phase_history_without_free_reset(self): + h=setup();r=run(h);self.assertEqual(h._fraction(),1.);call(h,'method.configure',**dict(h.method,start_temperature_k=h.read()['sample.indicated_k'],segments=[dict(target_k=h.read()['sample.indicated_k'],rate_k_s=.1,hold_s=.2)],start_tolerance_k=1.));r2=run(h);self.assertEqual(h._fraction(),1.);self.assertNotEqual(r['operation_id'],r2['operation_id']);self.assertEqual(r,h.records[r['operation_id']]);self.ledger(h) + def test_40_sampler_registered_descent_and_interrupted_path_are_atomic(self): + h=setup(warm=False,method=quick());call(h,'lid.set',opened=True);step(h,2.1);call(h,'sampler.move',x_m=.1,y_m=.05,z_m=.06);self.rejected(h,'sampler.move','SAMPLER_MOVING',x_m=0.,y_m=0.,z_m=.06);step(h,2.1);self.rejected(h,'sampler.move','SAMPLER_TARGET_NOT_REGISTERED',x_m=.1,y_m=.05,z_m=0.);self.assertEqual(len(rt.SAMPLER_REGISTERED_XY),56) + for x,y in rt.SAMPLER_REGISTERED_XY:self.assertTrue(0<=x<=.330 and 0<=y<=.110) + def test_41_tiny_gas_at_maximum_molar_rate_consumed_without_loop(self): + h=setup(gas={'amount_mol':1e-18,'reference_pressure_pa':1e7,'reference_temperature_k':200.},method=quick(),warm=False);call(h,'gas.set_flow',flow_m3_s=1e-5);r=run(h);self.assertEqual(r['error_code'],'GAS_EXHAUSTED');self.assertEqual(h.gas_remaining,0.);self.assertGreater(r['elapsed_s'],0.);self.ledger(h) + def test_99_every_actual_api_state_and_metadata_schema(self): + spec=importlib.util.spec_from_file_location('asset_tool_dsc',ROOT/'skills/chemistry-lab-assets/scripts/asset_tool.py');tool=importlib.util.module_from_spec(spec);spec.loader.exec_module(tool);meta=rt.export_ta_dsc2500_contract_metadata();checked=0 + for k,c in meta['capabilities'].items(): + for key in ['input_schema','output_schema']:self.assertEqual(tool.lint_schema(c[key],path=k+'.'+key),[]) + self.assertEqual(tool.validate_value(c['example_arguments'],c['input_schema'],path=k),[]) + counts={k:0 for k in rt.CAPS if k not in rt.UNSUPPORTED} + for k,a,r in OBSERVED: + self.assertEqual(tool.validate_value(a,meta['capabilities'][k]['input_schema'],path=k+'.arguments'),[]);self.assertEqual(tool.validate_value(r,meta['capabilities'][k]['output_schema'],path=k+'.return'),[]);counts[k]+=1;checked+=1 + self.assertTrue(all(counts.values()),counts) + for state_values in STATES: + self.assertEqual(set(state_values),set(meta['state_slots'])) + for k,v in state_values.items():self.assertEqual(tool.validate_value(v,meta['state_slots'][k]['value_schema'],path=k),[]);checked+=1 + SCHEMA_REPORT.update(actual_capability_calls=len(OBSERVED),state_snapshots=len(STATES),schema_checks=checked,capability_counts=counts) +if __name__=='__main__':unittest.main() diff --git a/tests/test_asset_ta_tamiv.py b/tests/test_asset_ta_tamiv.py new file mode 100644 index 0000000000000000000000000000000000000000..fd47b2bd43bb951c987ef87e9036ed6538decddc --- /dev/null +++ b/tests/test_asset_ta_tamiv.py @@ -0,0 +1,166 @@ +"""CHEM138: actual chemistry/thermal integration, public protocol and conservation.""" +import copy,importlib.util,json,math,unittest +from pathlib import Path +import numpy as np +from scipy.integrate import solve_ivp +from scripts.asset_runtime import ta_tamiv as r +ROOT=Path(__file__).resolve().parents[1] +spec=importlib.util.spec_from_file_location('tam_asset_tool',ROOT/'skills/chemistry-lab-assets/scripts/asset_tool.py');asset_tool=importlib.util.module_from_spec(spec);spec.loader.exec_module(asset_tool) +OBSERVED=[] +class Checked(r.TaTamivRuntime): + def invoke(self,k,**a): + before=self.read();out=super().invoke(k,**a);after=self.read();changed={x for x in after if after[x]!=before[x]} + assert not changed-set(r.CAPS[k]['effects']),(k,changed-set(r.CAPS[k]['effects'])) + assert not asset_tool.validate_value(out,r.CAPS[k]['output_schema']),(k,asset_tool.validate_value(out,r.CAPS[k]['output_schema'])) + OBSERVED.append((k,copy.deepcopy(a),copy.deepcopy(out)));return out + +def make(plant=None,sample=None,reference=None,method=None): + h=Checked();h.invoke('plant.configure',**dict(r.PLANT_EXAMPLE,**(plant or {})));h.invoke('sample.load',**dict(r.SAMPLE_EXAMPLE,**(sample or {})));h.invoke('reference.load',**dict(r.REFERENCE_EXAMPLE,**(reference or {})));h.invoke('power.set',enabled=True);h.invoke('thermal.set_temperature',temperature_k=298.15);h.invoke('sample.set_lift',lift_m=0.);h.step(1.);h.invoke('method.configure',**dict(r.METHOD_EXAMPLE,**(method or {})));return h + +def finish(h,trigger=True): + h.invoke('acquisition.start') + if trigger:h.invoke('sample.trigger') + h.step(h.method['duration_s']);return h.invoke('acquisition.result') +def remove(h): + if h.phase=='running':h.invoke('acquisition.stop') + h.invoke('calibration.set_power',power_w=0.);h.invoke('sample.set_lift',lift_m=.48);h.step(1.);h.invoke('sample.remove') +def sessions(h): + for n,role in [('student','agent'),('teacher','evaluator'),('other','agent')]:h.register_principal(n,role) + return h.session('student'),h.session('teacher'),h.session('other') +def call(s,c,a=None,rid='r1'):return s.invoke(instance_id=s._host.instance_id,capability_id=c,arguments=a or {},request_id=rid) +def snapshot(h): + return json.dumps(dict(state=h.read(),plant=h.plant,sample=h.sample,reference=h.reference,ledger=h._ledger(),rows=h.rows,records=h.records,revision=h.revision,calibration=h.calibration,method=h.method,x=h.x.tolist()),sort_keys=True,allow_nan=False) + +class TamTests(unittest.TestCase): + def budget(self,h,tol=1e-9): + for k,v in h.invoke('ledger.read').items(): + if 'error' in k:self.assertLess(abs(v),tol,(k,v)) + def reject(self,h,k,**a): + before=snapshot(h) + with self.assertRaises(r.ActionRejected):h.invoke(k,**a) + self.assertEqual(snapshot(h),before) + def test_01_targets_and_motion_are_not_teleports(self): + h=make();old=h.x.copy();h.invoke('thermal.set_temperature',temperature_k=300.15);np.testing.assert_array_equal(h.x,old);h.invoke('sample.set_lift',lift_m=.48);self.assertEqual(h.lift,0.);h.step(.5);self.assertEqual(h.lift,.24);self.assertGreater(h._temperature(0),298.15);self.budget(h) + def test_02_reads_describe_and_zero_are_pure(self): + h=make();a,e,_=sessions(h);before=snapshot(h) + for _ in range(2):a.read(instance_id=h.instance_id);e.describe(asset_type_id=r.ASSET_TYPE_ID);h.step(0.) + self.assertEqual(before,snapshot(h)) + def test_03_sixtysix_real_enthalpies_and_mass_closure(self): + lib=r.library();self.assertGreaterEqual(len(lib),50) + for row in lib.values(): + self.assertEqual(row['reference_temperature_K'],298.15);self.assertTrue(row['source']);self.assertTrue(row['enthalpy_J_mol']);self.assertAlmostEqual(sum(p['stoichiometry']*p['molar_mass_kg_mol'] for p in row['products']),row['molar_mass_kg_mol'],places=9) + def test_04_halite_heat_and_true_vs_recorded_integral(self): + h=make();o=finish(h);expected=1e-6*(1-math.exp(-.5*12));self.assertEqual(o['phase'],'succeeded');self.assertEqual(len(o['rows']),241);self.assertAlmostEqual(h.sample['converted'],expected,17);self.assertAlmostEqual(h.reaction_heat,-3700*expected,14);self.assertLess(min(x['heat_flow_w'] for x in o['rows']),0);self.assertGreater(abs(h.reaction_heat-o['recorded_heat_j']),1e-5);self.budget(h) + def test_05_stoichiometric_products_not_constant_mass_shortcut(self): + h=make();h.invoke('sample.trigger');h.step(2.);xi=h.sample['converted'];d=h.species_ledger();self.assertAlmostEqual(d['products']['Na+']['amount_mol'],xi,18);self.assertAlmostEqual(d['products']['Cl-']['amount_mol'],xi,18);m=d['carrier_water_kg']+d['solid_mol']*h.sample['molar_mass']+sum(v['mass_kg'] for v in d['products'].values());self.assertEqual(m,h._mass());self.budget(h) + def test_06_crystal_water_is_conserved(self): + h=make(sample={'reference_id':'chalcanthite_dissolution'});h.invoke('sample.trigger');h.step(3.);water=next(p for p in h.sample['products'] if p['phase']=='liquid_water');self.assertEqual(water['stoichiometry'],5.);self.assertAlmostEqual(h.species_ledger()['products'][water['id']]['mass_kg'],5*h.sample['converted']*water['molar_mass_kg_mol'],18);self.budget(h) + def test_07_solubility_limit_leaves_solid(self): + h=make(sample={'reference_id':'barite_dissolution'});h.invoke('sample.trigger');limit=.0001*10**(-9.98/2);self.assertAlmostEqual(h.x[4],limit,18);h.step(40.);self.assertGreater(h.sample['amount_mol']-h.sample['converted'],.99e-6);self.assertLessEqual(h.sample['converted'],limit);self.budget(h) + def test_08_exothermic_sign(self): + h=make(sample={'reference_id':'cuso4_dissolution','amount_mol':1e-7});o=finish(h);self.assertGreater(h.reaction_heat,0);self.assertGreater(max(row['heat_flow_w'] for row in o['rows']),0);self.budget(h) + def test_09_blank_and_no_automatic_reaction(self): + h=make(plant={'baseline_offset_w':0.,'baseline_drift_w_s':0.});o=finish(h,False);self.assertFalse(h.sample['triggered']);self.assertEqual(h.reaction_heat,0.);self.assertTrue(all(row['heat_flow_w']==0. for row in o['rows']));self.budget(h) + def test_10_electric_heat_enters_sample_before_sensor(self): + h=make(plant={'baseline_offset_w':0.,'baseline_drift_w_s':0.});h.invoke('calibration.set_power',power_w=.001);self.assertEqual(h._observed(),0.);h.step(.01);self.assertGreater(h.x[1],h.x[0]);self.assertGreater(h._observed(),0.);self.assertLess(h._observed(),.001);self.assertAlmostEqual(h.electrical_input,.00001,15);h.invoke('calibration.set_power',power_w=0.);h.step(.1);self.assertAlmostEqual(h.electrical_input,.00001,15);self.budget(h) + def test_11_baseline_estimated_from_actual_blank(self): + h=make(plant={'baseline_offset_w':4e-7,'baseline_drift_w_s':2e-9,'heatflow_resolution_w':1e-12});o=finish(h,False);args=dict(time_s=[x['host_time_s'] for x in o['rows']],heat_flow_w=[x['heat_flow_w'] for x in o['rows']]);f=h.invoke('analysis.baseline',**args);self.assertAlmostEqual(f['intercept_w'],4e-7,15);self.assertAlmostEqual(f['drift_w_s'],2e-9,15) + def test_12_actual_electric_platform_gain(self): + h=make(plant={'sensor_gain':1.2,'baseline_offset_w':3e-7,'baseline_drift_w_s':0.},method={'duration_s':25.});blank=h._observed();h.invoke('calibration.set_power',power_w=.0001);o=finish(h,False);plateau=o['rows'][-1]['heat_flow_w'];f=h.invoke('analysis.electrical_calibration',known_power_w=.0001,plateau_observed_w=plateau,baseline_observed_w=blank);self.assertAlmostEqual(f['gain_correction'],1/1.2,places=4);self.assertAlmostEqual(h.electrical_input,.0025,14);self.budget(h) + def test_13_external_kinetics_has_no_private_sample(self): + h=Checked();f=h.invoke('analysis.kinetics',**r.KINETICS_EXAMPLE);self.assertAlmostEqual(f['rate_s_inv'],.5,6);self.assertAlmostEqual(f['total_heat_j'],-.0037,10);self.assertIsNone(h.sample) + def test_14_near_equal_response_rates_are_finite(self): + t=np.linspace(0,8,101);out=r.first_order_observation(t,1.,1.,1.);expected=.5*t*t*np.exp(-t);np.testing.assert_allclose(out,expected,atol=1e-15) + def test_15_independent_ode_response_and_external_fit(self): + t=np.linspace(0,18.,361);k=.37;H=-.0074;thermal=2.34;sensor=.2 + def ode(t,y):return [-k*y[0],(H*k*y[0]-y[1])/thermal,(y[1]-y[2])/sensor] + sol=solve_ivp(ode,(0,18),[1.,0.,0.],t_eval=t,rtol=1e-10,atol=1e-14);h=Checked();f=h.invoke('analysis.kinetics',time_s=t.tolist(),heat_flow_w=(sol.y[2]+2e-7+1e-9*t).tolist(),trigger_time_s=0.,thermal_tau_s=thermal,sensor_tau_s=sensor,minimum_rate_s_inv=.01,maximum_rate_s_inv=10.,accept_fixed_bath_first_order=True);self.assertAlmostEqual(f['rate_s_inv'],k,6);self.assertAlmostEqual(f['total_heat_j'],H,9) + def test_16_cancel_freezes_rows_but_chemistry_continues(self): + h=make();h.invoke('acquisition.start');h.invoke('sample.trigger');h.step(2.);h.invoke('acquisition.stop');rows=copy.deepcopy(h.rows);q=h.recorded_heat;xi=h.sample['converted'];h.step(10.);self.assertEqual(h.rows,rows);self.assertEqual(h.recorded_heat,q);self.assertGreater(h.sample['converted'],xi);self.budget(h) + def test_17_power_off_does_not_arrest_chemistry(self): + h=make();h.invoke('acquisition.start');h.invoke('sample.trigger');h.invoke('calibration.set_power',power_w=.0001);h.step(.5);h.invoke('power.set',enabled=False);xi=h.sample['converted'];e=h.electrical_input;c=h.controller_input;h.step(2.);self.assertGreater(h.sample['converted'],xi);self.assertEqual(h.electrical_input,e);self.assertEqual(h.controller_input,c);self.assertIsNone(h._observed());self.assertEqual(h.phase,'cancelled');self.budget(h) + def test_18_remove_exports_remaining_chemistry(self): + h=make();h.invoke('sample.trigger');h.step(1.);remove(h);d=h.invoke('ledger.read');self.assertGreater(d['reactant_removed_mol'],0);self.assertGreater(d['converted_removed_mol'],0);self.assertEqual(d['sample_mass_present_kg'],0);q=h.reaction_heat;h.step(2.);self.assertEqual(q,h.reaction_heat);self.budget(h) + def test_19_loading_and_unloading_do_not_create_sensible_heat(self): + h=Checked();h.invoke('plant.configure',**dict(r.PLANT_EXAMPLE,ambient_k=293.15));h.invoke('sample.load',**r.SAMPLE_EXAMPLE);h.invoke('reference.load',**dict(r.REFERENCE_EXAMPLE,initial_temperature_k=303.15));self.assertAlmostEqual(h.loaded_sensible,.418*15,14);self.budget(h);h.step(2.);h.invoke('sample.remove');h.invoke('reference.remove');self.assertGreater(h.removed_sensible,0);self.budget(h) + def test_20_lift_switches_sample_to_ambient(self): + a=make(plant={'retracted_conductance_w_k':0.});b=make(plant={'retracted_conductance_w_k':0.}) + for h in (a,b):h.invoke('thermal.set_temperature',temperature_k=300.15) + b.invoke('sample.set_lift',lift_m=.48);a.step(1.);b.step(1.);self.assertEqual(b.x[1],0.);self.assertGreater(a.x[1],0.);self.budget(a);self.budget(b) + def test_21_motion_arrival_partition(self): + a=make();b=make() + for h in (a,b):h.invoke('sample.trigger');h.invoke('sample.set_lift',lift_m=.24) + a.step(1.2) + for _ in range(72):b.step(1/60) + np.testing.assert_allclose(a.x,b.x,rtol=1e-12,atol=1e-15);self.assertEqual(a.lift,b.lift);self.budget(a);self.budget(b) + def test_22_controller_heat_and_cool_limits(self): + for target,expected in [(310.15,2.),(280.15,-1.)]: + h=make(plant={'bath_capacity_j_k':10.,'controller_heating_limit_w':2.,'controller_cooling_limit_w':1.});h.invoke('thermal.set_temperature',temperature_k=target);h.step(1.);self.assertAlmostEqual(h.controller_input,expected,10);self.budget(h) + def test_23_saturated_power_partition(self): + a=make(plant={'bath_capacity_j_k':10.,'controller_heating_limit_w':2.});b=make(plant={'bath_capacity_j_k':10.,'controller_heating_limit_w':2.}) + for h in (a,b):h.invoke('thermal.set_temperature',temperature_k=310.15) + a.step(1.) + for _ in range(60):b.step(1/60) + np.testing.assert_allclose(a.x,b.x,rtol=1e-9,atol=1e-11);self.assertAlmostEqual(a.controller_input,b.controller_input,9);self.budget(a);self.budget(b) + def test_24_nominal_target_limits_and_disable(self): + h=make();h.invoke('thermal.set_temperature',temperature_k=423.15);h.step(.1);h.invoke('thermal.disable');c=h.controller_input;h.step(.1);self.assertEqual(c,h.controller_input);h.invoke('thermal.set_temperature',temperature_k=277.15);self.reject(h,'thermal.set_temperature',temperature_k=423.16);self.budget(h) + def test_25_temperature_invalidates_observation_not_chemistry(self): + h=make(plant={'bath_capacity_j_k':1.});h.invoke('sample.trigger');h.invoke('thermal.set_temperature',temperature_k=303.15);h.step(3.);self.assertIsNone(h._observed());self.reject(h,'acquisition.start');xi=h.sample['converted'];h.step(1.);self.assertGreater(h.sample['converted'],xi);self.budget(h) + def test_26_temperature_drift_fails_active_record(self): + h=make(sample={'reference_id':'cuso4_dissolution','amount_mol':1e-5});h.invoke('acquisition.start');h.invoke('sample.trigger');h.step(2.);self.assertEqual(h.phase,'failed');self.assertEqual(h.error,'REFERENCE_TEMPERATURE_RANGE');self.assertIsNone(h.recorded_heat);self.assertIsNone(h.rows[-1]['heat_flow_w']);xi=h.sample['converted'];h.step(1.);self.assertGreater(h.sample['converted'],xi);self.budget(h) + def test_27_sensor_range_is_missing_not_zero(self): + h=make(plant={'heatflow_limit_w':1e-6});o=finish(h);self.assertEqual(o['phase'],'failed');self.assertEqual(o['error_code'],'SENSOR_RANGE');self.assertIsNone(o['recorded_heat_j']);self.assertTrue(any(x['heat_flow_w'] is None for x in o['rows'])) + def test_28_sixty_hz_clock_and_internal_rows(self): + a=make();b=make() + for h in (a,b):h.invoke('acquisition.start');h.invoke('sample.trigger') + a.step(12.) + for _ in range(720):b.step(1/60) + self.assertEqual(a.time_ns,b.time_ns);self.assertEqual(a.rows,b.rows);np.testing.assert_allclose(a.x,b.x,rtol=1e-11,atol=1e-14);self.budget(a);self.budget(b) + def test_29_sampling_grid_and_input_atomicity(self): + h=make() + for override in [{'duration_s':.123,'sample_interval_s':.05},{'duration_s':1.,'sample_interval_s':.00000001}]:self.reject(h,'method.configure',**dict(r.METHOD_EXAMPLE,**override)) + for dt in [True,-1.,float('nan'),float('inf')]: + before=snapshot(h) + with self.assertRaises(r.ActionRejected):h.step(dt) + self.assertEqual(before,snapshot(h)) + self.reject(h,'thermal.set_temperature',temperature_k=True);self.reject(h,'thermal.set_temperature',temperature_k=298.15,extra=1) + def test_30_busy_load_and_capacity_guards(self): + h=make();h.invoke('acquisition.start');self.reject(h,'sample.set_lift',lift_m=.48);self.reject(h,'sensor.calibrate',**r.CALIBRATION_EXAMPLE);self.reject(h,'sample.remove');h.invoke('acquisition.stop');remove(h);self.reject(h,'sample.load',**dict(r.SAMPLE_EXAMPLE,volume_m3=21e-6));self.reject(h,'sample.load',**dict(r.SAMPLE_EXAMPLE,reference_id='missing'));self.reject(h,'sample.load',**dict(r.SAMPLE_EXAMPLE,initial_temperature_k=303.15)) + def test_31_double_instance_isolation(self): + a=make();b=make();before=snapshot(b);finish(a);self.assertEqual(snapshot(b),before);self.assertNotEqual(a.reaction_heat,b.reaction_heat) + def test_32_identity_and_visibility(self): + h=make();a,e,_=sessions(h);self.assertNotIn('truth.sample_k',a.read(instance_id=h.instance_id)['observations']);self.assertIn('truth.sample_k',e.read(instance_id=h.instance_id)['observations']);self.assertNotIn('sample.trigger',a.describe(instance_id=h.instance_id)['capabilities']);self.assertEqual(call(a,'sample.trigger')['error']['code'],'ACCESS_DENIED') + with self.assertRaises(r.ActionRejected):h.session('unregistered') + with self.assertRaises(r.ActionRejected):a.read(instance_id=h.instance_id,state_ids=['truth.sample_k']) + with self.assertRaises(r.ActionRejected):h.register_principal('student','evaluator') + def test_33_idempotency_owner_and_cancel(self): + h=make();a,e,b=sessions(h);start=call(a,'acquisition.start');self.assertEqual(start,call(a,'acquisition.start'));self.assertEqual(call(a,'power.set',{'enabled':True})['error']['code'],'REQUEST_CONFLICT');self.assertEqual(call(b,'acquisition.stop')['error']['code'],'ACCESS_DENIED');self.assertEqual(call(b,'power.set',{'enabled':False},'off')['error']['code'],'ACCESS_DENIED');h.invoke('sample.trigger');h.step(.2);op=start['operation_id'];response=a.cancel(op,'cancel');self.assertEqual(response,a.cancel(op,'cancel'));self.assertEqual(a.poll(op)['status'],'cancelled') + def test_34_privileged_public_results_do_not_leak_source(self): + h=make();a,e,_=sessions(h);op=call(a,'acquisition.start')['operation_id'];h.invoke('sample.trigger');h.step(12.) + for payload in [call(a,'acquisition.result',rid='a'),call(e,'acquisition.result',rid='e'),a.poll(op)]: + text=json.dumps(payload);self.assertNotIn('halite',text.lower());self.assertNotIn('minteq',text.lower());self.assertNotIn('3700',text) + self.assertEqual(call(a,'provenance.read',rid='p')['error']['code'],'ACCESS_DENIED');self.assertEqual(call(e,'provenance.read',rid='p')['result']['reference_id'],'halite_dissolution') + def test_35_result_provenance_snapshots_survive_new_sample(self): + h=make();old=finish(h);remove(h);self.assertIsNone(h.invoke('provenance.read')['reference_id']);h.invoke('sample.load',**dict(r.SAMPLE_EXAMPLE,reference_id='barite_dissolution'));new=h.invoke('acquisition.result');self.assertEqual(new,old);self.assertEqual(h.invoke('provenance.read')['reference_id'],'barite_dissolution') + def test_36_assumption_acceptance_and_unsupported(self): + h=Checked();self.reject(h,'plant.configure',**dict(r.PLANT_EXAMPLE,accept_engineering=False));h.invoke('plant.configure',**r.PLANT_EXAMPLE);self.reject(h,'sample.load',**dict(r.SAMPLE_EXAMPLE,accept_ideal_solution_and_kinetics=False));self.reject(h,'reference.load',**dict(r.REFERENCE_EXAMPLE,accept_inert_reference=False)) + for c in r.UNSUPPORTED:self.reject(h,c) + h.register_principal('a');self.assertEqual(call(h.session('a'),'measurement.micro_solution_accessory')['status'],'unsupported') + def test_37_external_analysis_rejections_are_atomic(self): + h=make();self.reject(h,'analysis.baseline',time_s=[0.,0.,1.],heat_flow_w=[0.,1.,2.]);self.reject(h,'analysis.electrical_calibration',known_power_w=.001,plateau_observed_w=0.,baseline_observed_w=1e-6);self.reject(h,'analysis.kinetics',**dict(r.KINETICS_EXAMPLE,heat_flow_w=[0.]*101));self.reject(h,'analysis.kinetics',**dict(r.KINETICS_EXAMPLE,accept_fixed_bath_first_order=False)) + def test_38_all_contract_schemas_and_actual_returns(self): + h=make();meta=h.describe() + for key,c in meta['capabilities'].items(): + self.assertEqual(asset_tool.lint_schema(c['input_schema']),[],key);self.assertEqual(asset_tool.lint_schema(c['output_schema']),[],key);self.assertEqual(asset_tool.validate_value(c['example_arguments'],c['input_schema']),[],key) + for key,args,result in OBSERVED:self.assertEqual(asset_tool.validate_value(result,meta['capabilities'][key]['output_schema']),[],key) + for key,value in h.read().items():self.assertEqual(asset_tool.validate_value(value,meta['state_slots'][key]['value_schema']),[],key) + def test_39_session_entrypoints_all_implemented_capabilities(self): + h=Checked();h.register_principal('eval','evaluator');s=h.session('eval');seen=set() + plan=[('plant.configure',r.PLANT_EXAMPLE),('sample.load',r.SAMPLE_EXAMPLE),('reference.load',r.REFERENCE_EXAMPLE),('power.set',{'enabled':True}),('thermal.set_temperature',{'temperature_k':298.15}),('sample.set_lift',{'lift_m':0.}),('sim.step',{'dt_s':1.}),('method.configure',r.METHOD_EXAMPLE),('sensor.calibrate',r.CALIBRATION_EXAMPLE),('acquisition.start',{}),('sample.trigger',{}),('calibration.set_power',{'power_w':.0001}),('sim.step',{'dt_s':.2}),('acquisition.stop',{}),('calibration.set_power',{'power_w':0.}),('acquisition.result',{}),('provenance.read',{}),('ledger.read',{}),('analysis.baseline',r.CAPS['analysis.baseline']['example_arguments']),('analysis.electrical_calibration',r.CAPS['analysis.electrical_calibration']['example_arguments']),('analysis.kinetics',r.KINETICS_EXAMPLE),('thermal.disable',{}),('sample.set_lift',{'lift_m':.48}),('sim.step',{'dt_s':1.}),('sample.remove',{}),('power.set',{'enabled':False}),('reference.remove',{})] + for i,(cap,args) in enumerate(plan): + out=call(s,cap,args,str(i));self.assertIn(out['status'],('accepted','succeeded'),(cap,out));self.assertEqual(asset_tool.validate_value(out['result'],r.CAPS[cap]['output_schema']),[],cap);seen.add(cap) + self.assertEqual(seen,set(r.CAPS)-set(r.UNSUPPORTED));self.budget(h) + def test_40_equilibrium_trigger_and_electrical_lift_guards(self): + h=make();h.invoke('calibration.set_power',power_w=.001);self.reject(h,'sample.set_lift',lift_m=.48);h.invoke('calibration.set_power',power_w=0.);h.invoke('thermal.set_temperature',temperature_k=310.15);self.reject(h,'acquisition.start');h.invoke('sample.set_lift',lift_m=.48);h.step(.2);self.reject(h,'sample.trigger');self.reject(h,'sample.remove');self.reject(h,'reference.remove') + +if __name__=='__main__':unittest.main(verbosity=2) diff --git a/tests/test_asset_ta_tga5500.py b/tests/test_asset_ta_tga5500.py new file mode 100644 index 0000000000000000000000000000000000000000..2177343bb13bed894c690102c2be64c63cd5b62d --- /dev/null +++ b/tests/test_asset_ta_tga5500.py @@ -0,0 +1,150 @@ +"""CHEM132: actual chemistry/energy/gas/host protocol regressions, not presence-only tests.""" +import copy,importlib.util,json,math,sys,unittest +from pathlib import Path +import numpy as np +ROOT=Path(__file__).resolve().parents[1];sys.path.insert(0,str(ROOT/'scripts')) +from asset_runtime import ta_tga5500 as rt +OBSERVED=[];STATES=[];SCHEMA_REPORT={} +def state(h):return json.dumps(h.__dict__,sort_keys=True,allow_nan=False,default=lambda x:x.item() if hasattr(x,'item') else str(x)) +def call(h,k,**a): + before=h.read();r=h.invoke(k,**a);after=h.read();json.dumps(r,allow_nan=False);json.dumps(after,allow_nan=False);OBSERVED.append((k,copy.deepcopy(a),copy.deepcopy(r)));STATES.append(after);changed={x for x in before if before[x]!=after[x]} + if not changed<=set(rt.CAPS[k]['effects']):raise AssertionError((k,'undeclared effects',changed-set(rt.CAPS[k]['effects']))) + return r +def step(h,t):h.step(t);STATES.append(h.read());json.dumps(h.read(),allow_nan=False) +def quick(**kw):return dict(rt.METHOD_EXAMPLE,segments=[dict(target_k=300.15,rate_k_s=.5,hold_s=1.,gas='N2')],**kw) +def setup(name='tga_test',plant=None,sample=None,gas=None,method=None): + h=rt.TaTga5500Runtime(name);call(h,'plant.configure',**dict(rt.PLANT_EXAMPLE,**(plant or {})));call(h,'power.set',enabled=True);call(h,'sensor.calibrate',**rt.CALIBRATION_EXAMPLE);call(h,'balance.tare');call(h,'sample.load',**dict(rt.SAMPLE_EXAMPLE,**(sample or {})));call(h,'gas.load',**dict(rt.GAS_EXAMPLE,**(gas or {})));call(h,'gas.load',**dict(rt.GAS_EXAMPLE,gas='O2'));call(h,'furnace.set',opened=False);step(h,2.1);call(h,'gas.set_flow',sample_flow_m3_s=25e-6/60,balance_flow_m3_s=10e-6/60);call(h,'gas.select',gas='N2');call(h,'gas.set_open',opened=True);call(h,'method.configure',**(method or quick()));return h +def run(h): + call(h,'acquisition.start') + for _ in range(30000): + step(h,.1) + if h.phase!='running':break + if h.phase=='running':raise AssertionError('no terminal state') + return call(h,'acquisition.result') +def cool(h): + if h.phase=='running':call(h,'acquisition.stop') + call(h,'thermal.disable');call(h,'thermal.set_cooling',enabled=True) + for _ in range(10000): + if h._cold():break + step(h,.1) + else:raise AssertionError('not cold') +def cleanup(h): + cool(h);call(h,'gas.set_open',opened=False);call(h,'furnace.set',opened=True);step(h,2.1);call(h,'sample.remove');call(h,'gas.unload',gas='N2');call(h,'gas.unload',gas='O2');call(h,'power.set',enabled=False) +class TestTGA5500(unittest.TestCase): + def rejected(self,h,k,error='.',**a): + before=state(h) + with self.assertRaisesRegex(rt.ActionRejected,error):h.invoke(k,**a) + self.assertEqual(before,state(h)) + def ledger(self,h): + l=call(h,'ledger.read');self.assertLess(abs(l['sample_error_kg']),1e-15);self.assertLess(abs(l['n2_error_mol']),1e-10);self.assertLess(abs(l['o2_error_mol']),1e-10);self.assertLess(abs(l['energy_error_j']),2e-6);return l + def test_01_two_actual_source_curves_raw_noise_preserved(self): + lib=rt.library()['substances'] + for rid in ['fsri_abs_n2_10k_r1','fsri_hdpe_n2_10k_r1']: + r=lib[rid];self.assertTrue(r['runtime_usable']);self.assertGreater(len(r['values']['temperature_k']),5000);self.assertIn(r['conditions']['gas'],['N2','nitrogen']);self.assertAlmostEqual(r['conditions']['heating_rate_k_s'],1/6);self.assertGreater(r['values']['time_s'][0],500);self.assertIn('sha256',r['source']) + def test_02_two_materials_drive_actual_distinct_observations(self): + masses=[] + for rid in ['fsri_abs_n2_10k_r1','fsri_hdpe_n2_10k_r1']: + h=setup(sample={'reference_id':rid},method=copy.deepcopy(rt.METHOD_EXAMPLE));r=run(h);self.assertEqual(r['phase'],'succeeded');self.assertAlmostEqual(r['elapsed_s'],105.);self.assertLess(h._mass(),2e-6);masses.append(r['rows'][-1]['mass_kg']);self.ledger(h) + self.assertGreater(abs(masses[0]-masses[1]),1e-8) + def test_03_projection_audited_raw_not_mutated(self): + ref=dict(runtime_usable=True,values=dict(temperature_k=[300.,310.,310.,320.,305.],mass_fraction=[1.,1.1,.8,-.01,.95]));old=copy.deepcopy(ref);m=rt.prepare_reference(ref,True);self.assertEqual(ref,old);self.assertEqual(m['temperature'],[300.,305.,310.,320.]);self.assertEqual(m['mass_fraction'],[1.,.95,.95,0.]);self.assertEqual(m['stats']['duplicate_temperatures_removed'],1);self.assertEqual(m['stats']['clipped_points'],2) + with self.assertRaisesRegex(rt.ActionRejected,'PROJECTION'):rt.prepare_reference(ref,False) + def test_04_targets_not_truth_queries_no_clock_or_mutation(self): + h=setup();call(h,'thermal.set_temperature',temperature_k=400.,rate_k_s=1.);self.assertEqual(h.target,298.15);self.assertEqual(h.furnace,298.15);before=state(h);h.read();h.describe();call(h,'reference.query',reference_id=rt.SAMPLE_EXAMPLE['reference_id']);call(h,'acquisition.result');call(h,'ledger.read');self.assertEqual(state(h),before);step(h,1);self.assertAlmostEqual(h.target,299.15);self.assertLess(h.furnace,h.target) + def test_05_program_holds_switches_and_terminal_timestamps(self): + m=quick();m['segments']=[dict(target_k=300.15,rate_k_s=.5,hold_s=1.,gas='N2'),dict(target_k=299.15,rate_k_s=.5,hold_s=.5,gas='O2')];h=setup(method=m);r=run(h);self.assertEqual(r['phase'],'succeeded');self.assertAlmostEqual(r['elapsed_s'],7.5);self.assertEqual(r['rows'][-1]['elapsed_s'],r['elapsed_s']);self.assertTrue(any(x['stage']=='hold' for x in r['rows']));self.assertGreater(h.chamber[1],0);self.ledger(h) + def test_06_conservative_cstr_analytic_and_deficit_fill(self): + n,out=rt.mix_chamber(1.,0.,'O2',.4,1.);self.assertAlmostEqual(n[0],math.exp(-.4));self.assertAlmostEqual(n[1],1-math.exp(-.4));self.assertAlmostEqual(out[0]+out[1],.4) + n,out=rt.mix_chamber(.4,.1,'N2',.3,1.);self.assertEqual(n,[.7,.1]);self.assertEqual(out,[0.,0.]);n,out=rt.mix_chamber(0.,0.,'N2',2.,1.);self.assertEqual(n,[1.,0.]);self.assertEqual(out,[1.,0.]) + def test_07_sample_gas_switch_not_instant_chamber_or_balance_oxygen(self): + h=setup();before=h.chamber.copy();call(h,'gas.select',gas='O2');self.assertEqual(h.chamber,before);N=h.gas_remaining['N2'];O=h.gas_remaining['O2'];step(h,1);self.assertGreater(h.chamber[1],0);self.assertLess(h.chamber[1]/sum(h.chamber),1);self.assertAlmostEqual(N-h.gas_remaining['N2'],h.balance_flow*101325/(rt.R_GAS*298.15),places=12);self.assertAlmostEqual(O-h.gas_remaining['O2'],h.sample_flow*101325/(rt.R_GAS*298.15),places=12);self.ledger(h) + def test_08_finite_oxygen_uptake_mass_consumption_and_pressure_deficit(self): + h=setup(sample={'oxidation_capacity_fraction':.2,'oxidation_rate_s_inv':100.,'oxidation_activation_j_mol':0.});call(h,'gas.select',gas='O2');step(h,.1);self.assertGreater(h.uptake,0);self.assertLessEqual(h.uptake,2e-6);self.assertLess(sum(h.chamber),h.capacity);self.assertAlmostEqual(h._mass(),1e-5+h.uptake,delta=1e-12);l=self.ledger(h);self.assertAlmostEqual(l['o2_consumed_mol']*rt.M_O2,l['oxygen_uptake_kg'],places=15) + def test_09_closed_valves_finite_oxygen_no_free_nitrogen(self): + h=setup(sample={'oxidation_capacity_fraction':2.,'oxidation_rate_s_inv':10.,'oxidation_activation_j_mol':0.});call(h,'gas.select',gas='O2');step(h,.2);call(h,'gas.set_open',opened=False);n=h.chamber[0];o=h.chamber[1];u=h.uptake;step(h,10);self.assertEqual(n,h.chamber[0]);self.assertAlmostEqual(h.uptake-u,(o-h.chamber[1])*rt.M_O2,places=14);self.assertLessEqual(h.uptake-u,o*rt.M_O2+1e-18);self.ledger(h) + def test_10_dual_branch_finite_n2_event_exact_terminal(self): + h=setup(gas={'amount_mol':1e-9});rate=(h.sample_flow+h.balance_flow)*101325/(rt.R_GAS*298.15);call(h,'acquisition.start');step(h,.1);self.assertEqual(h.phase,'failed');self.assertEqual(h.error,'GAS_EXHAUSTED');self.assertAlmostEqual(h.elapsed,1e-9/rate,places=13);self.assertLess(h.gas_remaining['N2'],1e-24);self.assertFalse(h.thermal_enabled);self.assertEqual(h.rows[-1]['elapsed_s'],h.elapsed);self.ledger(h) + def test_11_extreme_tiny_gas_finite_termination_not_infinite(self): + h=setup(gas={'amount_mol':1e-18});call(h,'acquisition.start');step(h,3.);self.assertEqual(h.phase,'failed');self.assertLess(h.elapsed,1e-10);self.assertAlmostEqual(h.time_s,5.1);self.ledger(h) + def test_12_o2_selected_balance_n2_exhaustion_stops_heater(self): + h=setup(gas={'amount_mol':1e-9});m=quick();m['segments'][0]['gas']='O2';call(h,'method.configure',**m);call(h,'acquisition.start');step(h,.1);self.assertEqual(h.phase,'failed');self.assertGreater(h.gas_remaining['O2'],.099);self.assertFalse(h.gas_open);self.ledger(h) + def test_13_two_node_heat_energy_closed_and_cooling_destination(self): + h=setup(method=copy.deepcopy(rt.METHOD_EXAMPLE));run(h);self.assertGreater(h.mass_emitted,0);self.assertGreater(h.emitted_sensible,0);E=h.sample_energy+self._ef(h);cool(h);self.assertLess(h.sample_energy+self._ef(h),E);self.assertGreater(h.cooling_removed,0);self.ledger(h);cleanup(h);l=self.ledger(h);self.assertEqual(l['sample_present_kg'],0);self.assertAlmostEqual(l['sample_loaded_kg'],l['sample_recovered_kg']+l['sample_emitted_kg'],places=14) + def _ef(self,h):return h.plant['furnace_capacity_j_k']*(h.furnace-h.plant['ambient_k']) + def test_14_reaction_enthalpy_changes_energy_without_mass_invention(self): + h=setup(sample={'oxidation_capacity_fraction':.3,'oxidation_rate_s_inv':2.,'oxidation_activation_j_mol':0.,'oxidation_heat_j_kg':5e5});call(h,'gas.select',gas='O2');step(h,5);self.assertGreater(h.reaction_heat,0);self.assertAlmostEqual(h.reaction_heat,h.uptake*5e5,places=10);self.assertGreater(h.sample_temperature,298.15);self.ledger(h) + def test_15_stiff_thermal_and_stiff_chemistry_remain_finite(self): + h=setup(plant={'furnace_capacity_j_k':1e-5,'pan_capacity_j_k':1e-7,'sample_conductance_w_k':1000.,'controller_gain_w_k':1e5},sample={'mass_kg':1e-10,'loss_relaxation_s':1e-6});r=run(h);self.assertEqual(r['phase'],'succeeded');self.assertTrue(all(2980));self.assertLess(m['minimum_k'],303.15);self.assertGreater(m['maximum_k'],470) + with self.assertRaisesRegex(rt.ActionRejected,'PROCESSING'):rt.prepare_reference(r,False) + def test_02_measured_temperature_displacement_actual_cte(self): + h=setup();r=run(h);self.assertEqual(r['phase'],'succeeded');self.assertAlmostEqual(r['elapsed_s'],13.,places=7);self.assertEqual(len(r['rows']),131);a=dict(temperature_k=[x['temperature_k'] for x in r['rows']],displacement_m=[x['displacement_m'] for x in r['rows']],blank_m=[0.]*len(r['rows']),initial_length_m=rt.SAMPLE_EXAMPLE['length_m'],start_index=20,end_index=100);q=call(h,'analysis.cte',**a);self.assertGreater(q['linear_cte_k_inv'],5e-5);self.assertLess(q['linear_cte_k_inv'],3e-4);self.ledger(h) + def test_03_copper_physical_normalization_and_negative_low_cte(self): + h=setup(sample=copper());r=run(h);self.assertEqual(r['phase'],'succeeded');T=h.sample_temperature;ref=h.model;eps=float(np.interp(T,ref['T'],ref['y']));eps0=float(np.interp(303.15,ref['T'],ref['y']));self.assertAlmostEqual(h.natural,.01*(1+eps)/(1+eps0),places=15);self.assertNotAlmostEqual(h.natural,.01*(1+eps-eps0),places=14);self.ledger(h) + def test_04_program_force_ramp_finite_true_vs_target(self): + h=setup(sample={'elastic_stiffness_n_m':1e5,'retarded_stiffness_n_m':2e5,'relaxation_s':.5});F=h.force;call(h,'load.set',motor_force_n=.5,rate_n_s=.1);self.assertEqual(h.force,F);step(h,1);self.assertAlmostEqual(h.motor_program,.15,places=8);self.assertLess(h.force,h.motor_program);self.assertGreater(h.retarded,0);self.assertLess(h._height(),h.natural);self.ledger(h) + def test_05_kelvin_analytical_hold_recovery_and_passivity(self): + for tau in [1e-8,.001,1.,1e8]: + r=rt.kelvin_step(.1,.1,0.,1e5,2e5,tau,.1);self.assertAlmostEqual(r['retarded_m'],.1/2e5*(-math.expm1(-.1/tau)),places=14);self.assertGreaterEqual(r['dissipated_j'],0);self.assertAlmostEqual(r['compression_work_j'],r['stored_j']-r['previous_stored_j']+r['dissipated_j'],places=16) + def test_06_force_work_recovery_and_no_material_loss(self): + h=setup(sample={'elastic_stiffness_n_m':1e5,'retarded_stiffness_n_m':2e5,'relaxation_s':.1});call(h,'load.set',motor_force_n=.5,rate_n_s=1);step(h,2);stored=h._elastic();cleanup(h);l=self.ledger(h);self.assertGreater(l['mechanical_recovered_j'],stored*.5);self.assertEqual(l['sample_recovered_kg'],rt.SAMPLE_EXAMPLE['mass_kg']);self.assertEqual(l['sample_present_kg'],0) + def test_07_cancel_keeps_load_and_freezes_history(self): + h=setup();call(h,'acquisition.start');step(h,2);F=h.force;T=h.sample_temperature;x=h.retarded;call(h,'acquisition.stop');r=call(h,'acquisition.result');self.assertEqual(h.force,F);self.assertEqual(h.sample_temperature,T);self.assertEqual(h.retarded,x);step(h,2);self.assertEqual(r,call(h,'acquisition.result'));self.assertNotEqual(h.sample_temperature,T);self.ledger(h) + def test_08_cleanup_after_hot_run_exports_sensible(self): + h=setup();run(h);self.rejected(h,'furnace.set','HOT_CELL',opened=True);cleanup(h);l=self.ledger(h);self.assertGreater(l['recovered_sensible_j'],0);self.assertEqual(h.read()['panel.temperature_text'],'');self.assertEqual(h.read()['panel.displacement_text'],'') + def test_09_geometry_probe_no_load_teleport(self): + h=rt.TaTma450Runtime();call(h,'plant.configure',**rt.PLANT_EXAMPLE);call(h,'power.set',enabled=True);call(h,'sample.load',**rt.SAMPLE_EXAMPLE);q=h.probe;call(h,'probe.contact',engaged=True);self.assertEqual(h.probe,q);step(h,.1);self.assertAlmostEqual(h.probe,q-.0002);self.assertEqual(h.force,0);wait(h,lambda:h.probe_mode=='contact');step(h,.5);self.assertAlmostEqual(h.probe,h._height(),places=14) + def test_10_probe_guard_and_manual_deadweight(self): + h=rt.TaTma450Runtime();call(h,'plant.configure',**rt.PLANT_EXAMPLE);call(h,'power.set',enabled=True);call(h,'load.deadweight',force_n=1.);call(h,'probe.select',kind='penetration');call(h,'probe.select',kind='expansion');call(h,'sample.load',**rt.SAMPLE_EXAMPLE);self.rejected(h,'probe.move','PROBE_COLLISION',position_m=.001);call(h,'probe.move',position_m=.029);wait(h,lambda:not h.read()['probe.moving']);call(h,'probe.contact',engaged=True);wait(h,lambda:h.probe_mode=='contact');step(h,.5);self.assertAlmostEqual(h.force,1.05,places=7);self.rejected(h,'load.deadweight','LIFT',force_n=.5);self.rejected(h,'load.set','INVALID_ARGUMENT',motor_force_n=1.01,rate_n_s=.1);self.ledger(h) + def test_11_pure_reads_analysis_do_not_take_time_or_owner(self): + h=setup();before=state(h);h.read();h.describe();call(h,'reference.query',reference_id=rt.SAMPLE_EXAMPLE['reference_id']);call(h,'analysis.cte',**rt.CAPS['analysis.cte']['example_arguments']);call(h,'acquisition.result');call(h,'ledger.read');self.assertEqual(before,state(h)) + def test_12_observation_gain_and_calibration(self): + h=setup(plant={'force_gain':.8,'displacement_gain':1.2});r=run(h);self.assertAlmostEqual(r['rows'][-1]['force_n'],.04,places=6);D=r['rows'][-1]['displacement_m'];call(h,'sensor.calibrate',**dict(rt.CALIBRATION_EXAMPLE,force_gain_correction=1/.8,displacement_gain_correction=1/1.2));self.assertAlmostEqual(h.read()['force.indicated_n'],.05,places=6);self.assertAlmostEqual(h.read()['displacement.indicated_m'],D/1.2,delta=1e-9) + def test_13_observation_overload_is_unavailable(self): + h=setup(plant={'force_gain':100.});self.assertIsNone(h.read()['force.indicated_n']);r=run(h);self.assertTrue(all(x['force_n'] is None for x in r['rows']));self.assertLess(h.force,.1) + def test_14_furnace_setpoint_not_temperature(self): + h=setup();call(h,'thermal.set_temperature',temperature_k=323.15,rate_k_s=2.5);self.assertAlmostEqual(h.furnace,303.15,places=6);step(h,1);self.assertAlmostEqual(h.target,305.65,places=7);self.assertLess(h.furnace,h.target);self.assertLess(h.sample_temperature,h.furnace);self.ledger(h) + def test_15_no_cooler_domain_rate_bounds_atomic(self): + h=setup();self.rejected(h,'thermal.set_temperature','COOLER_TEMPERATURE_RANGE',temperature_k=293.15,rate_k_s=1.);self.rejected(h,'thermal.set_temperature','INVALID_ARGUMENT',temperature_k=323.15,rate_k_s=2.500001);self.rejected(h,'thermal.set_temperature','INVALID_ARGUMENT',temperature_k=323.15,rate_k_s=.0001);self.rejected(h,'thermal.set_temperature','REFERENCE_TEMPERATURE_RANGE',temperature_k=600.,rate_k_s=1.) + def test_16_ln2_finite_cooling_and_ledger(self): + h=setup(sample=copper(),plant={'cooler':'LN2'});call(h,'thermal.set_temperature',temperature_k=293.15,rate_k_s=1.);step(h,20);self.assertLess(h.sample_temperature,298.15);self.assertGreater(h.coolant_used,0);self.assertGreater(h.cooling_removed,0);self.ledger(h);cleanup(h);self.ledger(h) + def test_17_tiny_ln2_terminal_not_infinite(self): + h=setup(sample=copper(),plant={'cooler':'LN2'});call(h,'coolant.unload');call(h,'coolant.load',amount_kg=1e-12,accept_engineering_latent=True);m=copy.deepcopy(rt.METHOD_EXAMPLE);m['segments'][0]['target_temperature_k']=293.15;call(h,'method.configure',**m);call(h,'acquisition.start');step(h,.1);self.assertEqual(h.phase,'failed');self.assertEqual(h.error,'COOLANT_EXHAUSTED');self.assertEqual(h.coolant_remaining,0);self.ledger(h) + def test_18_finite_gas_last_tick_snapshot(self): + h=setup();call(h,'gas.set_open',opened=False);call(h,'gas.unload',port=1);call(h,'gas.load',**dict(rt.GAS_EXAMPLE,amount_mol=1e-9));call(h,'gas.set_open',opened=True);call(h,'acquisition.start');step(h,.1);self.assertEqual(h.phase,'failed');self.assertEqual(h.error,'GAS_EXHAUSTED');self.assertAlmostEqual(h.elapsed,1e-9/(100e-6/60*101325/(rt.R_GAS*298.15)),places=12);self.assertEqual(h.rows[-1]['elapsed_s'],h.elapsed);self.ledger(h) + def test_19_subfloating_gas_finite_termination(self): + h=setup();call(h,'gas.set_open',opened=False);call(h,'gas.unload',port=1);call(h,'gas.load',**dict(rt.GAS_EXAMPLE,amount_mol=1e-18));call(h,'gas.set_open',opened=True);call(h,'acquisition.start');step(h,1);self.assertEqual(h.error,'GAS_EXHAUSTED');self.assertLess(h.elapsed,1e-10);self.ledger(h) + def test_20_dual_gas_selection_and_inventory(self): + h=setup();call(h,'gas.load',**dict(rt.GAS_EXAMPLE,port=2,gas='He')) if not h.gas_open else None + self.rejected(h,'gas.select','GAS_VALVE_OPEN',port=2);call(h,'gas.set_open',opened=False);call(h,'gas.load',**dict(rt.GAS_EXAMPLE,port=2,gas='He'));call(h,'gas.select',port=2);call(h,'gas.set_open',opened=True);n=h.gas_remaining[1];step(h,1);self.assertEqual(h.gas_remaining[1],n);self.assertGreater(h.gas_used[2],0);cleanup(h);self.ledger(h) + def test_21_flow_minimum_and_reference_state(self): + h=setup();call(h,'gas.set_flow',flow_m3_s=50e-6/60);self.rejected(h,'acquisition.start','PURGE_NOT_READY');call(h,'gas.set_flow',flow_m3_s=100e-6/60);call(h,'thermal.set_temperature',temperature_k=313.15,rate_k_s=.1);self.rejected(h,'gas.set_flow','PURGE_FLOW_TOO_LOW',flow_m3_s=0.);call(h,'gas.set_open',opened=False);self.assertFalse(h.thermal_enabled) + def test_22_sample_assumptions_and_unknown_reference_atomic(self): + h=rt.TaTma450Runtime();call(h,'plant.configure',**rt.PLANT_EXAMPLE) + for kw,err in [({'accept_condition_transfer':False},'CONDITION_TRANSFER'),({'accept_engineering_compliance':False},'MODEL_NOT_ACCEPTED'),({'accept_reference_processing':False},'REFERENCE_PROCESSING'),({'reference_id':'missing'},'INVALID_REFERENCE')]:self.rejected(h,'sample.load',err,**dict(rt.SAMPLE_EXAMPLE,**kw)) + def test_23_source_temperature_and_geometry_atomic(self): + h=rt.TaTma450Runtime();call(h,'plant.configure',**dict(rt.PLANT_EXAMPLE,ambient_k=298.15));self.rejected(h,'sample.load','REFERENCE_TEMPERATURE_RANGE',**rt.SAMPLE_EXAMPLE);self.rejected(h,'sample.load','INVALID_ARGUMENT',**dict(rt.SAMPLE_EXAMPLE,length_m=.027));self.rejected(h,'sample.load','INVALID_ARGUMENT',**dict(rt.SAMPLE_EXAMPLE,diameter_m=.011)) + def test_24_cte_negative_blank_and_external_length(self): + h=rt.TaTma450Runtime();a=copy.deepcopy(rt.CAPS['analysis.cte']['example_arguments']);a['displacement_m']=[0.,-1e-6,-2e-6];a['blank_m']=[0.,1e-7,2e-7];r=call(h,'analysis.cte',**a);self.assertAlmostEqual(r['linear_cte_k_inv'],-11e-6,places=13);a['initial_length_m']=.02;r=call(h,'analysis.cte',**a);self.assertAlmostEqual(r['linear_cte_k_inv'],-5.5e-6,places=13) + def test_25_softening_bracket_and_boundary_null(self): + h=rt.TaTma450Runtime();a=copy.deepcopy(rt.CAPS['analysis.softening']['example_arguments']);r=call(h,'analysis.softening',**a);self.assertAlmostEqual(r['softening_temperature_k'],330.,places=8);a['displacement_m']=[0.,1e-6,2e-6,3e-6,4e-6,5e-6,6e-6];r=call(h,'analysis.softening',**a);self.assertFalse(r['bracketed']);self.assertIsNone(r['softening_temperature_k']) + def test_26_analysis_rejects_missing_reversed_or_bad_windows(self): + h=rt.TaTma450Runtime();a=copy.deepcopy(rt.CAPS['analysis.cte']['example_arguments']);self.rejected(h,'analysis.cte','ANALYSIS_DATA',**dict(a,blank_m=[0.,0.,0.,0.]));self.rejected(h,'analysis.cte','ANALYSIS_TEMPERATURE_WINDOW',**dict(a,temperature_k=[300.,320.,310.]));self.rejected(h,'analysis.cte','INVALID_ARGUMENT',**dict(a,initial_length_m=0.));b=copy.deepcopy(rt.CAPS['analysis.softening']['example_arguments']);self.rejected(h,'analysis.softening','ANALYSIS_WINDOWS',**dict(b,first_window=[0,4])) + def test_27_session_auth_principals_and_no_hidden_state(self): + h=setup();s=h.session();d=s.describe(instance_id=h.instance_id);self.assertNotIn('sample.load',d['capabilities']);self.assertNotIn('truth.force_n',d['state_slots']);self.assertNotIn('sample.height_m',d['state_slots']);self.assertNotIn('probe.position_m',d['state_slots']);r=s.invoke(instance_id=h.instance_id,capability_id='ledger.read',arguments={},request_id='deny');self.assertEqual(r['error']['code'],'ACCESS_DENIED') + with self.assertRaises(rt.ActionRejected):s.read(instance_id=h.instance_id,state_ids=['truth.force_n']) + with self.assertRaises(rt.ActionRejected):h.session('fake') + with self.assertRaises(rt.ActionRejected):s.write(instance_id=h.instance_id,state_id='thermal.target_k',value=350,request_id='w') + def test_28_owner_result_poll_cancel(self): + h=setup();h.register_principal('other');a=h.session();b=h.session('other');r=a.invoke(instance_id=h.instance_id,capability_id='acquisition.start',arguments={},request_id='s');op=r['operation_id'];self.assertEqual(r['status'],'accepted') + for cap in ['acquisition.result','acquisition.stop']:self.assertEqual(b.invoke(instance_id=h.instance_id,capability_id=cap,arguments={},request_id=cap)['error']['code'],'ACCESS_DENIED') + for fn in [lambda:b.poll(op),lambda:b.cancel(op,'x')]: + with self.assertRaises(rt.ActionRejected):fn() + self.assertEqual(a.cancel(op,'c')['status'],'succeeded');self.assertEqual(a.poll(op)['status'],'cancelled') + def test_29_request_dedup_conflict_and_cancel_idempotence(self): + h=setup();s=h.session();kw=dict(instance_id=h.instance_id,capability_id='acquisition.start',arguments={},request_id='s');a=s.invoke(**kw);self.assertEqual(a,s.invoke(**kw));self.assertEqual(h._counter,1);self.assertEqual(s.invoke(**dict(kw,capability_id='acquisition.result'))['error']['code'],'REQUEST_CONFLICT');c=s.cancel(a['operation_id'],'c');self.assertEqual(c,s.cancel(a['operation_id'],'c')) + def test_30_frozen_previous_operation_and_source(self): + h=setup();s=h.session();a=s.invoke(instance_id=h.instance_id,capability_id='acquisition.start',arguments={},request_id='1');step(h,.2);s.cancel(a['operation_id'],'cancel');old=s.poll(a['operation_id']);h.reference['name']='mutated';h.operation_source='mutated';step(h,.1);m=copy.deepcopy(rt.METHOD_EXAMPLE);m['start_temperature_k']=h.sample_temperature;call(h,'method.configure',**m);b=s.invoke(instance_id=h.instance_id,capability_id='acquisition.start',arguments={},request_id='2');self.assertEqual(b['status'],'accepted');self.assertEqual(old,s.poll(a['operation_id']));s.cancel(b['operation_id'],'cancel2') + def test_31_fixed_clock_partition_and_two_instance(self): + a=setup(instance='a');b=setup(instance='b');call(a,'acquisition.start');call(b,'acquisition.start');step(a,.3) + for _ in range(6):step(b,.05) + self.assertEqual(a.read(),b.read());before=b.read();step(a,.1);self.assertEqual(before,b.read());self.assertNotEqual(a.time_s,b.time_s) + def test_32_sim_step_actual_api_and_zero_noop(self): + h=setup();t=h.time_s;r=call(h,'sim.step',dt_s=.1);self.assertAlmostEqual(r['time_s'],t+.1);before=state(h);call(h,'sim.step',dt_s=0.);self.assertEqual(before,state(h));self.rejected(h,'sim.step','INVALID_ARGUMENT',dt_s=-1.) + def test_33_strict_inputs_bool_nan_extra_unknown(self): + h=setup() + for a in [dict(motor_force_n=True,rate_n_s=.1),dict(motor_force_n=float('nan'),rate_n_s=.1),dict(motor_force_n=.1,rate_n_s=.1,extra=1)]:self.rejected(h,'load.set','INVALID_ARGUMENT',**a) + self.rejected(h,'made.up','UNKNOWN_CAPABILITY');self.rejected(h,'plant.configure','INITIALIZATION_ONLY',**rt.PLANT_EXAMPLE) + def test_34_em_modes_and_unimplemented_not_false_success(self): + h=setup();self.assertIn('isostrain.native',rt.UNSUPPORTED) + for cap in rt.UNSUPPORTED:self.rejected(h,cap,'UNSUPPORTED') + def test_35_software_stop_and_explicit_reset(self): + h=setup();call(h,'acquisition.start');step(h,.2);F=h.force;call(h,'emergency.stop');self.assertEqual(h.error,'SOFTWARE_STOP');self.assertEqual(h.force,F);self.assertFalse(h.gas_open);self.rejected(h,'power.set','EMERGENCY_LATCHED',enabled=True);call(h,'emergency.reset');self.assertFalse(h.emergency);self.assertEqual(h.phase,'failed');self.ledger(h) + def test_36_method_atomic_clock_and_timeout(self): + h=setup();self.rejected(h,'method.configure','SAMPLE_CLOCK_ALIGNMENT',**dict(rt.METHOD_EXAMPLE,sample_interval_s=.15));self.rejected(h,'method.configure','CONDITION_TRANSFER',**dict(rt.METHOD_EXAMPLE,accept_condition_transfer=False));m=copy.deepcopy(rt.METHOD_EXAMPLE);m['timeout_s']=.25;call(h,'method.configure',**m);r=run(h);self.assertEqual(r['error_code'],'TIMEOUT');self.assertAlmostEqual(r['elapsed_s'],.25,places=9) + def test_37_multiple_segments_and_zero_hold(self): + h=setup();m=copy.deepcopy(rt.METHOD_EXAMPLE);m['segments']=[dict(m['segments'][0],target_temperature_k=305.65,hold_s=0.),dict(m['segments'][0],target_temperature_k=308.15,hold_s=.3)];call(h,'method.configure',**m);r=run(h);self.assertEqual(r['phase'],'succeeded');self.assertAlmostEqual(r['elapsed_s'],2.3,places=8);self.assertEqual(r['rows'][-1]['segment_index'],1);self.ledger(h) + def test_38_stiff_heat_capacity_implicit_stable(self): + p=dict(rt.PLANT_EXAMPLE,furnace_capacity_j_k=1e-5,fixture_capacity_j_k=1e-7,sample_conductance_w_k=1000.,controller_gain_w_k=1e5);r=rt.coupled_thermal_step(p,303.15,0.,1e-7,.1,310.,True,False,0.,0.,0.,0.,lambda T:0.);self.assertTrue(303.15<=r['sample_k']<=310.);error=r['heater_j']-r['ambient_j']-1e-5*(r['furnace_k']-303.15)-r['sample_energy_j'];self.assertLess(abs(error),1e-9) + def test_39_force_domain_failure_keeps_energy_and_can_recover(self): + h=setup(sample={'elastic_stiffness_n_m':500.,'retarded_stiffness_n_m':1e10,'maximum_compression_fraction':.1});call(h,'load.set',motor_force_n=1.,rate_n_s=1.);step(h,1);self.assertEqual(h.model_fault,'SAMPLE_COMPRESSION_DOMAIN');self.assertGreater(h._height(),0);self.ledger(h);cleanup(h);self.ledger(h) + def test_40_schema_actual_states_returns_and_json(self): + h=setup();run(h);meta=h.describe();self.assertEqual(set(h.read()),set(meta['state_slots'])) + for key,value in h.read().items():rt.validate(meta['state_slots'][key]['value_schema'],value) + json.dumps(h.read(),allow_nan=False);json.dumps(call(h,'acquisition.result'),allow_nan=False);self.assertEqual(meta['catalog_id'],'CHEM-134');self.assertEqual(meta['asset_type_id'],'instrument.ta_tma450') + def test_41_preconfiguration_and_cold_manual_interlocks(self): + h=rt.TaTma450Runtime();h.step(0);call(h,'sim.step',dt_s=.1);self.assertIsNone(h.plant);self.rejected(h,'power.set','NOT_CONFIGURED',enabled=True);call(h,'plant.configure',**rt.PLANT_EXAMPLE);self.rejected(h,'probe.move','POWER_OFF',position_m=.02);call(h,'power.set',enabled=True);call(h,'furnace.set',opened=False);self.rejected(h,'sample.load','MECHANISM_MOVING',**rt.SAMPLE_EXAMPLE) + def test_42_force_and_cte_analysis_not_ground_truth_answers(self): + h=setup(plant={'frame_drift_m_k':1e-6});r=run(h);a=dict(temperature_k=[x['temperature_k'] for x in r['rows']],displacement_m=[x['displacement_m'] for x in r['rows']],blank_m=[0.]*len(r['rows']),initial_length_m=rt.SAMPLE_EXAMPLE['length_m'],start_index=20,end_index=100);q=call(h,'analysis.cte',**a);self.assertGreater(q['linear_cte_k_inv'],5e-4);a['blank_m']=[1e-6*(x['furnace_k']-r['rows'][0]['furnace_k']) for x in r['rows']];q=call(h,'analysis.cte',**a);self.assertLess(q['linear_cte_k_inv'],3e-4) + def test_43_unconfigured_host_clock_then_explicit_configuration(self): + a=rt.TaTma450Runtime('idle_a');b=rt.TaTma450Runtime('idle_b');initial=a.read();step(a,.35) + for _ in range(7):step(b,.05) + self.assertEqual(a.read(),b.read());self.assertAlmostEqual(a.time_s,.3);self.assertIsNone(a.plant);self.assertFalse(a.power);self.assertFalse(a.gases);self.assertEqual(a.gas_used,{1:0.,2:0.});self.assertEqual({k:v for k,v in a.read().items() if k!='clock.time_s'},{k:v for k,v in initial.items() if k!='clock.time_s'});self.rejected(a,'power.set','NOT_CONFIGURED',enabled=True) + call(a,'plant.configure',**rt.PLANT_EXAMPLE);self.assertAlmostEqual(a.time_s,.3);step(a,.05);self.assertAlmostEqual(a.time_s,.4);self.assertAlmostEqual(a.sample_temperature,303.15);self.assertIsNone(b.plant);self.assertAlmostEqual(b.time_s,.3);self.ledger(a) +if __name__=='__main__':unittest.main() diff --git a/tests/test_asset_thermo_ibrightfl1500.py b/tests/test_asset_thermo_ibrightfl1500.py new file mode 100644 index 0000000000000000000000000000000000000000..322333fa0c31ada250ed2faddc2f186aea1f7e2c --- /dev/null +++ b/tests/test_asset_thermo_ibrightfl1500.py @@ -0,0 +1,1135 @@ +"""tests for CHEM-165 thermo_ibrightfl1500: python3 -m unittest tests/test_asset_thermo_ibrightfl1500.py + +Topics (pipeline.md): set points only write targets, read/describe are pure, rejected preconditions leave the state unchanged, two instances are +isolated, agent/evaluator truth isolation, conservation (energy ledger, exposure time, photons), real return values validated against the declared +schemas (asset_tool validate_value), asynchronous completion and cancellation, host-step independence, declared immediate and on_step effects over +scenario states; plus the imaging physics against the manufacturer data and first principles: 22.5 x 18.0 cm field, 16-bit saturation at 65 535, +binning 1-8 and 1-2x optical / digital zoom (object-side NA of the 25 mm f/0.95 lens), CCD cooling before capture, FPbase spectra with the FL1500 +filter sets (channel mismatch, EX3/EX4 crosstalk), Smart Exposure to 80 % of full scale, linear quantification of dilution series (fluorescence, +chemiluminescence, visible Coomassie), chemiluminescent substrate decay and Smart Range HDR, nucleic-acid stain and free-stain background, automatic +alignment / zoom and the camera lock, band analysis outputs of the user guide (volume, density, local background, Rf, purity, molar mass from a +marker), faults (LED failure, smudged glass, filter wheel jam, blocked drawer, mains loss during a capture). +""" +import copy +import json +import math +import sys +import unittest +from pathlib import Path + +import numpy as np + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / 'scripts')) +sys.path.insert(0, str(ROOT / 'skills/chemistry-lab-assets/scripts')) +from asset_runtime import thermo_ibrightfl1500 as rt # noqa: E402 +import asset_tool # noqa: E402 + +CHECKS, PROCESS_EVIDENCE, REJECTIONS = [], {}, {} +_META = {} +INST = 'imager_01' + + +def _meta(): + if not _META: + _META.update(rt.export_thermo_ibrightfl1500_contract_metadata()) + return _META + + +def _changed(a, b): + return json.dumps(a, sort_keys=True, default=str) != json.dumps(b, sort_keys=True, default=str) + + +_orig_invoke = rt.ThermoIbrightFl1500Runtime.invoke + + +def _instrumented_invoke(self, capability_id, **a): + """Every successful call is checked against its declared output schema and immediate state effects (a call does not advance time); every + rejection code is recorded for the declaration check.""" + before = self.read('evaluator') if capability_id != 'sim.step' else None + t0 = self.t + try: + out = _orig_invoke(self, capability_id, **a) + except rt.ActionRejected as exc: + REJECTIONS.setdefault(capability_id, set()).add(str(exc)) + raise + meta = _meta()['capabilities'][capability_id] + errs = asset_tool.validate_value(out, meta['output_schema']) + if errs: + raise AssertionError(f'{capability_id} output violates its schema: {errs[:3]}') + if before is not None: + assert self.t == t0, capability_id + after = self.read('evaluator') + undeclared = {k for k in after if _changed(before[k], after[k])} - set(rt.EFFECTS.get(capability_id, [])) + if undeclared: + raise AssertionError(f'{capability_id} changed undeclared state immediately: {sorted(undeclared)}') + PROCESS_EVIDENCE.setdefault(capability_id, []).append(dict(arguments=copy.deepcopy(a), result_keys=sorted(out))) + return out + + +rt.ThermoIbrightFl1500Runtime.invoke = _instrumented_invoke + + +def check(cid, **detail): + CHECKS.append(dict(check=cid, status='passed', **detail)) + + +def powered(seed=1, cool=True, **plant): + h = rt.ThermoIbrightFl1500Runtime() + h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, noise_seed=seed, **plant)) + h.invoke('power.set', enabled=True) + if cool: + h.step(300.0) + return h + + +def blot(sid='blot', n=8, label='alexa_fluor_647', base=2.5e-15, factor=2.0, support='pvdf_lf', y=0.020, second=None, W=0.085, H=0.065, **kw): + lanes = [] + for i in range(n): + bands = [dict(y_m=y, sigma_m=0.0006, label=label, amount_mol=base * factor ** i)] + if second: + bands.append(dict(second)) + lanes.append(dict(x_m=0.008 + 0.0095 * i, width_m=0.006, bands=bands)) + return dict(sample_id=sid, support=support, width_m=W, height_m=H, lanes=lanes, **kw) + + +def loaded(sample, skew=0.0, seed=1, mode='fluorescent_blots', channels=(('EX3', 'alexa_fluor_647'),), **plant): + h = powered(seed, **plant) + h.invoke('sample.provide', **sample) + h.invoke('drawer.open') + h.step(5.0) + h.invoke('sample.place', sample_id=sample['sample_id'], skew_rad=skew) + h.invoke('drawer.close') + h.step(5.0) + h.invoke('mode.select', mode=mode) + if channels is not None and mode in ('fluorescent_blots', 'universal'): + h.invoke('channels.set', channels=[dict(channel=c, dye=d) for c, d in channels]) + return h + + +def smart_capture(h, hdr=False, smart=True): + if smart: + h.invoke('smart_exposure.run') + h.step(120.0) + h.invoke('capture.run', hdr=hdr) + h.step(1200.0) + return max(h.images) + + +def first_band_volumes(an): + return [l['bands'][0]['lbc_volume'] if l['bands'] else None for l in an['lanes']] + + +class ContractAndLibrary(unittest.TestCase): + def test_module_identity_and_export(self): + meta = rt.export_thermo_ibrightfl1500_contract_metadata() + self.assertEqual((rt.ASSET_TYPE_ID, rt.CATALOG_ID), ('instrument.thermo_ibrightfl1500', 'CHEM-165')) + for k, c in meta['capabilities'].items(): + for sname in ('input_schema', 'output_schema'): + self.assertEqual(asset_tool.lint_schema(c[sname]) if hasattr(asset_tool, 'lint_schema') else [], [], (k, sname)) + self.assertEqual(asset_tool.validate_value(c['example_arguments'], c['input_schema']), [], k) + self.assertEqual(set(meta['state_slots']), set(rt.SLOTS)) + for k, v in rt.SLOTS.items(): + self.assertFalse(v['origin'] == 'process_truth' and v['visibility'] == 'agent', k) + check('export', capabilities=len(meta['capabilities']), slots=len(meta['state_slots'])) + + def test_fluorophore_library(self): + lib = rt.fluor_lib() + S = lib['substances'] + self.assertGreaterEqual(len(S), 50) + self.assertAlmostEqual(S['alexa_fluor_647']['ext_coeff_m2_mol'], 27000.0, delta=1.0) # 270 000 M-1 cm-1 (FPbase) + self.assertAlmostEqual(S['alexa_fluor_647']['quantum_yield'], 0.33, delta=1e-9) + self.assertIn('CC BY-SA', json.dumps(lib['license'])) + g = rt._grid() + self.assertEqual(len(S['alexa_fluor_488']['spectra']['em']), len(g)) + em = np.array(S['alexa_fluor_488']['spectra']['em']) + self.assertTrue(505e-9 < g[int(np.argmax(em))] < 530e-9) # AF488 emission maximum ~517 nm + check('library', dyes=len(S)) + + def test_optics_geometry(self): + g1, g2 = rt.working_geometry(1.0), rt.working_geometry(2.0) + self.assertAlmostEqual(rt.SENSOR_PX[0] * g1['object_pixel_m'], 0.225, delta=1e-12) # 22.5 cm field at zoom 1 + self.assertAlmostEqual(g1['object_pixel_m'], 66.4e-6, delta=0.2e-6) + self.assertTrue(0.02 < g1['na'] < 0.04) + self.assertAlmostEqual(g2['collection'] / g1['collection'], 3.6, delta=0.15) # moving the camera closer collects more light + h = powered() + self.assertTrue(np.allclose(h.read()['camera.field_of_view_m'], [0.225, 0.18], atol=2e-4)) # 3388 x 2712 pixels: 22.5 x 18.01 cm + h.invoke('camera.set', binning=1, zoom=4.0, auto_focus=True, lock=False) + fov = h.read()['camera.field_of_view_m'] + self.assertAlmostEqual(fov[0], 0.225 / 4, delta=1e-4) + self.assertAlmostEqual(h._geometry()['obj_px_m'], g2['object_pixel_m'], delta=1e-12) # digital zoom crops: pixel size of the 2x optics + check('optics', na_zoom1=g1['na'], collection_ratio=g2['collection'] / g1['collection']) + + +class Imaging(unittest.TestCase): + def test_ccd_cooling_before_capture(self): + h = powered(cool=False) + h.invoke('mode.select', mode='chemi_blots') + self.assertFalse(h.read()['camera.ready']) + with self.assertRaises(rt.ActionRejected): + h.invoke('capture.run', hdr=False) + t = 0.0 + while not h.read()['camera.ready']: + h.step(1.0) + t += 1.0 + self.assertTrue(200.0 <= t <= 300.0, t) # 90 s x ln(30 K / 2 K) = 244 s + self.assertAlmostEqual(h.ccd_temperature(), h._room() - rt.CCD_DELTA_K + 2.0, delta=0.05) + h.invoke('capture.run', hdr=False) + check('ccd_cooling', ready_after_s=t) + + def test_fluorescence_dilution_series_and_quantification(self): + h = loaded(blot()) + iid = smart_capture(h) + an = h.invoke('image.analyze', image_id=iid, channel='EX3', sensitivity=0.5) + self.assertEqual(len(an['lanes']), 8) + v = first_band_volumes(an) + for a, b in zip(v, v[1:]): + self.assertAlmostEqual(b / a, 2.0, delta=0.12) # linear 2-fold series + for l in an['lanes']: + self.assertAlmostEqual(l['bands'][0]['rf'], 0.020 / 0.065, delta=0.01) + self.assertAlmostEqual(l['bands'][0]['band_purity_pct'], 100.0, delta=1e-9) + q = h.invoke('image.quantify', image_id=iid, channel='EX3', standards=[dict(lane=i, band=1, amount_kg=1e-10 * 2 ** (i - 1)) for i in (1, 2, 3)], sensitivity=0.5) + est = {u['lane']: u['amount_kg'] for u in q['unknowns']} + for lane in range(4, 9): + self.assertAlmostEqual(est[lane] / (1e-10 * 2 ** (lane - 1)), 1.0, delta=0.05) + self.assertEqual({u['flag'] for u in q['unknowns']}, {'above_range'}) + self.assertGreater(q['r2'], 0.999) + check('fluorescence_quant', ratios=[b / a for a, b in zip(v, v[1:])], r2=q['r2']) + + def test_smart_exposure_puts_the_brightest_pixel_near_80_percent(self): + for ch, dye in (('EX3', 'alexa_fluor_647'), ('EX2', 'alexa_fluor_555'), ('EX5', 'irdye_800cw')): + h = loaded(blot(label=dye), channels=((ch, dye),)) + iid = smart_capture(h) + mx = h.invoke('measurement.result', image_id=iid)['channels'][0]['max_adu'] + self.assertTrue(0.65 * rt.ADC_MAX < mx < 0.95 * rt.ADC_MAX, (ch, mx)) + check('smart_exposure') + + def test_saturation_and_binning(self): + h = loaded(blot()) + h.invoke('exposure.set', channel='EX3', exposure_s=60.0) + iid = smart_capture(h, smart=False) + r = h.invoke('measurement.result', image_id=iid) + self.assertGreater(r['channels'][0]['saturated_px'], 0) + self.assertTrue(any(w.startswith('saturated_pixels') for w in r['warnings'])) + an = h.invoke('image.analyze', image_id=iid, channel='EX3', sensitivity=0.5) + self.assertTrue(an['lanes'][-1]['bands'][0]['saturated']) + self.assertFalse(an['lanes'][0]['bands'][0]['saturated']) + peaks = {} + for b in (1, 2, 4): + k = loaded(blot()) + k.invoke('camera.set', binning=b, zoom=k.camera['zoom'], auto_focus=True, lock=False) + k.invoke('exposure.set', channel='EX3', exposure_s=0.5) + peaks[b] = k.invoke('measurement.result', image_id=smart_capture(k, smart=False))['channels'][0]['max_adu'] - rt.BIAS_ADU + self.assertAlmostEqual(peaks[2] / peaks[1], 4.0, delta=0.6) # binning sums the charge of b x b pixels + self.assertAlmostEqual(peaks[4] / peaks[2], 4.0, delta=0.6) + check('saturation_binning', peaks=peaks) + + def test_filter_sets_crosstalk_and_mismatch(self): + h = loaded(blot(), channels=(('EX3', 'alexa_fluor_647'), ('EX4', 'alexa_fluor_680'))) + self.assertIn('ex3_ex4_crosstalk', h.records and [] or h.invoke('channels.set', channels=[dict(channel='EX3', dye='alexa_fluor_647'), + dict(channel='EX4', dye='alexa_fluor_680')])['warnings']) + iid = smart_capture(h) + a4 = h.invoke('image.analyze', image_id=iid, channel='EX4', sensitivity=0.6) + self.assertGreaterEqual(len(a4['lanes']), 4) # AF647 bleeds into the EX4/EM4 channel + self.assertIn('ex3_ex4_crosstalk', h.invoke('measurement.result', image_id=iid)['warnings']) + with self.assertRaises(rt.ActionRejected): + h.invoke('channels.set', channels=[dict(channel='EX5', dye='alexa_fluor_488')]) # AF488 is not seen through 800-850 nm + with self.assertRaises(rt.ActionRejected): + h.invoke('channels.set', channels=[dict(channel=c, dye=d) for c, d in (('EX1', 'alexa_fluor_488'), ('EX2', 'alexa_fluor_555'), ('EX3', 'alexa_fluor_647'), + ('EX4', 'alexa_fluor_680'), ('EX5', 'irdye_800cw'))]) + self.assertGreater(rt.dye_rate('alexa_fluor_647', 'EX3'), 5 * rt.dye_rate('alexa_fluor_647', 'EX1')) + check('filters') + + def test_chemiluminescence_decay_and_hdr(self): + s = blot(label='hrp', base=1e-18, factor=3.0, support='nitrocellulose', substrate='supersignal_west_pico_plus') + h = loaded(s, mode='chemi_blots') + h.invoke('exposure.set', channel='CHEMI', exposure_s=10.0) + plain = smart_capture(h, smart=False) + h.invoke('capture.run', hdr=True) + h.step(600.0) + hdr = max(h.images) + rp, rh = h.invoke('measurement.result', image_id=plain), h.invoke('measurement.result', image_id=hdr) + self.assertGreater(rp['channels'][0]['saturated_px'], 0) + self.assertEqual(rh['channels'][0]['saturated_px'], 0) # Smart Range HDR: no saturated pixels, still 16-bit + vh = first_band_volumes(h.invoke('image.analyze', image_id=hdr, channel='CHEMI', sensitivity=0.7)) + strong = [x for x in vh if x][-3:] + for a, b in zip(strong, strong[1:]): + self.assertAlmostEqual(b / a, 3.0, delta=0.25) # linear across the lanes that saturate without HDR + k = loaded(s, mode='chemi_blots') + k.invoke('exposure.set', channel='CHEMI', exposure_s=1.0) + i1 = smart_capture(k, smart=False) + t1 = k.images[i1]['captured_s'] + early = k.invoke('image.analyze', image_id=i1, channel='CHEMI', sensitivity=0.7) + k.step(6 * 3600.0) + i2 = smart_capture(k, smart=False) + late = k.invoke('image.analyze', image_id=i2, channel='CHEMI', sensitivity=0.7) + self.assertEqual(k.invoke('measurement.result', image_id=i1)['channels'][0]['saturated_px'], 0) + e, l = first_band_volumes(early)[-1], first_band_volumes(late)[-1] + expect = math.exp(-(k.images[i2]['captured_s'] - t1) / rt.SUBSTRATE_TAU_S['supersignal_west_pico_plus']) + self.assertAlmostEqual(l / e, expect, delta=0.04) # substrate decay + with self.assertRaises(rt.ActionRejected): + loaded(blot()).invoke('capture.run', hdr=True) + check('chemi', decay=l / e) + + def test_visible_coomassie_gel_and_marker_molar_mass(self): + mk = [250, 150, 100, 75, 50, 37, 25, 20, 15, 10] + rf = [0.08, 0.15, 0.22, 0.30, 0.40, 0.50, 0.62, 0.70, 0.80, 0.90] + lanes = [dict(x_m=0.008, width_m=0.005, bands=[dict(y_m=0.068 * f, sigma_m=0.0006, label='coomassie_r250', amount_kg=0.5e-9, molar_mass_kg_mol=float(k)) + for k, f in zip(mk, rf)])] + for i in range(1, 6): + lanes.append(dict(x_m=0.008 + 0.0085 * i, width_m=0.005, bands=[dict(y_m=0.068 * 0.35, sigma_m=0.0007, label='coomassie_r250', amount_kg=0.1e-9 * i)])) + h = loaded(dict(sample_id='gel', support='polyacrylamide_gel', width_m=0.086, height_m=0.068, lanes=lanes), mode='protein_gels') + iid = smart_capture(h) + an = h.invoke('image.analyze', image_id=iid, channel='VISIBLE', sensitivity=0.6, marker_lane=1, marker_molar_mass_kg_mol=[float(k) for k in mk]) + self.assertTrue(an['inverted']) + self.assertEqual(len(an['lanes']), 6) + self.assertEqual(len(an['lanes'][0]['bands']), 10) + v = first_band_volumes(an)[1:] + self.assertTrue(all(b > a for a, b in zip(v, v[1:]))) # absorbed light grows with the stained mass + self.assertAlmostEqual(v[1] / v[0], 2.0, delta=0.2) + for l in an['lanes'][1:]: + self.assertAlmostEqual(l['bands'][0]['molar_mass_kg_mol'], 10 ** (math.log10(75) + 0.5 * math.log10(50 / 75)), delta=2.0) + check('coomassie', volumes=v) + + def test_nucleic_acid_gel_and_free_stain(self): + lanes = [dict(x_m=0.008 + 0.0095 * i, width_m=0.006, bands=[dict(y_m=0.030, sigma_m=0.0008, label='sybr_safe', amount_kg=2e-12 * (i + 1))]) for i in range(6)] # 2-12 ng DNA + clean = loaded(dict(sample_id='dna', support='agarose_gel', width_m=0.07, height_m=0.065, lanes=lanes), mode='nucleic_acid_gels') + dirty = loaded(dict(sample_id='dna', support='agarose_gel', width_m=0.07, height_m=0.065, lanes=lanes, free_stain_mol_m2=2e-8), mode='nucleic_acid_gels') + for h in (clean, dirty): + h.invoke('exposure.set', channel='GREEN_TRANS', exposure_s=0.5) + ic, idr = smart_capture(clean, smart=False), smart_capture(dirty, smart=False) + mc, md = clean.invoke('measurement.result', image_id=ic), dirty.invoke('measurement.result', image_id=idr) + self.assertGreater(md['channels'][0]['mean_adu'], mc['channels'][0]['mean_adu'] + 20) # unbound stain raises the gel background + an = clean.invoke('image.analyze', image_id=ic, channel='GREEN_TRANS', sensitivity=0.6) + v = first_band_volumes(an) + self.assertEqual(len(v), 6) + for i in range(1, 6): + self.assertAlmostEqual(v[i] / v[0], i + 1, delta=0.15 * (i + 1)) + check('nucleic_acid', background_clean=mc['channels'][0]['mean_adu'], background_free_stain=md['channels'][0]['mean_adu']) + + def test_auto_align_zoom_and_lock(self): + h = loaded(blot(), skew=0.12) + self.assertAlmostEqual(h.stage_angle, 0.12, delta=1e-12) # the stage squares the sample + self.assertEqual(h.read('evaluator')['truth.sample_skew_rad'], 0.0) + self.assertAlmostEqual(h.camera['zoom'], 2.0, delta=1e-12) # a mini blot fills the 2x field + big = loaded(blot(W=0.15, H=0.11), skew=0.0) + self.assertTrue(1.0 < big.camera['zoom'] < 1.5, big.camera['zoom']) + k = loaded(blot(), skew=0.25) + self.assertAlmostEqual(k.stage_angle, rt.STAGE_ROT_RAD, delta=1e-12) # at most 10 deg + iid = smart_capture(k) + self.assertIn('sample_skewed', k.invoke('measurement.result', image_id=iid)['warnings']) + k.invoke('camera.set', binning=2, zoom=1.5, auto_focus=True, lock=True) + k.invoke('drawer.open') + k.step(5.0) + k.invoke('sample.remove', sample_id='blot') + k.invoke('sample.place', sample_id='blot', skew_rad=0.0) + k.invoke('drawer.close') + k.step(5.0) + self.assertEqual((k.camera['zoom'], k.stage_angle), (1.5, rt.STAGE_ROT_RAD)) # locked: no auto rotation / zoom (user guide p.14) + with self.assertRaises(rt.ActionRejected): + k.invoke('exposure.set', channel='EX3', exposure_s=3.0) + h.invoke('drawer.open') + h.step(5.0) + with self.assertRaises(rt.ActionRejected): + h.invoke('sample.place', sample_id='blot', skew_rad=0.0) # already on the stage + big2 = powered() + big2.invoke('sample.provide', **blot(sid='huge', W=0.22, H=0.17)) + big2.invoke('drawer.open') + big2.step(5.0) + with self.assertRaises(rt.ActionRejected): + big2.invoke('sample.place', sample_id='huge', skew_rad=0.3) # beyond the 24 x 20 cm glass when skewed + big2.invoke('sample.place', sample_id='huge', skew_rad=0.0) + check('auto_align', zoom_big=big.camera['zoom']) + + def test_faults(self): + base = loaded(blot()) + base.invoke('exposure.set', channel='EX3', exposure_s=2.0) + ref = base.invoke('measurement.result', image_id=smart_capture(base, smart=False))['channels'][0] + led = loaded(blot()) + led.invoke('exposure.set', channel='EX3', exposure_s=2.0) + led.invoke('fault.inject', fault='led_failure', active=True) + dark = led.invoke('measurement.result', image_id=smart_capture(led, smart=False))['channels'][0] + self.assertLess(dark['max_adu'], rt.BIAS_ADU + 50) + sm = loaded(blot()) + sm.invoke('exposure.set', channel='EX3', exposure_s=2.0) + sm.invoke('fault.inject', fault='stage_smudge', active=True) + smr = sm.invoke('measurement.result', image_id=smart_capture(sm, smart=False))['channels'][0] + self.assertGreater(smr['min_adu'], ref['min_adu']) + fj = loaded(blot()) + fj.invoke('fault.inject', fault='filter_wheel_jam', active=True) + fj.invoke('capture.run', hdr=False) + fj.step(10.0) + self.assertEqual(list(fj.records.values())[-1]['status'], 'failed') + self.assertEqual(fj.images, {}) + db = loaded(blot()) + db.invoke('fault.inject', fault='drawer_blocked', active=True) + db.invoke('drawer.open') + db.step(10.0) + self.assertEqual((db.drawer['state'], db.read()['drawer.y_m']), ('stopped', 0.0)) + pl = loaded(blot()) + pl.invoke('exposure.set', channel='EX3', exposure_s=20.0) + pl.invoke('capture.run', hdr=False) + pl.step(5.0) + pl.invoke('fault.inject', fault='power_loss', active=True) + self.assertEqual((list(pl.records.values())[-1]['status'], pl.images), ('failed', {})) + with self.assertRaises(rt.ActionRejected): + pl.invoke('power.set', enabled=True) + pl.step(900.0) + pl.invoke('fault.inject', fault='power_loss', active=False) + self.assertTrue(pl.power) + self.assertFalse(pl.read()['camera.ready']) # the CCD warmed while off + check('faults', ref_min=ref['min_adu'], smudge_min=smr['min_adu']) + + +class ReviewRound1(unittest.TestCase): + """Behaviour fixed after the independent runtime review round 1 (F-01 ... F-M09).""" + + def test_stopped_drawer_state_is_declared(self): + for how in ('blocked', 'power'): + h = loaded(blot()) + h.register_principal('ag', 'agent') + if how == 'blocked': + h.invoke('fault.inject', fault='drawer_blocked', active=True) + h.invoke('drawer.open') + h.step(2.0) + if how == 'power': + h.invoke('fault.inject', fault='power_loss', active=True) + h.step(5.0) + obs = h.session('ag').read(instance_id=INST)['observations'] + self.assertEqual(obs['drawer.state']['value'], 'stopped') + for k, o in obs.items(): + self.assertEqual(asset_tool.validate_value(o['value'], _meta()['state_slots'][k]['value_schema']), [], k) + check('stopped_state') + + def test_hdr_is_linear_and_not_flagged_saturated(self): + lanes = [dict(x_m=0.02, width_m=0.006, bands=[dict(y_m=0.03, sigma_m=0.0007, label='hrp', amount_mol=1e-16)]), + dict(x_m=0.05, width_m=0.006, bands=[dict(y_m=0.03, sigma_m=0.0007, label='hrp', amount_mol=1e-18)])] + h = loaded(dict(sample_id='c', support='nitrocellulose', width_m=0.086, height_m=0.068, lanes=lanes, substrate='supersignal_west_pico_plus'), mode='chemi_blots') + h.invoke('exposure.set', channel='CHEMI', exposure_s=600.0) + h.invoke('capture.run', hdr=True) + h.step(700.0) + iid = max(h.images) + r = h.invoke('measurement.result', image_id=iid)['channels'][0] + self.assertLess(r['max_adu'], rt.ADC_MAX) + an = h.invoke('image.analyze', image_id=iid, channel='CHEMI', sensitivity=0.7) + self.assertEqual(len(an['lanes']), 2) + self.assertFalse(any(b['saturated'] for l in an['lanes'] for b in l['bands'])) + v = first_band_volumes(an) + self.assertAlmostEqual(v[0] / v[1], 100.0, delta=8.0) # linear across two decades + self.assertIn('frame_from_live_view', an['warnings']) # no membrane channel: the live-view outline + self.assertAlmostEqual(an['lanes'][0]['bands'][0]['rf'], 0.03 / 0.068, delta=0.02) + check('hdr', ratio=v[0] / v[1]) + + def test_visible_white_clipping_is_flagged(self): + lanes = [dict(x_m=0.01 + 0.012 * i, width_m=0.006, bands=[dict(y_m=0.03, sigma_m=0.0007, label='coomassie_r250', amount_kg=0.5e-9 * 2 ** i)]) for i in range(5)] + h = loaded(dict(sample_id='g', support='polyacrylamide_gel', width_m=0.086, height_m=0.068, lanes=lanes), mode='protein_gels') + ok = h.invoke('measurement.result', image_id=smart_capture(h, smart=False))['channels'][0] # default visible exposure + self.assertLess(ok['saturated_fraction'], 0.01) + h.invoke('smart_exposure.run') + h.step(30.0) + t = h.exposure['VISIBLE'] + h.invoke('exposure.set', channel='VISIBLE', exposure_s=2.0 * t) + iid = smart_capture(h, smart=False) + an = h.invoke('image.analyze', image_id=iid, channel='VISIBLE', sensitivity=0.6) + self.assertIn('saturated_bands', an['warnings']) + self.assertTrue(any(b['saturated'] for l in an['lanes'] for b in l['bands'])) + check('white_clip') + + def test_narrow_lane_gaps_and_empty_lanes(self): + for w, g, n in ((5.3, 2.2, 10), (3.4, 1.6, 15)): + lanes = [dict(x_m=0.004 + w / 2e3 + i * (w + g) / 1e3, width_m=w / 1e3, bands=[dict(y_m=0.02, sigma_m=0.0006, label='alexa_fluor_647', amount_mol=1e-14)]) + for i in range(n)] + h = loaded(dict(sample_id='b', support='pvdf_lf', width_m=lanes[-1]['x_m'] + w / 2e3 + 0.004, height_m=0.065, lanes=lanes)) + an = h.invoke('image.analyze', image_id=smart_capture(h), channel='EX3', sensitivity=0.5) + self.assertEqual(len(an['lanes']), n, (w, g)) + v = first_band_volumes(an) + self.assertLess(max(v) / min(v), 1.1) + lanes = [dict(x_m=0.008 + 0.0095 * i, width_m=0.006, bands=([] if i in (1, 3) else [dict(y_m=0.02, sigma_m=0.0006, label='alexa_fluor_647', amount_mol=1e-14)])) + for i in range(6)] + h = loaded(dict(sample_id='e', support='pvdf_lf', width_m=0.065, height_m=0.065, lanes=lanes)) + iid = smart_capture(h) + an = h.invoke('image.analyze', image_id=iid, channel='EX3', sensitivity=0.5) + self.assertEqual([len(l['bands']) for l in an['lanes']], [1, 0, 1, 0, 1, 1]) # physical order, empty lanes kept + cen = [l['x_m'] for l in an['lanes']] + an2 = h.invoke('image.analyze', image_id=iid, channel='EX3', sensitivity=0.5, lane_centres_m=cen[:3]) + self.assertEqual(len(an2['lanes']), 3) + self.assertIn('lanes_from_user', an2['warnings']) + check('lanes') + + def test_template_source_lists_only_the_chosen_dyes(self): + lanes = [dict(x_m=0.02, width_m=0.006, bands=[dict(y_m=0.02, sigma_m=0.0006, label='alexa_fluor_647', amount_mol=1e-14)]), + dict(x_m=0.04, width_m=0.006, bands=[dict(y_m=0.02, sigma_m=0.0006, label='alexa_fluor_790', amount_mol=1e-14)])] + h = loaded(dict(sample_id='hid', support='pvdf_lf', width_m=0.06, height_m=0.065, lanes=lanes)) + r = h.invoke('measurement.result', image_id=smart_capture(h)) + self.assertEqual(r['template_source'], ['fluorophore_library.json#alexa_fluor_647']) + check('template_source') + + def test_pixel_integration_and_zoom_independence(self): + vols = [] + for dy in (0.0, 0.1e-3, 0.2e-3, 0.3e-3): + lanes = [dict(x_m=0.03, width_m=0.006, bands=[dict(y_m=0.03 + dy, sigma_m=0.0001, label='alexa_fluor_647', amount_mol=1e-14)])] + h = loaded(dict(sample_id='n', support='pvdf_lf', width_m=0.06, height_m=0.065, lanes=lanes)) + h.invoke('camera.set', binning=2, zoom=1.0, auto_focus=True, lock=False) + h.invoke('exposure.set', channel='EX3', exposure_s=1.0) + vols.append(first_band_volumes(h.invoke('image.analyze', image_id=smart_capture(h, smart=False), channel='EX3', sensitivity=0.5))[0]) + self.assertLess(max(vols) / min(vols), 1.08) # narrow bands no longer alias + vz = {} + for zoom in (2.0, 8.0): + lanes = [dict(x_m=0.03, width_m=0.006, bands=[dict(y_m=0.03, sigma_m=0.0006, label='alexa_fluor_647', amount_mol=2e-15)])] + h = loaded(dict(sample_id='z', support='pvdf_lf', width_m=0.06, height_m=0.065, lanes=lanes)) + h.invoke('camera.set', binning=2, zoom=zoom, auto_focus=True, lock=False) + h.invoke('exposure.set', channel='EX3', exposure_s=1.0) + vz[zoom] = first_band_volumes(h.invoke('image.analyze', image_id=smart_capture(h, smart=False), channel='EX3', sensitivity=0.5))[0] + self.assertAlmostEqual(vz[8.0] / vz[2.0], 1.0, delta=0.12) # digital zoom only crops + check('pixel_integration', aliasing=max(vols) / min(vols), zoom_ratio=vz[8.0] / vz[2.0]) + + def test_fault_mid_capture_leaves_earlier_channels(self): + h = loaded(blot(), channels=(('EX3', 'alexa_fluor_647'), ('EX1', 'alexa_fluor_488'))) + for c in ('EX3', 'EX1'): + h.invoke('exposure.set', channel=c, exposure_s=10.0) + h.invoke('capture.run', hdr=False) + h.step(12.0) # EX3 read out at 11.5 s + h.invoke('fault.inject', fault='led_failure', active=True) + h.step(20.0) + r = {c['channel']: c for c in h.invoke('measurement.result', image_id=max(h.images))['channels']} + self.assertGreater(r['EX3']['max_adu'], 10 * rt.BIAS_ADU) + self.assertLess(r['EX1']['max_adu'], rt.BIAS_ADU + 60) + check('fault_mid_capture') + + def test_gallery_delete_ledger_export_and_smart_target(self): + h = loaded(blot()) + L0 = h.ledger() + h.invoke('smart_exposure.run') + h.step(30.0) + L1 = h.ledger() + self.assertGreater(L1['exposure_time_s'], L0['exposure_time_s']) # test shots are booked + self.assertGreater(L1['led_energy_j'], L0['led_energy_j']) + h.invoke('exposure.set', channel='EX3', exposure_s=20.0) + h.invoke('capture.run', hdr=False) + h.step(1.5 + 5.0) + h.register_principal('ag', 'agent') + L2 = h.ledger() + h.invoke('fault.inject', fault='power_loss', active=True) + L3 = h.ledger() + self.assertAlmostEqual(L3['led_energy_j'] - L2['led_energy_j'], rt.POWER_LED_W * 5.0, delta=1e-6) # the exposed part of the aborted capture + k = loaded(blot()) + iid = smart_capture(k) + mx = k.invoke('measurement.result', image_id=iid)['channels'][0]['max_adu'] + self.assertTrue(0.75 * rt.ADC_MAX < mx < 0.9 * rt.ADC_MAX, mx) + a16 = k.invoke('image.export', image_id=iid, fmt='tiff', analysis_16bit=True)['bytes'] + pub = k.invoke('image.export', image_id=iid, fmt='tiff', analysis_16bit=False)['bytes'] + r = k.invoke('measurement.result', image_id=iid) + self.assertAlmostEqual(pub, 3 * r['width_px'] * r['height_px'] + 8192, delta=1) # 24-bit publication composite + self.assertNotEqual(a16, pub) + k.invoke('image.delete', image_id=iid) + self.assertEqual(k.images, {}) + self.assertIsNone(k.read()['result.last_image_id']) + big = powered() + big.invoke('sample.provide', **blot(sid='wide', W=0.235, H=0.19)) + check('gallery_ledger_export') + + +def chemi(amounts, spacing=0.023, x0=0.02): + lanes = [dict(x_m=x0 + spacing * i, width_m=0.006, bands=[dict(y_m=0.03, sigma_m=0.0007, label='hrp', amount_mol=a)]) for i, a in enumerate(amounts)] + return dict(sample_id='c', support='nitrocellulose', width_m=0.086, height_m=0.068, lanes=lanes, substrate='supersignal_west_pico_plus') + + +class ReviewRound2(unittest.TestCase): + """Regression tests for the round-2 review findings (F2-01 ... F2-08).""" + + def test_resolved_bands_are_split_at_the_valley(self): + for gap in (2.4e-3, 3.0e-3, 3.6e-3): # 4, 5, 6 sigma + s = dict(sample_id='two', support='pvdf_lf', width_m=0.086, height_m=0.068, lanes=[dict(x_m=0.043, width_m=0.006, bands=[ + dict(y_m=0.030, sigma_m=0.0006, label='alexa_fluor_647', amount_mol=1e-14), dict(y_m=0.030 + gap, sigma_m=0.0006, label='alexa_fluor_647', amount_mol=1e-14)])]) + h = loaded(s) + b = h.invoke('image.analyze', image_id=smart_capture(h), channel='EX3', sensitivity=0.5)['lanes'][0]['bands'] + self.assertEqual(len(b), 2, gap) + self.assertAlmostEqual(b[0]['lbc_volume'] / b[1]['lbc_volume'], 1.0, delta=0.12) + mk = [250, 150, 100, 75, 50, 37, 25, 20, 15, 10] # the reviewer's marker spacing (2.9-6.7 mm) + ys = [0.006] + for d in (6.66, 5.28, 3.75, 5.28, 3.92, 5.11, 2.91, 3.75, 5.28): + ys.append(ys[-1] + d * 1e-3) + y60 = ys[3] + (math.log10(75) - math.log10(60)) / (math.log10(75) - math.log10(50)) * (ys[4] - ys[3]) + lanes = [dict(x_m=0.010, width_m=0.005, bands=[dict(y_m=y, sigma_m=0.0006, label='coomassie_r250', amount_kg=0.5e-9) for y in ys]), + dict(x_m=0.020, width_m=0.005, bands=[dict(y_m=y60, sigma_m=0.0006, label='coomassie_r250', amount_kg=0.5e-9)])] + h = loaded(dict(sample_id='gel', support='polyacrylamide_gel', width_m=0.086, height_m=0.068, lanes=lanes), mode='protein_gels') + an = h.invoke('image.analyze', image_id=smart_capture(h), channel='VISIBLE', sensitivity=0.6, marker_lane=1, marker_molar_mass_kg_mol=[float(k) for k in mk]) + self.assertEqual(len(an['lanes'][0]['bands']), 10) + self.assertAlmostEqual(an['lanes'][1]['bands'][0]['molar_mass_kg_mol'], 60.0, delta=4.0) + check('band_resolution', gaps_mm=[2.4, 3.0, 3.6]) + + def test_room_change_during_an_exposure(self): + def run(dT, at): + h = loaded(chemi((1e-16,)), mode='chemi_blots') + h.invoke('exposure.set', channel='CHEMI', exposure_s=600.0) + h.invoke('capture.run', hdr=False) + h.step(at) + if dT: + h.invoke('plant.configure', room_k=rt.PLANT_EXAMPLE['room_k'] + dT, mains_voltage_v=230.0, noise_seed=1) + h.step(700.0) + self.assertIsNone(h.op) + self.assertEqual(len(h.images), 1) + return h.invoke('measurement.result', image_id=max(h.images))['channels'][0]['mean_adu'] + m0 = run(0.0, 300.0) + self.assertLess(abs(run(-1.0, 300.0) - m0), 3.0) # the room change does not create dark charge + self.assertLess(abs(run(-10.0, 595.0) - m0), 3.0) + warm = run(+5.0, 100.0) # warmer room: warmer CCD, a little more dark charge + self.assertTrue(m0 < warm < m0 + 40.0, (m0, warm)) + check('room_change_mid_exposure', mean_adu=m0, warm=warm) + + def test_user_lane_centres_are_validated(self): + h = loaded(blot(n=6)) + iid = smart_capture(h) + an = h.invoke('image.analyze', image_id=iid, channel='EX3', sensitivity=0.5) + fw = an['frame_m'][2] - an['frame_m'][0] + xs = [l['x_m'] for l in an['lanes']] + for bad, code in (([0.01, 0.02, fw + 0.01], 'LANE_OUTSIDE_FRAME'), ([0.02, 0.02], 'LANES_OVERLAP'), ([0.02, 0.0205], 'LANES_OVERLAP')): + for cap_ in ('image.analyze', 'image.quantify'): + kw = dict(standards=[dict(lane=1, band=1, amount_kg=1e-10), dict(lane=2, band=1, amount_kg=2e-10)]) if cap_ == 'image.quantify' else {} + with self.assertRaises(rt.ActionRejected) as cm: + h.invoke(cap_, image_id=iid, channel='EX3', sensitivity=0.5, lane_centres_m=bad, **kw) + self.assertEqual(str(cm.exception), code) + srt = h.invoke('image.analyze', image_id=iid, channel='EX3', sensitivity=0.5, lane_centres_m=xs) + uns = h.invoke('image.analyze', image_id=iid, channel='EX3', sensitivity=0.5, lane_centres_m=list(reversed(xs))) + self.assertIn('lane_centres_sorted', uns['warnings']) + self.assertEqual([l['width_m'] for l in srt['lanes']], [l['width_m'] for l in uns['lanes']]) + self.assertGreater(min(l['width_m'] for l in srt['lanes']), 0.004) + vol = lambda a: [l['total_lane_volume'] for l in a['lanes']] # noqa: E731 + self.assertEqual(vol(srt), vol(uns)) + self.assertAlmostEqual(sum(vol(srt)) / sum(vol(an)), 1.0, delta=0.05) + check('lane_centres_validation') + + def test_image_delete_ownership_power_busy_and_events(self): + h = loaded(blot()) + for n, v in (('a', 'agent'), ('b', 'agent'), ('ev', 'evaluator')): + h.register_principal(n, v) + a, b, ev = h.session('a'), h.session('b'), h.session('ev') + + def shoot(s, rid): + r = s.invoke(instance_id=INST, capability_id='capture.run', arguments=dict(hdr=False), request_id=rid) + h.step(60.0) + return s.poll(r['operation_id'])['result']['image_id'] + + def delete(s, iid, rid): + return s.invoke(instance_id=INST, capability_id='image.delete', arguments=dict(image_id=iid), request_id=rid) + ia, ie = shoot(a, 'ca'), shoot(ev, 'ce') + self.assertEqual(delete(a, ie, 'd1')['error']['code'], 'ACCESS_DENIED') # evaluator images are read-only for agents + self.assertEqual(delete(b, ia, 'd2')['error']['code'], 'ACCESS_DENIED') + a.invoke(instance_id=INST, capability_id='capture.run', arguments=dict(hdr=False), request_id='c2') + self.assertEqual(delete(a, ia, 'd3')['error']['code'], 'BUSY') + h.step(60.0) + self.assertEqual(delete(a, ia, 'd4')['status'], 'succeeded') + seen_b = [e['message_zh'] for e in b.invoke(instance_id=INST, capability_id='events.read', arguments=dict(since_s=0.0), request_id='e')['result']['events']] + seen_ev = [e['message_zh'] for e in ev.invoke(instance_id=INST, capability_id='events.read', arguments=dict(since_s=0.0), request_id='e')['result']['events']] + self.assertFalse([m for m in seen_b if ia in m]) + self.assertTrue([m for m in seen_ev if ia in m and '删除' in m]) + h.invoke('power.set', enabled=False) + self.assertEqual(delete(ev, ie, 'd5')['error']['code'], 'POWER_OFF') + check('image_delete_rules') + + def test_lbc_does_not_depend_on_digital_zoom(self): + s = dict(sample_id='z', support='pvdf_lf', width_m=0.086, height_m=0.068, lanes=[dict(x_m=0.043, width_m=0.005, bands=[dict(y_m=0.034, sigma_m=0.0006, label='alexa_fluor_647', amount_mol=2e-15)])]) + res = {} + for z in (2.0, 8.0): + v = [] + for seed in (1, 2, 3): + h = loaded(s, seed=seed) + h.invoke('camera.set', binning=2, zoom=z, auto_focus=True, lock=False) + h.invoke('capture.run', hdr=False) + h.step(60.0) + an = h.invoke('image.analyze', image_id=max(h.images), channel='EX3', sensitivity=0.5) + v.append(max(an['lanes'][0]['bands'], key=lambda q: q['lbc_volume'])['lbc_volume']) + res[z] = float(np.mean(v)) + self.assertAlmostEqual(res[8.0] / res[2.0], 1.0, delta=0.04) + check('lbc_zoom', ratio=res[8.0] / res[2.0]) + + def test_hdr_keeps_the_faint_lane_and_reports_its_scale(self): + h = loaded(chemi((1e-15, 1e-18, 1e-19)), mode='chemi_blots') + h.invoke('exposure.set', channel='CHEMI', exposure_s=600.0) + h.invoke('capture.run', hdr=True) + h.step(700.0) + iid = max(h.images) + an = h.invoke('image.analyze', image_id=iid, channel='CHEMI', sensitivity=0.5) + self.assertEqual(len(an['lanes']), 3) + mr = h.invoke('measurement.result', image_id=iid) + self.assertTrue(0.0 < mr['hdr_scale'] < 1.0) + self.assertEqual(an['hdr_scale'], mr['hdr_scale']) + check('hdr_faint_lane', hdr_scale=mr['hdr_scale']) + + def test_large_dna_ladders_are_accepted(self): + bp = [10000, 8000, 6000, 5000, 4000, 3000, 2000, 1500, 1000, 500] + lanes = [dict(x_m=0.010, width_m=0.006, bands=[dict(y_m=0.006 + 0.005 * i, sigma_m=0.0007, label='sybr_safe', amount_kg=20e-12) for i in range(len(bp))])] + h = loaded(dict(sample_id='dna', support='agarose_gel', width_m=0.07, height_m=0.065, lanes=lanes), mode='nucleic_acid_gels') + h.invoke('exposure.set', channel='GREEN_TRANS', exposure_s=0.5) + an = h.invoke('image.analyze', image_id=smart_capture(h, smart=False), channel='GREEN_TRANS', sensitivity=0.5, marker_lane=1, + marker_molar_mass_kg_mol=[0.650 * n for n in bp]) + self.assertEqual(an['lanes'][0]['bands'][0]['molar_mass_kg_mol'], 6500.0) + check('dna_ladder_10kb') + + def test_fault_timing_in_ledger_and_smart_exposure(self): + h = loaded(blot()) + h.register_principal('ev', 'evaluator') + ev = h.session('ev') + h.invoke('fault.inject', fault='led_failure', active=True) + h.invoke('exposure.set', channel='EX3', exposure_s=20.0) + r = ev.invoke(instance_id=INST, capability_id='capture.run', arguments=dict(hdr=False), request_id='c') + h.step(rt.CAPTURE_OVERHEAD_S + 3.0) + led0 = h.ledger()['led_energy_j'] + ev.cancel(r['operation_id'], 'x') + self.assertEqual(h.ledger()['led_energy_j'], led0) # a failed LED books no energy + ok, bad = loaded(blot()), loaded(blot()) + for k in (ok, bad): + k.invoke('smart_exposure.run') + bad.step(0.2) + bad.invoke('fault.inject', fault='led_failure', active=True) # before the first test shot + for k in (ok, bad): + k.step(120.0) + rec = lambda k: k.records[max(k.records)] # noqa: E731 + self.assertNotIn('weak_signal:EX3', rec(ok)['warnings']) + self.assertIn('weak_signal:EX3', rec(bad)['warnings']) + self.assertGreater(rec(bad)['recommended_exposure_s']['EX3'], 10 * rec(ok)['recommended_exposure_s']['EX3']) + check('fault_timing') + + +class ReviewRound3(unittest.TestCase): + """Regression tests for the round-3 review findings (F3-01 ... F3-04).""" + + def test_edge_lane_centre_keeps_a_finite_lane(self): + h = loaded(blot(n=4)) + h.invoke('camera.set', binning=2, zoom=1.0, auto_focus=True, lock=False) + h.invoke('capture.run', hdr=False) + h.step(60.0) + an = h.invoke('image.analyze', image_id=max(h.images), channel='EX3', sensitivity=0.5, lane_centres_m=[0.0, 0.0012]) # schema-checked by the wrapper + self.assertTrue(all(l['width_m'] > 0 and math.isfinite(l['background_volume']) for l in an['lanes'])) + check('edge_lane_finite') + + def test_equal_bands_share_the_valley_row(self): + s = dict(sample_id='two', support='pvdf_lf', width_m=0.086, height_m=0.068, lanes=[dict(x_m=0.043, width_m=0.006, bands=[ + dict(y_m=0.030, sigma_m=0.0006, label='alexa_fluor_647', amount_mol=1e-14), dict(y_m=0.030 + 3.5 * 0.0006, sigma_m=0.0006, label='alexa_fluor_647', amount_mol=1e-14)])]) + ratios = [] + for seed in (1, 2, 3): + h = loaded(s, seed=seed) + b = h.invoke('image.analyze', image_id=smart_capture(h), channel='EX3', sensitivity=0.5)['lanes'][0]['bands'] + self.assertEqual(len(b), 2) + ratios.append(b[0]['lbc_volume'] / b[1]['lbc_volume']) + self.assertAlmostEqual(float(np.mean(ratios)), 1.0, delta=0.06) + check('valley_row_shared', ratio=float(np.mean(ratios))) + + def test_many_room_declarations_during_an_exposure(self): + def run(n): + h = loaded(chemi((1e-16,)), mode='chemi_blots') + h.invoke('exposure.set', channel='CHEMI', exposure_s=600.0) + h.invoke('capture.run', hdr=False) + for _ in range(n): + h.step(5.0) + h.invoke('plant.configure', **rt.PLANT_EXAMPLE) # the same room re-declared: a new CCD piece each time + h.step(700.0) + return h.invoke('measurement.result', image_id=max(h.images))['channels'][0]['mean_adu'] + self.assertAlmostEqual(run(100), run(0), delta=0.05) # trapezoid rule per piece: numerical difference only + check('ccd_history_pieces', pieces=100) + + def test_no_band_below_its_local_background(self): + h = loaded(blot(n=3)) + iid = smart_capture(h) + an = h.invoke('image.analyze', image_id=iid, channel='EX3', sensitivity=1.0, lane_centres_m=[0.050, 0.060, 0.070, 0.080]) # empty columns + self.assertTrue(all(b['lbc_volume'] > 0 for l in an['lanes'] for b in l['bands'])) + check('no_negative_bands') + + +class ReviewRound4(unittest.TestCase): + """Regression tests for the round-4 review findings (F4-03 ... F4-05).""" + + def test_degenerate_standard_curve_is_refused(self): + h = loaded(blot(n=4)) + iid = smart_capture(h) + for amounts in ((0.0, 1e-300), (0.0, 1e-200), (0.0, 5e-324)): # a finite (schema-checked) fit or a declared refusal, never a crash + try: + r = h.invoke('image.quantify', image_id=iid, channel='EX3', sensitivity=0.5, + standards=[dict(lane=1, band=1, amount_kg=amounts[0]), dict(lane=2, band=1, amount_kg=amounts[1])]) + self.assertTrue(math.isfinite(r['slope']) and math.isfinite(r['intercept'])) + except rt.ActionRejected as exc: + self.assertEqual(str(exc), 'ANALYSIS_FAILED') + ok = h.invoke('image.quantify', image_id=iid, channel='EX3', sensitivity=0.5, standards=[dict(lane=1, band=1, amount_kg=1e-10), dict(lane=2, band=1, amount_kg=2e-10)]) + self.assertTrue(math.isfinite(ok['slope'])) + check('degenerate_standards') + + def test_clipped_lanes_do_not_overlap(self): + h = loaded(blot(n=4)) + h.invoke('camera.set', binning=8, zoom=1.0, auto_focus=True, lock=False) + h.invoke('capture.run', hdr=False) + h.step(60.0) + an = h.invoke('image.analyze', image_id=max(h.images), channel='EX3', sensitivity=0.5, lane_centres_m=[0.0, 0.001, 0.02]) + edges = [(l['x_m'] - l['width_m'] / 2, l['x_m'] + l['width_m'] / 2) for l in an['lanes']] + self.assertTrue(all(b0 >= a1 - 1e-12 for (a0, a1), (b0, b1) in zip(edges, edges[1:]))) + check('lanes_not_overlapping') + + def test_power_toggles_at_one_instant_keep_one_ccd_piece(self): + h = powered() + n0 = len(h.ccd_hist) + for _ in range(200): + h.invoke('power.press_switch') + self.assertLessEqual(len(h.ccd_hist), n0 + 1) + check('ccd_pieces_bounded') + + +class Framework(unittest.TestCase): + def test_read_describe_pure_and_clock(self): + h = loaded(blot()) + h.register_principal('ag', 'agent') + v0 = h.read('evaluator') + h.session('ag').describe(instance_id=INST) + h.session('ag').read(instance_id=INST) + self.assertEqual(json.dumps(h.read('evaluator'), sort_keys=True), json.dumps(v0, sort_keys=True)) + t = h.invoke('sim.step', dt_s=2.25)['time_s'] + self.assertEqual(t, h.t) + check('pure_reads') + + def test_step_partition_independent(self): + def run(splits): + h = powered(seed=4, cool=False) + h.invoke('sample.provide', **blot()) + for dt in splits(300.0): + h.step(dt) + h.invoke('drawer.open') + for dt in splits(5.0): + h.step(dt) + h.invoke('sample.place', sample_id='blot', skew_rad=0.03) + h.invoke('drawer.close') + for dt in splits(2.0): + h.step(dt) + v_mid = h.read('evaluator') + for dt in splits(3.0): + h.step(dt) + h.invoke('mode.select', mode='fluorescent_blots') + h.invoke('channels.set', channels=[dict(channel='EX3', dye='alexa_fluor_647')]) + h.invoke('smart_exposure.run') + for dt in splits(30.0): + h.step(dt) + h.invoke('capture.run', hdr=False) + for dt in splits(40.0): + h.step(dt) + return h, v_mid + a, am = run(lambda T: [T]) + b, bm = run(lambda T: [T / 8] * 8) + self.assertEqual(json.dumps(am, sort_keys=True), json.dumps(bm, sort_keys=True)) + for k, v in a.read('evaluator').items(): + w = b.read('evaluator')[k] + if isinstance(v, float): + self.assertAlmostEqual(v, w, delta=1e-9 * max(1.0, abs(v)), msg=k) + else: + self.assertEqual(v, w, k) + self.assertEqual(json.dumps(a.records, sort_keys=True), json.dumps(b.records, sort_keys=True)) + self.assertTrue(np.array_equal(a.images['IMG0001']['channels'][0]['img'], b.images['IMG0001']['channels'][0]['img'])) + la, lb = a.ledger(), b.ledger() + for k in la: + self.assertAlmostEqual(la[k], lb[k], delta=1e-9 * max(1.0, abs(la[k])), msg=k) + check('step_partition') + + def test_energy_and_exposure_ledger(self): + h = powered(cool=False) + h.step(3600.0) + L = h.ledger() + cool = rt.POWER_COOL_W * rt.CCD_TAU_S * (1 - math.exp(-3600.0 / rt.CCD_TAU_S)) + self.assertAlmostEqual(L['electrical_energy_j'], rt.POWER_IDLE_W * 3600.0 + cool, delta=1e-6) + self.assertEqual(h.invoke('ledger.read')['ledger'], h.ledger()) + self.assertFalse(h.invoke('power.press_switch')['enabled']) # the rear switch toggles + h.step(600.0) + self.assertAlmostEqual(h.ledger()['electrical_energy_j'], L['electrical_energy_j'], delta=1e-6) # off: no draw + self.assertTrue(h.invoke('power.press_switch')['enabled']) + h.invoke('power.set', enabled=False) + k = loaded(blot(), channels=(('EX3', 'alexa_fluor_647'), ('EX1', 'alexa_fluor_488'))) + for c, t in (('EX3', 2.0), ('EX1', 3.0)): + k.invoke('exposure.set', channel=c, exposure_s=t) + smart_capture(k, smart=False) + L = k.ledger() + self.assertAlmostEqual(L['exposure_time_s'], 5.0, delta=1e-12) + self.assertAlmostEqual(L['led_energy_j'], rt.POWER_LED_W * 5.0, delta=1e-9) + self.assertEqual(L['images'], 1.0) + rec = list(k.records.values())[-1] + self.assertAlmostEqual(rec['finished_s'] - rec['started_s'], 2 * rt.CAPTURE_OVERHEAD_S + 5.0, delta=1e-9) + check('ledger', energy_1h_j=L['electrical_energy_j']) + + def test_rejections_leave_state_unchanged(self): + h = loaded(blot()) + v0 = json.dumps(h.read('evaluator'), sort_keys=True, default=str) + for cap, args in [('sample.place', dict(sample_id='blot', skew_rad=0.0)), ('drawer.close', {}), ('exposure.set', dict(channel='EX5', exposure_s=1.0)), + ('camera.set', dict(binning=7, zoom=1.0, auto_focus=True, lock=False)), ('channels.set', dict(channels=[dict(channel='CHEMI', dye=None)])), + ('capture.run', dict(hdr=True)), ('sample.provide', dict(blot(), sample_id='x', lanes=[dict(x_m=0.01, width_m=0.005, bands=[dict(y_m=0.01, sigma_m=0.001, label='nope', amount_mol=1e-15)])])), + ('image.analyze', dict(image_id='IMG9999', channel='EX3', sensitivity=0.5)), ('mode.select', dict(mode='fluorescent_blots')) if False else ('drawer.close', {})]: + with self.assertRaises(rt.ActionRejected): + h.invoke(cap, **args) + self.assertEqual(json.dumps(h.read('evaluator'), sort_keys=True, default=str), v0) + check('rejections_pure') + + def test_cancellation(self): + h = loaded(blot()) + h.register_principal('ag', 'agent') + s = h.session('ag') + h.invoke('exposure.set', channel='EX3', exposure_s=30.0) + r = s.invoke(instance_id=INST, capability_id='capture.run', arguments=dict(hdr=False), request_id='c') + self.assertEqual(r['status'], 'accepted') + h.step(5.0) + s.cancel(r['operation_id'], 'x') + self.assertEqual(s.poll(r['operation_id'])['status'], 'cancelled') + h.step(60.0) + self.assertEqual(h.images, {}) + d = s.invoke(instance_id=INST, capability_id='drawer.open', arguments={}, request_id='d') + with self.assertRaises(rt.ActionRejected): + s.cancel(d['operation_id'], 'y') + h.step(5.0) + self.assertEqual(s.poll(d['operation_id'])['result']['drawer_state'], 'open') + check('cancel') + + def test_two_instances_isolated(self): + a, b = loaded(blot()), loaded(blot()) + smart_capture(a) + self.assertEqual(b.images, {}) + self.assertEqual(b.records, {}) + check('isolation') + + def test_agent_truth_isolation_ownership_and_idempotence(self): + h = loaded(blot()) + for n, v in (('a1', 'agent'), ('a2', 'agent'), ('ev', 'evaluator')): + h.register_principal(n, v) + s1, s2, e = h.session('a1'), h.session('a2'), h.session('ev') + obs = s1.read(instance_id=INST)['observations'] + self.assertFalse([k for k in obs if k.startswith('truth.') or k == 'camera.temperature_k']) + self.assertIn('truth.sample_skew_rad', e.read(instance_id=INST)['observations']) + self.assertEqual(s1.invoke(instance_id=INST, capability_id='sample.inspect', arguments=dict(sample_id='blot'), request_id='i')['error']['code'], 'ACCESS_DENIED') + r1 = s1.invoke(instance_id=INST, capability_id='capture.run', arguments=dict(hdr=False), request_id='r') + self.assertEqual(s1.invoke(instance_id=INST, capability_id='capture.run', arguments=dict(hdr=False), request_id='r'), r1) + self.assertEqual(s1.invoke(instance_id=INST, capability_id='drawer.open', arguments={}, request_id='r')['error']['code'], 'REQUEST_CONFLICT') + self.assertEqual(s2.invoke(instance_id=INST, capability_id='drawer.open', arguments={}, request_id='x')['error']['code'], 'ACCESS_DENIED') + self.assertTrue(s2.read(instance_id=INST)['observations']['operation.started_by_other_agent']['value']) + h.step(60.0) + iid = s1.poll(r1['operation_id'])['result']['image_id'] + self.assertEqual(s2.invoke(instance_id=INST, capability_id='measurement.result', arguments=dict(image_id=iid), request_id='m')['error']['code'], 'ACCESS_DENIED') + self.assertEqual(s2.invoke(instance_id=INST, capability_id='records.list', arguments={}, request_id='l')['result'], dict(records=[], images=[])) + self.assertEqual(s1.read(instance_id=INST)['observations']['result.last_image_id']['value'], iid) + self.assertIsNone(s2.read(instance_id=INST)['observations']['result.last_image_id']['value']) + check('truth_isolation_ownership') + + def test_queries_export_and_unsupported(self): + h = loaded(blot()) + iid = smart_capture(h) + lst = h.invoke('records.list') + self.assertEqual(lst['images'], [iid]) + r = h.invoke('measurement.result', image_id=iid) + self.assertLessEqual(len(r['channels'][0]['preview']), 64) + self.assertTrue(h.invoke('events.read', since_s=0.0)['events']) + self.assertEqual(len(h.invoke('provenance.read')['libraries']), 1) + ex = h.invoke('image.export', image_id=iid, fmt='tiff', analysis_16bit=True) + self.assertGreater(ex['bytes'], 2 * r['width_px'] * r['height_px']) + with self.assertRaises(rt.ActionRejected): + h.invoke('image.export', image_id=iid, fmt='jpg', analysis_16bit=True) + ins = h.invoke('sample.inspect', sample_id='blot') + self.assertEqual(len(ins['lanes']['lanes']), 8) + self.assertGreater(ins['expected_signal']['EX3']['lane_8'][0]['electrons_per_s'], 0) + for k in rt.UNSUPPORTED: + with self.assertRaises(rt.ActionRejected): + h.invoke(k) + check('queries') + + +# ---------------------------------------------------------------- declared effects over scenario states +_SC = {} + + +def _build(name): + if name == 'fresh': + return rt.ThermoIbrightFl1500Runtime() + if name == 'off': + h = rt.ThermoIbrightFl1500Runtime() + h.invoke('plant.configure', **rt.PLANT_EXAMPLE) + h.invoke('sample.provide', **blot()) + return h + if name == 'cold': + h = powered(cool=False) + h.invoke('sample.provide', **blot()) + h.step(30.0) + return h + if name == 'ready': + return loaded(blot()) + if name == 'open': + h = loaded(blot()) + h.invoke('drawer.open') + h.step(5.0) + return h + if name == 'open_empty': + h = _scenario('open') + h.invoke('sample.remove', sample_id='blot') + return h + if name == 'moving': + h = loaded(blot()) + h.invoke('drawer.open') + h.step(1.5) + return h + if name == 'capturing': + h = loaded(blot()) + h.invoke('exposure.set', channel='EX3', exposure_s=20.0) + h.invoke('capture.run', hdr=False) + h.step(3.0) + return h + if name == 'smart': + h = loaded(blot()) + h.invoke('smart_exposure.run') + h.step(1.0) + return h + if name == 'imaged': + h = loaded(blot()) + smart_capture(h) + return h + if name == 'locked': + h = loaded(blot()) + h.invoke('camera.set', binning=2, zoom=2.0, auto_focus=True, lock=True) + return h + if name == 'chemi': + return loaded(blot(label='hrp', base=1e-18, factor=3.0, substrate='generic_ecl'), mode='chemi_blots') + if name == 'stopped': + h = _scenario('moving') + h.invoke('fault.inject', fault='power_loss', active=True) + h.invoke('fault.inject', fault='power_loss', active=False) + return h + raise KeyError(name) + + +def _scenario(name): + if name not in _SC: + _SC[name] = _build(name) + return copy.deepcopy(_SC[name]) + + +SCENARIOS = ['fresh', 'off', 'cold', 'ready', 'open', 'open_empty', 'moving', 'capturing', 'smart', 'imaged', 'locked', 'chemi', 'stopped'] +STEP_DTS = (0.5, 5.0, 60.0) + + +def _variants(cap): + V = { + 'plant.configure': [dict(rt.PLANT_EXAMPLE), dict(rt.PLANT_EXAMPLE, mains_voltage_v=60.0), dict(rt.PLANT_EXAMPLE, room_k=300.15)], + 'power.set': [dict(enabled=True), dict(enabled=False)], 'power.press_switch': [{}], + 'mode.select': [dict(mode='fluorescent_blots'), dict(mode='chemi_blots')], 'drawer.open': [{}], 'drawer.close': [{}], + 'sample.provide': [dict(rt.SAMPLE_EXAMPLE, sample_id='new')], 'sample.place': [dict(sample_id='blot', skew_rad=0.05)], 'sample.remove': [dict(sample_id='blot')], + 'channels.set': [dict(channels=[dict(channel='EX3', dye='alexa_fluor_647')]), dict(channels=[dict(channel='EX3', dye='alexa_fluor_647'), dict(channel='VISIBLE', dye=None)])], + 'exposure.set': [dict(channel='EX3', exposure_s=2.0), dict(channel='CHEMI', exposure_s=5.0)], + 'camera.set': [dict(binning=4, zoom=1.0, auto_focus=True, lock=False), dict(binning=2, zoom=2.0, auto_focus=True, lock=True, rotation_rad=0.05)], + 'smart_exposure.run': [{}], 'capture.run': [dict(hdr=False), dict(hdr=True)], + 'image.export': [dict(image_id='IMG0001', fmt='tiff', analysis_16bit=True)], 'image.delete': [dict(image_id='IMG0001')], + 'fault.inject': [dict(fault=f, active=True) for f in ('power_loss', 'led_failure', 'drawer_blocked', 'filter_wheel_jam', 'stage_smudge')] + [dict(fault='power_loss', active=False)], + 'sim.step': [dict(dt_s=0.5), dict(dt_s=30.0)], + } + return V.get(cap, []) + + +def _num(x): + return isinstance(x, (int, float)) and not isinstance(x, bool) + + +def _flat(v, prefix=''): + out = {} + if isinstance(v, dict): + for k, x in v.items(): + out.update(_flat(x, f'{prefix}.{k}')) + elif isinstance(v, list) and len(v) <= 128: + for i, x in enumerate(v): + out.update(_flat(x, f'{prefix}[{i}]')) + else: + out[prefix] = json.dumps(v, sort_keys=True, default=str) if isinstance(v, list) else v + return out + + +def _rel_changed(a, b, scale=None): + if _num(a) and _num(b): + return abs(a - b) > 1e-9 * (max(abs(a), abs(b)) if scale is None else scale) + 1e-300 + return _changed(a, b) + + +def _leaf_changed(a, b): + fa, fb = _flat(a), _flat(b) + return any(_rel_changed(fa.get(k, ''), fb.get(k, '')) for k in set(fa) | set(fb)) + + +def _step_differs(v1, a2, v0, b2): + f1, fa, f0, fb = _flat(v1), _flat(a2), _flat(v0), _flat(b2) + for leaf in set(f1) | set(fa) | set(f0) | set(fb): + x1, xa, x0, xb = (f.get(leaf, '') for f in (f1, fa, f0, fb)) + ca, cb = _rel_changed(x1, xa), _rel_changed(x0, xb) + if not (ca or cb): + continue + if ca and cb and all(_num(x) for x in (x1, xa, x0, xb)) and not _rel_changed(xa - x1, xb - x0, max(abs(x1), abs(xa), abs(x0), abs(xb))): + continue + if ca and cb and (x1, xa) == (x0, xb): + continue + if ca and cb and x1 == x0 and not _rel_changed(xa, xb): + continue + return True + return False + + +def _executable(cap): + return cap not in rt.UNSUPPORTED and rt.CAPS[cap]['kind'] not in ('query', 'analysis') + + +class ZDeclaredEffects(unittest.TestCase): + def test_immediate_and_on_step_effects_are_declared(self): + missing_imm, missing_step = {}, {} + states = {n: _scenario(n) for n in SCENARIOS} + for cap in rt.CAPS: + if not _executable(cap): + continue + for sname, S in states.items(): + for args in _variants(cap): + A = copy.deepcopy(S) + v0 = A.read('evaluator') + try: + _orig_invoke(A, cap, **args) + except rt.ActionRejected: + continue + v1 = A.read('evaluator') + if cap == 'sim.step': + for k in v0: + if _leaf_changed(v0[k], v1[k]) and k not in rt.ON_STEP['sim.step'] + rt.EFFECTS['sim.step']: + missing_step.setdefault('sim.step', set()).add((sname, k)) + continue + for k in v0: + if _leaf_changed(v0[k], v1[k]) and k not in rt.EFFECTS.get(cap, []): + missing_imm.setdefault(cap, set()).add((sname, k)) + for dt in STEP_DTS: + A2, B2 = copy.deepcopy(A), copy.deepcopy(S) + A2.step(dt) + B2.step(dt) + a2, b2 = A2.read('evaluator'), B2.read('evaluator') + for k in v0: + if k not in rt.ON_STEP.get(cap, []) and _step_differs(v1[k], a2[k], v0[k], b2[k]): + missing_step.setdefault(cap, set()).add((sname, k)) + if k not in rt.ON_STEP['sim.step'] + ['clock.time_s'] and _leaf_changed(v0[k], b2[k]): + missing_step.setdefault('sim.step', set()).add((sname, k)) + self.maxDiff = None + self.assertEqual(missing_imm, {}) + self.assertEqual(missing_step, {}) + check('declared_effects_scenarios') + + def test_every_device_capability_is_accepted_in_some_scenario(self): + accepted = set() + for n in SCENARIOS: + S = _scenario(n) + for cap in rt.CAPS: + if not _executable(cap) or cap in accepted: + continue + for args in _variants(cap): + try: + _orig_invoke(copy.deepcopy(S), cap, **args) + accepted.add(cap) + break + except rt.ActionRejected: + pass + self.assertEqual({c for c in rt.CAPS if _executable(c)} - accepted, set()) + + +class ZZRejectionCodes(unittest.TestCase): + def test_every_observed_rejection_code_is_declared(self): + undeclared = {k: sorted(v - set(rt.CAP_ERRORS.get(k, [])) - {'INVALID_ARGUMENT', 'UNSUPPORTED', 'UNKNOWN_CAPABILITY'}) for k, v in REJECTIONS.items()} + self.assertEqual({k: v for k, v in undeclared.items() if v}, {}) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_asset_tuttnauer_3870elvd.py b/tests/test_asset_tuttnauer_3870elvd.py new file mode 100644 index 0000000000000000000000000000000000000000..e8d7d552b5ff166b760adbfcdf24f2bf66c06791 --- /dev/null +++ b/tests/test_asset_tuttnauer_3870elvd.py @@ -0,0 +1,601 @@ +"""tests for CHEM-192 tuttnauer_3870elvd (Tuttnauer 3870ELV-D vertical laboratory autoclave): python3 -m unittest tests/test_asset_tuttnauer_3870elvd.py + +Themes: contract consistency (slots, effects, errors raised vs declared); agent / evaluator truth isolation; idempotent request ids; two instances +isolated; step-partition independence; rejected calls leave the state unchanged; every output validated against its schema and every success +changes only declared slots; IAPWS-IF97 saturation pressure (Table 35 verification values) and the latent heat; liquid cycle with two 700 ml +bottles (heating time against the same-platform printout, hold at the set point, loads lag the chamber: bottle F0 below the chamber F0, biological +indicator log reduction); 134 C solids cycle (pressure at the hold); liquid + cooling cycle (compressed air prevents boiling, ends at 90 C); +liquids under fast exhaust boil over, sealed bottles burst, non-autoclavable plastics deform; lid interlock; residual air (stuck air valve) +stops the heating at the pressure limit (Low Heat); no water supply; heater fault; door gasket leak; power loss; 200-record ring; program +editing limits (999 min extended time, 105-138 C); panel keys; water and load mass ledgers.""" +import json +import math +import re +import sys +import unittest +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / 'scripts')) +from asset_runtime import tuttnauer_3870elvd as rt # noqa: E402 + +INST = 'tuttnauer_3870elvd_01' +CHECKS = [] +SEEN_CAPS = set() +PROCESS_EVIDENCE = {} +BI = 'geobacillus_stearothermophilus' + + +def _differ(x, y): + if isinstance(x, float) and isinstance(y, float): + return abs(x - y) > 1e-12 * max(1.0, abs(x), abs(y)) + return json.dumps(x, sort_keys=True, default=str) != json.dumps(y, sort_keys=True, default=str) + + +class Rig: + def __init__(self, seed=1, ambient=295.15, patm=101325.0, water=True, air=True, cooling=True, instance=INST): + self.h = rt.TuttnauerElvdRuntime(instance) + self.h.register_principal('agent', 'agent') + self.h.register_principal('eval', 'evaluator') + self.A = self.h.session('agent') + self.E = self.h.session('eval') + self.n = 0 + self.inst = instance + self.call(self.E, 'plant.configure', ambient_k=ambient, atmospheric_pressure_pa=patm, water_supply=water, compressed_air=air, cooling_water=cooling, noise_seed=seed) + + def call(self, sess, cap, expect='succeeded', **args): + """Instrumented call: outputs validated against the declared schema; a success changes only declared immediate slots and never the clock; + a rejection leaves every slot unchanged and returns a declared error code.""" + self.n += 1 + before, t0 = self.h.read('evaluator'), self.h.t + r = sess.invoke(instance_id=self.inst, capability_id=cap, arguments=args, request_id=f'r{self.n}') + after = self.h.read('evaluator') + changed = {k for k in after if _differ(after[k], before[k])} - {'clock.time_s'} + if expect == 'succeeded': + assert r['status'] == 'succeeded', (cap, r['error']) + rt.validate(rt.CAPS[cap]['output_schema'], r['result']) + if cap != 'sim.step': + extra = changed - set(rt.EFFECTS.get(cap, [])) + assert not extra, (cap, sorted(extra)) + assert self.h.t == t0, cap + SEEN_CAPS.add(cap) + PROCESS_EVIDENCE.setdefault(cap, []).append(dict(arguments=json.dumps(args, sort_keys=True, default=str)[:200], time_s=t0, status=r['status'])) + return r['result'] + assert r['status'] in ('rejected', 'unsupported'), (cap, r['status'], r.get('result')) + assert r['error']['code'] == expect, (cap, r['error']['code'], expect) + assert not changed, (cap, 'rejected call changed', sorted(changed)) + assert expect in [e['code'] for e in rt.export_tuttnauer_3870elvd_contract_metadata()['capabilities'][cap]['errors']], (cap, expect) + return r + + def step(self, s): + self.call(self.E, 'sim.step', dt_s=float(s)) + + def read(self, *ids, who=None): + sess = who or self.E + o = sess.read(instance_id=self.inst, state_ids=list(ids) if ids else None)['observations'] + return {k: v['value'] for k, v in o.items()} if not ids or len(ids) > 1 else o[ids[0]]['value'] + + def on(self): + self.call(self.A, 'power.set', on=True) + + def open_lid(self): + self.call(self.A, 'lid.set', open=True) + self.step(3.0) + + def close_lid(self): + self.call(self.A, 'lid.set', open=False) + self.step(3.0) + + def bottles(self, n=2, mass=0.7, closure='loose', liquid='water', material='borosilicate_glass', bi=True): + for i in range(n): + args = dict(load_id=f'b{i + 1}', kind='liquid', mass_kg=mass, liquid=liquid, container_volume_m3=1e-3, material=material, closure=closure) + if bi: + args.update(organism=BI, log10_n0=6.0) + self.call(self.A, 'load.add', **args) + + def run(self, program, limit=4 * 3600.0, every=10.0): + self.call(self.A, 'program.select', program=program) + self.call(self.A, 'cycle.start') + t0, marks = self.h.t, {} + while self.h.t - t0 < limit: + self.step(every) + st = self.read('cycle.status')['stage'] + marks.setdefault(st, self.h.t - t0) + if st in ('complete', 'failed'): + break + return marks + + def ledger(self): + return self.call(self.E, 'ledger.read')['ledger'] + + +def _raised_codes(): + src = Path(rt.__file__).read_text() + funcs = {} + for m in re.finditer(r'\n def (\w+)\(self[^\n]*\n(.*?)(?=\n def |\n# ----|\nclass |\ndef )', src, re.S): + funcs[m.group(1)] = m.group(2) + own = {k: set(re.findall(r"ActionRejected\('([A-Z_]+)'\)", v)) for k, v in funcs.items()} + calls = {k: set(re.findall(r'self\.(_\w+)\(', v)) & set(funcs) for k, v in funcs.items()} + out = {} + for k in funcs: + if not k.startswith('_cmd_'): + continue + seen, todo, codes = set(), [k], set() + while todo: + f = todo.pop() + if f in seen: + continue + seen.add(f) + codes |= own.get(f, set()) + todo += [g for g in calls.get(f, ()) if g not in ('_cmd_sim_step', 'step', '_tick')] + out[k[5:].replace('_', '.', 1)] = codes + return out + + +def _water_balance(test, led): + out = led['steam_vented_kg'] + led['flash_vented_kg'] + led['water_drained_kg'] + led['leak_kg'] + led['water_in_chamber_kg'] + test.assertAlmostEqual(led['water_supplied_kg'], out, delta=1e-9 + 1e-9 * led['water_supplied_kg'], msg=led) + loads = led['load_removed_kg'] + led['load_mass_in_chamber_kg'] + led['load_boilover_kg'] + led['load_burst_kg'] + test.assertAlmostEqual(led['load_added_kg'], loads, delta=1e-9, msg=led) + + +class Contract(unittest.TestCase): + def test_metadata_slots_effects_and_mirrors_consistent(self): + meta = rt.export_tuttnauer_3870elvd_contract_metadata() + slots = set(meta['state_slots']) + self.assertEqual(slots, set(rt.SLOTS)) + for k, c in meta['capabilities'].items(): + for e in c['state_effects']: + self.assertIn(e['state_id'], slots, k) + for x in c['observes']: + self.assertIn(x, slots, k) + for pre in c['preconditions']: + self.assertTrue(set(pre['state_ids']) <= slots, k) + self.assertTrue({'INVALID_ARGUMENT', 'REQUEST_CONFLICT', 'UNKNOWN_INSTANCE'} <= {e['code'] for e in c['errors']}, k) + self.assertIn(c['kind'], ('query', 'device_command', 'robot_skill', 'simulation', 'analysis', 'configuration')) + self.assertIn(c['model_effects']['mode'], ('none', 'direct', 'coupled', 'host_required')) + self.assertTrue(rt.SCENE_MIRRORED <= slots) + for name, p in meta['mechanisms']['steam_sterilization_process']['parameters'].items(): + self.assertEqual(name, name.lower()) + self.assertIn(p['evidence'], ('documented', 'assumption'), name) + + def test_declared_errors_cover_raised_codes(self): + meta = rt.export_tuttnauer_3870elvd_contract_metadata() + for cap, codes in _raised_codes().items(): + declared = {e['code'] for e in meta['capabilities'][cap]['errors']} + self.assertTrue(codes <= declared, (cap, sorted(codes - declared))) + + def test_unsupported_capabilities(self): + g = Rig() + for k in rt.UNSUPPORTED: + r = g.A.invoke(instance_id=INST, capability_id=k, arguments={}, request_id='u-' + k) + self.assertEqual((r['status'], r['error']['code']), ('unsupported', 'UNSUPPORTED')) + + def test_agent_truth_isolation(self): + g = Rig() + d = g.A.describe(instance_id=INST) + self.assertFalse(any(k.startswith('truth.') for k in d['state_slots'])) + with self.assertRaises(rt.ActionRejected): + g.A.read(instance_id=INST, state_ids=['truth.loads']) + for cap, args in (('truth.inspect', {}), ('sim.step', dict(dt_s=1.0)), ('ledger.read', {}), ('fault.inject', dict(fault='heater_failure', active=True))): + r = g.A.invoke(instance_id=INST, capability_id=cap, arguments=args, request_id='x-' + cap) + self.assertEqual(r['error']['code'], 'ACCESS_DENIED', cap) + g.call(g.E, 'fault.inject', fault='door_gasket_leak', active=True) + self.assertFalse(any(e['kind'] in ('fault', 'truth') for e in g.call(g.A, 'events.read', since_s=0.0)['events'])) + + def test_idempotent_request_ids(self): + g = Rig() + g.on() + args = dict(program='solids_134') + r1 = g.A.invoke(instance_id=INST, capability_id='program.select', arguments=args, request_id='same') + snap = g.h.read('evaluator') + r2 = g.A.invoke(instance_id=INST, capability_id='program.select', arguments=args, request_id='same') + self.assertEqual(r1, r2) + self.assertEqual(json.dumps(snap, sort_keys=True, default=str), json.dumps(g.h.read('evaluator'), sort_keys=True, default=str)) + r3 = g.A.invoke(instance_id=INST, capability_id='program.select', arguments=dict(program='solids_121'), request_id='same') + self.assertEqual(r3['error']['code'], 'REQUEST_CONFLICT') + + def test_two_instances_isolated(self): + a, b = Rig(instance='t_a'), Rig(instance='t_b', ambient=298.15) + a.call(a.A, 'power.set', on=True) + self.assertFalse(b.read('power.on')) + r = a.A.invoke(instance_id='t_b', capability_id='power.set', arguments=dict(on=True), request_id='z') + self.assertEqual(r['error']['code'], 'UNKNOWN_INSTANCE') + + def test_step_partition_independence(self): + def run(steps): + g = Rig(seed=5) + g.on() + g.open_lid() + g.bottles(1) + g.close_lid() + g.call(g.A, 'program.select', program='liquids_121') + g.call(g.A, 'cycle.start') + for s in steps: + g.step(s) + r = g.read() + return json.dumps({k: r[k] for k in r if k.startswith(('truth.', 'chamber.', 'cycle.'))}, sort_keys=True), json.dumps(g.ledger(), sort_keys=True) + a = run([1500.0]) + b = run([0.05] * 400 + [0.37, 13.11, 1466.52]) + c = run([30.0] * 50) + self.assertEqual(a, b) + self.assertEqual(a, c) + + def test_rejections_change_nothing(self): + g = Rig() + r = rt.TuttnauerElvdRuntime('fresh') + r.register_principal('e', 'evaluator') + self.assertEqual(r.session('e').invoke(instance_id='fresh', capability_id='power.set', arguments=dict(on=True), request_id='p')['error']['code'], 'PLANT_REQUIRED') + g.call(g.E, 'plant.configure', expect='SEED_FIXED', ambient_k=295.15, atmospheric_pressure_pa=101325.0, water_supply=True, compressed_air=True, + cooling_water=True, noise_seed=2) + g.call(g.A, 'cycle.start', expect='POWER_OFF') + g.call(g.A, 'records.read', expect='POWER_OFF') + g.call(g.A, 'load.add', expect='LID_CLOSED', load_id='x', kind='solid', mass_kg=1.0, material='stainless_316') + g.on() + g.open_lid() + g.call(g.A, 'cycle.start', expect='LID_OPEN') + g.call(g.A, 'load.add', expect='MISSING_SETTING', load_id='x', kind='liquid', mass_kg=0.5, material='pp') + g.call(g.A, 'load.add', expect='UNKNOWN_LIQUID', load_id='x', kind='liquid', mass_kg=0.5, material='pp', liquid='unobtainium', container_volume_m3=1e-3) + g.call(g.A, 'load.add', expect='MISSING_SETTING', load_id='x', kind='solid', mass_kg=0.5, material='pp', organism=BI) + g.call(g.A, 'load.add', load_id='w1', kind='liquid', mass_kg=9.0, material='borosilicate_glass', liquid='water', container_volume_m3=0.01) + g.call(g.A, 'load.add', load_id='w2', kind='liquid', mass_kg=9.0, material='borosilicate_glass', liquid='water', container_volume_m3=0.009) + g.call(g.A, 'load.add', expect='OVERLOAD', load_id='x', kind='liquid', mass_kg=2.0, material='pp', liquid='water', container_volume_m3=0.002) + g.call(g.A, 'load.remove', load_id='w1') + g.call(g.A, 'load.remove', load_id='w2') + g.call(g.A, 'load.add', load_id='x', kind='solid', mass_kg=1.0, material='stainless_316') + g.call(g.A, 'load.add', expect='LOAD_EXISTS', load_id='x', kind='solid', mass_kg=1.0, material='stainless_316') + g.call(g.A, 'load.remove', expect='UNKNOWN_LOAD', load_id='y') + g.call(g.A, 'cycle.stop', expect='NO_CYCLE') + g.call(g.A, 'program.configure', expect='TIME_OUT_OF_RANGE', program='custom_1', time_s=120 * 60.0) + g.call(g.A, 'program.configure', expect='INVALID_ARGUMENT', program='custom_1', temperature_k=420.0) + g.call(g.A, 'program.configure', expect='INVALID_ARGUMENT', program='liquids_121', time_s=600.0) + g.close_lid() + g.call(g.A, 'cycle.start') + g.step(60.0) + g.call(g.A, 'lid.set', expect='LID_LOCKED', open=True) + g.call(g.A, 'program.select', expect='CYCLE_RUNNING', program='solids_121') + g.call(g.A, 'cycle.start', expect='CYCLE_RUNNING') + g.call(g.E, 'fault.inject', expect='INVALID_ARGUMENT', fault='alien', active=True) + h = Rig(water=False, air=False, cooling=False) + h.on() + h.call(h.A, 'cycle.start', expect='NO_WATER_SUPPLY') + h.call(h.A, 'program.configure', expect='NO_COOLING_UTILITIES', program='custom_2', exhaust='cooling') + + +class Steam(unittest.TestCase): + def test_iapws_saturation_and_latent_heat(self): + for v in rt._lib('steam')['saturation']['verification']: + self.assertAlmostEqual(rt.psat_water(v['T_K']) / v['ps_Pa'], 1.0, delta=1e-8) + self.assertAlmostEqual(rt.tsat_water(101325.0), 373.124, delta=0.01) + self.assertAlmostEqual(rt.psat_water(394.25) / 1e3, 205.0, delta=1.0) # 121.1 C (the manual's 204-205 kPa) + for T, h_ref in ((373.15, 2256.5e3), (394.25, 2199.0e3), (407.15, 2162.0e3)): # steam-table latent heats + self.assertLess(abs(rt.hfg_water(T) / h_ref - 1.0), 0.035, T) + CHECKS.append(dict(id='iapws_if97_table35_and_latent_heat', status='passed', layer='process')) + + +class Cycles(unittest.TestCase): + def test_liquid_cycle_two_700ml_bottles(self): + g = Rig() + g.on() + g.open_lid() + g.bottles(2) + g.close_lid() + marks = g.run('liquids_121') + st = g.read('cycle.status') + self.assertEqual(st['result'], 'CYCLE ENDED') + self.assertTrue(8 * 60 < marks['sterilization'] < 25 * 60, marks) # same-platform printout: sterilization from 14:51 + rec = g.call(g.A, 'records.read', last=1)['records'][0] + self.assertGreaterEqual(rec['hold_min_k'], 394.15 - 0.5) + self.assertLess(rec['hold_max_k'], 394.15 + rt.DOC['high_temperature_k']) + self.assertGreaterEqual(rec['hold_s'], 1200.0) + tl = g.read('truth.loads') + self.assertLess(tl['b1']['F0_s'], rec['chamber_F0_s']) # the load centre lags the chamber + self.assertGreater(6.0 - tl['b1']['log10_survivors'], 4.0) + self.assertLess(tl['b1']['lost_kg'], 0.005) # slow exhaust: (almost) no boil-over + _water_balance(self, g.ledger()) + CHECKS.append(dict(id='liquid_cycle_two_bottles', status='passed', layer='process', marks_s=marks, bottle_F0_s=tl['b1']['F0_s'], chamber_F0_s=rec['chamber_F0_s'])) + + def test_solids_134_hold_pressure(self): + g = Rig() + g.on() + g.open_lid() + g.call(g.A, 'load.add', load_id='tray', kind='solid', mass_kg=3.0, material='stainless_316', organism=BI, log10_n0=6.0) + g.close_lid() + g.call(g.A, 'program.select', program='solids_134') + g.call(g.A, 'cycle.start') + for _ in range(400): + g.step(10.0) + if g.read('cycle.status')['stage'] == 'sterilization': + break + g.step(60.0) + P = g.read('truth.chamber')['pressure_pa'] + self.assertAlmostEqual(P / rt.psat_water(407.15 + 0.3), 1.0, delta=0.03) + for _ in range(400): + g.step(10.0) + if g.read('cycle.status')['stage'] in ('complete', 'failed'): + break + self.assertEqual(g.read('cycle.status')['result'], 'CYCLE ENDED') + self.assertLess(g.read('truth.loads')['tray']['log10_survivors'], 0.0) + _water_balance(self, g.ledger()) + + def test_liquid_cooling_cycle(self): + g = Rig() + g.on() + g.open_lid() + g.bottles(2) + g.close_lid() + marks = g.run('liquids_121_cooling') + self.assertEqual(g.read('cycle.status')['result'], 'CYCLE ENDED') + cool = marks['exhaust'] - marks['cooling'] + self.assertTrue(15 * 60 < cool < 45 * 60, marks) # same-platform: average cooling stage 30 min + tl = g.read('truth.loads') + self.assertLessEqual(tl['b1']['temperature_k'], 363.15 + 0.5) + self.assertEqual(tl['b1']['lost_kg'], 0.0) # compressed air keeps the liquid from boiling + _water_balance(self, g.ledger()) + + def test_fast_exhaust_boils_liquids_and_sealed_bottles_burst(self): + g = Rig() + g.on() + g.open_lid() + g.bottles(1, bi=False) + g.call(g.A, 'load.add', load_id='sealed', kind='liquid', mass_kg=0.5, liquid='water', container_volume_m3=1e-3, material='borosilicate_glass', closure='sealed') + g.call(g.A, 'load.add', load_id='dish', kind='solid', mass_kg=0.2, material='ps') + g.close_lid() + g.run('solids_121') + tl = g.read('truth.loads') + self.assertTrue(tl['b1']['boilover'] and tl['b1']['lost_kg'] > 0.01, tl['b1']) + self.assertTrue(tl['sealed']['burst'], tl['sealed']) + self.assertTrue(tl['dish']['deformed']) + g.open_lid() + out = g.call(g.A, 'load.remove', load_id='b1') + self.assertTrue(out['state']['liquid_lost']) + _water_balance(self, g.ledger()) + CHECKS.append(dict(id='boilover_burst_deformation', status='passed', layer='process')) + + def test_residual_air_stops_heating_low_heat(self): + g = Rig() + g.on() + g.call(g.E, 'fault.inject', fault='air_valve_stuck_closed', active=True) + g.call(g.A, 'program.select', program='solids_121') + g.call(g.A, 'cycle.start') + g.step(30 * 60.0) + tc = g.read('truth.chamber') + self.assertGreater(tc['air_mol'], 2.0) + self.assertLess(tc['water_temperature_k'], 394.15 - 3.0) + self.assertLessEqual(tc['pressure_pa'], rt.psat_water(394.15) + rt.P_MARGIN + 3e3) + g.step(40 * 60.0) + self.assertIn('LOW_HEAT', g.read('alarms.active')) + self.assertEqual(g.read('cycle.status')['result'], 'CYCLE FAIL') + + def test_lid_interlock_and_end_temperature(self): + g = Rig() + g.on() + g.open_lid() + g.bottles(1) + g.close_lid() + g.call(g.A, 'program.select', program='liquids_121') + g.call(g.A, 'cycle.start') + g.step(25 * 60.0) + self.assertTrue(g.read('lid.locked')) + g.call(g.A, 'lid.set', expect='LID_LOCKED', open=True) + self.assertGreater(g.read('gauge.needle_rad'), 0.5) + self.assertAlmostEqual(g.read('display.temperature_c'), g.read('chamber.temperature_k') - 273.15, delta=0.06) + + def test_faults_supply_and_power(self): + g = Rig(water=False) + g.on() + g.call(g.A, 'cycle.start', expect='NO_WATER_SUPPLY') + h = Rig() + h.on() + h.call(h.E, 'fault.inject', fault='water_supply_off', active=True) + h.call(h.A, 'cycle.start') + h.step(30.0) + self.assertEqual(h.read('cycle.status')['result'], 'CYCLE FAIL') + self.assertIn('NO_RES_SRC', h.read('alarms.active')) + k = Rig() + k.on() + k.call(k.E, 'fault.inject', fault='heater_failure', active=True) + k.call(k.A, 'program.select', program='solids_134') + k.call(k.A, 'cycle.start') + k.step(3700.0) + self.assertEqual(k.read('cycle.status')['result'], 'CYCLE FAIL') + self.assertIn('LOW_HEAT', k.read('alarms.active')) + m = Rig() + m.on() + m.call(m.E, 'fault.inject', fault='door_gasket_leak', active=True) + m.call(m.A, 'program.select', program='solids_121') + m.call(m.A, 'cycle.start') + m.step(40 * 60.0) + self.assertGreater(m.ledger()['leak_kg'], 0.0) + _water_balance(self, m.ledger()) + n = Rig() + n.on() + n.call(n.A, 'cycle.start') + n.step(300.0) + n.call(n.A, 'power.set', on=False) + self.assertIsNone(n.read('chamber.temperature_k')) + n.on() + self.assertEqual(n.call(n.A, 'records.read', last=1)['records'][0]['result'], 'CYCLE FAIL') + n.call(n.E, 'fault.inject', fault='pressure_sensor_fault', active=True) + self.assertIsNone(n.read('chamber.pressure_pa')) + n.call(n.E, 'fault.inject', fault='temperature_sensor_drift', active=True) + n.call(n.E, 'truth.inspect') + + def test_record_ring_keeps_200_cycles(self): + g = Rig() + g.on() + for i in range(203): + g.call(g.A, 'cycle.start') + g.call(g.A, 'cycle.stop') + g.step(120.0) + recs = g.call(g.A, 'records.read') + self.assertEqual(recs['stored'], 200) + self.assertEqual(recs['records'][0]['cycle_number'], 4) + self.assertEqual(g.read('records.stored'), 200) + + def test_program_editing_panel_keys_and_toggle(self): + g = Rig() + g.on() + out = g.call(g.A, 'program.configure', program='extended_time', time_s=999 * 60.0, temperature_k=378.15) + self.assertEqual(out['parameters']['time_s'], 999 * 60.0) + g.call(g.A, 'program.configure', program='custom_1', temperature_k=411.15, exhaust='slow_waste', end_temperature_k=353.15) + first = g.read('program.current')['program'] + nxt = g.call(g.A, 'program.next')['program'] + self.assertNotEqual(first, nxt) + self.assertTrue(g.call(g.A, 'cycle.toggle')['running']) + g.step(30.0) + self.assertFalse(g.call(g.A, 'cycle.toggle')['running']) + self.assertFalse(g.call(g.A, 'power.press_switch')['on']) + self.assertTrue(g.call(g.A, 'power.press_switch')['on']) + + def test_waste_bag_lags_and_non_autoclavable_note(self): + g = Rig() + g.on() + g.open_lid() + notes = g.call(g.A, 'load.add', load_id='bag', kind='waste', mass_kg=2.0, material='pp', organism=BI, log10_n0=6.0)['notes'] + self.assertEqual(notes, []) + notes = g.call(g.A, 'load.add', load_id='tube', kind='solid', mass_kg=0.1, material='ldpe')['notes'] + self.assertTrue(any('ldpe' in n for n in notes)) + notes = g.call(g.A, 'load.add', load_id='eth', kind='liquid', mass_kg=0.2, liquid='ethanol', container_volume_m3=5e-4, material='borosilicate_glass', + closure='sealed')['notes'] + self.assertEqual(len(notes), 2) # sealed closure and a boiling point below 100 C + g.call(g.A, 'load.remove', load_id='eth') + g.close_lid() + g.run('waste_121') + tl = g.read('truth.loads') + self.assertLess(tl['bag']['F0_s'], g.call(g.A, 'records.read', last=1)['records'][0]['chamber_F0_s'] * 0.8) + self.assertTrue(tl['tube']['deformed']) + _water_balance(self, g.ledger()) + + +class ReviewRegressions(unittest.TestCase): + def test_open_chamber_stays_atmospheric_when_loaded(self): # round-1 R1-02 / C1-06 + g = Rig() + g.on() + g.open_lid() + g.call(g.A, 'load.add', load_id='w', kind='liquid', mass_kg=8.0, liquid='water', container_volume_m3=0.01, material='borosilicate_glass', closure='loose') + g.step(5.0) + self.assertAlmostEqual(g.read('truth.chamber')['pressure_pa'], 101325.0, delta=1.0) + self.assertFalse(g.read('lid.locked')) + g.close_lid() + g.step(600.0) + g.call(g.A, 'lid.set', open=True) # idle, cold: the lid opens again + + def test_liquid_hold_counts_on_the_reference_bottle(self): # round-1 R1-01 + g = Rig() + g.on() + g.open_lid() + g.bottles(2) + g.close_lid() + g.run('liquids_121') + rec = g.call(g.A, 'records.read', last=1)['records'][-1] + self.assertEqual(rec['result'], 'CYCLE ENDED') + L = g.read('truth.loads') + # the reference bottle was at >= 120.6 C for the whole 20 min hold: its F0 is close to the hold time + self.assertGreater(min(x['F0_s'] for x in L.values()), 0.8 * 1200.0, L) + + def test_stop_during_exhaust_keeps_venting(self): # round-1 R1-03 + g = Rig() + g.on() + g.call(g.A, 'program.select', program='solids_121') + g.call(g.A, 'cycle.start') + while g.read('cycle.status')['stage'] != 'exhaust': + g.step(10.0) + g.step(2.0) + g.call(g.A, 'cycle.stop') + g.step(300.0) + self.assertLess(g.read('truth.chamber')['pressure_pa'], 101325.0 + 3e3) + st = g.read('cycle.status') + self.assertIn(st['stage'], ('drain', 'failed')) + + def test_hot_restart_flashes_stored_heat(self): # round-1 R1-08 + g = Rig() + g.on() + g.call(g.A, 'program.select', program='solids_121') + g.call(g.A, 'cycle.start') + while g.read('cycle.status')['stage'] != 'sterilization': + g.step(10.0) + g.call(g.A, 'power.set', on=False) # power fail: CYCLE FAIL, chamber stays hot and pressurised + g.step(60.0) + g.call(g.A, 'power.set', on=True) + before = g.ledger()['flash_vented_kg'] + T0 = g.read('truth.chamber')['water_temperature_k'] + self.assertGreater(T0, 374.0) + g.call(g.A, 'cycle.start') + g.step(30.0) + self.assertGreater(g.ledger()['flash_vented_kg'] - before, 1e-3) + _water_balance(self, g.ledger()) + + def test_drift_shifts_the_true_hold_and_faults_fail(self): # round-1 R1-05 / R1-07 + a, b = Rig(), Rig() + b.call(b.E, 'fault.inject', fault='temperature_sensor_drift', active=True) + for g in (a, b): + g.on() + g.call(g.A, 'program.select', program='solids_121') + g.call(g.A, 'cycle.start') + while g.read('cycle.status')['stage'] != 'sterilization': + g.step(10.0) + g.step(300.0) + self.assertLess(b.read('truth.chamber')['water_temperature_k'], a.read('truth.chamber')['water_temperature_k'] - 1.0) + c = Rig() + c.on() + c.call(c.E, 'fault.inject', fault='pressure_sensor_fault', active=True) + c.call(c.A, 'program.select', program='solids_121') + c.run('solids_121') + self.assertEqual(c.call(c.A, 'records.read', last=1)['records'][-1]['failure'], 'PRESS_SENSOR') + + def test_container_fill_and_separate_limits(self): # round-1 R1-06 / R1-09, C1-07 + g = Rig() + g.on() + g.open_lid() + g.call(g.A, 'load.add', expect='CONTAINER_OVERFILLED', load_id='x', kind='liquid', mass_kg=5.0, liquid='water', container_volume_m3=1e-6, material='pp') + r = g.call(g.A, 'load.add', load_id='e', kind='liquid', mass_kg=0.5, liquid='glycerol', container_volume_m3=1e-3, material='borosilicate_glass') + self.assertTrue(any('inconsistent' in n for n in r['notes']), r) + g.call(g.A, 'load.add', load_id='s', kind='solid', mass_kg=19.0, material='stainless_316') + g.call(g.A, 'load.add', load_id='l', kind='liquid', mass_kg=9.0, liquid='water', container_volume_m3=0.01, material='borosilicate_glass') # liquids and instruments counted separately + small, big = rt.TuttnauerElvdRuntime('a'), None + L1 = dict(kind='waste', mass_kg=0.1, cp=3000.0) + L2 = dict(kind='waste', mass_kg=5.0, cp=3000.0) + self.assertLess(small._load_ua(L1, True) / (0.1 * 3000.0), 0.7 * small._load_ua(L2, True) / (5.0 * 3000.0) * 10) + del big + + def test_records_hold_sensor_values_and_pressure_alarms(self): # round-2 R2-03 / R2-04 / R2-05 + g = Rig() + g.call(g.E, 'fault.inject', fault='temperature_sensor_drift', active=True) + g.on() + g.run('solids_121') + rec = g.call(g.A, 'records.read', last=1)['records'][-1] + self.assertGreater(rec['hold_min_k'], 394.15 - 0.6) # the record shows what sensor 1 read (drifted), not the truth + self.assertTrue(all(abs(x['T1_k'] - round(x['T1_k'], 2)) < 1e-9 for x in rec['log'])) + h = Rig() + h.on() + h.call(h.E, 'fault.inject', fault='heater_relay_stuck', active=True) + h.run('solids_121') + self.assertEqual(h.call(h.A, 'records.read', last=1)['records'][-1]['failure'], 'HIGH_PRESSURE') + lp = Rig() + lp.on() + lp.call(lp.A, 'program.select', program='solids_121') + lp.call(lp.A, 'cycle.start') + while lp.read('cycle.status')['stage'] != 'sterilization': + lp.step(10.0) + lp.call(lp.E, 'fault.inject', fault='pressure_sensor_drift', active=True) + lp.step(30.0) + self.assertIn('LOW_PRESSURE', lp.read('alarms.active')) + k = Rig() + k.on() + k.open_lid() + k.call(k.A, 'load.add', load_id='w', kind='liquid', mass_kg=8.0, liquid='water', container_volume_m3=0.01, material='borosilicate_glass') + self.assertAlmostEqual(k.read('truth.chamber')['pressure_pa'], 101325.0, delta=1.0) # no step needed + self.assertFalse(k.read('lid.locked')) + + +class ZCoverage(unittest.TestCase): + def test_all_capabilities_exercised(self): + implemented = {k for k in rt.CAPS if k not in rt.UNSUPPORTED} + missing = implemented - SEEN_CAPS + if len(SEEN_CAPS) > 5: + self.assertFalse(missing, sorted(missing)) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_asset_vaisala_dmt152.py b/tests/test_asset_vaisala_dmt152.py new file mode 100644 index 0000000000000000000000000000000000000000..28769a5db64a3b12c6734c5635f1988da222e377 --- /dev/null +++ b/tests/test_asset_vaisala_dmt152.py @@ -0,0 +1,526 @@ +"""tests for CHEM-195 vaisala_dmt152 (Vaisala DRYCAP dew point transmitter DMT152, ISO G1/2"): python3 -m unittest tests/test_asset_vaisala_dmt152.py + +Themes: contract consistency (slots, effects, errors raised vs declared); agent / evaluator truth isolation; idempotent request ids; two instances +isolated; step-partition independence; rejected calls leave the state unchanged; every output validated against its schema and every success +changes only declared slots; Hardy ITS-90 frost / dew point and ppmv; asymmetric response (wet -> dry T63 0.5 min / T90 7.5 min, dry -> wet +T63 2 s); accuracy within the spec over many units; pressure: the dew point at the sensor follows the sensor pressure, ppm needs the right PRES; +frost point below 0 C and condensation; power-up and weekly purge (frozen output), XPUR off; auto-calibration and the Autocal error; sampling +line wall sorption (wet new tubing dries slowly), polymer permeation, leak; unsuitable gases; analog outputs, limit / purge / malfunction alarm +levels and the 21 V current-output supply; calibration service; operating-temperature error; water ledger closing exactly.""" +import json +import math +import re +import sys +import unittest +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / 'scripts')) +from asset_runtime import vaisala_dmt152 as rt # noqa: E402 + +INST = 'vaisala_dmt152_01' +CHECKS = [] +SEEN_CAPS = set() +PROCESS_EVIDENCE = {} +N2_DRY = dict(gas='nitrogen', water_umol_mol=1.0, pressure_pa=101325.0, temperature_k=293.15) +N2_WET = dict(gas='nitrogen', water_umol_mol=1000.0, pressure_pa=101325.0, temperature_k=293.15) + + +def _differ(x, y): + if isinstance(x, float) and isinstance(y, float): + return abs(x - y) > 1e-12 * max(1.0, abs(x), abs(y)) + return json.dumps(x, sort_keys=True, default=str) != json.dumps(y, sort_keys=True, default=str) + + +class Rig: + def __init__(self, seed=1, instance=INST, fresh=False, **plant): + self.h = rt.VaisalaDmt152Runtime(instance) + self.h.register_principal('agent', 'agent') + self.h.register_principal('eval', 'evaluator') + self.A = self.h.session('agent') + self.E = self.h.session('eval') + self.n = 0 + self.inst = instance + self.call(self.E, 'plant.configure', **dict(rt.PLANT_EXAMPLE, noise_seed=seed, **plant)) + if not fresh: # default: cap removed and screwed directly into the process line + self.call(self.A, 'cap.remove') + self.call(self.A, 'installation.set', mode='direct') + + def call(self, sess, cap, expect='succeeded', **args): + self.n += 1 + before, t0 = self.h.read('evaluator'), self.h.t + r = sess.invoke(instance_id=self.inst, capability_id=cap, arguments=args, request_id=f'r{self.n}') + after = self.h.read('evaluator') + changed = {k for k in after if _differ(after[k], before[k])} - {'clock.time_s'} + if expect == 'succeeded': + assert r['status'] == 'succeeded', (cap, r['error']) + rt.validate(rt.CAPS[cap]['output_schema'], r['result']) + if cap != 'sim.step': + extra = changed - set(rt.EFFECTS.get(cap, [])) + assert not extra, (cap, sorted(extra)) + assert self.h.t == t0, cap + SEEN_CAPS.add(cap) + PROCESS_EVIDENCE.setdefault(cap, []).append(dict(arguments=json.dumps(args, sort_keys=True, default=str)[:200], time_s=t0, status=r['status'])) + return r['result'] + assert r['status'] in ('rejected', 'unsupported'), (cap, r['status'], r.get('result')) + assert r['error']['code'] == expect, (cap, r['error']['code'], expect) + assert not changed, (cap, 'rejected call changed', sorted(changed)) + assert expect in [e['code'] for e in rt.export_vaisala_dmt152_contract_metadata()['capabilities'][cap]['errors']], (cap, expect) + return r + + def step(self, s): + self.call(self.E, 'sim.step', dt_s=float(s)) + + def read(self, *ids, who=None): + sess = who or self.E + o = sess.read(instance_id=self.inst, state_ids=list(ids) if ids else None)['observations'] + return {k: v['value'] for k, v in o.items()} if not ids or len(ids) > 1 else o[ids[0]]['value'] + + def ready(self, process=N2_DRY, settle=3600.0): + self.call(self.E, 'process.set', **process) + self.call(self.A, 'power.set', on=True, voltage_v=24.0) + self.step(settle) + + def until(self, pred, limit, every=0.5): + t = 0.0 + while not pred() and t < limit: + self.step(every) + t += every + return t + + def ledger(self): + return self.call(self.E, 'ledger.read')['ledger'] + + +def _raised_codes(): + src = Path(rt.__file__).read_text() + funcs = {} + for m in re.finditer(r'\n def (\w+)\(self[^\n]*\n(.*?)(?=\n def |\n# ----|\nclass |\ndef )', src, re.S): + funcs[m.group(1)] = m.group(2) + own = {k: set(re.findall(r"ActionRejected\('([A-Z_]+)'\)", v)) for k, v in funcs.items()} + calls = {k: set(re.findall(r'self\.(_\w+)\(', v)) & set(funcs) for k, v in funcs.items()} + out = {} + for k in funcs: + if not k.startswith('_cmd_'): + continue + seen, todo, codes = set(), [k], set() + while todo: + f = todo.pop() + if f in seen: + continue + seen.add(f) + codes |= own.get(f, set()) + todo += [g for g in calls.get(f, ()) if g not in ('_cmd_sim_step', 'step', '_tick')] + out[k[5:].replace('_', '.', 1)] = codes + return out + + +def _balance(test, L): + lhs = L['water_in_mol'] + L['water_permeated_mol'] + L['water_leaked_mol'] + L['water_desorbed_mol'] # gas phase (quasi-steady) + rhs = L['water_out_mol'] + L['water_adsorbed_mol'] + test.assertAlmostEqual(lhs, rhs, delta=1e-9 * max(lhs, 1e-12)) + walls = L['water_installed_with_tubing_mol'] - L['water_removed_with_tubing_mol'] + L['water_adsorbed_mol'] - L['water_desorbed_mol'] + test.assertAlmostEqual(walls, L['water_on_walls_mol'], delta=1e-9 * max(L['water_installed_with_tubing_mol'] + L['water_adsorbed_mol'], 1e-15)) + + +class Contract(unittest.TestCase): + def test_metadata_slots_effects_consistent(self): + meta = rt.export_vaisala_dmt152_contract_metadata() + slots = set(meta['state_slots']) + self.assertEqual(slots, set(rt.SLOTS)) + for k, c in meta['capabilities'].items(): + for e in c['state_effects']: + self.assertIn(e['state_id'], slots, k) + for x in c['observes']: + self.assertIn(x, slots, k) + self.assertTrue({'INVALID_ARGUMENT', 'REQUEST_CONFLICT', 'UNKNOWN_INSTANCE'} <= {e['code'] for e in c['errors']}, k) + for name, p in meta['mechanisms']['trace_moisture_measurement']['parameters'].items(): + self.assertEqual(name, name.lower()) + self.assertIn(p['evidence'], ('documented', 'assumption'), name) + + def test_declared_errors_cover_raised_codes(self): + meta = rt.export_vaisala_dmt152_contract_metadata() + for cap, codes in _raised_codes().items(): + declared = {e['code'] for e in meta['capabilities'][cap]['errors']} + self.assertTrue(codes <= declared, (cap, sorted(codes - declared))) + + def test_unsupported_capabilities(self): + g = Rig() + for k in rt.UNSUPPORTED: + g.call(g.A, k, expect='UNSUPPORTED') + + def test_agent_truth_isolation(self): + g = Rig() + g.ready(settle=10.0) + self.assertFalse(any(k.startswith('truth.') for k in g.read(who=g.A))) + r = g.A.invoke(instance_id=INST, capability_id='truth.inspect', arguments={}, request_id='x') + self.assertEqual(r['error']['code'], 'ACCESS_DENIED') + r = g.A.invoke(instance_id=INST, capability_id='process.set', arguments=N2_WET, request_id='y') + self.assertEqual(r['error']['code'], 'ACCESS_DENIED') + g.call(g.E, 'fault.inject', fault='sensor_oil_contamination', active=True) + ev = g.call(g.A, 'events.read', since_s=0.0)['events'] + self.assertFalse(any(e['kind'] in ('fault', 'truth') for e in ev)) + + def test_idempotent_request_ids(self): + g = Rig() + a = g.A.invoke(instance_id=INST, capability_id='power.set', arguments=dict(on=True), request_id='same') + b = g.A.invoke(instance_id=INST, capability_id='power.set', arguments=dict(on=True), request_id='same') + self.assertEqual(a, b) + c = g.A.invoke(instance_id=INST, capability_id='power.set', arguments=dict(on=False), request_id='same') + self.assertEqual(c['error']['code'], 'REQUEST_CONFLICT') + + def test_two_instances_isolated(self): + a, b = Rig(instance='i1'), Rig(instance='i2') + a.ready(process=N2_WET, settle=600.0) + self.assertFalse(b.read('power.on')) + self.assertIsNone(b.read('reading.tdf_k')) + + def test_step_partition_independence(self): + runs = [] + for parts in ([1800.0], [0.3, 7.7, 400.0, 1392.0], [0.5] * 60 + [1770.0]): + g = Rig(seed=7) + g.call(g.E, 'process.set', **N2_DRY) + g.call(g.A, 'installation.set', **rt.INSTALL_EXAMPLE) + g.call(g.A, 'power.set', on=True) + for p in parts: + g.step(p) + v = g.read() + v.pop('clock.time_s') + runs.append(json.dumps(v, sort_keys=True, default=str)) + self.assertEqual(runs[0], runs[1]) + self.assertEqual(runs[0], runs[2]) + + def test_rejections_change_nothing(self): + g = Rig() + r = rt.VaisalaDmt152Runtime('fresh') + r.register_principal('e', 'evaluator') + self.assertEqual(r.session('e').invoke(instance_id='fresh', capability_id='power.set', arguments=dict(on=True), request_id='p')['error']['code'], 'PLANT_REQUIRED') + g.call(g.E, 'plant.configure', expect='SEED_FIXED', **dict(rt.PLANT_EXAMPLE, noise_seed=2)) + g.call(g.A, 'measurement.send', expect='POWER_OFF') + g.call(g.A, 'errors.read', expect='POWER_OFF') + g.call(g.A, 'settings.configure', expect='POWER_OFF', pressure_pa=1e5) + g.call(g.A, 'output.configure', expect='POWER_OFF', channel=1, mode='0-5V') + g.call(g.E, 'process.set', expect='PRESSURE_TOO_HIGH', **dict(N2_DRY, pressure_pa=55e5)) + g.call(g.A, 'installation.set', expect='MISSING_SETTING', mode='sampling_line', tubing_length_m=1.0) + g.call(g.E, 'process.set', **N2_DRY) + g.call(g.A, 'power.set', on=True) + g.call(g.A, 'calibration.service', expect='POWER_ON') + g.call(g.A, 'settings.configure', expect='PRESSURE_TOO_LOW', xpressure_pa=5000.0) + g.call(g.A, 'output.configure', expect='RANGE_ORDER', channel=1, lo=250.0, hi=200.0) + g.call(g.A, 'output.configure', expect='ERROR_LEVEL_OUT_OF_RANGE', channel=2, error_level=50.0) + g.call(g.A, 'installation.set', **dict(rt.INSTALL_EXAMPLE, sensor_pressure_pa=101325.0)) + g.call(g.E, 'process.set', **dict(N2_DRY, pressure_pa=55e5)) # sampling line: the line may exceed 50 bar + g.call(g.A, 'installation.set', expect='PRESSURE_TOO_HIGH', mode='direct') + g.call(g.E, 'fault.inject', expect='INVALID_ARGUMENT', fault='alien', active=True) + + +class Physics(unittest.TestCase): + def test_hardy_frost_point_and_ppm(self): + self.assertAlmostEqual(rt.e_water(273.16), 611.657, delta=0.05) + self.assertAlmostEqual(rt.e_ice(273.16), 611.657, delta=0.05) + x10 = 10e-6 / (1 + 10e-6) + self.assertAlmostEqual(rt.dewpoint(x10, 101325.0) - 273.15, -60.5, delta=0.3) # 10 ppmv ~ -60.5 C frost point (1 atm) + self.assertAlmostEqual(rt.ppmv_from(rt.dewpoint(x10, 101325.0), 101325.0), 10.0, delta=0.01) + self.assertGreater(rt.dewpoint(x10, 7e5), rt.dewpoint(x10, 1e5) + 15.0) # pressure raises the dew point (tens of degrees) + self.assertLess(rt.e_ice(263.15), rt.e_water(263.15)) # frost point below 0 C + + def test_asymmetric_response_matches_datasheet(self): + g = Rig() + g.ready(process=dict(N2_DRY, water_umol_mol=1000.0 * math.exp(0)), settle=4 * 3600.0) + wet = rt.dewpoint(1000e-6 / (1 + 1000e-6), 101325.0) + dry_x = 0.55e-6 + dry = rt.dewpoint(dry_x / (1 + dry_x), 101325.0) + tr = lambda: g.read('truth.sensor') # noqa: E731 + y = lambda s: s['y_k'] # noqa: E731 + g.call(g.E, 'process.set', **dict(N2_DRY, water_umol_mol=0.55)) + start = y(tr()) + t63 = g.until(lambda: start - y(tr()) >= 0.63 * (start - dry), 3600.0) + t90 = g.until(lambda: start - y(tr()) >= 0.90 * (start - dry), 7200.0) + t63 + self.assertAlmostEqual(t63, 30.0, delta=10.0) + self.assertAlmostEqual(t90, 450.0, delta=120.0) + g.step(4 * 3600.0) + start = y(tr()) + g.call(g.E, 'process.set', **dict(N2_DRY, water_umol_mol=1000.0)) + t63w = g.until(lambda: y(tr()) - start >= 0.63 * (wet - start), 600.0) + self.assertLessEqual(t63w, 5.5) # 2 s at 20 C (+ line update granularity) + CHECKS.append(dict(t63_drying_s=t63, t90_drying_s=t90, t63_wetting_s=t63w)) + + def test_accuracy_within_spec_over_units(self): + within = 0 + n = 24 + for seed in range(n): + g = Rig(seed=100 + seed) + g.ready(process=dict(N2_DRY, water_umol_mol=10.0), settle=2.5 * 3600.0) + err = g.read('reading.tdf_k') - g.read('truth.gas')['dew_point_sensor_k'] + within += abs(err) <= rt.DOC['accuracy_dry_k'] + self.assertGreaterEqual(within, int(0.85 * n)) + + def test_sampling_pressure_and_ppm_setting(self): + g = Rig() + hp = dict(N2_DRY, water_umol_mol=20.0, pressure_pa=7e5) + g.call(g.E, 'process.set', **hp) + g.call(g.A, 'installation.set', **dict(rt.INSTALL_EXAMPLE, tubing_length_m=0.3, pre_dried=True, sensor_pressure_pa=101325.0)) + g.call(g.A, 'power.set', on=True) + g.step(6 * 3600.0) + tg = g.call(g.E, 'truth.inspect')['gas'] + self.assertLess(tg['dew_point_sensor_k'], tg['dew_point_line_k'] - 15.0) # several tens of degrees between 7 bar and 1 bar + ppm_ok = g.read('reading.h2o_umol_mol') + g.call(g.A, 'settings.configure', pressure_pa=7e5) # wrong PRES (line pressure, not the sensor pressure) + ppm_bad = g.read('reading.h2o_umol_mol') + self.assertLess(abs(ppm_ok - 20.0), 0.2 + 0.4 * 20.0) + self.assertLess(ppm_bad, 0.25 * ppm_ok) + g.call(g.A, 'settings.configure', xpressure_pa=101325.0) # XPRES overrides PRES + self.assertAlmostEqual(g.read('reading.h2o_umol_mol'), ppm_ok, delta=1e-9) + g.call(g.A, 'settings.configure', molar_mass_kg_mol=0.028014) + self.assertAlmostEqual(g.read('reading.h2o_mg_kg') / g.read('reading.h2o_umol_mol'), rt.M_W / 0.028014, delta=1e-9) + + def test_power_up_purge_weekly_purge_and_xpur(self): + g = Rig() + g.call(g.E, 'process.set', **N2_DRY) + g.call(g.A, 'power.set', on=True) + g.step(1.0) + self.assertEqual(g.read('state.current'), 'purge') + self.assertIsNone(g.read('reading.tdf_k')) # nothing measured yet + self.assertTrue(g.read('reading.frozen')) + g.call(g.A, 'output.configure', channel=1, mode='U-alarm', purge_status=True) # purge status only in an ON/OFF alarm mode (AMODE 8) + g.step(1.0) + self.assertEqual(g.read('output.analog')['ch1']['state'], 'purge_status') + self.assertAlmostEqual(g.read('output.analog')['ch1']['value'], 10.0, delta=1e-12) + g.step(rt.DOC['startup_approx_reading_s']) + self.assertIsNotNone(g.read('reading.tdf_k')) # approximated reading after one minute + self.assertTrue(g.read('reading.frozen')) + g.call(g.A, 'output.configure', channel=1, mode='4-20mA') + g.step(rt.DOC['startup_normal_s'][0]) # start-up: normal operation after about 10 min + self.assertEqual(g.read('state.current'), 'measuring') + g.step(rt.DOC['purge_interval_s'] + 1.0) # weekly purge, counted from the end of the last one + self.assertEqual(g.read('state.current'), 'purge') + held = g.read('reading.tdf_k') + g.call(g.E, 'process.set', **N2_WET) + g.step(60.0) + self.assertEqual(g.read('reading.tdf_k'), held) # frozen to the last measured value + g.step(rt.ENG['purge_duration_s']) + self.assertGreater(g.read('reading.tdf_k'), held + 20.0) + d0 = g.read('truth.sensor')['drift_k'] + g.call(g.A, 'settings.configure', purge_enabled=False) + g.step(7 * 86400.0) + self.assertGreater(g.read('truth.sensor')['drift_k'] - d0, 0.15) # XPUR OFF: extra wet-end drift (about 1 K / month) + self.assertNotEqual(g.read('state.current'), 'purge') + + def test_autocal_error_after_failures(self): + g = Rig() + g.ready(settle=10.0) + g.call(g.E, 'fault.inject', fault='autocal_disturbed', active=True) + g.step(6 * 3600.0) + self.assertIn('Autocal error', g.read('diagnostics.errors')) + self.assertIn('malfunction', g.read('alarms.active')) + self.assertIsNotNone(g.read('reading.tdf_k')) # measurement continues + g.call(g.E, 'fault.inject', fault='autocal_disturbed', active=False) + g.step(3600.0) + self.assertNotIn('Autocal error', g.read('diagnostics.errors')) + + def test_sampling_line_materials_leak_and_ledger(self): + res = {} + for mat in ('ss316l_ep', 'ptfe', 'pa6'): + g = Rig() + g.call(g.E, 'process.set', **dict(N2_DRY, water_umol_mol=0.5)) + r = g.call(g.A, 'installation.set', **dict(rt.INSTALL_EXAMPLE, tubing_material=mat, tubing_length_m=5.0)) + if mat != 'ss316l_ep': + self.assertTrue(any('塑料' in n for n in r['notes'])) + g.call(g.A, 'power.set', on=True) + g.step(1800.0) + early = g.read('truth.gas')['dew_point_sensor_k'] + g.step(48 * 3600.0) + res[mat] = (early, g.read('truth.gas')['dew_point_sensor_k']) + _balance(self, g.ledger()) + d = Rig() + d.call(d.E, 'process.set', **dict(N2_DRY, water_umol_mol=0.5)) + d.step(10.0) + direct = d.read('truth.gas')['dew_point_sensor_k'] + self.assertGreater(res['ss316l_ep'][0], direct + 5.0) # wet new tubing: wetter than the gas after 30 min + self.assertLess(res['ss316l_ep'][1], res['ss316l_ep'][0] - 5.0) # and dries down over hours + self.assertLess(abs(res['ss316l_ep'][1] - direct), 0.5) + self.assertGreater(res['ptfe'][1], res['ss316l_ep'][1] + 1.0) # polymer permeation keeps it wetter + self.assertGreater(res['pa6'][1], res['ss316l_ep'][1] + 1.0) # (per mm of wall the CMC film data rank PTFE above PA6) + g = Rig() + g.call(g.E, 'process.set', **dict(N2_DRY, water_umol_mol=0.5)) + g.call(g.A, 'installation.set', **dict(rt.INSTALL_EXAMPLE, tubing_length_m=1.0, pre_dried=True)) + g.step(3600.0) + t0 = g.read('truth.gas')['dew_point_sensor_k'] + g.call(g.E, 'fault.inject', fault='sample_line_leak', active=True) + g.step(4 * 3600.0) + self.assertGreater(g.read('truth.gas')['dew_point_sensor_k'], t0 + 5.0) + _balance(self, g.ledger()) + + def test_unsuitable_gases_and_condensation(self): + g = Rig() + r = g.call(g.E, 'process.set', **dict(N2_DRY, gas='hydrogen', water_umol_mol=10.0)) + self.assertTrue(any('不适用' in n for n in r['notes'])) + g.call(g.A, 'power.set', on=True) + g.step(4 * 3600.0) + self.assertGreater(g.read('truth.sensor')['gas_bias_k'], 1.5) + r = g.call(g.E, 'process.set', **dict(N2_DRY, gas='ammonia', water_umol_mol=10.0)) + self.assertTrue(any('咨询厂家' in n for n in r['notes'])) + g.call(g.E, 'process.set', expect='CONDENSING', **dict(N2_DRY, water_umol_mol=40000.0, temperature_k=288.15)) + g.call(g.E, 'process.set', **dict(N2_DRY, water_umol_mol=40000.0, temperature_k=313.15)) # hot humid gas, sampled at room temperature + g.call(g.A, 'installation.set', **dict(rt.INSTALL_EXAMPLE, sensor_pressure_pa=N2_DRY['pressure_pa'])) + g.step(600.0) + Ts = g.read('truth.sensor')['sensor_temperature_k'] if 'sensor_temperature_k' in g.read('truth.sensor') else 295.15 + self.assertLessEqual(g.read('truth.sensor')['target_k'], Ts + rt.ENG['condensation_margin_k'] + 1e-9) # condensation: saturates at the sensor temperature + self.assertGreater(g.read('reading.tdf_k'), 273.15) # above 0 C: dew point + self.assertFalse(g.read('reading.in_calibrated_range')) + + def test_outputs_alarms_and_supply(self): + g = Rig() + g.ready(process=dict(N2_DRY, water_umol_mol=10.0), settle=4 * 3600.0) + td = g.read('reading.tdf_k') + ch1 = g.read('output.analog')['ch1'] + self.assertAlmostEqual(ch1['value'], 0.004 + 0.016 * (td - 193.15) / 100.0, delta=1e-12) + g.call(g.A, 'output.configure', channel=1, limit_alarm=dict(lo=150.0, hi=td - 5.0)) + g.step(1.0) + self.assertNotIn('ch1_limit_alarm', g.read('alarms.active')) # AMODE 1-5: limit alarm disabled + g.call(g.A, 'output.configure', channel=1, mode='I-alarm') + g.step(1.0) + self.assertIn('ch1_limit_alarm', g.read('alarms.active')) + self.assertAlmostEqual(g.read('output.analog')['ch1']['value'], 0.020, delta=1e-12) + g.call(g.A, 'output.configure', channel=1, mode='4-20mA', limit_alarm=None) + g.step(1.0) + self.assertNotIn('ch1_limit_alarm', g.read('alarms.active')) + g.call(g.A, 'output.configure', channel=2, mode='0-5V', quantity='ppm', lo=0.0, hi=100.0, error_level=0.0) + g.step(1.0) + self.assertAlmostEqual(g.read('output.analog')['ch2']['value'], 5.0 * g.read('reading.h2o_umol_mol') / 100.0, delta=1e-9) + g.call(g.A, 'power.set', on=True, voltage_v=18.0) + g.step(1.0) + self.assertIn('Voltage too low for mA output error', g.read('diagnostics.errors')) + g.call(g.A, 'power.set', on=True, voltage_v=24.0) + g.call(g.E, 'fault.inject', fault='sensor_damage', active=True) + g.step(1.0) + self.assertIsNone(g.read('reading.tdf_k')) + self.assertEqual(g.read('output.analog')['ch1']['state'], 'malfunction') + self.assertAlmostEqual(g.read('output.analog')['ch1']['value'], 0.020, delta=1e-12) + self.assertIn('T meas error', g.call(g.A, 'errors.read')['errors']) + s = g.call(g.A, 'measurement.send') + self.assertIsNone(s['tdf_k']) + + def test_drift_calibration_service_and_temperature_error(self): + g = Rig(seed=5, calibration_age_s=1.8 * rt.YEAR_S) + g.ready(process=dict(N2_DRY, water_umol_mol=300.0), settle=3600.0) + self.assertGreater(g.read('calibration.age_s'), 1.8 * rt.YEAR_S) + d0 = g.read('truth.sensor')['drift_k'] + g.call(g.A, 'power.set', on=False) + g.call(g.A, 'calibration.service', expect='INSTALLED') + g.call(g.A, 'installation.remove') + r = g.call(g.A, 'calibration.service') + self.assertTrue(r['calibrated']) + self.assertLess(abs(g.read('truth.sensor')['drift_k']), abs(d0) + 1e-12) + g.call(g.A, 'installation.set', mode='direct') + g.call(g.A, 'power.set', on=True) + g.call(g.E, 'process.set', **dict(N2_DRY, temperature_k=353.15)) + g.step(rt.DOC['startup_normal_s'][0] + 10.0) + self.assertIn('Ambient temperature error', g.read('diagnostics.errors')) + self.assertIsNone(g.read('reading.tdf_k')) + + +class ReviewR1(unittest.TestCase): + """Round-1 review fixes: process truth hidden from agent events, polymer bulk water uptake, H2 bias gated / capped / reset, auto-calibration + period start to start, setup checks, tick anchoring.""" + def test_agent_events_hide_the_process_truth(self): + g = Rig() + g.ready(process=dict(N2_DRY, water_umol_mol=7.3), settle=60.0) + ev = g.call(g.A, 'events.read', since_s=0.0)['events'] + self.assertFalse([e for e in ev if e['code'] == 'PROCESS_SET']) + + def test_nylon_line_dries_much_slower_than_stainless(self): + out = {} + for mat in ('pa6', 'ss316l_ep'): + g = Rig() + g.ready(process=dict(N2_DRY, water_umol_mol=10.0), settle=1.0) + g.call(g.A, 'installation.set', **dict(rt.INSTALL_EXAMPLE, tubing_material=mat, sensor_pressure_pa=N2_DRY['pressure_pa'])) + g.step(3600.0) + out[mat] = g.read('truth.gas')['water_sensor_umol_mol'] if 'water_sensor_umol_mol' in g.read('truth.gas') else g.read('reading.h2o_umol_mol') + out[mat + '_wall'] = g.read('truth.line')['wall_water_mol'] + _balance(self, g.ledger()) + self.assertGreater(out['pa6'], 5 * out['ss316l_ep'], out) + self.assertGreater(out['pa6_wall'], 50 * out['ss316l_ep_wall'], out) + + def test_h2_bias_only_when_exposed_and_capped(self): + g = Rig(fresh=True) # capped, not installed + g.call(g.E, 'process.set', **dict(N2_DRY, gas='hydrogen')) + g.step(10 * 86400.0) + self.assertEqual(g.read('truth.sensor')['gas_bias_k'], 0.0) + h = Rig() + h.ready(process=dict(N2_DRY, gas='hydrogen'), settle=1.0) + h.step(14 * 86400.0) + self.assertLessEqual(h.read('truth.sensor')['gas_bias_k'], rt.ENG['h2_bias_max_k'] + 1e-9) + + def test_autocal_every_45_min_and_setup_checks(self): + g = Rig() + g.ready(process=dict(N2_DRY, water_umol_mol=300.0), settle=1.0) + g.step(4 * 3600.0) + ok = [e['time_s'] for e in g.call(g.A, 'events.read', since_s=0.0)['events'] if e['code'] in ('AUTOCAL_OK', 'AUTOCAL_FAILED')] + gaps = {round(b - a) for a, b in zip(ok, ok[1:])} + self.assertEqual(gaps, {int(rt.DOC['autocal_interval_s'])}, ok) + g.call(g.A, 'installation.set', expect='INVALID_SETUP', **dict(rt.INSTALL_EXAMPLE, sensor_pressure_pa=40e5)) + + def test_tick_anchored_when_stepping_before_the_plant(self): + h = rt.VaisalaDmt152Runtime('x') + h.step(0.5) + self.assertEqual(h.tick, 1) + + +class ReviewR2(unittest.TestCase): + """Round-2 minors fixed directly: persistent H2 bias, condensing line noted, consistent pressure tolerance, no reading from a damaged sensor in the purge.""" + def test_h2_bias_persists_after_switching_gas(self): + g = Rig() + g.ready(process=dict(N2_DRY, gas='hydrogen'), settle=10 * 3600.0) + b = g.read('truth.sensor')['gas_bias_k'] + g.call(g.E, 'process.set', **N2_DRY) + self.assertAlmostEqual(g.read('truth.sensor')['gas_bias_k'], b, delta=1e-9) + + def test_condensing_line_noted_and_pressure_tolerance(self): + g = Rig() + g.ready(process=N2_DRY, settle=60.0) + g.call(g.A, 'installation.set', **dict(rt.INSTALL_EXAMPLE, sensor_pressure_pa=N2_DRY['pressure_pa'] * 1.00005)) + g.call(g.E, 'process.set', **N2_DRY) # same tolerance as installation.set + r = g.call(g.E, 'process.set', **dict(N2_DRY, water_umol_mol=40000.0, temperature_k=333.15)) + self.assertTrue(any('冷凝' in n for n in r['notes']), r['notes']) + + def test_damaged_sensor_no_reading_during_startup(self): + g = Rig() + g.call(g.E, 'process.set', **N2_DRY) + g.call(g.E, 'fault.inject', fault='sensor_damage', active=True) + g.call(g.A, 'power.set', on=True, voltage_v=24.0) + g.step(120.0) + self.assertIsNone(g.call(g.A, 'measurement.send')['tdf_k']) + + +class TransportCap(unittest.TestCase): + def test_cap_keeps_sensor_dry_and_blocks_installation(self): + g = Rig(fresh=True) + self.assertTrue(g.read('cap.fitted')) + self.assertEqual(g.read('cap.offset_m'), 0.0) + g.call(g.A, 'installation.set', expect='CAP_ON', mode='direct') + g.call(g.A, 'power.set', on=True) + g.step(3600.0) + self.assertAlmostEqual(g.read('truth.sensor')['y_k'], rt.ENG['cap_storage_dew_point_k'], delta=1e-9) # sealed under the cap + g.call(g.A, 'cap.remove') + self.assertAlmostEqual(g.read('cap.offset_m'), rt.CAP_TRAVEL, delta=1e-12) + g.step(60.0) + self.assertGreater(g.read('truth.sensor')['y_k'], rt.ENG['cap_storage_dew_point_k'] + 20.0) # wets quickly in room air + g.call(g.A, 'installation.set', mode='direct') + g.call(g.A, 'cap.fit', expect='INSTALLED') + g.call(g.A, 'installation.remove') + g.call(g.A, 'installation.remove', expect='NOT_INSTALLED') + g.call(g.A, 'cap.fit') + g.call(g.A, 'cap.fit', expect='CAP_ALREADY_FITTED') + + +class ZCoverage(unittest.TestCase): + def test_all_capabilities_exercised(self): + implemented = {k for k in rt.CAPS if k not in rt.UNSUPPORTED} + missing = implemented - SEEN_CAPS + if len(SEEN_CAPS) > 5: + self.assertFalse(missing, sorted(missing)) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_asset_wtw_oxitopi.py b/tests/test_asset_wtw_oxitopi.py new file mode 100644 index 0000000000000000000000000000000000000000..38eb59bbb5c96ca7958069ab36a5f9e8fb999d06 --- /dev/null +++ b/tests/test_asset_wtw_oxitopi.py @@ -0,0 +1,855 @@ +"""tests for CHEM-171 wtw_oxitopi (WTW OxiTop-i IS 6 respirometric BOD system): python3 -m unittest tests/test_asset_wtw_oxitopi.py + +Themes: contract consistency (slots, effects, errors raised vs declared); agent / evaluator truth isolation and foreign-agent ownership; idempotent +request ids; two instances isolated; step-partition independence; rejected calls leave the state unchanged; every output validated against its +schema and every success changes only declared slots; WTW BOD equation and the manual's factor table; Benson-Krause oxygen solubility; oxygen +conservation in the closed bottle; glucose / glutamic acid check (WTW 260 +- 30 mg/l stirred, DIN 210 +- 40 mg/l with the literature rates, blank +<= 2 mg/l); missing NaOH, missing stirring, untight head, NaOH in the sample; nitrification and ATU; AutoTemp (cold sample, test interval by +duration, 3 h latest start); daily storage, end of measurement, green LED for 24 h; units and digits; range exceeded; OxiTop PM tablet against the lot +value; OxiTop PT against the altitude table; battery drain, low-battery red LED, battery replacement; LED flash pattern; display switch-off; key +menu; incubator door and failure; sample preparation (dilution, seeding, pH adjustment, buffer chemistry); seeded-dilution evaluation; library +substances (degradable vs refractory) and evaluator-defined substances; inhibitors and chlorine.""" +import copy +import json +import math +import re +import sys +import unittest +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / 'scripts')) +from asset_runtime import wtw_oxitopi as rt # noqa: E402 + +INST = 'oxitop_i_is6_01' +CHECKS = [] +SEEN_CAPS = set() +PROCESS_EVIDENCE = {} +DAY = 86400.0 +DROPS = {22.7: 1, 43.5: 1, 97.0: 2, 164.0: 3, 250.0: 5, 365.0: 7, 432.0: 9} + + +def _differ(x, y): + if isinstance(x, float) and isinstance(y, float): + return abs(x - y) > 1e-12 * max(1.0, abs(x), abs(y)) + return x != y + + +class Rig: + def __init__(self, seed=1, incubator=293.15, room=295.15, pressure=101325.0, instance=INST): + self.h = rt.WtwOxitopiRuntime(instance) + self.h.register_principal('agent', 'agent') + self.h.register_principal('eval', 'evaluator') + self.A = self.h.session('agent') + self.E = self.h.session('eval') + self.n = 0 + self.inst = instance + self.call(self.E, 'plant.configure', incubator_k=incubator, room_k=room, ambient_pressure_pa=pressure, noise_seed=seed) + + def call(self, sess, cap, expect='succeeded', **args): + """Instrumented call: outputs validated against the declared schema; a success changes only declared immediate slots and never the clock; + a rejection leaves every slot unchanged and returns a declared error code.""" + self.n += 1 + before, t0 = self.h.read('evaluator'), self.h.t + r = sess.invoke(instance_id=self.inst, capability_id=cap, arguments=args, request_id=f'r{self.n}') + after = self.h.read('evaluator') + changed = {k for k in after if _differ(after[k], before[k])} - {'clock.time_s'} + if expect == 'succeeded': + assert r['status'] == 'succeeded', (cap, r['error']) + rt.validate(rt.CAPS[cap]['output_schema'], r['result']) + if cap != 'sim.step': + extra = changed - set(rt.EFFECTS.get(cap, [])) + assert not extra, (cap, sorted(extra)) + assert self.h.t == t0, cap + SEEN_CAPS.add(cap) + PROCESS_EVIDENCE.setdefault(cap, []).append(dict(arguments=json.dumps(args, sort_keys=True, default=str)[:200], time_s=t0, status=r['status'])) + return r['result'] + assert r['status'] in ('rejected', 'unsupported'), (cap, r['status'], r.get('result')) + assert r['error']['code'] == expect, (cap, r['error']['code'], expect) + assert not changed, (cap, 'rejected call changed', sorted(changed)) + assert expect in [e['code'] for e in rt.export_wtw_oxitopi_contract_metadata()['capabilities'][cap]['errors']], (cap, expect) + return r + + def step(self, s): + self.call(self.E, 'sim.step', dt_s=float(s)) + + def read(self, *ids, who=None): + sess = who or self.E + o = sess.read(instance_id=self.inst, state_ids=list(ids) if ids else None)['observations'] + return {k: v['value'] for k, v in o.items()} if not ids or len(ids) > 1 else o[ids[0]]['value'] + + def kits(self, *names, volume=3e-3): + for k in names: + self.call(self.E, 'kit.provide', kit=k, volume_m3=volume) + + def free(self, pos, head=None): + """Take the stored head off bottle `pos` (and `head` off whatever bottle it sits on) before working on the bottle.""" + on = self.h.bottles[pos]['head'] + if on is not None: + self.call(self.A, 'head.unscrew', head=on) + if head is not None and self.h.heads[head]['position'] is not None: + self.call(self.A, 'head.unscrew', head=head) + + def load(self, pos, head, sample, ml, pellets=2, atu=True, bar=True, days=5, unit='mg/l', start=True, tight=True): + A = self.A + self.free(pos, head) + self.call(A, 'bottle.fill', position=pos, sample_id=sample, volume_m3=ml * 1e-6) + if bar: + self.call(A, 'bottle.add_stir_bar', position=pos) + if atu: + self.call(A, 'bottle.add_reagent', position=pos, reagent='nth_600', drops=DROPS[ml]) + self.call(A, 'bottle.insert_sleeve', position=pos, naoh_pellets=pellets) + self.call(A, 'head.screw_on', head=head, position=pos, tight=tight) + self.call(A, 'head.configure', head=head, duration_days=days, unit=unit, sample_volume_m3=ml * 1e-6) + if start: + self.call(A, 'head.start', head=head) + + def gga(self, seed_fraction=0.02): + """Respirometric check (BOD primer p.32-33, Standard Methods 5210 D): R10 diluted 1:100 in seeded dilution water (20 ml settled wastewater + per litre), 164 ml; blank = seeded dilution water, 432 ml.""" + self.kits('gga_stock_r10', 'nth_600', 'nhp_600', 'dilution_water', 'settled_sewage_seed') + self.call(self.A, 'sample.prepare', sample_id='std', volume_m3=1e-3, sources=[dict(source_id='gga_stock_r10', volume_m3=1e-5)], + seed_volume_fraction=seed_fraction, diluent='dilution_water', aerate=True, temperature_k=293.15) + self.call(self.A, 'sample.prepare', sample_id='blank', volume_m3=1e-3, sources=[], seed_volume_fraction=seed_fraction, diluent='dilution_water', + aerate=True, temperature_k=293.15) + + def stored(self, head, unit_value=True): + v = self.read('heads.stored_values')[head] + return [x['value'] for x in v] if unit_value else v + + def truth(self, pos): + return self.read('truth.bottles')[pos] + + +def _raised_codes(): + """Error codes each command can raise: its own ActionRejected calls plus those of the helpers it calls (static scan of the module source).""" + src = Path(rt.__file__).read_text() + funcs = {} + for m in re.finditer(r'\n def (\w+)\(self[^\n]*\n(.*?)(?=\n def |\n# ----|\nclass )', src, re.S): + funcs[m.group(1)] = m.group(2) + own = {k: set(re.findall(r"ActionRejected\('([A-Z_]+)'\)", v)) for k, v in funcs.items()} + calls = {k: set(re.findall(r'self\.(_\w+)\(', v)) & set(funcs) for k, v in funcs.items()} + out = {} + for k in funcs: + if not k.startswith('_cmd_'): + continue + seen, todo, codes = set(), [k], set() + while todo: + f = todo.pop() + if f in seen: + continue + seen.add(f) + codes |= own.get(f, set()) + todo += [g for g in calls.get(f, ()) if g not in ('_cmd_sim_step',)] + out[k[5:].replace('_', '.', 1)] = codes + return out + + +class Contract(unittest.TestCase): + def test_metadata_slots_effects_and_mirrors_consistent(self): + meta = rt.export_wtw_oxitopi_contract_metadata() + slots = set(meta['state_slots']) + self.assertEqual(slots, set(rt.SLOTS)) + for k, c in meta['capabilities'].items(): + for e in c['state_effects']: + self.assertIn(e['state_id'], slots, k) + for x in c['observes']: + self.assertIn(x, slots, k) + for pre in c['preconditions']: + self.assertTrue(set(pre['state_ids']) <= slots, k) + self.assertTrue({'INVALID_ARGUMENT', 'REQUEST_CONFLICT', 'UNKNOWN_INSTANCE'} <= {e['code'] for e in c['errors']}, k) + self.assertTrue(c['function_zh']) + self.assertTrue(rt.SCENE_MIRRORED <= slots) + for k in rt.SCENE_MIRRORED: + self.assertEqual(meta['state_slots'][k]['visibility'], 'agent', k) + self.assertEqual(len([k for k in slots if k.startswith('led.')]), 18) + mech = meta['mechanisms']['respirometric_bod_process'] + for name, p in mech['parameters'].items(): + self.assertEqual(name, name.lower()) + self.assertIn(p['evidence'], ('documented', 'assumption'), name) + + def test_declared_errors_cover_raised_codes(self): + meta = rt.export_wtw_oxitopi_contract_metadata() + for cap, codes in _raised_codes().items(): + if cap not in meta['capabilities']: + cap = next(k for k in meta['capabilities'] if k.replace('.', '_') == cap.replace('.', '_')) + declared = {e['code'] for e in meta['capabilities'][cap]['errors']} + self.assertTrue(codes <= declared, (cap, sorted(codes - declared))) + + def test_unsupported_capabilities(self): + g = Rig() + for k in rt.UNSUPPORTED: + r = g.A.invoke(instance_id=INST, capability_id=k, arguments={}, request_id='u-' + k) + self.assertEqual(r['status'], 'unsupported') + self.assertEqual(r['error']['code'], 'UNSUPPORTED') + + def test_agent_truth_isolation(self): + g = Rig() + d = g.A.describe(instance_id=INST) + self.assertFalse(any(k.startswith('truth.') for k in d['state_slots'])) + self.assertFalse(any(c['visibility'] != 'agent' for c in d['capabilities'].values())) + for c in d['capabilities'].values(): + self.assertFalse(any(e['state_id'].startswith('truth.') for e in c['state_effects'])) + with self.assertRaises(rt.ActionRejected): + g.A.read(instance_id=INST, state_ids=['truth.bottles']) + r = g.A.invoke(instance_id=INST, capability_id='bottle.inspect', arguments=dict(position='P1'), request_id='x1') + self.assertEqual(r['error']['code'], 'ACCESS_DENIED') + r = g.A.invoke(instance_id=INST, capability_id='sim.step', arguments=dict(dt_s=10.0), request_id='x2') + self.assertEqual(r['error']['code'], 'ACCESS_DENIED') + self.assertIn('truth.bottles', g.E.describe(instance_id=INST)['state_slots']) + g.call(g.E, 'fault.inject', fault='incubator_failure', active=True) + ev = g.call(g.A, 'events.read', since_s=0.0)['events'] + self.assertFalse(any(e['kind'] == 'fault' for e in ev)) + + def test_foreign_agent_ownership(self): + g = Rig() + g.h.register_principal('agent2', 'agent') + B = g.h.session('agent2') + g.gga() + g.load('P1', 'h1', 'std', 164.0) + for cap, args in (('bottle.empty', dict(position='P1')), ('head.stop', dict(head='h1')), ('head.read', dict(head='h1')), + ('head.unscrew', dict(head='h1')), ('bottle.add_stir_bar', dict(position='P1'))): + r = B.invoke(instance_id=INST, capability_id=cap, arguments=args, request_id='b-' + cap) + self.assertEqual(r['error']['code'], 'ACCESS_DENIED', cap) + r = B.invoke(instance_id=INST, capability_id='bottle.fill', arguments=dict(position='P2', sample_id='std', volume_m3=1.64e-4), request_id='b-fill') + self.assertEqual(r['error']['code'], 'ACCESS_DENIED') + self.assertNotIn('std', B.read(instance_id=INST, state_ids=['samples.available'])['observations']['samples.available']['value']) + # agent2 works with its own objects; agent 1 releases the head after stopping and unscrewing + B.invoke(instance_id=INST, capability_id='head.configure', arguments=dict(head='h4', duration_days=3), request_id='b-own') + g.call(g.A, 'head.stop', head='h1') + g.call(g.A, 'head.unscrew', head='h1') + r = B.invoke(instance_id=INST, capability_id='head.read', arguments=dict(head='h1'), request_id='b-free') + self.assertEqual(r['status'], 'succeeded') + g.call(g.A, 'bottle.empty', position='P1') + r = B.invoke(instance_id=INST, capability_id='bottle.add_stir_bar', arguments=dict(position='P1'), request_id='b-free2') + self.assertEqual(r['status'], 'succeeded') + + def test_idempotent_request_ids(self): + g = Rig() + g.kits('distilled_water') + g.free('P1') + args = dict(position='P1', sample_id='distilled_water', volume_m3=1.64e-4) + r1 = g.A.invoke(instance_id=INST, capability_id='bottle.fill', arguments=args, request_id='same') + snap = g.h.read('evaluator') + r2 = g.A.invoke(instance_id=INST, capability_id='bottle.fill', arguments=args, request_id='same') + self.assertEqual(r1, r2) + self.assertEqual(snap, g.h.read('evaluator')) + r3 = g.A.invoke(instance_id=INST, capability_id='bottle.fill', arguments=dict(args, position='P2'), request_id='same') + self.assertEqual(r3['error']['code'], 'REQUEST_CONFLICT') + r5 = g.A.invoke(instance_id=INST, capability_id='bottle.fill', arguments=dict(args, position='P2'), request_id='p2') + self.assertEqual(r5['error']['code'], 'HEAD_ON_BOTTLE') # stored heads sit on the bottles + r4 = g.A.invoke(instance_id=INST, capability_id='bottle.fill', arguments=args, request_id='other') + self.assertEqual(r4['error']['code'], 'BOTTLE_NOT_EMPTY') + + def test_two_instances_isolated(self): + a, b = Rig(instance='oxitop_a'), Rig(instance='oxitop_b', incubator=298.15) + a.call(a.A, 'platform.set_power', on=True) + self.assertFalse(b.read('platform.powered')) + with self.assertRaises(rt.ActionRejected): + a.A.read(instance_id='oxitop_b') + r = a.A.invoke(instance_id='oxitop_b', capability_id='platform.set_power', arguments=dict(on=True), request_id='z') + self.assertEqual(r['error']['code'], 'UNKNOWN_INSTANCE') + a.step(3600.0) + b.step(3600.0) + self.assertNotAlmostEqual(a.read('truth.incubator_air_k'), b.read('truth.incubator_air_k'), places=1) + + def test_step_partition_independence(self): + def run(steps): + g = Rig(seed=5) + g.gga() + g.load('P1', 'h1', 'std', 164.0) + g.call(g.A, 'platform.set_power', on=True) + for s in steps: + g.step(s) + return g.read('heads.stored_values'), g.read('truth.bottles')['P1'], g.read('display.h1_value') + total = 2.3 * DAY + a = run([total]) + b = run([7.0, 53.0, 1000.0, 3599.5, 0.5] + [total - 4660.0]) + c = run([total / 37.0] * 37) + self.assertEqual(a, b) + self.assertEqual(a[0], c[0]) + self.assertAlmostEqual(a[1]['pressure_pa'], c[1]['pressure_pa'], places=6) + + def test_rejections_change_nothing(self): + g = Rig() + r = rt.WtwOxitopiRuntime('fresh') + r.register_principal('e', 'evaluator') + out = r.session('e').invoke(instance_id='fresh', capability_id='platform.set_power', arguments=dict(on=True), request_id='p') + self.assertEqual(out['error']['code'], 'PLANT_REQUIRED') + g.call(g.E, 'plant.configure', expect='SEED_FIXED', incubator_k=293.15, room_k=295.15, ambient_pressure_pa=101325.0, noise_seed=2) + g.kits('distilled_water', 'nhp_600') + g.call(g.A, 'bottle.fill', expect='HEAD_ON_BOTTLE', position='P1', sample_id='distilled_water', volume_m3=1.64e-4) + g.free('P1') + g.call(g.A, 'bottle.fill', position='P1', sample_id='distilled_water', volume_m3=1.64e-4) + g.call(g.A, 'bottle.fill', expect='BOTTLE_NOT_EMPTY', position='P1', sample_id='distilled_water', volume_m3=1.64e-4) + g.call(g.A, 'bottle.add_stir_bar', position='P1') + g.call(g.A, 'bottle.add_stir_bar', expect='ALREADY_PRESENT', position='P1') + g.call(g.A, 'bottle.add_reagent', expect='UNKNOWN_SAMPLE', position='P1', reagent='nth_600', drops=3) + g.call(g.A, 'bottle.insert_sleeve', position='P1', naoh_pellets=2) + g.call(g.A, 'bottle.add_reagent', expect='SLEEVE_IN_NECK', position='P1', reagent='nth_600', drops=3) + g.call(g.A, 'head.screw_on', head='h1', position='P1') + g.call(g.A, 'bottle.fill', expect='HEAD_ON_BOTTLE', position='P1', sample_id='distilled_water', volume_m3=1.64e-4) + g.call(g.A, 'head.screw_on', expect='HEAD_ON_BOTTLE', head='h2', position='P1') + g.free('P2') + g.call(g.A, 'head.screw_on', expect='POSITION_OCCUPIED', head='h2', position='P1') + g.call(g.A, 'head.screw_on', expect='HEAD_ON_BOTTLE', head='h1', position='P2') + g.call(g.A, 'head.pt_test', expect='HEAD_ON_BOTTLE', head='h1') + g.call(g.A, 'head.start', head='h1') + g.call(g.A, 'head.configure', expect='MEASUREMENT_RUNNING', head='h1', duration_days=3) + g.call(g.A, 'head.start', expect='MEASUREMENT_RUNNING', head='h1') + g.call(g.A, 'head.unscrew', expect='HEAD_NOT_ON_BOTTLE', head='h2') + g.call(g.A, 'head.screw_on', head='h2', position='P2') + g.call(g.A, 'bottle.empty', expect='HEAD_ON_BOTTLE', position='P1') + g.call(g.A, 'bottle.empty', expect='HEAD_ON_BOTTLE', position='P3') + g.free('P3') + g.call(g.A, 'bottle.empty', expect='BOTTLE_EMPTY', position='P3') + g.call(g.A, 'sample.prepare', expect='INSUFFICIENT_SAMPLE', sample_id='big', volume_m3=0.004, + sources=[dict(source_id='distilled_water', volume_m3=0.004)]) + g.call(g.A, 'sample.prepare', expect='VOLUME_OUT_OF_RANGE', sample_id='v', volume_m3=1e-3, sources=[dict(source_id='distilled_water', volume_m3=5e-4)]) + g.call(g.A, 'sample.prepare', expect='NO_SEED', sample_id='v', volume_m3=1e-3, sources=[dict(source_id='distilled_water', volume_m3=9e-4)], + seed_volume_fraction=0.02, diluent='distilled_water') + g.call(g.A, 'sample.prepare', expect='UNKNOWN_SAMPLE', sample_id='v', volume_m3=1e-3, sources=[dict(source_id='nope', volume_m3=1e-4)], + diluent='distilled_water') + g.call(g.A, 'head.stop', expect='HEAD_OFF', head='h5') + g.call(g.E, 'stock.provide', expect='UNKNOWN_SUBSTANCE', stock_id='q', volume_m3=1e-3, composition=dict(substances=[dict(substance_id='unobtainium', + concentration_kg_m3=0.1)], ph=7.0)) + g.call(g.E, 'kit.provide', expect='INVALID_ARGUMENT', kit='oxitop_pm') + g.call(g.E, 'fault.inject', expect='INVALID_ARGUMENT', fault='head_untight', active=True) + g.call(g.A, 'eval.bod', expect='INVALID_ARGUMENT', sample_value_kg_m3=0.1, blank_value_kg_m3=0.0, sample_volume_m3=2e-3, total_volume_m3=1e-3) + + +class Physics(unittest.TestCase): + def test_bod_equation_matches_manual_factor_table(self): + f432 = rt.bod_factor(432.0) + for v, fac in rt.DOC['factors'].items(): + self.assertAlmostEqual(rt.bod_factor(float(v)) / f432, fac, delta=0.012 * fac) + self.assertAlmostEqual(rt.DIGIT_HPA, 3.5616, places=3) + # manual volume table: BOD measuring range = 40 digits x factor; the digit display ends at 50 digits (primer: > 50 digit exceeds the range) + for v, rng in rt.DOC['ranges_mg_l'].items(): + self.assertEqual(rng, 40 * rt.DOC['factors'][v]) + self.assertAlmostEqual(40 * rt.DIGIT_HPA * rt.bod_factor(float(v)), rng, delta=0.012 * rng) + + def test_benson_krause_reference_values(self): + # USGS DOTABLES / Benson-Krause at 760 mmHg: 9.09 (20 C), 11.29 (10 C), 7.56 (30 C) mg/l + self.assertAlmostEqual(rt.do_saturation_1atm(293.15), 9.09, delta=0.01) + self.assertAlmostEqual(rt.do_saturation_1atm(283.15), 11.29, delta=0.01) + self.assertAlmostEqual(rt.do_saturation_1atm(303.15), 7.56, delta=0.01) + self.assertAlmostEqual(rt.p_vapour(293.15), 2339.0, delta=4.0) + + def test_buffer_chemistry_round_trip(self): + for ph, dic, pt in ((7.2, 0.5, 3.75), (6.0, 2.0, 0.0), (8.4, 4.0, 0.1), (4.0, 0.0, 0.0), (11.0, 0.1, 0.0)): + alk = rt.alk_of(ph, dic, pt) + self.assertAlmostEqual(rt.ph_of(alk, dic, pt), ph, places=6) + self.assertAlmostEqual(rt.dic_of(7.38, 2.0), 2.2, places=3) + + def test_oxygen_conservation_closed_bottle(self): + g = Rig(seed=3) + g.gga() + g.load('P1', 'h1', 'std', 164.0) + g.call(g.A, 'platform.set_power', on=True) + b = g.h.bottles['P1'] + L, G = b['liquid'], b['gas'] + o2_0 = G['o2'] * rt.M_O2 * 1000.0 + L['DO'] * L['V'] * 1000.0 # mg + g.step(3 * DAY) + o2_1 = G['o2'] * rt.M_O2 * 1000.0 + L['DO'] * L['V'] * 1000.0 + L['o2_used'] * L['V'] * 1000.0 + self.assertAlmostEqual(o2_0, o2_1, delta=1e-6 * o2_0) + + def test_gga_check_in_wtw_range_and_blank_below_2(self): + g = Rig(seed=11) + g.gga() + g.load('P1', 'h1', 'std', 164.0) + g.load('P2', 'h2', 'blank', 432.0) + g.call(g.A, 'platform.set_power', on=True) + g.step(5 * DAY + 4 * 3600) + A, B = g.stored('h1')[-1], g.stored('h2')[-1] + self.assertEqual(len(g.stored('h1')), 5) + self.assertLessEqual(B, 2.0) + r = g.call(g.A, 'eval.bod', sample_value_kg_m3=A / 1000, blank_value_kg_m3=B / 1000, sample_volume_m3=0.99e-3, total_volume_m3=1e-3) + self.assertTrue(0.230 <= A / 1000 - 0.99 * B / 1000 <= 0.290, (A, B)) + self.assertAlmostEqual(r['bod_kg_m3'], (A / 1000 - B / 1000 * 0.01) / 0.99, places=9) + true = g.truth('P1')['o2_consumed_kg_m3'] * 1000 + self.assertLess(abs(A - true) / true, 0.04) # head vs true consumption (AutoTemp phase, sensor errors) + + def test_literature_rates_reproduce_din_dilution_value(self): + old = rt.STIRRED_RATE_FACTOR + rt.STIRRED_RATE_FACTOR = 1.0 + try: + g = Rig(seed=11) + g.gga() + g.load('P1', 'h1', 'std', 164.0) + g.call(g.A, 'platform.set_power', on=True) + g.step(5 * DAY + 4 * 3600) + self.assertTrue(170.0 <= g.stored('h1')[-1] <= 250.0, g.stored('h1')) + finally: + rt.STIRRED_RATE_FACTOR = old + + def test_missing_naoh_and_missing_stirring_read_low(self): + def run(pellets=2, power=True): + g = Rig(seed=4) + g.gga() + g.load('P1', 'h1', 'std', 164.0, pellets=pellets) + if power: + g.call(g.A, 'platform.set_power', on=True) + g.step(5 * DAY + 4 * 3600) + return g.stored('h1')[-1], g.truth('P1') + ref, t_ref = run() + no_naoh, t_no = run(pellets=0) + still, t_still = run(power=False) + self.assertLess(no_naoh, 0.6 * ref) + self.assertGreater(t_no['p_co2_pa'], 1000.0) + self.assertLess(t_ref['p_co2_pa'], 50.0) + self.assertLess(still, 0.6 * ref) + self.assertLess(t_still['do_kg_m3'], 0.5 * t_ref['do_kg_m3']) + self.assertGreater(t_ref['remaining_bod_kg_m3'], -1e-12) + + def test_nitrification_and_atu(self): + def run(atu): + g = Rig(seed=8) + g.kits('domestic_effluent', 'nth_600', 'nhp_600') + g.call(g.A, 'sample.prepare', sample_id='eff', volume_m3=1e-3, sources=[dict(source_id='domestic_effluent', volume_m3=1e-3)], aerate=True, + temperature_k=293.15) + g.load('P1', 'h1', 'eff', 432.0, atu=atu) + g.call(g.A, 'platform.set_power', on=True) + g.step(5 * DAY + 4 * 3600) + return g.stored('h1')[-1], g.truth('P1') + with_atu, t1 = run(True) + without, t2 = run(False) + self.assertLess(t1['nitrified_n_kg_m3'], 2e-5) + self.assertGreater(t2['nitrified_n_kg_m3'], 1e-3) + self.assertGreater(without - with_atu, 0.7 * 4.57 * t2['nitrified_n_kg_m3'] * 1000) + + def test_autotemp_cold_sample_and_latest_start(self): + starts = {} + for T in (293.15, 288.15, 285.15): + g = Rig(seed=2) + g.gga() + g.call(g.A, 'sample.prepare', sample_id='cold', volume_m3=5e-4, sources=[dict(source_id='std', volume_m3=5e-4)], temperature_k=T) + g.load('P1', 'h1', 'cold', 164.0) + g.call(g.A, 'platform.set_power', on=True) + g.step(4 * 3600) + ev = [e for e in g.call(g.A, 'events.read', since_s=0.0)['events'] if e['code'] == 'MEASUREMENT_START'] + starts[T] = ev[0]['time_s'] + if T < 288.15: + self.assertIn('FILLING_TEMPERATURE_P1', g.read('warnings.active')) + self.assertEqual(starts[293.15], 3600.0 + 1800.0) + self.assertGreater(starts[288.15], starts[293.15]) + self.assertLessEqual(max(starts.values()), 3 * 3600.0 + 60.0) + + def test_autotemp_interval_scales_with_duration(self): + g = Rig(seed=2) + g.gga() + g.load('P1', 'h1', 'std', 164.0, days=1) + g.call(g.A, 'platform.set_power', on=True) + g.step(2 * 3600) + ev = [e for e in g.call(g.A, 'events.read', since_s=0.0)['events'] if e['code'] == 'MEASUREMENT_START'] + self.assertEqual(ev[0]['time_s'], 3600.0 + 360.0) + + def test_daily_storage_finish_green_led_and_display(self): + g = Rig(seed=6) + g.gga() + g.load('P1', 'h1', 'std', 164.0, days=2) + g.call(g.A, 'platform.set_power', on=True) + g.step(3600 + 1800 + DAY + 60) + self.assertEqual(len(g.stored('h1')), 1) + self.assertEqual(g.read('heads.status')['h1']['state'], 'measuring') + g.step(DAY) + st = g.read('heads.status')['h1'] + self.assertEqual(st['state'], 'finished') + self.assertEqual(st['led'], 'green') + r = g.call(g.A, 'head.read', head='h1') + self.assertEqual(r['label'], 'BOD2') + self.assertAlmostEqual(r['value'], g.stored('h1')[-1]) + g.step(DAY + 120) + self.assertEqual(g.read('heads.status')['h1']['led'], 'off') + self.assertEqual(len(g.stored('h1')), 2) + + def test_units_and_digits_consistent(self): + g = Rig(seed=6) + g.gga() + g.load('P1', 'h1', 'std', 164.0, days=2) + g.call(g.A, 'platform.set_power', on=True) + g.step(2 * DAY + 3 * 3600) + mg = g.stored('h1')[-1] + raw = g.stored('h1', unit_value=False)[-1] + vals = {} + for u in ('digit', 'dhPa', 'hPa', 'mg/l'): + g.call(g.A, 'head.configure', head='h1', unit=u) + vals[u] = g.stored('h1')[-1] + self.assertEqual(vals['mg/l'], mg) + self.assertAlmostEqual(vals['dhPa'], round(raw['delta_p_pa'] / 100.0), delta=1.0) + self.assertAlmostEqual(vals['digit'], round(vals['dhPa'] / rt.DIGIT_HPA), delta=1.0) + self.assertAlmostEqual(mg, vals['digit'] * 10.0, delta=12.0) # factor 10 at 164 ml (manual table) + self.assertTrue(900 < vals['hPa'] < 1013) + + def test_range_exceeded_still_displayed(self): + g = Rig(seed=9) + g.gga() + g.load('P1', 'h1', 'std', 432.0) # range 40 mg/l at 432 ml, GGA ~260 mg/l + g.call(g.A, 'platform.set_power', on=True) + g.step(3 * DAY) + st = g.stored('h1', unit_value=False) + self.assertTrue(any(x['over_range'] for x in st)) + self.assertTrue(all(x['value'] is not None for x in st)) + self.assertIn('RANGE_EXCEEDED_h1', g.read('warnings.active')) + tb = g.truth('P1') + self.assertLess(tb['do_kg_m3'], 0.002) # oxygen nearly exhausted in the small head space + + def test_pm_tablet_matches_lot_value(self): + """BOD primer p.34-35: heads started and thermostatted 4-4.5 h off the bottle, then tablet, rubber sleeve without NaOH, head screwed on.""" + g = Rig(seed=12) + g.kits('distilled_water') + g.call(g.E, 'kit.provide', kit='oxitop_pm', lot_test_value_kg_m3=0.21) + g.free('P1') + g.call(g.A, 'bottle.fill', position='P1', sample_id='distilled_water', volume_m3=1.64e-4) + g.call(g.A, 'bottle.add_stir_bar', position='P1') + g.call(g.A, 'platform.set_power', on=True) + g.call(g.A, 'head.configure', head='h1', duration_days=5, unit='mg/l', sample_volume_m3=1.64e-4) + g.call(g.A, 'head.start', head='h1') + g.step(4.25 * 3600) + self.assertEqual(g.read('heads.status')['h1']['state'], 'measuring') + g.call(g.A, 'bottle.add_reagent', position='P1', reagent='oxitop_pm') + g.call(g.A, 'bottle.insert_sleeve', position='P1', naoh_pellets=0) + g.call(g.A, 'head.screw_on', head='h1', position='P1') + g.step(5 * DAY) + v = g.stored('h1')[-1] + tol = 210.0 * 0.005 + 1.0 * rt.bod_factor(164.0) + 0.03 * 210.0 + self.assertLess(abs(v - 210.0), tol, g.stored('h1')) + + def test_pt_test_altitude_table(self): + for p, ctrl in ((101325.0, 39), (74700.0, 29), (89800.0, 35)): + g = Rig(seed=3, pressure=p) + g.call(g.A, 'head.pt_test', expect='HEAD_ON_BOTTLE', head='h2') + g.free('P2') + r = g.call(g.A, 'head.pt_test', head='h2') + self.assertEqual(r['control_digits'], ctrl) + self.assertTrue(r['passed'], r) + self.assertLessEqual(abs(r['measured_digits'] - ctrl), 3.0) + + def test_untight_head_and_pellets_in_sample(self): + def run(fault=None, tight=True): + g = Rig(seed=10) + g.gga() + if fault: + g.call(g.E, 'fault.inject', fault=fault, active=True, target='P1') + g.load('P1', 'h1', 'std', 164.0, tight=tight) + g.call(g.A, 'platform.set_power', on=True) + g.step(5 * DAY + 4 * 3600) + return g.stored('h1')[-1], g.truth('P1'), g + ref, _, _ = run() + leak, _, _ = run(fault='head_untight') + loose, _, _ = run(tight=False) + naoh, t, g = run(fault='pellets_in_sample') + self.assertLess(leak, 0.85 * ref) + self.assertLess(loose, 0.85 * ref) + self.assertLess(naoh, 0.1 * ref) + self.assertTrue(g.call(g.E, 'bottle.inspect', position='P1')['state']['naoh_in_sample']) + self.assertGreater(g.call(g.E, 'bottle.inspect', position='P1')['state']['ph'], 11.0) + + def test_door_and_incubator_failure(self): + g = Rig(seed=10, room=298.15) + g.gga() + g.load('P1', 'h1', 'std', 164.0) + g.call(g.A, 'platform.set_power', on=True) + g.step(DAY) + p0 = g.truth('P1')['pressure_pa'] + g.call(g.A, 'incubator.set_door', open=True) + g.step(600) + self.assertGreater(g.read('truth.incubator_air_k'), 296.0) + self.assertGreater(g.truth('P1')['pressure_pa'], p0 - 50.0) # warming opposes the BOD pressure drop + g.call(g.A, 'incubator.set_door', open=False) + g.step(4 * 3600) + self.assertLess(abs(g.read('truth.incubator_air_k') - 293.15), 0.5) + g.call(g.E, 'fault.inject', fault='incubator_failure', active=True) + g.step(6 * 3600) + self.assertAlmostEqual(g.read('truth.incubator_air_k'), 298.15, delta=0.05) + self.assertGreater(g.truth('P1')['temperature_k'], 297.0) + + def test_battery_low_red_led_dead_and_replace(self): + g = Rig(seed=10) + g.gga() + g.load('P1', 'h1', 'std', 164.0, days=7) + g.call(g.A, 'platform.set_power', on=True) + g.step(1.2 * DAY) + g.call(g.E, 'fault.inject', fault='battery_drain', active=True, target='h1') + n = len(g.stored('h1')) + low_seen = False + for _ in range(48 * 12): + g.step(300) + st = g.read('heads.status')['h1'] + if st['battery_low'] and st['state'] == 'measuring': + low_seen = True + self.assertEqual(st['led'], 'red') + if st['state'] == 'dead': + break + self.assertTrue(low_seen) + self.assertEqual(g.read('heads.status')['h1']['state'], 'dead') + self.assertGreaterEqual(len(g.stored('h1')), n) + g.call(g.A, 'head.press_key', expect='BATTERY_EMPTY', head='h1', key='M') + g.call(g.A, 'head.replace_battery', head='h1') + self.assertEqual(g.read('heads.status')['h1']['state'], 'off') + self.assertFalse(g.read('heads.status')['h1']['battery_low']) + self.assertGreaterEqual(len(g.stored('h1')), n) + + def test_led_flash_pattern_and_signal_led_off(self): + g = Rig(seed=10) + g.gga() + g.load('P1', 'h1', 'std', 164.0) + lit = [] + for _ in range(20): + g.step(0.5) + lit.append(g.read('led.h1_blue')) + self.assertEqual(sum(lit), 2) # 0.5 s on every 5 s + self.assertFalse(any(g.read('led.h1_red') for _ in range(1))) + g.call(g.A, 'head.set_system', head='h1', signal_led=False) + for _ in range(12): + g.step(0.5) + self.assertFalse(g.read('led.h1_blue')) + + def test_display_switch_off_and_wake(self): + g = Rig(seed=10) + g.call(g.A, 'head.set_system', head='h3', switch_off_s=60.0) + self.assertEqual(g.read('heads.status')['h3']['state'], 'idle') + g.step(61) + self.assertEqual(g.read('heads.status')['h3']['state'], 'off') + r = g.call(g.A, 'head.read', head='h3') + self.assertTrue(r['display_on']) + self.assertEqual(r['lines'][0], 'ID: 13') + + def test_key_menu_navigation(self): + g = Rig(seed=10) + g.gga() + g.free('P1') + g.call(g.A, 'bottle.fill', position='P1', sample_id='std', volume_m3=1.64e-4) + g.call(g.A, 'bottle.insert_sleeve', position='P1', naoh_pellets=2) + g.call(g.A, 'head.screw_on', head='h1', position='P1') + r = g.call(g.A, 'head.press_key', head='h1', key='M') # any key: display on + self.assertEqual(r['screen'], 'id') + r = g.call(g.A, 'head.press_key', head='h1', key='ENTER') # measurement settings + self.assertEqual(r['screen'], 'menu_meas') + g.call(g.A, 'head.press_key', head='h1', key='NAV') # duration 5 -> 6 + g.call(g.A, 'head.press_key', head='h1', key='ENTER') # next item: unit + g.call(g.A, 'head.press_key', head='h1', key='ENTER') # next item: sample volume + for _ in range(4): # 432 -> 22.7 -> 43.5 -> 97 -> 164 + g.call(g.A, 'head.press_key', head='h1', key='NAV') + st = g.read('heads.status')['h1'] + self.assertEqual(st['duration_days'], 6) + self.assertAlmostEqual(st['sample_volume_m3'], 1.64e-4) + g.call(g.A, 'head.press_key', head='h1', key='M') # back to the info page + r = g.call(g.A, 'head.press_key', head='h1', key='M') # start + self.assertEqual(g.read('heads.status')['h1']['state'], 'adaption') + self.assertIn('AutoTemp', r['lines']) + r = g.call(g.A, 'head.press_key', head='h1', key='M', long=True) + self.assertEqual(r['screen'], 'confirm_off') + g.call(g.A, 'head.press_key', head='h1', key='ENTER') # no + self.assertEqual(g.read('heads.status')['h1']['state'], 'adaption') + g.call(g.A, 'head.press_key', head='h1', key='M', long=True) + g.call(g.A, 'head.press_key', head='h1', key='M') # yes + self.assertEqual(g.read('heads.status')['h1']['state'], 'off') + + def test_stop_keeps_values_restart_clears_and_unscrew_vents(self): + g = Rig(seed=10) + g.gga() + g.load('P1', 'h1', 'std', 164.0) + g.call(g.A, 'platform.set_power', on=True) + g.step(1.2 * DAY) + g.call(g.A, 'head.unscrew', head='h1') + self.assertAlmostEqual(g.truth('P1')['pressure_pa'], 101325.0, delta=1.0) + g.step(600) + r = g.call(g.A, 'head.read', head='h1') + self.assertLess(abs(r['value'] or 0.0), 3.0 * rt.bod_factor(164.0)) # vented: no pressure difference left + g.call(g.A, 'head.stop', head='h1') + self.assertEqual(len(g.stored('h1')), 1) + g.call(g.A, 'head.start', head='h1') + self.assertEqual(len(g.stored('h1')), 0) + + def test_volume_setting_mismatch_warning(self): + g = Rig(seed=10) + g.gga() + g.free('P1') + g.call(g.A, 'bottle.fill', position='P1', sample_id='std', volume_m3=1.64e-4) + g.call(g.A, 'bottle.insert_sleeve', position='P1', naoh_pellets=2) + g.call(g.A, 'head.screw_on', head='h1', position='P1') + g.call(g.A, 'head.start', head='h1') # default setting 432 ml + self.assertIn('VOLUME_SETTING_h1', g.read('warnings.active')) + + +class ReviewRound1(unittest.TestCase): + def test_head_read_and_stored_slot_agree_over_range(self): # R1-07 / C1-10 + g = Rig(seed=9) + g.gga() + g.load('P1', 'h1', 'std', 432.0) + g.call(g.A, 'platform.set_power', on=True) + g.step(3 * DAY) + slot = g.read('heads.stored_values')['h1'] + r = g.call(g.A, 'head.read', head='h1')['stored'] + self.assertTrue(any(x['over_range'] for x in slot)) + self.assertEqual([x['value'] for x in slot], [x['value'] for x in r]) + self.assertTrue(all(x['value'] is not None for x in r)) + + def test_empty_battery_while_off_is_dead(self): # R1-04 + g = Rig(seed=9) + g.call(g.E, 'fault.inject', fault='battery_drain', active=True, target='h3') + g.step(4 * DAY) + self.assertEqual(g.read('heads.status')['h3']['state'], 'dead') + g.call(g.A, 'head.start', expect='BATTERY_EMPTY', head='h3') + g.call(g.A, 'head.press_key', expect='BATTERY_EMPTY', head='h3', key='M') + g.call(g.A, 'head.replace_battery', head='h3') + g.call(g.E, 'fault.inject', fault='battery_drain', active=False, target='h3') + g.call(g.A, 'head.start', head='h3') + + def test_filling_temperature_hidden_from_agent(self): # R1-08 + g = Rig(seed=9) + g.call(g.E, 'stock.provide', stock_id='cold', volume_m3=1e-3, composition=dict(substances=[], ph=7.0, temperature_k=284.65)) + g.free('P1') + g.call(g.A, 'bottle.fill', position='P1', sample_id='cold', volume_m3=4.32e-4) + agent_msgs = ' '.join(e['message_zh'] for e in g.call(g.A, 'events.read', since_s=0.0)['events']) + self.assertIn('FILLING_TEMPERATURE_P1', g.read('warnings.active')) + self.assertNotIn('11.5', agent_msgs) + ev = g.E.invoke(instance_id=INST, capability_id='events.read', arguments=dict(since_s=0.0), request_id='ev-truth')['result']['events'] + self.assertTrue(any('11.5' in e['message_zh'] for e in ev)) + + def test_pt_control_values_full_primer_table(self): # R1-06 + table = rt.DOC['pt_test'] + self.assertEqual(len(table['control_digits']), 29) + for alt in ('-200', '-100', '300', '700', '1100', '2300'): + g = Rig(seed=3, pressure=table['mean_pressure_hpa'][alt] * 100.0) + g.free('P2') + r = g.call(g.A, 'head.pt_test', head='h2') + self.assertEqual(r['control_digits'], table['control_digits'][alt], alt) + self.assertTrue(r['passed'], (alt, r)) + + def test_display_slot_text_matches_over_range_rule(self): # C2-01 (round 2) + self.assertIn('超过50 digit仍显示数值', rt.SLOTS['display.h1_value']['meaning']) + g = Rig(seed=9) + g.gga() + g.load('P1', 'h1', 'std', 432.0) + g.call(g.A, 'platform.set_power', on=True) + g.step(3 * DAY) + r = g.call(g.A, 'head.read', head='h1') + self.assertTrue(r['stored'][-1]['over_range']) + self.assertIsNotNone(g.read('display.h1_value')) + + def test_pm_tablet_first_day_course(self): # R2-01 (round 2): BOD primer p.34 figure + g = Rig(seed=12) + g.kits('distilled_water') + g.call(g.E, 'kit.provide', kit='oxitop_pm', lot_test_value_kg_m3=0.30) + g.free('P1') + g.call(g.A, 'bottle.fill', position='P1', sample_id='distilled_water', volume_m3=1.64e-4) + g.call(g.A, 'bottle.add_stir_bar', position='P1') + g.call(g.A, 'platform.set_power', on=True) + g.call(g.A, 'head.configure', head='h1', duration_days=5, unit='mg/l', sample_volume_m3=1.64e-4) + g.call(g.A, 'head.start', head='h1') + g.step(4.25 * 3600) + g.call(g.A, 'bottle.add_reagent', position='P1', reagent='oxitop_pm') + g.call(g.A, 'bottle.insert_sleeve', position='P1', naoh_pellets=0) + g.call(g.A, 'head.screw_on', head='h1', position='P1') + g.step(7 * 3600) + v7 = g.call(g.A, 'head.read', head='h1')['value'] + g.step(12 * 3600) + v19 = g.call(g.A, 'head.read', head='h1')['value'] + self.assertTrue(150.0 <= v7 <= 240.0, v7) + self.assertGreaterEqual(v19, 280.0) + + def test_key_components_wired_to_press_key(self): # C1-08 + comps = rt.CAPS['head.press_key']['component_ids'] + self.assertTrue(all(f'head_{i}_key_{k}' in comps for i in range(1, 7) for k in ('m', 'enter', 'nav'))) + + +class Samples(unittest.TestCase): + def test_sample_prepare_dilution_seed_ph_and_buffer(self): + g = Rig(seed=10) + g.kits('domestic_influent', 'dilution_water', 'settled_sewage_seed', 'distilled_water') + r = g.call(g.A, 'sample.prepare', sample_id='d10', volume_m3=1e-3, sources=[dict(source_id='domestic_influent', volume_m3=1e-4)], + diluent='dilution_water', seed_volume_fraction=0.02, atu_kg_m3=0.005) + self.assertAlmostEqual(r['dilution_factor'], 10.0) + s = g.h.samples['d10'] + self.assertAlmostEqual(s['subs']['ww_readily'], 95.0 * 0.1 + rt.sample_lib()['samples']['settled_sewage_seed']['components']['readily_mg_l'] * 0.02, places=9) + self.assertAlmostEqual(s['atu'], 5.0, places=9) + self.assertAlmostEqual(s['pt'], 3.75 * 0.88, places=9) + self.assertTrue(6.6 < s['ph'] < 7.6) + g.call(g.A, 'sample.prepare', sample_id='adj', volume_m3=5e-4, sources=[dict(source_id='domestic_influent', volume_m3=5e-4)], ph_adjust_to=6.8) + self.assertAlmostEqual(g.h.samples['adj']['ph'], 6.8) + self.assertAlmostEqual(rt.ph_of(g.h.samples['adj']['alk'], g.h.samples['adj']['dic'], g.h.samples['adj']['pt']), 6.8, places=6) + g.call(g.A, 'sample.prepare', sample_id='aer', volume_m3=5e-4, sources=[dict(source_id='domestic_influent', volume_m3=5e-4)], aerate=True) + self.assertGreater(g.h.samples['aer']['ph'], 8.0) # CO2 stripped by aeration + g.call(g.A, 'sample.prepare', sample_id='dw', volume_m3=1e-3, sources=[dict(source_id='domestic_influent', volume_m3=1e-4)], diluent='distilled_water') + self.assertTrue(any(i['name'].startswith('osmotic') for i in g.h.samples['dw']['inhibitors'])) + self.assertAlmostEqual(g.h.samples['domestic_influent']['V'], 3e-3 - 1e-4 - 5e-4 - 5e-4 - 1e-4, places=12) + + def test_library_substances_degradable_vs_refractory(self): + res = {} + for sub, c in (('phenol', 0.08), ('pentachlorophenol', 0.08), ('sodium_acetate', 0.15)): + g = Rig(seed=10) + g.kits('dilution_water', 'settled_sewage_seed', 'nth_600', 'nhp_600') + g.call(g.E, 'stock.provide', stock_id='s', volume_m3=1e-3, composition=dict(substances=[dict(substance_id=sub, concentration_kg_m3=c)], ph=7.0, + alkalinity_mol_m3=1.0)) + g.call(g.A, 'sample.prepare', sample_id='m', volume_m3=1e-3, sources=[dict(source_id='s', volume_m3=9.8e-4)], seed_volume_fraction=0.02, + diluent='dilution_water', aerate=True) + g.load('P1', 'h1', 'm', 164.0) + g.call(g.A, 'platform.set_power', on=True) + g.step(5 * DAY + 4 * 3600) + thod = rt.substances()[sub]['thod_nh4_mg_mg'] * c * 1000 * 0.98 + res[sub] = g.stored('h1')[-1] / thod + self.assertGreater(res['phenol'], 0.5) + self.assertGreater(res['sodium_acetate'], 0.5) + self.assertLess(res['pentachlorophenol'], 0.1) + + def test_evaluator_substance_inhibitor_and_chlorine(self): + def run(**comp): + g = Rig(seed=10) + g.kits('nth_600', 'nhp_600') + g.call(g.E, 'substance.define', substance_id='cmpd_x', name='compound X', thod_kg_kg=1.5, f_ult=0.8, k20_per_s=3e-6) + dechlor = comp.pop('dechlorinate', False) + g.call(g.E, 'stock.provide', stock_id='w', volume_m3=1e-3, composition=dict(dict(substances=[dict(substance_id='cmpd_x', concentration_kg_m3=0.1)], ph=7.2, + seed=dict(type='activated_sludge', volume_fraction=0.02)), **comp)) + g.call(g.A, 'sample.prepare', sample_id='m', volume_m3=1e-3, sources=[dict(source_id='w', volume_m3=1e-3)], aerate=True, dechlorinate=dechlor) + g.load('P1', 'h1', 'm', 164.0) + g.call(g.A, 'platform.set_power', on=True) + g.step(5 * DAY + 4 * 3600) + return g.stored('h1')[-1] + base = run() + self.assertTrue(0.5 * 150 * 0.8 < base < 1.05 * 150 * 0.8 + 5.0, base) + tox = run(inhibitors=[dict(name='cu', concentration_kg_m3=0.002, ic50_kg_m3=0.001, hill=2.0)]) + self.assertLess(tox, 0.5 * base) + chl = run(free_chlorine_kg_m3=0.002) + self.assertLess(chl, 0.2 * base) + rescued = run(free_chlorine_kg_m3=0.002, dechlorinate=True) + self.assertAlmostEqual(rescued, base, delta=0.05 * base) + + def test_events_provenance_ledger_trace(self): + g = Rig(seed=10) + g.gga() + g.load('P1', 'h1', 'std', 164.0) + g.call(g.A, 'platform.set_power', on=True) + g.step(2 * DAY) + codes = [e['code'] for e in g.call(g.A, 'events.read', since_s=0.0)['events']] + for c in ('START', 'AUTOTEMP_ZERO', 'MEASUREMENT_START'): + self.assertIn(c, codes) + prov = g.call(g.A, 'provenance.read') + self.assertGreaterEqual(len(prov['substances']), 80) + led = g.call(g.E, 'ledger.read')['ledger'] + tb = g.truth('P1') + self.assertAlmostEqual(led['o2_consumed_mg'], tb['o2_consumed_kg_m3'] * 1000 * tb['liquid_m3'] * 1000, delta=1e-6) + self.assertLessEqual(led['co2_absorbed_mol'], led['co2_produced_mol'] + led['co2_initial_mol'] + 1e-12) + self.assertGreater(led['co2_initial_mol'], 0.0) + tr = g.call(g.E, 'data.trace', head='h1', max_points=50) + self.assertEqual(len(tr['time_s']), 50) + dps = [x for x in tr['delta_p_pa'] if x is not None] + self.assertGreater(dps[-1], dps[0]) + g.call(g.A, 'head.stop', head='h1') + g.call(g.A, 'head.unscrew', head='h1') + out = g.call(g.A, 'bottle.empty', position='P1') + self.assertAlmostEqual(out['removed_m3'], 1.64e-4) + self.assertAlmostEqual(g.call(g.E, 'ledger.read')['ledger']['waste_m3'], 1.64e-4) + + +class ZCoverage(unittest.TestCase): + def test_all_capabilities_exercised(self): + implemented = {k for k in rt.CAPS if k not in rt.UNSUPPORTED} + missing = implemented - SEEN_CAPS + if len(SEEN_CAPS) > 5: + self.assertFalse(missing, sorted(missing)) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_asset_zwick_hit5p.py b/tests/test_asset_zwick_hit5p.py new file mode 100644 index 0000000000000000000000000000000000000000..c63a604aea7141e1a8686e130f61a807be01c2d0 --- /dev/null +++ b/tests/test_asset_zwick_hit5p.py @@ -0,0 +1,158 @@ +"""CHEM-145 physical/event/protocol tests; no native scene or hardware claims.""" +import copy,hashlib,io,json,math,subprocess,sys,unittest +from pathlib import Path +import numpy as np +from scipy.integrate import quad +ROOT=Path(__file__).resolve().parents[1];sys.path.insert(0,str(ROOT)) +from scripts.asset_runtime.zwick_hit5p import * +PROCESS_EVIDENCE={};CHECKS=[] +def call(h,k,**a): + before=h.read('debug');r=h.invoke(k,**a);validate(CAPS[k]['output_schema'],r);after=h.read('debug');delta={x for x in after if before[x]!=after[x]} + if not delta<=set(CAPS[k]['effects']):raise AssertionError(f'{k}: undeclared {delta-set(CAPS[k]["effects"])}') + PROCESS_EVIDENCE.setdefault(k,[]).append(dict(time_s=h.time_s,phase=h.phase,result_keys=list(r),actual_call=True));return r + +def configured(plant=None,method=None): + h=ZwickHit5pRuntime() + for k,a in [('plant.configure',dict(PLANT_EXAMPLE,**(plant or {}))),('fixture.configure',FIXTURE_EXAMPLE),('method.configure',dict(METHOD_EXAMPLE,**(method or {}))),('power.set',dict(enabled=True)),('shield.set_open',dict(opened=False))]:call(h,k,**a) + h.step(.6);call(h,'pendulum.raise');h.step(3.);return h + +def calibrated(plant=None,method=None): + h=configured(plant,method);call(h,'calibration.start');call(h,'pendulum.catch');h.step(2);return h + +def loaded(plant=None,sample=None,method=None): + h=calibrated(plant,method);call(h,'pendulum.raise');h.step(5);call(h,'shield.set_open',opened=True);h.step(.6);call(h,'sample.load',**dict(SAMPLE_EXAMPLE,**(sample or {})));call(h,'shield.set_open',opened=False);h.step(.6);return h + +def impact(h,catch=True): + call(h,'acquisition.start') + if catch:call(h,'pendulum.catch') + h.step(2);return call(h,'acquisition.result') + +class HITTest(unittest.TestCase): + def check(self,condition,key):self.assertTrue(condition,key);CHECKS.append(dict(id=key,status='passed',layer='process')) + def balanced(self,h): + b=call(h,'ledger.read');self.check(abs(b['energy_residual_j'])<2e-9,'mechanical_thermal_energy_balance');self.check(abs(b['mass_residual_kg'])<1e-15,'mass_balance');self.check(abs(b['volume_residual_m3'])<1e-18,'volume_balance');return b + def reject(self,h,k,code=None,**a): + state=copy.deepcopy({key:value for key,value in h.__dict__.items() if key!='_segment'});seg=h._segment + with self.assertRaises(ActionRejected) as e:h.invoke(k,**a) + if code:self.assertEqual(str(e.exception),code) + self.assertEqual(state,{key:value for key,value in h.__dict__.items() if key!='_segment'});self.assertIs(seg,h._segment) + def test01_fixed_config_and_units(self): + self.assertAlmostEqual(GRAVITY_COEFFICIENT_NM*(1-math.cos(RELEASE_ANGLE_RAD)),.5);self.assertAlmostEqual(math.sqrt(2*.5/INERTIA_KG_M2)*.25,2.9);self.assertAlmostEqual(math.degrees(ENCODER_RESOLUTION_RAD),.018);self.assertEqual(SUPPORT_SPAN_M,.062);h=configured();self.reject(h,'fixture.configure','INVALID_ARGUMENT',**dict(FIXTURE_EXAMPLE,pendulum_energy_j=5));self.check(True,'nominal0_5J_not5J') + def test02_raise_is_finite_host_work(self): + h=ZwickHit5pRuntime();call(h,'plant.configure',**PLANT_EXAMPLE);call(h,'fixture.configure',**FIXTURE_EXAMPLE);call(h,'shield.set_open',opened=False);h.step(.6);call(h,'pendulum.raise');self.assertEqual(h.theta,0);h.step(.1);self.assertAlmostEqual(h.theta,.1,delta=1e-9);self.assertAlmostEqual(h.omega,1.,delta=1e-9);h.step(3);self.assertAlmostEqual(h.theta,RELEASE_ANGLE_RAD);b=self.balanced(h);self.assertAlmostEqual(b['host_work_j'],.5+.001*RELEASE_ANGLE_RAD,places=10) + def test03_independent_lossless_period_quadrature(self): + h=configured(dict(friction_torque_nm=0.));call(h,'calibration.start');call(h,'pendulum.catch');h.step(2);a=RELEASE_ANGLE_RAD;k=math.sin(a/2);quarter=math.sqrt(INERTIA_KG_M2/GRAVITY_COEFFICIENT_NM)*quad(lambda u:1/math.sqrt(1-k*k*math.sin(u)**2),0,math.pi/2,epsabs=1e-12)[0];self.assertAlmostEqual(h.elapsed,2*quarter,delta=2e-8);self.assertAlmostEqual(abs(h.theta),a,places=10);self.assertAlmostEqual(h.calibration,0.,places=12);self.balanced(h) + def test04_actual_empty_calibration(self): + h=calibrated();r=call(h,'acquisition.result');alpha=r['release_angle_rad'];beta=abs(r['rebound_angle_rad']);tau=GRAVITY_COEFFICIENT_NM*(math.cos(beta)-math.cos(alpha))/(alpha+beta);self.assertEqual(h.calibration,tau);self.assertNotEqual(h.calibration,PLANT_EXAMPLE['friction_torque_nm']);self.assertAlmostEqual(h.calibration,.001,delta=3e-6);self.check(True,'calibration_from_quantized_external_angles') + def test05_impact_reference_default(self): + h=loaded();r=impact(h);self.assertEqual(r['phase'],'succeeded');self.assertEqual(r['outcome'],'break');self.assertAlmostEqual(r['corrected_energy_j'],.16,delta=.0001);self.assertAlmostEqual(r['impact_strength_j_m2'],5000,delta=4);self.assertTrue(2.61<=r['observed_impact_speed_m_s']<=3.19);self.assertTrue(h.broken);self.balanced(h) + def test06_independent_impact_kinetic_drop(self): + h=loaded();call(h,'acquisition.start');h._new_segment();event=h._segment['end_ns'];h.step((event-h.time_ns)/1e9);expected_available=.5-PLANT_EXAMPLE['friction_torque_nm']*RELEASE_ANGLE_RAD;self.assertAlmostEqual(.5*INERTIA_KG_M2*h.omega*h.omega,expected_available-.16,delta=1e-10);self.assertAlmostEqual(h.absorbed,.16,places=14);self.balanced(h) + def test07_fracture_heat_damage_partition(self): + h=loaded();impact(h);b=self.balanced(h);self.assertAlmostEqual(b['sample_absorbed_j'],.16,places=13);self.assertAlmostEqual(b['sample_heat_j'],.128,places=13);self.assertAlmostEqual(b['sample_damage_stored_j'],.032,places=13);self.assertAlmostEqual(b['sample_thermal_j']+b['sample_heat_export_j'],.128,places=11) + def test08_no_break_is_not_full_strength(self): + h=loaded(sample=dict(behavior='unbreakable_proxy',no_break_restitution=.7));r=impact(h);self.assertEqual(r['outcome'],'no_break');self.assertEqual(r['validity'],'no_break');self.assertIsNone(r['impact_strength_j_m2']);self.assertFalse(h.broken);self.assertTrue(h.spent);self.assertGreater(h.theta,0);self.balanced(h) + def test09_capacity_upper_and_no_break(self): + h=loaded(sample=dict(host_charpy_strength_j_m2=20000.));r=impact(h);self.assertEqual(r['outcome'],'no_break');self.assertEqual(r['validity'],'above_working_range');self.assertEqual(r['phase'],'failed');self.assertIsNone(r['impact_strength_j_m2']);self.balanced(h) + def test10_capacity_lower(self): + h=loaded(sample=dict(host_charpy_strength_j_m2=1000.));r=impact(h);self.assertEqual(r['outcome'],'break');self.assertEqual(r['validity'],'below_working_range');self.assertEqual(r['phase'],'failed');self.assertIsNone(r['impact_strength_j_m2']);self.assertAlmostEqual(r['corrected_energy_j'],.032,delta=.00015) + def test11_complete_break_above_validrange(self): + h=loaded(sample=dict(host_charpy_strength_j_m2=14000.));r=impact(h);self.assertTrue(h.broken);self.assertEqual(r['outcome'],'break');self.assertEqual(r['validity'],'above_working_range');self.assertIsNone(r['impact_strength_j_m2']);self.balanced(h) + def test12_external_area_prior_required(self): + h=loaded(method=dict(remaining_area_prior_m2=None));r=impact(h);self.assertEqual(r['validity'],'valid');self.assertAlmostEqual(r['corrected_energy_j'],.16,delta=.0001);self.assertIsNone(r['impact_strength_j_m2']);self.check(True,'no_unknown_area_inversion') + def test13_external_analysis_independent_units(self): + h=configured();a=RELEASE_ANGLE_RAD;beta=math.acos(math.cos(a)+.2/GRAVITY_COEFFICIENT_NM);r=call(h,'analysis.impact',release_angle_rad=a,rebound_angle_rad=-beta,friction_torque_nm=0.,remaining_area_prior_m2=2e-5,outcome='break');self.assertAlmostEqual(r['corrected_energy_j'],.2);self.assertAlmostEqual(r['impact_strength_j_m2'],10000.);self.assertEqual(r['validity'],'valid');self.check(True,'ISO179_J_per_m2_not_J_per_m') + def test14_method_only_changes_sampling(self): + a=loaded(method=dict(sample_interval_s=.001));b=loaded(method=dict(sample_interval_s=.01));ra=impact(a);rb=impact(b);self.assertEqual(a.absorbed,b.absorbed);self.assertAlmostEqual(a.theta,b.theta,places=12);self.assertEqual(ra['corrected_energy_j'],rb['corrected_energy_j']);self.assertGreater(len(ra['rows']),len(rb['rows']));self.check(True,'sampling_not_physics_time_scale') + def test15_60Hz_partition(self): + a=loaded();b=loaded();call(a,'acquisition.start');call(b,'acquisition.start');call(a,'pendulum.catch');call(b,'pendulum.catch');a.step(2.) + for _ in range(120):b.step(1/60) + self.assertEqual(a.time_ns,b.time_ns);self.assertEqual(a.rows,b.rows);self.assertEqual(a.theta,b.theta);self.assertAlmostEqual(a.sample_U,b.sample_U,places=12);self.balanced(a);self.balanced(b) + def test16_natural_free_swing_partition(self): + a=configured();b=configured();call(a,'calibration.start');call(b,'calibration.start');a.step(5.) + for _ in range(137):b.step(5/137) + self.assertEqual(a.time_ns,b.time_ns);self.assertAlmostEqual(a.theta,b.theta,places=12);self.assertAlmostEqual(a.omega,b.omega,places=12);self.assertEqual(a.rows,b.rows);self.assertEqual(a.mechanical,'free');self.balanced(a) + def test17_completed_measurement_does_not_stop_motion(self): + h=loaded();r=impact(h,catch=False);self.assertEqual(r['phase'],'succeeded');self.assertEqual(h.mechanical,'free');theta=h.theta;h.step(.1);self.assertNotEqual(h.theta,theta);self.assertEqual(h.rows,r['rows']);self.balanced(h) + def test18_cancel_before_impact_still_breaks(self): + h=loaded();call(h,'acquisition.start');h.step(.1);call(h,'acquisition.stop');snapshot=call(h,'acquisition.result');theta=h.theta;call(h,'pendulum.catch');h.step(1);self.assertTrue(h.broken);self.assertTrue(h.spent);self.assertNotEqual(h.theta,theta);self.assertEqual(call(h,'acquisition.result'),snapshot);self.assertEqual(h.phase,'cancelled');self.balanced(h) + def test19_power_off_keeps_physics(self): + h=loaded();call(h,'acquisition.start');h.step(.1);call(h,'power.set',enabled=False);call(h,'pendulum.catch');h.step(1);self.assertTrue(h.broken);self.assertEqual(h.phase,'cancelled');self.assertIsNone(h.read()['encoder.angle_rad']);self.assertIsNone(h.read()['measurement.energy_j']);self.balanced(h) + def test20_catch_only_at_future_turn(self): + h=configured();call(h,'calibration.start');h.step(.1);theta=h.theta;omega=h.omega;call(h,'pendulum.catch');self.assertEqual(h.theta,theta);self.assertEqual(h.omega,omega);self.assertEqual(h.mechanical,'free');h.step(1);self.assertEqual(h.mechanical,'held');self.assertEqual(h.omega,0.);self.assertGreater(h._energy(),.49);self.balanced(h) + def test21_free_decay_static_friction(self): + h=configured(dict(friction_torque_nm=.05));call(h,'calibration.start');h.step(20);self.assertEqual(h.mechanical,'held');self.assertAlmostEqual(h.omega,0);self.assertLessEqual(abs(GRAVITY_COEFFICIENT_NM*math.sin(h.theta)),.05+1e-10);self.balanced(h) + def test22_sample_removal_carries_energy(self): + h=loaded();impact(h);call(h,'pendulum.raise');h.step(5);call(h,'shield.set_open',opened=True);h.step(.6);m=call(h,'sample.remove');self.assertEqual(m['removed_mass_kg'],SAMPLE_EXAMPLE['mass_kg']);self.assertGreater(h.book['internal_removed_j'],0);self.assertGreater(h.book['sensible_removed_j'],0);self.assertFalse(h.sample);self.balanced(h) + def test23_sensible_load_no_energy_creation(self): + h=loaded(sample=dict(initial_temperature_k=297.15));self.assertAlmostEqual(h.book['sensible_loaded_j'],.00415*1200);self.balanced(h) + def test24_temperature_after_impact_invalid(self): + h=loaded(sample=dict(temperature_tolerance_k=.001));r=impact(h);self.assertTrue(h.broken);self.assertEqual(r['validity'],'temperature_invalid');self.assertEqual(r['phase'],'failed');self.assertIsNone(r['impact_strength_j_m2']);self.balanced(h) + def test25_temperature_source_guard(self): + h=calibrated();call(h,'pendulum.raise');h.step(5);call(h,'shield.set_open',opened=True);h.step(.6);self.reject(h,'sample.load','REFERENCE_TEMPERATURE_RANGE',**dict(SAMPLE_EXAMPLE,initial_temperature_k=310.,temperature_tolerance_k=1.)) + def test26_shield_and_loading_geometry(self): + h=configured();self.reject(h,'sample.load','LOADING_GEOMETRY',**SAMPLE_EXAMPLE);call(h,'calibration.start');self.reject(h,'shield.set_open','BUSY',opened=True);h.step(2);self.reject(h,'shield.set_open','PENDULUM_MOVING',opened=True);self.reject(h,'pendulum.raise','PENDULUM_MOVING');self.balanced(h) + def test27_no_calibration_no_measurement(self): + h=loaded();call(h,'calibration.clear');self.reject(h,'acquisition.start','CALIBRATION_REQUIRED');self.check(True,'empty_calibration_required') + def test28_spent_sample_cannot_repeat(self): + h=loaded();impact(h);call(h,'pendulum.raise');h.step(5);self.reject(h,'acquisition.start','SAMPLE_SPENT');self.check(True,'irreversible_sample_state') + def test29_non_numeric_inputs_atomic(self): + h=loaded();self.reject(h,'power.set','INVALID_ARGUMENT',enabled=1);self.reject(h,'method.configure','INVALID_ARGUMENT',**dict(METHOD_EXAMPLE,sample_interval_s=float('nan')));self.reject(h,'power.set','INVALID_ARGUMENT',enabled=True,unknown=0) + for dt in [True,-1,float('inf'),float('nan')]: + before=h.time_ns + with self.assertRaises(ActionRejected):h.step(dt) + self.assertEqual(h.time_ns,before) + self.check(True,'input_schema_and_rejection_atomicity') + def test30_missing_reference_never_zero(self): + h=calibrated();call(h,'pendulum.raise');h.step(5);call(h,'shield.set_open',opened=True);h.step(.6);self.reject(h,'sample.load','MISSING_CHARPY_REFERENCE_OR_PRIOR',**dict(SAMPLE_EXAMPLE,notch='unnotched',notch_depth_m=0.));call(h,'sample.load',**dict(SAMPLE_EXAMPLE,notch='unnotched',notch_depth_m=0.,behavior='unbreakable_proxy'));self.assertIsNone(h.break_energy);self.check(True,'not_broken_N_not_zero') + def test31_real61_grade_references(self): + records=library();self.assertGreaterEqual(len(records),50) + for r in records.values():self.assertTrue(r['source']);self.assertEqual(r['reference_temperature_K'],296.15);self.assertTrue('charpy_notched_impact_strength_J_m2' in r) + self.check(True,'real_material_library_evidence_and_units') + def test32_declared_geometry_guards(self): + h=calibrated();call(h,'pendulum.raise');h.step(5);call(h,'shield.set_open',opened=True);h.step(.6);self.reject(h,'sample.load','INVALID_NOTCH_GEOMETRY',**dict(SAMPLE_EXAMPLE,notch_depth_m=.01));self.reject(h,'sample.load','INVALID_VOLUME',**dict(SAMPLE_EXAMPLE,volume_m3=1e-5));self.reject(h,'sample.load','ENGINEERING_ACCEPTANCE_REQUIRED',**dict(SAMPLE_EXAMPLE,accept_reference_transfer_and_fracture_proxy=False));self.check(True,'remaining_notch_area_explicit') + def test33_sensor_quantization_not_exact_truth(self): + h=configured();call(h,'calibration.start');h.step(.123);value=h.read()['encoder.angle_rad'];self.assertAlmostEqual(value/ENCODER_RESOLUTION_RAD,round(value/ENCODER_RESOLUTION_RAD));self.assertNotEqual(value,h.theta);self.assertNotIn('pendulum.angle_rad',h.read());self.assertNotIn('truth.sample_absorbed_j',h.read());self.check(True,'exact_scene_states_restricted') + def test34_all_public_roles_redacted(self): + h=loaded();impact(h) + for role in ['agent','evaluator','debug']: + h.register_principal(role,role);h._owners[h.operation_id]=role;s=h.session(role);r=s.invoke(instance_id=h.instance_id,capability_id='acquisition.result',arguments={},request_id='r');payload=json.dumps(r);self.assertNotIn(SAMPLE_EXAMPLE['reference_id'],payload);self.assertNotIn('Ultradur',payload);self.assertNotIn('B4520',payload);self.assertNotIn(SAMPLE_EXAMPLE['reference_id'],json.dumps(s.poll(h.operation_id))) + self.check(True,'privileged_bridge_public_result_filter') + def test35_private_provenance_snapshot(self): + h=loaded();impact(h);source=call(h,'provenance.read')['operation_source'];h.register_principal('a','agent');s=h.session('a');r=s.invoke(instance_id=h.instance_id,capability_id='provenance.read',arguments={},request_id='p');self.assertEqual(r['error']['code'],'ACCESS_DENIED');call(h,'pendulum.raise');h.step(5);call(h,'shield.set_open',opened=True);h.step(.6);call(h,'sample.remove');p=call(h,'provenance.read');self.assertIsNone(p['current_sample']);self.assertEqual(p['operation_source'],source) + def test36_idempotence_owner_and_cancel(self): + h=loaded();h.register_principal('a','agent');h.register_principal('b','agent');a=h.session('a');b=h.session('b');r=a.invoke(instance_id=h.instance_id,capability_id='acquisition.start',arguments={},request_id='start');self.assertEqual(a.invoke(instance_id=h.instance_id,capability_id='acquisition.start',arguments={},request_id='start'),r);h.step(.1) + with self.assertRaises(ActionRejected):b.poll(r['operation_id']) + c=a.cancel(r['operation_id'],'cancel');self.assertEqual(a.cancel(r['operation_id'],'cancel'),c);bad=a.invoke(instance_id=h.instance_id,capability_id='power.set',arguments={'enabled':False},request_id='start');self.assertEqual(bad['error']['code'],'REQUEST_CONFLICT');self.check(True,'identity_owner_and_request_retry') + def test37_read_poll_do_not_advance(self): + h=loaded();h.register_principal('a','agent');s=h.session('a');r=s.invoke(instance_id=h.instance_id,capability_id='acquisition.start',arguments={},request_id='s');t=h.time_ns;theta=h.theta;rows=copy.deepcopy(h.rows) + for _ in range(10):s.read(instance_id=h.instance_id);s.poll(r['operation_id']);s.describe(instance_id=h.instance_id) + self.assertEqual(h.time_ns,t);self.assertEqual(h.theta,theta);self.assertEqual(h.rows,rows);self.check(True,'pure_read_describe_poll') + def test38_instance_isolation(self): + a=loaded();b=loaded(sample=dict(host_charpy_strength_j_m2=8000.));ra=impact(a);self.assertFalse(b.spent);rb=impact(b);self.assertNotEqual(ra['corrected_energy_j'],rb['corrected_energy_j']);self.assertAlmostEqual(b.absorbed,.256);self.check(True,'independent_instances') + def test39_no_fake_instrumented_modes(self): + h=configured() + for k in UNSUPPORTED:self.reject(h,k,'UNSUPPORTED') + self.check(True,'unsupported_is_negative_only') + def test40_schema_examples_and_all_reads(self): + meta=export_zwick_hit5p_contract_metadata();schemas=[v[s] for v in CAPS.values() for s in ['input_schema','output_schema']]+[v['schema'] for v in SLOTS.values()];r=subprocess.run([sys.executable,'-c','import sys,json;from jsonschema import Draft202012Validator;[Draft202012Validator.check_schema(s) for s in json.load(sys.stdin)]'],input=json.dumps(schemas),text=True,capture_output=True);self.assertEqual(r.returncode,0,r.stderr) + for k,c in CAPS.items():validate(c['input_schema'],c['example_arguments']);self.assertEqual(meta['capabilities'][k]['availability'],'unsupported' if k in UNSUPPORTED else 'implemented') + for k,v in configured().read('debug').items():validate(SLOTS[k]['schema'],v) + self.check(True,'all_contract_schemas_units_examples') + def test41_step_cap_and_fractional_ns(self): + h=configured();t=h.time_ns + for _ in range(60):call(h,'sim.step',dt_s=1/60) + self.assertEqual(h.time_ns-t,1_000_000_000);self.check(True,'fractional_ns_no_drift') + def test42_external_negative_energy_not_clipped(self): + h=configured();r=call(h,'analysis.impact',**dict(CAPS['analysis.impact']['example_arguments'],rebound_angle_rad=-RELEASE_ANGLE_RAD,friction_torque_nm=.001));self.assertLess(r['corrected_energy_j'],0);self.assertEqual(r['validity'],'negative_corrected_energy');self.assertIsNone(r['impact_strength_j_m2']);self.check(True,'negative_corrected_energy_not_hidden') + def test43_empty_requires_no_sample(self): + h=loaded();self.reject(h,'calibration.start','EMPTY_REQUIRED');self.reject(h,'sample.load','SAMPLE_PRESENT',**SAMPLE_EXAMPLE);self.check(True,'calibration_empty_guard') + def test44_sample_grid_and_event_labels(self): + h=loaded();r=impact(h);times=[x['time_s'] for x in r['rows'] if x['kind']=='sample'];self.assertTrue(np.allclose(np.diff(times),.002,atol=1e-12));self.assertEqual([x['kind'] for x in r['rows'] if x['kind']!='sample'],['impact','apex']);self.assertGreater(r['elapsed_s'],.5);self.check(True,'real_time_encoder_samples_and_events') + def test45_passive_heat_independent_solution(self): + h=loaded();impact(h);U=h.sample_U;C=.01+.00415*1200.;h.step(1.234);self.assertAlmostEqual(h.sample_U,U*math.exp(-.03*1.234/C),places=13);self.balanced(h) + + def test46_stiff_thermal_configuration_rejected_atomically(self): + h=ZwickHit5pRuntime();self.reject(h,'plant.configure','THERMAL_TIME_CONSTANT_OUTSIDE_NUMERICAL_DOMAIN',**dict(PLANT_EXAMPLE,local_sample_heat_capacity_j_k=1e-6,sample_conductance_w_k=1e4));self.reject(h,'plant.configure','THERMAL_TIME_CONSTANT_OUTSIDE_NUMERICAL_DOMAIN',**dict(PLANT_EXAMPLE,bearing_heat_capacity_j_k=.001,bearing_conductance_w_k=1e4));h=configured(dict(local_sample_heat_capacity_j_k=.001,sample_conductance_w_k=1.,bearing_heat_capacity_j_k=.001,bearing_conductance_w_k=1.));call(h,'calibration.start');call(h,'pendulum.catch');h.step(2);self.assertEqual(h.phase,'succeeded');self.balanced(h);self.check(True,'thermal_minimum1ms_is_numerical_domain_not_OEM') + +if __name__=='__main__':unittest.main(verbosity=2) diff --git a/tests/test_asset_zwick_mflow.py b/tests/test_asset_zwick_mflow.py new file mode 100644 index 0000000000000000000000000000000000000000..b4ca3aed030589e105d86bf6b4ddf09099ecfa6d --- /dev/null +++ b/tests/test_asset_zwick_mflow.py @@ -0,0 +1,937 @@ +"""CHEM-146 ZwickRoell Mflow runtime tests: python3 -m unittest tests/test_asset_zwick_mflow.py + +Themes (pipeline.md): setpoints only write targets; read/describe/poll are pure; rejected preconditions leave the state +unchanged; two instances are isolated; agent/evaluator truth isolation and result redaction; mass and energy +conservation; real return values validate against the contract schemas; async completion / cancellation residue. +Physics: PI heating and recovery, melting/compaction, die-flow transfer (load, temperature, friction, history), +quantisation of the encoder / time base / display, cutter half turns, external weighing, ISO method A/B arithmetic. +No native scene, robot or hardware claims. +""" +import copy +import importlib.util +import json +import math +import subprocess +import sys +import unittest +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT)) +from scripts.asset_runtime.zwick_mflow import * # noqa: E402,F401,F403 +from scripts.asset_runtime import zwick_mflow as rt # noqa: E402 + +PROCESS_EVIDENCE = {} +CHECKS = [] +_spec = importlib.util.spec_from_file_location('mflow_asset_tool', ROOT / 'skills/chemistry-lab-assets/scripts/asset_tool.py') +asset_tool = importlib.util.module_from_spec(_spec) +_spec.loader.exec_module(asset_tool) +_ispec = importlib.util.spec_from_file_location('mflow_interface', ROOT / 'outputs/expansion_batch04/t1_thermal/zwick_mflow/interface_definition.py') +interface = importlib.util.module_from_spec(_ispec) +_ispec.loader.exec_module(interface) +TARGET = 523.15 + + +def call(h, k, **a): + """Invoke through the runtime, validate the returned value and check that only declared slots changed.""" + before = h.read('debug') + r = h.invoke(k, **a) + validate(CAPS[k]['output_schema'], r) + problems = asset_tool.validate_value(r, CAPS[k]['output_schema']) + if problems: + raise AssertionError(f'{k}: {problems}') + after = h.read('debug') + delta = {x for x in after if before[x] != after[x]} + if not delta <= set(CAPS[k]['effects']): + raise AssertionError(f'{k}: undeclared state changes {sorted(delta - set(CAPS[k]["effects"]))}') + PROCESS_EVIDENCE.setdefault(k, []).append(dict(time_s=h.time_s, phase=h.phase, result_keys=sorted(r), actual_call=True)) + return r + + +def configured(plant=None, method=None, balance=True): + h = ZwickMflowRuntime() + call(h, 'plant.configure', **dict(PLANT_EXAMPLE, **(plant or {}))) + if balance: + call(h, 'balance.configure', **BALANCE_EXAMPLE) + call(h, 'method.configure', **dict(METHOD_EXAMPLE, **(method or {}))) + return h + + +def heated(plant=None, method=None, target=TARGET, seconds=1500.0): + h = configured(plant, method) + call(h, 'power.set', enabled=True) + call(h, 'thermal.set_temperature', target_k=target) + h.step(seconds) + return h + + +def charged(plant=None, method=None, sample=None, target=TARGET, preheat=True, load=2.16): + """Heated barrel, charge loaded, piston inserted (piston load only) and preheated, then the test weight applied.""" + h = heated(plant, method, target) + call(h, 'sample.load', **dict(SAMPLE_EXAMPLE, **(sample or {}))) + call(h, 'piston.insert') + h.step(8.0) + if preheat: + h.step(h.method['preheat_time_s'] - 8.0 + 1.0) + call(h, 'weight.configure', total_load_kg=load) + return h + + +def run(h, limit=900.0): + call(h, 'acquisition.start') + t = 0.0 + while h.phase == 'running' and t < limit: + h.step(1.0) + t += 1.0 + h.step(30.0) # let the automatic weighings settle + return call(h, 'acquisition.result') + + +def reference_mvr(): + ref = library()[SAMPLE_EXAMPLE['reference_id']] + return next(m['mvr_m3_s'] for m in ref['measurements'] if m['mvr_m3_s'] is not None and abs(m['reference_temperature_K'] - 523.15) < 1e-9) + + +class MflowTest(unittest.TestCase): + def check(self, condition, key, **data): + self.assertTrue(condition, key) + CHECKS.append(dict(id=key, status='passed', layer='process', **data)) + + def balanced(self, h): + b = call(h, 'ledger.read') + throughput = b['heater_input_j'] + b['ambient_export_j'] + abs(b['host_work_j']) + tol = 1e-6 + 1e-11 * throughput # double-precision accumulation over millions of sub-steps + self.check(abs(b['energy_residual_j']) < tol, 'energy_balance', residual_j=b['energy_residual_j'], tolerance_j=tol) + self.check(abs(b['mass_residual_kg']) < 1e-15, 'mass_balance', residual_kg=b['mass_residual_kg']) + return b + + def reject(self, h, k, code=None, **a): + state = copy.deepcopy(h.__dict__) + with self.assertRaises(ActionRejected) as e: + h.invoke(k, **a) + if code: + self.assertEqual(str(e.exception), code) + self.assertEqual(state, h.__dict__) + + # ------------------------------------------------------------ documented constants and geometry agreement + def test01_documented_constants(self): + self.assertAlmostEqual(BARREL_DIAMETER_M, 0.00955) + self.assertAlmostEqual(DIE_DIAMETER_M, 0.002095) + self.assertAlmostEqual(DIE_LENGTH_M, 0.008) + self.assertEqual(LOAD_RANGE_KG, (0.325, 21.6)) + self.assertEqual(TEMPERATURE_RANGE_K, (323.15, 723.15)) + self.assertAlmostEqual(ENCODER_RESOLUTION_M, 3e-6) + self.assertAlmostEqual(TIME_RESOLUTION_S, 0.002) + self.assertAlmostEqual(STANDARD_AREA_M2 * 1e4, 0.7106, places=3) # ISO 1133 mean area 0.711 cm^2 + self.check(True, 'documented_specifications_and_iso_area') + + def test02_runtime_matches_geometry_interface(self): + for q in [0.0, 0.01, 0.05, 0.08, 0.107, 0.12, 0.18]: + self.assertAlmostEqual(sensor_arm_angle(q), interface.sensor_arm_angle(q), places=12) + self.assertAlmostEqual(SENSOR_RANGE_M[1], interface.SENSOR_CONTACT_RANGE_M[1], places=12) + self.assertAlmostEqual(PISTON_TRAVEL_M, interface.PISTON_TRAVEL_M) + self.assertAlmostEqual(DIE_DIAMETER_M, interface.DIE_DIAMETER_M) + self.assertEqual({m[1] for m in interface.MOTION}, {'piston.position_m', 'sensor_arm.angle_rad', 'cutter.angle_rad', 'power.angle_rad'}) + for part, sid, capability, attr, unit, hi in interface.MOTION: + self.assertIn(sid, SLOTS) + self.assertIn(capability, CAPS) + for row in interface.READOUTS: + self.assertIn(row['source']['bridge'][0], SLOTS) + for key, capability in interface.KEY_COMMANDS.items(): + self.assertIn(capability, CAPS) + self.check(True, 'runtime_constants_equal_geometry_interface') + + # ------------------------------------------------------------ setpoints, heating, control + def test03_setpoint_only_writes_target(self): + h = configured() + call(h, 'power.set', enabled=True) + T = h.T_b + call(h, 'thermal.set_temperature', target_k=TARGET) + self.assertEqual(h.T_b, T) + self.assertEqual(h.read()['thermal.target_k'], TARGET) + h.step(1.0) + self.assertGreater(h.T_b, T) + self.check(True, 'set_temperature_is_target_only') + + def test04_heat_up_rate_and_stability(self): + h = configured() + call(h, 'power.set', enabled=True) + call(h, 'thermal.set_temperature', target_k=TARGET) + h.step(60.0) + rate = (h.T_b - PLANT_EXAMPLE['ambient_k']) / 60.0 + self.assertGreater(rate, 0.3) # full heater power, >0.3 K/s at the start + times = [] + for t in range(1, 1801): + h.step(1.0) + if abs(h.T_b - TARGET) < 0.1 and not times: + times.append(t + 60) + self.assertTrue(times and times[0] < 1200, times) + self.assertLess(abs(h.T_b - TARGET), 0.01) + self.balanced(h) + self.check(True, 'pi_heating_within_20min_and_steady_state', first_within_0p1K_s=times[0], initial_rate_k_s=rate) + + def test05_cooling_after_power_off(self): + h = heated() + call(h, 'power.set', enabled=False) + T0 = h.T_b + h.step(600.0) + tau = PLANT_EXAMPLE['barrel_heat_capacity_j_k'] / PLANT_EXAMPLE['barrel_loss_w_k'] + expected = PLANT_EXAMPLE['ambient_k'] + (T0 - PLANT_EXAMPLE['ambient_k']) * math.exp(-600.0 / tau) + self.assertAlmostEqual(h.T_b, expected, delta=0.05) + self.assertIsNone(h.read()['thermal.indicated_k']) + self.balanced(h) + self.check(True, 'passive_cooling_matches_analytic_first_order') + + def test06_display_quantisation(self): + h = heated(seconds=200.0) + v = h.read()['thermal.indicated_k'] + self.assertAlmostEqual(v / 0.01, round(v / 0.01), places=6) + self.assertLessEqual(abs(v - h.T_b), 0.005 + 1e-9) + self.check(True, 'temperature_display_0p01K') + + # ------------------------------------------------------------ loading, melting, compaction + def test07_loading_requires_withdrawn_piston(self): + h = heated() + call(h, 'piston.insert') + h.step(20.0) + self.reject(h, 'sample.load', 'PISTON_NOT_WITHDRAWN', **SAMPLE_EXAMPLE) + call(h, 'piston.withdraw') + h.step(20.0) + r = call(h, 'sample.load', **SAMPLE_EXAMPLE) + self.assertAlmostEqual(r['column_height_m'], 0.006 / (800.0 * STANDARD_AREA_M2)) + self.reject(h, 'sample.load', 'SAMPLE_PRESENT', **SAMPLE_EXAMPLE) + self.check(True, 'loading_geometry_and_column_height') + + def test08_melting_compaction_and_premature_flow(self): + h = heated() + call(h, 'sample.load', **SAMPLE_EXAMPLE) + call(h, 'piston.insert') + h.step(20.0) + self.assertTrue(h.contact) + x0 = h.x + self.assertAlmostEqual(x0, 0.006 / (800.0 * STANDARD_AREA_M2), places=9) + h.step(280.0) + melted_height = h.m_s / (SAMPLE_EXAMPLE['melt_density_kg_m3'] * STANDARD_AREA_M2) + self.assertAlmostEqual(h.x, melted_height, places=9) + self.assertEqual(h.pellet, 0.0) + self.assertGreater(h.strand_kg, 0.0) + self.assertLess(h.strand_kg, 0.1 * SAMPLE_EXAMPLE['mass_kg']) # piston-only preload keeps premature flow small + self.assertGreater(h._sample_T(), TARGET - 2.0) + self.balanced(h) + self.check(True, 'melting_compaction_premature_flow', piston_mm=h.x * 1000, strand_g=h.strand_kg * 1000) + + def test09_resolidification_does_not_restore_pellets(self): + h = heated() + call(h, 'sample.load', **SAMPLE_EXAMPLE) + call(h, 'piston.insert') + h.step(300.0) + x = h.x + call(h, 'power.set', enabled=False) + h.step(3000.0) + self.assertLess(h._sample_T(), SAMPLE_EXAMPLE['melting_low_k']) + self.assertEqual(h.pellet, 0.0) + self.assertLessEqual(h.x, x) + self.balanced(h) + self.check(True, 'monotonic_compaction') + + def test10_cold_charge_barrel_recovery(self): + h = heated() + call(h, 'sample.load', **SAMPLE_EXAMPLE) + call(h, 'piston.insert') + dips = [] + for _ in range(240): + h.step(1.0) + dips.append(h.T_b) + self.assertLess(min(dips), TARGET) + self.assertLess(abs(h.T_b - TARGET), 0.3) # back within ISO-like tolerance within 4 min + self.balanced(h) + self.check(True, 'temperature_recovery_after_charging', dip_k=TARGET - min(dips)) + + # ------------------------------------------------------------ die flow and ISO results + def test11_reference_condition_mvr(self): + h = charged() + r = run(h) + self.assertEqual(r['phase'], 'succeeded') + self.assertEqual(r['validity'], 'valid') + mvr = r['flow']['mvr_m3_s'] + ref = reference_mvr() + friction = ((2.16 * GRAVITY - PLANT_EXAMPLE['piston_friction_n']) / (2.16 * GRAVITY)) ** (1 / SAMPLE_EXAMPLE['power_law_index']) + self.assertLess(abs(mvr / ref - 1.0), 0.03) + self.assertLess(mvr, ref * math.exp(SAMPLE_EXAMPLE['history_rate_per_s'] * 600)) + self.assertGreater(r['flow']['mfr_kg_s'], 0.0) + self.assertAlmostEqual(r['flow']['density_at_test_temperature_kg_m3'], SAMPLE_EXAMPLE['melt_density_kg_m3'], delta=15.0) + self.assertEqual(r['flow']['weighed_segments'], sum(1 for s in r['segments'] if s['measurement_segment'])) + self.balanced(h) + self.check(True, 'iso_reference_condition_recovered', mvr_cm3_10min=mvr * 6e8, reference_cm3_10min=ref * 6e8, friction_factor=friction) + + def test12_independent_flow_law_at_contact(self): + h = charged() + T, phi = h._sample_state() + n, Ea = SAMPLE_EXAMPLE['power_law_index'], SAMPLE_EXAMPLE['activation_energy_j_mol'] + expected = (reference_mvr() * ((2.16 * GRAVITY - PLANT_EXAMPLE['piston_friction_n']) / (2.16 * GRAVITY)) ** (1 / n) + * math.exp(-(Ea / (n * GAS_CONSTANT)) * (1 / T - 1 / 523.15)) * math.exp(SAMPLE_EXAMPLE['history_rate_per_s'] * h.t_hist) * phi ** 3) + self.assertAlmostEqual(h._flow(T, phi), expected, delta=expected * 1e-12) + self.check(True, 'independent_power_law_transfer_formula') + + def test13_load_scaling_power_law(self): + a = charged(method=dict(test_load_kg=2.16), load=2.16) + b = charged(method=dict(test_load_kg=5.0), load=5.0) + T = a._sample_T() + ratio = b._flow(T, 1.0) / a._flow(T, 1.0) + n = SAMPLE_EXAMPLE['power_law_index'] + f = PLANT_EXAMPLE['piston_friction_n'] + self.assertAlmostEqual(ratio, ((5.0 * GRAVITY - f) / (2.16 * GRAVITY - f)) ** (1 / n), places=9) + self.check(True, 'load_scaling_one_over_n') + + def test14_temperature_scaling_arrhenius(self): + h = charged() + n, Ea = SAMPLE_EXAMPLE['power_law_index'], SAMPLE_EXAMPLE['activation_energy_j_mol'] + r = h._flow(533.15, 1.0) / h._flow(523.15, 1.0) + self.assertAlmostEqual(r, math.exp(-(Ea / (n * GAS_CONSTANT)) * (1 / 533.15 - 1 / 523.15)), places=9) + self.assertGreater(r, 1.0) + self.check(True, 'arrhenius_temperature_shift') + + def test15_friction_reduces_flow_and_heats_barrel(self): + a = charged(plant=dict(piston_friction_n=0.0)) + b = charged(plant=dict(piston_friction_n=2.0)) + T = a._sample_T() + self.assertGreater(a._flow(T, 1.0), b._flow(T, 1.0)) + rb = run(b) + self.assertGreater(b.book['friction_heat_j'], 0.0) + self.assertLess(rb['flow']['mvr_m3_s'], reference_mvr()) + self.balanced(b) + self.check(True, 'piston_friction_effect') + + def test16_thermal_history_changes_flow(self): + a = charged(sample=dict(history_rate_per_s=0.0)) + b = charged(sample=dict(history_rate_per_s=5e-4)) + T = a._sample_T() + self.assertAlmostEqual(b._flow(T, 1.0) / a._flow(T, 1.0), math.exp(5e-4 * b.t_hist), places=9) + self.assertGreater(b.t_hist, 100.0) + self.check(True, 'thermal_history_multiplier') + + def test17_preheat_and_load_guards(self): + h = heated() + call(h, 'sample.load', **SAMPLE_EXAMPLE) + call(h, 'piston.insert') + h.step(30.0) + call(h, 'weight.configure', total_load_kg=2.16) + self.reject(h, 'acquisition.start', 'PREHEAT_NOT_COMPLETE') + h.step(300.0) + call(h, 'weight.configure', total_load_kg=5.0) + self.reject(h, 'acquisition.start', 'LOAD_MISMATCH') + call(h, 'thermal.set_temperature', target_k=533.15) + call(h, 'weight.configure', total_load_kg=2.16) + self.reject(h, 'acquisition.start', 'TEMPERATURE_NOT_STABLE') + self.check(True, 'acquisition_preconditions') + + def test18_window_and_encoder_quantisation(self): + h = charged() + r = run(h) + pos = [x['encoder_position_m'] for x in r['rows'] if x['encoder_position_m'] is not None] + self.assertTrue(all(abs(p / ENCODER_RESOLUTION_M - round(p / ENCODER_RESOLUTION_M)) < 1e-6 for p in pos)) + times = [x['time_s'] for x in r['rows']] + self.assertTrue(all(abs(t / TIME_RESOLUTION_S - round(t / TIME_RESOLUTION_S)) < 1e-6 for t in times)) + a, b = r['flow']['window_positions_m'] + self.assertLessEqual(a, METHOD_EXAMPLE['window_upper_m']) + self.assertGreaterEqual(b, METHOD_EXAMPLE['window_lower_m']) + manual = analyze_flow(a, b, *r['flow']['window_times_s'], STANDARD_AREA_M2, [], None) + self.assertAlmostEqual(manual['mvr_m3_s'], r['flow']['mvr_m3_s'], places=18) + self.check(True, 'encoder_3um_time_2ms_quantised_window') + + def test19_segments_mass_conservation_and_weighing(self): + h = charged() + r = run(h) + segs = r['segments'] + self.assertFalse(segs[0]['measurement_segment']) # trim cut removes the preheat extrudate + meas = [s for s in segs if s['measurement_segment']] + self.assertTrue(all(s['status'] == 'weighed' for s in meas)) + self.assertTrue(all(abs(s['duration_s'] - METHOD_EXAMPLE['cut_interval_s']) < 1e-9 for s in meas)) + for s in meas: + true = next(g['true_mass_kg'] for g in h.segments if g['segment_id'] == s['segment_id']) + self.assertLessEqual(abs(s['observed_mass_kg'] - true), BALANCE_EXAMPLE['resolution_kg'] / 2 + 1e-15) + b = self.balanced(h) + self.assertAlmostEqual(b['extruded_mass_kg'], b['strand_mass_kg'] + b['segments_mass_kg'] + b['collected_mass_kg'], places=15) + self.check(True, 'cut_segments_weighed_on_external_balance', segments=len(meas)) + + def test20_manual_cut_half_turn(self): + h = charged() + call(h, 'piston.insert') if not h.contact else None + strand = h.strand_kg + self.assertGreater(strand, 0.0) + call(h, 'cutter.cut') + self.reject(h, 'cutter.cut', 'CUTTER_BUSY') + h.step(PLANT_EXAMPLE['cutter_half_turn_s'] * 0.25) + self.assertAlmostEqual(h.cutter_angle, math.pi * 0.25, places=6) + self.assertGreater(h.strand_kg, strand) # still uncut before pi/2 + h.step(PLANT_EXAMPLE['cutter_half_turn_s'] * 0.30) + self.assertEqual(len(h.segments), 1) + h.step(1.0) + self.assertEqual(h.cutter_angle, math.pi) + call(h, 'cutter.cut') + h.step(1.0) + self.assertEqual(h.cutter_angle, 0.0) # alternate half turns + self.assertEqual(len(h.segments), 2) + self.balanced(h) + self.check(True, 'cutter_alternate_half_turn_sever_at_pi_over_2') + + def test21_balance_resolution_gain_offset_settling(self): + h = charged(method=dict(automatic_weighing=False)) + call(h, 'balance.configure', **dict(BALANCE_EXAMPLE, resolution_kg=1e-6, gain=1.01, offset_kg=2e-6, settling_s=6.0)) + r = run(h) + seg = next(s for s in r['segments'] if s['measurement_segment']) + self.assertEqual(seg['status'], 'unweighed') + call(h, 'balance.weigh', segment_id=seg['segment_id']) + self.reject(h, 'balance.weigh', 'SEGMENT_ALREADY_WEIGHED_OR_QUEUED', segment_id=seg['segment_id']) + h.step(5.9) + self.assertEqual(next(g for g in h.segments if g['segment_id'] == seg['segment_id'])['status'], 'weighing') + h.step(0.2) + g = next(g for g in h.segments if g['segment_id'] == seg['segment_id']) + self.assertEqual(g['status'], 'weighed') + self.assertAlmostEqual(g['observed_mass_kg'], round((1.01 * g['true_mass_kg'] + 2e-6) / 1e-6) * 1e-6, places=15) + c = call(h, 'calibration.balance', observed_low_kg=2e-6, observed_high_kg=1.01e-3 + 2e-6, reference_low_kg=0.0, reference_high_kg=1e-3) + self.assertAlmostEqual(c['scale'], 1 / 1.01, places=9) + self.check(True, 'external_balance_proxy_behaviour') + + def test22_encoder_two_point_calibration(self): + h = charged() + before = h.read()['encoder.position_m'] + c = call(h, 'calibration.encoder', observed_low_m=0.010, observed_high_m=0.061, reference_low_m=0.010, reference_high_m=0.060) + self.assertAlmostEqual(c['scale'], 50 / 51, places=12) + after = h.read()['encoder.position_m'] + self.assertAlmostEqual(after, quantize(c['scale'] * h.x + c['offset_m'], ENCODER_RESOLUTION_M), places=12) + self.assertNotEqual(before, after) + self.reject(h, 'calibration.encoder', 'DEGENERATE_CALIBRATION', observed_low_m=0.01, observed_high_m=0.01, reference_low_m=0.01, reference_high_m=0.06) + self.check(True, 'encoder_calibration_from_external_observations') + + def test23_encoder_range_and_arm(self): + h = configured() + call(h, 'power.set', enabled=True) + self.assertIsNone(h.read()['encoder.position_m']) # withdrawn piston above the transducer range + self.assertAlmostEqual(h.read('debug')['sensor_arm.angle_rad'], interface.SENSOR_ARM_LIMITS_RAD[1], places=12) + call(h, 'piston.insert') + h.step(20.0) + self.assertEqual(h.x, 0.0) + self.assertEqual(h.read()['encoder.position_m'], 0.0) + self.assertEqual(h.read('debug')['sensor_arm.angle_rad'], 0.0) + self.check(True, 'encoder_range_and_arm_mapping') + + def test24_validity_preheat_below_iso(self): + h = charged(method=dict(preheat_time_s=120.0)) + r = run(h) + self.assertEqual(r['validity'], 'preheat_below_iso_minimum') + self.assertIsNone(h.read()['measurement.mvr_m3_s']) + self.check(True, 'iso_preheat_minimum_flag') + + def test25_validity_started_below_window(self): + h = charged() + h.step(60.0) # full load already pushes the piston through the upper window edge + r = run(h) + self.assertEqual(r['validity'], 'window_not_traversed') + self.assertEqual(r['terminal_reason'], 'STARTED_BELOW_WINDOW') + self.assertEqual(r['phase'], 'failed') + self.check(True, 'window_must_be_traversed') + + def test26_temperature_excursion_invalidates(self): + h = charged(method=dict(temperature_tolerance_k=0.2)) + call(h, 'acquisition.start') + call(h, 'thermal.set_temperature', target_k=528.15) + while h.phase == 'running': + h.step(1.0) + self.assertEqual(h.validity, 'temperature_out_of_tolerance') + self.check(True, 'temperature_excursion_flag') + + def test27_duration_limit(self): + h = charged(method=dict(duration_s=5.0)) + r = run(h) + self.assertEqual(r['terminal_reason'], 'DURATION_ELAPSED') + self.assertEqual(r['validity'], 'window_not_traversed') + self.check(True, 'duration_limit') + + def test28_sample_exhausted(self): + h = charged(sample=dict(mass_kg=0.0032), method=dict(window_lower_m=0.005, window_upper_m=0.020)) + r = run(h) + self.assertIn(r['terminal_reason'], ('SAMPLE_EXHAUSTED', 'WINDOW_TRAVERSED', 'STARTED_BELOW_WINDOW')) + self.balanced(h) + self.check(True, 'small_charge_end_conditions') + + # ------------------------------------------------------------ async, cancellation, power + def test29_stop_keeps_physics(self): + h = charged() + call(h, 'acquisition.start') + h.step(12.0) + call(h, 'acquisition.stop') + snap = call(h, 'acquisition.result') + x = h.x + strand = h.strand_kg + h.step(20.0) + self.assertLess(h.x, x) # the loaded piston keeps extruding + self.assertGreater(h.strand_kg + sum(g['true_mass_kg'] for g in h.segments), strand) + self.assertEqual(call(h, 'acquisition.result')['rows'], snap['rows']) + self.assertEqual(snap['phase'], 'cancelled') + self.balanced(h) + self.check(True, 'cancel_freezes_record_not_physics') + + def test30_power_off_cancels(self): + h = charged() + call(h, 'acquisition.start') + h.step(3.0) + call(h, 'power.set', enabled=False) + self.assertEqual(h.phase, 'cancelled') + self.assertEqual(h.terminal_reason, 'POWER_OFF') + self.assertIsNone(h.read()['encoder.position_m']) + self.assertIsNone(h.read()['thermal.indicated_k']) + self.reject(h, 'cutter.cut', 'POWER_OFF') + h.step(60.0) + self.assertLess(h.T_b, TARGET) + self.balanced(h) + self.check(True, 'power_off_semantics') + + def test31_busy_guard_atomic(self): + h = charged() + call(h, 'acquisition.start') + self.reject(h, 'weight.configure', 'BUSY', total_load_kg=5.0) + self.reject(h, 'piston.withdraw', 'BUSY') + self.reject(h, 'sample.remove', 'BUSY') + self.reject(h, 'acquisition.start', 'BUSY') + self.check(True, 'busy_rejections_atomic') + + # ------------------------------------------------------------ removal, clearing, conservation + def test32_remove_and_clear_conserve(self): + h = charged() + run(h) + call(h, 'piston.withdraw') + h.step(15.0) + rem = call(h, 'sample.remove') + self.assertGreater(rem['removed_mass_kg'], 0.0) + clr = call(h, 'collection.clear') + self.assertGreater(clr['collected_mass_kg'], 0.0) + b = self.balanced(h) + self.assertAlmostEqual(b['loaded_mass_kg'], b['removed_mass_kg'] + b['collected_mass_kg'], places=15) + self.assertGreater(b['host_work_j'], 0.0) + self.check(True, 'remove_and_collect_close_ledgers') + + def test33_step_partition_independence(self): + a = charged() + b = charged() + call(a, 'acquisition.start') + call(b, 'acquisition.start') + a.step(6.0) + for _ in range(360): + b.step(1 / 60) + self.assertEqual(a.time_ns, b.time_ns) + self.assertEqual(a.rows, b.rows) # quantised observations identical + self.assertAlmostEqual(a.x, b.x, delta=ENCODER_RESOLUTION_M / 10) # explicit sub-steps: O(dt) truth difference + self.assertAlmostEqual(a.T_b, b.T_b, delta=1e-4) + self.balanced(a) + self.balanced(b) + self.check(True, 'partition_changes_truth_below_resolution_rows_identical', piston_difference_m=abs(a.x - b.x), barrel_difference_k=abs(a.T_b - b.T_b)) + + def test34_fractional_nanosecond_clock(self): + h = configured() + t = h.time_ns + for _ in range(60): + call(h, 'sim.step', dt_s=1 / 60) + self.assertEqual(h.time_ns - t, 1_000_000_000) + self.check(True, 'fractional_ns_no_drift') + + # ------------------------------------------------------------ roles, redaction, sessions + def test35_agent_truth_isolation(self): + h = charged() + agent_view = h.read('agent') + self.assertFalse(any(k.startswith('truth.') for k in agent_view)) + for k in ('piston.position_m', 'piston.target_m', 'sensor_arm.angle_rad', 'cutter.angle_rad', 'extrudate.length_m', 'heater.output_fraction'): + self.assertNotIn(k, agent_view) + h.register_principal('a', 'agent') + s = h.session('a') + r = s.invoke(instance_id=h.instance_id, capability_id='provenance.read', arguments={}, request_id='p') + self.assertEqual(r['error']['code'], 'ACCESS_DENIED') + r = s.invoke(instance_id=h.instance_id, capability_id='sample.remove', arguments={}, request_id='x') + self.assertEqual(r['error']['code'], 'ACCESS_DENIED') + with self.assertRaises(ActionRejected): + s.read(instance_id=h.instance_id, state_ids=['truth.flow_m3_s']) + self.check(True, 'agent_cannot_read_truth_or_provenance') + + def test36_result_redacted_for_all_roles(self): + h = charged() + run(h) + for role in ['agent', 'evaluator', 'debug']: + h.register_principal(role, role) + h._owners[h.operation_id] = role + s = h.session(role) + r = s.invoke(instance_id=h.instance_id, capability_id='acquisition.result', arguments={}, request_id='r') + payload = json.dumps(r) + json.dumps(s.poll(h.operation_id)) + self.assertNotIn(SAMPLE_EXAMPLE['reference_id'], payload) + self.assertNotIn('B4520', payload) + self.assertNotIn('Ultradur', payload) + p = call(h, 'provenance.read') + self.assertIn('basf_ultradur_b4520', p['operation_source']) + self.check(True, 'public_result_redaction_private_provenance') + + def test37_idempotence_owner_cancel(self): + h = charged() + h.register_principal('a', 'agent') + h.register_principal('b', 'agent') + a = h.session('a') + b = h.session('b') + r = a.invoke(instance_id=h.instance_id, capability_id='acquisition.start', arguments={}, request_id='start') + self.assertEqual(a.invoke(instance_id=h.instance_id, capability_id='acquisition.start', arguments={}, request_id='start'), r) + h.step(1.0) + with self.assertRaises(ActionRejected): + b.poll(r['operation_id']) + denied = b.invoke(instance_id=h.instance_id, capability_id='acquisition.stop', arguments={}, request_id='s') + self.assertEqual(denied['error']['code'], 'ACCESS_DENIED') + c = a.cancel(r['operation_id'], 'cancel') + self.assertEqual(a.cancel(r['operation_id'], 'cancel'), c) + bad = a.invoke(instance_id=h.instance_id, capability_id='power.set', arguments={'enabled': False}, request_id='start') + self.assertEqual(bad['error']['code'], 'REQUEST_CONFLICT') + self.check(True, 'request_idempotence_and_operation_owner') + + def test38_read_describe_poll_pure(self): + h = charged() + h.register_principal('a', 'agent') + s = h.session('a') + r = s.invoke(instance_id=h.instance_id, capability_id='acquisition.start', arguments={}, request_id='s') + h.step(2.0) + snapshot = copy.deepcopy(h.__dict__) + for _ in range(5): + s.read(instance_id=h.instance_id) + s.poll(r['operation_id']) + s.describe(instance_id=h.instance_id) + self.assertEqual(snapshot, h.__dict__) + self.check(True, 'pure_read_describe_poll') + + def test39_write_via_capability(self): + h = configured() + h.register_principal('e', 'evaluator') + s = h.session('e') + r = s.write(instance_id=h.instance_id, state_id='thermal.target_k', value=493.15, request_id='w') + self.assertEqual(r['status'], 'succeeded') + self.assertEqual(h.target_k, 493.15) + with self.assertRaises(ActionRejected): + s.write(instance_id=h.instance_id, state_id='truth.sample_mass_kg', value=1.0, request_id='w2') + self.check(True, 'read_write_slots_use_capabilities') + + def test40_instance_isolation(self): + a = charged(sample=dict(reference_id='basf_ultradur_b4520')) + b = charged(sample=dict(reference_id='basf_ultradur_b1520_fc_r01')) + ra = run(a) + self.assertEqual(b.phase, 'idle') + rb = run(b) + self.assertGreater(rb['flow']['mvr_m3_s'], 3 * ra['flow']['mvr_m3_s']) + self.balanced(a) + self.balanced(b) + self.check(True, 'independent_instances_different_grades') + + # ------------------------------------------------------------ inputs, library, schemas, unsupported + def test41_reference_cell_guards(self): + h = heated() + self.reject(h, 'sample.load', 'NO_NUMERIC_REFERENCE_AT_CONDITION', **dict(SAMPLE_EXAMPLE, reference_temperature_k=548.15)) + self.reject(h, 'sample.load', 'UNKNOWN_REFERENCE', **dict(SAMPLE_EXAMPLE, reference_id='pure_water')) + self.reject(h, 'sample.load', 'CHARGE_EXCEEDS_BARREL', **dict(SAMPLE_EXAMPLE, mass_kg=0.02, bulk_density_kg_m3=500.0)) + self.reject(h, 'sample.load', 'ENGINEERING_ACCEPTANCE_REQUIRED', **dict(SAMPLE_EXAMPLE, accept_rheology_thermal_density_and_packing_assumptions=False)) + self.reject(h, 'sample.load', 'INVALID_MELTING_RANGE', **dict(SAMPLE_EXAMPLE, melting_low_k=500.0, melting_high_k=490.0)) + self.check(True, 'reference_cell_and_input_guards') + + def test42_library_real_references(self): + records = library() + self.assertGreaterEqual(len(records), 50) + numeric = 0 + for r in records.values(): + self.assertTrue(r['source']) + self.assertIsNone(r['melt_density_kg_m3']) + self.assertIsNone(r['power_law_exponent']) + for m in r['measurements']: + if m['mvr_m3_s'] is not None: + numeric += 1 + self.assertAlmostEqual(m['mvr_m3_s'], float(m['raw_value']) * 1e-6 / 600, places=18) + self.assertGreaterEqual(numeric, 60) + self.check(True, 'real_material_library_units', grades=len(records), numeric_cells=numeric) + + def test43_every_numeric_cell_loadable(self): + loaded = 0 + for rid, r in library().items(): + for m in r['measurements']: + if m['mvr_m3_s'] is None: + continue + h = configured() + call(h, 'sample.load', **dict(SAMPLE_EXAMPLE, reference_id=rid, reference_temperature_k=m['reference_temperature_K'], reference_load_kg=m['reference_load_kg'])) + loaded += 1 + self.assertGreaterEqual(loaded, 60) + self.check(True, 'all_numeric_reference_cells_loadable', cells=loaded) + + def test44_invalid_inputs_atomic(self): + h = configured() + self.reject(h, 'power.set', 'INVALID_ARGUMENT', enabled=1) + self.reject(h, 'method.configure', 'INVALID_ARGUMENT', **dict(METHOD_EXAMPLE, sample_interval_s=float('nan'))) + self.reject(h, 'method.configure', 'INVALID_WINDOW', **dict(METHOD_EXAMPLE, window_upper_m=0.02, window_lower_m=0.05)) + self.reject(h, 'method.configure', 'SAMPLING_NOT_ON_TIME_BASE', **dict(METHOD_EXAMPLE, sample_interval_s=0.003)) + self.reject(h, 'thermal.set_temperature', 'INVALID_ARGUMENT', target_k=800.0) + self.reject(h, 'weight.configure', 'INVALID_ARGUMENT', total_load_kg=25.0) + self.reject(h, 'plant.configure', 'PLANT_ALREADY_CONFIGURED', **PLANT_EXAMPLE) + for dt in [True, -1, float('inf'), float('nan')]: + before = h.time_ns + with self.assertRaises(ActionRejected): + h.step(dt) + self.assertEqual(h.time_ns, before) + g = ZwickMflowRuntime() + self.reject(g, 'plant.configure', 'ENGINEERING_ACCEPTANCE_REQUIRED', **dict(PLANT_EXAMPLE, accept_engineering=False)) + self.reject(g, 'plant.configure', 'THERMAL_TIME_CONSTANT_OUTSIDE_NUMERICAL_DOMAIN', **dict(PLANT_EXAMPLE, barrel_heat_capacity_j_k=100.0, controller_gain_w_k=1000.0)) + self.check(True, 'input_schema_and_rejection_atomicity') + + def test45_unsupported_negative_only(self): + h = configured() + for k in UNSUPPORTED: + self.reject(h, k, 'UNSUPPORTED') + self.check(True, 'unsupported_is_negative_only') + + def test46_contract_schemas_examples_and_reads(self): + meta = export_zwick_mflow_contract_metadata() + schemas = [v[s] for v in CAPS.values() for s in ['input_schema', 'output_schema']] + [v['schema'] for v in SLOTS.values()] + r = subprocess.run([sys.executable, '-c', 'import sys,json;from jsonschema import Draft202012Validator;[Draft202012Validator.check_schema(s) for s in json.load(sys.stdin)]'], + input=json.dumps(schemas), text=True, capture_output=True) + self.assertEqual(r.returncode, 0, r.stderr) + for s in schemas: + self.assertEqual(asset_tool.lint_schema(s), []) + for k, c in CAPS.items(): + validate(c['input_schema'], c['example_arguments']) + self.assertEqual(meta['capabilities'][k]['availability'], 'unsupported' if k in UNSUPPORTED else 'implemented') + h = charged() + run(h) + for k, v in h.read('debug').items(): + validate(SLOTS[k]['schema'], v) + self.assertEqual(asset_tool.validate_value(v, SLOTS[k]['schema']), []) + self.assertEqual(set(meta['state_slots']), set(SLOTS)) + self.check(True, 'all_contract_schemas_units_examples') + + def test47_analysis_pure_function(self): + h = configured() + r = call(h, 'analysis.flow', start_position_m=0.05, end_position_m=0.02, start_time_s=0.0, end_time_s=60.0, area_prior_m2=STANDARD_AREA_M2, + weighed_segments=[dict(mass_kg=3.8e-4, duration_s=10.0), dict(mass_kg=3.9e-4, duration_s=10.0)], melt_density_prior_kg_m3=1110.0) + self.assertAlmostEqual(r['mvr_m3_s'], 0.03 * STANDARD_AREA_M2 / 60.0, places=20) + self.assertAlmostEqual(r['mfr_g_10min'], 7.7e-4 / 20.0 * 6e5, places=9) + self.assertAlmostEqual(r['density_derived_mfr_kg_s'], r['mvr_m3_s'] * 1110.0, places=18) + with self.assertRaises(ActionRejected): + h.invoke('analysis.flow', **dict(CAPS['analysis.flow']['example_arguments'], end_time_s=0.0)) + self.check(True, 'iso_arithmetic_on_supplied_observations') + + def test48_weight_change_host_work(self): + h = configured() + call(h, 'piston.insert') + h.step(10.0) + call(h, 'weight.configure', total_load_kg=2.16) + call(h, 'piston.withdraw') + h.step(12.0) + b = self.balanced(h) + self.assertAlmostEqual(b['load_potential_j'], 2.16 * GRAVITY * PISTON_TRAVEL_M, places=9) + self.check(True, 'manual_lift_and_weights_host_work') + + def test49_panel_started_operation_visible_to_operators(self): + h = charged() + h.register_principal('panel', 'evaluator') + h.register_principal('a', 'agent') + h.register_principal('b', 'agent') + started = h.session('panel').invoke(instance_id=h.instance_id, capability_id='acquisition.start', arguments={}, request_id='key') + self.assertEqual(started['status'], 'accepted') + h.step(2.0) + r = h.session('a').invoke(instance_id=h.instance_id, capability_id='acquisition.result', arguments={}, request_id='r') + self.assertEqual(r['status'], 'succeeded') + stop = h.session('b').invoke(instance_id=h.instance_id, capability_id='acquisition.stop', arguments={}, request_id='s') + self.assertEqual(stop['status'], 'succeeded') + self.check(True, 'panel_or_host_started_operation_shared_with_operators') + + # ------------------------------------------------------------ regressions for the independent review findings + def test50_agent_never_sees_exact_position(self): + h = charged() + call(h, 'acquisition.start') + for _ in range(40): + h.step(0.5) + view = h.read('agent') + self.assertNotIn('piston.target_m', view) + self.assertNotIn('piston.position_m', view) + enc = view['encoder.position_m'] + self.assertAlmostEqual(enc / ENCODER_RESOLUTION_M, round(enc / ENCODER_RESOLUTION_M), places=6) + self.check(True, 'F01_exact_piston_position_restricted') + + def test51_finished_record_immutable_after_clear_method_change_and_other_weighings(self): + h = charged() + r = run(h) + before = call(h, 'acquisition.result') + call(h, 'method.configure', **dict(METHOD_EXAMPLE, window_upper_m=0.040, window_lower_m=0.030)) + call(h, 'collection.clear') + h.step(20.0) # keep extruding, then a manual cut and its weighing + call(h, 'cutter.cut') + h.step(1.0) + manual = h.segments[-1]['segment_id'] + call(h, 'balance.weigh', segment_id=manual) + h.step(10.0) + after = call(h, 'acquisition.result') + self.assertEqual(after, before) + self.assertEqual(h.read()['measurement.mvr_m3_s'], r['flow']['mvr_m3_s']) + self.assertEqual(h.read()['measurement.mfr_kg_s'], r['flow']['mfr_kg_s']) + self.check(True, 'F02_F03_record_immutable') + + def test52_late_weighing_reaches_its_own_record(self): + h = charged(method=dict(automatic_weighing=False)) + first = run(h) + seg = next(s for s in first['segments'] if s['measurement_segment']) + call(h, 'piston.withdraw') + h.step(10.0) + call(h, 'sample.remove') + call(h, 'sample.load', **SAMPLE_EXAMPLE) + call(h, 'piston.insert') + h.step(320.0) + call(h, 'balance.weigh', segment_id=seg['segment_id']) + call(h, 'acquisition.start') # a new run starts while the old segment is still settling + h.step(10.0) + h.register_principal('e', 'evaluator') + old = h.records[first['operation_id']] + weighed = next(s for s in old['segments'] if s['segment_id'] == seg['segment_id']) + self.assertEqual(weighed['status'], 'weighed') + self.assertIsNotNone(old['flow']['mfr_kg_s']) + self.check(True, 'F04_late_weighing_backfills_owner_record') + + def test53_small_charge_high_conductance_stable(self): + h = heated(plant=dict(sample_conductance_w_k=20.0)) + call(h, 'sample.load', **dict(SAMPLE_EXAMPLE, mass_kg=1e-4)) + for _ in range(200): + h.step(0.05) + T = h._sample_T() + self.assertTrue(PLANT_EXAMPLE['ambient_k'] - 1e-9 <= T <= TARGET + 0.5, T) + self.assertAlmostEqual(h._sample_T(), h.T_b, delta=0.05) + self.balanced(h) + self.check(True, 'F05_unconditionally_stable_exchange') + + def test54_history_multiplier_bounded(self): + h = heated() + call(h, 'sample.load', **dict(SAMPLE_EXAMPLE, history_rate_per_s=0.005)) + h.step(20 * 3600.0) + h.step(20 * 3600.0) # 40 h molten (one step is limited to 24 h) + call(h, 'piston.insert') + h.step(30.0) + T, phi = h._sample_state() + self.assertTrue(math.isfinite(h._flow(T, phi))) + self.balanced(h) + self.check(True, 'F06_history_bounded_no_overflow') + + def test55_cutter_continuous_after_power_off_mid_turn(self): + h = charged() + call(h, 'cutter.cut') + h.step(PLANT_EXAMPLE['cutter_half_turn_s'] * 0.3) + stopped = h.cutter_angle + call(h, 'power.set', enabled=False) + call(h, 'power.set', enabled=True) + call(h, 'cutter.cut') + last = h.cutter_angle + self.assertEqual(last, stopped) + n = len(h.segments) + while h._cut is not None: + h.step(0.001) + self.assertLessEqual(abs(h.cutter_angle - last), math.pi / PLANT_EXAMPLE['cutter_half_turn_s'] * 0.001 + 1e-9) + last = h.cutter_angle + self.assertEqual(h.cutter_angle, math.pi) + self.assertEqual(len(h.segments), n + 1) + self.check(True, 'F07_no_cutter_angle_jump') + + def test56_bulk_density_and_zero_width_melting(self): + h = heated() + self.reject(h, 'sample.load', 'BULK_DENSITY_EXCEEDS_MELT_DENSITY', **dict(SAMPLE_EXAMPLE, bulk_density_kg_m3=1200.0)) + call(h, 'sample.load', **dict(SAMPLE_EXAMPLE, melting_low_k=493.15, melting_high_k=493.15)) + s = h.sample + h_lo = s['specific_heat_j_kg_k'] * (493.15 - PLANT_EXAMPLE['ambient_k']) + T, phi = h._phase_of_h(h_lo + 0.3 * s['latent_heat_j_kg']) + self.assertEqual(T, 493.15) + self.assertAlmostEqual(phi, 0.3, places=12) + self.check(True, 'F08_F09_density_and_enthalpy_melt_fraction') + + def test57_row_bound_and_structured_session_errors(self): + h = configured() + self.reject(h, 'method.configure', 'TOO_MANY_SAMPLES', **dict(METHOD_EXAMPLE, duration_s=3600.0, sample_interval_s=0.002)) + h.register_principal('a', 'agent') + s = h.session('a') + for bad in ([1], {'x': 1}, None): + with self.assertRaises(ActionRejected): + s.poll(bad) + with self.assertRaises(ActionRejected): + s.write(instance_id=h.instance_id, state_id=bad, value=1.0, request_id='w') + with self.assertRaises(ActionRejected): + s.cancel(bad, 'c') + self.check(True, 'F11_F12_row_bound_structured_errors') + + def test58_segment_ids_unique_after_clear(self): + h = charged() + ids = [] + for _ in range(3): + h.step(3.0) + call(h, 'cutter.cut') + h.step(1.0) + ids.append(h.segments[-1]['segment_id']) + call(h, 'collection.clear') + self.assertEqual(len(set(ids)), 3) + self.check(True, 'F13_unique_segment_ids') + + def test59_foreign_agent_cannot_cut_during_agent_run(self): + h = charged() + h.register_principal('a', 'agent') + h.register_principal('b', 'agent') + h.session('a').invoke(instance_id=h.instance_id, capability_id='acquisition.start', arguments={}, request_id='s') + h.step(1.0) + r = h.session('b').invoke(instance_id=h.instance_id, capability_id='cutter.cut', arguments={}, request_id='c') + self.assertEqual(r['error']['code'], 'ACCESS_DENIED') + self.check(True, 'F14_foreign_agent_cut_denied') + + def test60_cycle_key_component_and_unselected_options(self): + self.assertIn('button_cycle', CAPS['cutter.cut']['component_ids']) + for k in ('piston.preheat_hold', 'collection.separating_pane', 'thermal.recool', 'die.change'): + self.assertIn(k, UNSUPPORTED) + self.assertIn('耐酸', UNSUPPORTED['material.fluorinated_or_pvc']) + self.check(True, 'K05_K06_F16_declarations') + + + def test61_die_work_leaves_with_extrudate(self): + h = charged(method=dict(test_load_kg=21.6, window_lower_m=0.010), load=21.6) + call(h, 'acquisition.start') + worst = -1e9 + while h.phase == 'running': + h.step(0.2) + if h.m_s > 0: + worst = max(worst, h._sample_T() - h.T_b) + dp = 21.6 * GRAVITY / STANDARD_AREA_M2 + adiabatic = dp / (SAMPLE_EXAMPLE['melt_density_kg_m3'] * SAMPLE_EXAMPLE['specific_heat_j_kg_k']) + self.assertLess(worst, adiabatic) + self.balanced(h) + self.check(True, 'N01_die_dissipation_exported_with_extrudate', worst_excess_k=worst, adiabatic_limit_k=adiabatic) + + def test62_foreign_agent_cannot_change_setpoint_during_run(self): + h = charged() + h.register_principal('a', 'agent') + h.register_principal('b', 'agent') + h.session('a').invoke(instance_id=h.instance_id, capability_id='acquisition.start', arguments={}, request_id='s') + r = h.session('b').invoke(instance_id=h.instance_id, capability_id='thermal.set_temperature', arguments={'target_k': 533.15}, request_id='t') + self.assertEqual(r['error']['code'], 'ACCESS_DENIED') + r = h.session('a').invoke(instance_id=h.instance_id, capability_id='thermal.set_temperature', arguments={'target_k': 523.15}, request_id='t') + self.assertEqual(r['status'], 'succeeded') + self.check(True, 'N02_setpoint_guarded_for_foreign_agents') + + def test63_segment_budget_keeps_result_within_schema(self): + saved = rt.MAX_SEGMENTS + try: + rt.MAX_SEGMENTS = 30 # budget = 30 - (240 // 10 + 2) = 4 manual cuts + h = charged() + call(h, 'acquisition.start') + h.step(1.0) + for _ in range(4): + call(h, 'cutter.cut') + h.step(0.3) + self.reject(h, 'cutter.cut', 'TOO_MANY_SEGMENTS') + while h.phase == 'running': + h.step(1.0) + self.assertLessEqual(len(call(h, 'acquisition.result')['segments']), 30) + finally: + rt.MAX_SEGMENTS = saved + self.check(True, 'N03_segment_budget') + + + +if __name__ == '__main__': + unittest.main(verbosity=2)