From 1edd03e39ad0c25e69b83fc3004e1889efbb4cc3 Mon Sep 17 00:00:00 2001 From: Neves-P Date: Mon, 20 Mar 2023 15:07:47 +0100 Subject: [PATCH 01/48] Use MIT license instead --- .Rbuildignore | 1 + DESCRIPTION | 2 +- LICENSE | 676 +------------------------------------------------- LICENSE.md | 21 ++ 4 files changed, 25 insertions(+), 675 deletions(-) create mode 100644 LICENSE.md diff --git a/.Rbuildignore b/.Rbuildignore index 5954eef4..0c6be8b9 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -19,3 +19,4 @@ ^\.vscode$ ^source_odeint\.R +^LICENSE\.md$ diff --git a/DESCRIPTION b/DESCRIPTION index 1586e294..499efd00 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -105,7 +105,7 @@ Authors@R: c( email = "r.scherrer@rug.nl", role = c("ctb"), comment = c(ORCID = "0000-0002-1447-7630"))) -License: GPL-3 +License: MIT + file LICENSE Description: Simulates and computes the (maximum) likelihood of a dynamical model of island biota assembly through speciation, immigration and extinction. See e.g. Valente et al. 2015. Ecology Letters 18: 844-852, diff --git a/LICENSE b/LICENSE index f288702d..428b3830 100644 --- a/LICENSE +++ b/LICENSE @@ -1,674 +1,2 @@ - 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 -. +YEAR: 2023 +COPYRIGHT HOLDER: DAISIE authors diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 00000000..24fdeb60 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +# MIT License + +Copyright (c) 2023 DAISIE authors + +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. From 262821d6cf4341301c10dc5a05929216aa05cf43 Mon Sep 17 00:00:00 2001 From: Neves-P Date: Mon, 20 Mar 2023 15:08:04 +0100 Subject: [PATCH 02/48] Include BSL-1.0 for patched Boost header --- inst/LICENSE_1_0.txt | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 inst/LICENSE_1_0.txt diff --git a/inst/LICENSE_1_0.txt b/inst/LICENSE_1_0.txt new file mode 100644 index 00000000..36b7cd93 --- /dev/null +++ b/inst/LICENSE_1_0.txt @@ -0,0 +1,23 @@ +Boost Software License - Version 1.0 - August 17th, 2003 + +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by +this license (the "Software") to use, reproduce, display, distribute, +execute, and transmit the Software, and to prepare derivative works of the +Software, and to permit third-parties to whom the Software is furnished to +do so, all subject to the following: + +The copyright notices in the Software and this entire statement, including +the above license grant, this restriction and the following disclaimer, +must be included in all copies of the Software, in whole or in part, and +all derivative works of the Software, unless such copies or derivative +works are solely in the form of machine-executable object code generated by +a source language processor. + +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, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. From 4d8cc486535f3bae386961d39cbf653d77bd125a Mon Sep 17 00:00:00 2001 From: Neves-P Date: Mon, 20 Mar 2023 15:08:30 +0100 Subject: [PATCH 03/48] \dontrun -> \donttest --- R/DAISIE_SR_ML_CS.R | 2 +- man/DAISIE_SR_ML.Rd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/DAISIE_SR_ML_CS.R b/R/DAISIE_SR_ML_CS.R index 76b0b3fd..82e62dcd 100644 --- a/R/DAISIE_SR_ML_CS.R +++ b/R/DAISIE_SR_ML_CS.R @@ -162,7 +162,7 @@ DAISIE_SR_loglik_all_choosepar <- function( #' @keywords models #' @examples #' -#' \dontrun{ +#' \donttest{ #' ### When all species have the same rates, and we want to optimize all 5 parameters, #' # we use: #' diff --git a/man/DAISIE_SR_ML.Rd b/man/DAISIE_SR_ML.Rd index 288c28c4..d1a3fc9a 100644 --- a/man/DAISIE_SR_ML.Rd +++ b/man/DAISIE_SR_ML.Rd @@ -166,7 +166,7 @@ used, otherwise the information in the data is overruled. } \examples{ -\dontrun{ +\donttest{ ### When all species have the same rates, and we want to optimize all 5 parameters, # we use: From 3053af29ee6806ac15ca6df981e3a18c319b2c43 Mon Sep 17 00:00:00 2001 From: Neves-P Date: Mon, 20 Mar 2023 15:08:45 +0100 Subject: [PATCH 04/48] Indent --- src/patched_bulrisch_stoer.h | 79 ++++++++++++++++++++++++------------ 1 file changed, 52 insertions(+), 27 deletions(-) diff --git a/src/patched_bulrisch_stoer.h b/src/patched_bulrisch_stoer.h index cad4f521..712a4da7 100644 --- a/src/patched_bulrisch_stoer.h +++ b/src/patched_bulrisch_stoer.h @@ -1,19 +1,19 @@ /* - Patched version of - boost/numeric/odeint/stepper/bulirsch_stoer.hpp + Patched version of + boost/numeric/odeint/stepper/bulirsch_stoer.hpp - Addresses unitialized member variable bulirsch_stoer<>::m_dt_last. + Addresses unitialized member variable bulirsch_stoer<>::m_dt_last. - Include this header before boost/numeric/odeint to shadow - boost/numeriuc/odeint/stepper/bulrisch_stoer.hpp + Include this header before boost/numeric/odeint to shadow + boost/numeriuc/odeint/stepper/bulrisch_stoer.hpp - The issue is *not* fixed in BOOST_VERSION == 1.81.0. - We need to check for fixes in upcomming boost (BH) releases. + The issue is *not* fixed in BOOST_VERSION == 1.81.0. + We need to check for fixes in upcomming boost (BH) releases. - Hanno Hildenbrandt 2023 -*/ + Hanno Hildenbrandt 2023 + */ -/* + /* [auto_generated] boost/numeric/odeint/stepper/bulirsch_stoer.hpp @@ -31,6 +31,31 @@ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + + Boost Software License - Version 1.0 - August 17th, 2003 + + Permission is hereby granted, free of charge, to any person or organization + obtaining a copy of the software and accompanying documentation covered by + this license (the "Software") to use, reproduce, display, distribute, + execute, and transmit the Software, and to prepare derivative works of the + Software, and to permit third-parties to whom the Software is furnished to + do so, all subject to the following: + + The copyright notices in the Software and this entire statement, including + the above license grant, this restriction and the following disclaimer, + must be included in all copies of the Software, in whole or in part, and + all derivative works of the Software, unless such copies or derivative + works are solely in the form of machine-executable object code generated by + a source language processor. + + 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, TITLE AND NON-INFRINGEMENT. IN NO EVENT + SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE + FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. */ #ifdef USE_BULRISCH_STOER_PATCH @@ -414,7 +439,7 @@ class bulirsch_stoer { template< class StateInOut > void extrapolate( size_t k , state_table_type &table , const value_matrix &coeff , StateInOut &xest ) /* polynomial extrapolation, see http://www.nr.com/webnotes/nr3web21.pdf - uses the obtained intermediate results to extrapolate to dt->0 + uses the obtained intermediate results to extrapolate to dt->0 */ { static const value_type val1 = static_cast< value_type >( 1.0 ); @@ -535,7 +560,7 @@ class bulirsch_stoer { /** * \class bulirsch_stoer * \brief The Bulirsch-Stoer algorithm. - * + * * The Bulirsch-Stoer is a controlled stepper that adjusts both step size * and order of the method. The algorithm uses the modified midpoint and * a polynomial extrapolation compute the solution. @@ -551,7 +576,7 @@ class bulirsch_stoer { /** * \fn bulirsch_stoer::bulirsch_stoer( value_type eps_abs , value_type eps_rel , value_type factor_x , value_type factor_dxdt ) - * \brief Constructs the bulirsch_stoer class, including initialization of + * \brief Constructs the bulirsch_stoer class, including initialization of * the error bounds. * * \param eps_abs Absolute tolerance level. @@ -565,15 +590,15 @@ class bulirsch_stoer { * \brief Tries to perform one step. * * This method tries to do one step with step size dt. If the error estimate - * is to large, the step is rejected and the method returns fail and the + * is to large, the step is rejected and the method returns fail and the * step size dt is reduced. If the error estimate is acceptably small, the - * step is performed, success is returned and dt might be increased to make + * step is performed, success is returned and dt might be increased to make * the steps as large as possible. This method also updates t if a step is * performed. Also, the internal order of the stepper is adjusted if required. * - * \param system The system function to solve, hence the r.h.s. of the ODE. + * \param system The system function to solve, hence the r.h.s. of the ODE. * It must fulfill the Simple System concept. - * \param x The state of the ODE which should be solved. Overwritten if + * \param x The state of the ODE which should be solved. Overwritten if * the step is successful. * \param t The value of the time. Updated if the step is successful. * \param dt The step size. Updated. @@ -585,15 +610,15 @@ class bulirsch_stoer { * \brief Tries to perform one step. * * This method tries to do one step with step size dt. If the error estimate - * is to large, the step is rejected and the method returns fail and the + * is to large, the step is rejected and the method returns fail and the * step size dt is reduced. If the error estimate is acceptably small, the - * step is performed, success is returned and dt might be increased to make + * step is performed, success is returned and dt might be increased to make * the steps as large as possible. This method also updates t if a step is * performed. Also, the internal order of the stepper is adjusted if required. * - * \param system The system function to solve, hence the r.h.s. of the ODE. + * \param system The system function to solve, hence the r.h.s. of the ODE. * It must fulfill the Simple System concept. - * \param x The state of the ODE which should be solved. Overwritten if + * \param x The state of the ODE which should be solved. Overwritten if * the step is successful. * \param dxdt The derivative of state. * \param t The value of the time. Updated if the step is successful. @@ -608,13 +633,13 @@ class bulirsch_stoer { * \note This method is disabled if state_type=time_type to avoid ambiguity. * * This method tries to do one step with step size dt. If the error estimate - * is to large, the step is rejected and the method returns fail and the + * is to large, the step is rejected and the method returns fail and the * step size dt is reduced. If the error estimate is acceptably small, the - * step is performed, success is returned and dt might be increased to make + * step is performed, success is returned and dt might be increased to make * the steps as large as possible. This method also updates t if a step is * performed. Also, the internal order of the stepper is adjusted if required. * - * \param system The system function to solve, hence the r.h.s. of the ODE. + * \param system The system function to solve, hence the r.h.s. of the ODE. * It must fulfill the Simple System concept. * \param in The state of the ODE which should be solved. * \param t The value of the time. Updated if the step is successful. @@ -629,13 +654,13 @@ class bulirsch_stoer { * \brief Tries to perform one step. * * This method tries to do one step with step size dt. If the error estimate - * is to large, the step is rejected and the method returns fail and the + * is to large, the step is rejected and the method returns fail and the * step size dt is reduced. If the error estimate is acceptably small, the - * step is performed, success is returned and dt might be increased to make + * step is performed, success is returned and dt might be increased to make * the steps as large as possible. This method also updates t if a step is * performed. Also, the internal order of the stepper is adjusted if required. * - * \param system The system function to solve, hence the r.h.s. of the ODE. + * \param system The system function to solve, hence the r.h.s. of the ODE. * It must fulfill the Simple System concept. * \param in The state of the ODE which should be solved. * \param dxdt The derivative of state. From 047d0c4097d13f30a80f6c3541fc863c58e29ef1 Mon Sep 17 00:00:00 2001 From: Neves-P Date: Mon, 20 Mar 2023 15:41:43 +0100 Subject: [PATCH 05/48] Remove export daisie_odeint_iw --- src/DAISIE_IW.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/DAISIE_IW.cpp b/src/DAISIE_IW.cpp index ae84a11a..3bf7d288 100644 --- a/src/DAISIE_IW.cpp +++ b/src/DAISIE_IW.cpp @@ -1,5 +1,3 @@ -//' @export daisie_odeint_iw - // [[Rcpp::plugins(cpp14)]] // [[Rcpp::plugins(openmp)]] // [[Rcpp::depends(BH)]] From c47ebdec00a17d75ef455ccf987484a4d5aa56a5 Mon Sep 17 00:00:00 2001 From: Neves-P Date: Mon, 20 Mar 2023 16:40:44 +0100 Subject: [PATCH 06/48] Format citation in DESCRIPTION --- DESCRIPTION | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 499efd00..9ad5cccf 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -108,8 +108,7 @@ Authors@R: c( License: MIT + file LICENSE Description: Simulates and computes the (maximum) likelihood of a dynamical model of island biota assembly through speciation, immigration and - extinction. See e.g. Valente et al. 2015. Ecology Letters 18: 844-852, - . + extinction. See Valente et al. (2015 ) . NeedsCompilation: yes SystemRequirements: C++17 Encoding: UTF-8 From f17418f5df37221c93c10b1f838dcc3b013c5b40 Mon Sep 17 00:00:00 2001 From: Neves-P Date: Mon, 20 Mar 2023 16:40:52 +0100 Subject: [PATCH 07/48] Unexport are_area_pars() --- NAMESPACE | 1 - 1 file changed, 1 deletion(-) diff --git a/NAMESPACE b/NAMESPACE index 9f793cfe..153d81a3 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -34,7 +34,6 @@ export(DAISIE_sim_relaxed_rate) export(DAISIE_sim_time_dep) export(DAISIE_sim_trait_dep) export(DAISIE_sim_trait_dep_2K) -export(are_area_pars) export(create_CS_version) export(create_area_pars) export(create_hyper_pars) From f72a966520045258d58a0e0cc6d23d842cedfc07 Mon Sep 17 00:00:00 2001 From: Neves-P Date: Mon, 20 Mar 2023 16:41:22 +0100 Subject: [PATCH 08/48] noRd or examples for internals Needed to avoid ::: in examples --- R/DAISIE_SR_sim.R | 2 +- R/DAISIE_check_format.R | 75 +++-------------------------- R/default_params_doc.R | 6 +-- man/DAISIE_ML.Rd | 3 +- man/DAISIE_ML1.Rd | 3 +- man/DAISIE_ML2.Rd | 3 +- man/DAISIE_ML4.Rd | 3 +- man/DAISIE_SR_sim.Rd | 2 +- man/DAISIE_calc_sumstats_pcrates.Rd | 6 +-- man/DAISIE_plot_area.Rd | 6 +-- man/DAISIE_plot_cladogenesis.Rd | 6 +-- man/DAISIE_plot_extinction.Rd | 6 +-- man/DAISIE_plot_immigration.Rd | 6 +-- man/DAISIE_plot_pc_rates.Rd | 6 +-- man/DAISIE_sim_core_time_dep.Rd | 6 +-- man/DAISIE_sim_core_trait_dep.Rd | 6 +-- man/DAISIE_sim_time_dep.Rd | 6 +-- man/DAISIE_sim_time_dep_cs.Rd | 6 +-- man/DAISIE_sim_time_dep_gw.Rd | 6 +-- man/DAISIE_sim_time_dep_iw.Rd | 6 +-- man/DAISIE_sim_trait_dep.Rd | 6 +-- man/DAISIE_sim_trait_dep_2K.Rd | 6 +-- man/are_area_pars.Rd | 44 ----------------- man/are_hyper_pars.Rd | 32 ------------ man/are_max_rates.Rd | 20 -------- man/are_max_rates_gt_rates.Rd | 49 ------------------- man/are_trait_pars.Rd | 41 ---------------- man/default_params_doc.Rd | 6 +-- man/get_global_max_area.Rd | 6 +-- man/get_global_min_area.Rd | 6 +-- man/is_island_ontogeny_input.Rd | 30 ------------ man/is_sea_level_input.Rd | 27 ----------- man/is_simulation_outputs.Rd | 37 -------------- man/island_area.Rd | 6 +-- man/translate_island_ontogeny.Rd | 3 +- man/translate_sea_level.Rd | 3 +- man/update_rates.Rd | 6 +-- 37 files changed, 56 insertions(+), 441 deletions(-) delete mode 100644 man/are_area_pars.Rd delete mode 100644 man/are_hyper_pars.Rd delete mode 100644 man/are_max_rates.Rd delete mode 100644 man/are_max_rates_gt_rates.Rd delete mode 100644 man/are_trait_pars.Rd delete mode 100644 man/is_island_ontogeny_input.Rd delete mode 100644 man/is_sea_level_input.Rd delete mode 100644 man/is_simulation_outputs.Rd diff --git a/R/DAISIE_SR_sim.R b/R/DAISIE_SR_sim.R index 7b824f54..f88ba33f 100644 --- a/R/DAISIE_SR_sim.R +++ b/R/DAISIE_SR_sim.R @@ -83,7 +83,7 @@ #' pars_before_shift = c(0.079, 0.973, Inf, 0.136, 0.413) #' pars_after_shift = c(0.079, 0.973, Inf, 0.652, 0.413) #' tshift = 0.195 -#' island_shift_replicates = DAISIE:::DAISIE_SR_sim( +#' island_shift_replicates = DAISIE_SR_sim( #' time = 4, #' M = 296, #' pars = c(pars_before_shift, pars_after_shift, tshift), diff --git a/R/DAISIE_check_format.R b/R/DAISIE_check_format.R index 094fd812..da07a498 100644 --- a/R/DAISIE_check_format.R +++ b/R/DAISIE_check_format.R @@ -37,9 +37,9 @@ are_rates <- function(rates) { #' #' @inheritParams default_params_doc #' -#' @keywords internal #' @return \code{TRUE} if object max_rates is a list of rates, #' \code{FALSE} otherwise. +#' @noRd are_max_rates <- function(max_rates) { if (!all(sapply(max_rates, is.numeric))) return(FALSE) if (!"ana_max_rate" %in% names(max_rates)) return(FALSE) @@ -62,27 +62,7 @@ are_max_rates <- function(max_rates) { #' @author Joshua Lambert, Pedro Neves #' @seealso \code{\link{are_rates}}, \code{\link{are_max_rates}} #' -#' @keywords internal -#' -#' @examples -#' rates <- list( -#' ext_rate = 0.1, -#' immig_rate = 0.1, -#' ana_rate = 0.1, -#' clado_rate = 0.1 -#' ) -#' max_rates <- list( -#' ext_max_rate = 1, -#' immig_max_rate = 1, -#' ana_max_rate = 1, -#' clado_max_rate = 1 -#' ) -#' testthat::expect_true( -#' DAISIE:::are_max_rates_gt_rates( -#' rates = rates, -#' max_rates = max_rates -#' ) -#' ) +#' @noRd are_max_rates_gt_rates <- function(rates, max_rates) { if (!all(sapply(rates, is.numeric))) return(FALSE) if (!all(sapply(max_rates, is.numeric))) return(FALSE) @@ -99,7 +79,7 @@ are_max_rates_gt_rates <- function(rates, max_rates) { #' #' @seealso is_island_ontogeny_runtime #' @return Boolean stating if island_ontogeny is correct. -#' @keywords internal +#' @noRd is_island_ontogeny_input <- function(island_ontogeny) { if (class(island_ontogeny) != class(character())) return(FALSE) if (island_ontogeny != "const" && island_ontogeny != "beta") return(FALSE) @@ -112,7 +92,7 @@ is_island_ontogeny_input <- function(island_ontogeny) { #' #' @seealso is_sea_level_runtime #' @return Boolean stating if sea_level is correct. -#' @keywords internal +#' @noRd is_sea_level_input <- function(sea_level) { if (class(sea_level) != class(character())) return(FALSE) if (sea_level != "const" && sea_level != "sine") return(FALSE) @@ -128,18 +108,7 @@ is_sea_level_input <- function(sea_level) { #' @return TRUE if the input is a valid collection of simulation #' outputs. #' @author Richel J.C Bilderbeek, Pedro Neves -#' @examples -#' testthat::expect_false(DAISIE:::is_simulation_outputs("nonsense")) -#' -#' simulation_outputs <- DAISIE_sim_cr( -#' time = 2, -#' M = 1000, -#' pars = c(2, 1, 20, 0.0001, 1), -#' replicates = 1, -#' plot_sims = FALSE -#' ) -#' testthat::expect_true(DAISIE:::is_simulation_outputs(simulation_outputs)) -#' @keywords internal +#' @noRd is_simulation_outputs <- function(simulation_outputs) { for (n_replicate in seq_along(simulation_outputs)) { if (!"island_age" %in% names(simulation_outputs[[n_replicate]][[1]])) @@ -164,22 +133,10 @@ is_simulation_outputs <- function(simulation_outputs) { #' #' @inheritParams default_params_doc #' -#' @export #' @return Boolean that indicates if list conforms to expected area parameters #' as created by \link{create_area_pars} #' @author Richel J.C Bilderbeek, Joshua Lambert, Pedro Neves -#' @keywords internal -#' -#' @examples -#' testit::assert(DAISIE:::are_area_pars( -#' create_area_pars( -#' max_area = 10, -#' current_area = 4, -#' proportional_peak_t = 0.5, -#' total_island_age = 5, -#' sea_level_amplitude = 5, -#' sea_level_frequency = 10, -#' island_gradient_angle = 0))) +#' @noRd are_area_pars <- function(area_pars) { if (is.null(area_pars) == TRUE) return(TRUE) if (class(area_pars) != class(list())) return(FALSE) @@ -208,12 +165,7 @@ are_area_pars <- function(area_pars) { #' @return \code{TRUE} if list contains hyperparameters, \code{FALSE} otherwise. #' @author Pedro Neves, Joshua Lambert #' -#' @keywords internal -#' -#' @examples -#' testit::assert( -#' DAISIE:::are_hyper_pars(create_hyper_pars(d = 0.027, x = 0.15)) -#' ) +#' @noRd are_hyper_pars <- function(hyper_pars) { if (!is.list(hyper_pars)) return(FALSE) if (!is.numeric(unlist(hyper_pars))) return(FALSE) @@ -231,18 +183,7 @@ are_hyper_pars <- function(hyper_pars) { #' @return Boolean that indicates if list conforms to expected area parameters #' as created by \link{create_trait_pars} #' -#' @keywords internal -#' -#' @examples -#' testit::assert(DAISIE:::are_trait_pars( -#' create_trait_pars( -#' trans_rate = 0.5, -#' immig_rate2 = 0.1, -#' ext_rate2 = 0.2, -#' ana_rate2 = 0.3, -#' clado_rate2 = 0.4, -#' trans_rate2 = 0.5, -#' M2 = 1000)) == TRUE) +#' @noRd are_trait_pars <- function(trait_pars) { if (is.null(trait_pars) == TRUE) return(TRUE) if (class(trait_pars) != class(list())) return(FALSE) diff --git a/R/default_params_doc.R b/R/default_params_doc.R index e205477a..602a0575 100644 --- a/R/default_params_doc.R +++ b/R/default_params_doc.R @@ -101,8 +101,7 @@ #' @param island_ontogeny In \code{\link{DAISIE_sim_time_dep}()}, #' \code{\link{DAISIE_ML_CS}} and plotting a string describing the type of #' island ontogeny. Can be \code{"const"}, \code{"beta"} for a beta function -#' describing area through time. String checked by -#' \code{\link{is_island_ontogeny_input}()}. \cr In all other functions a +#' describing area through time. \cr In all other functions a #' numeric describing the type of island ontogeny. Can be \code{0} for #' constant, \code{1} for a beta function describing area through time. In ML #' functions \code{island_ontogeny = NA} assumes constant ontogeny. Time @@ -110,8 +109,7 @@ #' Will return an error if called in that case. #' @param sea_level In \code{\link{DAISIE_sim_time_dep}()} and plotting a #' string describing the type of sea level. Can be \code{"const"} or -#' \code{"sine"} for a sine function describing area through time. String -#' checked by \code{\link{is_sea_level_input}()}. +#' \code{"sine"} for a sine function describing area through time. #' \cr In all other functions a numeric describing the type of sea level. Can #' be \code{0} for constant, \code{1} for a sine function describing area #' through time. diff --git a/man/DAISIE_ML.Rd b/man/DAISIE_ML.Rd index 057774ac..7af3e734 100644 --- a/man/DAISIE_ML.Rd +++ b/man/DAISIE_ML.Rd @@ -122,8 +122,7 @@ on the island. This last option is not yet available for the IW model \cr} \item{island_ontogeny}{In \code{\link{DAISIE_sim_time_dep}()}, \code{\link{DAISIE_ML_CS}} and plotting a string describing the type of island ontogeny. Can be \code{"const"}, \code{"beta"} for a beta function -describing area through time. String checked by -\code{\link{is_island_ontogeny_input}()}. \cr In all other functions a +describing area through time. \cr In all other functions a numeric describing the type of island ontogeny. Can be \code{0} for constant, \code{1} for a beta function describing area through time. In ML functions \code{island_ontogeny = NA} assumes constant ontogeny. Time diff --git a/man/DAISIE_ML1.Rd b/man/DAISIE_ML1.Rd index a908afc6..abe0d776 100644 --- a/man/DAISIE_ML1.Rd +++ b/man/DAISIE_ML1.Rd @@ -167,8 +167,7 @@ tolerance of the integration.} \item{island_ontogeny}{In \code{\link{DAISIE_sim_time_dep}()}, \code{\link{DAISIE_ML_CS}} and plotting a string describing the type of island ontogeny. Can be \code{"const"}, \code{"beta"} for a beta function -describing area through time. String checked by -\code{\link{is_island_ontogeny_input}()}. \cr In all other functions a +describing area through time. \cr In all other functions a numeric describing the type of island ontogeny. Can be \code{0} for constant, \code{1} for a beta function describing area through time. In ML functions \code{island_ontogeny = NA} assumes constant ontogeny. Time diff --git a/man/DAISIE_ML2.Rd b/man/DAISIE_ML2.Rd index d7c726c7..cf10630b 100644 --- a/man/DAISIE_ML2.Rd +++ b/man/DAISIE_ML2.Rd @@ -105,8 +105,7 @@ on the island. This last option is not yet available for the IW model \cr} \item{island_ontogeny}{In \code{\link{DAISIE_sim_time_dep}()}, \code{\link{DAISIE_ML_CS}} and plotting a string describing the type of island ontogeny. Can be \code{"const"}, \code{"beta"} for a beta function -describing area through time. String checked by -\code{\link{is_island_ontogeny_input}()}. \cr In all other functions a +describing area through time. \cr In all other functions a numeric describing the type of island ontogeny. Can be \code{0} for constant, \code{1} for a beta function describing area through time. In ML functions \code{island_ontogeny = NA} assumes constant ontogeny. Time diff --git a/man/DAISIE_ML4.Rd b/man/DAISIE_ML4.Rd index b30ae271..0476994e 100644 --- a/man/DAISIE_ML4.Rd +++ b/man/DAISIE_ML4.Rd @@ -142,8 +142,7 @@ tolerance of the integration.} \item{island_ontogeny}{In \code{\link{DAISIE_sim_time_dep}()}, \code{\link{DAISIE_ML_CS}} and plotting a string describing the type of island ontogeny. Can be \code{"const"}, \code{"beta"} for a beta function -describing area through time. String checked by -\code{\link{is_island_ontogeny_input}()}. \cr In all other functions a +describing area through time. \cr In all other functions a numeric describing the type of island ontogeny. Can be \code{0} for constant, \code{1} for a beta function describing area through time. In ML functions \code{island_ontogeny = NA} assumes constant ontogeny. Time diff --git a/man/DAISIE_SR_sim.Rd b/man/DAISIE_SR_sim.Rd index e275045f..2ec366be 100644 --- a/man/DAISIE_SR_sim.Rd +++ b/man/DAISIE_SR_sim.Rd @@ -108,7 +108,7 @@ function instead. pars_before_shift = c(0.079, 0.973, Inf, 0.136, 0.413) pars_after_shift = c(0.079, 0.973, Inf, 0.652, 0.413) tshift = 0.195 -island_shift_replicates = DAISIE:::DAISIE_SR_sim( +island_shift_replicates = DAISIE_SR_sim( time = 4, M = 296, pars = c(pars_before_shift, pars_after_shift, tshift), diff --git a/man/DAISIE_calc_sumstats_pcrates.Rd b/man/DAISIE_calc_sumstats_pcrates.Rd index 4f8d70d5..28001417 100644 --- a/man/DAISIE_calc_sumstats_pcrates.Rd +++ b/man/DAISIE_calc_sumstats_pcrates.Rd @@ -69,8 +69,7 @@ calculations as returned by \code{\link{create_hyper_pars}()}: \item{island_ontogeny}{In \code{\link{DAISIE_sim_time_dep}()}, \code{\link{DAISIE_ML_CS}} and plotting a string describing the type of island ontogeny. Can be \code{"const"}, \code{"beta"} for a beta function -describing area through time. String checked by -\code{\link{is_island_ontogeny_input}()}. \cr In all other functions a +describing area through time. \cr In all other functions a numeric describing the type of island ontogeny. Can be \code{0} for constant, \code{1} for a beta function describing area through time. In ML functions \code{island_ontogeny = NA} assumes constant ontogeny. Time @@ -79,8 +78,7 @@ Will return an error if called in that case.} \item{sea_level}{In \code{\link{DAISIE_sim_time_dep}()} and plotting a string describing the type of sea level. Can be \code{"const"} or -\code{"sine"} for a sine function describing area through time. String -checked by \code{\link{is_sea_level_input}()}. +\code{"sine"} for a sine function describing area through time. \cr In all other functions a numeric describing the type of sea level. Can be \code{0} for constant, \code{1} for a sine function describing area through time.} diff --git a/man/DAISIE_plot_area.Rd b/man/DAISIE_plot_area.Rd index f0330d36..94b48ce8 100644 --- a/man/DAISIE_plot_area.Rd +++ b/man/DAISIE_plot_area.Rd @@ -38,8 +38,7 @@ present and the \code{area_pars}.} \item{island_ontogeny}{In \code{\link{DAISIE_sim_time_dep}()}, \code{\link{DAISIE_ML_CS}} and plotting a string describing the type of island ontogeny. Can be \code{"const"}, \code{"beta"} for a beta function -describing area through time. String checked by -\code{\link{is_island_ontogeny_input}()}. \cr In all other functions a +describing area through time. \cr In all other functions a numeric describing the type of island ontogeny. Can be \code{0} for constant, \code{1} for a beta function describing area through time. In ML functions \code{island_ontogeny = NA} assumes constant ontogeny. Time @@ -50,8 +49,7 @@ Will return an error if called in that case.} \item{sea_level}{In \code{\link{DAISIE_sim_time_dep}()} and plotting a string describing the type of sea level. Can be \code{"const"} or -\code{"sine"} for a sine function describing area through time. String -checked by \code{\link{is_sea_level_input}()}. +\code{"sine"} for a sine function describing area through time. \cr In all other functions a numeric describing the type of sea level. Can be \code{0} for constant, \code{1} for a sine function describing area through time.} diff --git a/man/DAISIE_plot_cladogenesis.Rd b/man/DAISIE_plot_cladogenesis.Rd index 79f95847..3a8481f2 100644 --- a/man/DAISIE_plot_cladogenesis.Rd +++ b/man/DAISIE_plot_cladogenesis.Rd @@ -46,8 +46,7 @@ present and the \code{area_pars}.} \item{island_ontogeny}{In \code{\link{DAISIE_sim_time_dep}()}, \code{\link{DAISIE_ML_CS}} and plotting a string describing the type of island ontogeny. Can be \code{"const"}, \code{"beta"} for a beta function -describing area through time. String checked by -\code{\link{is_island_ontogeny_input}()}. \cr In all other functions a +describing area through time. \cr In all other functions a numeric describing the type of island ontogeny. Can be \code{0} for constant, \code{1} for a beta function describing area through time. In ML functions \code{island_ontogeny = NA} assumes constant ontogeny. Time @@ -56,8 +55,7 @@ Will return an error if called in that case.} \item{sea_level}{In \code{\link{DAISIE_sim_time_dep}()} and plotting a string describing the type of sea level. Can be \code{"const"} or -\code{"sine"} for a sine function describing area through time. String -checked by \code{\link{is_sea_level_input}()}. +\code{"sine"} for a sine function describing area through time. \cr In all other functions a numeric describing the type of sea level. Can be \code{0} for constant, \code{1} for a sine function describing area through time.} diff --git a/man/DAISIE_plot_extinction.Rd b/man/DAISIE_plot_extinction.Rd index 9562e0dd..837f1d30 100644 --- a/man/DAISIE_plot_extinction.Rd +++ b/man/DAISIE_plot_extinction.Rd @@ -52,8 +52,7 @@ calculations as returned by \code{\link{create_hyper_pars}()}: \item{island_ontogeny}{In \code{\link{DAISIE_sim_time_dep}()}, \code{\link{DAISIE_ML_CS}} and plotting a string describing the type of island ontogeny. Can be \code{"const"}, \code{"beta"} for a beta function -describing area through time. String checked by -\code{\link{is_island_ontogeny_input}()}. \cr In all other functions a +describing area through time. \cr In all other functions a numeric describing the type of island ontogeny. Can be \code{0} for constant, \code{1} for a beta function describing area through time. In ML functions \code{island_ontogeny = NA} assumes constant ontogeny. Time @@ -62,8 +61,7 @@ Will return an error if called in that case.} \item{sea_level}{In \code{\link{DAISIE_sim_time_dep}()} and plotting a string describing the type of sea level. Can be \code{"const"} or -\code{"sine"} for a sine function describing area through time. String -checked by \code{\link{is_sea_level_input}()}. +\code{"sine"} for a sine function describing area through time. \cr In all other functions a numeric describing the type of sea level. Can be \code{0} for constant, \code{1} for a sine function describing area through time.} diff --git a/man/DAISIE_plot_immigration.Rd b/man/DAISIE_plot_immigration.Rd index f74e4a57..dc1a5b79 100644 --- a/man/DAISIE_plot_immigration.Rd +++ b/man/DAISIE_plot_immigration.Rd @@ -61,8 +61,7 @@ calculations as returned by \code{\link{create_hyper_pars}()}: \item{island_ontogeny}{In \code{\link{DAISIE_sim_time_dep}()}, \code{\link{DAISIE_ML_CS}} and plotting a string describing the type of island ontogeny. Can be \code{"const"}, \code{"beta"} for a beta function -describing area through time. String checked by -\code{\link{is_island_ontogeny_input}()}. \cr In all other functions a +describing area through time. \cr In all other functions a numeric describing the type of island ontogeny. Can be \code{0} for constant, \code{1} for a beta function describing area through time. In ML functions \code{island_ontogeny = NA} assumes constant ontogeny. Time @@ -71,8 +70,7 @@ Will return an error if called in that case.} \item{sea_level}{In \code{\link{DAISIE_sim_time_dep}()} and plotting a string describing the type of sea level. Can be \code{"const"} or -\code{"sine"} for a sine function describing area through time. String -checked by \code{\link{is_sea_level_input}()}. +\code{"sine"} for a sine function describing area through time. \cr In all other functions a numeric describing the type of sea level. Can be \code{0} for constant, \code{1} for a sine function describing area through time.} diff --git a/man/DAISIE_plot_pc_rates.Rd b/man/DAISIE_plot_pc_rates.Rd index d7758da5..d793f82c 100644 --- a/man/DAISIE_plot_pc_rates.Rd +++ b/man/DAISIE_plot_pc_rates.Rd @@ -49,8 +49,7 @@ argument is the mean of the gamma distribution for the relaxed parameter.} \item{island_ontogeny}{In \code{\link{DAISIE_sim_time_dep}()}, \code{\link{DAISIE_ML_CS}} and plotting a string describing the type of island ontogeny. Can be \code{"const"}, \code{"beta"} for a beta function -describing area through time. String checked by -\code{\link{is_island_ontogeny_input}()}. \cr In all other functions a +describing area through time. \cr In all other functions a numeric describing the type of island ontogeny. Can be \code{0} for constant, \code{1} for a beta function describing area through time. In ML functions \code{island_ontogeny = NA} assumes constant ontogeny. Time @@ -59,8 +58,7 @@ Will return an error if called in that case.} \item{sea_level}{In \code{\link{DAISIE_sim_time_dep}()} and plotting a string describing the type of sea level. Can be \code{"const"} or -\code{"sine"} for a sine function describing area through time. String -checked by \code{\link{is_sea_level_input}()}. +\code{"sine"} for a sine function describing area through time. \cr In all other functions a numeric describing the type of sea level. Can be \code{0} for constant, \code{1} for a sine function describing area through time.} diff --git a/man/DAISIE_sim_core_time_dep.Rd b/man/DAISIE_sim_core_time_dep.Rd index f2ba6171..40f1f75a 100644 --- a/man/DAISIE_sim_core_time_dep.Rd +++ b/man/DAISIE_sim_core_time_dep.Rd @@ -66,8 +66,7 @@ argument is the mean of the gamma distribution for the relaxed parameter.} \item{island_ontogeny}{In \code{\link{DAISIE_sim_time_dep}()}, \code{\link{DAISIE_ML_CS}} and plotting a string describing the type of island ontogeny. Can be \code{"const"}, \code{"beta"} for a beta function -describing area through time. String checked by -\code{\link{is_island_ontogeny_input}()}. \cr In all other functions a +describing area through time. \cr In all other functions a numeric describing the type of island ontogeny. Can be \code{0} for constant, \code{1} for a beta function describing area through time. In ML functions \code{island_ontogeny = NA} assumes constant ontogeny. Time @@ -76,8 +75,7 @@ Will return an error if called in that case.} \item{sea_level}{In \code{\link{DAISIE_sim_time_dep}()} and plotting a string describing the type of sea level. Can be \code{"const"} or -\code{"sine"} for a sine function describing area through time. String -checked by \code{\link{is_sea_level_input}()}. +\code{"sine"} for a sine function describing area through time. \cr In all other functions a numeric describing the type of sea level. Can be \code{0} for constant, \code{1} for a sine function describing area through time.} diff --git a/man/DAISIE_sim_core_trait_dep.Rd b/man/DAISIE_sim_core_trait_dep.Rd index 36faea6f..5c665b20 100644 --- a/man/DAISIE_sim_core_trait_dep.Rd +++ b/man/DAISIE_sim_core_trait_dep.Rd @@ -56,8 +56,7 @@ argument is the mean of the gamma distribution for the relaxed parameter.} \item{island_ontogeny}{In \code{\link{DAISIE_sim_time_dep}()}, \code{\link{DAISIE_ML_CS}} and plotting a string describing the type of island ontogeny. Can be \code{"const"}, \code{"beta"} for a beta function -describing area through time. String checked by -\code{\link{is_island_ontogeny_input}()}. \cr In all other functions a +describing area through time. \cr In all other functions a numeric describing the type of island ontogeny. Can be \code{0} for constant, \code{1} for a beta function describing area through time. In ML functions \code{island_ontogeny = NA} assumes constant ontogeny. Time @@ -66,8 +65,7 @@ Will return an error if called in that case.} \item{sea_level}{In \code{\link{DAISIE_sim_time_dep}()} and plotting a string describing the type of sea level. Can be \code{"const"} or -\code{"sine"} for a sine function describing area through time. String -checked by \code{\link{is_sea_level_input}()}. +\code{"sine"} for a sine function describing area through time. \cr In all other functions a numeric describing the type of sea level. Can be \code{0} for constant, \code{1} for a sine function describing area through time.} diff --git a/man/DAISIE_sim_time_dep.Rd b/man/DAISIE_sim_time_dep.Rd index 00f29ee9..43829a65 100644 --- a/man/DAISIE_sim_time_dep.Rd +++ b/man/DAISIE_sim_time_dep.Rd @@ -115,8 +115,7 @@ type 2.} \item{island_ontogeny}{In \code{\link{DAISIE_sim_time_dep}()}, \code{\link{DAISIE_ML_CS}} and plotting a string describing the type of island ontogeny. Can be \code{"const"}, \code{"beta"} for a beta function -describing area through time. String checked by -\code{\link{is_island_ontogeny_input}()}. \cr In all other functions a +describing area through time. \cr In all other functions a numeric describing the type of island ontogeny. Can be \code{0} for constant, \code{1} for a beta function describing area through time. In ML functions \code{island_ontogeny = NA} assumes constant ontogeny. Time @@ -125,8 +124,7 @@ Will return an error if called in that case.} \item{sea_level}{In \code{\link{DAISIE_sim_time_dep}()} and plotting a string describing the type of sea level. Can be \code{"const"} or -\code{"sine"} for a sine function describing area through time. String -checked by \code{\link{is_sea_level_input}()}. +\code{"sine"} for a sine function describing area through time. \cr In all other functions a numeric describing the type of sea level. Can be \code{0} for constant, \code{1} for a sine function describing area through time.} diff --git a/man/DAISIE_sim_time_dep_cs.Rd b/man/DAISIE_sim_time_dep_cs.Rd index 66b8180c..49781453 100644 --- a/man/DAISIE_sim_time_dep_cs.Rd +++ b/man/DAISIE_sim_time_dep_cs.Rd @@ -94,8 +94,7 @@ higher resolution, but will also run slower.} \item{island_ontogeny}{In \code{\link{DAISIE_sim_time_dep}()}, \code{\link{DAISIE_ML_CS}} and plotting a string describing the type of island ontogeny. Can be \code{"const"}, \code{"beta"} for a beta function -describing area through time. String checked by -\code{\link{is_island_ontogeny_input}()}. \cr In all other functions a +describing area through time. \cr In all other functions a numeric describing the type of island ontogeny. Can be \code{0} for constant, \code{1} for a beta function describing area through time. In ML functions \code{island_ontogeny = NA} assumes constant ontogeny. Time @@ -104,8 +103,7 @@ Will return an error if called in that case.} \item{sea_level}{In \code{\link{DAISIE_sim_time_dep}()} and plotting a string describing the type of sea level. Can be \code{"const"} or -\code{"sine"} for a sine function describing area through time. String -checked by \code{\link{is_sea_level_input}()}. +\code{"sine"} for a sine function describing area through time. \cr In all other functions a numeric describing the type of sea level. Can be \code{0} for constant, \code{1} for a sine function describing area through time.} diff --git a/man/DAISIE_sim_time_dep_gw.Rd b/man/DAISIE_sim_time_dep_gw.Rd index 9afbf070..9ed84d0f 100644 --- a/man/DAISIE_sim_time_dep_gw.Rd +++ b/man/DAISIE_sim_time_dep_gw.Rd @@ -98,8 +98,7 @@ higher resolution, but will also run slower.} \item{island_ontogeny}{In \code{\link{DAISIE_sim_time_dep}()}, \code{\link{DAISIE_ML_CS}} and plotting a string describing the type of island ontogeny. Can be \code{"const"}, \code{"beta"} for a beta function -describing area through time. String checked by -\code{\link{is_island_ontogeny_input}()}. \cr In all other functions a +describing area through time. \cr In all other functions a numeric describing the type of island ontogeny. Can be \code{0} for constant, \code{1} for a beta function describing area through time. In ML functions \code{island_ontogeny = NA} assumes constant ontogeny. Time @@ -108,8 +107,7 @@ Will return an error if called in that case.} \item{sea_level}{In \code{\link{DAISIE_sim_time_dep}()} and plotting a string describing the type of sea level. Can be \code{"const"} or -\code{"sine"} for a sine function describing area through time. String -checked by \code{\link{is_sea_level_input}()}. +\code{"sine"} for a sine function describing area through time. \cr In all other functions a numeric describing the type of sea level. Can be \code{0} for constant, \code{1} for a sine function describing area through time.} diff --git a/man/DAISIE_sim_time_dep_iw.Rd b/man/DAISIE_sim_time_dep_iw.Rd index 602576e8..d6010e4c 100644 --- a/man/DAISIE_sim_time_dep_iw.Rd +++ b/man/DAISIE_sim_time_dep_iw.Rd @@ -94,8 +94,7 @@ higher resolution, but will also run slower.} \item{island_ontogeny}{In \code{\link{DAISIE_sim_time_dep}()}, \code{\link{DAISIE_ML_CS}} and plotting a string describing the type of island ontogeny. Can be \code{"const"}, \code{"beta"} for a beta function -describing area through time. String checked by -\code{\link{is_island_ontogeny_input}()}. \cr In all other functions a +describing area through time. \cr In all other functions a numeric describing the type of island ontogeny. Can be \code{0} for constant, \code{1} for a beta function describing area through time. In ML functions \code{island_ontogeny = NA} assumes constant ontogeny. Time @@ -104,8 +103,7 @@ Will return an error if called in that case.} \item{sea_level}{In \code{\link{DAISIE_sim_time_dep}()} and plotting a string describing the type of sea level. Can be \code{"const"} or -\code{"sine"} for a sine function describing area through time. String -checked by \code{\link{is_sea_level_input}()}. +\code{"sine"} for a sine function describing area through time. \cr In all other functions a numeric describing the type of sea level. Can be \code{0} for constant, \code{1} for a sine function describing area through time.} diff --git a/man/DAISIE_sim_trait_dep.Rd b/man/DAISIE_sim_trait_dep.Rd index 6e082fe5..442eb5ab 100644 --- a/man/DAISIE_sim_trait_dep.Rd +++ b/man/DAISIE_sim_trait_dep.Rd @@ -83,8 +83,7 @@ type 2.} \item{island_ontogeny}{In \code{\link{DAISIE_sim_time_dep}()}, \code{\link{DAISIE_ML_CS}} and plotting a string describing the type of island ontogeny. Can be \code{"const"}, \code{"beta"} for a beta function -describing area through time. String checked by -\code{\link{is_island_ontogeny_input}()}. \cr In all other functions a +describing area through time. \cr In all other functions a numeric describing the type of island ontogeny. Can be \code{0} for constant, \code{1} for a beta function describing area through time. In ML functions \code{island_ontogeny = NA} assumes constant ontogeny. Time @@ -93,8 +92,7 @@ Will return an error if called in that case.} \item{sea_level}{In \code{\link{DAISIE_sim_time_dep}()} and plotting a string describing the type of sea level. Can be \code{"const"} or -\code{"sine"} for a sine function describing area through time. String -checked by \code{\link{is_sea_level_input}()}. +\code{"sine"} for a sine function describing area through time. \cr In all other functions a numeric describing the type of sea level. Can be \code{0} for constant, \code{1} for a sine function describing area through time.} diff --git a/man/DAISIE_sim_trait_dep_2K.Rd b/man/DAISIE_sim_trait_dep_2K.Rd index 414661a5..d84c2230 100644 --- a/man/DAISIE_sim_trait_dep_2K.Rd +++ b/man/DAISIE_sim_trait_dep_2K.Rd @@ -83,8 +83,7 @@ type 2.} \item{island_ontogeny}{In \code{\link{DAISIE_sim_time_dep}()}, \code{\link{DAISIE_ML_CS}} and plotting a string describing the type of island ontogeny. Can be \code{"const"}, \code{"beta"} for a beta function -describing area through time. String checked by -\code{\link{is_island_ontogeny_input}()}. \cr In all other functions a +describing area through time. \cr In all other functions a numeric describing the type of island ontogeny. Can be \code{0} for constant, \code{1} for a beta function describing area through time. In ML functions \code{island_ontogeny = NA} assumes constant ontogeny. Time @@ -93,8 +92,7 @@ Will return an error if called in that case.} \item{sea_level}{In \code{\link{DAISIE_sim_time_dep}()} and plotting a string describing the type of sea level. Can be \code{"const"} or -\code{"sine"} for a sine function describing area through time. String -checked by \code{\link{is_sea_level_input}()}. +\code{"sine"} for a sine function describing area through time. \cr In all other functions a numeric describing the type of sea level. Can be \code{0} for constant, \code{1} for a sine function describing area through time.} diff --git a/man/are_area_pars.Rd b/man/are_area_pars.Rd deleted file mode 100644 index db25ed7f..00000000 --- a/man/are_area_pars.Rd +++ /dev/null @@ -1,44 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/DAISIE_check_format.R -\name{are_area_pars} -\alias{are_area_pars} -\title{Test if list has area parameters} -\usage{ -are_area_pars(area_pars) -} -\arguments{ -\item{area_pars}{A named list containing area and sea level parameters as -created by \code{\link{create_area_pars}()}: -\itemize{ - \item{[1]: maximum area} - \item{[2]: current area} - \item{[3]: value from 0 to 1 indicating where in the island's history the - peak area is achieved} - \item{[4]: total island age} - \item{[5]: amplitude of area fluctuation from sea level} - \item{[6]: frequency of sine wave of area change from sea level} - \item{[7]: angle of the slope of the island} -}} -} -\value{ -Boolean that indicates if list conforms to expected area parameters -as created by \link{create_area_pars} -} -\description{ -Test if list has area parameters -} -\examples{ -testit::assert(DAISIE:::are_area_pars( - create_area_pars( - max_area = 10, - current_area = 4, - proportional_peak_t = 0.5, - total_island_age = 5, - sea_level_amplitude = 5, - sea_level_frequency = 10, - island_gradient_angle = 0))) -} -\author{ -Richel J.C Bilderbeek, Joshua Lambert, Pedro Neves -} -\keyword{internal} diff --git a/man/are_hyper_pars.Rd b/man/are_hyper_pars.Rd deleted file mode 100644 index 3fa55fe2..00000000 --- a/man/are_hyper_pars.Rd +++ /dev/null @@ -1,32 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/DAISIE_check_format.R -\name{are_hyper_pars} -\alias{are_hyper_pars} -\title{Test if a list has hyperparameters} -\usage{ -are_hyper_pars(hyper_pars) -} -\arguments{ -\item{hyper_pars}{A named list of numeric hyperparameters for the rate -calculations as returned by \code{\link{create_hyper_pars}()}: -\itemize{ - \item{[1]: is d the scaling parameter for exponent for calculating - cladogenesis rate} - \item{[2]: is x the exponent for calculating extinction rate} -}} -} -\value{ -\code{TRUE} if list contains hyperparameters, \code{FALSE} otherwise. -} -\description{ -Test if a list has hyperparameters -} -\examples{ -testit::assert( - DAISIE:::are_hyper_pars(create_hyper_pars(d = 0.027, x = 0.15)) -) -} -\author{ -Pedro Neves, Joshua Lambert -} -\keyword{internal} diff --git a/man/are_max_rates.Rd b/man/are_max_rates.Rd deleted file mode 100644 index 7d16471f..00000000 --- a/man/are_max_rates.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/DAISIE_check_format.R -\name{are_max_rates} -\alias{are_max_rates} -\title{Determines if object max_rates are max_rates} -\usage{ -are_max_rates(max_rates) -} -\arguments{ -\item{max_rates}{named list of numeric max rates as returned by -\code{\link{update_max_rates}()}.} -} -\value{ -\code{TRUE} if object max_rates is a list of rates, -\code{FALSE} otherwise. -} -\description{ -Determines if object max_rates are max_rates -} -\keyword{internal} diff --git a/man/are_max_rates_gt_rates.Rd b/man/are_max_rates_gt_rates.Rd deleted file mode 100644 index 8565c9e1..00000000 --- a/man/are_max_rates_gt_rates.Rd +++ /dev/null @@ -1,49 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/DAISIE_check_format.R -\name{are_max_rates_gt_rates} -\alias{are_max_rates_gt_rates} -\title{Check if maximum rates are greater or equal to rates} -\usage{ -are_max_rates_gt_rates(rates, max_rates) -} -\arguments{ -\item{rates}{named list of numeric rates as returned by -\code{\link{update_rates}()}.} - -\item{max_rates}{named list of numeric max rates as returned by -\code{\link{update_max_rates}()}.} -} -\value{ -\code{TRUE} if maximum rates are greater or equal than rates, -\code{FALSE} otherwise. -} -\description{ -Check if maximum rates are greater or equal to rates -} -\examples{ -rates <- list( - ext_rate = 0.1, - immig_rate = 0.1, - ana_rate = 0.1, - clado_rate = 0.1 -) -max_rates <- list( - ext_max_rate = 1, - immig_max_rate = 1, - ana_max_rate = 1, - clado_max_rate = 1 -) -testthat::expect_true( - DAISIE:::are_max_rates_gt_rates( - rates = rates, - max_rates = max_rates - ) -) -} -\seealso{ -\code{\link{are_rates}}, \code{\link{are_max_rates}} -} -\author{ -Joshua Lambert, Pedro Neves -} -\keyword{internal} diff --git a/man/are_trait_pars.Rd b/man/are_trait_pars.Rd deleted file mode 100644 index e4b47591..00000000 --- a/man/are_trait_pars.Rd +++ /dev/null @@ -1,41 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/DAISIE_check_format.R -\name{are_trait_pars} -\alias{are_trait_pars} -\title{Test if list has trait state parameters} -\usage{ -are_trait_pars(trait_pars) -} -\arguments{ -\item{trait_pars}{A named list containing diversification rates considering - two trait states created by \code{\link{create_trait_pars}}: -\itemize{ - \item{[1]:A numeric with the per capita transition rate with state1} - \item{[2]:A numeric with the per capita immigration rate with state2} - \item{[3]:A numeric with the per capita extinction rate with state2} - \item{[4]:A numeric with the per capita anagenesis rate with state2} - \item{[5]:A numeric with the per capita cladogenesis rate with state2} - \item{[6]:A numeric with the per capita transition rate with state2} - \item{[7]:A numeric with the number of species with trait state 2 on - mainland} -}} -} -\value{ -Boolean that indicates if list conforms to expected area parameters -as created by \link{create_trait_pars} -} -\description{ -Test if list has trait state parameters -} -\examples{ -testit::assert(DAISIE:::are_trait_pars( - create_trait_pars( - trans_rate = 0.5, - immig_rate2 = 0.1, - ext_rate2 = 0.2, - ana_rate2 = 0.3, - clado_rate2 = 0.4, - trans_rate2 = 0.5, - M2 = 1000)) == TRUE) -} -\keyword{internal} diff --git a/man/default_params_doc.Rd b/man/default_params_doc.Rd index 3c74d4a7..26338485 100644 --- a/man/default_params_doc.Rd +++ b/man/default_params_doc.Rd @@ -250,8 +250,7 @@ calculations as returned by \code{\link{create_hyper_pars}()}: \item{island_ontogeny}{In \code{\link{DAISIE_sim_time_dep}()}, \code{\link{DAISIE_ML_CS}} and plotting a string describing the type of island ontogeny. Can be \code{"const"}, \code{"beta"} for a beta function -describing area through time. String checked by -\code{\link{is_island_ontogeny_input}()}. \cr In all other functions a +describing area through time. \cr In all other functions a numeric describing the type of island ontogeny. Can be \code{0} for constant, \code{1} for a beta function describing area through time. In ML functions \code{island_ontogeny = NA} assumes constant ontogeny. Time @@ -260,8 +259,7 @@ Will return an error if called in that case.} \item{sea_level}{In \code{\link{DAISIE_sim_time_dep}()} and plotting a string describing the type of sea level. Can be \code{"const"} or -\code{"sine"} for a sine function describing area through time. String -checked by \code{\link{is_sea_level_input}()}. +\code{"sine"} for a sine function describing area through time. \cr In all other functions a numeric describing the type of sea level. Can be \code{0} for constant, \code{1} for a sine function describing area through time.} diff --git a/man/get_global_max_area.Rd b/man/get_global_max_area.Rd index 76685f40..f429bc65 100644 --- a/man/get_global_max_area.Rd +++ b/man/get_global_max_area.Rd @@ -31,8 +31,7 @@ present and the \code{area_pars}.} \item{island_ontogeny}{In \code{\link{DAISIE_sim_time_dep}()}, \code{\link{DAISIE_ML_CS}} and plotting a string describing the type of island ontogeny. Can be \code{"const"}, \code{"beta"} for a beta function -describing area through time. String checked by -\code{\link{is_island_ontogeny_input}()}. \cr In all other functions a +describing area through time. \cr In all other functions a numeric describing the type of island ontogeny. Can be \code{0} for constant, \code{1} for a beta function describing area through time. In ML functions \code{island_ontogeny = NA} assumes constant ontogeny. Time @@ -41,8 +40,7 @@ Will return an error if called in that case.} \item{sea_level}{In \code{\link{DAISIE_sim_time_dep}()} and plotting a string describing the type of sea level. Can be \code{"const"} or -\code{"sine"} for a sine function describing area through time. String -checked by \code{\link{is_sea_level_input}()}. +\code{"sine"} for a sine function describing area through time. \cr In all other functions a numeric describing the type of sea level. Can be \code{0} for constant, \code{1} for a sine function describing area through time.} diff --git a/man/get_global_min_area.Rd b/man/get_global_min_area.Rd index bfb80a7d..76bad641 100644 --- a/man/get_global_min_area.Rd +++ b/man/get_global_min_area.Rd @@ -31,8 +31,7 @@ present and the \code{area_pars}.} \item{island_ontogeny}{In \code{\link{DAISIE_sim_time_dep}()}, \code{\link{DAISIE_ML_CS}} and plotting a string describing the type of island ontogeny. Can be \code{"const"}, \code{"beta"} for a beta function -describing area through time. String checked by -\code{\link{is_island_ontogeny_input}()}. \cr In all other functions a +describing area through time. \cr In all other functions a numeric describing the type of island ontogeny. Can be \code{0} for constant, \code{1} for a beta function describing area through time. In ML functions \code{island_ontogeny = NA} assumes constant ontogeny. Time @@ -41,8 +40,7 @@ Will return an error if called in that case.} \item{sea_level}{In \code{\link{DAISIE_sim_time_dep}()} and plotting a string describing the type of sea level. Can be \code{"const"} or -\code{"sine"} for a sine function describing area through time. String -checked by \code{\link{is_sea_level_input}()}. +\code{"sine"} for a sine function describing area through time. \cr In all other functions a numeric describing the type of sea level. Can be \code{0} for constant, \code{1} for a sine function describing area through time.} diff --git a/man/is_island_ontogeny_input.Rd b/man/is_island_ontogeny_input.Rd deleted file mode 100644 index 847b6877..00000000 --- a/man/is_island_ontogeny_input.Rd +++ /dev/null @@ -1,30 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/DAISIE_check_format.R -\name{is_island_ontogeny_input} -\alias{is_island_ontogeny_input} -\title{Check if island_ontogeny is correct after user input} -\usage{ -is_island_ontogeny_input(island_ontogeny) -} -\arguments{ -\item{island_ontogeny}{In \code{\link{DAISIE_sim_time_dep}()}, -\code{\link{DAISIE_ML_CS}} and plotting a string describing the type of -island ontogeny. Can be \code{"const"}, \code{"beta"} for a beta function -describing area through time. String checked by -\code{\link{is_island_ontogeny_input}()}. \cr In all other functions a -numeric describing the type of island ontogeny. Can be \code{0} for -constant, \code{1} for a beta function describing area through time. In ML -functions \code{island_ontogeny = NA} assumes constant ontogeny. Time -dependent estimation is not yet available as development is still ongoing. -Will return an error if called in that case.} -} -\value{ -Boolean stating if island_ontogeny is correct. -} -\description{ -Check if island_ontogeny is correct after user input -} -\seealso{ -is_island_ontogeny_runtime -} -\keyword{internal} diff --git a/man/is_sea_level_input.Rd b/man/is_sea_level_input.Rd deleted file mode 100644 index 67321f2c..00000000 --- a/man/is_sea_level_input.Rd +++ /dev/null @@ -1,27 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/DAISIE_check_format.R -\name{is_sea_level_input} -\alias{is_sea_level_input} -\title{Check if sea_level is correct after user input} -\usage{ -is_sea_level_input(sea_level) -} -\arguments{ -\item{sea_level}{In \code{\link{DAISIE_sim_time_dep}()} and plotting a -string describing the type of sea level. Can be \code{"const"} or -\code{"sine"} for a sine function describing area through time. String -checked by \code{\link{is_sea_level_input}()}. -\cr In all other functions a numeric describing the type of sea level. Can -be \code{0} for constant, \code{1} for a sine function describing area -through time.} -} -\value{ -Boolean stating if sea_level is correct. -} -\description{ -Check if sea_level is correct after user input -} -\seealso{ -is_sea_level_runtime -} -\keyword{internal} diff --git a/man/is_simulation_outputs.Rd b/man/is_simulation_outputs.Rd deleted file mode 100644 index 3139dbc1..00000000 --- a/man/is_simulation_outputs.Rd +++ /dev/null @@ -1,37 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/DAISIE_check_format.R -\name{is_simulation_outputs} -\alias{is_simulation_outputs} -\title{Measures if the input is a valid collection of simulation -outputs.} -\usage{ -is_simulation_outputs(simulation_outputs) -} -\arguments{ -\item{simulation_outputs}{A list with matrices and vectors of simulation -produced by DAISIE_sim functions.} -} -\value{ -TRUE if the input is a valid collection of simulation -outputs. -} -\description{ -Measures if the input is a valid collection of simulation -outputs. -} -\examples{ -testthat::expect_false(DAISIE:::is_simulation_outputs("nonsense")) - -simulation_outputs <- DAISIE_sim_cr( - time = 2, - M = 1000, - pars = c(2, 1, 20, 0.0001, 1), - replicates = 1, - plot_sims = FALSE - ) -testthat::expect_true(DAISIE:::is_simulation_outputs(simulation_outputs)) -} -\author{ -Richel J.C Bilderbeek, Pedro Neves -} -\keyword{internal} diff --git a/man/island_area.Rd b/man/island_area.Rd index d0ca12f9..1da2d969 100644 --- a/man/island_area.Rd +++ b/man/island_area.Rd @@ -33,8 +33,7 @@ present and the \code{area_pars}.} \item{island_ontogeny}{In \code{\link{DAISIE_sim_time_dep}()}, \code{\link{DAISIE_ML_CS}} and plotting a string describing the type of island ontogeny. Can be \code{"const"}, \code{"beta"} for a beta function -describing area through time. String checked by -\code{\link{is_island_ontogeny_input}()}. \cr In all other functions a +describing area through time. \cr In all other functions a numeric describing the type of island ontogeny. Can be \code{0} for constant, \code{1} for a beta function describing area through time. In ML functions \code{island_ontogeny = NA} assumes constant ontogeny. Time @@ -43,8 +42,7 @@ Will return an error if called in that case.} \item{sea_level}{In \code{\link{DAISIE_sim_time_dep}()} and plotting a string describing the type of sea level. Can be \code{"const"} or -\code{"sine"} for a sine function describing area through time. String -checked by \code{\link{is_sea_level_input}()}. +\code{"sine"} for a sine function describing area through time. \cr In all other functions a numeric describing the type of sea level. Can be \code{0} for constant, \code{1} for a sine function describing area through time.} diff --git a/man/translate_island_ontogeny.Rd b/man/translate_island_ontogeny.Rd index b491a2e6..ffd46538 100644 --- a/man/translate_island_ontogeny.Rd +++ b/man/translate_island_ontogeny.Rd @@ -10,8 +10,7 @@ translate_island_ontogeny(island_ontogeny) \item{island_ontogeny}{In \code{\link{DAISIE_sim_time_dep}()}, \code{\link{DAISIE_ML_CS}} and plotting a string describing the type of island ontogeny. Can be \code{"const"}, \code{"beta"} for a beta function -describing area through time. String checked by -\code{\link{is_island_ontogeny_input}()}. \cr In all other functions a +describing area through time. \cr In all other functions a numeric describing the type of island ontogeny. Can be \code{0} for constant, \code{1} for a beta function describing area through time. In ML functions \code{island_ontogeny = NA} assumes constant ontogeny. Time diff --git a/man/translate_sea_level.Rd b/man/translate_sea_level.Rd index a486c9be..5905010a 100644 --- a/man/translate_sea_level.Rd +++ b/man/translate_sea_level.Rd @@ -9,8 +9,7 @@ translate_sea_level(sea_level) \arguments{ \item{sea_level}{In \code{\link{DAISIE_sim_time_dep}()} and plotting a string describing the type of sea level. Can be \code{"const"} or -\code{"sine"} for a sine function describing area through time. String -checked by \code{\link{is_sea_level_input}()}. +\code{"sine"} for a sine function describing area through time. \cr In all other functions a numeric describing the type of sea level. Can be \code{0} for constant, \code{1} for a sine function describing area through time.} diff --git a/man/update_rates.Rd b/man/update_rates.Rd index 0e9c3b2f..b20a6154 100644 --- a/man/update_rates.Rd +++ b/man/update_rates.Rd @@ -68,8 +68,7 @@ present and the \code{area_pars}.} \item{island_ontogeny}{In \code{\link{DAISIE_sim_time_dep}()}, \code{\link{DAISIE_ML_CS}} and plotting a string describing the type of island ontogeny. Can be \code{"const"}, \code{"beta"} for a beta function -describing area through time. String checked by -\code{\link{is_island_ontogeny_input}()}. \cr In all other functions a +describing area through time. \cr In all other functions a numeric describing the type of island ontogeny. Can be \code{0} for constant, \code{1} for a beta function describing area through time. In ML functions \code{island_ontogeny = NA} assumes constant ontogeny. Time @@ -78,8 +77,7 @@ Will return an error if called in that case.} \item{sea_level}{In \code{\link{DAISIE_sim_time_dep}()} and plotting a string describing the type of sea level. Can be \code{"const"} or -\code{"sine"} for a sine function describing area through time. String -checked by \code{\link{is_sea_level_input}()}. +\code{"sine"} for a sine function describing area through time. \cr In all other functions a numeric describing the type of sea level. Can be \code{0} for constant, \code{1} for a sine function describing area through time.} From 0672105b292e50c029d5d5637a246fe196b93c6c Mon Sep 17 00:00:00 2001 From: Neves-P Date: Mon, 20 Mar 2023 16:48:51 +0100 Subject: [PATCH 09/48] Don't need ::: in tests [run ci] --- tests/testthat/test-DAISIE_ML1.R | 2 +- tests/testthat/test-DAISIE_ML2.R | 2 +- tests/testthat/test-DAISIE_ONEcolonist.R | 26 ++++----- tests/testthat/test-DAISIE_format_CS.R | 54 +++++++++---------- .../testthat/test-DAISIE_format_CS_full_stt.R | 32 +++++------ .../test-DAISIE_format_CS_sampled_stt.R | 22 ++++---- tests/testthat/test-DAISIE_format_CS_trait.R | 2 +- tests/testthat/test-DAISIE_format_GW.R | 14 ++--- tests/testthat/test-DAISIE_format_IW.R | 40 +++++++------- tests/testthat/test-DAISIE_loglik_CS.R | 6 +-- tests/testthat/test-DAISIE_loglik_IW_solver.R | 2 +- tests/testthat/test-DAISIE_max_rates.R | 8 +-- tests/testthat/test-DAISIE_min_rates.R | 6 +-- tests/testthat/test-DAISIE_plot_stt.R | 4 +- tests/testthat/test-DAISIE_sim_core.R | 4 +- tests/testthat/test-DAISIE_sim_core_cr.R | 10 ++-- .../testthat/test-DAISIE_sim_core_cr_shift.R | 6 +-- .../testthat/test-DAISIE_sim_core_time_dep.R | 52 +++++++++--------- .../testthat/test-DAISIE_sim_core_trait_dep.R | 8 +-- tests/testthat/test-are_max_rates_gt_rates.R | 16 +++--- tests/testthat/test-get_ana_rate.R | 4 +- tests/testthat/test-get_clado_rate.R | 16 +++--- tests/testthat/test-get_ext_rate.R | 8 +-- tests/testthat/test-get_immig_rate.R | 12 ++--- tests/testthat/test-integration_DAISIE.R | 2 +- tests/testthat/test-island_area.R | 4 +- tests/testthat/test-time_dep_vs_cr.R | 4 +- tests/testthat/test-update_max_rates.R | 8 +-- tests/testthat/test-update_rates.R | 2 +- 29 files changed, 188 insertions(+), 188 deletions(-) diff --git a/tests/testthat/test-DAISIE_ML1.R b/tests/testthat/test-DAISIE_ML1.R index 4aa7def5..f058e4e4 100644 --- a/tests/testthat/test-DAISIE_ML1.R +++ b/tests/testthat/test-DAISIE_ML1.R @@ -48,7 +48,7 @@ test_that("abuse", { parsfix <- NULL idparsfix <- NULL expect_error( - DAISIE:::DAISIE_ML1( + DAISIE_ML1( datalist = "nonsense", initparsopt = initparsopt, idparsopt = idparsopt, diff --git a/tests/testthat/test-DAISIE_ML2.R b/tests/testthat/test-DAISIE_ML2.R index 0d64954e..3c3ea8e9 100644 --- a/tests/testthat/test-DAISIE_ML2.R +++ b/tests/testthat/test-DAISIE_ML2.R @@ -60,7 +60,7 @@ test_that("use", { test_that("abuse", { skip_if(Sys.getenv("CI") == "", message = "Run only on CI") skip_on_cran() - expect_error(tested_MLE <- DAISIE:::DAISIE_ML2( + expect_error(tested_MLE <- DAISIE_ML2( datalist = "nonsense", initparsopt = c( 1.053151832, diff --git a/tests/testthat/test-DAISIE_ONEcolonist.R b/tests/testthat/test-DAISIE_ONEcolonist.R index c0437b11..046b61fc 100644 --- a/tests/testthat/test-DAISIE_ONEcolonist.R +++ b/tests/testthat/test-DAISIE_ONEcolonist.R @@ -17,7 +17,7 @@ test_that("DAISIE_ONEcolonist works on an oceanic DAISIE_sim_core", { island_gradient_angle = 0) hyper_pars <- create_hyper_pars(d = 0, x = 0) nonoceanic_pars <- c(0, 0) - sim <- DAISIE:::DAISIE_sim_core_cr( + sim <- DAISIE_sim_core_cr( time = sim_time, mainland_n = n_mainland_species, pars = c(clado_rate, ext_rate, carr_cap, imm_rate, ana_rate), @@ -51,7 +51,7 @@ test_that("DAISIE_ONEcolonist works on an oceanic DAISIE_sim_core", { init_nonend_spec <- sim$init_nonend_spec init_end_spec <- sim$init_end_spec carrying_capacity <- sim$carrying_capacity - result <- DAISIE:::DAISIE_ONEcolonist( + result <- DAISIE_ONEcolonist( time = sim_time, island_spec = island_spec, stt_table = stt_table @@ -87,7 +87,7 @@ test_that("DAISIE_ONEcolonist works with >=2 cladogenetic with same ancestor", { island_gradient_angle = 0) hyper_pars <- create_hyper_pars(d = 0, x = 0) nonoceanic_pars <- c(0, 0) - expect_silent(out <- DAISIE:::DAISIE_sim_core_cr( + expect_silent(out <- DAISIE_sim_core_cr( time = sim_time, mainland_n = n_mainland_species, pars = c(clado_rate, ext_rate, carr_cap, imm_rate, ana_rate), @@ -118,7 +118,7 @@ test_that("DAISIE_ONEcolonist works with >=2 anagenetic with same ancestor", { island_gradient_angle = 0) hyper_pars <- create_hyper_pars(d = 0, x = 0) nonoceanic_pars <- c(0, 0) - expect_silent(out <- DAISIE:::DAISIE_sim_core_cr( + expect_silent(out <- DAISIE_sim_core_cr( time = sim_time, mainland_n = n_mainland_species, pars = c(clado_rate, ext_rate, carr_cap, imm_rate, ana_rate), @@ -147,7 +147,7 @@ test_that("DAISIE_ONEcolonist works with >=2 nonendemic with same ancestor", { island_gradient_angle = 0) hyper_pars <- create_hyper_pars(d = 0, x = 0) nonoceanic_pars <- c(0, 0) - expect_silent(out <- DAISIE:::DAISIE_sim_core_cr( + expect_silent(out <- DAISIE_sim_core_cr( time = sim_time, mainland_n = n_mainland_species, pars = c(clado_rate, ext_rate, carr_cap, imm_rate, ana_rate), @@ -185,7 +185,7 @@ test_that("DAISIE_ONEcolonist stac and brts works for single colonist", { "Anagenetic_origin" ) stt_table <- NULL - result <- DAISIE:::DAISIE_ONEcolonist( + result <- DAISIE_ONEcolonist( time = sim_time, island_spec = island_spec, stt_table = stt_table @@ -221,7 +221,7 @@ test_that("DAISIE_ONEcolonist stac and brts works for 1 nonendemic colonist", { "Anagenetic_origin" ) stt_table <- NULL - result <- DAISIE:::DAISIE_ONEcolonist( + result <- DAISIE_ONEcolonist( time = sim_time, island_spec = island_spec, stt_table = stt_table @@ -266,7 +266,7 @@ test_that("DAISIE_ONEcolonist stac and brts works for 2 endemic colonists, "Anagenetic_origin" ) stt_table <- NULL - result <- DAISIE:::DAISIE_ONEcolonist( + result <- DAISIE_ONEcolonist( time = sim_time, island_spec = island_spec, stt_table = stt_table @@ -312,7 +312,7 @@ test_that("DAISIE_ONEcolonist stac and brts works for 3 endemic colonists", { "Anagenetic_origin" ) stt_table <- NULL - result <- DAISIE:::DAISIE_ONEcolonist( + result <- DAISIE_ONEcolonist( time = sim_time, island_spec = island_spec, stt_table = stt_table @@ -380,7 +380,7 @@ test_that("DAISIE_ONEcolonist stac and brts works for 2 endemic clades", { "Anagenetic_origin" ) stt_table <- NULL - result <- DAISIE:::DAISIE_ONEcolonist( + result <- DAISIE_ONEcolonist( time = sim_time, island_spec = island_spec, stt_table = stt_table @@ -461,7 +461,7 @@ test_that("DAISIE_ONEcolonist stac and brts works for 2 endemic clades, "Anagenetic_origin" ) stt_table <- NULL - result <- DAISIE:::DAISIE_ONEcolonist( + result <- DAISIE_ONEcolonist( time = sim_time, island_spec = island_spec, stt_table = stt_table @@ -548,7 +548,7 @@ test_that("DAISIE_ONEcolonist stac and brts works for 2 endemic clades, "Anagenetic_origin" ) stt_table <- NULL - result <- DAISIE:::DAISIE_ONEcolonist( + result <- DAISIE_ONEcolonist( time = sim_time, island_spec = island_spec, stt_table = stt_table @@ -607,7 +607,7 @@ test_that("DAISIE_ONEcolonist stac and brts works for 1 anagenetic clade from island_gradient_angle = 0) hyper_pars <- create_hyper_pars(d = 0, x = 0) nonoceanic_pars <- c(0, 0) - result <- DAISIE:::DAISIE_sim_core_cr( + result <- DAISIE_sim_core_cr( time = sim_time, mainland_n = n_mainland_species, pars = c(clado_rate, ext_rate, carr_cap, imm_rate, ana_rate), diff --git a/tests/testthat/test-DAISIE_format_CS.R b/tests/testthat/test-DAISIE_format_CS.R index f8f54722..42dcdc01 100644 --- a/tests/testthat/test-DAISIE_format_CS.R +++ b/tests/testthat/test-DAISIE_format_CS.R @@ -7,7 +7,7 @@ test_that("silent with empty island with correct output", { set.seed(1) island_replicates <- list() out <- list() - out[[1]] <- DAISIE:::DAISIE_sim_core_cr( + out[[1]] <- DAISIE_sim_core_cr( time = time, pars = pars, mainland_n = mainland_n, @@ -25,7 +25,7 @@ test_that("silent with empty island with correct output", { ) island_replicates[[1]] <- out expect_silent( - formatted_CS_sim <- DAISIE:::DAISIE_format_CS( + formatted_CS_sim <- DAISIE_format_CS( island_replicates = island_replicates, time = time, M = mainland_n, @@ -54,7 +54,7 @@ test_that("silent with non-empty island with correct output", { set.seed(1) island_replicates <- list() out <- list() - out[[1]] <- DAISIE:::DAISIE_sim_core_cr( + out[[1]] <- DAISIE_sim_core_cr( time = time, pars = pars, mainland_n = mainland_n, @@ -71,7 +71,7 @@ test_that("silent with non-empty island with correct output", { ) island_replicates[[1]] <- out expect_silent( - formatted_CS_sim <- DAISIE:::DAISIE_format_CS( # nolint + formatted_CS_sim <- DAISIE_format_CS( # nolint island_replicates = island_replicates, time = time, M = mainland_n, @@ -106,7 +106,7 @@ test_that("output with empty island and verbose = TRUE", { set.seed(1) island_replicates <- list() out <- list() - out[[1]] <- DAISIE:::DAISIE_sim_core_cr( + out[[1]] <- DAISIE_sim_core_cr( time = time, pars = pars, mainland_n = mainland_n, @@ -123,7 +123,7 @@ test_that("output with empty island and verbose = TRUE", { ) island_replicates[[1]] <- out expect_message( - formatted_CS_sim <- DAISIE:::DAISIE_format_CS( + formatted_CS_sim <- DAISIE_format_CS( island_replicates = island_replicates, time = time, M = mainland_n, @@ -145,7 +145,7 @@ test_that("silent with non-empty 2 type island", { set.seed(1) island_replicates <- list() prop_type2_pool <- 0.4 - island_replicates <- DAISIE:::DAISIE_sim_min_type2( + island_replicates <- DAISIE_sim_min_type2( time = total_time, M = M, pars = pars, @@ -162,7 +162,7 @@ test_that("silent with non-empty 2 type island", { island_gradient_angle = 0), verbose = FALSE) expect_silent( - formatted_CS_sim <- DAISIE:::DAISIE_format_CS( + formatted_CS_sim <- DAISIE_format_CS( island_replicates = island_replicates, time = total_time, M = mainland_n, @@ -183,7 +183,7 @@ test_that("silent with non-empty 2 type island full stt", { set.seed(1) island_replicates <- list() prop_type2_pool <- 0.4 - island_replicates <- DAISIE:::DAISIE_sim_min_type2( + island_replicates <- DAISIE_sim_min_type2( time = total_time, M = M, pars = pars, @@ -201,7 +201,7 @@ test_that("silent with non-empty 2 type island full stt", { island_gradient_angle = 0) ) expect_silent( - formatted_CS_sim <- DAISIE:::DAISIE_format_CS( + formatted_CS_sim <- DAISIE_format_CS( island_replicates = island_replicates, time = total_time, M = mainland_n, @@ -212,7 +212,7 @@ test_that("silent with non-empty 2 type island full stt", { test_that("abuse", { expect_error( - DAISIE:::DAISIE_format_CS( + DAISIE_format_CS( island_replicates = "nonsense", time = "nonsense", M = "nonsense", @@ -232,7 +232,7 @@ test_that("use full stt", { set.seed(1) island_replicates <- list() out <- list() - out[[1]] <- DAISIE:::DAISIE_sim_core_cr( + out[[1]] <- DAISIE_sim_core_cr( time = time, pars = pars, mainland_n = mainland_n, @@ -249,7 +249,7 @@ test_that("use full stt", { ) island_replicates[[1]] <- out expect_silent( - formatted_CS_sim <- DAISIE:::DAISIE_format_CS( + formatted_CS_sim <- DAISIE_format_CS( island_replicates = island_replicates, time = time, M = mainland_n, @@ -333,21 +333,21 @@ test_that("use complete stt with ontogeny", { ) hyper_pars <- create_hyper_pars(d = 0.2, x = 0.1) nonoceanic_pars <- c(0, 0) - island_ontogeny = DAISIE:::translate_island_ontogeny("beta") - sea_level = DAISIE:::translate_sea_level("const") - peak <- DAISIE:::calc_peak(total_time = total_time, + island_ontogeny = translate_island_ontogeny("beta") + sea_level = translate_sea_level("const") + peak <- calc_peak(total_time = total_time, area_pars = area_pars) - Amax <- DAISIE:::get_global_max_area(total_time = total_time, + Amax <- get_global_max_area(total_time = total_time, area_pars = area_pars, peak = peak, island_ontogeny = island_ontogeny, sea_level = sea_level) - Amin <- DAISIE:::get_global_min_area(total_time = total_time, + Amin <- get_global_min_area(total_time = total_time, area_pars = area_pars, peak = peak, island_ontogeny = island_ontogeny, sea_level = sea_level) - out[[1]] <- DAISIE:::DAISIE_sim_core_time_dep( + out[[1]] <- DAISIE_sim_core_time_dep( time = total_time, pars = pars, mainland_n = mainland_n, @@ -363,7 +363,7 @@ test_that("use complete stt with ontogeny", { ) island_replicates[[1]] <- out expect_silent( - formatted_CS_sim <- DAISIE:::DAISIE_format_CS( + formatted_CS_sim <- DAISIE_format_CS( island_replicates = island_replicates, time = total_time, M = mainland_n, @@ -430,7 +430,7 @@ test_that("full stt works with multiple replicates", { island_replicates <- list() island_replicates[[1]] <- island_replicates out <- list() - out[[1]] <- DAISIE:::DAISIE_sim_core_cr( + out[[1]] <- DAISIE_sim_core_cr( time = time, pars = pars, mainland_n = mainland_n, @@ -438,7 +438,7 @@ test_that("full stt works with multiple replicates", { hyper_pars = hyper_pars, nonoceanic_pars = nonoceanic_pars ) - out[[2]] <- DAISIE:::DAISIE_sim_core_cr( + out[[2]] <- DAISIE_sim_core_cr( time = time, pars = pars, mainland_n = mainland_n, @@ -448,7 +448,7 @@ test_that("full stt works with multiple replicates", { ) island_replicates[[1]] <- out expect_silent( - formatted_CS_sim <- DAISIE:::DAISIE_format_CS( + formatted_CS_sim <- DAISIE_format_CS( island_replicates = island_replicates, time = time, M = mainland_n, @@ -483,7 +483,7 @@ test_that("full stt works with empty island", { out <- list() for (m_spec in 1:mainland_n) { out$branching_times <- c(10) - out <- DAISIE:::DAISIE_sim_core_cr( + out <- DAISIE_sim_core_cr( time = total_time, mainland_n = 1, pars = pars, @@ -496,7 +496,7 @@ test_that("full stt works with empty island", { island_replicates[[rep]] <- full_list } expect_silent( - formatted_CS_sim <- DAISIE:::DAISIE_format_CS( + formatted_CS_sim <- DAISIE_format_CS( island_replicates = island_replicates, time = total_time, M = mainland_n, @@ -523,7 +523,7 @@ test_that("full stt with two trait states", { set.seed(1) island_replicates <- list() out <- list() - out[[1]] <- DAISIE:::DAISIE_sim_core_trait_dep( + out[[1]] <- DAISIE_sim_core_trait_dep( time = time, pars = pars, mainland_n = mainland_n, @@ -540,7 +540,7 @@ test_that("full stt with two trait states", { ) island_replicates[[1]] <- out expect_silent( - formatted_CS_sim <- DAISIE:::DAISIE_format_CS( + formatted_CS_sim <- DAISIE_format_CS( island_replicates = island_replicates, time = time, M = mainland_n, diff --git a/tests/testthat/test-DAISIE_format_CS_full_stt.R b/tests/testthat/test-DAISIE_format_CS_full_stt.R index 2b2bd8b5..61e7f43b 100644 --- a/tests/testthat/test-DAISIE_format_CS_full_stt.R +++ b/tests/testthat/test-DAISIE_format_CS_full_stt.R @@ -24,7 +24,7 @@ test_that("complete stt, 1 type, no geodynamics, oceanic island, one trait state for (m_spec in 1:mainland_n) { out$branching_times <- c(10) while (length(out$branching_times) == 1) { - out <- DAISIE:::DAISIE_sim_core_cr( + out <- DAISIE_sim_core_cr( time = total_time, mainland_n = 1, pars = pars, @@ -40,7 +40,7 @@ test_that("complete stt, 1 type, no geodynamics, oceanic island, one trait state expect_silent( - formatted_CS_sim <- DAISIE:::DAISIE_format_CS_full_stt( + formatted_CS_sim <- DAISIE_format_CS_full_stt( island_replicates = island_replicates, time = total_time, M = mainland_n, @@ -119,14 +119,14 @@ test_that("complete stt, 1 type, geodynamics, oceanic island, one trait state ) hyper_pars <- create_hyper_pars(d = 0.2, x = 0.1) nonoceanic_pars <- c(0, 0) - peak <- DAISIE:::calc_peak(total_time = total_time, + peak <- calc_peak(total_time = total_time, area_pars = area_pars) - Amax <- DAISIE:::get_global_max_area(total_time = total_time, + Amax <- get_global_max_area(total_time = total_time, area_pars = area_pars, peak = peak, island_ontogeny = island_ontogeny, sea_level = sea_level) - Amin <- DAISIE:::get_global_min_area(total_time = total_time, + Amin <- get_global_min_area(total_time = total_time, area_pars = area_pars, peak = peak, island_ontogeny = island_ontogeny, @@ -138,7 +138,7 @@ test_that("complete stt, 1 type, geodynamics, oceanic island, one trait state for (m_spec in 1:mainland_n) { out$branching_times <- c(10) while (length(out$branching_times) == 1) { - out <- DAISIE:::DAISIE_sim_core_time_dep( + out <- DAISIE_sim_core_time_dep( island_ontogeny = 1, time = total_time, mainland_n = 1, @@ -159,7 +159,7 @@ test_that("complete stt, 1 type, geodynamics, oceanic island, one trait state } expect_silent( - formatted_CS_sim <- DAISIE:::DAISIE_format_CS_full_stt( + formatted_CS_sim <- DAISIE_format_CS_full_stt( island_replicates = island_replicates, time = total_time, M = mainland_n, @@ -230,7 +230,7 @@ test_that("complete stt, 2 type, no geodynamics, oceanic island, one trait state island_replicates <- list() prop_type2_pool <- 0.4 - island_replicates <- DAISIE:::DAISIE_sim_min_type2( + island_replicates <- DAISIE_sim_min_type2( time = total_time, M = M, pars = pars, @@ -241,7 +241,7 @@ test_that("complete stt, 2 type, no geodynamics, oceanic island, one trait state verbose = FALSE ) expect_silent( - formatted_CS_sim <- DAISIE:::DAISIE_format_CS_full_stt( + formatted_CS_sim <- DAISIE_format_CS_full_stt( island_replicates = island_replicates, time = total_time, M = mainland_n, @@ -386,7 +386,7 @@ test_that("complete stt, 1 type, no geodynamics, nonoceanic, one trait state for (m_spec in 1:mainland_n) { out$branching_times <- c(10) while (length(out$branching_times) == 1) { - out <- DAISIE:::DAISIE_sim_core_cr( + out <- DAISIE_sim_core_cr( time = total_time, mainland_n = 1, pars = pars, @@ -400,7 +400,7 @@ test_that("complete stt, 1 type, no geodynamics, nonoceanic, one trait state island_replicates[[rep]] <- full_list } expect_silent( - formatted_CS_sim <- DAISIE:::DAISIE_format_CS_full_stt( + formatted_CS_sim <- DAISIE_format_CS_full_stt( island_replicates = island_replicates, time = total_time, M = mainland_n, @@ -437,7 +437,7 @@ test_that("complete stt, 1 type, no geodynamics, oceanic island, one trait state for (m_spec in 1:mainland_n) { out$branching_times <- c(10) while (length(out$branching_times) == 1) { - out <- DAISIE:::DAISIE_sim_core_cr( + out <- DAISIE_sim_core_cr( time = total_time, mainland_n = 1, pars = pars, @@ -451,7 +451,7 @@ test_that("complete stt, 1 type, no geodynamics, oceanic island, one trait state island_replicates[[rep]] <- full_list } expect_message( - formatted_CS_sim <- DAISIE:::DAISIE_format_CS_full_stt( + formatted_CS_sim <- DAISIE_format_CS_full_stt( island_replicates = island_replicates, time = total_time, M = mainland_n, @@ -545,7 +545,7 @@ test_that("complete stt, 1 type, no geodynamics, oceanic,two trait states island_replicates[[rep]] <- full_list } expect_silent( - formatted_CS_sim <- DAISIE:::DAISIE_format_CS_full_stt( + formatted_CS_sim <- DAISIE_format_CS_full_stt( island_replicates = island_replicates, time = total_time, M = mainland_n, @@ -578,7 +578,7 @@ test_that("when no colonization happens returns 0", { full_list <- list() out <- list() for (m_spec in 1:mainland_n) { - out <- DAISIE:::DAISIE_sim_core_cr( + out <- DAISIE_sim_core_cr( time = total_time, mainland_n = 1, pars = pars, @@ -594,7 +594,7 @@ test_that("when no colonization happens returns 0", { expect_silent( - formatted_CS_sim <- DAISIE:::DAISIE_format_CS_full_stt( + formatted_CS_sim <- DAISIE_format_CS_full_stt( island_replicates = island_replicates, time = total_time, M = mainland_n, diff --git a/tests/testthat/test-DAISIE_format_CS_sampled_stt.R b/tests/testthat/test-DAISIE_format_CS_sampled_stt.R index 7544f826..fb95205b 100644 --- a/tests/testthat/test-DAISIE_format_CS_sampled_stt.R +++ b/tests/testthat/test-DAISIE_format_CS_sampled_stt.R @@ -78,20 +78,20 @@ test_that("sampled stt, 1 type, geodynamics, oceanic island (same arguments as island_gradient_angle = 0 ) hyper_pars <- create_hyper_pars(d = 0.2, x = 0.1) - peak <- DAISIE:::calc_peak(total_time = total_time, + peak <- calc_peak(total_time = total_time, area_pars = area_pars) - Amax <- DAISIE:::get_global_max_area(total_time = total_time, + Amax <- get_global_max_area(total_time = total_time, area_pars = area_pars, peak = peak, island_ontogeny = island_ontogeny, sea_level = sea_level) - Amin <- DAISIE:::get_global_min_area(total_time = total_time, + Amin <- get_global_min_area(total_time = total_time, area_pars = area_pars, peak = peak, island_ontogeny = island_ontogeny, sea_level = sea_level) nonoceanic_pars <- c(0, 0) - out[[1]] <- DAISIE:::DAISIE_sim_core_time_dep( + out[[1]] <- DAISIE_sim_core_time_dep( time = total_time, pars = pars, mainland_n = mainland_n, @@ -106,7 +106,7 @@ test_that("sampled stt, 1 type, geodynamics, oceanic island (same arguments as ) island_replicates[[1]] <- out expect_silent( - formatted_CS_sim <- DAISIE:::DAISIE_format_CS_sampled_stt( + formatted_CS_sim <- DAISIE_format_CS_sampled_stt( island_replicates = island_replicates, time = total_time, M = mainland_n, @@ -173,7 +173,7 @@ test_that("sampled stt, 2 type, no geodynamics, oceanic island (same arguments set.seed(1) island_replicates <- list() prop_type2_pool <- 0.4 - island_replicates <- DAISIE:::DAISIE_sim_min_type2( + island_replicates <- DAISIE_sim_min_type2( time = total_time, M = M, pars = pars, @@ -184,7 +184,7 @@ test_that("sampled stt, 2 type, no geodynamics, oceanic island (same arguments verbose = FALSE ) expect_silent( - formatted_CS_sim <- DAISIE:::DAISIE_format_CS_sampled_stt( + formatted_CS_sim <- DAISIE_format_CS_sampled_stt( island_replicates = island_replicates, time = total_time, M = mainland_n, @@ -258,7 +258,7 @@ test_that("sampled stt, 1 type, no geodynamics, nonoceanic (same arguments as set.seed(1) island_replicates <- list() out <- list() - out[[1]] <- DAISIE:::DAISIE_sim_core_cr( + out[[1]] <- DAISIE_sim_core_cr( time = total_time, pars = pars, mainland_n = mainland_n, @@ -268,7 +268,7 @@ test_that("sampled stt, 1 type, no geodynamics, nonoceanic (same arguments as ) island_replicates[[1]] <- out expect_silent( - formatted_CS_sim <- DAISIE:::DAISIE_format_CS_sampled_stt( + formatted_CS_sim <- DAISIE_format_CS_sampled_stt( island_replicates = island_replicates, time = total_time, M = mainland_n, @@ -305,7 +305,7 @@ test_that("sampled stt, 1 type, no geodynamics, oceanic (same arguments as for (m_spec in 1:mainland_n) { out$branching_times <- c(10) while (length(out$branching_times) == 1) { - out <- DAISIE:::DAISIE_sim_core_cr( + out <- DAISIE_sim_core_cr( time = total_time, mainland_n = 1, pars = pars, @@ -320,7 +320,7 @@ test_that("sampled stt, 1 type, no geodynamics, oceanic (same arguments as } expect_silent( - formatted_CS_sim <- DAISIE:::DAISIE_format_CS_sampled_stt( + formatted_CS_sim <- DAISIE_format_CS_sampled_stt( island_replicates = island_replicates, time = total_time, M = mainland_n, diff --git a/tests/testthat/test-DAISIE_format_CS_trait.R b/tests/testthat/test-DAISIE_format_CS_trait.R index 7db2a982..33d4a9c9 100644 --- a/tests/testthat/test-DAISIE_format_CS_trait.R +++ b/tests/testthat/test-DAISIE_format_CS_trait.R @@ -85,7 +85,7 @@ test_that("sampled stt, 1 type, no geodynamics, oceanic, two trait states island_replicates[[rep]] <- full_list } expect_silent( - formatted_CS_sim <- DAISIE:::DAISIE_format_CS_sampled_stt( + formatted_CS_sim <- DAISIE_format_CS_sampled_stt( island_replicates = island_replicates, time = total_time, M = mainland_n, diff --git a/tests/testthat/test-DAISIE_format_GW.R b/tests/testthat/test-DAISIE_format_GW.R index 59e80f36..b0be75f8 100644 --- a/tests/testthat/test-DAISIE_format_GW.R +++ b/tests/testthat/test-DAISIE_format_GW.R @@ -18,7 +18,7 @@ test_that("silent with empty island with correct output", { set.seed(1) island_replicates <- list() out <- list() - out[[1]] <- DAISIE:::DAISIE_sim_core_cr( + out[[1]] <- DAISIE_sim_core_cr( time = time, pars = pars, mainland_n = mainland_n, @@ -28,7 +28,7 @@ test_that("silent with empty island with correct output", { ) island_replicates[[1]] <- out expect_silent( - formatted_GW_sim <- DAISIE:::DAISIE_format_GW( + formatted_GW_sim <- DAISIE_format_GW( island_replicates = island_replicates, time = time, M = mainland_n, @@ -69,7 +69,7 @@ test_that("silent with non-empty island with correct output", { set.seed(1) island_replicates <- list() out <- list() - out[[1]] <- DAISIE:::DAISIE_sim_core_cr( + out[[1]] <- DAISIE_sim_core_cr( time = time, pars = pars, mainland_n = mainland_n, @@ -79,7 +79,7 @@ test_that("silent with non-empty island with correct output", { ) island_replicates[[1]] <- out expect_silent( - formatted_GW_sim <- DAISIE:::DAISIE_format_GW( + formatted_GW_sim <- DAISIE_format_GW( island_replicates = island_replicates, time = time, M = mainland_n, @@ -110,7 +110,7 @@ test_that("output with empty island and verbose = TRUE", { nonoceanic_pars <- c(0, 0) island_replicates <- list() out <- list() - out[[1]] <- DAISIE:::DAISIE_sim_core_cr( + out[[1]] <- DAISIE_sim_core_cr( time = time, pars = pars, mainland_n = mainland_n, @@ -120,7 +120,7 @@ test_that("output with empty island and verbose = TRUE", { ) island_replicates[[1]] <- out expect_output( - formatted_GW_sim <- DAISIE:::DAISIE_format_GW( + formatted_GW_sim <- DAISIE_format_GW( island_replicates = island_replicates, time = time, M = mainland_n, @@ -133,5 +133,5 @@ test_that("output with empty island and verbose = TRUE", { }) test_that("abuse", { - expect_error(DAISIE:::DAISIE_format_GW("nonsense")) + expect_error(DAISIE_format_GW("nonsense")) }) diff --git a/tests/testthat/test-DAISIE_format_IW.R b/tests/testthat/test-DAISIE_format_IW.R index 246d0622..8b847091 100644 --- a/tests/testthat/test-DAISIE_format_IW.R +++ b/tests/testthat/test-DAISIE_format_IW.R @@ -17,7 +17,7 @@ test_that("silent with empty island with correct output", { set.seed(1) island_replicates <- list() - island_replicates[[1]] <- DAISIE:::DAISIE_sim_core_cr( + island_replicates[[1]] <- DAISIE_sim_core_cr( time = time, pars = pars, mainland_n = mainland_n, @@ -26,7 +26,7 @@ test_that("silent with empty island with correct output", { nonoceanic_pars = nonoceanic_pars ) expect_silent( - formatted_IW_sim <- DAISIE:::DAISIE_format_IW( + formatted_IW_sim <- DAISIE_format_IW( island_replicates = island_replicates, time = time, M = mainland_n, @@ -68,7 +68,7 @@ test_that("silent with non-empty island with correct output", { nonoceanic_pars <- c(0, 0) set.seed(1) island_replicates <- list() - island_replicates[[1]] <- DAISIE:::DAISIE_sim_core_cr( + island_replicates[[1]] <- DAISIE_sim_core_cr( time = time, pars = pars, mainland_n = mainland_n, @@ -77,7 +77,7 @@ test_that("silent with non-empty island with correct output", { nonoceanic_pars = nonoceanic_pars ) expect_silent( - formatted_IW_sim <- DAISIE:::DAISIE_format_IW( + formatted_IW_sim <- DAISIE_format_IW( island_replicates = island_replicates, time = time, M = mainland_n, @@ -138,7 +138,7 @@ test_that("DAISIE_format_IW prints when verbose = TRUE", { nonoceanic_pars <- c(0, 0) set.seed(1) island_replicates <- list() - island_replicates[[1]] <- DAISIE:::DAISIE_sim_core_cr( + island_replicates[[1]] <- DAISIE_sim_core_cr( time = time, pars = pars, mainland_n = mainland_n, @@ -147,7 +147,7 @@ test_that("DAISIE_format_IW prints when verbose = TRUE", { nonoceanic_pars = nonoceanic_pars ) expect_message( - formatted_IW_sim <- DAISIE:::DAISIE_format_IW( + formatted_IW_sim <- DAISIE_format_IW( island_replicates = island_replicates, time = time, M = mainland_n, @@ -176,7 +176,7 @@ test_that("silent with empty nonoceanic island with correct output", { hyper_pars <- create_hyper_pars(d = 0, x = 0) set.seed(1) island_replicates <- list() - island_replicates[[1]] <- DAISIE:::DAISIE_sim_core_cr( + island_replicates[[1]] <- DAISIE_sim_core_cr( time = time, mainland_n = mainland_n, pars = pars, @@ -185,7 +185,7 @@ test_that("silent with empty nonoceanic island with correct output", { nonoceanic_pars = nonoceanic_pars ) expect_silent( - formatted_IW_sim <- DAISIE:::DAISIE_format_IW( + formatted_IW_sim <- DAISIE_format_IW( island_replicates = island_replicates, time = time, M = mainland_n, @@ -229,7 +229,7 @@ test_that("silent with non-empty nonoceanic island with set.seed(1) island_replicates <- list() - island_replicates[[1]] <- DAISIE:::DAISIE_sim_core_cr( + island_replicates[[1]] <- DAISIE_sim_core_cr( time = time, mainland_n = mainland_n, pars = pars, @@ -238,7 +238,7 @@ test_that("silent with non-empty nonoceanic island with hyper_pars = hyper_pars ) expect_silent( - formatted_IW_sim <- DAISIE:::DAISIE_format_IW( + formatted_IW_sim <- DAISIE_format_IW( island_replicates = island_replicates, time = time, M = mainland_n, @@ -290,7 +290,7 @@ test_that("silent with non-empty nonoceanic island with set.seed(1) island_replicates <- list() - island_replicates[[1]] <- DAISIE:::DAISIE_sim_core_cr( + island_replicates[[1]] <- DAISIE_sim_core_cr( time = time, mainland_n = mainland_n, pars = pars, @@ -299,7 +299,7 @@ test_that("silent with non-empty nonoceanic island with hyper_pars = hyper_pars ) expect_silent( - formatted_IW_sim <- DAISIE:::DAISIE_format_IW( + formatted_IW_sim <- DAISIE_format_IW( island_replicates = island_replicates, time = time, M = mainland_n, @@ -342,7 +342,7 @@ test_that("add_brt_table output is correct when length(island) == 1", { stt_all = stt_all, init_nonend_spec = 0, init_end_spec = 0) - formatted_brt <- DAISIE:::add_brt_table(island) + formatted_brt <- add_brt_table(island) brt_table <- matrix(ncol = 5, nrow = 1) colnames(brt_table) <- c("brt", "clade", "event", "endemic", "col") brt_table[1, ] <- c(1, 0, 0, NA, NA) @@ -381,7 +381,7 @@ test_that("add_brt_table output is correct when length(island) != 1", { 0.5288428), stac = 4, missing_species = 0) - formatted_brt <- DAISIE:::add_brt_table(island) + formatted_brt <- add_brt_table(island) brt_table <- matrix(ncol = 5, nrow = 5) colnames(brt_table) <- c("brt", "clade", "event", "endemic", "col") brt_table[1, ] <- c(1, 0, 0, NA, NA) @@ -413,11 +413,11 @@ test_that("add_brt_table output is correct when length(island) != 1", { #test_that("add_brt_table output is correct when length(island_no_stac1or5) != 0") test_that("abuse", { - expect_error(DAISIE:::DAISIE_format_IW("nonsense")) + expect_error(DAISIE_format_IW("nonsense")) }) test_that("abuse", { - expect_error(DAISIE:::add_brt_table("nonsense")) + expect_error(add_brt_table("nonsense")) }) @@ -440,7 +440,7 @@ test_that("silent with empty island with correct output", { start_midway <- FALSE set.seed(1) island_replicates <- list() - island_replicates[[1]] <- DAISIE:::DAISIE_sim_core_trait_dep( + island_replicates[[1]] <- DAISIE_sim_core_trait_dep( time = time, pars = pars, hyper_pars = create_hyper_pars(d = 0, x = 0), @@ -456,7 +456,7 @@ test_that("silent with empty island with correct output", { mainland_n = mainland_n ) expect_silent( - formatted_IW_sim <- DAISIE:::DAISIE_format_IW( + formatted_IW_sim <- DAISIE_format_IW( island_replicates = island_replicates, time = time, M = mainland_n, @@ -503,7 +503,7 @@ test_that("silent when species with two trait states with island_replicates <- list() verbose <- FALSE set.seed(1) - island_replicates[[1]] <- DAISIE:::DAISIE_sim_core_trait_dep( + island_replicates[[1]] <- DAISIE_sim_core_trait_dep( time = time, mainland_n = mainland_n, pars = pars, @@ -522,7 +522,7 @@ test_that("silent when species with two trait states with extcutoff = extcutoff ) expect_silent( - formatted_IW_sim <- DAISIE:::DAISIE_format_IW( + formatted_IW_sim <- DAISIE_format_IW( island_replicates = island_replicates, time = time, M = mainland_n, diff --git a/tests/testthat/test-DAISIE_loglik_CS.R b/tests/testthat/test-DAISIE_loglik_CS.R index bb55aba9..544af93a 100644 --- a/tests/testthat/test-DAISIE_loglik_CS.R +++ b/tests/testthat/test-DAISIE_loglik_CS.R @@ -126,7 +126,7 @@ test_that("DAISIE_loglik_all produces same output for CS_version 0 and 1 with Galapagos_datalist2[[i]]$branching_times <- c(4, 4 - 2*i*0.1,4 -2*i*0.1-0.1) Galapagos_datalist2[[i]]$stac <- 2 } - Galapagos_datalist2 <- DAISIE:::add_brt_table(Galapagos_datalist2) + Galapagos_datalist2 <- add_brt_table(Galapagos_datalist2) loglik_CS00 <- DAISIE::DAISIE_loglik_all( pars1 = c(2.55068735, 2.68345455, 10.00000000, 0.00933207, 1.01007312), pars2 = c(100, 11, 0, 0, NA), @@ -174,14 +174,14 @@ test_that("DAISIE_loglik_CS_choice produces equivalent output for ODEINT RKCK54 0.0527, 0.0327, 0.0221, 0.1180, 0.0756, 0.0525, 0.0322, 0.0118) stac <- 2 missnumspec <- 0 - loglik1 <- DAISIE:::DAISIE_loglik_CS_choice( + loglik1 <- DAISIE_loglik_CS_choice( pars1 = pars1, pars2 = pars2, brts = brts, stac = stac, missnumspec = missnumspec ) - loglik2 <- DAISIE:::DAISIE_loglik_CS_choice( + loglik2 <- DAISIE_loglik_CS_choice( pars1 = pars1, pars2 = pars2, brts = brts, diff --git a/tests/testthat/test-DAISIE_loglik_IW_solver.R b/tests/testthat/test-DAISIE_loglik_IW_solver.R index c7013f37..723ed070 100644 --- a/tests/testthat/test-DAISIE_loglik_IW_solver.R +++ b/tests/testthat/test-DAISIE_loglik_IW_solver.R @@ -24,7 +24,7 @@ test_that("IW and CS loglik is same when K = Inf", { #Galapagos_datalist_IW[[8]]$branching_times <- c(4, 2, 1.41) #Galapagos_datalist_IW[[8]]$stac <- 2 - Galapagos_datalist_IW <- DAISIE:::add_brt_table(Galapagos_datalist_IW) + Galapagos_datalist_IW <- add_brt_table(Galapagos_datalist_IW) invisible(capture.output( loglik_IW <- DAISIE_loglik_IW( pars1 = pars1, diff --git a/tests/testthat/test-DAISIE_max_rates.R b/tests/testthat/test-DAISIE_max_rates.R index 22413493..a353acd9 100644 --- a/tests/testthat/test-DAISIE_max_rates.R +++ b/tests/testthat/test-DAISIE_max_rates.R @@ -12,9 +12,9 @@ test_that("use ontogeny", { ) island_ontogeny <- 1 sea_level <- 0 - peak <- DAISIE:::calc_peak(total_time = total_time, area_pars = area_pars) + peak <- calc_peak(total_time = total_time, area_pars = area_pars) testthat::expect_silent( - global_max_area <- DAISIE:::get_global_max_area( + global_max_area <- get_global_max_area( total_time = total_time, area_pars = area_pars, peak = peak, @@ -25,7 +25,7 @@ test_that("use ontogeny", { total_time <- 15 # Gets actual peak for entire curve testthat::expect_equal( - global_max_area <- DAISIE:::get_global_max_area( + global_max_area <- get_global_max_area( total_time = total_time, area_pars = area_pars, peak = peak, @@ -52,7 +52,7 @@ test_that("use sea level", { island_ontogeny <- 0 sea_level <- 1 testthat::expect_silent( - global_max_area <- DAISIE:::get_global_max_area( + global_max_area <- get_global_max_area( total_time = total_time, area_pars = area_pars, peak = peak, diff --git a/tests/testthat/test-DAISIE_min_rates.R b/tests/testthat/test-DAISIE_min_rates.R index 1122c1cf..96c81631 100644 --- a/tests/testthat/test-DAISIE_min_rates.R +++ b/tests/testthat/test-DAISIE_min_rates.R @@ -12,9 +12,9 @@ test_that("use ontogeny", { ) island_ontogeny <- 1 sea_level <- 0 - peak <- DAISIE:::calc_peak(total_time = total_time, area_pars = area_pars) + peak <- calc_peak(total_time = total_time, area_pars = area_pars) testthat::expect_silent( - global_min_area <- DAISIE:::get_global_min_area( + global_min_area <- get_global_min_area( total_time = total_time, area_pars = area_pars, peak = peak, @@ -38,7 +38,7 @@ test_that("use sea level", { island_ontogeny <- 0 sea_level <- 1 testthat::expect_silent( - global_min_area <- DAISIE:::get_global_min_area( + global_min_area <- get_global_min_area( total_time = total_time, area_pars = area_pars, island_ontogeny = island_ontogeny, diff --git a/tests/testthat/test-DAISIE_plot_stt.R b/tests/testthat/test-DAISIE_plot_stt.R index 45a9faea..303f663d 100644 --- a/tests/testthat/test-DAISIE_plot_stt.R +++ b/tests/testthat/test-DAISIE_plot_stt.R @@ -1,12 +1,12 @@ test_that("use", { skip("Plots: Run and manually inspect output") utils::data(islands_1type_1000reps, package = "DAISIE") - plot_lists <- DAISIE:::DAISIE_convert_to_classic_plot( + plot_lists <- DAISIE_convert_to_classic_plot( simulation_outputs = islands_1type_1000reps ) type <- names(plot_lists)[1] expect_silent( - DAISIE:::DAISIE_plot_stt( + DAISIE_plot_stt( plot_plus_one = FALSE, time = 4, plot_lists = plot_lists, diff --git a/tests/testthat/test-DAISIE_sim_core.R b/tests/testthat/test-DAISIE_sim_core.R index 886c05db..5c977aa0 100644 --- a/tests/testthat/test-DAISIE_sim_core.R +++ b/tests/testthat/test-DAISIE_sim_core.R @@ -10,7 +10,7 @@ test_that("Clean run should be silent", { ana_rate <- 1.0 testthat::expect_silent( - DAISIE:::DAISIE_sim_core_cr( + DAISIE_sim_core_cr( time = sim_time, mainland_n = n_mainland_species, pars = c(clado_rate, ext_rate, carr_cap, imm_rate, ana_rate), @@ -32,7 +32,7 @@ test_that("Clean run should be silent", { test_that("Ontogeny simulation should run silent", { set.seed(234567890) - testthat::expect_silent(DAISIE:::DAISIE_sim_core_time_dep( + testthat::expect_silent(DAISIE_sim_core_time_dep( time = 10, mainland_n = 1000, pars = c(0.0001, 2.2, 0.005, 0.001, 1), diff --git a/tests/testthat/test-DAISIE_sim_core_cr.R b/tests/testthat/test-DAISIE_sim_core_cr.R index 1a50caec..3f02e2a8 100644 --- a/tests/testthat/test-DAISIE_sim_core_cr.R +++ b/tests/testthat/test-DAISIE_sim_core_cr.R @@ -18,7 +18,7 @@ test_that("Clean run should be silent", { hyper_pars <- create_hyper_pars(d = 0, x = 0) nonoceanic_pars <- c(0, 0) expect_silent( - DAISIE:::DAISIE_sim_core_cr( + DAISIE_sim_core_cr( time = sim_time, mainland_n = n_mainland_species, pars = c(clado_rate, ext_rate, carr_cap, imm_rate, ana_rate), @@ -40,7 +40,7 @@ test_that("A non-oceanic run with non-zero sampling should have native sea_level_frequency = 0, island_gradient_angle = 0) hyper_pars <- create_hyper_pars(d = 0, x = 0) - nonoceanic_sim <- DAISIE:::DAISIE_sim_core_cr( + nonoceanic_sim <- DAISIE_sim_core_cr( time = 0.4, mainland_n = 1000, pars = c( @@ -72,7 +72,7 @@ test_that("DAISIE_sim_core output is correct", { island_gradient_angle = 0) nonoceanic_pars <- c(0, 0) hyper_pars <- create_hyper_pars(d = 0, x = 0) - sim_core <- DAISIE:::DAISIE_sim_core_cr( + sim_core <- DAISIE_sim_core_cr( time = time, mainland_n = mainland_n, pars = c(2, 2, 20, 0.1, 1), @@ -104,7 +104,7 @@ test_that("DAISIE_sim_core with land-bridge starting at time = 0 for CS uses island_gradient_angle = 0) hyper_pars <- create_hyper_pars(d = 0, x = 0) expect_silent( - DAISIE:::DAISIE_sim_core_cr_shift( + DAISIE_sim_core_cr_shift( time = 10, mainland_n = 1, pars = c(1, 1, 10, 0.1, 1, 2, 2, 20, 0.2, 1), @@ -128,7 +128,7 @@ test_that("DAISIE_sim_core fails when pars[4] == 0 && nonoceanic_pars <- c(0, 0) hyper_pars <- create_hyper_pars(d = 0, x = 0) expect_error( - DAISIE:::DAISIE_sim_core_cr( + DAISIE_sim_core_cr( time = 1, mainland_n = 100, pars = c(2, 2, 20, 0, 1), diff --git a/tests/testthat/test-DAISIE_sim_core_cr_shift.R b/tests/testthat/test-DAISIE_sim_core_cr_shift.R index ec7a6aea..eaf69087 100644 --- a/tests/testthat/test-DAISIE_sim_core_cr_shift.R +++ b/tests/testthat/test-DAISIE_sim_core_cr_shift.R @@ -12,7 +12,7 @@ test_that("split-rate model runs silent and nonoceanic_pars <- c(0, 0) hyper_pars <- create_hyper_pars(d = 0, x = 0) expect_silent( - DAISIE:::DAISIE_sim_core_cr_shift( + DAISIE_sim_core_cr_shift( time = 10, mainland_n = 1, pars = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1), @@ -35,7 +35,7 @@ test_that("abuse split-rate model with time smaller than shift_times", { island_gradient_angle = 0) nonoceanic_pars <- c(0, 0) hyper_pars <- create_hyper_pars(d = 0, x = 0) - expect_error(DAISIE:::DAISIE_sim_core_cr_shift( + expect_error(DAISIE_sim_core_cr_shift( time = 1, mainland_n = 1, pars = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1), @@ -55,7 +55,7 @@ test_that("abuse split-rate model with gamma = 0", { island_gradient_angle = 0) nonoceanic_pars <- c(0, 0) hyper_pars <- create_hyper_pars(d = 0, x = 0) - expect_error(DAISIE:::DAISIE_sim_core_cr_shift( + expect_error(DAISIE_sim_core_cr_shift( time = 1, mainland_n = 1, pars = c(1, 1, 1, 0, 1, 1, 1, 1, 1, 1), diff --git a/tests/testthat/test-DAISIE_sim_core_time_dep.R b/tests/testthat/test-DAISIE_sim_core_time_dep.R index 17bc5b89..c2002d18 100644 --- a/tests/testthat/test-DAISIE_sim_core_time_dep.R +++ b/tests/testthat/test-DAISIE_sim_core_time_dep.R @@ -12,23 +12,23 @@ test_that("Ontogeny oceanic should run silent IW", { island_gradient_angle = 0) nonoceanic_pars <- c(0, 0) hyper_pars <- create_hyper_pars(d = 0.2, x = 0.1) - island_ontogeny <- DAISIE:::translate_island_ontogeny("beta") - sea_level <- DAISIE:::translate_sea_level("const") - peak <- DAISIE:::calc_peak(total_time = total_time, + island_ontogeny <- translate_island_ontogeny("beta") + sea_level <- translate_sea_level("const") + peak <- calc_peak(total_time = total_time, area_pars = area_pars) - Amax <- DAISIE:::get_global_max_area(total_time = total_time, + Amax <- get_global_max_area(total_time = total_time, area_pars = area_pars, peak = peak, island_ontogeny = island_ontogeny, sea_level = sea_level) - Amin <- DAISIE:::get_global_min_area(total_time = total_time, + Amin <- get_global_min_area(total_time = total_time, area_pars = area_pars, peak = peak, island_ontogeny = island_ontogeny, sea_level = sea_level) set.seed(234567890) expect_silent( - DAISIE:::DAISIE_sim_core_time_dep( + DAISIE_sim_core_time_dep( time = total_time, mainland_n = mainland_n, pars = pars, @@ -49,8 +49,8 @@ test_that("Ontogeny oceanic should run silent CS", { total_time <- 10 mainland_n <- 1 pars <- c(0.0001, 2.2, 0.005, 0.001, 1) - island_ontogeny <- DAISIE:::translate_island_ontogeny("beta") - sea_level <- DAISIE:::translate_sea_level("const") + island_ontogeny <- translate_island_ontogeny("beta") + sea_level <- translate_sea_level("const") area_pars <- create_area_pars( max_area = 5000, current_area = 2500, @@ -61,21 +61,21 @@ test_that("Ontogeny oceanic should run silent CS", { island_gradient_angle = 0) nonoceanic_pars <- c(0, 0) hyper_pars <- create_hyper_pars(d = 0.2, x = 0.1) - peak <- DAISIE:::calc_peak(total_time = total_time, + peak <- calc_peak(total_time = total_time, area_pars = area_pars) - Amax <- DAISIE:::get_global_max_area(total_time = total_time, + Amax <- get_global_max_area(total_time = total_time, area_pars = area_pars, peak = peak, island_ontogeny = island_ontogeny, sea_level = sea_level) - Amin <- DAISIE:::get_global_min_area(total_time = total_time, + Amin <- get_global_min_area(total_time = total_time, area_pars = area_pars, peak = peak, island_ontogeny = island_ontogeny, sea_level = sea_level) set.seed(420) expect_silent( - DAISIE:::DAISIE_sim_core_time_dep( + DAISIE_sim_core_time_dep( time = total_time, mainland_n = mainland_n, pars = pars, @@ -105,23 +105,23 @@ test_that("Ontogeny oceanic with sea level should run silent CS", { island_gradient_angle = 30) nonoceanic_pars <- c(0, 0) hyper_pars <- create_hyper_pars(d = 0.2, x = 0.1) - island_ontogeny <- DAISIE:::translate_island_ontogeny("beta") + island_ontogeny <- translate_island_ontogeny("beta") sea_level <- translate_sea_level("const") - peak <- DAISIE:::calc_peak(total_time = total_time, + peak <- calc_peak(total_time = total_time, area_pars = area_pars) - Amax <- DAISIE:::get_global_max_area(total_time = total_time, + Amax <- get_global_max_area(total_time = total_time, area_pars = area_pars, peak = peak, island_ontogeny = island_ontogeny, sea_level = sea_level) - Amin <- DAISIE:::get_global_min_area(total_time = total_time, + Amin <- get_global_min_area(total_time = total_time, area_pars = area_pars, peak = peak, island_ontogeny = island_ontogeny, sea_level = sea_level) set.seed(439) expect_silent( - out <- DAISIE:::DAISIE_sim_core_time_dep( + out <- DAISIE_sim_core_time_dep( time = total_time, mainland_n = mainland_n, pars = pars, @@ -152,22 +152,22 @@ test_that("all species extinct if island dead", { sea_level_frequency = 0, island_gradient_angle = 0) nonoceanic_pars <- c(0, 0) - island_ontogeny <- DAISIE:::translate_island_ontogeny("beta") - sea_level <- DAISIE:::translate_sea_level("const") - peak <- DAISIE:::calc_peak(total_time = total_time, + island_ontogeny <- translate_island_ontogeny("beta") + sea_level <- translate_sea_level("const") + peak <- calc_peak(total_time = total_time, area_pars = area_pars) - Amax <- DAISIE:::get_global_max_area(total_time = total_time, + Amax <- get_global_max_area(total_time = total_time, area_pars = area_pars, peak = peak, island_ontogeny = island_ontogeny, sea_level = sea_level) - Amin <- DAISIE:::get_global_min_area(total_time = total_time, + Amin <- get_global_min_area(total_time = total_time, area_pars = area_pars, peak = peak, island_ontogeny = island_ontogeny, sea_level = sea_level) set.seed(1) - ontogeny_sim <- DAISIE:::DAISIE_sim_core_time_dep( + ontogeny_sim <- DAISIE_sim_core_time_dep( time = total_time, mainland_n = mainland_n, pars = pars, @@ -209,7 +209,7 @@ test_that("!is.null(area_pars) && island_ontogeny == 'const'", { Amax <- 1 Amin <- 1 expect_error( - DAISIE:::DAISIE_sim_core_time_dep( + DAISIE_sim_core_time_dep( time = total_time, mainland_n = mainland_n, pars = pars, @@ -237,7 +237,7 @@ test_that("(is.null(ext_pars) || is.null(area_pars)) && sea_level <- 1 expect_error( - DAISIE:::DAISIE_sim_core_time_dep( + DAISIE_sim_core_time_dep( time = time, mainland_n = mainland_n, pars = pars, @@ -254,7 +254,7 @@ test_that("(is.null(ext_pars) || is.null(area_pars)) && test_that("abuse time dependent model with gamma = 0", { - expect_error(DAISIE:::DAISIE_sim_core_time_dep( + expect_error(DAISIE_sim_core_time_dep( time = 1, mainland_n = 1, pars = c(1, 1, 1, 0, 1), diff --git a/tests/testthat/test-DAISIE_sim_core_trait_dep.R b/tests/testthat/test-DAISIE_sim_core_trait_dep.R index a7ec0b84..e45cee2d 100644 --- a/tests/testthat/test-DAISIE_sim_core_trait_dep.R +++ b/tests/testthat/test-DAISIE_sim_core_trait_dep.R @@ -1,7 +1,7 @@ test_that("nonontogeny oceanic trait_dependnet island should run silent IW", { set.seed(234567890) expect_silent( - DAISIE:::DAISIE_sim_core_trait_dep( + DAISIE_sim_core_trait_dep( time = 10, mainland_n = 100, hyper_pars = create_hyper_pars(d = 0, x = 0), @@ -29,7 +29,7 @@ test_that("nonontogeny oceanic trait_dependnet island should run silent IW", { test_that("nonontogeny oceanic trait_dependnet island should run silent CS", { set.seed(420) expect_silent( - DAISIE:::DAISIE_sim_core_trait_dep( + DAISIE_sim_core_trait_dep( time = 10, mainland_n = 0, hyper_pars = create_hyper_pars(d = 0, x = 0), @@ -57,7 +57,7 @@ test_that("nonontogeny oceanic trait_dependnet island should run silent CS", { test_that("abuse NULL trait pars", { set.seed(234567890) expect_error( - DAISIE:::DAISIE_sim_core_trait_dep( + DAISIE_sim_core_trait_dep( time = 10, mainland_n = 100, hyper_pars = create_hyper_pars(d = 0, x = 0), @@ -79,7 +79,7 @@ test_that("abuse NULL trait pars", { test_that("abuse NULL trait pars", { set.seed(234567890) expect_error( - DAISIE:::DAISIE_sim_core_trait_dep( + DAISIE_sim_core_trait_dep( time = 10, mainland_n = 100, hyper_pars = create_hyper_pars(d = 0, x = 0), diff --git a/tests/testthat/test-are_max_rates_gt_rates.R b/tests/testthat/test-are_max_rates_gt_rates.R index 72586a40..130217f3 100644 --- a/tests/testthat/test-are_max_rates_gt_rates.R +++ b/tests/testthat/test-are_max_rates_gt_rates.R @@ -1,6 +1,6 @@ test_that("basic use", { expect_true( - DAISIE:::are_max_rates_gt_rates( + are_max_rates_gt_rates( rates = list( immig_rate = 0.1, ext_rate = 0.2, @@ -16,7 +16,7 @@ test_that("basic use", { ) ) expect_true( - DAISIE:::are_max_rates_gt_rates( + are_max_rates_gt_rates( rates = list( immig_rate = 0.1, ext_rate = 0.2, @@ -36,7 +36,7 @@ test_that("basic use", { test_that("check returns FALSE when wrong", { expect_false( - DAISIE:::are_max_rates_gt_rates( + are_max_rates_gt_rates( rates = list( immig_rate = 0.1, ext_rate = 0.2, @@ -53,7 +53,7 @@ test_that("check returns FALSE when wrong", { ) expect_false( - DAISIE:::are_max_rates_gt_rates( + are_max_rates_gt_rates( rates = list( immig_rate = 0.1, ext_rate = 0.2, @@ -69,7 +69,7 @@ test_that("check returns FALSE when wrong", { ) ) expect_false( - DAISIE:::are_max_rates_gt_rates( + are_max_rates_gt_rates( rates = list( immig_rate = 0.1, ext_rate = 0.2, @@ -86,7 +86,7 @@ test_that("check returns FALSE when wrong", { ) expect_false( - DAISIE:::are_max_rates_gt_rates( + are_max_rates_gt_rates( rates = list( immig_rate = 0.1, ext_rate = 0.2, @@ -102,7 +102,7 @@ test_that("check returns FALSE when wrong", { ) ) expect_false( - DAISIE:::are_max_rates_gt_rates( + are_max_rates_gt_rates( rates = list( immig_rate = "nonsense", ext_rate = 0.2, @@ -118,7 +118,7 @@ test_that("check returns FALSE when wrong", { ) ) expect_false( - DAISIE:::are_max_rates_gt_rates( + are_max_rates_gt_rates( rates = list( immig_rate = 0.1, ext_rate = 0.2, diff --git a/tests/testthat/test-get_ana_rate.R b/tests/testthat/test-get_ana_rate.R index 8055238c..23dd32d8 100644 --- a/tests/testthat/test-get_ana_rate.R +++ b/tests/testthat/test-get_ana_rate.R @@ -1,10 +1,10 @@ test_that("use", { ps_ana_rate <- 1 n_immigrants <- 5 - ana_rate <- DAISIE:::get_ana_rate( + ana_rate <- get_ana_rate( laa = ps_ana_rate, num_immigrants = n_immigrants) - created <- DAISIE:::get_ana_rate( + created <- get_ana_rate( laa = 1, num_immigrants = 5) expected <- ps_ana_rate * n_immigrants diff --git a/tests/testthat/test-get_clado_rate.R b/tests/testthat/test-get_clado_rate.R index c2d8399b..c356f1e0 100644 --- a/tests/testthat/test-get_clado_rate.R +++ b/tests/testthat/test-get_clado_rate.R @@ -2,9 +2,9 @@ test_that("use area constant diversity-independent", { ps_clado_rate <- 0.2 carr_cap <- Inf n_species <- 4 - hyper_pars <- DAISIE:::create_hyper_pars(d = 0, x = 0) + hyper_pars <- create_hyper_pars(d = 0, x = 0) area <- 1 - created <- DAISIE:::get_clado_rate( + created <- get_clado_rate( lac = ps_clado_rate, hyper_pars = hyper_pars, num_spec = n_species, @@ -19,9 +19,9 @@ test_that("use area constant diversity-dependent", { ps_clado_rate <- 0.2 carr_cap <- 9 n_species <- 4 - hyper_pars <- DAISIE:::create_hyper_pars(d = 0, x = 0) + hyper_pars <- create_hyper_pars(d = 0, x = 0) area <- 1 - created <- DAISIE:::get_clado_rate( + created <- get_clado_rate( lac = ps_clado_rate, hyper_pars = hyper_pars, num_spec = n_species, @@ -36,9 +36,9 @@ test_that("use area variable diversity-independent", { ps_clado_rate <- 0.2 carr_cap <- Inf n_species <- 4 - hyper_pars <- DAISIE:::create_hyper_pars(d = 0.2, x = 0.1) + hyper_pars <- create_hyper_pars(d = 0.2, x = 0.1) area <- 10 - created <- DAISIE:::get_clado_rate( + created <- get_clado_rate( lac = ps_clado_rate, hyper_pars = hyper_pars, num_spec = n_species, @@ -53,9 +53,9 @@ test_that("use area variable diversity-dependent", { ps_clado_rate <- 0.2 carr_cap <- 9 n_species <- 4 - hyper_pars <- DAISIE:::create_hyper_pars(d = 0.2, x = 0.1) + hyper_pars <- create_hyper_pars(d = 0.2, x = 0.1) area <- 10 - created <- DAISIE:::get_clado_rate( + created <- get_clado_rate( lac = ps_clado_rate, hyper_pars = hyper_pars, num_spec = n_species, diff --git a/tests/testthat/test-get_ext_rate.R b/tests/testthat/test-get_ext_rate.R index 78acb145..66ed0042 100644 --- a/tests/testthat/test-get_ext_rate.R +++ b/tests/testthat/test-get_ext_rate.R @@ -1,9 +1,9 @@ test_that("use area constant", { ps_ext_rate <- 2 n_species <- 4 - hyper_pars = DAISIE:::create_hyper_pars(d = 0, x = 0) + hyper_pars = create_hyper_pars(d = 0, x = 0) area <- 1 - created <- DAISIE:::get_ext_rate( + created <- get_ext_rate( mu = ps_ext_rate, hyper_pars = hyper_pars, extcutoff = 1000, @@ -17,9 +17,9 @@ test_that("use area constant", { test_that("use area variable", { ps_ext_rate <- 2 n_species <- 4 - hyper_pars = DAISIE:::create_hyper_pars(d = 0.2, x = 0.1) + hyper_pars = create_hyper_pars(d = 0.2, x = 0.1) area <- 10 - created <- DAISIE:::get_ext_rate( + created <- get_ext_rate( mu = ps_ext_rate, hyper_pars = hyper_pars, extcutoff = 1000, diff --git a/tests/testthat/test-get_immig_rate.R b/tests/testthat/test-get_immig_rate.R index e3fac823..51fbeda3 100644 --- a/tests/testthat/test-get_immig_rate.R +++ b/tests/testthat/test-get_immig_rate.R @@ -3,9 +3,9 @@ test_that("use area constant diversity-independent", { ps_imm_rate <- 0.1 n_island_species <- 5 n_mainland_species <- 1 - hyper_pars <- DAISIE:::create_hyper_pars(0, 0) + hyper_pars <- create_hyper_pars(0, 0) area <- 1 - created <- DAISIE:::get_immig_rate( + created <- get_immig_rate( gam = ps_imm_rate, A = area, num_spec = n_island_species, @@ -22,9 +22,9 @@ test_that("use area constant diversity-dependent", { ps_imm_rate <- 0.1 n_island_species <- 5 n_mainland_species <- 1 - hyper_pars <- DAISIE:::create_hyper_pars(0, 0) + hyper_pars <- create_hyper_pars(0, 0) area <- 1 - created <- DAISIE:::get_immig_rate( + created <- get_immig_rate( gam = ps_imm_rate, A = area, num_spec = n_island_species, @@ -41,9 +41,9 @@ test_that("use area variable (ontogeny) diversity-dependent", { ps_imm_rate <- 0.1 n_island_species <- 5 n_mainland_species <- 1 - hyper_pars <- DAISIE:::create_hyper_pars(0, 0) + hyper_pars <- create_hyper_pars(0, 0) area <- 10 - created <- DAISIE:::get_immig_rate( + created <- get_immig_rate( gam = ps_imm_rate, A = area, num_spec = n_island_species, diff --git a/tests/testthat/test-integration_DAISIE.R b/tests/testthat/test-integration_DAISIE.R index c6923be8..70eac94b 100644 --- a/tests/testthat/test-integration_DAISIE.R +++ b/tests/testthat/test-integration_DAISIE.R @@ -73,7 +73,7 @@ test_that("IW and CS loglik is same when K = Inf", { Galapagos_datalist_IW[[i]]$stac <- 2 } - Galapagos_datalist_IW <- DAISIE:::add_brt_table(Galapagos_datalist_IW) + Galapagos_datalist_IW <- add_brt_table(Galapagos_datalist_IW) loglik_IW <- DAISIE_loglik_IW( pars1 = pars1, pars2 = pars2, diff --git a/tests/testthat/test-island_area.R b/tests/testthat/test-island_area.R index c5d287c6..9d02ee77 100644 --- a/tests/testthat/test-island_area.R +++ b/tests/testthat/test-island_area.R @@ -25,7 +25,7 @@ test_that("is valid island area with ontogeny", { sea_level_frequency = 0, island_gradient_angle = 0 ) - peak <- DAISIE:::calc_peak(total_time = 4, area_pars = area_pars) + peak <- calc_peak(total_time = 4, area_pars = area_pars) area <- island_area(timeval = 2, total_time = 4, @@ -64,7 +64,7 @@ test_that("is valid island area with ontogeny and sea level", { sea_level_frequency = 10, island_gradient_angle = 85 ) - peak <- DAISIE:::calc_peak(total_time = 4, area_pars = area_pars) + peak <- calc_peak(total_time = 4, area_pars = area_pars) area <- island_area(timeval = 2, total_time = 4, area_pars = area_pars, diff --git a/tests/testthat/test-time_dep_vs_cr.R b/tests/testthat/test-time_dep_vs_cr.R index adc6f213..76bef016 100644 --- a/tests/testthat/test-time_dep_vs_cr.R +++ b/tests/testthat/test-time_dep_vs_cr.R @@ -29,7 +29,7 @@ test_that("constant rate output matches time dependent code", { nonoceanic_pars <- c(0, 0) rng_seed <- 42 set.seed(rng_seed) - cr_out <- DAISIE:::DAISIE_sim_cr( + cr_out <- DAISIE_sim_cr( time = sim_time, M = n_mainland_species, pars = pars, @@ -45,7 +45,7 @@ test_that("constant rate output matches time dependent code", { # area. hyper_pars <- DAISIE::create_hyper_pars(d = 0, x = 0) set.seed(rng_seed) - time_dep_out <- DAISIE:::DAISIE_sim_core_time_dep( + time_dep_out <- DAISIE_sim_core_time_dep( time = sim_time, mainland_n = n_mainland_species, pars = c(clado_rate, ext_rate, carr_cap, imm_rate, ana_rate), diff --git a/tests/testthat/test-update_max_rates.R b/tests/testthat/test-update_max_rates.R index d319131c..6f33bb53 100644 --- a/tests/testthat/test-update_max_rates.R +++ b/tests/testthat/test-update_max_rates.R @@ -23,12 +23,12 @@ test_that("update_max_rates constant rates is silent and gives correct output", num_immigrants <- 0 mainland_n <- 1 peak <- 1 - Amin <- DAISIE:::get_global_min_area(total_time = total_time, + Amin <- get_global_min_area(total_time = total_time, area_pars = area_pars, peak = peak, island_ontogeny = island_ontogeny, sea_level = sea_level) - Amax <- DAISIE:::get_global_max_area(total_time = total_time, + Amax <- get_global_max_area(total_time = total_time, area_pars = area_pars, peak = peak, island_ontogeny = island_ontogeny, @@ -70,7 +70,7 @@ test_that("update area-dependent max rates is silent and gives correct output", island_gradient_angle = 0 ) hyper_pars <- create_hyper_pars(d = 0.2, x = 0.1) - peak <- DAISIE:::calc_peak(total_time = 0.7, area_pars = area_pars) + peak <- calc_peak(total_time = 0.7, area_pars = area_pars) Amin <- get_global_min_area(total_time = 0.7, area_pars = area_pars, peak = peak, @@ -82,7 +82,7 @@ test_that("update area-dependent max rates is silent and gives correct output", island_ontogeny = 1, sea_level = 0) - expect_silent(rates <- DAISIE:::update_max_rates( + expect_silent(rates <- update_max_rates( gam = 0.009, laa = 1.0, lac = 2.5, diff --git a/tests/testthat/test-update_rates.R b/tests/testthat/test-update_rates.R index 502c243a..4a0479b4 100644 --- a/tests/testthat/test-update_rates.R +++ b/tests/testthat/test-update_rates.R @@ -63,7 +63,7 @@ test_that("update area-dependent rates is silent and gives correct output", { island_gradient_angle = 0) hyper_pars <- create_hyper_pars(d = 0.2, x = 0.1) peak <- calc_peak(total_time = 1, area_pars = area_pars) - expect_silent(rates <- DAISIE:::update_rates( + expect_silent(rates <- update_rates( timeval = 0, total_time = 1, gam = gam, From 982f21656fd0c22bf032e67bbb0a0cdee4f42f45 Mon Sep 17 00:00:00 2001 From: Neves-P Date: Mon, 20 Mar 2023 16:51:31 +0100 Subject: [PATCH 10/48] Don't need DAISIE:: in tests [run ci] --- tests/testthat/test-DAISIE_MW_ML.R | 4 ++-- tests/testthat/test-DAISIE_ONEcolonist.R | 10 +++++----- .../test-DAISIE_convert_to_classic_plot.R | 2 +- tests/testthat/test-DAISIE_format_CS.R | 16 ++++++++-------- tests/testthat/test-DAISIE_format_CS_full_stt.R | 14 +++++++------- .../testthat/test-DAISIE_format_CS_sampled_stt.R | 8 ++++---- tests/testthat/test-DAISIE_format_CS_trait.R | 4 ++-- tests/testthat/test-DAISIE_format_GW.R | 6 +++--- tests/testthat/test-DAISIE_format_IW.R | 16 ++++++++-------- tests/testthat/test-DAISIE_loglik_CS.R | 10 +++++----- tests/testthat/test-DAISIE_loglik_IW_solver.R | 10 +++++----- tests/testthat/test-DAISIE_max_rates.R | 4 ++-- tests/testthat/test-DAISIE_min_rates.R | 4 ++-- tests/testthat/test-DAISIE_sim_core_cr.R | 10 +++++----- tests/testthat/test-DAISIE_sim_core_cr_shift.R | 6 +++--- tests/testthat/test-DAISIE_sim_core_trait_dep.R | 8 ++++---- tests/testthat/test-DAISIE_sim_cr.R | 6 +++--- tests/testthat/test-is_simulation_outputs.R | 2 +- tests/testthat/test-time_dep_vs_cr.R | 6 +++--- 19 files changed, 73 insertions(+), 73 deletions(-) diff --git a/tests/testthat/test-DAISIE_MW_ML.R b/tests/testthat/test-DAISIE_MW_ML.R index 23b55798..fd52d34c 100644 --- a/tests/testthat/test-DAISIE_MW_ML.R +++ b/tests/testthat/test-DAISIE_MW_ML.R @@ -7,7 +7,7 @@ test_that("DAISIE_MW_ML produces correct output", { utils::data(archipelagos41) invisible(capture.output( - M19_tested <- DAISIE::DAISIE_MW_ML( + M19_tested <- DAISIE_MW_ML( datalist = archipelagos41, initparsopt = c( 0.040073803, @@ -81,7 +81,7 @@ test_that("DAISIE_MW_ML produces correct output when in parallel", { ) invisible(capture.output( - M19_computation <- DAISIE::DAISIE_MW_ML( + M19_computation <- DAISIE_MW_ML( datalist = archipelagos41, initparsopt = c( 0.040073803, diff --git a/tests/testthat/test-DAISIE_ONEcolonist.R b/tests/testthat/test-DAISIE_ONEcolonist.R index 046b61fc..86319784 100644 --- a/tests/testthat/test-DAISIE_ONEcolonist.R +++ b/tests/testthat/test-DAISIE_ONEcolonist.R @@ -7,7 +7,7 @@ test_that("DAISIE_ONEcolonist works on an oceanic DAISIE_sim_core", { imm_rate <- 1.0 ana_rate <- 1.0 set.seed(1) - area_pars <- DAISIE::create_area_pars( + area_pars <- create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, @@ -77,7 +77,7 @@ test_that("DAISIE_ONEcolonist works with >=2 cladogenetic with same ancestor", { carr_cap <- 4 imm_rate <- 1 ana_rate <- 0.000001 - area_pars <- DAISIE::create_area_pars( + area_pars <- create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, @@ -108,7 +108,7 @@ test_that("DAISIE_ONEcolonist works with >=2 anagenetic with same ancestor", { carr_cap <- 4 imm_rate <- 1 ana_rate <- 2 - area_pars <- DAISIE::create_area_pars( + area_pars <- create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, @@ -137,7 +137,7 @@ test_that("DAISIE_ONEcolonist works with >=2 nonendemic with same ancestor", { carr_cap <- 4 imm_rate <- 3 ana_rate <- 1 - area_pars <- DAISIE::create_area_pars( + area_pars <- create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, @@ -597,7 +597,7 @@ test_that("DAISIE_ONEcolonist stac and brts works for 1 anagenetic clade from imm_rate <- 1.0 ana_rate <- 0 set.seed(3) - area_pars <- DAISIE::create_area_pars( + area_pars <- create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, diff --git a/tests/testthat/test-DAISIE_convert_to_classic_plot.R b/tests/testthat/test-DAISIE_convert_to_classic_plot.R index 2cae9ca3..1ca8c389 100644 --- a/tests/testthat/test-DAISIE_convert_to_classic_plot.R +++ b/tests/testthat/test-DAISIE_convert_to_classic_plot.R @@ -8,7 +8,7 @@ test_that("abuse", { # test_that("use", { # utils::data("islands_1type_1000reps", package = "DAISIE") -# simulation_outputs <- DAISIE::DAISIE_convert_to_classic_plot( +# simulation_outputs <- DAISIE_convert_to_classic_plot( # islands_1type_1000reps # ) # expect_true(is_simulation_outputs(simulation_outuputs)) diff --git a/tests/testthat/test-DAISIE_format_CS.R b/tests/testthat/test-DAISIE_format_CS.R index 42dcdc01..ba91e0a0 100644 --- a/tests/testthat/test-DAISIE_format_CS.R +++ b/tests/testthat/test-DAISIE_format_CS.R @@ -60,7 +60,7 @@ test_that("silent with non-empty island with correct output", { mainland_n = mainland_n, nonoceanic_pars = c(0, 0), hyper_pars = create_hyper_pars(d = 0, x = 0), - area_pars = DAISIE::create_area_pars( + area_pars = create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, @@ -112,7 +112,7 @@ test_that("output with empty island and verbose = TRUE", { mainland_n = mainland_n, nonoceanic_pars = c(0, 0), hyper_pars = create_hyper_pars(d = 0, x = 0), - area_pars = DAISIE::create_area_pars( + area_pars = create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, @@ -152,7 +152,7 @@ test_that("silent with non-empty 2 type island", { replicates = replicates, prop_type2_pool = prop_type2_pool, hyper_pars = create_hyper_pars(d = 0, x = 0), - area_pars = DAISIE::create_area_pars( + area_pars = create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, @@ -191,7 +191,7 @@ test_that("silent with non-empty 2 type island full stt", { prop_type2_pool = prop_type2_pool, verbose = FALSE, hyper_pars = create_hyper_pars(d = 0, x = 0), - area_pars = DAISIE::create_area_pars( + area_pars = create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, @@ -238,7 +238,7 @@ test_that("use full stt", { mainland_n = mainland_n, nonoceanic_pars = c(0, 0), hyper_pars = create_hyper_pars(d = 0, x = 0), - area_pars = DAISIE::create_area_pars( + area_pars = create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, @@ -417,7 +417,7 @@ test_that("full stt works with multiple replicates", { verbose <- FALSE sample_freq <- Inf set.seed(1) - area_pars <- DAISIE::create_area_pars( + area_pars <- create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, @@ -464,7 +464,7 @@ test_that("full stt works with empty island", { mainland_n <- 1 verbose <- FALSE sample_freq <- Inf - area_pars <- DAISIE::create_area_pars( + area_pars <- create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, @@ -528,7 +528,7 @@ test_that("full stt with two trait states", { pars = pars, mainland_n = mainland_n, hyper_pars = create_hyper_pars(d = 0, x = 0), - area_pars = DAISIE::create_area_pars( + area_pars = create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, diff --git a/tests/testthat/test-DAISIE_format_CS_full_stt.R b/tests/testthat/test-DAISIE_format_CS_full_stt.R index 61e7f43b..e87ec03b 100644 --- a/tests/testthat/test-DAISIE_format_CS_full_stt.R +++ b/tests/testthat/test-DAISIE_format_CS_full_stt.R @@ -3,7 +3,7 @@ test_that("complete stt, 1 type, no geodynamics, oceanic island, one trait state pars <- c(0.4, 0.2, 10, 2, 0.5) total_time <- 1 mainland_n <- 2 - area_pars <- DAISIE::create_area_pars( + area_pars <- create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, @@ -217,7 +217,7 @@ test_that("complete stt, 2 type, no geodynamics, oceanic island, one trait state mainland_n <- M verbose <- FALSE replicates <- 2 - area_pars <- DAISIE::create_area_pars( + area_pars <- create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, @@ -366,7 +366,7 @@ test_that("complete stt, 1 type, no geodynamics, nonoceanic, one trait state ana_rate <- 1.010073119 # anagenesis rate pars <- c(clado_rate, ext_rate, clade_carr_cap, imm_rate, ana_rate) replicates <- 3 - area_pars <- DAISIE::create_area_pars( + area_pars <- create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, @@ -415,7 +415,7 @@ test_that("complete stt, 1 type, no geodynamics, oceanic island, one trait state total_time <- 1 mainland_n <- 2 verbose <- TRUE - area_pars <- DAISIE::create_area_pars( + area_pars <- create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, @@ -502,7 +502,7 @@ test_that("complete stt, 1 type, no geodynamics, oceanic,two trait states sea_level = sea_level, extcutoff = extcutoff, hyper_pars = create_hyper_pars(d = 0, x = 0), - area_pars = DAISIE::create_area_pars( + area_pars = create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, @@ -530,7 +530,7 @@ test_that("complete stt, 1 type, no geodynamics, oceanic,two trait states sea_level = sea_level, extcutoff = extcutoff, hyper_pars = create_hyper_pars(d = 0, x = 0), - area_pars = DAISIE::create_area_pars( + area_pars = create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, @@ -560,7 +560,7 @@ test_that("when no colonization happens returns 0", { pars <- c(0.4, 0.2, 10, 0.000001, 0.5) total_time <- 1 mainland_n <- 1 - area_pars <- DAISIE::create_area_pars( + area_pars <- create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, diff --git a/tests/testthat/test-DAISIE_format_CS_sampled_stt.R b/tests/testthat/test-DAISIE_format_CS_sampled_stt.R index fb95205b..3b8637b4 100644 --- a/tests/testthat/test-DAISIE_format_CS_sampled_stt.R +++ b/tests/testthat/test-DAISIE_format_CS_sampled_stt.R @@ -5,7 +5,7 @@ test_that("sampled stt, 1 type, no geodynamics, oceanic island (same arguments mainland_n <- 1 verbose <- FALSE sample_freq <- 1 - area_pars <- DAISIE::create_area_pars( + area_pars <- create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, @@ -161,7 +161,7 @@ test_that("sampled stt, 2 type, no geodynamics, oceanic island (same arguments verbose <- FALSE replicates <- 1 sample_freq <- 25 - area_pars <- DAISIE::create_area_pars( + area_pars <- create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, @@ -242,7 +242,7 @@ test_that("sampled stt, 1 type, no geodynamics, nonoceanic (same arguments as imm_rate <- 0.00933207 # immigration rate ana_rate <- 1.010073119 # anagenesis rate pars <- c(clado_rate, ext_rate, clade_carr_cap, imm_rate, ana_rate) - area_pars <- DAISIE::create_area_pars( + area_pars <- create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, @@ -285,7 +285,7 @@ test_that("sampled stt, 1 type, no geodynamics, oceanic (same arguments as mainland_n <- 2 verbose <- FALSE sample_freq <- 25 - area_pars <- DAISIE::create_area_pars( + area_pars <- create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, diff --git a/tests/testthat/test-DAISIE_format_CS_trait.R b/tests/testthat/test-DAISIE_format_CS_trait.R index 33d4a9c9..497c2c03 100644 --- a/tests/testthat/test-DAISIE_format_CS_trait.R +++ b/tests/testthat/test-DAISIE_format_CS_trait.R @@ -40,7 +40,7 @@ test_that("sampled stt, 1 type, no geodynamics, oceanic, two trait states sea_level = sea_level, extcutoff = extcutoff, hyper_pars = create_hyper_pars(d = 0, x = 0), - area_pars = DAISIE::create_area_pars( + area_pars = create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, @@ -70,7 +70,7 @@ test_that("sampled stt, 1 type, no geodynamics, oceanic, two trait states sea_level = sea_level, extcutoff = extcutoff, hyper_pars = create_hyper_pars(d = 0, x = 0), - area_pars = DAISIE::create_area_pars( + area_pars = create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, diff --git a/tests/testthat/test-DAISIE_format_GW.R b/tests/testthat/test-DAISIE_format_GW.R index b0be75f8..d14e88dc 100644 --- a/tests/testthat/test-DAISIE_format_GW.R +++ b/tests/testthat/test-DAISIE_format_GW.R @@ -5,7 +5,7 @@ test_that("silent with empty island with correct output", { num_guilds <- 1 verbose <- FALSE sample_freq <- 1 - area_pars <- DAISIE::create_area_pars( + area_pars <- create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, @@ -56,7 +56,7 @@ test_that("silent with non-empty island with correct output", { num_guilds <- 1 verbose <- FALSE sample_freq <- 1 - area_pars <- DAISIE::create_area_pars( + area_pars <- create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, @@ -98,7 +98,7 @@ test_that("output with empty island and verbose = TRUE", { verbose <- TRUE sample_freq <- 1 set.seed(1) - area_pars <- DAISIE::create_area_pars( + area_pars <- create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, diff --git a/tests/testthat/test-DAISIE_format_IW.R b/tests/testthat/test-DAISIE_format_IW.R index 8b847091..17d43c1d 100644 --- a/tests/testthat/test-DAISIE_format_IW.R +++ b/tests/testthat/test-DAISIE_format_IW.R @@ -4,7 +4,7 @@ test_that("silent with empty island with correct output", { mainland_n <- 10 verbose <- FALSE sample_freq <- 1 - area_pars <- DAISIE::create_area_pars( + area_pars <- create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, @@ -56,7 +56,7 @@ test_that("silent with non-empty island with correct output", { mainland_n <- 10 verbose <- FALSE sample_freq <- 1 - area_pars <- DAISIE::create_area_pars( + area_pars <- create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, @@ -126,7 +126,7 @@ test_that("DAISIE_format_IW prints when verbose = TRUE", { mainland_n <- 1000 verbose <- TRUE sample_freq <- 1 - area_pars <- DAISIE::create_area_pars( + area_pars <- create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, @@ -165,7 +165,7 @@ test_that("silent with empty nonoceanic island with correct output", { nonoceanic_pars <- c(0.2, 0.5) verbose <- FALSE sample_freq <- 1 - area_pars <- DAISIE::create_area_pars( + area_pars <- create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, @@ -217,7 +217,7 @@ test_that("silent with non-empty nonoceanic island with nonoceanic_pars <- c(0.2, 0.5) verbose <- FALSE sample_freq <- 1 - area_pars <- DAISIE::create_area_pars( + area_pars <- create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, @@ -278,7 +278,7 @@ test_that("silent with non-empty nonoceanic island with nonoceanic_pars <- c(0.2, 0.5) verbose <- FALSE sample_freq <- 1 - area_pars <- DAISIE::create_area_pars( + area_pars <- create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, @@ -444,7 +444,7 @@ test_that("silent with empty island with correct output", { time = time, pars = pars, hyper_pars = create_hyper_pars(d = 0, x = 0), - area_pars = DAISIE::create_area_pars( + area_pars = create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, @@ -511,7 +511,7 @@ test_that("silent when species with two trait states with island_ontogeny = island_ontogeny, sea_level = sea_level, hyper_pars = create_hyper_pars(d = 0, x = 0), - area_pars = DAISIE::create_area_pars( + area_pars = create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, diff --git a/tests/testthat/test-DAISIE_loglik_CS.R b/tests/testthat/test-DAISIE_loglik_CS.R index 544af93a..034fe078 100644 --- a/tests/testthat/test-DAISIE_loglik_CS.R +++ b/tests/testthat/test-DAISIE_loglik_CS.R @@ -82,7 +82,7 @@ test_that("DAISIE_loglik_all produces correct output for relaxed-rate model", { skip_on_cran() utils::data(Galapagos_datalist) invisible(capture.output(suppressWarnings( - loglik <- DAISIE::DAISIE_loglik_all( + loglik <- DAISIE_loglik_all( pars1 = c(2.55068735, 2.68345455, 10.00000000, 0.00933207, 1.01007312), pars2 = c(100, 0, 0, 0, NA), datalist = Galapagos_datalist, @@ -127,7 +127,7 @@ test_that("DAISIE_loglik_all produces same output for CS_version 0 and 1 with Galapagos_datalist2[[i]]$stac <- 2 } Galapagos_datalist2 <- add_brt_table(Galapagos_datalist2) - loglik_CS00 <- DAISIE::DAISIE_loglik_all( + loglik_CS00 <- DAISIE_loglik_all( pars1 = c(2.55068735, 2.68345455, 10.00000000, 0.00933207, 1.01007312), pars2 = c(100, 11, 0, 0, NA), datalist = Galapagos_datalist2, @@ -135,7 +135,7 @@ test_that("DAISIE_loglik_all produces same output for CS_version 0 and 1 with CS_version = 0, abstolint = 1e-16, reltolint = 1e-10) - loglik_CS10 <- DAISIE::DAISIE_loglik_all( + loglik_CS10 <- DAISIE_loglik_all( pars1 = c(2.55068735, 2.68345455, 10.00000000, 0.00933207, 1.01007312), pars2 = c(100, 11, 0, 0, NA), datalist = Galapagos_datalist2, @@ -144,7 +144,7 @@ test_that("DAISIE_loglik_all produces same output for CS_version 0 and 1 with abstolint = 1e-16, reltolint = 1e-10) testthat::expect_equal(loglik_CS00, loglik_CS10, tol = 5E-6) - loglik_CS01 <- DAISIE::DAISIE_loglik_all( + loglik_CS01 <- DAISIE_loglik_all( pars1 = c(2.55068735, 2.68345455, 10.00000000, 0.00933207, 1.01007312), pars2 = c(100, 11, 1, 0, NA), datalist = Galapagos_datalist2, @@ -152,7 +152,7 @@ test_that("DAISIE_loglik_all produces same output for CS_version 0 and 1 with CS_version = 0, abstolint = 1e-16, reltolint = 1e-10) - loglik_CS11 <- DAISIE::DAISIE_loglik_all( + loglik_CS11 <- DAISIE_loglik_all( pars1 = c(2.55068735, 2.68345455, 10.00000000, 0.00933207, 1.01007312), pars2 = c(100, 11, 1, 0, NA), datalist = Galapagos_datalist2, diff --git a/tests/testthat/test-DAISIE_loglik_IW_solver.R b/tests/testthat/test-DAISIE_loglik_IW_solver.R index 723ed070..4add87b2 100644 --- a/tests/testthat/test-DAISIE_loglik_IW_solver.R +++ b/tests/testthat/test-DAISIE_loglik_IW_solver.R @@ -56,7 +56,7 @@ test_that("loglik IW various solver options give similar results", { pars1 <- c(0.2, 0.1, 1000.1, 0.001, 0.3) pars2 <- c(40, 11, 0, 0) - IW0 <- DAISIE::DAISIE_loglik_IW( + IW0 <- DAISIE_loglik_IW( pars1 = pars1, pars2 = pars2, datalist = frogs_datalist, @@ -64,7 +64,7 @@ test_that("loglik IW various solver options give similar results", { abstolint = 1E-12, reltolint = 1E-10, ) - IW1 <- DAISIE::DAISIE_loglik_IW( + IW1 <- DAISIE_loglik_IW( pars1 = pars1, pars2 = pars2, datalist = frogs_datalist, @@ -72,7 +72,7 @@ test_that("loglik IW various solver options give similar results", { abstolint = 1E-12, reltolint = 1E-10, ) - IW2 <- DAISIE::DAISIE_loglik_IW( + IW2 <- DAISIE_loglik_IW( pars1 = pars1, pars2 = pars2, datalist = frogs_datalist, @@ -80,7 +80,7 @@ test_that("loglik IW various solver options give similar results", { abstolint = 1E-12, reltolint = 1E-10, ) - IW3 <- DAISIE::DAISIE_loglik_IW( + IW3 <- DAISIE_loglik_IW( pars1 = pars1, pars2 = pars2, datalist = frogs_datalist, @@ -88,7 +88,7 @@ test_that("loglik IW various solver options give similar results", { abstolint = 1E-12, reltolint = 1E-10, ) - IW4 <- DAISIE::DAISIE_loglik_IW( + IW4 <- DAISIE_loglik_IW( pars1 = pars1, pars2 = pars2, datalist = frogs_datalist, diff --git a/tests/testthat/test-DAISIE_max_rates.R b/tests/testthat/test-DAISIE_max_rates.R index a353acd9..1971c399 100644 --- a/tests/testthat/test-DAISIE_max_rates.R +++ b/tests/testthat/test-DAISIE_max_rates.R @@ -1,7 +1,7 @@ test_that("use ontogeny", { total_time <- 1 - area_pars <- DAISIE::create_area_pars( + area_pars <- create_area_pars( max_area = 5000, current_area = 2500, proportional_peak_t = 0.5, @@ -39,7 +39,7 @@ test_that("use ontogeny", { test_that("use sea level", { total_time <- 1 - area_pars <- DAISIE::create_area_pars( + area_pars <- create_area_pars( max_area = 1000, current_area = 1, proportional_peak_t = 0, diff --git a/tests/testthat/test-DAISIE_min_rates.R b/tests/testthat/test-DAISIE_min_rates.R index 96c81631..9128a43b 100644 --- a/tests/testthat/test-DAISIE_min_rates.R +++ b/tests/testthat/test-DAISIE_min_rates.R @@ -1,7 +1,7 @@ test_that("use ontogeny", { total_time <- 1 - area_pars <- DAISIE::create_area_pars( + area_pars <- create_area_pars( max_area = 5000, current_area = 2500, proportional_peak_t = 0.5, @@ -26,7 +26,7 @@ test_that("use ontogeny", { test_that("use sea level", { total_time <- 1 - area_pars <- DAISIE::create_area_pars( + area_pars <- create_area_pars( max_area = 1000, current_area = 1000, proportional_peak_t = 0, diff --git a/tests/testthat/test-DAISIE_sim_core_cr.R b/tests/testthat/test-DAISIE_sim_core_cr.R index 3f02e2a8..51527dcc 100644 --- a/tests/testthat/test-DAISIE_sim_core_cr.R +++ b/tests/testthat/test-DAISIE_sim_core_cr.R @@ -7,7 +7,7 @@ test_that("Clean run should be silent", { carr_cap <- 4 imm_rate <- 1.0 ana_rate <- 1.0 - area_pars <- DAISIE::create_area_pars( + area_pars <- create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, @@ -31,7 +31,7 @@ test_that("Clean run should be silent", { test_that("A non-oceanic run with non-zero sampling should have native species on the island", { - area_pars <- DAISIE::create_area_pars( + area_pars <- create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, @@ -62,7 +62,7 @@ test_that("DAISIE_sim_core output is correct", { time <- 1 mainland_n <- 100 set.seed(5) - area_pars <- DAISIE::create_area_pars( + area_pars <- create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, @@ -94,7 +94,7 @@ test_that("DAISIE_sim_core output is correct", { test_that("DAISIE_sim_core with land-bridge starting at time = 0 for CS uses the second parameter set at time = 0", { - area_pars <- DAISIE::create_area_pars( + area_pars <- create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, @@ -117,7 +117,7 @@ test_that("DAISIE_sim_core with land-bridge starting at time = 0 for CS uses test_that("DAISIE_sim_core fails when pars[4] == 0 && nonoceanic_pars[1] == 0", { - area_pars <- DAISIE::create_area_pars( + area_pars <- create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, diff --git a/tests/testthat/test-DAISIE_sim_core_cr_shift.R b/tests/testthat/test-DAISIE_sim_core_cr_shift.R index eaf69087..200f496b 100644 --- a/tests/testthat/test-DAISIE_sim_core_cr_shift.R +++ b/tests/testthat/test-DAISIE_sim_core_cr_shift.R @@ -1,7 +1,7 @@ test_that("split-rate model runs silent and gives correct output", { set.seed(1) - area_pars <- DAISIE::create_area_pars( + area_pars <- create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, @@ -25,7 +25,7 @@ test_that("split-rate model runs silent and }) test_that("abuse split-rate model with time smaller than shift_times", { - area_pars <- DAISIE::create_area_pars( + area_pars <- create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, @@ -45,7 +45,7 @@ test_that("abuse split-rate model with time smaller than shift_times", { }) test_that("abuse split-rate model with gamma = 0", { - area_pars <- DAISIE::create_area_pars( + area_pars <- create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, diff --git a/tests/testthat/test-DAISIE_sim_core_trait_dep.R b/tests/testthat/test-DAISIE_sim_core_trait_dep.R index e45cee2d..1687ef8f 100644 --- a/tests/testthat/test-DAISIE_sim_core_trait_dep.R +++ b/tests/testthat/test-DAISIE_sim_core_trait_dep.R @@ -5,7 +5,7 @@ test_that("nonontogeny oceanic trait_dependnet island should run silent IW", { time = 10, mainland_n = 100, hyper_pars = create_hyper_pars(d = 0, x = 0), - area_pars = DAISIE::create_area_pars( + area_pars = create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, @@ -33,7 +33,7 @@ test_that("nonontogeny oceanic trait_dependnet island should run silent CS", { time = 10, mainland_n = 0, hyper_pars = create_hyper_pars(d = 0, x = 0), - area_pars = DAISIE::create_area_pars( + area_pars = create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, @@ -61,7 +61,7 @@ test_that("abuse NULL trait pars", { time = 10, mainland_n = 100, hyper_pars = create_hyper_pars(d = 0, x = 0), - area_pars = DAISIE::create_area_pars( + area_pars = create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, @@ -83,7 +83,7 @@ test_that("abuse NULL trait pars", { time = 10, mainland_n = 100, hyper_pars = create_hyper_pars(d = 0, x = 0), - area_pars = DAISIE::create_area_pars( + area_pars = create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, diff --git a/tests/testthat/test-DAISIE_sim_cr.R b/tests/testthat/test-DAISIE_sim_cr.R index c5053986..ae84ef15 100644 --- a/tests/testthat/test-DAISIE_sim_cr.R +++ b/tests/testthat/test-DAISIE_sim_cr.R @@ -568,7 +568,7 @@ test_that("constant rate oceanic CS prints correct output when verbose <- TRUE set.seed(1) expect_output( - sim <- DAISIE::DAISIE_sim_cr(time = total_time, + sim <- DAISIE_sim_cr(time = total_time, M = mainland_n, pars = pars, replicates = replicates, @@ -587,7 +587,7 @@ test_that("constant rate oceanic IW prints correct output when verbose <- TRUE set.seed(1) expect_output( - sim <- DAISIE::DAISIE_sim_cr(time = total_time, + sim <- DAISIE_sim_cr(time = total_time, M = mainland_n, pars = pars, replicates = replicates, @@ -672,7 +672,7 @@ test_that("2 type, no geodynamics, nonoceanic should give error", { set.seed(1) prop_type2_pool <- 0.4 nonoceanic_pars <- c(0.5, 0.5) - expect_error(DAISIE::DAISIE_sim_cr( + expect_error(DAISIE_sim_cr( time = total_time, M = M, pars = pars, diff --git a/tests/testthat/test-is_simulation_outputs.R b/tests/testthat/test-is_simulation_outputs.R index 35d780af..79177c02 100644 --- a/tests/testthat/test-is_simulation_outputs.R +++ b/tests/testthat/test-is_simulation_outputs.R @@ -8,7 +8,7 @@ test_that("use", { plot_sims = FALSE, verbose = FALSE))) - expect_true(is_simulation_outputs(DAISIE::DAISIE_sim_time_dep( + expect_true(is_simulation_outputs(DAISIE_sim_time_dep( time = 2, M = 500, pars = c(0.00001, 1, 0.05, 0.001, 1), diff --git a/tests/testthat/test-time_dep_vs_cr.R b/tests/testthat/test-time_dep_vs_cr.R index 76bef016..8751739f 100644 --- a/tests/testthat/test-time_dep_vs_cr.R +++ b/tests/testthat/test-time_dep_vs_cr.R @@ -16,7 +16,7 @@ test_that("constant rate output matches time dependent code", { imm_rate <- 1.0 ana_rate <- 1.0 pars <- c(clado_rate, ext_rate, carr_cap, imm_rate, ana_rate) - area_pars <- DAISIE::create_area_pars( + area_pars <- create_area_pars( max_area = 1, current_area = 1, proportional_peak_t = 0, @@ -25,7 +25,7 @@ test_that("constant rate output matches time dependent code", { sea_level_frequency = 0, island_gradient_angle = 0 ) - hyper_pars <- DAISIE::create_hyper_pars(d = 0, x = 0) + hyper_pars <- create_hyper_pars(d = 0, x = 0) nonoceanic_pars <- c(0, 0) rng_seed <- 42 set.seed(rng_seed) @@ -43,7 +43,7 @@ test_that("constant rate output matches time dependent code", { # Ontogeny code running constant case ----------------------------------- # We must use the core function to avoid calling calc_peak with a constant # area. - hyper_pars <- DAISIE::create_hyper_pars(d = 0, x = 0) + hyper_pars <- create_hyper_pars(d = 0, x = 0) set.seed(rng_seed) time_dep_out <- DAISIE_sim_core_time_dep( time = sim_time, From d0dfd58ceb0b532cb37c0854244b2e3d010e1663 Mon Sep 17 00:00:00 2001 From: Neves-P Date: Mon, 20 Mar 2023 17:58:43 +0100 Subject: [PATCH 11/48] Internal functions don't have example Remove ::: and :: where required Replace print() with message() in some simulations --- R/DAISIE_SR_ML_CS.R | 44 ++++++-- R/DAISIE_SR_sim.R | 17 +--- R/DAISIE_format_IW.R | 34 +------ R/DAISIE_loglik_CS.R | 2 +- R/DAISIE_max_rates.R | 57 +---------- R/DAISIE_plot_comparison_stts.R | 6 +- R/DAISIE_plot_stt.R | 9 +- R/DAISIE_rates.R | 29 +----- R/DAISIE_sim_cr_cs.R | 4 +- R/DAISIE_sim_cr_gw.R | 2 +- R/DAISIE_sim_cr_iw.R | 2 +- R/DAISIE_sim_cr_shift.R | 6 +- R/DAISIE_sim_relaxed_rate.R | 2 +- R/DAISIE_sim_time_dep_cs.R | 2 +- R/DAISIE_sim_time_dep_gw.R | 2 +- R/DAISIE_sim_time_dep_iw.R | 2 +- R/DAISIE_sim_trait_dep.R | 4 +- R/DAISIE_sim_trait_dep_2K.R | 4 +- R/DAISIE_sumstats_rates.R | 32 +----- R/DAISIE_utils.R | 12 +-- R/create_pars.R | 28 +++--- man/DAISIE_SR_ML.Rd | 44 ++++++-- man/DAISIE_SR_sim.Rd | 129 ------------------------ man/DAISIE_calc_sumstats_pcrates.Rd | 139 -------------------------- man/DAISIE_convert_to_classic_plot.Rd | 44 -------- man/DAISIE_format_IW.Rd | 99 ------------------ man/DAISIE_nonoceanic_spec.Rd | 32 ------ man/DAISIE_plot_comparison_stts.Rd | 51 ---------- man/create_area_pars.Rd | 9 +- man/create_trait_pars.Rd | 18 ++-- man/get_clado_rate_per_capita.Rd | 38 ------- man/get_ext_rate_per_capita.Rd | 34 ------- man/get_global_max_area.Rd | 83 --------------- man/get_global_min_area.Rd | 84 ---------------- man/get_immig_rate_per_capita.Rd | 34 ------- man/translate_island_ontogeny.Rd | 29 ------ man/translate_sea_level.Rd | 26 ----- 37 files changed, 125 insertions(+), 1068 deletions(-) delete mode 100644 man/DAISIE_SR_sim.Rd delete mode 100644 man/DAISIE_calc_sumstats_pcrates.Rd delete mode 100644 man/DAISIE_convert_to_classic_plot.Rd delete mode 100644 man/DAISIE_format_IW.Rd delete mode 100644 man/DAISIE_nonoceanic_spec.Rd delete mode 100644 man/DAISIE_plot_comparison_stts.Rd delete mode 100644 man/get_clado_rate_per_capita.Rd delete mode 100644 man/get_ext_rate_per_capita.Rd delete mode 100644 man/get_global_max_area.Rd delete mode 100644 man/get_global_min_area.Rd delete mode 100644 man/get_immig_rate_per_capita.Rd delete mode 100644 man/translate_island_ontogeny.Rd delete mode 100644 man/translate_sea_level.Rd diff --git a/R/DAISIE_SR_ML_CS.R b/R/DAISIE_SR_ML_CS.R index 82e62dcd..db85bd5c 100644 --- a/R/DAISIE_SR_ML_CS.R +++ b/R/DAISIE_SR_ML_CS.R @@ -163,9 +163,12 @@ DAISIE_SR_loglik_all_choosepar <- function( #' @examples #' #' \donttest{ -#' ### When all species have the same rates, and we want to optimize all 5 parameters, -#' # we use: -#' +#' ## In all following DAISIE_ML calls very high tolerances and low system size +#' ## are used for fast computation for this example. Use default or better +#' ## tol, tolint an res values in actual analyses. +#' ################## +#' ### When all species have the same rates, and we want to optimize all 5 +#' ### parameters, we use: #' utils::data(Galapagos_datalist) #' DAISIE_ML( #' datalist = Galapagos_datalist, @@ -173,7 +176,10 @@ DAISIE_SR_loglik_all_choosepar <- function( #' ddmodel = 11, #' idparsopt = 1:5, #' parsfix = NULL, -#' idparsfix = NULL +#' idparsfix = NULL, +#' tol = c(0.1, 0.02, 0.01), +#' tolint = c(1e-4, 1e-2), +#' res = 50 #' ) #' #' ### When all species have the same rates, and we want to optimize all parameters @@ -185,7 +191,10 @@ DAISIE_SR_loglik_all_choosepar <- function( #' initparsopt = c(2.5,2.7,0.009,1.01), #' idparsopt = c(1,2,4,5), #' parsfix = Inf, -#' idparsfix = 3 +#' idparsfix = 3, +#' tol = c(0.1, 0.02, 0.01), +#' tolint = c(1e-4, 1e-2), +#' res = 50 #' ) #' #' ### When all species have the same rates except that the finches have a different @@ -199,7 +208,10 @@ DAISIE_SR_loglik_all_choosepar <- function( #' idparsopt = c(1,2,4,5,6), #' parsfix = c(Inf,Inf,0.163), #' idparsfix = c(3,8,11), -#' idparsnoshift = c(7,9,10) +#' idparsnoshift = c(7,9,10), +#' tol = c(0.1, 0.02, 0.01), +#' tolint = c(1e-4, 1e-2), +#' res = 50 #' ) #' #' ### When all species have the same rates except that the finches have a different @@ -214,7 +226,10 @@ DAISIE_SR_loglik_all_choosepar <- function( #' idparsopt = c(1,2,4,5,6,7,8), #' parsfix = c(Inf,0.163), #' idparsfix = c(3,11), -#' idparsnoshift = c(9,10) +#' idparsnoshift = c(9,10), +#' tol = c(0.1, 0.02, 0.01), +#' tolint = c(1e-4, 1e-2), +#' res = 50 #' ) #' #' @@ -230,7 +245,10 @@ DAISIE_SR_loglik_all_choosepar <- function( #' idparsopt = c(1,2,4,5,7,11), #' parsfix = c(Inf,Inf), #' idparsfix = c(3,8), -#' idparsnoshift = c(6,9,10) +#' idparsnoshift = c(6,9,10), +#' tol = c(0.1, 0.02, 0.01), +#' tolint = c(1e-4, 1e-2), +#' res = 50 #' ) #' #' ### When we have two islands with the same rates except for immigration and anagenesis rate, @@ -244,7 +262,10 @@ DAISIE_SR_loglik_all_choosepar <- function( #' idparsmat = rbind(1:5,c(1:3,6,7)), #' idparsopt = 1:7, #' parsfix = NULL, -#' idparsfix = NULL +#' idparsfix = NULL, +#' tol = c(0.1, 0.02, 0.01), +#' tolint = c(1e-4, 1e-2), +#' res = 50 #' ) #' #' ### When we consider the four Macaronesia archipelagoes and set all parameters the same @@ -261,7 +282,10 @@ DAISIE_SR_loglik_all_choosepar <- function( #' idparsmat = rbind(1:5,c(6,2,3,7,5),1:5,1:5), #' idparsopt = c(2,4,5,6,7), #' parsfix = c(0,Inf), -#' idparsfix = c(1,3) +#' idparsfix = c(1,3), +#' tol = c(0.1, 0.02, 0.01), +#' tolint = c(1e-4, 1e-2), +#' res = 50 #' ) #' #' } diff --git a/R/DAISIE_SR_sim.R b/R/DAISIE_SR_sim.R index f88ba33f..8133fe9a 100644 --- a/R/DAISIE_SR_sim.R +++ b/R/DAISIE_SR_sim.R @@ -75,20 +75,7 @@ #' @references Hauffe, T., D. Delicado, R.S. Etienne and L. Valente (2020). #' Lake expansion increases equilibrium diversity via the target effect of #' island biogeography -#' @keywords internal -#' @examples -#' # Simulate 15 islands for 4 million years with a shift in immigration rate -#' # at 0.195 Ma, and plot the species-through-time plot. Pool size 296. -#' -#' pars_before_shift = c(0.079, 0.973, Inf, 0.136, 0.413) -#' pars_after_shift = c(0.079, 0.973, Inf, 0.652, 0.413) -#' tshift = 0.195 -#' island_shift_replicates = DAISIE_SR_sim( -#' time = 4, -#' M = 296, -#' pars = c(pars_before_shift, pars_after_shift, tshift), -#' replicates = 15 -#' ) +#' @noRd DAISIE_SR_sim <- function(time, M, pars, @@ -118,7 +105,7 @@ DAISIE_SR_sim <- function(time, } island_replicates[[rep]] = full_list if (verbose) - print(paste("Island replicate ", rep, sep = "")) + message("Island replicate ", rep) } island_replicates = DAISIE_format_CS( island_replicates = island_replicates, diff --git a/R/DAISIE_format_IW.R b/R/DAISIE_format_IW.R index f9509aa4..9584c632 100644 --- a/R/DAISIE_format_IW.R +++ b/R/DAISIE_format_IW.R @@ -5,39 +5,7 @@ #' #' @return List with CS DAISIE simulation output #' -#' @keywords internal -#' -#' @examples -#' island_replicates <- list() -#' island_replicates[[1]] <- DAISIE:::DAISIE_sim_core_cr( -#' time = 5, -#' mainland_n = 1000, -#' pars = c(2, 2, 40, 0.1, 1), -#' area_pars = DAISIE::create_area_pars( -#' max_area = 1, -#' current_area = 1, -#' proportional_peak_t = 0, -#' total_island_age = 0, -#' sea_level_amplitude = 0, -#' sea_level_frequency = 0, -#' island_gradient_angle = 0), -#' hyper_pars = create_hyper_pars(d = 0.2, x = 0.1), -#' nonoceanic_pars = c(0, 0) -#') -#' formatted_island_sampled <- DAISIE:::DAISIE_format_IW( -#' island_replicates = island_replicates, -#' time = 5, -#' M = 1000, -#' sample_freq = 25, -#' verbose = FALSE -#') -#' formatted_island_full <- DAISIE:::DAISIE_format_IW( -#' island_replicates = island_replicates, -#' time = 5, -#' M = 1000, -#' sample_freq = Inf, -#' verbose = FALSE -#') +#' @noRd DAISIE_format_IW <- function(island_replicates, time, M, diff --git a/R/DAISIE_loglik_CS.R b/R/DAISIE_loglik_CS.R index f290b764..c335fc07 100644 --- a/R/DAISIE_loglik_CS.R +++ b/R/DAISIE_loglik_CS.R @@ -1221,7 +1221,7 @@ DAISIE_integrate_const <- function(initprobs,tvec,rhs_func,pars,rtol,atol,method # During code coverage, 'function_as_text' may become: # # if (TRUE) { - # covr:::count("DAISIE_loglik_CS.R:58:3:58:25:3:25:4657:4657") + # covr::count("DAISIE_loglik_CS.R:58:3:58:25:3:25:4657:4657") # lx <- (length(x) - 1)/2 # } # diff --git a/R/DAISIE_max_rates.R b/R/DAISIE_max_rates.R index 45e6857e..f17d8ef7 100644 --- a/R/DAISIE_max_rates.R +++ b/R/DAISIE_max_rates.R @@ -72,33 +72,7 @@ update_max_rates <- function(gam, #' #' @return Numeric maximum area during the simulation. #' -#' @keywords internal -#' -#' @examples -#' timeval <- 1 -#' total_time <- 10 -#' area_pars <- DAISIE::create_area_pars( -#' max_area = 5000, -#' current_area = 4000, -#' proportional_peak_t = 0.5, -#' total_island_age = 15, -#' sea_level_amplitude = 0, -#' sea_level_frequency = 0, -#' island_gradient_angle = 0 -#' ) -#' island_ontogeny <- 1 -#' sea_level <- 0 -#' peak <- DAISIE:::calc_peak(total_time = total_time, area_pars = area_pars) -#' testthat::expect_silent( -#' global_max_area_time <- DAISIE:::get_global_max_area( -#' total_time = total_time, -#' peak = peak, -#' area_pars = area_pars, -#' island_ontogeny = island_ontogeny, -#' sea_level = sea_level -#' ) -#' ) -#' +#' @noRd #' @author Pedro Neves, Joshua Lambert, Shu Xie get_global_max_area <- function(total_time, area_pars, @@ -139,34 +113,7 @@ get_global_max_area <- function(total_time, #' @inheritParams default_params_doc #' #' @return Numeric with time at which area is minimum during the simulation -#' -#' @examples -#' timeval <- 1 -#' total_time <- 10 -#' area_pars <- DAISIE::create_area_pars( -#' max_area = 5000, -#' current_area = 4000, -#' proportional_peak_t = 0.5, -#' total_island_age = 15, -#' sea_level_amplitude = 0, -#' sea_level_frequency = 0, -#' island_gradient_angle = 0 -#' ) -#' island_ontogeny <- 1 -#' sea_level <- 0 -#' peak <- DAISIE:::calc_peak(total_time = total_time, area_pars = area_pars) -#' -#' testthat::expect_silent( -#' DAISIE:::get_global_min_area( -#' total_time = total_time, -#' area_pars = area_pars, -#' peak = peak, -#' island_ontogeny = island_ontogeny, -#' sea_level = sea_level -#' ) -#' ) -#' -#' @keywords internal +#' @noRd #' #' @author Pedro Neves, Joshua Lambert, Shu Xie get_global_min_area <- function(total_time, diff --git a/R/DAISIE_plot_comparison_stts.R b/R/DAISIE_plot_comparison_stts.R index 1de3c0ee..409a4c17 100644 --- a/R/DAISIE_plot_comparison_stts.R +++ b/R/DAISIE_plot_comparison_stts.R @@ -2,14 +2,12 @@ #' #' @inheritParams default_params_doc #' -#' @seealso \code{\link{DAISIE_plot_sims}}, \code{\link{DAISIE_plot_stt}}, -#' \code{\link{DAISIE_convert_to_classic_plot}} +#' @seealso \code{\link{DAISIE_plot_sims}}, \code{\link{DAISIE_plot_stt}} #' @family plotting #' @return Standard \code{\link{DAISIE_plot_stt}} with overlaid additional #' STT curves for comparison. -#' @keywords internal -#' #' @author Pedro Neves +#' @noRd DAISIE_plot_comparison_stts <- function( time, plot_lists_simulations, diff --git a/R/DAISIE_plot_stt.R b/R/DAISIE_plot_stt.R index c82b6d1a..2f0a0fc9 100644 --- a/R/DAISIE_plot_stt.R +++ b/R/DAISIE_plot_stt.R @@ -3,16 +3,9 @@ #' @inheritParams default_params_doc #' #' @seealso \code{\link{DAISIE_plot_stt}}, \code{\link{DAISIE_plot_sims}} -#' @examples -#' utils::data("islands_1type_1000reps", package = "DAISIE") -#' simulation_outuputs <- DAISIE:::DAISIE_convert_to_classic_plot( -#' islands_1type_1000reps -#' ) -#' -#' #' @return a list with wrangled data to be used for plotting STT plots with #' DAISIE_plot_stt -#' @keywords internal +#' @noRd DAISIE_convert_to_classic_plot <- function(simulation_outputs, trait_pars = NULL) { if (!is_simulation_outputs(simulation_outputs)) { diff --git a/R/DAISIE_rates.R b/R/DAISIE_rates.R index 77586314..ee8a574c 100644 --- a/R/DAISIE_rates.R +++ b/R/DAISIE_rates.R @@ -283,14 +283,7 @@ island_area <- function(timeval, #' @inheritParams default_params_doc #' #' @return Numeric with per capita extinction rate, given A(t), x, and mu0. -#' @keywords internal -#' -#' @examples -#' ext_rate_per_capita <- DAISIE:::get_ext_rate_per_capita( -#' mu = 0.5, -#' x = 1, -#' A = 1000 -#' ) +#' @noRd get_ext_rate_per_capita <- function(mu, x, extcutoff = 1000, @@ -404,15 +397,7 @@ get_ana_rate <- function(laa, #' #' @return Numeric with the per-capita cladogenesis rate given a base #' cladogenesis rate, K, A and the d hyperparameter. -#' @keywords internal -#' -#' @examples -#' lac <- 0.4 -#' d <- 0 -#' num_spec <- 2 -#' K <- 10 -#' A <- 1 -#' clado_rate_pc <- DAISIE:::get_clado_rate_per_capita(lac, d, num_spec, K, A) +#' @noRd get_clado_rate_per_capita <- function(lac, d, num_spec, @@ -494,15 +479,7 @@ get_clado_rate <- function(lac, #' @inheritParams default_params_doc #' #' @return A numeric with the per-capita immigration rate given A(t) and K. -#' @keywords internal -#' -#' @examples -#' immig_rate_per_capita <- DAISIE:::get_immig_rate_per_capita( -#' gam = 0.001, -#' num_spec = 5, -#' K = 20, -#' A = 1000 -#' ) +#' @noRd get_immig_rate_per_capita <- function(gam, num_spec, K, diff --git a/R/DAISIE_sim_cr_cs.R b/R/DAISIE_sim_cr_cs.R index 7e6e4839..d43bf2ce 100644 --- a/R/DAISIE_sim_cr_cs.R +++ b/R/DAISIE_sim_cr_cs.R @@ -44,7 +44,7 @@ DAISIE_sim_cr_cs <- function(total_time, } island_replicates[[rep]] <- full_list if (verbose == TRUE) { - print(paste("Island replicate ", rep, sep = "")) + message("Island replicate ", rep) } } } else if (length(pars) == 10) { @@ -113,7 +113,7 @@ DAISIE_sim_cr_cs <- function(total_time, } island_replicates[[rep]] <- full_list if (verbose == TRUE) { - print(paste("Island replicate ", rep, sep = "")) + message("Island replicate ", rep) } } } diff --git a/R/DAISIE_sim_cr_gw.R b/R/DAISIE_sim_cr_gw.R index 072224f5..5c0aeab0 100644 --- a/R/DAISIE_sim_cr_gw.R +++ b/R/DAISIE_sim_cr_gw.R @@ -37,7 +37,7 @@ DAISIE_sim_cr_gw <- function(total_time, } island_replicates[[rep]] <- full_list if (verbose == TRUE) { - print(paste("Island replicate ", rep, sep = "")) + message("Island replicate ", rep) } } island_replicates <- DAISIE_format_GW( diff --git a/R/DAISIE_sim_cr_iw.R b/R/DAISIE_sim_cr_iw.R index d2db9bad..0769782e 100644 --- a/R/DAISIE_sim_cr_iw.R +++ b/R/DAISIE_sim_cr_iw.R @@ -36,7 +36,7 @@ DAISIE_sim_cr_iw <- function(total_time, number_present <- length(present) } if (verbose == TRUE) { - print(paste("Island replicate ", rep, sep = "")) + message("Island replicate ", rep) } } island_replicates <- DAISIE_format_IW( diff --git a/R/DAISIE_sim_cr_shift.R b/R/DAISIE_sim_cr_shift.R index 3b1741c5..3bbea482 100644 --- a/R/DAISIE_sim_cr_shift.R +++ b/R/DAISIE_sim_cr_shift.R @@ -105,7 +105,7 @@ DAISIE_sim_cr_shift <- function( shift_times = shift_times ) if (verbose == TRUE) { - print(paste("Island replicate ", rep, sep = "")) + message("Island replicate ", rep) } } island_replicates <- DAISIE_format_IW(island_replicates = island_replicates, @@ -141,7 +141,7 @@ DAISIE_sim_cr_shift <- function( } island_replicates[[rep]] <- full_list if (verbose == TRUE) { - print(paste("Island replicate ", rep, sep = "")) + message("Island replicate ", rep) } } island_replicates <- DAISIE_format_CS( @@ -176,7 +176,7 @@ DAISIE_sim_cr_shift <- function( } island_replicates[[rep]] <- full_list if (verbose == TRUE) { - print(paste("Island replicate ", rep, sep = "")) + message("Island replicate ", rep) } } island_replicates <- DAISIE_format_GW(island_replicates = island_replicates, diff --git a/R/DAISIE_sim_relaxed_rate.R b/R/DAISIE_sim_relaxed_rate.R index 1c2271df..451632d6 100644 --- a/R/DAISIE_sim_relaxed_rate.R +++ b/R/DAISIE_sim_relaxed_rate.R @@ -149,7 +149,7 @@ DAISIE_sim_relaxed_rate <- function( } island_replicates[[rep]] <- full_list if (verbose == TRUE) { - print(paste("Island replicate ", rep, sep = "")) + message("Island replicate ", rep) } } island_replicates <- DAISIE_format_CS( diff --git a/R/DAISIE_sim_time_dep_cs.R b/R/DAISIE_sim_time_dep_cs.R index 61991812..d54814ba 100644 --- a/R/DAISIE_sim_time_dep_cs.R +++ b/R/DAISIE_sim_time_dep_cs.R @@ -53,7 +53,7 @@ DAISIE_sim_time_dep_cs <- function(total_time, } island_replicates[[rep]] <- full_list if (verbose == TRUE) { - print(paste("Island replicate ", rep, sep = "")) + message("Island replicate ", rep) } } island_replicates <- DAISIE_format_CS( diff --git a/R/DAISIE_sim_time_dep_gw.R b/R/DAISIE_sim_time_dep_gw.R index ccd57bcd..4891b7eb 100644 --- a/R/DAISIE_sim_time_dep_gw.R +++ b/R/DAISIE_sim_time_dep_gw.R @@ -49,7 +49,7 @@ DAISIE_sim_time_dep_gw <- function(total_time, } island_replicates[[rep]] <- full_list if (verbose == TRUE) { - print(paste("Island replicate ", rep, sep = "")) + message("Island replicate ", rep) } } island_replicates <- DAISIE_format_GW( diff --git a/R/DAISIE_sim_time_dep_iw.R b/R/DAISIE_sim_time_dep_iw.R index 18863a2b..bd91a10b 100644 --- a/R/DAISIE_sim_time_dep_iw.R +++ b/R/DAISIE_sim_time_dep_iw.R @@ -48,7 +48,7 @@ DAISIE_sim_time_dep_iw <- function(total_time, number_present <- length(present) } if (verbose == TRUE) { - print(paste("Island replicate ", rep, sep = "")) + message("Island replicate ", rep) } } island_replicates <- DAISIE_format_IW( diff --git a/R/DAISIE_sim_trait_dep.R b/R/DAISIE_sim_trait_dep.R index 4beeb503..4f575444 100644 --- a/R/DAISIE_sim_trait_dep.R +++ b/R/DAISIE_sim_trait_dep.R @@ -91,7 +91,7 @@ DAISIE_sim_trait_dep <- function( trait_pars = trait_pars ) if (verbose == TRUE) { - print(paste("Island replicate ", rep, sep = "")) + message("Island replicate ", rep) } } island_replicates <- DAISIE_format_IW( @@ -168,7 +168,7 @@ DAISIE_sim_trait_dep <- function( } island_replicates[[rep]] <- full_list if (verbose == TRUE) { - print(paste("Island replicate ", rep, sep = "")) + message("Island replicate ", rep) } } island_replicates <- DAISIE_format_CS( diff --git a/R/DAISIE_sim_trait_dep_2K.R b/R/DAISIE_sim_trait_dep_2K.R index 5496884e..24e98a5a 100644 --- a/R/DAISIE_sim_trait_dep_2K.R +++ b/R/DAISIE_sim_trait_dep_2K.R @@ -92,7 +92,7 @@ DAISIE_sim_trait_dep_2K <- function( trait_pars = trait_pars ) if (verbose == TRUE) { - print(paste("Island replicate ", rep, sep = "")) + message("Island replicate ", rep) } } island_replicates <- DAISIE_format_IW( @@ -171,7 +171,7 @@ DAISIE_sim_trait_dep_2K <- function( } island_replicates[[rep]] <- full_list if (verbose == TRUE) { - print(paste("Island replicate ", rep, sep = "")) + message("Island replicate ", rep) } } island_replicates <- DAISIE_format_CS( diff --git a/R/DAISIE_sumstats_rates.R b/R/DAISIE_sumstats_rates.R index ae9ebdc6..062945e3 100644 --- a/R/DAISIE_sumstats_rates.R +++ b/R/DAISIE_sumstats_rates.R @@ -5,38 +5,8 @@ #' #' @inheritParams default_params_doc #' @author Pedro Neves -#' @keywords internal +#' @noRd #' @return A named list with mean and median values of specified parameters -#' @examples -#' pars <- c(0.01, 1, 20, 0.01, 1) -#' area_pars <- create_area_pars( -#' max_area = 13500, -#' current_area = 3500, -#' proportional_peak_t = 0.1, -#' total_island_age = 15, -#' sea_level_amplitude = 0, -#' sea_level_frequency = 0, -#' island_gradient_angle = 0 -#' ) -#' hyper_pars <- create_hyper_pars(d = 0.2, x = 0.1) -#' island_ontogeny <- 1 -#' sea_level <- 0 -#' extcutoff <- 1100 -#' resol <- 100 -#' total_time <- 10 -#' mainland_n <- 1000 -#' -#' mean_med <- DAISIE:::DAISIE_calc_sumstats_pcrates( -#' pars = pars, -#' total_time = total_time, -#' area_pars = area_pars, -#' hyper_pars = hyper_pars, -#' island_ontogeny = island_ontogeny, -#' sea_level = sea_level, -#' extcutoff = extcutoff, -#' mainland_n = mainland_n, -#' resol = resol -#' ) DAISIE_calc_sumstats_pcrates <- function( pars, total_time, diff --git a/R/DAISIE_utils.R b/R/DAISIE_utils.R index 8c34aa30..fec14011 100644 --- a/R/DAISIE_utils.R +++ b/R/DAISIE_utils.R @@ -279,8 +279,7 @@ sample_relaxed_rate <- function(pars, #' @inheritParams default_params_doc #' #' @return Numeric, 0 for null-ontogeny, 1 for beta function -#' @keywords internal -#' @examples translated_ontogeny <- DAISIE:::translate_island_ontogeny("const") +#' @noRd translate_island_ontogeny <- function(island_ontogeny) { if (island_ontogeny == "const" || island_ontogeny == 0) { @@ -297,8 +296,7 @@ translate_island_ontogeny <- function(island_ontogeny) { #' @inheritParams default_params_doc #' #' @return Numeric, 0 for null-sea-level, 1 for sine function -#' @keywords internal -#' @examples translated_sea_level <- DAISIE:::translate_sea_level("const") +#' @noRd translate_sea_level <- function(sea_level) { if (sea_level == "const" || sea_level == 0) { @@ -321,11 +319,7 @@ translate_sea_level <- function(sea_level) { #' #' @return A list of non-endemic species, endemic species and the new #' mainland species pool -#' @examples DAISIE:::DAISIE_nonoceanic_spec( -#' prob_samp = 0.1, -#' prob_nonend = 0.9, -#' mainland_n = 1000) -#' @keywords internal +#' @noRd DAISIE_nonoceanic_spec <- function(prob_samp, prob_nonend, mainland_n) { testit::assert(prob_samp <= 1) testit::assert(prob_samp >= 0) diff --git a/R/create_pars.R b/R/create_pars.R index 19eac88e..56a022bb 100644 --- a/R/create_pars.R +++ b/R/create_pars.R @@ -33,10 +33,8 @@ create_pars <- function(clado_rate, #' @export #' @author Richel J.C Bilderbeek, Joshua Lambert, Pedro Neves #' -#' #' @examples -#' testit::assert(DAISIE:::are_area_pars( -#' create_area_pars( +#' area_pars <- create_area_pars( #' max_area = 10, #' current_area = 1, #' proportional_peak_t = 0.5, @@ -44,9 +42,9 @@ create_pars <- function(clado_rate, #' sea_level_amplitude = 5, #' sea_level_frequency = 10, #' island_gradient_angle = 0 -#' ) -#' ) -#' ) +#' +#' +#' ) create_area_pars <- function(max_area, current_area, proportional_peak_t, @@ -105,15 +103,15 @@ create_hyper_pars <- function(d, x) { #' @export #' #' @examples -#' testit::assert(DAISIE:::are_trait_pars( -#' create_trait_pars( -#' trans_rate = 0.5, -#' immig_rate2 = 0.1, -#' ext_rate2 = 0.2, -#' ana_rate2 = 0.3, -#' clado_rate2 = 0.4, -#' trans_rate2 = 0.5, -#' M2 = 1000)) == TRUE) +#' trait_pars <- create_trait_pars( +#' trans_rate = 0.5, +#' immig_rate2 = 0.1, +#' ext_rate2 = 0.2, +#' ana_rate2 = 0.3, +#' clado_rate2 = 0.4, +#' trans_rate2 = 0.5, +#' M2 = 1000 +#' ) create_trait_pars <- function(trans_rate, immig_rate2, ext_rate2, diff --git a/man/DAISIE_SR_ML.Rd b/man/DAISIE_SR_ML.Rd index d1a3fc9a..f4e0f720 100644 --- a/man/DAISIE_SR_ML.Rd +++ b/man/DAISIE_SR_ML.Rd @@ -167,9 +167,12 @@ used, otherwise the information in the data is overruled. \examples{ \donttest{ -### When all species have the same rates, and we want to optimize all 5 parameters, -# we use: - +## In all following DAISIE_ML calls very high tolerances and low system size +## are used for fast computation for this example. Use default or better +## tol, tolint an res values in actual analyses. +################## +### When all species have the same rates, and we want to optimize all 5 +### parameters, we use: utils::data(Galapagos_datalist) DAISIE_ML( datalist = Galapagos_datalist, @@ -177,7 +180,10 @@ DAISIE_ML( ddmodel = 11, idparsopt = 1:5, parsfix = NULL, - idparsfix = NULL + idparsfix = NULL, + tol = c(0.1, 0.02, 0.01), + tolint = c(1e-4, 1e-2), + res = 50 ) ### When all species have the same rates, and we want to optimize all parameters @@ -189,7 +195,10 @@ DAISIE_ML( initparsopt = c(2.5,2.7,0.009,1.01), idparsopt = c(1,2,4,5), parsfix = Inf, - idparsfix = 3 + idparsfix = 3, + tol = c(0.1, 0.02, 0.01), + tolint = c(1e-4, 1e-2), + res = 50 ) ### When all species have the same rates except that the finches have a different @@ -203,7 +212,10 @@ DAISIE_ML( idparsopt = c(1,2,4,5,6), parsfix = c(Inf,Inf,0.163), idparsfix = c(3,8,11), - idparsnoshift = c(7,9,10) + idparsnoshift = c(7,9,10), + tol = c(0.1, 0.02, 0.01), + tolint = c(1e-4, 1e-2), + res = 50 ) ### When all species have the same rates except that the finches have a different @@ -218,7 +230,10 @@ DAISIE_ML( idparsopt = c(1,2,4,5,6,7,8), parsfix = c(Inf,0.163), idparsfix = c(3,11), - idparsnoshift = c(9,10) + idparsnoshift = c(9,10), + tol = c(0.1, 0.02, 0.01), + tolint = c(1e-4, 1e-2), + res = 50 ) @@ -234,7 +249,10 @@ DAISIE_ML( idparsopt = c(1,2,4,5,7,11), parsfix = c(Inf,Inf), idparsfix = c(3,8), - idparsnoshift = c(6,9,10) + idparsnoshift = c(6,9,10), + tol = c(0.1, 0.02, 0.01), + tolint = c(1e-4, 1e-2), + res = 50 ) ### When we have two islands with the same rates except for immigration and anagenesis rate, @@ -248,7 +266,10 @@ DAISIE_ML( idparsmat = rbind(1:5,c(1:3,6,7)), idparsopt = 1:7, parsfix = NULL, - idparsfix = NULL + idparsfix = NULL, + tol = c(0.1, 0.02, 0.01), + tolint = c(1e-4, 1e-2), + res = 50 ) ### When we consider the four Macaronesia archipelagoes and set all parameters the same @@ -265,7 +286,10 @@ DAISIE_ML( idparsmat = rbind(1:5,c(6,2,3,7,5),1:5,1:5), idparsopt = c(2,4,5,6,7), parsfix = c(0,Inf), - idparsfix = c(1,3) + idparsfix = c(1,3), + tol = c(0.1, 0.02, 0.01), + tolint = c(1e-4, 1e-2), + res = 50 ) } diff --git a/man/DAISIE_SR_sim.Rd b/man/DAISIE_SR_sim.Rd deleted file mode 100644 index 2ec366be..00000000 --- a/man/DAISIE_SR_sim.Rd +++ /dev/null @@ -1,129 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/DAISIE_SR_sim.R -\name{DAISIE_SR_sim} -\alias{DAISIE_SR_sim} -\title{DEPRECATED - Simulate islands with given parameters.} -\usage{ -DAISIE_SR_sim( - time, - M, - pars, - replicates, - sample_freq = 25, - plot_sims = TRUE, - ddep = 11, - verbose = FALSE, - ... -) -} -\arguments{ -\item{time}{Length of the simulation in time units. For example, if an -island is know to be 4 million years old, setting time = 4 will simulate -entire life span of the island; setting time = 2 will stop the simulation at -the mid-life of the island.} - -\item{M}{The size of the mainland pool, i.e the number of species that can -potentially colonize the island} - -\item{pars}{Contains the model parameters: \cr \cr \code{pars[1]} -corresponds to lambda^c (cladogenesis rate) before the shift \cr \code{pars[2]} corresponds -to mu (extinction rate) before the shift \cr \code{pars[3]} corresponds to K (clade-level -carrying capacity) before the shift. Set K=Inf for non-diversity dependence.\cr -\code{pars[4]} corresponds to gamma (immigration rate) before the shift \cr \code{pars[5]} -corresponds to lambda^a (anagenesis rate) before the shift \cr \code{pars[6]} corresponds to -lambda^c (cladogenesis rate) after the shift \cr \code{pars[7]} -corresponds to mu (extinction rate) after the shift \cr \code{pars[8]} -corresponds to K (clade-level carrying capacity) after the shift. Set -K=Inf for non-diversity dependence. \cr \code{pars[9]} corresponds to gamma -(immigration rate) after the shift \cr \code{pars[10]} corresponds to -lambda^a (anagenesis rate) after the shift \cr \code{pars[11]} corresponds to -the time of shift. This is defined as time before the end of the simulation. For example, -setting time = 4 and pars[11] = 1.5 will simulate with pars[1:5] from 4 to 1.5 and -with pars[6:10] from 1.5 to 0.} - -\item{replicates}{Number of island replicates to be simulated.} - -\item{sample_freq}{Specifies the number of units time should be divided by -for plotting purposes. Larger values will lead to plots with higher -resolution, but will also run slower.} - -\item{plot_sims}{Default=TRUE plots species-through-time (STT) plots. It -detects how many types of species are present. If only one type of species -is present, STT is plotted for all species. If two types are present, three -plots are produced: STT for all, STT for type 1 and STT for type 2.} - -\item{ddep}{= diversity-dependent model,mode of diversity-dependence \cr \cr -\code{ddep == 0} no diversity-dependence -\code{ddep == 1} linear dependence in speciation rate (anagenesis and cladogenesis) -\code{ddep == 11} linear dependence in speciation rate and immigration rate -\code{ddep == 3} linear dependence in extinction rate} - -\item{verbose}{\code{Default=TRUE} Give intermediate output, also if -everything goes OK.} - -\item{...}{Any arguments to pass on to plotting functions.} -} -\value{ -Each simulated dataset is an element of the list, which can be -called using [[x]]. For example if the object is called island_replicates, -the 1st replicate can be called using island_replicates[[1]] Each of the -island replicates is a list in itself. The first (e.g. -island_replicates[[x]][[1]]) element of that list has the following -components: \cr \code{$island_age} - the island age \cr Then, we have:\cr \code{$not_present} -- the number of mainland lineages that are not present on the island \cr -\code{$stt_all} - STT table for all species on the island (nI - number of -non-endemic species; nA - number of anagenetic species, nC - number of -cladogenetic species, present - number of independent colonisations present)\cr -The subsequent elements of the list each contain information on a single -colonist lineage on the island and has 4 components:\cr -\code{$branching_times} - island age and stem age of the population/species -in the case of Non-endemic, Non-endemic_MaxAge and Endemic anagenetic -species. For cladogenetic species these should be island age and branching -times of the radiation including the stem age of the radiation.\cr -\code{$stac} - the status of the colonist \cr * Non_endemic_MaxAge: 1 \cr * -Endemic: 2 \cr * Endemic&Non_Endemic: 3 \cr * Non_endemic: 4 \cr -\code{$missing_species} - number of island species that were not sampled for -particular clade (only applicable for endemic clades) \cr \code{$type_1or2} -- whether the colonist belongs to type 1 or type 2 \cr -} -\description{ -This function simulates islands with given cladogenesis, extinction, Kprime, -immigration and anagenesis parameters that shift at some time. -Runs the function with clade-specific -carrying capacity, where diversity-dependence operates only within single -clades, i.e. only among species originating from the same mainland -colonist. - -Returns R list object that contains the simulated islands. -} -\details{ -This function's use has been deprecated in favor -of \code{\link{DAISIE_sim_cr_shift}()}. Please use that -function instead. -} -\examples{ -# Simulate 15 islands for 4 million years with a shift in immigration rate -# at 0.195 Ma, and plot the species-through-time plot. Pool size 296. - -pars_before_shift = c(0.079, 0.973, Inf, 0.136, 0.413) -pars_after_shift = c(0.079, 0.973, Inf, 0.652, 0.413) -tshift = 0.195 -island_shift_replicates = DAISIE_SR_sim( - time = 4, - M = 296, - pars = c(pars_before_shift, pars_after_shift, tshift), - replicates = 15 - ) -} -\references{ -Hauffe, T., D. Delicado, R.S. Etienne and L. Valente (2020). -Lake expansion increases equilibrium diversity via the target effect of -island biogeography -} -\seealso{ -\code{\link{DAISIE_plot_sims}()} -} -\author{ -Luis Valente, Albert Phillimore, and Torsten Hauffe -} -\keyword{internal} diff --git a/man/DAISIE_calc_sumstats_pcrates.Rd b/man/DAISIE_calc_sumstats_pcrates.Rd deleted file mode 100644 index 28001417..00000000 --- a/man/DAISIE_calc_sumstats_pcrates.Rd +++ /dev/null @@ -1,139 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/DAISIE_sumstats_rates.R -\name{DAISIE_calc_sumstats_pcrates} -\alias{DAISIE_calc_sumstats_pcrates} -\title{Calculate summary statistics of per capita rates} -\usage{ -DAISIE_calc_sumstats_pcrates( - pars, - total_time, - area_pars, - hyper_pars, - island_ontogeny = 1, - sea_level = 0, - extcutoff = 100, - mainland_n = 1000, - resol = 100 -) -} -\arguments{ -\item{pars}{A numeric vector containing the model parameters: -\itemize{ - \item{\code{pars[1]}: lambda^c (cladogenesis rate)} - \item{\code{pars[2]}: mu (extinction rate)} - \item{\code{pars[3]}: K (carrying capacity), set K=Inf for diversity - independence.} - \item{\code{pars[4]}: gamma (immigration rate)} - \item{\code{pars[5]}: lambda^a (anagenesis rate)} - \item{\code{pars[6]}: lambda^c (cladogenesis rate) for either type 2 species - or rate set 2 in rate shift model} - \item{\code{pars[7]}: mu (extinction rate) for either type 2 species or rate - set 2 in rate shift model} - \item{\code{pars[8]}: K (carrying capacity) for either type 2 species or rate - set 2 in rate shift model, set K=Inf for diversity independence.} - \item{\code{pars[9]}: gamma (immigration rate) for either type 2 species - or rate set 2 in rate shift model} - \item{\code{pars[10]}: lambda^a (anagenesis rate) for either type 2 - species or rate set 2 in rate shift model} -} -Elements 6:10 are required only when type 2 species are included -or in the rate shift model. For \code{\link{DAISIE_sim_relaxed_rate}()} -\code{pars[6]} is the standard deviation of the gamma distribution for the -relaxed parameter and the parameter chosen by the \code{relaxed_par} -argument is the mean of the gamma distribution for the relaxed parameter.} - -\item{total_time}{Numeric defining the length of the simulation in time -units.} - -\item{area_pars}{A named list containing area and sea level parameters as -created by \code{\link{create_area_pars}()}: -\itemize{ - \item{[1]: maximum area} - \item{[2]: current area} - \item{[3]: value from 0 to 1 indicating where in the island's history the - peak area is achieved} - \item{[4]: total island age} - \item{[5]: amplitude of area fluctuation from sea level} - \item{[6]: frequency of sine wave of area change from sea level} - \item{[7]: angle of the slope of the island} -}} - -\item{hyper_pars}{A named list of numeric hyperparameters for the rate -calculations as returned by \code{\link{create_hyper_pars}()}: -\itemize{ - \item{[1]: is d the scaling parameter for exponent for calculating - cladogenesis rate} - \item{[2]: is x the exponent for calculating extinction rate} -}} - -\item{island_ontogeny}{In \code{\link{DAISIE_sim_time_dep}()}, -\code{\link{DAISIE_ML_CS}} and plotting a string describing the type of -island ontogeny. Can be \code{"const"}, \code{"beta"} for a beta function -describing area through time. \cr In all other functions a -numeric describing the type of island ontogeny. Can be \code{0} for -constant, \code{1} for a beta function describing area through time. In ML -functions \code{island_ontogeny = NA} assumes constant ontogeny. Time -dependent estimation is not yet available as development is still ongoing. -Will return an error if called in that case.} - -\item{sea_level}{In \code{\link{DAISIE_sim_time_dep}()} and plotting a -string describing the type of sea level. Can be \code{"const"} or -\code{"sine"} for a sine function describing area through time. -\cr In all other functions a numeric describing the type of sea level. Can -be \code{0} for constant, \code{1} for a sine function describing area -through time.} - -\item{extcutoff}{A numeric with the cutoff for the the maximum extinction -rate preventing it from being too large and slowing down simulation.} - -\item{mainland_n}{A numeric stating the number of mainland species, that -is the number of species that can potentially colonize the island. -If using a clade-specific diversity dependence, this value is set to 1. -If using an island-wide diversity dependence, this value is set to the -number of mainland species.} - -\item{resol}{numeric for resolution of summary stats calculation. Should be -> 1.} -} -\value{ -A named list with mean and median values of specified parameters -} -\description{ -Calculates the summary statistics of per capita rates throught an ontogeny -simulation -} -\examples{ -pars <- c(0.01, 1, 20, 0.01, 1) -area_pars <- create_area_pars( - max_area = 13500, - current_area = 3500, - proportional_peak_t = 0.1, - total_island_age = 15, - sea_level_amplitude = 0, - sea_level_frequency = 0, - island_gradient_angle = 0 -) -hyper_pars <- create_hyper_pars(d = 0.2, x = 0.1) -island_ontogeny <- 1 -sea_level <- 0 -extcutoff <- 1100 -resol <- 100 -total_time <- 10 -mainland_n <- 1000 - -mean_med <- DAISIE:::DAISIE_calc_sumstats_pcrates( - pars = pars, - total_time = total_time, - area_pars = area_pars, - hyper_pars = hyper_pars, - island_ontogeny = island_ontogeny, - sea_level = sea_level, - extcutoff = extcutoff, - mainland_n = mainland_n, - resol = resol -) -} -\author{ -Pedro Neves -} -\keyword{internal} diff --git a/man/DAISIE_convert_to_classic_plot.Rd b/man/DAISIE_convert_to_classic_plot.Rd deleted file mode 100644 index 01a2872d..00000000 --- a/man/DAISIE_convert_to_classic_plot.Rd +++ /dev/null @@ -1,44 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/DAISIE_plot_stt.R -\name{DAISIE_convert_to_classic_plot} -\alias{DAISIE_convert_to_classic_plot} -\title{Prepare input for DAISIE_stt} -\usage{ -DAISIE_convert_to_classic_plot(simulation_outputs, trait_pars = NULL) -} -\arguments{ -\item{simulation_outputs}{A list with matrices and vectors of simulation -produced by DAISIE_sim functions.} - -\item{trait_pars}{A named list containing diversification rates considering - two trait states created by \code{\link{create_trait_pars}}: -\itemize{ - \item{[1]:A numeric with the per capita transition rate with state1} - \item{[2]:A numeric with the per capita immigration rate with state2} - \item{[3]:A numeric with the per capita extinction rate with state2} - \item{[4]:A numeric with the per capita anagenesis rate with state2} - \item{[5]:A numeric with the per capita cladogenesis rate with state2} - \item{[6]:A numeric with the per capita transition rate with state2} - \item{[7]:A numeric with the number of species with trait state 2 on - mainland} -}} -} -\value{ -a list with wrangled data to be used for plotting STT plots with -DAISIE_plot_stt -} -\description{ -Prepare input for DAISIE_stt -} -\examples{ -utils::data("islands_1type_1000reps", package = "DAISIE") -simulation_outuputs <- DAISIE:::DAISIE_convert_to_classic_plot( -islands_1type_1000reps -) - - -} -\seealso{ -\code{\link{DAISIE_plot_stt}}, \code{\link{DAISIE_plot_sims}} -} -\keyword{internal} diff --git a/man/DAISIE_format_IW.Rd b/man/DAISIE_format_IW.Rd deleted file mode 100644 index 75b1972b..00000000 --- a/man/DAISIE_format_IW.Rd +++ /dev/null @@ -1,99 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/DAISIE_format_IW.R -\name{DAISIE_format_IW} -\alias{DAISIE_format_IW} -\title{Formats island-wide simulation output into -standard DAISIE list output} -\usage{ -DAISIE_format_IW( - island_replicates, - time, - M, - sample_freq = 25, - verbose = TRUE, - trait_pars = NULL -) -} -\arguments{ -\item{island_replicates}{List output from -\code{\link{DAISIE_sim_core_cr}()}, -\code{\link{DAISIE_sim_core_time_dep}()}, -\code{\link{DAISIE_sim_core_cr_shift}()} or -\code{\link{DAISIE_sim_min_type2}()} functions. Minimally, this must be a -list that has as many elements as replicates. Each element must be a list -with the elements \code{island_age}, \code{not_present} and \code{stt_all}. -\code{stt_all} must be a data frame with the column names \code{Time}, -\code{nI}, \code{nA}, \code{nC} and \code{present}.} - -\item{time}{Numeric defining the length of the simulation in time units. -For example, if an island is known to be 4 million years old, setting -time = 4 will simulate the entire life span of the island; setting time = 2 -will stop the simulation at the mid-life of the island.} - -\item{M}{Numeric defining the size of mainland pool, i.e. the number of -species that can potentially colonize the island.} - -\item{sample_freq}{Numeric specifing the number of units times should be -divided by for plotting purposes. Larger values will lead to plots with -higher resolution, but will also run slower.} - -\item{verbose}{In simulation and dataprep functions a logical, -\code{Default = TRUE} gives intermediate output should be printed. -For ML functions a numeric determining if intermediate output should be -printed, \code{Default = 0} does not print, \code{verbose = 1} prints -intermediate output of the parameters and loglikelihood, \code{verbose = 2} -means also intermediate progress during loglikelihood computation is shown.} - -\item{trait_pars}{A named list containing diversification rates considering - two trait states created by \code{\link{create_trait_pars}}: -\itemize{ - \item{[1]:A numeric with the per capita transition rate with state1} - \item{[2]:A numeric with the per capita immigration rate with state2} - \item{[3]:A numeric with the per capita extinction rate with state2} - \item{[4]:A numeric with the per capita anagenesis rate with state2} - \item{[5]:A numeric with the per capita cladogenesis rate with state2} - \item{[6]:A numeric with the per capita transition rate with state2} - \item{[7]:A numeric with the number of species with trait state 2 on - mainland} -}} -} -\value{ -List with CS DAISIE simulation output -} -\description{ -Formats island-wide simulation output into -standard DAISIE list output -} -\examples{ -island_replicates <- list() -island_replicates[[1]] <- DAISIE:::DAISIE_sim_core_cr( - time = 5, - mainland_n = 1000, - pars = c(2, 2, 40, 0.1, 1), - area_pars = DAISIE::create_area_pars( - max_area = 1, - current_area = 1, - proportional_peak_t = 0, - total_island_age = 0, - sea_level_amplitude = 0, - sea_level_frequency = 0, - island_gradient_angle = 0), - hyper_pars = create_hyper_pars(d = 0.2, x = 0.1), - nonoceanic_pars = c(0, 0) -) -formatted_island_sampled <- DAISIE:::DAISIE_format_IW( - island_replicates = island_replicates, - time = 5, - M = 1000, - sample_freq = 25, - verbose = FALSE -) -formatted_island_full <- DAISIE:::DAISIE_format_IW( - island_replicates = island_replicates, - time = 5, - M = 1000, - sample_freq = Inf, - verbose = FALSE -) -} -\keyword{internal} diff --git a/man/DAISIE_nonoceanic_spec.Rd b/man/DAISIE_nonoceanic_spec.Rd deleted file mode 100644 index 57d9a1d4..00000000 --- a/man/DAISIE_nonoceanic_spec.Rd +++ /dev/null @@ -1,32 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/DAISIE_utils.R -\name{DAISIE_nonoceanic_spec} -\alias{DAISIE_nonoceanic_spec} -\title{Calculates the species on the island initially when \code{nonoceanic_pars[1] -!= 0}} -\usage{ -DAISIE_nonoceanic_spec(prob_samp, prob_nonend, mainland_n) -} -\arguments{ -\item{prob_samp}{probability of a species being sampled -from the mainland pool} - -\item{prob_nonend}{probability of a species sampled being non-endemic} - -\item{mainland_n}{number of species in the mainland pool} -} -\value{ -A list of non-endemic species, endemic species and the new -mainland species pool -} -\description{ -Calculates the species on the island initially when \code{nonoceanic_pars[1] -!= 0} -} -\examples{ -DAISIE:::DAISIE_nonoceanic_spec( -prob_samp = 0.1, -prob_nonend = 0.9, -mainland_n = 1000) -} -\keyword{internal} diff --git a/man/DAISIE_plot_comparison_stts.Rd b/man/DAISIE_plot_comparison_stts.Rd deleted file mode 100644 index 3d108871..00000000 --- a/man/DAISIE_plot_comparison_stts.Rd +++ /dev/null @@ -1,51 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/DAISIE_plot_comparison_stts.R -\name{DAISIE_plot_comparison_stts} -\alias{DAISIE_plot_comparison_stts} -\title{Plot STT and overlay additional STT curves.} -\usage{ -DAISIE_plot_comparison_stts( - time, - plot_lists_simulations, - plot_lists_simulations_MLE, - type, - kind_of_plot = "line" -) -} -\arguments{ -\item{time}{Numeric defining the length of the simulation in time units. -For example, if an island is known to be 4 million years old, setting -time = 4 will simulate the entire life span of the island; setting time = 2 -will stop the simulation at the mid-life of the island.} - -\item{plot_lists_simulations}{List with simulation output after parsing by -\code{DAISIE_prepare_data_plotting}.} - -\item{plot_lists_simulations_MLE}{List with simulation output after parsing -by \code{DAISIE_prepare_data_plotting}, but obtained by simulating MLE -output.} - -\item{type}{String to indicate if stt of all species or all possible stt -should be plotted. Default is \code{"all_species"}, \code{"type1_species"} -or \code{"type2_species"} should be plotted.} - -\item{kind_of_plot}{Character vector stating how STT plot resulting from MLE -based simulations should be plotted. Default is \code{"line"} for multiple -individual lines. Can also be \code{"shade"} for the 5\% quantile.} -} -\value{ -Standard \code{\link{DAISIE_plot_stt}} with overlaid additional - STT curves for comparison. -} -\description{ -Plot STT and overlay additional STT curves. -} -\seealso{ -\code{\link{DAISIE_plot_sims}}, \code{\link{DAISIE_plot_stt}}, - \code{\link{DAISIE_convert_to_classic_plot}} -} -\author{ -Pedro Neves -} -\concept{plotting} -\keyword{internal} diff --git a/man/create_area_pars.Rd b/man/create_area_pars.Rd index c0e623be..34002ab7 100644 --- a/man/create_area_pars.Rd +++ b/man/create_area_pars.Rd @@ -42,8 +42,7 @@ for island ontogeny simulation Create named list of area parameters } \examples{ -testit::assert(DAISIE:::are_area_pars( -create_area_pars( +area_pars <- create_area_pars( max_area = 10, current_area = 1, proportional_peak_t = 0.5, @@ -51,9 +50,9 @@ create_area_pars( sea_level_amplitude = 5, sea_level_frequency = 10, island_gradient_angle = 0 - ) - ) - ) + + +) } \author{ Richel J.C Bilderbeek, Joshua Lambert, Pedro Neves diff --git a/man/create_trait_pars.Rd b/man/create_trait_pars.Rd index c8cba6b5..e17d089b 100644 --- a/man/create_trait_pars.Rd +++ b/man/create_trait_pars.Rd @@ -36,13 +36,13 @@ list of numerical values containing trait state parameters Create named list of trait state parameters } \examples{ -testit::assert(DAISIE:::are_trait_pars( - create_trait_pars( - trans_rate = 0.5, - immig_rate2 = 0.1, - ext_rate2 = 0.2, - ana_rate2 = 0.3, - clado_rate2 = 0.4, - trans_rate2 = 0.5, - M2 = 1000)) == TRUE) +trait_pars <- create_trait_pars( + trans_rate = 0.5, + immig_rate2 = 0.1, + ext_rate2 = 0.2, + ana_rate2 = 0.3, + clado_rate2 = 0.4, + trans_rate2 = 0.5, + M2 = 1000 + ) } diff --git a/man/get_clado_rate_per_capita.Rd b/man/get_clado_rate_per_capita.Rd deleted file mode 100644 index 66c08deb..00000000 --- a/man/get_clado_rate_per_capita.Rd +++ /dev/null @@ -1,38 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/DAISIE_rates.R -\name{get_clado_rate_per_capita} -\alias{get_clado_rate_per_capita} -\title{Calculate per-capita cladogenesis rate} -\usage{ -get_clado_rate_per_capita(lac, d, num_spec, K, A = 1) -} -\arguments{ -\item{lac}{A numeric with the per capita cladogenesis rate.} - -\item{d}{Numeric defining the scaling parameter for exponent for -calculating cladogenesis rate.} - -\item{num_spec}{A numeric with the current number of species.} - -\item{K}{A numeric with carrying capacity.} - -\item{A}{A numeric value for island area at a given point in time.} -} -\value{ -Numeric with the per-capita cladogenesis rate given a base -cladogenesis rate, K, A and the d hyperparameter. -} -\description{ -This function is only called directly inside the RHS of the ontogeny -likelihood functions. In all other cases \code{\link{get_clado_rate}()} is to -be called instead. -} -\examples{ -lac <- 0.4 -d <- 0 -num_spec <- 2 -K <- 10 -A <- 1 -clado_rate_pc <- DAISIE:::get_clado_rate_per_capita(lac, d, num_spec, K, A) -} -\keyword{internal} diff --git a/man/get_ext_rate_per_capita.Rd b/man/get_ext_rate_per_capita.Rd deleted file mode 100644 index 66018299..00000000 --- a/man/get_ext_rate_per_capita.Rd +++ /dev/null @@ -1,34 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/DAISIE_rates.R -\name{get_ext_rate_per_capita} -\alias{get_ext_rate_per_capita} -\title{Function to describe per-capita changes in extinction rate through time} -\usage{ -get_ext_rate_per_capita(mu, x, extcutoff = 1000, A = 1) -} -\arguments{ -\item{mu}{A numeric with the per capita extinction rate.} - -\item{x}{Numeric defining the exponent for calculating extinction rate.} - -\item{extcutoff}{A numeric with the cutoff for the the maximum extinction -rate preventing it from being too large and slowing down simulation.} - -\item{A}{A numeric value for island area at a given point in time.} -} -\value{ -Numeric with per capita extinction rate, given A(t), x, and mu0. -} -\description{ -This function is only called directly inside the RHS of the ontogeny -likelihood functions. In all other cases \code{\link{get_ext_rate}()} is to -be called instead. -} -\examples{ -ext_rate_per_capita <- DAISIE:::get_ext_rate_per_capita( - mu = 0.5, - x = 1, - A = 1000 -) -} -\keyword{internal} diff --git a/man/get_global_max_area.Rd b/man/get_global_max_area.Rd deleted file mode 100644 index f429bc65..00000000 --- a/man/get_global_max_area.Rd +++ /dev/null @@ -1,83 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/DAISIE_max_rates.R -\name{get_global_max_area} -\alias{get_global_max_area} -\title{Get the maximum area} -\usage{ -get_global_max_area(total_time, area_pars, peak, island_ontogeny, sea_level) -} -\arguments{ -\item{total_time}{Numeric defining the length of the simulation in time -units.} - -\item{area_pars}{A named list containing area and sea level parameters as -created by \code{\link{create_area_pars}()}: -\itemize{ - \item{[1]: maximum area} - \item{[2]: current area} - \item{[3]: value from 0 to 1 indicating where in the island's history the - peak area is achieved} - \item{[4]: total island age} - \item{[5]: amplitude of area fluctuation from sea level} - \item{[6]: frequency of sine wave of area change from sea level} - \item{[7]: angle of the slope of the island} -}} - -\item{peak}{A numeric value specifying the peakiness (or shaprness) of the -ontogeny curve. Higher values imply peakier ontogeny. This value is -internally calculated by \code{\link{calc_peak}()} given the area at the -present and the \code{area_pars}.} - -\item{island_ontogeny}{In \code{\link{DAISIE_sim_time_dep}()}, -\code{\link{DAISIE_ML_CS}} and plotting a string describing the type of -island ontogeny. Can be \code{"const"}, \code{"beta"} for a beta function -describing area through time. \cr In all other functions a -numeric describing the type of island ontogeny. Can be \code{0} for -constant, \code{1} for a beta function describing area through time. In ML -functions \code{island_ontogeny = NA} assumes constant ontogeny. Time -dependent estimation is not yet available as development is still ongoing. -Will return an error if called in that case.} - -\item{sea_level}{In \code{\link{DAISIE_sim_time_dep}()} and plotting a -string describing the type of sea level. Can be \code{"const"} or -\code{"sine"} for a sine function describing area through time. -\cr In all other functions a numeric describing the type of sea level. Can -be \code{0} for constant, \code{1} for a sine function describing area -through time.} -} -\value{ -Numeric maximum area during the simulation. -} -\description{ -Get the maximum area -} -\examples{ -timeval <- 1 -total_time <- 10 -area_pars <- DAISIE::create_area_pars( - max_area = 5000, - current_area = 4000, - proportional_peak_t = 0.5, - total_island_age = 15, - sea_level_amplitude = 0, - sea_level_frequency = 0, - island_gradient_angle = 0 -) -island_ontogeny <- 1 -sea_level <- 0 -peak <- DAISIE:::calc_peak(total_time = total_time, area_pars = area_pars) -testthat::expect_silent( - global_max_area_time <- DAISIE:::get_global_max_area( - total_time = total_time, - peak = peak, - area_pars = area_pars, - island_ontogeny = island_ontogeny, - sea_level = sea_level - ) -) - -} -\author{ -Pedro Neves, Joshua Lambert, Shu Xie -} -\keyword{internal} diff --git a/man/get_global_min_area.Rd b/man/get_global_min_area.Rd deleted file mode 100644 index 76bad641..00000000 --- a/man/get_global_min_area.Rd +++ /dev/null @@ -1,84 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/DAISIE_max_rates.R -\name{get_global_min_area} -\alias{get_global_min_area} -\title{Get the minimum area} -\usage{ -get_global_min_area(total_time, area_pars, peak, island_ontogeny, sea_level) -} -\arguments{ -\item{total_time}{Numeric defining the length of the simulation in time -units.} - -\item{area_pars}{A named list containing area and sea level parameters as -created by \code{\link{create_area_pars}()}: -\itemize{ - \item{[1]: maximum area} - \item{[2]: current area} - \item{[3]: value from 0 to 1 indicating where in the island's history the - peak area is achieved} - \item{[4]: total island age} - \item{[5]: amplitude of area fluctuation from sea level} - \item{[6]: frequency of sine wave of area change from sea level} - \item{[7]: angle of the slope of the island} -}} - -\item{peak}{A numeric value specifying the peakiness (or shaprness) of the -ontogeny curve. Higher values imply peakier ontogeny. This value is -internally calculated by \code{\link{calc_peak}()} given the area at the -present and the \code{area_pars}.} - -\item{island_ontogeny}{In \code{\link{DAISIE_sim_time_dep}()}, -\code{\link{DAISIE_ML_CS}} and plotting a string describing the type of -island ontogeny. Can be \code{"const"}, \code{"beta"} for a beta function -describing area through time. \cr In all other functions a -numeric describing the type of island ontogeny. Can be \code{0} for -constant, \code{1} for a beta function describing area through time. In ML -functions \code{island_ontogeny = NA} assumes constant ontogeny. Time -dependent estimation is not yet available as development is still ongoing. -Will return an error if called in that case.} - -\item{sea_level}{In \code{\link{DAISIE_sim_time_dep}()} and plotting a -string describing the type of sea level. Can be \code{"const"} or -\code{"sine"} for a sine function describing area through time. -\cr In all other functions a numeric describing the type of sea level. Can -be \code{0} for constant, \code{1} for a sine function describing area -through time.} -} -\value{ -Numeric with time at which area is minimum during the simulation -} -\description{ -Get the minimum area -} -\examples{ -timeval <- 1 -total_time <- 10 -area_pars <- DAISIE::create_area_pars( - max_area = 5000, - current_area = 4000, - proportional_peak_t = 0.5, - total_island_age = 15, - sea_level_amplitude = 0, - sea_level_frequency = 0, - island_gradient_angle = 0 -) -island_ontogeny <- 1 -sea_level <- 0 -peak <- DAISIE:::calc_peak(total_time = total_time, area_pars = area_pars) - -testthat::expect_silent( - DAISIE:::get_global_min_area( - total_time = total_time, - area_pars = area_pars, - peak = peak, - island_ontogeny = island_ontogeny, - sea_level = sea_level - ) -) - -} -\author{ -Pedro Neves, Joshua Lambert, Shu Xie -} -\keyword{internal} diff --git a/man/get_immig_rate_per_capita.Rd b/man/get_immig_rate_per_capita.Rd deleted file mode 100644 index 2340f481..00000000 --- a/man/get_immig_rate_per_capita.Rd +++ /dev/null @@ -1,34 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/DAISIE_rates.R -\name{get_immig_rate_per_capita} -\alias{get_immig_rate_per_capita} -\title{Calculate per-capita immigration rate} -\usage{ -get_immig_rate_per_capita(gam, num_spec, K, A = 1) -} -\arguments{ -\item{gam}{A numeric with the per capita immigration rate.} - -\item{num_spec}{A numeric with the current number of species.} - -\item{K}{A numeric with carrying capacity.} - -\item{A}{A numeric value for island area at a given point in time.} -} -\value{ -A numeric with the per-capita immigration rate given A(t) and K. -} -\description{ -This function is only called directly inside the RHS of the ontogeny -likelihood functions. In all other cases \code{\link{get_immig_rate}()} is to -be called instead. -} -\examples{ -immig_rate_per_capita <- DAISIE:::get_immig_rate_per_capita( - gam = 0.001, - num_spec = 5, - K = 20, - A = 1000 -) -} -\keyword{internal} diff --git a/man/translate_island_ontogeny.Rd b/man/translate_island_ontogeny.Rd deleted file mode 100644 index ffd46538..00000000 --- a/man/translate_island_ontogeny.Rd +++ /dev/null @@ -1,29 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/DAISIE_utils.R -\name{translate_island_ontogeny} -\alias{translate_island_ontogeny} -\title{Translate user-friendly ontogeny codes to numerics} -\usage{ -translate_island_ontogeny(island_ontogeny) -} -\arguments{ -\item{island_ontogeny}{In \code{\link{DAISIE_sim_time_dep}()}, -\code{\link{DAISIE_ML_CS}} and plotting a string describing the type of -island ontogeny. Can be \code{"const"}, \code{"beta"} for a beta function -describing area through time. \cr In all other functions a -numeric describing the type of island ontogeny. Can be \code{0} for -constant, \code{1} for a beta function describing area through time. In ML -functions \code{island_ontogeny = NA} assumes constant ontogeny. Time -dependent estimation is not yet available as development is still ongoing. -Will return an error if called in that case.} -} -\value{ -Numeric, 0 for null-ontogeny, 1 for beta function -} -\description{ -Translate user-friendly ontogeny codes to numerics -} -\examples{ -translated_ontogeny <- DAISIE:::translate_island_ontogeny("const") -} -\keyword{internal} diff --git a/man/translate_sea_level.Rd b/man/translate_sea_level.Rd deleted file mode 100644 index 5905010a..00000000 --- a/man/translate_sea_level.Rd +++ /dev/null @@ -1,26 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/DAISIE_utils.R -\name{translate_sea_level} -\alias{translate_sea_level} -\title{Translate user-friendly sea-level codes to numerics} -\usage{ -translate_sea_level(sea_level) -} -\arguments{ -\item{sea_level}{In \code{\link{DAISIE_sim_time_dep}()} and plotting a -string describing the type of sea level. Can be \code{"const"} or -\code{"sine"} for a sine function describing area through time. -\cr In all other functions a numeric describing the type of sea level. Can -be \code{0} for constant, \code{1} for a sine function describing area -through time.} -} -\value{ -Numeric, 0 for null-sea-level, 1 for sine function -} -\description{ -Translate user-friendly sea-level codes to numerics -} -\examples{ -translated_sea_level <- DAISIE:::translate_sea_level("const") -} -\keyword{internal} From b79f32d331933e17a1be5a2c733f3ea05064e6b9 Mon Sep 17 00:00:00 2001 From: Neves-P Date: Mon, 20 Mar 2023 18:36:33 +0100 Subject: [PATCH 12/48] message(), not print() --- R/DAISIE_PEI.R | 14 +++++++------- R/DAISIE_dataprep.R | 4 ++-- R/DAISIE_format_CS_full_stt.R | 7 +++---- R/DAISIE_format_GW.R | 8 +++----- R/DAISIE_make_archipelago.R | 2 +- R/DAISIE_max_rates.R | 2 -- R/DAISIE_sim_MW.R | 14 ++++++++++---- R/DAISIE_sim_core_time_dep.R | 5 ----- R/DAISIE_sim_min_type2.R | 9 +++++---- tests/testthat/test-DAISIE_format_GW.R | 2 +- tests/testthat/test-DAISIE_sim_cr.R | 8 ++++---- tests/testthat/test-DAISIE_sim_cr_shift.R | 2 +- tests/testthat/test-DAISIE_sim_time_dep.R | 6 +++--- 13 files changed, 40 insertions(+), 43 deletions(-) diff --git a/R/DAISIE_PEI.R b/R/DAISIE_PEI.R index 34e0c01b..ea551439 100644 --- a/R/DAISIE_PEI.R +++ b/R/DAISIE_PEI.R @@ -1,6 +1,6 @@ DAISIE_probdist_rhs <- function(t, x, m) { x <- pmax(x, 0) - #print(t) + #message(t) #utils::flush.console() nx <- sqrt(length(x)) dim(x) <- c(nx, nx) @@ -350,13 +350,13 @@ DAISIE_KLdist <- function(pars1, pars2, tvec) { ee <- rep(0:(lx - 1), lx) dim(ee) <- c(lx, lx) expEapprox <- sum(ee * probstp) - print(sum(probstp)) - print(expEapprox) - print(DAISIE_ExpEIN(teq, pars1, M)[[1]]) + message(sum(probstp)) + message(expEapprox) + message(DAISIE_ExpEIN(teq, pars1, M)[[1]]) expEapprox <- sum(ee * probseq) - print(sum(probseq)) - print(expEapprox) - print(DAISIE_ExpEIN(Inf, pars1, M)[[1]]) + message(sum(probseq)) + message(expEapprox) + message(DAISIE_ExpEIN(Inf, pars1, M)[[1]]) KLdist <- sum(probseq * log(probseq / probstp)) return(KLdist) } diff --git a/R/DAISIE_dataprep.R b/R/DAISIE_dataprep.R index 95a36060..d38340e8 100644 --- a/R/DAISIE_dataprep.R +++ b/R/DAISIE_dataprep.R @@ -196,11 +196,11 @@ DAISIE_dataprep = function(datatable, if(max(the_brts)>island_age){ if (verbose == TRUE) { - print(paste("Colonisation time of ", + message("Colonisation time of ", max(the_brts), " for ", as.character(datatable[i, "Clade_name"]), - " is older than island age", sep = "")) + " is older than island age") } if(datatable[i,"Status"] == "Endemic" | datatable[i,"Status"] == "endemic" ){ datatable[i,"Status"] <-"Endemic_MaxAge"} diff --git a/R/DAISIE_format_CS_full_stt.R b/R/DAISIE_format_CS_full_stt.R index d46f23fd..4d92c5a8 100644 --- a/R/DAISIE_format_CS_full_stt.R +++ b/R/DAISIE_format_CS_full_stt.R @@ -147,10 +147,9 @@ DAISIE_format_CS_full_stt <- function(island_replicates, } several_islands[[rep]] <- island_list if (verbose == TRUE) { - message(paste0("Island being formatted: ", - rep, - "/", - length(island_replicates))) + message( + "Island being formatted: ", rep, "/", length(island_replicates) + ) } } return(several_islands) diff --git a/R/DAISIE_format_GW.R b/R/DAISIE_format_GW.R index 8a100753..61cf16c0 100644 --- a/R/DAISIE_format_GW.R +++ b/R/DAISIE_format_GW.R @@ -94,11 +94,9 @@ DAISIE_format_GW <- function(island_replicates, several_islands[[rep]] <- island_list if (verbose == TRUE) { - print(paste("Island being formatted: ", - rep, - "/", - length(island_replicates), - sep = "")) + message( + "Island being formatted: ", rep, "/", length(island_replicates) + ) } } return(several_islands) diff --git a/R/DAISIE_make_archipelago.R b/R/DAISIE_make_archipelago.R index 07189041..f06ccd07 100644 --- a/R/DAISIE_make_archipelago.R +++ b/R/DAISIE_make_archipelago.R @@ -53,7 +53,7 @@ DAISIE_make_global <- function(archipelago_list, M, phylo_data, archipelago_data global_object <- list() for (i in 1:length(archipelago_list)) { the_archipelago <- as.character(archipelago_list[i]) - print(the_archipelago) + message(the_archipelago) global_object[[i]] <- DAISIE_make_archipelago(the_archipelago, M, phylo_data, archipelago_data) } return(global_object) diff --git a/R/DAISIE_max_rates.R b/R/DAISIE_max_rates.R index f17d8ef7..77fa596e 100644 --- a/R/DAISIE_max_rates.R +++ b/R/DAISIE_max_rates.R @@ -60,8 +60,6 @@ update_max_rates <- function(gam, ana_max_rate = ana_max_rate, clado_max_rate = clado_max_rate ) - # print("max rates") - # print(max_rates) return(max_rates) } diff --git a/R/DAISIE_sim_MW.R b/R/DAISIE_sim_MW.R index b5795011..6f8d4365 100644 --- a/R/DAISIE_sim_MW.R +++ b/R/DAISIE_sim_MW.R @@ -245,9 +245,9 @@ DAISIE_sim_MW <- DAISIE_sim_global <- function( Archipelago <- as.character(Archipelago) archipelago_specific <- cbind(Archipelago,Area,Distance,Age,lambda_c,mu,K,gamma,lamda_a) - print('Input data and local parameters for each island:') - print(archipelago_specific) - print('Start of the simulations:') + message('Input data and local parameters for each island:') + message(archipelago_specific) + message('Start of the simulations:') global_sim <- list() for (i in 1:nrow(archipelago_specific)) { @@ -270,7 +270,13 @@ DAISIE_sim_MW <- DAISIE_sim_global <- function( global_sim[[i]][[a]][[1]]$name <- the_archipelago } - print(paste('Simulation of',as.character(archipelago_specific[i,'Archipelago']),'for',island_age,'Myrs each completed',sep=' ')) + message( + "Simulation of ", + as.character(archipelago_specific[i,'Archipelago']), + " for ", + island_age, + "Myrs each completed" + ) } return(global_sim) } diff --git a/R/DAISIE_sim_core_time_dep.R b/R/DAISIE_sim_core_time_dep.R index a3c988db..f1388641 100644 --- a/R/DAISIE_sim_core_time_dep.R +++ b/R/DAISIE_sim_core_time_dep.R @@ -109,11 +109,6 @@ DAISIE_sim_core_time_dep <- function( num_immigrants = num_immigrants, mainland_n = mainland_n ) - # print("rates") - # print(rates) - # print(island_spec) - # print(timeval) - # testit::assert(are_rates(rates)) possible_event <- DAISIE_sample_event_time_dep( max_rates = max_rates ) diff --git a/R/DAISIE_sim_min_type2.R b/R/DAISIE_sim_min_type2.R index 31a13f48..016ae579 100644 --- a/R/DAISIE_sim_min_type2.R +++ b/R/DAISIE_sim_min_type2.R @@ -68,14 +68,15 @@ DAISIE_sim_min_type2 <- function(time, island_replicates[[length(island_replicates) + 1]] <- list() island_replicates[[length(island_replicates)]] <- full_list if (verbose == TRUE) { - print(paste("Number of island replicates with type 2 species: ", - length(island_replicates), - sep = "")) + message( + "Number of island replicates with type 2 species: ", + length(island_replicates) + ) } } counter <- counter + 1 if (verbose == TRUE) { - print(paste("Island ", counter, sep = "")) + message("Island ", counter) } } return(island_replicates) diff --git a/tests/testthat/test-DAISIE_format_GW.R b/tests/testthat/test-DAISIE_format_GW.R index d14e88dc..769e1bc1 100644 --- a/tests/testthat/test-DAISIE_format_GW.R +++ b/tests/testthat/test-DAISIE_format_GW.R @@ -119,7 +119,7 @@ test_that("output with empty island and verbose = TRUE", { nonoceanic_pars = nonoceanic_pars ) island_replicates[[1]] <- out - expect_output( + expect_message( formatted_GW_sim <- DAISIE_format_GW( island_replicates = island_replicates, time = time, diff --git a/tests/testthat/test-DAISIE_sim_cr.R b/tests/testthat/test-DAISIE_sim_cr.R index ae84ef15..19c1eb7c 100644 --- a/tests/testthat/test-DAISIE_sim_cr.R +++ b/tests/testthat/test-DAISIE_sim_cr.R @@ -567,7 +567,7 @@ test_that("constant rate oceanic CS prints correct output when replicates <- 1 verbose <- TRUE set.seed(1) - expect_output( + expect_message( sim <- DAISIE_sim_cr(time = total_time, M = mainland_n, pars = pars, @@ -586,7 +586,7 @@ test_that("constant rate oceanic IW prints correct output when replicates <- 1 verbose <- TRUE set.seed(1) - expect_output( + expect_message( sim <- DAISIE_sim_cr(time = total_time, M = mainland_n, pars = pars, @@ -615,7 +615,7 @@ test_that("2 type simulation with divdepmodel = 'CS' verbose run should ana_rate_type_2 <- 1.0 prop_type2_pool <- 0.1 replicates_apply_type2 <- FALSE - expect_output( + expect_message( sim <- DAISIE_sim_cr( time = island_age, M = n_mainland_species, @@ -648,7 +648,7 @@ test_that("A divdepmodel = 'GW' run with verbose should print", { imm_rate <- 0.01 ana_rate <- 1.0 num_guilds <- 5 - expect_output( + expect_message( DAISIE_sim_cr( time = island_age, M = n_mainland_species, diff --git a/tests/testthat/test-DAISIE_sim_cr_shift.R b/tests/testthat/test-DAISIE_sim_cr_shift.R index 9abbc4c1..a33f7ee2 100644 --- a/tests/testthat/test-DAISIE_sim_cr_shift.R +++ b/tests/testthat/test-DAISIE_sim_cr_shift.R @@ -129,7 +129,7 @@ test_that("abuse split-rates model", { }) test_that("split-rates model prints when verbose = TRUE", { - expect_output( + expect_message( DAISIE_sim_cr_shift( time = 10, M = 10, diff --git a/tests/testthat/test-DAISIE_sim_time_dep.R b/tests/testthat/test-DAISIE_sim_time_dep.R index 4382d0be..d1dd8dee 100644 --- a/tests/testthat/test-DAISIE_sim_time_dep.R +++ b/tests/testthat/test-DAISIE_sim_time_dep.R @@ -341,7 +341,7 @@ test_that("A clean CS ontogeny run with verbose should print to console", { sea_level <- "const" extcutoff <- 1000 hyper_pars <- create_hyper_pars(d = 0.2, x = 0.1) - expect_output( + expect_message( DAISIE_sim_time_dep( time = island_age, M = n_mainland_species, @@ -387,7 +387,7 @@ test_that("A clean IW ontogeny run should produce no output", { extcutoff <- 1000 hyper_pars <- create_hyper_pars(d = 0.2, x = 0.1) nonoceanic_pars <- c(0, 0) - expect_output( + expect_message( DAISIE_sim_time_dep( time = island_age, M = n_mainland_species, @@ -436,7 +436,7 @@ test_that("A clean GW ontogeny run should produce no output", { extcutoff <- 1000 hyper_pars <- create_hyper_pars(d = 0.2, x = 0.1) nonoceanic_pars <- c(0, 0) - expect_output( + expect_message( DAISIE_sim_time_dep( time = island_age, M = n_mainland_species, From 50f952e08f69ede26cde6517916858ef56f4d457 Mon Sep 17 00:00:00 2001 From: Neves-P Date: Mon, 20 Mar 2023 19:36:45 +0100 Subject: [PATCH 13/48] suppressWarnings() not options(warn=-1) --- R/DAISIE_MW_ML.R | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/R/DAISIE_MW_ML.R b/R/DAISIE_MW_ML.R index cf36cf04..b4b15fc2 100644 --- a/R/DAISIE_MW_ML.R +++ b/R/DAISIE_MW_ML.R @@ -162,17 +162,21 @@ DAISIE_MW_loglik_choosepar = function( doMC::registerDoMC(cpus - 1) } X = NULL; rm(X) - loglik = foreach::foreach(X = datalist, - .combine = sum, - .export = c("pars2"), - .packages = c('DAISIE','foreach','deSolve','doParallel')) %dopar% - DAISIE_loglik_all(pars1 = X[[1]]$pars1new, - pars2 = pars2, - datalist = X, - methode = methode, - CS_version = CS_version, - abstolint = abstolint, - reltolint = reltolint) + + suppressWarnings({ + loglik = foreach::foreach( + X = datalist, + .combine = sum, + .export = c("pars2"), + .packages = c('DAISIE','foreach','deSolve','doParallel')) %dopar% + DAISIE_loglik_all(pars1 = X[[1]]$pars1new, + pars2 = pars2, + datalist = X, + methode = methode, + CS_version = CS_version, + abstolint = abstolint, + reltolint = reltolint) + }) } else { loglik = 0 if(pars2[4] == 0.5) pb <- utils::txtProgressBar(min = 0, max = length(datalist), style = 3) @@ -390,7 +394,6 @@ DAISIE_MW_ML = function( num_cycles = 1 ) { - options(warn=-1) distance_dep_options1 <- distance_dep_options1_fun() numpars <- 10 + is.element(distance_dep,distance_dep_options1) + 2 * (distance_dep == 'sigmoidal_col_ana') if(numpars == 11) From ad03da1db427dbd99fb16a1cf8722c864497a3e6 Mon Sep 17 00:00:00 2001 From: Neves-P Date: Mon, 20 Mar 2023 19:36:55 +0100 Subject: [PATCH 14/48] cat() -> message() [run ci] --- R/DAISIE_ML1.R | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/R/DAISIE_ML1.R b/R/DAISIE_ML1.R index 2f0df0d7..9f0d32ca 100644 --- a/R/DAISIE_ML1.R +++ b/R/DAISIE_ML1.R @@ -61,8 +61,7 @@ DAISIE_loglik_all_choosepar <- function(trparsopt, ) } if (is.nan(loglik) || is.na(loglik)) { - cat("There are parameter values used - which cause numerical problems.\n") + message("There are parameter values used which cause numerical problems.") loglik <- -Inf } } @@ -227,7 +226,7 @@ DAISIE_ML1 <- function( optstr <- namepars[idparsopt] } - cat("You are optimizing", optstr, "\n") + message("You are optimizing", optstr, "\n") if (length(namepars[idparsfix]) == 0) { fixstr <- "nothing" } else { From 64639b599afbb001ee7fbf6ae1490c08cc80c0f1 Mon Sep 17 00:00:00 2001 From: Neves-P Date: Tue, 21 Mar 2023 16:18:53 +0100 Subject: [PATCH 15/48] Add print_ml_par_settings() Move settings printing in ML1 (for now) to new function. --- R/DAISIE_ML1.R | 71 +++++++++++++++------------------------ R/print_ml_par_settings.R | 31 +++++++++++++++++ 2 files changed, 59 insertions(+), 43 deletions(-) create mode 100644 R/print_ml_par_settings.R diff --git a/R/DAISIE_ML1.R b/R/DAISIE_ML1.R index 9f0d32ca..3b91a38a 100644 --- a/R/DAISIE_ML1.R +++ b/R/DAISIE_ML1.R @@ -220,66 +220,56 @@ DAISIE_ML1 <- function( position = 'lambda_a', column_to_insert = nc) } - if (length(namepars[idparsopt]) == 0) { - optstr <- "nothing" - } else { - optstr <- namepars[idparsopt] - } - message("You are optimizing", optstr, "\n") - if (length(namepars[idparsfix]) == 0) { - fixstr <- "nothing" - } else { - fixstr <- namepars[idparsfix] - } - cat("You are fixing", fixstr, "\n") + print_ml_par_settings( + namepars = namepars, + idparsopt = idparsopt, + idparsfix = idparsfix, + idparsnoshift = idparsnoshift, + all_no_shift = all_no_shift + ) - if (sum(idparsnoshift %in% (all_no_shift)) != 5) { - noshiftstring <- namepars[idparsnoshift] - cat("You are not shifting", noshiftstring, "\n") - } idpars <- sort(c(idparsopt, idparsfix, idparsnoshift, idparseq)) missnumspec <- unlist(lapply(datalist, function(list) {list$missing_species})) # nolint if (max(missnumspec) > (res - 1)) { - cat( + warning( "The number of missing species is too large relative to the - resolution of the ODE.\n") + resolution of the ODE.") return(out2err) } if (max(missnumspec) > res/10) { warning( "The number of missing species is quite low relative to the - resolution of the ODE.\n") + resolution of the ODE.") } if ((length(idpars) != max(idpars))) { - cat("The parameters to be optimized and/or fixed are incoherent.\n") + warning("The parameters to be optimized and/or fixed are incoherent.") return(out2err) } if ((!all(idpars == 1:max(idpars))) || # nolint (length(initparsopt) != length(idparsopt)) || (length(parsfix) != length(idparsfix))) { - cat("The parameters to be optimized and/or fixed are incoherent.\n") + warning("The parameters to be optimized and/or fixed are incoherent.") return(out2err) } if (length(idparseq) == 0) { } else { if (ddmodel == 3) { - cat("Equilibrium optimization is not implemented for ddmodel = 3\n") + warning("Equilibrium optimization is not implemented for ddmodel = 3") } else { - cat( + message( "You are assuming equilibrium. Extinction and/or immigration will be considered a function of the other parameters, the species pool size, the number of endemics, - and/or the number of non-endemics\n" + and/or the number of non-endemics" ) } } - cat("Calculating the likelihood for the initial parameters.", "\n") - utils::flush.console() + message("Calculating the likelihood for the initial parameters.") trparsopt <- initparsopt / (1 + initparsopt) trparsopt[which(initparsopt == Inf)] <- 1 trparsfix <- parsfix / (1 + parsfix) @@ -312,20 +302,16 @@ DAISIE_ML1 <- function( abstolint = tolint[1], reltolint = tolint[2] ) - cat( - "The loglikelihood for the initial parameter values is", - initloglik, - "\n" - ) + message( + "The loglikelihood for the initial parameter values is ", initloglik) if (initloglik == -Inf) { - cat( + warning( "The initial parameter values have a likelihood that is equal to 0 or - below machine precision. Try again with different initial values.\n" + below machine precision. Try again with different initial values." ) return(out2err) } - cat("Optimizing the likelihood - this may take a while.", "\n") - utils::flush.console() + message("Optimizing the likelihood - this may take a while.") out <- DDD::optimizer( optimmethod = optimmethod, optimpars = optimpars, @@ -346,9 +332,9 @@ DAISIE_ML1 <- function( num_cycles = num_cycles ) if (out$conv != 0) { - cat( + warning( "Optimization has not converged. - Try again with different initial values.\n") + Try again with different initial values.") out2 <- out2err out2$conv <- out$conv return(out2) @@ -413,7 +399,7 @@ DAISIE_ML1 <- function( conv = unlist(out$conv) ) pars_to_print <- MLpars1[1:6] - parnames <- c('lambda^c','mu','K','gamma','lambda^a','prob_init_pres') + parnames <- c("lambda^c", "mu", "K", "gamma", "lambda^a", "prob_init_pres") } else { out2 <- data.frame( lambda_c = MLpars1[1], @@ -436,11 +422,10 @@ DAISIE_ML1 <- function( if (eqmodel > 0) { M <- calcMN(datalist, MLpars1) ExpEIN <- DAISIE_ExpEIN(datalist[[1]]$island_age, MLpars1, M) # nolint start - cat("The expected number of endemics, non-endemics, and the total at - these parameters is: ", - ExpEIN[[1]], - ExpEIN[[2]], - ExpEIN[[3]] + message( + paste0("The expected number of endemics, non-endemics, and the total at ", + "these parameters is: "), + paste(ExpEIN[[1]], ExpEIN[[2]], ExpEIN[[3]]) ) # nolint end } return(invisible(out2)) diff --git a/R/print_ml_par_settings.R b/R/print_ml_par_settings.R new file mode 100644 index 00000000..fb6c31ae --- /dev/null +++ b/R/print_ml_par_settings.R @@ -0,0 +1,31 @@ +#' Print optimisation settings +#' +#' @inheritParams default_params_doc +#' +#' @return Nothing. Prints a `message()` to the console with the parameters +#' that are to be optimized, fixed, and shifted. +#' @noRd +print_ml_par_settings <- function(namepars, + idparsopt, + idparsfix, + idparsnoshift, + all_no_shift) { + if (length(namepars[idparsopt]) == 0) { + optstr <- "nothing" + } else { + optstr <- namepars[idparsopt] + } + + message("You are optimizing ", paste(optstr, collapse = " ")) + if (length(namepars[idparsfix]) == 0) { + fixstr <- "nothing" + } else { + fixstr <- namepars[idparsfix] + } + message("You are fixing ", paste(fixstr, collapse = " ")) + + if (sum(idparsnoshift %in% (all_no_shift)) != 5) { + noshiftstring <- namepars[idparsnoshift] + message("You are not shifting", paste(noshiftstring, collapse = " ")) + } +} From 5fe2b883bd3ac4d9fd1719a5b910f5820308df67 Mon Sep 17 00:00:00 2001 From: Neves-P Date: Tue, 21 Mar 2023 22:35:55 +0100 Subject: [PATCH 16/48] cat() and print() to message() and warning() Add verbose option to some printing. --- R/DAISIE_ML1.R | 3 +- R/DAISIE_ML2.R | 18 ++++---- R/DAISIE_ML4.R | 48 +++++++++----------- R/DAISIE_ML_IW.R | 33 +++++++------- R/DAISIE_MW_ML.R | 33 +++++++------- R/DAISIE_PEI.R | 18 ++++---- R/DAISIE_SR_ML_CS.R | 101 ++++++++++++++++++++++--------------------- R/DAISIE_loglik_CS.R | 11 +++-- 8 files changed, 131 insertions(+), 134 deletions(-) diff --git a/R/DAISIE_ML1.R b/R/DAISIE_ML1.R index 3b91a38a..3db2a4be 100644 --- a/R/DAISIE_ML1.R +++ b/R/DAISIE_ML1.R @@ -226,7 +226,8 @@ DAISIE_ML1 <- function( idparsopt = idparsopt, idparsfix = idparsfix, idparsnoshift = idparsnoshift, - all_no_shift = all_no_shift + all_no_shift = all_no_shift, + verbose = verbose ) idpars <- sort(c(idparsopt, idparsfix, idparsnoshift, idparseq)) diff --git a/R/DAISIE_ML2.R b/R/DAISIE_ML2.R index 3bd3702c..d19b0401 100644 --- a/R/DAISIE_ML2.R +++ b/R/DAISIE_ML2.R @@ -30,7 +30,7 @@ DAISIE_loglik_all_choosepar2 <- function( } } if (is.nan(loglik) || is.na(loglik)) { - cat("There are parameter values used which cause numerical problems.\n") + warning("There are parameter values used which cause numerical problems.") loglik <- -Inf } return(loglik) @@ -131,17 +131,16 @@ DAISIE_ML2 <- function( } if (missnumspec > (res - 1)) { - cat("The number of missing species is too large relative to the resolution of the ODE.\n") + warning("The number of missing species is too large relative to the resolution of the ODE.") return(out2err) } if (all((sort(unique(as.vector(idparsmat))) != sort(c(idparsopt, idparsfix)))) || (length(initparsopt) != length(idparsopt)) || (length(parsfix) != length(idparsfix))) { - cat("The parameters to be optimized and/or fixed are incoherent.\n") + warning("The parameters to be optimized and/or fixed are incoherent.") return(out2err) } - cat("Calculating the likelihood for the initial parameters.", "\n") - utils::flush.console() + message("Calculating the likelihood for the initial parameters.") trparsopt <- initparsopt / (1 + initparsopt) trparsopt[which(initparsopt == Inf)] <- 1 trparsfix <- parsfix / (1 + parsfix) @@ -149,13 +148,12 @@ DAISIE_ML2 <- function( pars2 <- c(res, ddmodel, cond, 0, island_ontogeny) optimpars <- c(tol, maxiter) initloglik <- DAISIE_loglik_all_choosepar2(trparsopt = trparsopt, trparsfix = trparsfix, idparsopt = idparsopt, idparsfix = idparsfix, idparsmat = idparsmat, pars2 = pars2, datalist = datalist, methode, abstolint = tolint[1], reltolint = tolint[2]) - cat("The loglikelihood for the initial parameter values is", initloglik, "\n") + message("The loglikelihood for the initial parameter values is ", initloglik) if (initloglik == -Inf) { - cat("The initial parameter values have a likelihood that is equal to 0 or below machine precision. Try again with different initial values.\n") + warning("The initial parameter values have a likelihood that is equal to 0 or below machine precision. Try again with different initial values.") return(out2err) } - cat("Optimizing the likelihood - this may take a while.", "\n") - utils::flush.console() + message("Optimizing the likelihood - this may take a while.") out <- DDD::optimizer( optimmethod = optimmethod, optimpars = optimpars, @@ -174,7 +172,7 @@ DAISIE_ML2 <- function( num_cycles = num_cycles ) if (out$conv != 0) { - cat("Optimization has not converged. Try again with different initial values.\n") + warning("Optimization has not converged. Try again with different initial values.") out2 <- out2err out2$conv <- out$conv return(out2err) diff --git a/R/DAISIE_ML4.R b/R/DAISIE_ML4.R index cc76e033..3f2d0ca3 100644 --- a/R/DAISIE_ML4.R +++ b/R/DAISIE_ML4.R @@ -39,8 +39,7 @@ DAISIE_loglik_all_choosepar4 <- function(trparsopt, ) } if (is.nan(loglik) || is.na(loglik)) { - cat("There are parameter values used - which cause numerical problems.\n") + message("There are parameter values used which cause numerical problems.") loglik <- -Inf } } @@ -122,33 +121,31 @@ DAISIE_ML4 <- function( } else { optstr <- namepars[idparsopt] } - cat("You are optimizing", optstr, "\n") - if (length(namepars[idparsfix]) == 0) { - fixstr <- "nothing" - } else { - fixstr <- namepars[idparsfix] - } - cat("You are fixing", fixstr, "\n") + print_ml_par_settings( + namepars = namepars, + idparsopt = idparsopt, + idparsfix = idparsfix, + idparsnoshift = NA, + all_no_shift = NA + ) idpars <- sort(c(idparsopt, idparsfix)) missnumspec <- unlist(lapply(datalist, function(list) {list$missing_species})) # nolint if (sum(missnumspec) > (res - 1)) { - cat( - "The number of missing species is too large relative to the - resolution of the ODE.\n") + warning( + "The number of missing species is too large relative to the resolution of the ODE.") return(out2err) } if (length(idpars) != 6) { - cat("You have too few or too many parameters to be optimized or fixed.\n") + warning("You have too few or too many parameters to be optimized or fixed.") return(out2err) } if ((prod(idpars == (1:6)) != 1) || # nolint (length(initparsopt) != length(idparsopt)) || (length(parsfix) != length(idparsfix))) { - cat("The parameters to be optimized and/or fixed are incoherent.\n") + warning("The parameters to be optimized and/or fixed are incoherent.") return(out2err) } - cat("Calculating the likelihood for the initial parameters.", "\n") - utils::flush.console() + message("Calculating the likelihood for the initial parameters.") trparsopt <- initparsopt / (1 + initparsopt) trparsopt[which(initparsopt == Inf)] <- 1 trparsfix <- parsfix / (1 + parsfix) @@ -174,20 +171,15 @@ DAISIE_ML4 <- function( abstolint = tolint[1], reltolint = tolint[2] ) - cat( - "The loglikelihood for the initial parameter values is", - initloglik, - "\n" - ) + message("The loglikelihood for the initial parameter values is ", initloglik) if (initloglik == -Inf) { - cat( + warning( "The initial parameter values have a likelihood that is equal to 0 or - below machine precision. Try again with different initial values.\n" + below machine precision. Try again with different initial values." ) return(out2err) } - cat("Optimizing the likelihood - this may take a while.", "\n") - utils::flush.console() + message("Optimizing the likelihood - this may take a while.") out <- DDD::optimizer( optimmethod = optimmethod, optimpars = optimpars, @@ -206,9 +198,9 @@ DAISIE_ML4 <- function( num_cycles = num_cycles ) if (out$conv != 0) { - cat( - "Optimization has not converged. - Try again with different initial values.\n") + warning( + "Optimization has not converged` + Try again with different initial values.") out2 <- out2err out2$conv <- out$conv return(out2) diff --git a/R/DAISIE_ML_IW.R b/R/DAISIE_ML_IW.R index 8fd289c4..dc0b1977 100644 --- a/R/DAISIE_ML_IW.R +++ b/R/DAISIE_ML_IW.R @@ -32,7 +32,7 @@ DAISIE_loglik_IW_choosepar <- function( ) } if (is.nan(loglik) || is.na(loglik)) { - cat("There are parameter values used which cause numerical problems.\n") + warning("There are parameter values used which cause numerical problems.") loglik <- -Inf } } @@ -105,27 +105,31 @@ DAISIE_ML_IW <- function( np = datalist[[1]]$not_present if (is.null(np)) { np = datalist[[1]]$not_present_type1 + datalist[[1]]$not_present_type2 - cat('Number of species not present is misspecified.\n') + warning('Number of species not present is misspecified.\n') return(invisible(out2err)) } M <- length(datalist) - 1 + np idpars <- sort(c(idparsopt, idparsfix)) if ((prod(idpars == (1:5)) != 1) || (length(initparsopt) != length(idparsopt)) || (length(parsfix) != length(idparsfix))) { - cat("The parameters to be optimized and/or fixed are incoherent.\n") + warning("The parameters to be optimized and/or fixed are incoherent.\n") return(out2err) } if (length(idparsopt) > 11) { - cat("The number of parameters to be optimized is too high.\n") + warning("The number of parameters to be optimized is too high.\n") return(out2err) } namepars <- c("lambda_c", "mu", "K'", "gamma", "lambda_a") - if (length(namepars[idparsopt]) == 0) { optstr = "nothing" } else { optstr = namepars[idparsopt] } - cat("You are optimizing", optstr, "\n") - if(length(namepars[idparsfix]) == 0) { fixstr = "nothing" } else { fixstr = namepars[idparsfix] } - cat("You are fixing", fixstr, "\n") - cat("Calculating the likelihood for the initial parameters.", "\n") - utils::flush.console() + + print_ml_par_settings( + namepars = namepars, + idparsopt = idparsopt, + idparsfix = idparsfix, + idparsnoshift = NA, + all_no_shift = NA, + verbose = verbose + ) + trparsopt <- initparsopt / (1 + initparsopt) trparsopt[which(initparsopt == Inf)] <- 1 trparsfix <- parsfix / (1 + parsfix) @@ -133,13 +137,12 @@ DAISIE_ML_IW <- function( pars2 <- c(res, ddmodel, cond, verbose) optimpars <- c(tol, maxiter) initloglik <- DAISIE_loglik_IW_choosepar(trparsopt = trparsopt, trparsfix = trparsfix, idparsopt = idparsopt, idparsfix = idparsfix, M = M, pars2 = pars2, datalist = datalist, methode = methode, abstolint = tolint[1], reltolint = tolint[2]) - cat("The loglikelihood for the initial parameter values is", initloglik, "\n") + message("The loglikelihood for the initial parameter values is ", initloglik) if (initloglik == -Inf) { - cat("The initial parameter values have a likelihood that is equal to 0 or below machine precision. Try again with different initial values.\n") + warning("The initial parameter values have a likelihood that is equal to 0 or below machine precision. Try again with different initial values.\n") return(out2err) } - cat("Optimizing the likelihood - this may take a while.", "\n") - utils::flush.console() + message("Optimizing the likelihood - this may take a while.") out <- DDD::optimizer( optimmethod = optimmethod, optimpars = optimpars, @@ -158,7 +161,7 @@ DAISIE_ML_IW <- function( num_cycles = num_cycles ) if (out$conv != 0) { - cat("Optimization has not converged. Try again with different initial values.\n") + warning("Optimization has not converged. Try again with different initial values.") out2 <- out2err out2$conv <- out$conv return(out2) diff --git a/R/DAISIE_MW_ML.R b/R/DAISIE_MW_ML.R index b4b15fc2..596f03a5 100644 --- a/R/DAISIE_MW_ML.R +++ b/R/DAISIE_MW_ML.R @@ -156,7 +156,7 @@ DAISIE_MW_loglik_choosepar = function( { if(.Platform$OS.type != "unix") { - cat('cluster does not work on a non-unix environment, choose local instead.\n') + warning('cluster does not work on a non-unix environment, choose local instead.') return(-Inf) } doMC::registerDoMC(cpus - 1) @@ -195,7 +195,7 @@ DAISIE_MW_loglik_choosepar = function( } if(is.nan(loglik) || is.na(loglik)) { - cat("There are parameter values used which cause numerical problems.\n") + warning("There are parameter values used which cause numerical problems.") loglik = -Inf } } @@ -411,12 +411,12 @@ DAISIE_MW_ML = function( idpars = sort(c(idparsopt,idparsfix)) if((prod(idpars == (1:numpars)) != 1) || (length(initparsopt) != length(idparsopt)) || (length(parsfix) != length(idparsfix))) { - cat("The parameters to be optimized and/or fixed are incoherent.\n") + warning("The parameters to be optimized and/or fixed are incoherent.\n") return(out2err) } if(length(idparsopt) > numpars) { - cat("The number of parameters to be optimized is too high.\n") + warning("The number of parameters to be optimized is too high.\n") return(out2err) } namepars = c("lambda_c0","y","mu_0","x","K_0","z","gamma_0","alpha","lambda_a0","beta") @@ -427,12 +427,16 @@ DAISIE_MW_ML = function( { namepars = c(namepars,"d0_col","d0_ana") } - if(length(namepars[idparsopt]) == 0) { optstr = "nothing" } else { optstr = namepars[idparsopt] } - cat("You are optimizing",optstr,"\n") - if(length(namepars[idparsfix]) == 0) { fixstr = "nothing" } else { fixstr = namepars[idparsfix] } - cat("You are fixing",fixstr,"\n") - cat("Calculating the likelihood for the initial parameters.","\n") - utils::flush.console() + + print_ml_par_settings( + namepars = namepars, + idparsopt = idparsopt, + idparsfix = idparsfix, + idparsnoshift = NA, + all_no_shift = NA, + verbose = verbose + ) + trparsopt = initparsopt/(1 + initparsopt) trparsopt[which(initparsopt == Inf)] = 1 trparsfix = parsfix/(1 + parsfix) @@ -440,14 +444,13 @@ DAISIE_MW_ML = function( pars2 = c(res,ddmodel,cond,verbose,island_ontogeny) optimpars = c(tol,maxiter) initloglik = DAISIE_MW_loglik_choosepar(trparsopt = trparsopt,trparsfix = trparsfix,idparsopt = idparsopt,idparsfix = idparsfix,pars2 = pars2,datalist = datalist,methode = methode,CS_version = CS_version,abstolint = tolint[1],reltolint = tolint[2],distance_type = distance_type,parallel = parallel,cpus = cpus,distance_dep = distance_dep) - cat("The loglikelihood for the initial parameter values is",initloglik,"\n") + message("The loglikelihood for the initial parameter values is ", initloglik) if(initloglik == -Inf) { - cat("The initial parameter values have a likelihood that is equal to 0 or below machine precision. Try again with different initial values.\n") + warning("The initial parameter values have a likelihood that is equal to 0 or below machine precision. Try again with different initial values.\n") return(out2err) } - cat("Optimizing the likelihood - this may take a while.","\n") - utils::flush.console() + message("Optimizing the likelihood - this may take a while.") out = DDD::optimizer(optimmethod = optimmethod, optimpars = optimpars, fun = DAISIE_MW_loglik_choosepar, @@ -468,7 +471,7 @@ DAISIE_MW_ML = function( num_cycles = num_cycles) if(out$conv != 0) { - cat("Optimization has not converged. Try again with different initial values.\n") + warning("Optimization has not converged. Try again with different initial values.\n") out2 = out2err out2$conv = out$conv return(out2) diff --git a/R/DAISIE_PEI.R b/R/DAISIE_PEI.R index ea551439..3aba936d 100644 --- a/R/DAISIE_PEI.R +++ b/R/DAISIE_PEI.R @@ -222,14 +222,14 @@ DAISIE_numcol_dist = function(pars1, dim(ee) <- c(lx, lx) expEtpapprox <- sum(ee * probstp) expEINtp <- DAISIE_ExpEIN(tvec[1], pars1, 1) - cat("The total sum of the probabilities at the first time is", sum(probstp), "\n") - cat("The approximation for the expected number of endemics is", expEtpapprox, "\n") - cat("The true value for the expected number of endemics is", expEINtp[[1]], "\n") + message("The total sum of the probabilities at the first time is ", sum(probstp)) + message("The approximation for the expected number of endemics is ", expEtpapprox) + message("The true value for the expected number of endemics is ", expEINtp[[1]]) expEteqapprox <- sum(ee * probseq) expEINteq <- DAISIE_ExpEIN(Inf, pars1, 1) - cat("The total sum of the probabilities at the second time is", sum(probstp), "\n") - cat("The approximation for the expected number of endemics is", expEteqapprox, "\n") - cat("The true value for the expected number of endemics is", expEINteq[[1]], "\n") + message("The total sum of the probabilities at the second time is ", sum(probstp)) + message("The approximation for the expected number of endemics is ", expEteqapprox) + message("The true value for the expected number of endemics is ", expEINteq[[1]]) utils::flush.console() M <- pars2[2] if (!is.na(pars1[11])) { @@ -239,10 +239,8 @@ DAISIE_numcol_dist = function(pars1, } pC <- stats::dbinom(0:Mnonfinches, Mnonfinches, 1 - probs00) expC <- Mnonfinches * (1 - probs00) - cat( - 'The approximation for the expected number of colonizations is', - expC, - "\n" + message( + "The approximation for the expected number of colonizations is ", expC ) out <- list(pC, expC, expEINtp, expEtpapprox, expEINteq, expEteqapprox) names(out) <- list( diff --git a/R/DAISIE_SR_ML_CS.R b/R/DAISIE_SR_ML_CS.R index db85bd5c..c7530cca 100644 --- a/R/DAISIE_SR_ML_CS.R +++ b/R/DAISIE_SR_ML_CS.R @@ -38,7 +38,7 @@ DAISIE_SR_loglik_all_choosepar <- function( ) } if (is.nan(loglik) || is.na(loglik)) { - cat("There are parameter values used which cause numerical problems.\n") + warning("There are parameter values used which cause numerical problems.\n") loglik <- -Inf } } @@ -360,40 +360,45 @@ DAISIE_SR_ML_CS <- DAISIE_SR_ML <- function( list$missing_species })) if (CS_version != 1) { - cat("This version of CS is not yet implemented\n") + warning("This version of CS is not yet implemented") return(out2err) } if (sum(missnumspec) > (res - 1)) { - cat("The number of missing species is too large relative to the resolution of the ODE.\n") + warning("The number of missing species is too large relative to the resolution of the ODE.") return(out2err) } if ((prod(idpars == (1:11)) != 1) || (length(initparsopt) != length(idparsopt)) || (length(parsfix) != length(idparsfix))) { - cat("The parameters to be optimized and/or fixed are incoherent.\n") + warning("The parameters to be optimized and/or fixed are incoherent.") return(out2err) } if (length(idparsopt) > 11) { - cat("The number of parameters to be optimized is too high.\n") + warning("The number of parameters to be optimized is too high.") return(out2err) } - namepars <- c("lambda_c", "mu", "K", "gamma", "lambda_a", "lambda_c2", "mu2", "K2", "gamma2", "lambda_a2", "tshift") - if (length(namepars[idparsopt]) == 0) { - optstr <- "nothing" - } else { - optstr <- namepars[idparsopt] - } - cat("You are optimizing", optstr, "\n") - if (length(namepars[idparsfix]) == 0) { - fixstr <- "nothing" - } else { - fixstr <- namepars[idparsfix] - } - cat("You are fixing", fixstr, "\n") - if (sum(idparsnoshift == (6:10)) != 5) { - noshiftstring <- namepars[idparsnoshift] - cat("You are not shifting", noshiftstring, "\n") - } - cat("Calculating the likelihood for the initial parameters.", "\n") - utils::flush.console() + namepars <- c( + "lambda_c", + "mu", + "K", + "gamma", + "lambda_a", + "lambda_c2", + "mu2", + "K2", + "gamma2", + "lambda_a2", + "tshift" + ) + + print_ml_par_settings( + namepars = namepars, + idparsopt = idparsopt, + idparsfix = idparsfix, + idparsnoshift = idparsnoshift, + # Basic case, only needs to be specified case by case on ML1 + all_no_shift = 6:10, + verbose = verbose + ) + trparsopt <- initparsopt / (1 + initparsopt) trparsopt[which(initparsopt == Inf)] <- 1 trparsfix <- parsfix / (1 + parsfix) @@ -401,34 +406,32 @@ DAISIE_SR_ML_CS <- DAISIE_SR_ML <- function( pars2 <- c(res, ddmodel, cond, verbose, island_ontogeny, tol, maxiter) optimpars <- c(tol, maxiter) initloglik <- DAISIE_SR_loglik_all_choosepar(trparsopt = trparsopt, trparsfix = trparsfix, idparsopt = idparsopt, idparsfix = idparsfix, idparsnoshift = idparsnoshift, pars2 = pars2, datalist = datalist, methode = methode, CS_version = CS_version, abstolint = tolint[1], reltolint = tolint[2]) - cat("The loglikelihood for the initial parameter values is", initloglik, "\n") + message("The loglikelihood for the initial parameter values is ", initloglik) if (initloglik == -Inf) { - cat("The initial parameter values have a likelihood that is equal to 0 or below machine precision. Try again with different initial values.\n") + message("The initial parameter values have a likelihood that is equal to 0 or below machine precision. Try again with different initial values.") return(out2err) } - cat("Optimizing the likelihood - this may take a while.", "\n") - utils::flush.console() - out <- - DDD::optimizer( - optimmethod = optimmethod, - optimpars = optimpars, - fun = DAISIE_SR_loglik_all_choosepar, - trparsopt = trparsopt, - idparsopt = idparsopt, - trparsfix = trparsfix, - idparsfix = idparsfix, - idparsnoshift = idparsnoshift, - pars2 = pars2, - datalist = datalist, - methode = methode, - CS_version = CS_version, - abstolint = tolint[1], - reltolint = tolint[2], - jitter = jitter, - num_cycles = num_cycles - ) + message("Optimizing the likelihood - this may take a while.", "\n") + out <- DDD::optimizer( + optimmethod = optimmethod, + optimpars = optimpars, + fun = DAISIE_SR_loglik_all_choosepar, + trparsopt = trparsopt, + idparsopt = idparsopt, + trparsfix = trparsfix, + idparsfix = idparsfix, + idparsnoshift = idparsnoshift, + pars2 = pars2, + datalist = datalist, + methode = methode, + CS_version = CS_version, + abstolint = tolint[1], + reltolint = tolint[2], + jitter = jitter, + num_cycles = num_cycles + ) if (out$conv != 0) { - cat("Optimization has not converged. Try again with different initial values.\n") + warning("Optimization has not converged. Try again with different initial values.") out2 <- out2err out2$conv <- out$conv return(out2) @@ -453,6 +456,6 @@ DAISIE_SR_ML_CS <- DAISIE_SR_ML <- function( out2 <- data.frame(lambda_c = MLpars1[1], mu = MLpars1[2], K = MLpars1[3], gamma = MLpars1[4], lambda_a = MLpars1[5], lambda_c2 = MLpars1[6], mu2 = MLpars1[7], K2 = MLpars1[8], gamma2 = MLpars1[9], lambda_a2 = MLpars1[10], tshift = MLpars1[11], loglik = ML, df = length(initparsopt), conv = unlist(out$conv)) s1 <- sprintf("Maximum likelihood parameter estimates: lambda_c: %f, mu: %f, K: %f, gamma: %f, lambda_a: %f, lambda_c2: %f, mu2: %f, K2: %f, gamma2: %f, lambda_a2: %f, time of shift: %f", MLpars1[1], MLpars1[2], MLpars1[3], MLpars1[4], MLpars1[5], MLpars1[6], MLpars1[7], MLpars1[8], MLpars1[9], MLpars1[10], MLpars1[11]) s2 <- sprintf("Maximum loglikelihood: %f", ML) - cat("\n", s1, "\n", s2, "\n") + message("\n", s1, "\n", s2, "\n") return(invisible(out2)) } diff --git a/R/DAISIE_loglik_CS.R b/R/DAISIE_loglik_CS.R index c335fc07..72952cc4 100644 --- a/R/DAISIE_loglik_CS.R +++ b/R/DAISIE_loglik_CS.R @@ -1056,12 +1056,12 @@ print_parameters_and_loglik <- function(pars, s2 <- paste(sprintf("%f", pars[-1]), collapse = ', ') s12 <- paste(s1, s2, collapse = ' ') s3 <- paste(sprintf("Loglikelihood: %f", loglik), collapse = '') - cat(s12, s3, sep = ', ') + message(paste(s12, s3, sep = ', ')) } else { if(type == 'global_ML') { s1 <- s1output(pars, distance_dep) s3 <- sprintf("Maximum Loglikelihood: %f", loglik) - cat(s1,s3,sep = '\n') + message(paste(s1, s3, sep = '\n')) } else { if(is.null(ncol(pars))) { lpars <- length(pars) @@ -1079,7 +1079,7 @@ print_parameters_and_loglik <- function(pars, s1 <- sprintf("Maximum likelihood parameters: ") s2 <- paste(sprintf("%f", pars), collapse = ', ') s3 <- sprintf("Maximum Loglikelihood: %f", loglik) - cat(s1, parnames, s2, s3, sep = '\n') + message(paste(s1, parnames, s2, s3, sep = '\n')) } else { if(type == 'multiple_island_ML') { s1 <- sprintf("Maximum likelihood parameters: ") @@ -1088,13 +1088,13 @@ print_parameters_and_loglik <- function(pars, s2 <- paste(s2,paste(sprintf("%f", pars[i,]), collapse = ', '), sep = '\n') } s3 <- sprintf("Maximum Loglikelihood: %f", loglik) - cat(s1, s2, s3, sep = '\n') + message(paste(s1, s2, s3, sep = '\n')) } else { if(type == 'island_loglik') { s1 <- sprintf("Parameters: ") s2 <- paste(sprintf("%f", pars), collapse = ', ') s3 <- sprintf("Loglikelihood: %f", loglik) - cat(s1, parnames, s2, s3, sep = '\n') + message(paste(s1, parnames, s2, s3, sep = '\n')) } else { stop('Type of printing output unknown') } @@ -1102,7 +1102,6 @@ print_parameters_and_loglik <- function(pars, } } } - cat('\n') utils::flush.console() } } From 204da602e8d6dabcab5fe8cad7fed73e2a58293e Mon Sep 17 00:00:00 2001 From: Neves-P Date: Tue, 21 Mar 2023 22:37:18 +0100 Subject: [PATCH 17/48] Safely restore graphics::par() to defaults on exit --- R/DAISIE_plot_sims.R | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/R/DAISIE_plot_sims.R b/R/DAISIE_plot_sims.R index 37c00aa1..0af46f65 100644 --- a/R/DAISIE_plot_sims.R +++ b/R/DAISIE_plot_sims.R @@ -52,7 +52,7 @@ DAISIE_plot_sims <- function( plot_lists <- DAISIE_convert_to_classic_plot(island_replicates, trait_pars = trait_pars) } else { - stop("Plotting STT with sample_freq = Inf not yet available. \n") + stop("Plotting STT with sample_freq = Inf not yet available.") } if (type == "all") { types <- names(plot_lists) @@ -60,7 +60,8 @@ DAISIE_plot_sims <- function( types <- type } num_plots <- sum(!sapply(plot_lists[types], FUN = is.null)) - graphics::par(mfrow = c(1, num_plots)) + oldpar <- graphics::par(mfrow = c(1, num_plots)) + on.exit(graphics::par(oldpar)) for (type_here in types) { DAISIE_plot_stt( plot_plus_one = plot_plus_one, From 6ede5d0f793b2455cd34b1279e07b6cf8459f104 Mon Sep 17 00:00:00 2001 From: Neves-P Date: Tue, 21 Mar 2023 22:37:32 +0100 Subject: [PATCH 18/48] Move print_ml_par_settings() to DAISIE_utils [run ci] --- R/DAISIE_utils.R | 41 +++++++++++++++++++++++++++++++++++++++ R/print_ml_par_settings.R | 31 ----------------------------- 2 files changed, 41 insertions(+), 31 deletions(-) delete mode 100644 R/print_ml_par_settings.R diff --git a/R/DAISIE_utils.R b/R/DAISIE_utils.R index fec14011..8e4b1a06 100644 --- a/R/DAISIE_utils.R +++ b/R/DAISIE_utils.R @@ -447,3 +447,44 @@ add_column_to_dataframe <- function(df, position, column_to_insert) { names(df)[names(df) == 'nc'] <- names(column_to_insert) return(df) } + +#' Print optimisation settings +#' +#' @inheritParams default_params_doc +#' @param all_no_shift numeric vector with the standard no shifted values +#' depending on a model. Internal parameter to DAISIE_ML1, set to NA upstream +#' if not needed to prevent shift message being generated. +#' +#' @return Invisible `NULL`. Prints a `message()` to the console with the parameters +#' that are to be optimized, fixed, and shifted if `isTRUE(verbose)`. +#' @noRd +print_ml_par_settings <- function(namepars, + idparsopt, + idparsfix, + idparsnoshift, + all_no_shift, + verbose) { + if (isTRUE(verbose)) { + + if (length(namepars[idparsopt]) == 0) { + optstr <- "nothing" + } else { + optstr <- namepars[idparsopt] + } + + message("You are optimizing ", paste(optstr, collapse = " ")) + if (length(namepars[idparsfix]) == 0) { + fixstr <- "nothing" + } else { + fixstr <- namepars[idparsfix] + } + message("You are fixing ", paste(fixstr, collapse = " ")) + + if (any(is.numeric(idparsnoshift)) && + sum(idparsnoshift %in% (all_no_shift)) != 5) { + noshiftstring <- namepars[idparsnoshift] + message("You are not shifting", paste(noshiftstring, collapse = " ")) + } + } + invisible(NULL) +} diff --git a/R/print_ml_par_settings.R b/R/print_ml_par_settings.R deleted file mode 100644 index fb6c31ae..00000000 --- a/R/print_ml_par_settings.R +++ /dev/null @@ -1,31 +0,0 @@ -#' Print optimisation settings -#' -#' @inheritParams default_params_doc -#' -#' @return Nothing. Prints a `message()` to the console with the parameters -#' that are to be optimized, fixed, and shifted. -#' @noRd -print_ml_par_settings <- function(namepars, - idparsopt, - idparsfix, - idparsnoshift, - all_no_shift) { - if (length(namepars[idparsopt]) == 0) { - optstr <- "nothing" - } else { - optstr <- namepars[idparsopt] - } - - message("You are optimizing ", paste(optstr, collapse = " ")) - if (length(namepars[idparsfix]) == 0) { - fixstr <- "nothing" - } else { - fixstr <- namepars[idparsfix] - } - message("You are fixing ", paste(fixstr, collapse = " ")) - - if (sum(idparsnoshift %in% (all_no_shift)) != 5) { - noshiftstring <- namepars[idparsnoshift] - message("You are not shifting", paste(noshiftstring, collapse = " ")) - } -} From 041502b9c5704162d15ee6ed1d78d8a55bfd79df Mon Sep 17 00:00:00 2001 From: Hanno Hildenbrandt Date: Wed, 22 Mar 2023 10:15:09 +0100 Subject: [PATCH 19/48] custom bstime_t --- .Rbuildignore | 2 +- .vscode/.env | 23 ++ .vscode/c_cpp_properties.json | 28 ++ .vscode/genenv.R | 19 + .vscode/launch.json | 71 ++++ .vscode/settings.json | 82 ++++ .vscode/tasks.json | 13 + R/RcppExports.R | 3 + dummy.R | 23 ++ src/DAISIE_CS.cpp | 27 +- src/DAISIE_IW.cpp | 11 +- src/DAISIE_odeint.h | 58 ++- src/DAISIE_types.h | 125 ++++++- src/R_init_DAISIE.c | 8 + src/config.h | 29 +- src/patched_bulrisch_stoer.h | 686 ---------------------------------- src/ublas_types.h | 119 ------ 17 files changed, 490 insertions(+), 837 deletions(-) create mode 100644 .vscode/.env create mode 100644 .vscode/c_cpp_properties.json create mode 100644 .vscode/genenv.R create mode 100644 .vscode/launch.json create mode 100644 .vscode/settings.json create mode 100644 .vscode/tasks.json create mode 100644 dummy.R delete mode 100644 src/patched_bulrisch_stoer.h delete mode 100644 src/ublas_types.h diff --git a/.Rbuildignore b/.Rbuildignore index 0c6be8b9..b98deaec 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -18,5 +18,5 @@ ^\.zenodo\.json$ ^\.vscode$ -^source_odeint\.R +^dummy\.R ^LICENSE\.md$ diff --git a/.vscode/.env b/.vscode/.env new file mode 100644 index 00000000..858dd13f --- /dev/null +++ b/.vscode/.env @@ -0,0 +1,23 @@ +LD_LIBRARY_PATH=/home/hanno/opt/Rval/lib/R/lib:/usr/local/lib:/usr/lib/jvm/java-17-openjdk-amd64/lib/server +R_ARCH= +R_BROWSER=/usr/bin/xdg-open +R_BZIPCMD=/usr/bin/bzip2 +R_DOC_DIR=/home/hanno/opt/Rval/lib/R/doc +R_GZIPCMD=/usr/bin/gzip +R_HOME=/home/hanno/opt/Rval/lib/R +R_INCLUDE_DIR=/home/hanno/opt/Rval/lib/R/include +R_LIBS_SITE=/home/hanno/opt/Rval/lib/R/site-library +R_LIBS_USER=/home/hanno/R/x86_64-pc-linux-gnu-library/4.2 +R_PAPERSIZE=letter +R_PDFVIEWER=/usr/bin/xdg-open +R_PLATFORM=x86_64-pc-linux-gnu +R_PRINTCMD= +R_RD4PDF=times,inconsolata,hyper +R_SESSION_TMPDIR=/tmp/RtmpBbOIae +R_SHARE_DIR=/home/hanno/opt/Rval/lib/R/share +R_STRIP_SHARED_LIB=strip --strip-unneeded +R_STRIP_STATIC_LIB=strip --strip-debug +R_SYSTEM_ABI=linux,gcc,gxx,gfortran,gfortran +R_TEXI2DVICMD=/usr/bin/texi2dvi +R_UNZIPCMD=/usr/bin/unzip +R_ZIPCMD=/usr/bin/zip diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 00000000..42079e35 --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,28 @@ +// c_cpp_properties.json +// +// C/C++ extension config file +// Some settings to augment IntelliSense for C/C++ files +{ + "configurations": [ + { + "name": "Linux gdb", + "includePath": [ + // recurse into workspace, picks up ./src/ and ./inst/include/ + "${workspaceFolder}/**", + // R headers + "${env:HOME}/opt/bin/Rroot/lib/R/include", + // includes used by our package + "${env:HOME}/opt/bin/Rlibrary/Rcpp/include", + "${env:HOME}/opt/bin/Rlibrary/BH/include" + ], + "defines": [], + // absolute path to compiler + "compilerPath": "/usr/bin/gcc", + // "compilerPath": "/usr/bin/clang" + "cStandard": "c11", + // should match [[Rcpp::plugins(cpp17)]] + "cppStandard": "c++17" + } + ], + "version": 4 +} diff --git a/.vscode/genenv.R b/.vscode/genenv.R new file mode 100644 index 00000000..2cd0a945 --- /dev/null +++ b/.vscode/genenv.R @@ -0,0 +1,19 @@ +# genenv.R +# +# Colects environment variables from R, required by the R *binary*. +# They are normally set by the R *script* which is circumvented if +# we need to run the binary under the debugger as we want to debug R +# not bash... +# +# This script is configured as a task in 'tasks.json' and referenced within +# 'launch.json' as the 'preLaunchTask'. + +env <- Sys.getenv() +envnames <- names(env) +rnames <- envnames[startsWith(envnames, "R_")] +cached_names <- rnames +ld_lib_path <- Sys.getenv("LD_LIBRARY_PATH") +if (ld_lib_path != "") { + cached_names <- c("LD_LIBRARY_PATH", rnames) +} +writeLines(paste0(cached_names, "=", env[cached_names]), ".vscode/.env") diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..05e6dc04 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,71 @@ +// launch.json +// +// launch the R *binary* under gdb and run devtools::test() +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "(gbd) devtools::test()", + "type": "cppdbg", + "request": "launch", + // The binary, not the script + "program": "${env:HOME}/opt/bin/Rroot/lib/R/bin/exec/R", + "args": [ + "--vanilla", + "-e", + "devtools::test()" + ], + "stopAtEntry": false, + // needs to be generated, see below + "envFile": "${workspaceFolder}/.vscode/.env", + "cwd": "${workspaceFolder}", + "externalConsole": false, + "MIMode": "gdb", + //"miDebuggerPath": "/usr/bin/gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ], + // 'R' is a script that sets a ton of environment variables + // required by the R binary. This task emulates that part of + // the R script: + "preLaunchTask": "genenv" + }, + { + "name": "(gbd) R-file", + "type": "cppdbg", + "request": "launch", + // The binary, not the script + "program": "${env:HOME}/opt/bin/Rroot/lib/R/bin/exec/R", + "args": [ + "--vanilla", + "-e", + "devtools::load_all(); source('${fileBasename}')" + ], + "stopAtEntry": false, + // needs to be generated, see below + "envFile": "${workspaceFolder}/.vscode/.env", + "cwd": "${workspaceFolder}", + "externalConsole": false, + "MIMode": "gdb", + //"miDebuggerPath": "/usr/bin/gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ], + // 'R' is a script that sets a ton of environment variables + // required by the R binary. This task emulates that part of + // the R script: + "preLaunchTask": "genenv" + } + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..7b9c91f1 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,82 @@ +{ + "files.associations": { + "*.rmd": "markdown", + "__locale": "cpp", + "__string": "cpp", + "locale": "cpp", + "array": "cpp", + "atomic": "cpp", + "strstream": "cpp", + "bit": "cpp", + "*.tcc": "cpp", + "bitset": "cpp", + "cctype": "cpp", + "cfenv": "cpp", + "chrono": "cpp", + "clocale": "cpp", + "cmath": "cpp", + "codecvt": "cpp", + "compare": "cpp", + "complex": "cpp", + "concepts": "cpp", + "condition_variable": "cpp", + "csetjmp": "cpp", + "cstdarg": "cpp", + "cstddef": "cpp", + "cstdint": "cpp", + "cstdio": "cpp", + "cstdlib": "cpp", + "cstring": "cpp", + "ctime": "cpp", + "cwchar": "cpp", + "cwctype": "cpp", + "deque": "cpp", + "list": "cpp", + "map": "cpp", + "set": "cpp", + "string": "cpp", + "unordered_map": "cpp", + "unordered_set": "cpp", + "vector": "cpp", + "exception": "cpp", + "algorithm": "cpp", + "functional": "cpp", + "iterator": "cpp", + "memory": "cpp", + "memory_resource": "cpp", + "numeric": "cpp", + "optional": "cpp", + "random": "cpp", + "ratio": "cpp", + "string_view": "cpp", + "system_error": "cpp", + "tuple": "cpp", + "type_traits": "cpp", + "utility": "cpp", + "fstream": "cpp", + "initializer_list": "cpp", + "iomanip": "cpp", + "iosfwd": "cpp", + "iostream": "cpp", + "istream": "cpp", + "limits": "cpp", + "mutex": "cpp", + "new": "cpp", + "numbers": "cpp", + "ostream": "cpp", + "semaphore": "cpp", + "sstream": "cpp", + "stdexcept": "cpp", + "stop_token": "cpp", + "streambuf": "cpp", + "thread": "cpp", + "cinttypes": "cpp", + "typeindex": "cpp", + "typeinfo": "cpp", + "variant": "cpp", + "__nullptr": "cpp", + "__hash_table": "cpp", + "__mutex_base": "cpp", + "__tree": "cpp" + } +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 00000000..e11a2f20 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,13 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "label": "genenv", + "type": "shell", + "command": "Rscript ${workspaceFolder}/.vscode/genenv.R", + "problemMatcher": [] + } + ] +} diff --git a/R/RcppExports.R b/R/RcppExports.R index 5d754b1e..de991b04 100644 --- a/R/RcppExports.R +++ b/R/RcppExports.R @@ -9,6 +9,9 @@ NULL #' @name daisie_odeint_cs NULL +#' @export daisie_odeint_iw +NULL + #' Driver for the boost::odeint solver #' #' @name daisie_odeint_iw diff --git a/dummy.R b/dummy.R new file mode 100644 index 00000000..27c2905a --- /dev/null +++ b/dummy.R @@ -0,0 +1,23 @@ +library(DAISIE) + +utils::data(Galapagos_datalist_2types) +pars1 <- c( +0.195442017, +0.087959583, +Inf, +0.002247364, +0.873605049, +3755.202241, +8.909285094, +14.99999923, +0.002247364, +0.873605049, +0.163 +) +pars2 <- c(40, 11, 0, 1) + +methode <- 'odeint::runge_kutta_cash_karp54' +loglik_rkck54 <- DAISIE_loglik_all(pars1, pars2, Galapagos_datalist_2types, methode = methode) + +methode <- 'odeint::bulirsch_stoer' +loglik_bs <- DAISIE_loglik_all(pars1, pars2, Galapagos_datalist_2types, methode = methode) diff --git a/src/DAISIE_CS.cpp b/src/DAISIE_CS.cpp index 8afa8f8d..c2104626 100644 --- a/src/DAISIE_CS.cpp +++ b/src/DAISIE_CS.cpp @@ -1,4 +1,11 @@ -// [[Rcpp::plugins(cpp14)]] +// +// Copyright (c) 2023, Hanno Hildenbrandt +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + // [[Rcpp::depends(BH)]] //' @export daisie_odeint_cs @@ -48,9 +55,11 @@ namespace { } // odeint interface - void operator()(const state_type& x, state_type& dx, double t) const + void operator()(const state_type& x, state_type& dx, double /*t*/) const { - if (++p_.steps > max_cs_steps) throw std::runtime_error("cpp_daisie_cs_runmod: too many steps"); + if (++p_.steps > max_cs_steps) { + throw std::runtime_error("cpp_daisie_cs_runmod: too many steps"); + } const auto xx1 = padded_vector_view<2>(x.data().begin(), p_.lx); const auto xx2 = padded_vector_view<2>(x.data().begin() + p_.lx, p_.lx); @@ -113,9 +122,11 @@ namespace { } // odeint interface - void operator()(const state_type& x, state_type& dx, double) const + void operator()(const state_type& x, state_type& dx, double /*t*/) const { - if (++p_.steps > max_cs_steps) throw std::runtime_error("cpp_daisie_cs_runmod_1: too many steps"); + if (++p_.steps > max_cs_steps) { + throw std::runtime_error("cpp_daisie_cs_runmod_1: too many steps"); + } const auto xx1 = padded_vector_view<2>(x.data().begin(), p_.lx); const auto xx2 = padded_vector_view<2>(x.data().begin() + p_.lx, p_.lx); @@ -196,9 +207,11 @@ namespace { } // odeint interface - void operator()(const state_type& x, state_type& dx, double) const + void operator()(const state_type& x, state_type& dx, double /*t*/) const { - if (++p_.steps > max_cs_steps) throw std::runtime_error("cpp_daisie_cs_runmod_2: too many steps"); + if (++p_.steps > max_cs_steps) { + throw std::runtime_error("cpp_daisie_cs_runmod_2: too many steps"); + } const auto xx1 = padded_vector_view<2>(x.data().begin(), p_.lx); const auto xx2 = padded_vector_view<2>(x.data().begin() + p_.lx, p_.lx); diff --git a/src/DAISIE_IW.cpp b/src/DAISIE_IW.cpp index 3bf7d288..757a3c47 100644 --- a/src/DAISIE_IW.cpp +++ b/src/DAISIE_IW.cpp @@ -1,4 +1,13 @@ -// [[Rcpp::plugins(cpp14)]] +// +// Copyright (c) 2023, Hanno Hildenbrandt +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +//' @export daisie_odeint_iw + // [[Rcpp::plugins(openmp)]] // [[Rcpp::depends(BH)]] // [[Rcpp::depends(RcppEigen)]] diff --git a/src/DAISIE_odeint.h b/src/DAISIE_odeint.h index 20fa9fa2..e4d63820 100644 --- a/src/DAISIE_odeint.h +++ b/src/DAISIE_odeint.h @@ -1,25 +1,69 @@ -// [[Rcpp::plugins(cpp14)]] +// +// Copyright (c) 2023, Hanno Hildenbrandt +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// -#pragma once #ifndef DAISIE_ODEINT_H_INCLUDED #define DAISIE_ODEINT_H_INCLUDED #include "config.h" -#include "ublas_types.h" -#include "patched_bulrisch_stoer.h" // shadow buggy boost header +#include "DAISIE_types.h" #include #include #include #include + using namespace Rcpp; using namespace boost::numeric::odeint; - // type of the ode state using state_type = vector_t; +#ifdef USE_BULRISCH_STOER_PATCH + +// Default initialized double-wrapper +// To be used as template argument for bulrisch_stoer<..., Time, ...> +class bstime_t +{ + public: + constexpr bstime_t() noexcept : val_(0.0) {} + constexpr bstime_t(double val) noexcept : val_(val) {} + constexpr operator double () const noexcept { return val_; } + constexpr operator double& () noexcept { return val_; } + + private: + double val_; +}; + +namespace std { + + template<> + struct numeric_limits : public std::numeric_limits {}; + + template<> + struct numeric_limits : public std::numeric_limits {}; + + template<> + struct numeric_limits : public std::numeric_limits {}; + + template<> + struct numeric_limits : public std::numeric_limits {}; + +} + +#else + +// That's much better ;) +using bstime_t = double; + +#endif // USE_BULRISCH_STOER_PATCH + + // zero-value padded view into vector template class padded_vector_view @@ -133,8 +177,8 @@ namespace daisie_odeint { } else if ("odeint::bulirsch_stoer" == stepper) { // outlier in calling convention - using stepper_t = bulirsch_stoer; - integrate_adaptive(stepper_t(atol, rtol), rhs, y, t0, t1, 0.1 * (t1 - t0)); + using stepper_t = bulirsch_stoer; + integrate_adaptive(stepper_t(atol, rtol), rhs, y, t0 * si::second, t1 * si::second, (0.1 * (t1 - t0)) * si::second); } else if (0 == stepper.compare(0, stepper.size() - 2, "odeint::adams_bashforth")) { const char steps = stepper.back(); diff --git a/src/DAISIE_types.h b/src/DAISIE_types.h index 78ae8f2f..2a0eb312 100644 --- a/src/DAISIE_types.h +++ b/src/DAISIE_types.h @@ -1,3 +1,124 @@ -#pragma once +// +// Copyright (c) 2023, Hanno Hildenbrandt +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#ifndef DAISIE_TYPES_H_INCLUDED +#define DAISIE_TYPES_H_INCLUDED + #include "config.h" -#include "odeint_types.h" +#include +#include +#include + + +namespace ublas = boost::numeric::ublas; + + +template using vector_t = ublas::vector; +template using matrix_t = ublas::matrix; + + +// forward declarations Rcpp <-> boost::numeric::ublas +namespace Rcpp { + + namespace traits { + + template SEXP wrap(const vector_t&); + template SEXP wrap(const matrix_t&); + + template vector_t as(SEXP); + template matrix_t as(SEXP); + + template class Exporter>; + template class Exporter>; + + } + +} + + +#include + + +namespace Rcpp { + + namespace traits { + + template inline SEXP wrap(const vector_t& obj) { + const int RTYPE = Rcpp::traits::r_sexptype_traits::rtype; + return Rcpp::Vector(obj.begin(), obj.end()); + } + + + template inline SEXP wrap(const matrix_t& obj) { + const size_t nr = static_cast(obj.size1()); + const size_t nc = static_cast(obj.size2()); + const int RTYPE = Rcpp::traits::r_sexptype_traits::rtype; + Rcpp::Matrix rmat(nr, nc); + for (size_t i = 0; i < nr; ++i) { + for (size_t j = 0; j < nc; ++j) { + rmat(i, j) = obj(i, j); + } + } + return rmat; + } + + + template + class Exporter> + { + private: + static constexpr int RTYPE = Rcpp::traits::r_sexptype_traits::rtype; + Rcpp::Vector rvec; + + public: + Exporter(SEXP x) : rvec(x) { + if (TYPEOF(x) != RTYPE) { + throw std::invalid_argument("Wrong R type for mapped 1D array"); + } + } + + vector_t get() { + vector_t x(rvec.size()); + std::copy(rvec.begin(), rvec.end(), x.begin()); + return x; + } + }; + + + template + class Exporter> + { + private: + static constexpr int RTYPE = Rcpp::traits::r_sexptype_traits::rtype; + Rcpp::Matrix rmat; + + public: + Exporter(SEXP x) : rmat(x) { + if (TYPEOF(x) != RTYPE) { + throw std::invalid_argument("Wrong R type for mapped 2D array"); + } + } + + matrix_t get() { + const size_t nr = static_cast(rmat.rows()); + const size_t nc = static_cast(rmat.cols()); + matrix_t x(nr, nc); + for (size_t i = 0; i < nr; ++i) { + for (size_t j = 0; j < nc; ++j) { + x(i, j) = rmat(i, j); + } + } + return x; + } + }; + + } + +} + +#endif diff --git a/src/R_init_DAISIE.c b/src/R_init_DAISIE.c index e5fd4b78..450941a3 100644 --- a/src/R_init_DAISIE.c +++ b/src/R_init_DAISIE.c @@ -1,3 +1,11 @@ +// +// Copyright (c) 2023, Hanno Hildenbrandt +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + // [[Rcpp::plugins(cpp14)]] #include"config.h" diff --git a/src/config.h b/src/config.h index 32cfa85b..c74d5afd 100644 --- a/src/config.h +++ b/src/config.h @@ -1,28 +1,29 @@ +// +// Copyright (c) 2023, Hanno Hildenbrandt +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + #ifndef ODEINT_CONFIG_H_INCLUDED #define ODEINT_CONFIG_H_INCLUDED // [[Rcpp::plugins(cpp14)]] -// Special case to make use of some steppers that would include -// boost/functional.hpp -// moved to Makevars[.win] -/* -#if __cplusplus >= 201703L -# ifdef _HAS_AUTO_PTR_ETC -# undef _HAS_AUTO_PTR_ETC -# endif -# define _HAS_AUTO_PTR_ETC 0 -#endif - */ - // Special case to make use of some steppers that would include // boost/get_pointer.hpp #ifndef BOOST_NO_AUTO_PTR # define BOOST_NO_AUTO_PTR #endif -// uncomment if unitialized member variable bulirsch_stoer::m_dt_last -// is fixed in boost (BH) +// Addresses unitialized member variable bulirsch_stoer<>::m_dt_last. +// +// The issue is *not* fixed in BOOST_VERSION 1.81.1. +// We need to check for fixes in upcomming boost (BH) releases. +// +// Uncomment if unitialized member variable bulirsch_stoer::m_dt_last +// is fixed in boost (BH): #define USE_BULRISCH_STOER_PATCH #endif diff --git a/src/patched_bulrisch_stoer.h b/src/patched_bulrisch_stoer.h deleted file mode 100644 index 712a4da7..00000000 --- a/src/patched_bulrisch_stoer.h +++ /dev/null @@ -1,686 +0,0 @@ -/* - Patched version of - boost/numeric/odeint/stepper/bulirsch_stoer.hpp - - Addresses unitialized member variable bulirsch_stoer<>::m_dt_last. - - Include this header before boost/numeric/odeint to shadow - boost/numeriuc/odeint/stepper/bulrisch_stoer.hpp - - The issue is *not* fixed in BOOST_VERSION == 1.81.0. - We need to check for fixes in upcomming boost (BH) releases. - - Hanno Hildenbrandt 2023 - */ - - /* - [auto_generated] - boost/numeric/odeint/stepper/bulirsch_stoer.hpp - - [begin_description] - Implementation of the Burlish-Stoer method. As described in - Ernst Hairer, Syvert Paul Norsett, Gerhard Wanner - Solving Ordinary Differential Equations I. Nonstiff Problems. - Springer Series in Comput. Mathematics, Vol. 8, Springer-Verlag 1987, Second revised edition 1993. - [end_description] - - Copyright 2011-2013 Mario Mulansky - Copyright 2011-2013 Karsten Ahnert - Copyright 2012 Christoph Koke - - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or - copy at http://www.boost.org/LICENSE_1_0.txt) - - - Boost Software License - Version 1.0 - August 17th, 2003 - - Permission is hereby granted, free of charge, to any person or organization - obtaining a copy of the software and accompanying documentation covered by - this license (the "Software") to use, reproduce, display, distribute, - execute, and transmit the Software, and to prepare derivative works of the - Software, and to permit third-parties to whom the Software is furnished to - do so, all subject to the following: - - The copyright notices in the Software and this entire statement, including - the above license grant, this restriction and the following disclaimer, - must be included in all copies of the Software, in whole or in part, and - all derivative works of the Software, unless such copies or derivative - works are solely in the form of machine-executable object code generated by - a source language processor. - - 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, TITLE AND NON-INFRINGEMENT. IN NO EVENT - SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE - FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, - ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. -*/ - -#ifdef USE_BULRISCH_STOER_PATCH - -#ifndef BOOST_NUMERIC_ODEINT_STEPPER_BULIRSCH_STOER_HPP_INCLUDED -#define BOOST_NUMERIC_ODEINT_STEPPER_BULIRSCH_STOER_HPP_INCLUDED - - -#include - -#include - -#include // for min/max guidelines - -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -namespace boost { -namespace numeric { -namespace odeint { - -template< - class State , - class Value = double , - class Deriv = State , - class Time = Value , - class Algebra = typename algebra_dispatcher< State >::algebra_type , - class Operations = typename operations_dispatcher< State >::operations_type , - class Resizer = initially_resizer - > -class bulirsch_stoer { - -public: - - typedef State state_type; - typedef Value value_type; - typedef Deriv deriv_type; - typedef Time time_type; - typedef Algebra algebra_type; - typedef Operations operations_type; - typedef Resizer resizer_type; -#ifndef DOXYGEN_SKIP - typedef state_wrapper< state_type > wrapped_state_type; - typedef state_wrapper< deriv_type > wrapped_deriv_type; - typedef controlled_stepper_tag stepper_category; - - typedef bulirsch_stoer< State , Value , Deriv , Time , Algebra , Operations , Resizer > controlled_error_bs_type; - - typedef typename inverse_time< time_type >::type inv_time_type; - - typedef std::vector< value_type > value_vector; - typedef std::vector< time_type > time_vector; - typedef std::vector< inv_time_type > inv_time_vector; //should be 1/time_type for boost.units - typedef std::vector< value_vector > value_matrix; - typedef std::vector< size_t > int_vector; - typedef std::vector< wrapped_state_type > state_table_type; -#endif //DOXYGEN_SKIP - const static size_t m_k_max = 8; - - bulirsch_stoer( - value_type eps_abs = 1E-6 , value_type eps_rel = 1E-6 , - value_type factor_x = 1.0 , value_type factor_dxdt = 1.0 , - time_type max_dt = static_cast(0)) - : m_error_checker( eps_abs , eps_rel , factor_x, factor_dxdt ) , m_midpoint() , - m_last_step_rejected( false ) , m_first( true ) , - m_dt_last(static_cast(-1)) , // !!! patched !!! - m_max_dt(max_dt) , - m_interval_sequence( m_k_max+1 ) , - m_coeff( m_k_max+1 ) , - m_cost( m_k_max+1 ) , - m_facmin_table( m_k_max+1 ) , - m_table( m_k_max ) , - STEPFAC1( 0.65 ) , STEPFAC2( 0.94 ) , STEPFAC3( 0.02 ) , STEPFAC4( 4.0 ) , KFAC1( 0.8 ) , KFAC2( 0.9 ) - { - BOOST_USING_STD_MIN(); - BOOST_USING_STD_MAX(); - /* initialize sequence of stage numbers and work */ - for( unsigned short i = 0; i < m_k_max+1; i++ ) - { - m_interval_sequence[i] = 2 * (i+1); - if( i == 0 ) - m_cost[i] = m_interval_sequence[i]; - else - m_cost[i] = m_cost[i-1] + m_interval_sequence[i]; - m_coeff[i].resize(i); - m_facmin_table[i] = pow BOOST_PREVENT_MACRO_SUBSTITUTION( STEPFAC3 , static_cast< value_type >(1) / static_cast< value_type >( 2*i+1 ) ); - for( size_t k = 0 ; k < i ; ++k ) - { - const value_type r = static_cast< value_type >( m_interval_sequence[i] ) / static_cast< value_type >( m_interval_sequence[k] ); - m_coeff[i][k] = 1.0 / ( r*r - static_cast< value_type >( 1.0 ) ); // coefficients for extrapolation - } - } - reset(); - } - - - /* - * Version 1 : try_step( sys , x , t , dt ) - * - * The overloads are needed to solve the forwarding problem - */ - template< class System , class StateInOut > - controlled_step_result try_step( System system , StateInOut &x , time_type &t , time_type &dt ) - { - return try_step_v1( system , x , t, dt ); - } - - /** - * \brief Second version to solve the forwarding problem, can be used with Boost.Range as StateInOut. - */ - template< class System , class StateInOut > - controlled_step_result try_step( System system , const StateInOut &x , time_type &t , time_type &dt ) - { - return try_step_v1( system , x , t, dt ); - } - - /* - * Version 2 : try_step( sys , x , dxdt , t , dt ) - * - * this version does not solve the forwarding problem, boost.range can not be used - */ - template< class System , class StateInOut , class DerivIn > - controlled_step_result try_step( System system , StateInOut &x , const DerivIn &dxdt , time_type &t , time_type &dt ) - { - m_xnew_resizer.adjust_size( x , detail::bind( &controlled_error_bs_type::template resize_m_xnew< StateInOut > , detail::ref( *this ) , detail::_1 ) ); - controlled_step_result res = try_step( system , x , dxdt , t , m_xnew.m_v , dt ); - if( res == success ) - { - boost::numeric::odeint::copy( m_xnew.m_v , x ); - } - return res; - } - - /* - * Version 3 : try_step( sys , in , t , out , dt ) - * - * this version does not solve the forwarding problem, boost.range can not be used - */ - template< class System , class StateIn , class StateOut > - typename boost::disable_if< boost::is_same< StateIn , time_type > , controlled_step_result >::type - try_step( System system , const StateIn &in , time_type &t , StateOut &out , time_type &dt ) - { - typename odeint::unwrap_reference< System >::type &sys = system; - m_dxdt_resizer.adjust_size( in , detail::bind( &controlled_error_bs_type::template resize_m_dxdt< StateIn > , detail::ref( *this ) , detail::_1 ) ); - sys( in , m_dxdt.m_v , t ); - return try_step( system , in , m_dxdt.m_v , t , out , dt ); - } - - - /* - * Full version : try_step( sys , in , dxdt_in , t , out , dt ) - * - * contains the actual implementation - */ - template< class System , class StateIn , class DerivIn , class StateOut > - controlled_step_result try_step( System system , const StateIn &in , const DerivIn &dxdt , time_type &t , StateOut &out , time_type &dt ) - { - if( m_max_dt != static_cast(0) && detail::less_with_sign(m_max_dt, dt, dt) ) - { - // given step size is bigger then max_dt - // set limit and return fail - dt = m_max_dt; - return fail; - } - - BOOST_USING_STD_MIN(); - BOOST_USING_STD_MAX(); - - static const value_type val1( 1.0 ); - - if( m_resizer.adjust_size( in , detail::bind( &controlled_error_bs_type::template resize_impl< StateIn > , detail::ref( *this ) , detail::_1 ) ) ) - { - reset(); // system resized -> reset - } - - if( dt != m_dt_last ) - { - reset(); // step size changed from outside -> reset - } - - bool reject( true ); - - time_vector h_opt( m_k_max+1 ); - inv_time_vector work( m_k_max+1 ); - - time_type new_h = dt; - - /* m_current_k_opt is the estimated current optimal stage number */ - for( size_t k = 0 ; k <= m_current_k_opt+1 ; k++ ) - { - /* the stage counts are stored in m_interval_sequence */ - m_midpoint.set_steps( m_interval_sequence[k] ); - if( k == 0 ) - { - m_midpoint.do_step( system , in , dxdt , t , out , dt ); - /* the first step, nothing more to do */ - } - else - { - m_midpoint.do_step( system , in , dxdt , t , m_table[k-1].m_v , dt ); - extrapolate( k , m_table , m_coeff , out ); - // get error estimate - m_algebra.for_each3( m_err.m_v , out , m_table[0].m_v , - typename operations_type::template scale_sum2< value_type , value_type >( val1 , -val1 ) ); - const value_type error = m_error_checker.error( m_algebra , in , dxdt , m_err.m_v , dt ); - h_opt[k] = calc_h_opt( dt , error , k ); - work[k] = static_cast( m_cost[k] ) / h_opt[k]; - - if( (k == m_current_k_opt-1) || m_first ) - { // convergence before k_opt ? - if( error < 1.0 ) - { - //convergence - reject = false; - if( (work[k] < KFAC2*work[k-1]) || (m_current_k_opt <= 2) ) - { - // leave order as is (except we were in first round) - m_current_k_opt = min BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast(m_k_max)-1 , max BOOST_PREVENT_MACRO_SUBSTITUTION( 2 , static_cast(k)+1 ) ); - new_h = h_opt[k]; - new_h *= static_cast( m_cost[k+1] ) / static_cast( m_cost[k] ); - } else { - m_current_k_opt = min BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast(m_k_max)-1 , max BOOST_PREVENT_MACRO_SUBSTITUTION( 2 , static_cast(k) ) ); - new_h = h_opt[k]; - } - break; - } - else if( should_reject( error , k ) && !m_first ) - { - reject = true; - new_h = h_opt[k]; - break; - } - } - if( k == m_current_k_opt ) - { // convergence at k_opt ? - if( error < 1.0 ) - { - //convergence - reject = false; - if( (work[k-1] < KFAC2*work[k]) ) - { - m_current_k_opt = max BOOST_PREVENT_MACRO_SUBSTITUTION( 2 , static_cast(m_current_k_opt)-1 ); - new_h = h_opt[m_current_k_opt]; - } - else if( (work[k] < KFAC2*work[k-1]) && !m_last_step_rejected ) - { - m_current_k_opt = min BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast(m_k_max-1) , static_cast(m_current_k_opt)+1 ); - new_h = h_opt[k]; - new_h *= static_cast(m_cost[m_current_k_opt])/static_cast(m_cost[k]); - } else - new_h = h_opt[m_current_k_opt]; - break; - } - else if( should_reject( error , k ) ) - { - reject = true; - new_h = h_opt[m_current_k_opt]; - break; - } - } - if( k == m_current_k_opt+1 ) - { // convergence at k_opt+1 ? - if( error < 1.0 ) - { //convergence - reject = false; - if( work[k-2] < KFAC2*work[k-1] ) - m_current_k_opt = max BOOST_PREVENT_MACRO_SUBSTITUTION( 2 , static_cast(m_current_k_opt)-1 ); - if( (work[k] < KFAC2*work[m_current_k_opt]) && !m_last_step_rejected ) - m_current_k_opt = min BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast(m_k_max)-1 , static_cast(k) ); - new_h = h_opt[m_current_k_opt]; - } else - { - reject = true; - new_h = h_opt[m_current_k_opt]; - } - break; - } - } - } - - if( !reject ) - { - t += dt; - } - - if( !m_last_step_rejected || boost::numeric::odeint::detail::less_with_sign(new_h, dt, dt) ) - { - // limit step size - if( m_max_dt != static_cast(0) ) - { - new_h = detail::min_abs(m_max_dt, new_h); - } - m_dt_last = new_h; - dt = new_h; - } - - m_last_step_rejected = reject; - m_first = false; - - if( reject ) - return fail; - else - return success; - } - - /** \brief Resets the internal state of the stepper */ - void reset() - { - m_first = true; - m_last_step_rejected = false; - // crude estimate of optimal order - m_current_k_opt = 4; - /* no calculation because log10 might not exist for value_type! - const value_type logfact( -log10( max BOOST_PREVENT_MACRO_SUBSTITUTION( eps_rel , static_cast< value_type >(1.0E-12) ) ) * 0.6 + 0.5 ); - m_current_k_opt = max BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast( 1 ) , min BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast( m_k_max-1 ) , logfact )); - */ - } - - - /* Resizer methods */ - - template< class StateIn > - void adjust_size( const StateIn &x ) - { - resize_m_dxdt( x ); - resize_m_xnew( x ); - resize_impl( x ); - m_midpoint.adjust_size( x ); - } - - -private: - - template< class StateIn > - bool resize_m_dxdt( const StateIn &x ) - { - return adjust_size_by_resizeability( m_dxdt , x , typename is_resizeable::type() ); - } - - template< class StateIn > - bool resize_m_xnew( const StateIn &x ) - { - return adjust_size_by_resizeability( m_xnew , x , typename is_resizeable::type() ); - } - - template< class StateIn > - bool resize_impl( const StateIn &x ) - { - bool resized( false ); - for( size_t i = 0 ; i < m_k_max ; ++i ) - resized |= adjust_size_by_resizeability( m_table[i] , x , typename is_resizeable::type() ); - resized |= adjust_size_by_resizeability( m_err , x , typename is_resizeable::type() ); - return resized; - } - - - template< class System , class StateInOut > - controlled_step_result try_step_v1( System system , StateInOut &x , time_type &t , time_type &dt ) - { - typename odeint::unwrap_reference< System >::type &sys = system; - m_dxdt_resizer.adjust_size( x , detail::bind( &controlled_error_bs_type::template resize_m_dxdt< StateInOut > , detail::ref( *this ) , detail::_1 ) ); - sys( x , m_dxdt.m_v ,t ); - return try_step( system , x , m_dxdt.m_v , t , dt ); - } - - - template< class StateInOut > - void extrapolate( size_t k , state_table_type &table , const value_matrix &coeff , StateInOut &xest ) - /* polynomial extrapolation, see http://www.nr.com/webnotes/nr3web21.pdf - uses the obtained intermediate results to extrapolate to dt->0 - */ - { - static const value_type val1 = static_cast< value_type >( 1.0 ); - for( int j=k-1 ; j>0 ; --j ) - { - m_algebra.for_each3( table[j-1].m_v , table[j].m_v , table[j-1].m_v , - typename operations_type::template scale_sum2< value_type , value_type >( val1 + coeff[k][j] , -coeff[k][j] ) ); - } - m_algebra.for_each3( xest , table[0].m_v , xest , - typename operations_type::template scale_sum2< value_type , value_type >( val1 + coeff[k][0] , -coeff[k][0]) ); - } - - time_type calc_h_opt( time_type h , value_type error , size_t k ) const - /* calculates the optimal step size for a given error and stage number */ - { - BOOST_USING_STD_MIN(); - BOOST_USING_STD_MAX(); - using std::pow; - value_type expo( 1.0/(2*k+1) ); - value_type facmin = m_facmin_table[k]; - value_type fac; - if (error == 0.0) - fac=1.0/facmin; - else - { - fac = STEPFAC2 / pow BOOST_PREVENT_MACRO_SUBSTITUTION( error / STEPFAC1 , expo ); - fac = max BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast(facmin/STEPFAC4) , min BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast(1.0/facmin) , fac ) ); - } - return h*fac; - } - - controlled_step_result set_k_opt( size_t k , const inv_time_vector &work , const time_vector &h_opt , time_type &dt ) - /* calculates the optimal stage number */ - { - if( k == 1 ) - { - m_current_k_opt = 2; - return success; - } - if( (work[k-1] < KFAC1*work[k]) || (k == m_k_max) ) - { // order decrease - m_current_k_opt = k-1; - dt = h_opt[ m_current_k_opt ]; - return success; - } - else if( (work[k] < KFAC2*work[k-1]) || m_last_step_rejected || (k == m_k_max-1) ) - { // same order - also do this if last step got rejected - m_current_k_opt = k; - dt = h_opt[ m_current_k_opt ]; - return success; - } - else - { // order increase - only if last step was not rejected - m_current_k_opt = k+1; - dt = h_opt[ m_current_k_opt-1 ] * m_cost[ m_current_k_opt ] / m_cost[ m_current_k_opt-1 ] ; - return success; - } - } - - bool in_convergence_window( size_t k ) const - { - if( (k == m_current_k_opt-1) && !m_last_step_rejected ) - return true; // decrease stepsize only if last step was not rejected - return ( (k == m_current_k_opt) || (k == m_current_k_opt+1) ); - } - - bool should_reject( value_type error , size_t k ) const - { - if( k == m_current_k_opt-1 ) - { - const value_type d = m_interval_sequence[m_current_k_opt] * m_interval_sequence[m_current_k_opt+1] / - (m_interval_sequence[0]*m_interval_sequence[0]); - //step will fail, criterion 17.3.17 in NR - return ( error > d*d ); - } - else if( k == m_current_k_opt ) - { - const value_type d = m_interval_sequence[m_current_k_opt] / m_interval_sequence[0]; - return ( error > d*d ); - } else - return error > 1.0; - } - - default_error_checker< value_type, algebra_type , operations_type > m_error_checker; - modified_midpoint< state_type , value_type , deriv_type , time_type , algebra_type , operations_type , resizer_type > m_midpoint; - - bool m_last_step_rejected; - bool m_first; - - time_type m_dt_last; - time_type m_t_last; - time_type m_max_dt; - - size_t m_current_k_opt; - - algebra_type m_algebra; - - resizer_type m_dxdt_resizer; - resizer_type m_xnew_resizer; - resizer_type m_resizer; - - wrapped_state_type m_xnew; - wrapped_state_type m_err; - wrapped_deriv_type m_dxdt; - - int_vector m_interval_sequence; // stores the successive interval counts - value_matrix m_coeff; - int_vector m_cost; // costs for interval count - value_vector m_facmin_table; // for precomputed facmin to save pow calls - - state_table_type m_table; // sequence of states for extrapolation - - value_type STEPFAC1 , STEPFAC2 , STEPFAC3 , STEPFAC4 , KFAC1 , KFAC2; -}; - - -/******** DOXYGEN ********/ -/** - * \class bulirsch_stoer - * \brief The Bulirsch-Stoer algorithm. - * - * The Bulirsch-Stoer is a controlled stepper that adjusts both step size - * and order of the method. The algorithm uses the modified midpoint and - * a polynomial extrapolation compute the solution. - * - * \tparam State The state type. - * \tparam Value The value type. - * \tparam Deriv The type representing the time derivative of the state. - * \tparam Time The time representing the independent variable - the time. - * \tparam Algebra The algebra type. - * \tparam Operations The operations type. - * \tparam Resizer The resizer policy type. - */ - - /** - * \fn bulirsch_stoer::bulirsch_stoer( value_type eps_abs , value_type eps_rel , value_type factor_x , value_type factor_dxdt ) - * \brief Constructs the bulirsch_stoer class, including initialization of - * the error bounds. - * - * \param eps_abs Absolute tolerance level. - * \param eps_rel Relative tolerance level. - * \param factor_x Factor for the weight of the state. - * \param factor_dxdt Factor for the weight of the derivative. - */ - - /** - * \fn bulirsch_stoer::try_step( System system , StateInOut &x , time_type &t , time_type &dt ) - * \brief Tries to perform one step. - * - * This method tries to do one step with step size dt. If the error estimate - * is to large, the step is rejected and the method returns fail and the - * step size dt is reduced. If the error estimate is acceptably small, the - * step is performed, success is returned and dt might be increased to make - * the steps as large as possible. This method also updates t if a step is - * performed. Also, the internal order of the stepper is adjusted if required. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. - * It must fulfill the Simple System concept. - * \param x The state of the ODE which should be solved. Overwritten if - * the step is successful. - * \param t The value of the time. Updated if the step is successful. - * \param dt The step size. Updated. - * \return success if the step was accepted, fail otherwise. - */ - - /** - * \fn bulirsch_stoer::try_step( System system , StateInOut &x , const DerivIn &dxdt , time_type &t , time_type &dt ) - * \brief Tries to perform one step. - * - * This method tries to do one step with step size dt. If the error estimate - * is to large, the step is rejected and the method returns fail and the - * step size dt is reduced. If the error estimate is acceptably small, the - * step is performed, success is returned and dt might be increased to make - * the steps as large as possible. This method also updates t if a step is - * performed. Also, the internal order of the stepper is adjusted if required. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. - * It must fulfill the Simple System concept. - * \param x The state of the ODE which should be solved. Overwritten if - * the step is successful. - * \param dxdt The derivative of state. - * \param t The value of the time. Updated if the step is successful. - * \param dt The step size. Updated. - * \return success if the step was accepted, fail otherwise. - */ - - /** - * \fn bulirsch_stoer::try_step( System system , const StateIn &in , time_type &t , StateOut &out , time_type &dt ) - * \brief Tries to perform one step. - * - * \note This method is disabled if state_type=time_type to avoid ambiguity. - * - * This method tries to do one step with step size dt. If the error estimate - * is to large, the step is rejected and the method returns fail and the - * step size dt is reduced. If the error estimate is acceptably small, the - * step is performed, success is returned and dt might be increased to make - * the steps as large as possible. This method also updates t if a step is - * performed. Also, the internal order of the stepper is adjusted if required. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. - * It must fulfill the Simple System concept. - * \param in The state of the ODE which should be solved. - * \param t The value of the time. Updated if the step is successful. - * \param out Used to store the result of the step. - * \param dt The step size. Updated. - * \return success if the step was accepted, fail otherwise. - */ - - - /** - * \fn bulirsch_stoer::try_step( System system , const StateIn &in , const DerivIn &dxdt , time_type &t , StateOut &out , time_type &dt ) - * \brief Tries to perform one step. - * - * This method tries to do one step with step size dt. If the error estimate - * is to large, the step is rejected and the method returns fail and the - * step size dt is reduced. If the error estimate is acceptably small, the - * step is performed, success is returned and dt might be increased to make - * the steps as large as possible. This method also updates t if a step is - * performed. Also, the internal order of the stepper is adjusted if required. - * - * \param system The system function to solve, hence the r.h.s. of the ODE. - * It must fulfill the Simple System concept. - * \param in The state of the ODE which should be solved. - * \param dxdt The derivative of state. - * \param t The value of the time. Updated if the step is successful. - * \param out Used to store the result of the step. - * \param dt The step size. Updated. - * \return success if the step was accepted, fail otherwise. - */ - - - /** - * \fn bulirsch_stoer::adjust_size( const StateIn &x ) - * \brief Adjust the size of all temporaries in the stepper manually. - * \param x A state from which the size of the temporaries to be resized is deduced. - */ - -} -} -} - -#endif // BOOST_NUMERIC_ODEINT_STEPPER_BULIRSCH_STOER_HPP_INCLUDED - -#endif // USE_BULRISCH_STOER_PATCH diff --git a/src/ublas_types.h b/src/ublas_types.h deleted file mode 100644 index 750b7056..00000000 --- a/src/ublas_types.h +++ /dev/null @@ -1,119 +0,0 @@ -// [[Rcpp::plugins(cpp14)]] - -#pragma once -#ifndef UBLAS_TYPES_H_INCLUDED -#define UBLAS_TYPES_H_INCLUDED - -#include "config.h" -#include -#include -#include - - -namespace ublas = boost::numeric::ublas; - - -template using vector_t = ublas::vector; -template using matrix_t = ublas::matrix; - - -// forward declarations Rcpp <-> boost::numeric::ublas -namespace Rcpp { - - namespace traits { - - template SEXP wrap(const vector_t&); - template SEXP wrap(const matrix_t&); - - template vector_t as(SEXP); - template matrix_t as(SEXP); - - template class Exporter>; - template class Exporter>; - - } - -} - - -#include - - -namespace Rcpp { - - namespace traits { - - template inline SEXP wrap(const vector_t& obj) { - const int RTYPE = Rcpp::traits::r_sexptype_traits::rtype; - return Rcpp::Vector(obj.begin(), obj.end()); - } - - - template inline SEXP wrap(const matrix_t& obj) { - const size_t nr = static_cast(obj.size1()); - const size_t nc = static_cast(obj.size2()); - const int RTYPE = Rcpp::traits::r_sexptype_traits::rtype; - Rcpp::Matrix rmat(nr, nc); - for (size_t i = 0; i < nr; ++i) { - for (size_t j = 0; j < nc; ++j) { - rmat(i, j) = obj(i, j); - } - } - return rmat; - } - - - template - class Exporter> - { - private: - static constexpr int RTYPE = Rcpp::traits::r_sexptype_traits::rtype; - Rcpp::Vector rvec; - - public: - Exporter(SEXP x) : rvec(x) { - if (TYPEOF(x) != RTYPE) { - throw std::invalid_argument("Wrong R type for mapped 1D array"); - } - } - - vector_t get() { - vector_t x(rvec.size()); - std::copy(rvec.begin(), rvec.end(), x.begin()); - return x; - } - }; - - - template - class Exporter> - { - private: - static constexpr int RTYPE = Rcpp::traits::r_sexptype_traits::rtype; - Rcpp::Matrix rmat; - - public: - Exporter(SEXP x) : rmat(x) { - if (TYPEOF(x) != RTYPE) { - throw std::invalid_argument("Wrong R type for mapped 2D array"); - } - } - - matrix_t get() { - const size_t nr = static_cast(rmat.rows()); - const size_t nc = static_cast(rmat.cols()); - matrix_t x(nr, nc); - for (size_t i = 0; i < nr; ++i) { - for (size_t j = 0; j < nc; ++j) { - x(i, j) = rmat(i, j); - } - } - return x; - } - }; - - } - -} - -#endif From 84db2ee28a66f4f14b5961bf8595f36dfa50df15 Mon Sep 17 00:00:00 2001 From: Hanno Hildenbrandt Date: Wed, 22 Mar 2023 10:18:09 +0100 Subject: [PATCH 20/48] custom bstime_t --- src/DAISIE_odeint.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DAISIE_odeint.h b/src/DAISIE_odeint.h index e4d63820..701fa1fd 100644 --- a/src/DAISIE_odeint.h +++ b/src/DAISIE_odeint.h @@ -178,7 +178,7 @@ namespace daisie_odeint { else if ("odeint::bulirsch_stoer" == stepper) { // outlier in calling convention using stepper_t = bulirsch_stoer; - integrate_adaptive(stepper_t(atol, rtol), rhs, y, t0 * si::second, t1 * si::second, (0.1 * (t1 - t0)) * si::second); + integrate_adaptive(stepper_t(atol, rtol), rhs, y, bstime_t{t0}, bstime_t{t1}, bstime_t{0.1 * (t1 - t0)}); } else if (0 == stepper.compare(0, stepper.size() - 2, "odeint::adams_bashforth")) { const char steps = stepper.back(); From f91ae73698a95ceeba810bfac024dfca936f0043 Mon Sep 17 00:00:00 2001 From: Neves-P Date: Wed, 22 Mar 2023 13:57:03 +0100 Subject: [PATCH 21/48] Less message statements --- R/DAISIE_utils.R | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/R/DAISIE_utils.R b/R/DAISIE_utils.R index 8e4b1a06..eff7fd25 100644 --- a/R/DAISIE_utils.R +++ b/R/DAISIE_utils.R @@ -472,19 +472,27 @@ print_ml_par_settings <- function(namepars, optstr <- namepars[idparsopt] } - message("You are optimizing ", paste(optstr, collapse = " ")) + opt_print <- paste0("You are optimizing: ", paste(optstr, collapse = " ")) if (length(namepars[idparsfix]) == 0) { fixstr <- "nothing" } else { fixstr <- namepars[idparsfix] } - message("You are fixing ", paste(fixstr, collapse = " ")) + fix_print <- paste0("You are fixing: ", paste(fixstr, collapse = " ")) if (any(is.numeric(idparsnoshift)) && sum(idparsnoshift %in% (all_no_shift)) != 5) { noshiftstring <- namepars[idparsnoshift] - message("You are not shifting", paste(noshiftstring, collapse = " ")) + shift_prt <- paste0( + "You are not shifting: ", + paste(noshiftstring, collapse = " ") + ) + message(paste(opt_print, fix_print, shift_prt, sep = "\n")) + } else { + message(paste(opt_print, fix_print, sep = "\n")) } + } + invisible(NULL) } From 1c72a6a84829f28103ba96532035bc27cffa955c Mon Sep 17 00:00:00 2001 From: Hanno Hildenbrandt Date: Wed, 22 Mar 2023 15:35:44 +0100 Subject: [PATCH 22/48] boost::units --- .vscode/.env | 14 ++++++------- dummy.R | 4 ++-- src/DAISIE_CS.cpp | 4 +++- src/DAISIE_odeint.h | 48 +++++++++++---------------------------------- 4 files changed, 23 insertions(+), 47 deletions(-) diff --git a/.vscode/.env b/.vscode/.env index 858dd13f..64baa4e3 100644 --- a/.vscode/.env +++ b/.vscode/.env @@ -1,20 +1,20 @@ -LD_LIBRARY_PATH=/home/hanno/opt/Rval/lib/R/lib:/usr/local/lib:/usr/lib/jvm/java-17-openjdk-amd64/lib/server +LD_LIBRARY_PATH=/home/hanno/opt/Rdebug/lib/R/lib:/usr/local/lib:/usr/lib/jvm/java-17-openjdk-amd64/lib/server R_ARCH= R_BROWSER=/usr/bin/xdg-open R_BZIPCMD=/usr/bin/bzip2 -R_DOC_DIR=/home/hanno/opt/Rval/lib/R/doc +R_DOC_DIR=/home/hanno/opt/Rdebug/lib/R/doc R_GZIPCMD=/usr/bin/gzip -R_HOME=/home/hanno/opt/Rval/lib/R -R_INCLUDE_DIR=/home/hanno/opt/Rval/lib/R/include -R_LIBS_SITE=/home/hanno/opt/Rval/lib/R/site-library +R_HOME=/home/hanno/opt/Rdebug/lib/R +R_INCLUDE_DIR=/home/hanno/opt/Rdebug/lib/R/include +R_LIBS_SITE=/home/hanno/opt/Rdebug/lib/R/site-library R_LIBS_USER=/home/hanno/R/x86_64-pc-linux-gnu-library/4.2 R_PAPERSIZE=letter R_PDFVIEWER=/usr/bin/xdg-open R_PLATFORM=x86_64-pc-linux-gnu R_PRINTCMD= R_RD4PDF=times,inconsolata,hyper -R_SESSION_TMPDIR=/tmp/RtmpBbOIae -R_SHARE_DIR=/home/hanno/opt/Rval/lib/R/share +R_SESSION_TMPDIR=/tmp/Rtmp5EoJOh +R_SHARE_DIR=/home/hanno/opt/Rdebug/lib/R/share R_STRIP_SHARED_LIB=strip --strip-unneeded R_STRIP_STATIC_LIB=strip --strip-debug R_SYSTEM_ABI=linux,gcc,gxx,gfortran,gfortran diff --git a/dummy.R b/dummy.R index 27c2905a..10dde7ef 100644 --- a/dummy.R +++ b/dummy.R @@ -16,8 +16,8 @@ Inf, ) pars2 <- c(40, 11, 0, 1) -methode <- 'odeint::runge_kutta_cash_karp54' -loglik_rkck54 <- DAISIE_loglik_all(pars1, pars2, Galapagos_datalist_2types, methode = methode) +#methode <- 'odeint::runge_kutta_cash_karp54' +#loglik_rkck54 <- DAISIE_loglik_all(pars1, pars2, Galapagos_datalist_2types, methode = methode) methode <- 'odeint::bulirsch_stoer' loglik_bs <- DAISIE_loglik_all(pars1, pars2, Galapagos_datalist_2types, methode = methode) diff --git a/src/DAISIE_CS.cpp b/src/DAISIE_CS.cpp index c2104626..9ea96297 100644 --- a/src/DAISIE_CS.cpp +++ b/src/DAISIE_CS.cpp @@ -25,9 +25,11 @@ namespace { static constexpr int default_max_cs_steps = 1000000; static int max_cs_steps = default_max_cs_steps; + // step-size factor for adams_bashforth_moulton integration static constexpr double default_abm_factor = 0.0001; - static double abm_factor = default_abm_factor; + double abm_factor = default_abm_factor; + // common parameter struct param_t diff --git a/src/DAISIE_odeint.h b/src/DAISIE_odeint.h index 701fa1fd..ff81a2f0 100644 --- a/src/DAISIE_odeint.h +++ b/src/DAISIE_odeint.h @@ -17,51 +17,25 @@ #include -using namespace Rcpp; -using namespace boost::numeric::odeint; - -// type of the ode state -using state_type = vector_t; - - #ifdef USE_BULRISCH_STOER_PATCH -// Default initialized double-wrapper -// To be used as template argument for bulrisch_stoer<..., Time, ...> -class bstime_t -{ - public: - constexpr bstime_t() noexcept : val_(0.0) {} - constexpr bstime_t(double val) noexcept : val_(val) {} - constexpr operator double () const noexcept { return val_; } - constexpr operator double& () noexcept { return val_; } - - private: - double val_; -}; - -namespace std { - - template<> - struct numeric_limits : public std::numeric_limits {}; +#include +#include - template<> - struct numeric_limits : public std::numeric_limits {}; +using bstime_t = boost::units::quantity; +#else - template<> - struct numeric_limits : public std::numeric_limits {}; +using bstime_t = double; - template<> - struct numeric_limits : public std::numeric_limits {}; +#endif // USE_BULRISCH_STOER_PATCH -} -#else +using namespace Rcpp; +using namespace boost::numeric::odeint; -// That's much better ;) -using bstime_t = double; +// type of the ode state +using state_type = vector_t; -#endif // USE_BULRISCH_STOER_PATCH // zero-value padded view into vector @@ -88,7 +62,7 @@ class padded_vector_view namespace daisie_odeint { - extern double abm_factor; + extern double abm_factor; // defined in DAISIE_CS.cpp template From 8a8fa2b207793ed7aff117e6c544f71e4f029aa3 Mon Sep 17 00:00:00 2001 From: Neves-P Date: Wed, 22 Mar 2023 19:52:44 +0100 Subject: [PATCH 23/48] Better `verbose` WIP [run ci] --- R/DAISIE_loglik_CS.R | 3 +-- R/DAISIE_loglik_IW.R | 11 +++++------ R/DAISIE_utils.R | 2 +- R/default_params_doc.R | 13 ++++++++----- man/DAISIE_ML.Rd | 13 ++++++++----- man/DAISIE_ML1.Rd | 13 ++++++++----- man/DAISIE_ML2.Rd | 13 ++++++++----- man/DAISIE_ML4.Rd | 13 ++++++++----- man/DAISIE_ML_IW.Rd | 13 ++++++++----- man/DAISIE_format_CS.Rd | 13 ++++++++----- man/DAISIE_format_CS_full_stt.Rd | 13 ++++++++----- man/DAISIE_format_CS_sampled_stt.Rd | 13 ++++++++----- man/DAISIE_format_GW.Rd | 13 ++++++++----- man/DAISIE_format_IW_full_stt.Rd | 13 ++++++++----- man/DAISIE_format_IW_sampled_stt.Rd | 13 ++++++++----- man/DAISIE_loglik_integrand.Rd | 13 ++++++++----- man/DAISIE_loglik_integrate.Rd | 13 ++++++++----- man/DAISIE_sim.Rd | 13 ++++++++----- man/DAISIE_sim_cr_cs.Rd | 13 ++++++++----- man/DAISIE_sim_cr_gw.Rd | 13 ++++++++----- man/DAISIE_sim_cr_iw.Rd | 13 ++++++++----- man/DAISIE_sim_cr_shift.Rd | 13 ++++++++----- man/DAISIE_sim_min_type2.Rd | 13 ++++++++----- man/DAISIE_sim_relaxed_rate.Rd | 13 ++++++++----- man/DAISIE_sim_time_dep.Rd | 13 ++++++++----- man/DAISIE_sim_time_dep_cs.Rd | 13 ++++++++----- man/DAISIE_sim_time_dep_gw.Rd | 13 ++++++++----- man/DAISIE_sim_time_dep_iw.Rd | 13 ++++++++----- man/DAISIE_sim_trait_dep.Rd | 13 ++++++++----- man/DAISIE_sim_trait_dep_2K.Rd | 13 ++++++++----- man/default_params_doc.Rd | 13 ++++++++----- tests/testthat/test-printing.R | 19 +++++++++++++++++++ tests/testthat/test_printing.R | 8 -------- 33 files changed, 250 insertions(+), 157 deletions(-) create mode 100644 tests/testthat/test-printing.R delete mode 100644 tests/testthat/test_printing.R diff --git a/R/DAISIE_loglik_CS.R b/R/DAISIE_loglik_CS.R index 72952cc4..d3677680 100644 --- a/R/DAISIE_loglik_CS.R +++ b/R/DAISIE_loglik_CS.R @@ -1048,7 +1048,7 @@ print_parameters_and_loglik <- function(pars, type = 'island_loglik', distance_dep = NULL) { - if (verbose >= 1) { + if (isTRUE(verbose >= 2)) { if(type == 'clade_loglik') { s1a <- sprintf("Status of colonist: %d", pars[1]) s1b <- sprintf("Parameters:") @@ -1102,7 +1102,6 @@ print_parameters_and_loglik <- function(pars, } } } - utils::flush.console() } } diff --git a/R/DAISIE_loglik_IW.R b/R/DAISIE_loglik_IW.R index 72c7aa50..6a059c48 100644 --- a/R/DAISIE_loglik_IW.R +++ b/R/DAISIE_loglik_IW.R @@ -305,7 +305,7 @@ DAISIE_loglik_IW <- function( } if(is.null(np)) { - cat('Number of species not present is misspecified.\n') + warning('Number of species not present is misspecified.') loglik <- NA return(loglik) } @@ -315,7 +315,7 @@ DAISIE_loglik_IW <- function( if(length(pars1) == 6) { M <- pars1[6] } else { - cat("pars1 should contain 5 or 6 values.\n") + warning("pars1 should contain 5 or 6 values.") loglik <- NA return(loglik) } @@ -381,10 +381,9 @@ DAISIE_loglik_IW <- function( expandvec <- NULL for (k in 0:(length(brts) - 2)) { - if (pars2[4] == 2) + if (isTRUE(identical(pars2[4], 3))) { - cat(paste('k = ',k,', sysdim = ',sysdim,'\n',sep = '')) - utils::flush.console() + message(paste('k = ',k ,', sysdim = ', sysdim, sep = '')) } dime <- list(lxm = lxm, lxe = lxe, sysdim = sysdim) if (sysdimchange == 1) { @@ -503,7 +502,7 @@ DAISIE_loglik_IW <- function( probs <- .Call("daisie_odeint_iw", probs, c(min(brts),0), iw_parms, methode, abstolint, reltolint) } else { y <- deSolve::ode(y = probs, - times = c(min(brts),0), + times = c(min(brts), 0), func = DAISIE_loglik_rhs_IW, parms = iw_parms, rtol = reltolint, diff --git a/R/DAISIE_utils.R b/R/DAISIE_utils.R index eff7fd25..108a818b 100644 --- a/R/DAISIE_utils.R +++ b/R/DAISIE_utils.R @@ -464,7 +464,7 @@ print_ml_par_settings <- function(namepars, idparsnoshift, all_no_shift, verbose) { - if (isTRUE(verbose)) { + if (isTRUE(verbose >= 1)) { if (length(namepars[idparsopt]) == 0) { optstr <- "nothing" diff --git a/R/default_params_doc.R b/R/default_params_doc.R index 602a0575..1cc094b0 100644 --- a/R/default_params_doc.R +++ b/R/default_params_doc.R @@ -73,12 +73,15 @@ #' of species is present, STT is plotted for all species. If two types are #' present, three plots are produced: STT for all, STT for type 1 and STT for #' type 2. -#' @param verbose In simulation and dataprep functions a logical, -#' \code{Default = TRUE} gives intermediate output should be printed. +#' @param verbose A numeric vector of length 1, which in simulations and +#' `DAISIEdataprep()` can be `1` or `0`, where `1` gives intermediate output +#' should be printed. #' For ML functions a numeric determining if intermediate output should be -#' printed, \code{Default = 0} does not print, \code{verbose = 1} prints -#' intermediate output of the parameters and loglikelihood, \code{verbose = 2} -#' means also intermediate progress during loglikelihood computation is shown. +#' printed. The default: `0` does not print, `1` prints the initial +#' likelihood and the settings that were selected (which parameters are +#' to be optimised, fixed or shifted), `2` prints the same as `1 and also the +#' intermediate output of the parameters and loglikelihood, while `3` the +#' same as `2` and prints intermediate progress during likelihood computation. #' @param area_pars A named list containing area and sea level parameters as #' created by \code{\link{create_area_pars}()}: #' \itemize{ diff --git a/man/DAISIE_ML.Rd b/man/DAISIE_ML.Rd index 7af3e734..098d672d 100644 --- a/man/DAISIE_ML.Rd +++ b/man/DAISIE_ML.Rd @@ -181,12 +181,15 @@ model, for a relaxed-rate model a list with the following elements: \code{"immigration"}, or \code{"anagenesis"}.} }} -\item{verbose}{In simulation and dataprep functions a logical, -\code{Default = TRUE} gives intermediate output should be printed. +\item{verbose}{A numeric vector of length 1, which in simulations and +`DAISIEdataprep()` can be `1` or `0`, where `1` gives intermediate output +should be printed. For ML functions a numeric determining if intermediate output should be -printed, \code{Default = 0} does not print, \code{verbose = 1} prints -intermediate output of the parameters and loglikelihood, \code{verbose = 2} -means also intermediate progress during loglikelihood computation is shown.} +printed. The default: `0` does not print, `1` prints the initial +likelihood and the settings that were selected (which parameters are +to be optimised, fixed or shifted), `2` prints the same as `1 and also the +intermediate output of the parameters and loglikelihood, while `3` the +same as `2` and prints intermediate progress during likelihood computation.} \item{tolint}{Vector of two elements containing the absolute and relative tolerance of the integration.} diff --git a/man/DAISIE_ML1.Rd b/man/DAISIE_ML1.Rd index abe0d776..158de7c1 100644 --- a/man/DAISIE_ML1.Rd +++ b/man/DAISIE_ML1.Rd @@ -154,12 +154,15 @@ model, for a relaxed-rate model a list with the following elements: \code{"immigration"}, or \code{"anagenesis"}.} }} -\item{verbose}{In simulation and dataprep functions a logical, -\code{Default = TRUE} gives intermediate output should be printed. +\item{verbose}{A numeric vector of length 1, which in simulations and +`DAISIEdataprep()` can be `1` or `0`, where `1` gives intermediate output +should be printed. For ML functions a numeric determining if intermediate output should be -printed, \code{Default = 0} does not print, \code{verbose = 1} prints -intermediate output of the parameters and loglikelihood, \code{verbose = 2} -means also intermediate progress during loglikelihood computation is shown.} +printed. The default: `0` does not print, `1` prints the initial +likelihood and the settings that were selected (which parameters are +to be optimised, fixed or shifted), `2` prints the same as `1 and also the +intermediate output of the parameters and loglikelihood, while `3` the +same as `2` and prints intermediate progress during likelihood computation.} \item{tolint}{Vector of two elements containing the absolute and relative tolerance of the integration.} diff --git a/man/DAISIE_ML2.Rd b/man/DAISIE_ML2.Rd index cf10630b..1521dfe1 100644 --- a/man/DAISIE_ML2.Rd +++ b/man/DAISIE_ML2.Rd @@ -135,12 +135,15 @@ and \code{"ode45"} from \code{\link[deSolve]{ode}()} for `subplex` (see `\link[subplex]{subplex}()` for full details). Alternative is \code{"simplex"} which was the method in previous versions.} -\item{verbose}{In simulation and dataprep functions a logical, -\code{Default = TRUE} gives intermediate output should be printed. +\item{verbose}{A numeric vector of length 1, which in simulations and +`DAISIEdataprep()` can be `1` or `0`, where `1` gives intermediate output +should be printed. For ML functions a numeric determining if intermediate output should be -printed, \code{Default = 0} does not print, \code{verbose = 1} prints -intermediate output of the parameters and loglikelihood, \code{verbose = 2} -means also intermediate progress during loglikelihood computation is shown.} +printed. The default: `0` does not print, `1` prints the initial +likelihood and the settings that were selected (which parameters are +to be optimised, fixed or shifted), `2` prints the same as `1 and also the +intermediate output of the parameters and loglikelihood, while `3` the +same as `2` and prints intermediate progress during likelihood computation.} \item{tolint}{Vector of two elements containing the absolute and relative tolerance of the integration.} diff --git a/man/DAISIE_ML4.Rd b/man/DAISIE_ML4.Rd index 0476994e..e31fc101 100644 --- a/man/DAISIE_ML4.Rd +++ b/man/DAISIE_ML4.Rd @@ -129,12 +129,15 @@ model, for a relaxed-rate model a list with the following elements: \code{"immigration"}, or \code{"anagenesis"}.} }} -\item{verbose}{In simulation and dataprep functions a logical, -\code{Default = TRUE} gives intermediate output should be printed. +\item{verbose}{A numeric vector of length 1, which in simulations and +`DAISIEdataprep()` can be `1` or `0`, where `1` gives intermediate output +should be printed. For ML functions a numeric determining if intermediate output should be -printed, \code{Default = 0} does not print, \code{verbose = 1} prints -intermediate output of the parameters and loglikelihood, \code{verbose = 2} -means also intermediate progress during loglikelihood computation is shown.} +printed. The default: `0` does not print, `1` prints the initial +likelihood and the settings that were selected (which parameters are +to be optimised, fixed or shifted), `2` prints the same as `1 and also the +intermediate output of the parameters and loglikelihood, while `3` the +same as `2` and prints intermediate progress during likelihood computation.} \item{tolint}{Vector of two elements containing the absolute and relative tolerance of the integration.} diff --git a/man/DAISIE_ML_IW.Rd b/man/DAISIE_ML_IW.Rd index 50ef9088..51b53994 100644 --- a/man/DAISIE_ML_IW.Rd +++ b/man/DAISIE_ML_IW.Rd @@ -115,12 +115,15 @@ and \code{"ode45"} from \code{\link[deSolve]{ode}()} for `subplex` (see `\link[subplex]{subplex}()` for full details). Alternative is \code{"simplex"} which was the method in previous versions.} -\item{verbose}{In simulation and dataprep functions a logical, -\code{Default = TRUE} gives intermediate output should be printed. +\item{verbose}{A numeric vector of length 1, which in simulations and +`DAISIEdataprep()` can be `1` or `0`, where `1` gives intermediate output +should be printed. For ML functions a numeric determining if intermediate output should be -printed, \code{Default = 0} does not print, \code{verbose = 1} prints -intermediate output of the parameters and loglikelihood, \code{verbose = 2} -means also intermediate progress during loglikelihood computation is shown.} +printed. The default: `0` does not print, `1` prints the initial +likelihood and the settings that were selected (which parameters are +to be optimised, fixed or shifted), `2` prints the same as `1 and also the +intermediate output of the parameters and loglikelihood, while `3` the +same as `2` and prints intermediate progress during likelihood computation.} \item{tolint}{Vector of two elements containing the absolute and relative tolerance of the integration.} diff --git a/man/DAISIE_format_CS.Rd b/man/DAISIE_format_CS.Rd index 84773fb1..e5101da8 100644 --- a/man/DAISIE_format_CS.Rd +++ b/man/DAISIE_format_CS.Rd @@ -37,12 +37,15 @@ species that can potentially colonize the island.} divided by for plotting purposes. Larger values will lead to plots with higher resolution, but will also run slower.} -\item{verbose}{In simulation and dataprep functions a logical, -\code{Default = TRUE} gives intermediate output should be printed. +\item{verbose}{A numeric vector of length 1, which in simulations and +`DAISIEdataprep()` can be `1` or `0`, where `1` gives intermediate output +should be printed. For ML functions a numeric determining if intermediate output should be -printed, \code{Default = 0} does not print, \code{verbose = 1} prints -intermediate output of the parameters and loglikelihood, \code{verbose = 2} -means also intermediate progress during loglikelihood computation is shown.} +printed. The default: `0` does not print, `1` prints the initial +likelihood and the settings that were selected (which parameters are +to be optimised, fixed or shifted), `2` prints the same as `1 and also the +intermediate output of the parameters and loglikelihood, while `3` the +same as `2` and prints intermediate progress during likelihood computation.} \item{trait_pars}{A named list containing diversification rates considering two trait states created by \code{\link{create_trait_pars}}: diff --git a/man/DAISIE_format_CS_full_stt.Rd b/man/DAISIE_format_CS_full_stt.Rd index 811b3e56..28b99beb 100644 --- a/man/DAISIE_format_CS_full_stt.Rd +++ b/man/DAISIE_format_CS_full_stt.Rd @@ -32,12 +32,15 @@ will stop the simulation at the mid-life of the island.} \item{M}{Numeric defining the size of mainland pool, i.e. the number of species that can potentially colonize the island.} -\item{verbose}{In simulation and dataprep functions a logical, -\code{Default = TRUE} gives intermediate output should be printed. +\item{verbose}{A numeric vector of length 1, which in simulations and +`DAISIEdataprep()` can be `1` or `0`, where `1` gives intermediate output +should be printed. For ML functions a numeric determining if intermediate output should be -printed, \code{Default = 0} does not print, \code{verbose = 1} prints -intermediate output of the parameters and loglikelihood, \code{verbose = 2} -means also intermediate progress during loglikelihood computation is shown.} +printed. The default: `0` does not print, `1` prints the initial +likelihood and the settings that were selected (which parameters are +to be optimised, fixed or shifted), `2` prints the same as `1 and also the +intermediate output of the parameters and loglikelihood, while `3` the +same as `2` and prints intermediate progress during likelihood computation.} \item{trait_pars}{A named list containing diversification rates considering two trait states created by \code{\link{create_trait_pars}}: diff --git a/man/DAISIE_format_CS_sampled_stt.Rd b/man/DAISIE_format_CS_sampled_stt.Rd index 2d6e2f28..844c2b9a 100644 --- a/man/DAISIE_format_CS_sampled_stt.Rd +++ b/man/DAISIE_format_CS_sampled_stt.Rd @@ -37,12 +37,15 @@ species that can potentially colonize the island.} divided by for plotting purposes. Larger values will lead to plots with higher resolution, but will also run slower.} -\item{verbose}{In simulation and dataprep functions a logical, -\code{Default = TRUE} gives intermediate output should be printed. +\item{verbose}{A numeric vector of length 1, which in simulations and +`DAISIEdataprep()` can be `1` or `0`, where `1` gives intermediate output +should be printed. For ML functions a numeric determining if intermediate output should be -printed, \code{Default = 0} does not print, \code{verbose = 1} prints -intermediate output of the parameters and loglikelihood, \code{verbose = 2} -means also intermediate progress during loglikelihood computation is shown.} +printed. The default: `0` does not print, `1` prints the initial +likelihood and the settings that were selected (which parameters are +to be optimised, fixed or shifted), `2` prints the same as `1 and also the +intermediate output of the parameters and loglikelihood, while `3` the +same as `2` and prints intermediate progress during likelihood computation.} \item{trait_pars}{A named list containing diversification rates considering two trait states created by \code{\link{create_trait_pars}}: diff --git a/man/DAISIE_format_GW.Rd b/man/DAISIE_format_GW.Rd index 8c4b8e38..6da3ee03 100644 --- a/man/DAISIE_format_GW.Rd +++ b/man/DAISIE_format_GW.Rd @@ -41,12 +41,15 @@ higher resolution, but will also run slower.} mainland species is divided by the number of guilds when \code{divdepmodel = "GW"}} -\item{verbose}{In simulation and dataprep functions a logical, -\code{Default = TRUE} gives intermediate output should be printed. +\item{verbose}{A numeric vector of length 1, which in simulations and +`DAISIEdataprep()` can be `1` or `0`, where `1` gives intermediate output +should be printed. For ML functions a numeric determining if intermediate output should be -printed, \code{Default = 0} does not print, \code{verbose = 1} prints -intermediate output of the parameters and loglikelihood, \code{verbose = 2} -means also intermediate progress during loglikelihood computation is shown.} +printed. The default: `0` does not print, `1` prints the initial +likelihood and the settings that were selected (which parameters are +to be optimised, fixed or shifted), `2` prints the same as `1 and also the +intermediate output of the parameters and loglikelihood, while `3` the +same as `2` and prints intermediate progress during likelihood computation.} } \value{ List with GW DAISIE simulation output diff --git a/man/DAISIE_format_IW_full_stt.Rd b/man/DAISIE_format_IW_full_stt.Rd index 88f07bb4..280ef37f 100644 --- a/man/DAISIE_format_IW_full_stt.Rd +++ b/man/DAISIE_format_IW_full_stt.Rd @@ -24,12 +24,15 @@ units.} \item{M}{Numeric defining the size of mainland pool, i.e. the number of species that can potentially colonize the island.} -\item{verbose}{In simulation and dataprep functions a logical, -\code{Default = TRUE} gives intermediate output should be printed. +\item{verbose}{A numeric vector of length 1, which in simulations and +`DAISIEdataprep()` can be `1` or `0`, where `1` gives intermediate output +should be printed. For ML functions a numeric determining if intermediate output should be -printed, \code{Default = 0} does not print, \code{verbose = 1} prints -intermediate output of the parameters and loglikelihood, \code{verbose = 2} -means also intermediate progress during loglikelihood computation is shown.} +printed. The default: `0` does not print, `1` prints the initial +likelihood and the settings that were selected (which parameters are +to be optimised, fixed or shifted), `2` prints the same as `1 and also the +intermediate output of the parameters and loglikelihood, while `3` the +same as `2` and prints intermediate progress during likelihood computation.} } \value{ List with IW DAISIE simulation output diff --git a/man/DAISIE_format_IW_sampled_stt.Rd b/man/DAISIE_format_IW_sampled_stt.Rd index 91e0cfe9..602cbbad 100644 --- a/man/DAISIE_format_IW_sampled_stt.Rd +++ b/man/DAISIE_format_IW_sampled_stt.Rd @@ -34,12 +34,15 @@ species that can potentially colonize the island.} divided by for plotting purposes. Larger values will lead to plots with higher resolution, but will also run slower.} -\item{verbose}{In simulation and dataprep functions a logical, -\code{Default = TRUE} gives intermediate output should be printed. +\item{verbose}{A numeric vector of length 1, which in simulations and +`DAISIEdataprep()` can be `1` or `0`, where `1` gives intermediate output +should be printed. For ML functions a numeric determining if intermediate output should be -printed, \code{Default = 0} does not print, \code{verbose = 1} prints -intermediate output of the parameters and loglikelihood, \code{verbose = 2} -means also intermediate progress during loglikelihood computation is shown.} +printed. The default: `0` does not print, `1` prints the initial +likelihood and the settings that were selected (which parameters are +to be optimised, fixed or shifted), `2` prints the same as `1 and also the +intermediate output of the parameters and loglikelihood, while `3` the +same as `2` and prints intermediate progress during likelihood computation.} } \value{ List with IW DAISIE simulation output diff --git a/man/DAISIE_loglik_integrand.Rd b/man/DAISIE_loglik_integrand.Rd index aec1eaee..f85af8e1 100644 --- a/man/DAISIE_loglik_integrand.Rd +++ b/man/DAISIE_loglik_integrand.Rd @@ -61,12 +61,15 @@ and \code{"ode45"} from \code{\link[deSolve]{ode}()} for \item{reltolint}{Numeric relative tolerance of the integration} -\item{verbose}{In simulation and dataprep functions a logical, -\code{Default = TRUE} gives intermediate output should be printed. +\item{verbose}{A numeric vector of length 1, which in simulations and +`DAISIEdataprep()` can be `1` or `0`, where `1` gives intermediate output +should be printed. For ML functions a numeric determining if intermediate output should be -printed, \code{Default = 0} does not print, \code{verbose = 1} prints -intermediate output of the parameters and loglikelihood, \code{verbose = 2} -means also intermediate progress during loglikelihood computation is shown.} +printed. The default: `0` does not print, `1` prints the initial +likelihood and the settings that were selected (which parameters are +to be optimised, fixed or shifted), `2` prints the same as `1 and also the +intermediate output of the parameters and loglikelihood, while `3` the +same as `2` and prints intermediate progress during likelihood computation.} \item{pick}{Numeric determining which parameter is selected for the relaxed-rate model} diff --git a/man/DAISIE_loglik_integrate.Rd b/man/DAISIE_loglik_integrate.Rd index 80ba5b8f..e5b7a6c8 100644 --- a/man/DAISIE_loglik_integrate.Rd +++ b/man/DAISIE_loglik_integrate.Rd @@ -66,12 +66,15 @@ and \code{"ode45"} from \code{\link[deSolve]{ode}()} for \item{reltolint}{Numeric relative tolerance of the integration} -\item{verbose}{In simulation and dataprep functions a logical, -\code{Default = TRUE} gives intermediate output should be printed. +\item{verbose}{A numeric vector of length 1, which in simulations and +`DAISIEdataprep()` can be `1` or `0`, where `1` gives intermediate output +should be printed. For ML functions a numeric determining if intermediate output should be -printed, \code{Default = 0} does not print, \code{verbose = 1} prints -intermediate output of the parameters and loglikelihood, \code{verbose = 2} -means also intermediate progress during loglikelihood computation is shown.} +printed. The default: `0` does not print, `1` prints the initial +likelihood and the settings that were selected (which parameters are +to be optimised, fixed or shifted), `2` prints the same as `1 and also the +intermediate output of the parameters and loglikelihood, while `3` the +same as `2` and prints intermediate progress during likelihood computation.} } \value{ A loglikelihood value diff --git a/man/DAISIE_sim.Rd b/man/DAISIE_sim.Rd index f46a0e23..f058e824 100644 --- a/man/DAISIE_sim.Rd +++ b/man/DAISIE_sim.Rd @@ -138,12 +138,15 @@ conditioning on island age and non-extinction of the island biota \cr. cond > 1 : conditioning on island age and having at least cond colonizations on the island. This last option is not yet available for the IW model \cr} -\item{verbose}{In simulation and dataprep functions a logical, -\code{Default = TRUE} gives intermediate output should be printed. +\item{verbose}{A numeric vector of length 1, which in simulations and +`DAISIEdataprep()` can be `1` or `0`, where `1` gives intermediate output +should be printed. For ML functions a numeric determining if intermediate output should be -printed, \code{Default = 0} does not print, \code{verbose = 1} prints -intermediate output of the parameters and loglikelihood, \code{verbose = 2} -means also intermediate progress during loglikelihood computation is shown.} +printed. The default: `0` does not print, `1` prints the initial +likelihood and the settings that were selected (which parameters are +to be optimised, fixed or shifted), `2` prints the same as `1 and also the +intermediate output of the parameters and loglikelihood, while `3` the +same as `2` and prints intermediate progress during likelihood computation.} \item{...}{Any arguments to pass on to plotting functions.} } diff --git a/man/DAISIE_sim_cr_cs.Rd b/man/DAISIE_sim_cr_cs.Rd index c65e1af2..4befd59b 100644 --- a/man/DAISIE_sim_cr_cs.Rd +++ b/man/DAISIE_sim_cr_cs.Rd @@ -111,12 +111,15 @@ conditioning on island age and non-extinction of the island biota \cr. cond > 1 : conditioning on island age and having at least cond colonizations on the island. This last option is not yet available for the IW model \cr} -\item{verbose}{In simulation and dataprep functions a logical, -\code{Default = TRUE} gives intermediate output should be printed. +\item{verbose}{A numeric vector of length 1, which in simulations and +`DAISIEdataprep()` can be `1` or `0`, where `1` gives intermediate output +should be printed. For ML functions a numeric determining if intermediate output should be -printed, \code{Default = 0} does not print, \code{verbose = 1} prints -intermediate output of the parameters and loglikelihood, \code{verbose = 2} -means also intermediate progress during loglikelihood computation is shown.} +printed. The default: `0` does not print, `1` prints the initial +likelihood and the settings that were selected (which parameters are +to be optimised, fixed or shifted), `2` prints the same as `1 and also the +intermediate output of the parameters and loglikelihood, while `3` the +same as `2` and prints intermediate progress during likelihood computation.} } \value{ A list. The highest level of the least corresponds to each individual diff --git a/man/DAISIE_sim_cr_gw.Rd b/man/DAISIE_sim_cr_gw.Rd index 93c267f6..f23853c9 100644 --- a/man/DAISIE_sim_cr_gw.Rd +++ b/man/DAISIE_sim_cr_gw.Rd @@ -89,12 +89,15 @@ created by \code{\link{create_area_pars}()}: \item{[7]: angle of the slope of the island} }} -\item{verbose}{In simulation and dataprep functions a logical, -\code{Default = TRUE} gives intermediate output should be printed. +\item{verbose}{A numeric vector of length 1, which in simulations and +`DAISIEdataprep()` can be `1` or `0`, where `1` gives intermediate output +should be printed. For ML functions a numeric determining if intermediate output should be -printed, \code{Default = 0} does not print, \code{verbose = 1} prints -intermediate output of the parameters and loglikelihood, \code{verbose = 2} -means also intermediate progress during loglikelihood computation is shown.} +printed. The default: `0` does not print, `1` prints the initial +likelihood and the settings that were selected (which parameters are +to be optimised, fixed or shifted), `2` prints the same as `1 and also the +intermediate output of the parameters and loglikelihood, while `3` the +same as `2` and prints intermediate progress during likelihood computation.} } \value{ A list. The highest level of the least corresponds to each individual diff --git a/man/DAISIE_sim_cr_iw.Rd b/man/DAISIE_sim_cr_iw.Rd index 09a8e647..456184c9 100644 --- a/man/DAISIE_sim_cr_iw.Rd +++ b/man/DAISIE_sim_cr_iw.Rd @@ -90,12 +90,15 @@ conditioning on island age and non-extinction of the island biota \cr. cond > 1 : conditioning on island age and having at least cond colonizations on the island. This last option is not yet available for the IW model \cr} -\item{verbose}{In simulation and dataprep functions a logical, -\code{Default = TRUE} gives intermediate output should be printed. +\item{verbose}{A numeric vector of length 1, which in simulations and +`DAISIEdataprep()` can be `1` or `0`, where `1` gives intermediate output +should be printed. For ML functions a numeric determining if intermediate output should be -printed, \code{Default = 0} does not print, \code{verbose = 1} prints -intermediate output of the parameters and loglikelihood, \code{verbose = 2} -means also intermediate progress during loglikelihood computation is shown.} +printed. The default: `0` does not print, `1` prints the initial +likelihood and the settings that were selected (which parameters are +to be optimised, fixed or shifted), `2` prints the same as `1 and also the +intermediate output of the parameters and loglikelihood, while `3` the +same as `2` and prints intermediate progress during likelihood computation.} } \value{ A list. The highest level of the least corresponds to each individual diff --git a/man/DAISIE_sim_cr_shift.Rd b/man/DAISIE_sim_cr_shift.Rd index 2b4a9893..8a45c848 100644 --- a/man/DAISIE_sim_cr_shift.Rd +++ b/man/DAISIE_sim_cr_shift.Rd @@ -120,12 +120,15 @@ conditioning on island age and non-extinction of the island biota \cr. cond > 1 : conditioning on island age and having at least cond colonizations on the island. This last option is not yet available for the IW model \cr} -\item{verbose}{In simulation and dataprep functions a logical, -\code{Default = TRUE} gives intermediate output should be printed. +\item{verbose}{A numeric vector of length 1, which in simulations and +`DAISIEdataprep()` can be `1` or `0`, where `1` gives intermediate output +should be printed. For ML functions a numeric determining if intermediate output should be -printed, \code{Default = 0} does not print, \code{verbose = 1} prints -intermediate output of the parameters and loglikelihood, \code{verbose = 2} -means also intermediate progress during loglikelihood computation is shown.} +printed. The default: `0` does not print, `1` prints the initial +likelihood and the settings that were selected (which parameters are +to be optimised, fixed or shifted), `2` prints the same as `1 and also the +intermediate output of the parameters and loglikelihood, while `3` the +same as `2` and prints intermediate progress during likelihood computation.} \item{...}{Any arguments to pass on to plotting functions.} } diff --git a/man/DAISIE_sim_min_type2.Rd b/man/DAISIE_sim_min_type2.Rd index c5be7d4f..12e98058 100644 --- a/man/DAISIE_sim_min_type2.Rd +++ b/man/DAISIE_sim_min_type2.Rd @@ -81,12 +81,15 @@ calculations as returned by \code{\link{create_hyper_pars}()}: \item{[2]: is x the exponent for calculating extinction rate} }} -\item{verbose}{In simulation and dataprep functions a logical, -\code{Default = TRUE} gives intermediate output should be printed. +\item{verbose}{A numeric vector of length 1, which in simulations and +`DAISIEdataprep()` can be `1` or `0`, where `1` gives intermediate output +should be printed. For ML functions a numeric determining if intermediate output should be -printed, \code{Default = 0} does not print, \code{verbose = 1} prints -intermediate output of the parameters and loglikelihood, \code{verbose = 2} -means also intermediate progress during loglikelihood computation is shown.} +printed. The default: `0` does not print, `1` prints the initial +likelihood and the settings that were selected (which parameters are +to be optimised, fixed or shifted), `2` prints the same as `1 and also the +intermediate output of the parameters and loglikelihood, while `3` the +same as `2` and prints intermediate progress during likelihood computation.} } \description{ Internal function of the DAISIE simulation diff --git a/man/DAISIE_sim_relaxed_rate.Rd b/man/DAISIE_sim_relaxed_rate.Rd index fc62a68b..685f9175 100644 --- a/man/DAISIE_sim_relaxed_rate.Rd +++ b/man/DAISIE_sim_relaxed_rate.Rd @@ -106,12 +106,15 @@ conditioning on island age and non-extinction of the island biota \cr. cond > 1 : conditioning on island age and having at least cond colonizations on the island. This last option is not yet available for the IW model \cr} -\item{verbose}{In simulation and dataprep functions a logical, -\code{Default = TRUE} gives intermediate output should be printed. +\item{verbose}{A numeric vector of length 1, which in simulations and +`DAISIEdataprep()` can be `1` or `0`, where `1` gives intermediate output +should be printed. For ML functions a numeric determining if intermediate output should be -printed, \code{Default = 0} does not print, \code{verbose = 1} prints -intermediate output of the parameters and loglikelihood, \code{verbose = 2} -means also intermediate progress during loglikelihood computation is shown.} +printed. The default: `0` does not print, `1` prints the initial +likelihood and the settings that were selected (which parameters are +to be optimised, fixed or shifted), `2` prints the same as `1 and also the +intermediate output of the parameters and loglikelihood, while `3` the +same as `2` and prints intermediate progress during likelihood computation.} \item{...}{Any arguments to pass on to plotting functions.} } diff --git a/man/DAISIE_sim_time_dep.Rd b/man/DAISIE_sim_time_dep.Rd index 43829a65..20e2c258 100644 --- a/man/DAISIE_sim_time_dep.Rd +++ b/man/DAISIE_sim_time_dep.Rd @@ -137,12 +137,15 @@ conditioning on island age and non-extinction of the island biota \cr. cond > 1 : conditioning on island age and having at least cond colonizations on the island. This last option is not yet available for the IW model \cr} -\item{verbose}{In simulation and dataprep functions a logical, -\code{Default = TRUE} gives intermediate output should be printed. +\item{verbose}{A numeric vector of length 1, which in simulations and +`DAISIEdataprep()` can be `1` or `0`, where `1` gives intermediate output +should be printed. For ML functions a numeric determining if intermediate output should be -printed, \code{Default = 0} does not print, \code{verbose = 1} prints -intermediate output of the parameters and loglikelihood, \code{verbose = 2} -means also intermediate progress during loglikelihood computation is shown.} +printed. The default: `0` does not print, `1` prints the initial +likelihood and the settings that were selected (which parameters are +to be optimised, fixed or shifted), `2` prints the same as `1 and also the +intermediate output of the parameters and loglikelihood, while `3` the +same as `2` and prints intermediate progress during likelihood computation.} \item{...}{Any arguments to pass on to plotting functions.} } diff --git a/man/DAISIE_sim_time_dep_cs.Rd b/man/DAISIE_sim_time_dep_cs.Rd index 49781453..101556c9 100644 --- a/man/DAISIE_sim_time_dep_cs.Rd +++ b/man/DAISIE_sim_time_dep_cs.Rd @@ -125,12 +125,15 @@ conditioning on island age and non-extinction of the island biota \cr. cond > 1 : conditioning on island age and having at least cond colonizations on the island. This last option is not yet available for the IW model \cr} -\item{verbose}{In simulation and dataprep functions a logical, -\code{Default = TRUE} gives intermediate output should be printed. +\item{verbose}{A numeric vector of length 1, which in simulations and +`DAISIEdataprep()` can be `1` or `0`, where `1` gives intermediate output +should be printed. For ML functions a numeric determining if intermediate output should be -printed, \code{Default = 0} does not print, \code{verbose = 1} prints -intermediate output of the parameters and loglikelihood, \code{verbose = 2} -means also intermediate progress during loglikelihood computation is shown.} +printed. The default: `0` does not print, `1` prints the initial +likelihood and the settings that were selected (which parameters are +to be optimised, fixed or shifted), `2` prints the same as `1 and also the +intermediate output of the parameters and loglikelihood, while `3` the +same as `2` and prints intermediate progress during likelihood computation.} } \value{ A list. The highest level of the least corresponds to each individual diff --git a/man/DAISIE_sim_time_dep_gw.Rd b/man/DAISIE_sim_time_dep_gw.Rd index 9ed84d0f..56f83128 100644 --- a/man/DAISIE_sim_time_dep_gw.Rd +++ b/man/DAISIE_sim_time_dep_gw.Rd @@ -124,12 +124,15 @@ present and the \code{area_pars}.} \item{extcutoff}{A numeric with the cutoff for the the maximum extinction rate preventing it from being too large and slowing down simulation.} -\item{verbose}{In simulation and dataprep functions a logical, -\code{Default = TRUE} gives intermediate output should be printed. +\item{verbose}{A numeric vector of length 1, which in simulations and +`DAISIEdataprep()` can be `1` or `0`, where `1` gives intermediate output +should be printed. For ML functions a numeric determining if intermediate output should be -printed, \code{Default = 0} does not print, \code{verbose = 1} prints -intermediate output of the parameters and loglikelihood, \code{verbose = 2} -means also intermediate progress during loglikelihood computation is shown.} +printed. The default: `0` does not print, `1` prints the initial +likelihood and the settings that were selected (which parameters are +to be optimised, fixed or shifted), `2` prints the same as `1 and also the +intermediate output of the parameters and loglikelihood, while `3` the +same as `2` and prints intermediate progress during likelihood computation.} } \value{ A list. The highest level of the least corresponds to each individual diff --git a/man/DAISIE_sim_time_dep_iw.Rd b/man/DAISIE_sim_time_dep_iw.Rd index d6010e4c..a5ee8e7a 100644 --- a/man/DAISIE_sim_time_dep_iw.Rd +++ b/man/DAISIE_sim_time_dep_iw.Rd @@ -125,12 +125,15 @@ conditioning on island age and non-extinction of the island biota \cr. cond > 1 : conditioning on island age and having at least cond colonizations on the island. This last option is not yet available for the IW model \cr} -\item{verbose}{In simulation and dataprep functions a logical, -\code{Default = TRUE} gives intermediate output should be printed. +\item{verbose}{A numeric vector of length 1, which in simulations and +`DAISIEdataprep()` can be `1` or `0`, where `1` gives intermediate output +should be printed. For ML functions a numeric determining if intermediate output should be -printed, \code{Default = 0} does not print, \code{verbose = 1} prints -intermediate output of the parameters and loglikelihood, \code{verbose = 2} -means also intermediate progress during loglikelihood computation is shown.} +printed. The default: `0` does not print, `1` prints the initial +likelihood and the settings that were selected (which parameters are +to be optimised, fixed or shifted), `2` prints the same as `1 and also the +intermediate output of the parameters and loglikelihood, while `3` the +same as `2` and prints intermediate progress during likelihood computation.} } \value{ A list. The highest level of the least corresponds to each individual diff --git a/man/DAISIE_sim_trait_dep.Rd b/man/DAISIE_sim_trait_dep.Rd index 442eb5ab..1a3cb8e7 100644 --- a/man/DAISIE_sim_trait_dep.Rd +++ b/man/DAISIE_sim_trait_dep.Rd @@ -126,12 +126,15 @@ conditioning on island age and non-extinction of the island biota \cr. cond > 1 : conditioning on island age and having at least cond colonizations on the island. This last option is not yet available for the IW model \cr} -\item{verbose}{In simulation and dataprep functions a logical, -\code{Default = TRUE} gives intermediate output should be printed. +\item{verbose}{A numeric vector of length 1, which in simulations and +`DAISIEdataprep()` can be `1` or `0`, where `1` gives intermediate output +should be printed. For ML functions a numeric determining if intermediate output should be -printed, \code{Default = 0} does not print, \code{verbose = 1} prints -intermediate output of the parameters and loglikelihood, \code{verbose = 2} -means also intermediate progress during loglikelihood computation is shown.} +printed. The default: `0` does not print, `1` prints the initial +likelihood and the settings that were selected (which parameters are +to be optimised, fixed or shifted), `2` prints the same as `1 and also the +intermediate output of the parameters and loglikelihood, while `3` the +same as `2` and prints intermediate progress during likelihood computation.} \item{trait_pars}{A named list containing diversification rates considering two trait states created by \code{\link{create_trait_pars}}: diff --git a/man/DAISIE_sim_trait_dep_2K.Rd b/man/DAISIE_sim_trait_dep_2K.Rd index d84c2230..c2d86e39 100644 --- a/man/DAISIE_sim_trait_dep_2K.Rd +++ b/man/DAISIE_sim_trait_dep_2K.Rd @@ -126,12 +126,15 @@ conditioning on island age and non-extinction of the island biota \cr. cond > 1 : conditioning on island age and having at least cond colonizations on the island. This last option is not yet available for the IW model \cr} -\item{verbose}{In simulation and dataprep functions a logical, -\code{Default = TRUE} gives intermediate output should be printed. +\item{verbose}{A numeric vector of length 1, which in simulations and +`DAISIEdataprep()` can be `1` or `0`, where `1` gives intermediate output +should be printed. For ML functions a numeric determining if intermediate output should be -printed, \code{Default = 0} does not print, \code{verbose = 1} prints -intermediate output of the parameters and loglikelihood, \code{verbose = 2} -means also intermediate progress during loglikelihood computation is shown.} +printed. The default: `0` does not print, `1` prints the initial +likelihood and the settings that were selected (which parameters are +to be optimised, fixed or shifted), `2` prints the same as `1 and also the +intermediate output of the parameters and loglikelihood, while `3` the +same as `2` and prints intermediate progress during likelihood computation.} \item{trait_pars}{A named list containing diversification rates considering two trait states created by \code{\link{create_trait_pars}}: diff --git a/man/default_params_doc.Rd b/man/default_params_doc.Rd index 26338485..a352fc87 100644 --- a/man/default_params_doc.Rd +++ b/man/default_params_doc.Rd @@ -219,12 +219,15 @@ of species is present, STT is plotted for all species. If two types are present, three plots are produced: STT for all, STT for type 1 and STT for type 2.} -\item{verbose}{In simulation and dataprep functions a logical, -\code{Default = TRUE} gives intermediate output should be printed. +\item{verbose}{A numeric vector of length 1, which in simulations and +`DAISIEdataprep()` can be `1` or `0`, where `1` gives intermediate output +should be printed. For ML functions a numeric determining if intermediate output should be -printed, \code{Default = 0} does not print, \code{verbose = 1} prints -intermediate output of the parameters and loglikelihood, \code{verbose = 2} -means also intermediate progress during loglikelihood computation is shown.} +printed. The default: `0` does not print, `1` prints the initial +likelihood and the settings that were selected (which parameters are +to be optimised, fixed or shifted), `2` prints the same as `1 and also the +intermediate output of the parameters and loglikelihood, while `3` the +same as `2` and prints intermediate progress during likelihood computation.} \item{area_pars}{A named list containing area and sea level parameters as created by \code{\link{create_area_pars}()}: diff --git a/tests/testthat/test-printing.R b/tests/testthat/test-printing.R new file mode 100644 index 00000000..5e612472 --- /dev/null +++ b/tests/testthat/test-printing.R @@ -0,0 +1,19 @@ +test_that("printing is done", { + expect_message( + print_parameters_and_loglik( + pars = c(1, 2:6), + loglik = -3, + verbose = 3, + type = 'clade_loglik' + ), + regexp = "Status of colonist: 1, Parameters: 2.000000, 3.000000, 4.000000, 5.000000, 6.000000, Loglikelihood: -3.000000") + expect_message(print_parameters_and_loglik(pars = c(2:6), loglik = -3, verbose = 3, type = 'island_loglik')) + + expect_message(print_parameters_and_loglik(pars = c(2:6), loglik = -3, verbose = 3, type = 'island_ML')) + expect_message(print_parameters_and_loglik(pars = c(1:11), loglik = D-3, verbose = 3, type = 'global_ML', distance_dep = 'power')) + expect_message(print_parameters_and_loglik(pars = c(1:11), loglik = -3, verbose = 3, type = 'global_ML', distance_dep = 'sigmoidal_col')) + expect_message(print_parameters_and_loglik(pars = data.frame(rbind(c(2:6),c(12:16))), loglik = -3, verbose = 3, type = 'multiple_island_ML')) + + expect_silent(print_parameters_and_loglik(pars = data.frame(rbind(c(2:6),c(12:16))), loglik = -3, verbose = 1, type = 'multiple_island_ML')) + expect_silent(print_parameters_and_loglik(pars = data.frame(rbind(c(2:6),c(12:16))), loglik = -3, verbose = 0, type = 'multiple_island_ML')) +}) diff --git a/tests/testthat/test_printing.R b/tests/testthat/test_printing.R deleted file mode 100644 index 4d331126..00000000 --- a/tests/testthat/test_printing.R +++ /dev/null @@ -1,8 +0,0 @@ -test_that("printing is done", { - print_parameters_and_loglik(pars = c(1,2:6), loglik = -3, verbose = T, type = 'clade_loglik') - print_parameters_and_loglik(pars = c(2:6), loglik = -3, verbose = T, type = 'island_loglik') - print_parameters_and_loglik(pars = c(2:6), loglik = -3, verbose = T, type = 'island_ML') - print_parameters_and_loglik(pars = c(1:11), loglik = -3, verbose = T, type = 'global_ML', distance_dep = 'power') - print_parameters_and_loglik(pars = c(1:11), loglik = -3, verbose = T, type = 'global_ML', distance_dep = 'sigmoidal_col') - print_parameters_and_loglik(pars = data.frame(rbind(c(2:6),c(12:16))), loglik = -3, verbose = T, type = 'multiple_island_ML') -}) From d5cbc6fb328d6c4aa4701f28446b1d22b737a3a0 Mon Sep 17 00:00:00 2001 From: Hanno Hildenbrandt Date: Wed, 22 Mar 2023 20:14:33 +0100 Subject: [PATCH 24/48] valgrind Rrelease Rdevel Rval passed --- src/DAISIE_odeint.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/DAISIE_odeint.h b/src/DAISIE_odeint.h index ff81a2f0..088c8141 100644 --- a/src/DAISIE_odeint.h +++ b/src/DAISIE_odeint.h @@ -23,8 +23,12 @@ #include using bstime_t = boost::units::quantity; -#else +#else // USE_BULRISCH_STOER_PATCH + +// The default. Causes unitialized member m_last_dt in +// boost::odeint::bulrisch_stoer<>, declared in +// boost/numreic/odeint/stepper/bulrisch_stoer.hpp using bstime_t = double; #endif // USE_BULRISCH_STOER_PATCH From 1c55111d8fbe29ffcc77c60968bd0477d497f1e4 Mon Sep 17 00:00:00 2001 From: Neves-P Date: Thu, 23 Mar 2023 13:41:08 +0100 Subject: [PATCH 25/48] Delete test files --- NAMESPACE | 1 + dummy.R | 23 ----------------------- inst/LICENSE_1_0.txt | 23 ----------------------- 3 files changed, 1 insertion(+), 46 deletions(-) delete mode 100644 dummy.R delete mode 100644 inst/LICENSE_1_0.txt diff --git a/NAMESPACE b/NAMESPACE index 153d81a3..4835adfd 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -41,6 +41,7 @@ export(create_pars) export(create_trait_pars) export(create_trait_pars_2K) export(daisie_odeint_cs) +export(daisie_odeint_iw) import(Rcpp) importFrom(doParallel,registerDoParallel) importFrom(foreach,"%dopar%") diff --git a/dummy.R b/dummy.R deleted file mode 100644 index 10dde7ef..00000000 --- a/dummy.R +++ /dev/null @@ -1,23 +0,0 @@ -library(DAISIE) - -utils::data(Galapagos_datalist_2types) -pars1 <- c( -0.195442017, -0.087959583, -Inf, -0.002247364, -0.873605049, -3755.202241, -8.909285094, -14.99999923, -0.002247364, -0.873605049, -0.163 -) -pars2 <- c(40, 11, 0, 1) - -#methode <- 'odeint::runge_kutta_cash_karp54' -#loglik_rkck54 <- DAISIE_loglik_all(pars1, pars2, Galapagos_datalist_2types, methode = methode) - -methode <- 'odeint::bulirsch_stoer' -loglik_bs <- DAISIE_loglik_all(pars1, pars2, Galapagos_datalist_2types, methode = methode) diff --git a/inst/LICENSE_1_0.txt b/inst/LICENSE_1_0.txt deleted file mode 100644 index 36b7cd93..00000000 --- a/inst/LICENSE_1_0.txt +++ /dev/null @@ -1,23 +0,0 @@ -Boost Software License - Version 1.0 - August 17th, 2003 - -Permission is hereby granted, free of charge, to any person or organization -obtaining a copy of the software and accompanying documentation covered by -this license (the "Software") to use, reproduce, display, distribute, -execute, and transmit the Software, and to prepare derivative works of the -Software, and to permit third-parties to whom the Software is furnished to -do so, all subject to the following: - -The copyright notices in the Software and this entire statement, including -the above license grant, this restriction and the following disclaimer, -must be included in all copies of the Software, in whole or in part, and -all derivative works of the Software, unless such copies or derivative -works are solely in the form of machine-executable object code generated by -a source language processor. - -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, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. From 452c2220915c522769d1cf815e86745e19692731 Mon Sep 17 00:00:00 2001 From: Neves-P Date: Thu, 23 Mar 2023 14:48:40 +0100 Subject: [PATCH 26/48] Fix typo [run ci] --- tests/testthat/test-printing.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test-printing.R b/tests/testthat/test-printing.R index 5e612472..220f5907 100644 --- a/tests/testthat/test-printing.R +++ b/tests/testthat/test-printing.R @@ -10,7 +10,7 @@ test_that("printing is done", { expect_message(print_parameters_and_loglik(pars = c(2:6), loglik = -3, verbose = 3, type = 'island_loglik')) expect_message(print_parameters_and_loglik(pars = c(2:6), loglik = -3, verbose = 3, type = 'island_ML')) - expect_message(print_parameters_and_loglik(pars = c(1:11), loglik = D-3, verbose = 3, type = 'global_ML', distance_dep = 'power')) + expect_message(print_parameters_and_loglik(pars = c(1:11), loglik = -3, verbose = 3, type = 'global_ML', distance_dep = 'power')) expect_message(print_parameters_and_loglik(pars = c(1:11), loglik = -3, verbose = 3, type = 'global_ML', distance_dep = 'sigmoidal_col')) expect_message(print_parameters_and_loglik(pars = data.frame(rbind(c(2:6),c(12:16))), loglik = -3, verbose = 3, type = 'multiple_island_ML')) From 48c4889277f0bcda12b79e32b023786ced9d9476 Mon Sep 17 00:00:00 2001 From: Neves-P Date: Thu, 23 Mar 2023 15:46:51 +0100 Subject: [PATCH 27/48] Back go GPL 3 [run ci] --- DESCRIPTION | 2 +- LICENSE | 2 - LICENSE.md | 616 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 596 insertions(+), 24 deletions(-) delete mode 100644 LICENSE diff --git a/DESCRIPTION b/DESCRIPTION index 9ad5cccf..95c606cb 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -105,7 +105,7 @@ Authors@R: c( email = "r.scherrer@rug.nl", role = c("ctb"), comment = c(ORCID = "0000-0002-1447-7630"))) -License: MIT + file LICENSE +License: GPL (>= 3) Description: Simulates and computes the (maximum) likelihood of a dynamical model of island biota assembly through speciation, immigration and extinction. See Valente et al. (2015 ) . diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 428b3830..00000000 --- a/LICENSE +++ /dev/null @@ -1,2 +0,0 @@ -YEAR: 2023 -COPYRIGHT HOLDER: DAISIE authors diff --git a/LICENSE.md b/LICENSE.md index 24fdeb60..175443ce 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,21 +1,595 @@ -# MIT License - -Copyright (c) 2023 DAISIE authors - -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. +GNU General Public License +========================== + +_Version 3, 29 June 2007_ +_Copyright © 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 +<>. From 16c6757693faf47f21e9ab7f97b5e543c1c88158 Mon Sep 17 00:00:00 2001 From: Neves-P Date: Sat, 25 Mar 2023 20:32:46 +0100 Subject: [PATCH 28/48] Use new print functions [run ci] --- R/DAISIE_ML1.R | 10 ++--- R/DAISIE_ML2.R | 7 ++-- R/DAISIE_ML4.R | 9 ++-- R/DAISIE_utils.R | 70 ++++++++++++++++++++++++++++++++ tests/testthat/test-DAISIE_ML1.R | 2 - tests/testthat/test-DAISIE_ML2.R | 5 +-- tests/testthat/test-DAISIE_ML4.R | 1 + 7 files changed, 87 insertions(+), 17 deletions(-) diff --git a/R/DAISIE_ML1.R b/R/DAISIE_ML1.R index 3db2a4be..f7c8aaac 100644 --- a/R/DAISIE_ML1.R +++ b/R/DAISIE_ML1.R @@ -270,7 +270,6 @@ DAISIE_ML1 <- function( ) } } - message("Calculating the likelihood for the initial parameters.") trparsopt <- initparsopt / (1 + initparsopt) trparsopt[which(initparsopt == Inf)] <- 1 trparsfix <- parsfix / (1 + parsfix) @@ -303,8 +302,9 @@ DAISIE_ML1 <- function( abstolint = tolint[1], reltolint = tolint[2] ) - message( - "The loglikelihood for the initial parameter values is ", initloglik) + + print_init_ll(initloglik = initloglik, verbose = verbose) + if (initloglik == -Inf) { warning( "The initial parameter values have a likelihood that is equal to 0 or @@ -312,7 +312,7 @@ DAISIE_ML1 <- function( ) return(out2err) } - message("Optimizing the likelihood - this may take a while.") + out <- DDD::optimizer( optimmethod = optimmethod, optimpars = optimpars, @@ -335,7 +335,7 @@ DAISIE_ML1 <- function( if (out$conv != 0) { warning( "Optimization has not converged. - Try again with different initial values.") + Try again with different initial values.") out2 <- out2err out2$conv <- out$conv return(out2) diff --git a/R/DAISIE_ML2.R b/R/DAISIE_ML2.R index d19b0401..02f2d2ff 100644 --- a/R/DAISIE_ML2.R +++ b/R/DAISIE_ML2.R @@ -140,7 +140,7 @@ DAISIE_ML2 <- function( warning("The parameters to be optimized and/or fixed are incoherent.") return(out2err) } - message("Calculating the likelihood for the initial parameters.") + trparsopt <- initparsopt / (1 + initparsopt) trparsopt[which(initparsopt == Inf)] <- 1 trparsfix <- parsfix / (1 + parsfix) @@ -148,12 +148,13 @@ DAISIE_ML2 <- function( pars2 <- c(res, ddmodel, cond, 0, island_ontogeny) optimpars <- c(tol, maxiter) initloglik <- DAISIE_loglik_all_choosepar2(trparsopt = trparsopt, trparsfix = trparsfix, idparsopt = idparsopt, idparsfix = idparsfix, idparsmat = idparsmat, pars2 = pars2, datalist = datalist, methode, abstolint = tolint[1], reltolint = tolint[2]) - message("The loglikelihood for the initial parameter values is ", initloglik) + + print_init_ll(initloglik = initloglik, verbose = verbose) + if (initloglik == -Inf) { warning("The initial parameter values have a likelihood that is equal to 0 or below machine precision. Try again with different initial values.") return(out2err) } - message("Optimizing the likelihood - this may take a while.") out <- DDD::optimizer( optimmethod = optimmethod, optimpars = optimpars, diff --git a/R/DAISIE_ML4.R b/R/DAISIE_ML4.R index 3f2d0ca3..7a1a0872 100644 --- a/R/DAISIE_ML4.R +++ b/R/DAISIE_ML4.R @@ -126,7 +126,8 @@ DAISIE_ML4 <- function( idparsopt = idparsopt, idparsfix = idparsfix, idparsnoshift = NA, - all_no_shift = NA + all_no_shift = NA, + verbose = verbose ) idpars <- sort(c(idparsopt, idparsfix)) missnumspec <- unlist(lapply(datalist, function(list) {list$missing_species})) # nolint @@ -145,7 +146,6 @@ DAISIE_ML4 <- function( warning("The parameters to be optimized and/or fixed are incoherent.") return(out2err) } - message("Calculating the likelihood for the initial parameters.") trparsopt <- initparsopt / (1 + initparsopt) trparsopt[which(initparsopt == Inf)] <- 1 trparsfix <- parsfix / (1 + parsfix) @@ -171,7 +171,9 @@ DAISIE_ML4 <- function( abstolint = tolint[1], reltolint = tolint[2] ) - message("The loglikelihood for the initial parameter values is ", initloglik) + + print_init_ll(initloglik = initloglik, verbose = verbose) + if (initloglik == -Inf) { warning( "The initial parameter values have a likelihood that is equal to 0 or @@ -179,7 +181,6 @@ DAISIE_ML4 <- function( ) return(out2err) } - message("Optimizing the likelihood - this may take a while.") out <- DDD::optimizer( optimmethod = optimmethod, optimpars = optimpars, diff --git a/R/DAISIE_utils.R b/R/DAISIE_utils.R index 108a818b..48e48842 100644 --- a/R/DAISIE_utils.R +++ b/R/DAISIE_utils.R @@ -496,3 +496,73 @@ print_ml_par_settings <- function(namepars, invisible(NULL) } +#' Print optimisation settings +#' +#' @inheritParams default_params_doc +#' @param all_no_shift numeric vector with the standard no shifted values +#' depending on a model. Internal parameter to DAISIE_ML1, set to NA upstream +#' if not needed to prevent shift message being generated. +#' +#' @return Invisible `NULL`. Prints a `message()` to the console with the parameters +#' that are to be optimized, fixed, and shifted if `verbose >= 1`. +#' @noRd +print_ml_par_settings <- function(namepars, + idparsopt, + idparsfix, + idparsnoshift, + all_no_shift, + verbose) { + if (isTRUE(verbose >= 1)) { + + if (length(namepars[idparsopt]) == 0) { + optstr <- "nothing" + } else { + optstr <- namepars[idparsopt] + } + + opt_print <- paste0("You are optimizing: ", paste(optstr, collapse = " ")) + if (length(namepars[idparsfix]) == 0) { + fixstr <- "nothing" + } else { + fixstr <- namepars[idparsfix] + } + fix_print <- paste0("You are fixing: ", paste(fixstr, collapse = " ")) + + if (any(is.numeric(idparsnoshift)) && + sum(idparsnoshift %in% (all_no_shift)) != 5) { + noshiftstring <- namepars[idparsnoshift] + shift_prt <- paste0( + "You are not shifting: ", + paste(noshiftstring, collapse = " ") + ) + message(paste(opt_print, fix_print, shift_prt, sep = "\n")) + } else { + message(paste(opt_print, fix_print, sep = "\n")) + } + + } + + invisible(NULL) +} + +#' Print likelihood for initial parameters +#' +#' @inheritParams default_params_doc +#' @initloglik A numeric with the value of loglikehood obtained prior to +#' optimisation. +#' +#' @return Invisible `NULL`. Prints a `message()` to the console with the +#' initial loglikelihood if `verbose >= 1` +#' @noRd +print_init_ll <- function(initloglik, + verbose) { + if (isTRUE(verbose >= 1)) { + init_ll_msg1 <- "Calculating the likelihood for the initial parameters." + init_ll_msg2 <- paste0("The loglikelihood for the initial parameter values is ", initloglik) + init_ll_msg3 <- c("Optimizing the likelihood - this may take a while.") + message(paste(init_ll_msg1, init_ll_msg2, init_ll_msg3, sep = "\n")) + + } + + invisible(NULL) +} diff --git a/tests/testthat/test-DAISIE_ML1.R b/tests/testthat/test-DAISIE_ML1.R index f058e4e4..58c56872 100644 --- a/tests/testthat/test-DAISIE_ML1.R +++ b/tests/testthat/test-DAISIE_ML1.R @@ -10,7 +10,6 @@ test_that("use", { idparsopt <- 1:5 parsfix <- NULL idparsfix <- NULL - invisible(capture.output( tested_MLE <- DAISIE_ML1( datalist = datalist, initparsopt = initparsopt, @@ -23,7 +22,6 @@ test_that("use", { res = 15, tolint = c(0.1, 0.01) ) - )) expected_MLE <- data.frame( lambda_c = 3.689104200780465, mu = 4.31030299415995, diff --git a/tests/testthat/test-DAISIE_ML2.R b/tests/testthat/test-DAISIE_ML2.R index 3c3ea8e9..58af6660 100644 --- a/tests/testthat/test-DAISIE_ML2.R +++ b/tests/testthat/test-DAISIE_ML2.R @@ -2,7 +2,6 @@ test_that("use", { skip_if(Sys.getenv("CI") == "", message = "Run only on CI") skip_on_cran() utils::data(Macaronesia_datalist, package = "DAISIE") - invisible(capture.output( tested_MLE <- DAISIE_ML2( datalist = Macaronesia_datalist, initparsopt = c( @@ -22,9 +21,9 @@ test_that("use", { idparsfix = c(1, 3), tol = c(0.01, 0.1, 0.001), res = 15, - tolint = c(0.1, 0.01) + tolint = c(0.1, 0.01), + verbose = 0 ) - )) expected_MLE <- data.frame( lambda_c = c(0.0, 0.315015693879739, diff --git a/tests/testthat/test-DAISIE_ML4.R b/tests/testthat/test-DAISIE_ML4.R index 435ec184..f5aec0ab 100644 --- a/tests/testthat/test-DAISIE_ML4.R +++ b/tests/testthat/test-DAISIE_ML4.R @@ -7,6 +7,7 @@ test_that("DAISIE_ML4 is silent and produces correct output", { idparsopt = 1:6, parsfix = NULL, idparsfix = NULL, + verbose = 0, methode = 'lsodes', optimmethod = 'simplex', CS_version = create_CS_version(model = 2, From fbf17721a580f31c37eded82d16a5dc8e0adfdba Mon Sep 17 00:00:00 2001 From: Neves-P Date: Mon, 27 Mar 2023 18:00:44 +0200 Subject: [PATCH 29/48] Fix typo on roxygen doc --- R/DAISIE_utils.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/DAISIE_utils.R b/R/DAISIE_utils.R index 48e48842..39d97027 100644 --- a/R/DAISIE_utils.R +++ b/R/DAISIE_utils.R @@ -548,8 +548,8 @@ print_ml_par_settings <- function(namepars, #' Print likelihood for initial parameters #' #' @inheritParams default_params_doc -#' @initloglik A numeric with the value of loglikehood obtained prior to -#' optimisation. +#' @param initloglik A numeric with the value of loglikehood obtained prior to +#' optimisation. Only used internally. #' #' @return Invisible `NULL`. Prints a `message()` to the console with the #' initial loglikelihood if `verbose >= 1` From a0eb718201d04c47c435c5c047294976aac16fad Mon Sep 17 00:00:00 2001 From: Neves-P Date: Mon, 27 Mar 2023 18:01:01 +0200 Subject: [PATCH 30/48] Add value field to exported Rcpp functions --- R/RcppExports.R | 11 ++++++----- man/daisie_odeint_cs.Rd | 7 +++++-- man/daisie_odeint_iw.Rd | 7 +++++-- src/DAISIE_CS.cpp | 6 ++++-- src/DAISIE_IW.cpp | 4 +++- 5 files changed, 23 insertions(+), 12 deletions(-) diff --git a/R/RcppExports.R b/R/RcppExports.R index de991b04..13860323 100644 --- a/R/RcppExports.R +++ b/R/RcppExports.R @@ -1,19 +1,20 @@ # Generated by using Rcpp::compileAttributes() -> do not edit by hand # Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 -#' @export daisie_odeint_cs -NULL - -#' Driver for the boost::odeint solver +#' Driver for the boost::odeint solver for the CS model #' #' @name daisie_odeint_cs +#' @export daisie_odeint_cs +#' @return The output of the integration, depending on the runmod chosen. NULL #' @export daisie_odeint_iw NULL -#' Driver for the boost::odeint solver +#' Driver for the boost::odeint solver for the IW model #' #' @name daisie_odeint_iw +#' @export daisie_odeint_iw +#' @return The output of the integration, depending on the runmod chosen. NULL diff --git a/man/daisie_odeint_cs.Rd b/man/daisie_odeint_cs.Rd index 71435a9e..f1875a49 100644 --- a/man/daisie_odeint_cs.Rd +++ b/man/daisie_odeint_cs.Rd @@ -2,7 +2,10 @@ % Please edit documentation in R/RcppExports.R \name{daisie_odeint_cs} \alias{daisie_odeint_cs} -\title{Driver for the boost::odeint solver} +\title{Driver for the boost::odeint solver for the CS model} +\value{ +The output of the integration, depending on the runmod chosen. +} \description{ -Driver for the boost::odeint solver +Driver for the boost::odeint solver for the CS model } diff --git a/man/daisie_odeint_iw.Rd b/man/daisie_odeint_iw.Rd index 8a8af05b..d12b1232 100644 --- a/man/daisie_odeint_iw.Rd +++ b/man/daisie_odeint_iw.Rd @@ -2,7 +2,10 @@ % Please edit documentation in R/RcppExports.R \name{daisie_odeint_iw} \alias{daisie_odeint_iw} -\title{Driver for the boost::odeint solver} +\title{Driver for the boost::odeint solver for the IW model} +\value{ +The output of the integration, depending on the runmod chosen. +} \description{ -Driver for the boost::odeint solver +Driver for the boost::odeint solver for the IW model } diff --git a/src/DAISIE_CS.cpp b/src/DAISIE_CS.cpp index 9ea96297..5f072237 100644 --- a/src/DAISIE_CS.cpp +++ b/src/DAISIE_CS.cpp @@ -8,7 +8,7 @@ // [[Rcpp::depends(BH)]] -//' @export daisie_odeint_cs + #include "config.h" #include "DAISIE_odeint.h" @@ -277,9 +277,11 @@ namespace { } // anonymous namespace -//' Driver for the boost::odeint solver +//' Driver for the boost::odeint solver for the CS model //' //' @name daisie_odeint_cs +//' @export daisie_odeint_cs +//' @return The output of the integration, depending on the runmod chosen. RcppExport SEXP daisie_odeint_cs(SEXP rrunmod, SEXP ry, SEXP rtimes, SEXP rlx, SEXP rkk, SEXP rpar, SEXP Stepper, SEXP ratol, SEXP rrtol) { BEGIN_RCPP Rcpp::RObject rcpp_result_gen; diff --git a/src/DAISIE_IW.cpp b/src/DAISIE_IW.cpp index 757a3c47..09368840 100644 --- a/src/DAISIE_IW.cpp +++ b/src/DAISIE_IW.cpp @@ -223,9 +223,11 @@ namespace { } // anonymous namespace -//' Driver for the boost::odeint solver +//' Driver for the boost::odeint solver for the IW model //' //' @name daisie_odeint_iw +//' @export daisie_odeint_iw +//' @return The output of the integration, depending on the runmod chosen. RcppExport SEXP daisie_odeint_iw(SEXP ry, SEXP rtimes, SEXP rpars, SEXP Stepper, SEXP atolint, SEXP reltolint) { BEGIN_RCPP Rcpp::RObject rcpp_result_gen; From dfc8f01cabebc81887ae92c5cccd64cdb1058882 Mon Sep 17 00:00:00 2001 From: Neves-P Date: Tue, 28 Mar 2023 14:34:09 +0200 Subject: [PATCH 31/48] Try remove options(warn=-1) [run ci] --- R/DAISIE_ML2.R | 2 -- R/DAISIE_ML_IW.R | 2 +- R/DAISIE_SR_ML_CS.R | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/R/DAISIE_ML2.R b/R/DAISIE_ML2.R index 02f2d2ff..b1bda069 100644 --- a/R/DAISIE_ML2.R +++ b/R/DAISIE_ML2.R @@ -120,8 +120,6 @@ DAISIE_ML2 <- function( # - cond = conditioning; currently only cond = 0 is possible # . cond == 0 : no conditioning # . cond == 1 : conditioning on presence on the island - - options(warn = -1) out2err <- data.frame(lambda_c = NA, mu = NA, K = NA, gamma = NA, lambda_a = NA, loglik = NA, df = NA, conv = NA) out2err <- invisible(out2err) numisl <- length(datalist) diff --git a/R/DAISIE_ML_IW.R b/R/DAISIE_ML_IW.R index dc0b1977..f61b4064 100644 --- a/R/DAISIE_ML_IW.R +++ b/R/DAISIE_ML_IW.R @@ -92,7 +92,7 @@ DAISIE_ML_IW <- function( tolint = c(1E-16, 1E-14), jitter = 0, num_cycles = 1) { - options(warn = -1) + out2err <- data.frame(lambda_c = NA, mu = NA, K = NA, gamma = NA, lambda_a = NA, loglik = NA, df = NA, conv = NA) out2err <- invisible(out2err) if (is.null(datalist[[1]]$brts_table)) { diff --git a/R/DAISIE_SR_ML_CS.R b/R/DAISIE_SR_ML_CS.R index c7530cca..a71c341a 100644 --- a/R/DAISIE_SR_ML_CS.R +++ b/R/DAISIE_SR_ML_CS.R @@ -352,7 +352,6 @@ DAISIE_SR_ML_CS <- DAISIE_SR_ML <- function( # . cond == 0 : no conditioning # . cond == 1 : conditioning on presence on the island - options(warn = -1) out2err <- data.frame(lambda_c = NA, mu = NA, K = NA, gamma = NA, lambda_a2 = NA, lambda_c2 = NA, mu2 = NA, K2 = NA, gamma2 = NA, lambda_a2 = NA, tshift = NA, loglik = NA, df = NA, conv = NA) out2err <- invisible(out2err) idpars <- sort(c(idparsopt, idparsfix, idparsnoshift)) From 3659047c795838ba35c43a774a61f44adccb5fc8 Mon Sep 17 00:00:00 2001 From: Neves-P Date: Tue, 28 Mar 2023 17:50:21 +0200 Subject: [PATCH 32/48] LICENSE.md -> LICENSE --- LICENSE.md => LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename LICENSE.md => LICENSE (99%) diff --git a/LICENSE.md b/LICENSE similarity index 99% rename from LICENSE.md rename to LICENSE index 175443ce..69bbf02d 100644 --- a/LICENSE.md +++ b/LICENSE @@ -2,7 +2,7 @@ GNU General Public License ========================== _Version 3, 29 June 2007_ -_Copyright © 2007 Free Software Foundation, Inc. <>_ +_Copyright © 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. From 8c5e64e8360b3ee123b3580f18d0839633b5a027 Mon Sep 17 00:00:00 2001 From: Neves-P Date: Tue, 28 Mar 2023 17:50:58 +0200 Subject: [PATCH 33/48] Sort out licenses Add COPYRIGHTS, LICENSE.note and BSL --- LICENSE.note | 8 ++++++++ inst/COPYRIGHTS | 26 ++++++++++++++++++++++++++ inst/LICENSE_1_0.txt | 23 +++++++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 LICENSE.note create mode 100644 inst/COPYRIGHTS create mode 100644 inst/LICENSE_1_0.txt diff --git a/LICENSE.note b/LICENSE.note new file mode 100644 index 00000000..5156ed43 --- /dev/null +++ b/LICENSE.note @@ -0,0 +1,8 @@ +The DAISIE package as a whole is distributed under >= GPL-3, the license of which can be found in the distributed file LICENSE. The DAISIE package includes code written one of the package authors that is distributed under BSL-1.0: + +* src/DAISIE_CS.cpp +* src/DAISIE_IW.cpp +* src/DAISIE_odeint.h +* src/DAISIE_types.h + +Full copies of the BSL-1.0 license used by these files is included in `inst/LICENSE_1_0.txt`, as is a license and copyright notice on said files, while details are also in `inst/COPYRIGHTS`. diff --git a/inst/COPYRIGHTS b/inst/COPYRIGHTS new file mode 100644 index 00000000..c89a8e1f --- /dev/null +++ b/inst/COPYRIGHTS @@ -0,0 +1,26 @@ +Files: src/DAISIE_CS.cpp src/DAISIE_IW.cpp src/DAISIE_odeint.h src/DAISIE_types.h +Copyright: 2023 Hanno Hildenbrandt +License: BSL-1.0 +Boost Software License - Version 1.0 - August 17th, 2003 + +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by +this license (the "Software") to use, reproduce, display, distribute, +execute, and transmit the Software, and to prepare derivative works of the +Software, and to permit third-parties to whom the Software is furnished to +do so, all subject to the following: + +The copyright notices in the Software and this entire statement, including +the above license grant, this restriction and the following disclaimer, +must be included in all copies of the Software, in whole or in part, and +all derivative works of the Software, unless such copies or derivative +works are solely in the form of machine-executable object code generated by +a source language processor. + +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, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN 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/inst/LICENSE_1_0.txt b/inst/LICENSE_1_0.txt new file mode 100644 index 00000000..36b7cd93 --- /dev/null +++ b/inst/LICENSE_1_0.txt @@ -0,0 +1,23 @@ +Boost Software License - Version 1.0 - August 17th, 2003 + +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by +this license (the "Software") to use, reproduce, display, distribute, +execute, and transmit the Software, and to prepare derivative works of the +Software, and to permit third-parties to whom the Software is furnished to +do so, all subject to the following: + +The copyright notices in the Software and this entire statement, including +the above license grant, this restriction and the following disclaimer, +must be included in all copies of the Software, in whole or in part, and +all derivative works of the Software, unless such copies or derivative +works are solely in the form of machine-executable object code generated by +a source language processor. + +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, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. From ea0dae565d9638c65519c023d3da513582557c65 Mon Sep 17 00:00:00 2001 From: Neves-P Date: Tue, 28 Mar 2023 17:51:35 +0200 Subject: [PATCH 34/48] Return type in daisie_odeint_* --- R/RcppExports.R | 5 +++-- man/daisie_odeint_cs.Rd | 4 +++- man/daisie_odeint_iw.Rd | 3 --- src/DAISIE_CS.cpp | 4 +++- src/DAISIE_IW.cpp | 4 +++- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/R/RcppExports.R b/R/RcppExports.R index 13860323..6b86ed04 100644 --- a/R/RcppExports.R +++ b/R/RcppExports.R @@ -5,7 +5,9 @@ #' #' @name daisie_odeint_cs #' @export daisie_odeint_cs -#' @return The output of the integration, depending on the runmod chosen. +#' @return Object of type `state_type`, which itself is +#' `vector_t`, with the result of the +#' integration depending on the runmod chosen. NULL #' @export daisie_odeint_iw @@ -15,6 +17,5 @@ NULL #' #' @name daisie_odeint_iw #' @export daisie_odeint_iw -#' @return The output of the integration, depending on the runmod chosen. NULL diff --git a/man/daisie_odeint_cs.Rd b/man/daisie_odeint_cs.Rd index f1875a49..71af420a 100644 --- a/man/daisie_odeint_cs.Rd +++ b/man/daisie_odeint_cs.Rd @@ -4,7 +4,9 @@ \alias{daisie_odeint_cs} \title{Driver for the boost::odeint solver for the CS model} \value{ -The output of the integration, depending on the runmod chosen. +Object of type `state_type`, which itself is +`vector_t`, with the result of the +integration depending on the runmod chosen. } \description{ Driver for the boost::odeint solver for the CS model diff --git a/man/daisie_odeint_iw.Rd b/man/daisie_odeint_iw.Rd index d12b1232..87e6efaa 100644 --- a/man/daisie_odeint_iw.Rd +++ b/man/daisie_odeint_iw.Rd @@ -3,9 +3,6 @@ \name{daisie_odeint_iw} \alias{daisie_odeint_iw} \title{Driver for the boost::odeint solver for the IW model} -\value{ -The output of the integration, depending on the runmod chosen. -} \description{ Driver for the boost::odeint solver for the IW model } diff --git a/src/DAISIE_CS.cpp b/src/DAISIE_CS.cpp index 5f072237..07373dd1 100644 --- a/src/DAISIE_CS.cpp +++ b/src/DAISIE_CS.cpp @@ -281,7 +281,9 @@ namespace { //' //' @name daisie_odeint_cs //' @export daisie_odeint_cs -//' @return The output of the integration, depending on the runmod chosen. +//' @return Object of type `state_type`, which itself is +//' `vector_t`, with the result of the +//' integration depending on the runmod chosen. RcppExport SEXP daisie_odeint_cs(SEXP rrunmod, SEXP ry, SEXP rtimes, SEXP rlx, SEXP rkk, SEXP rpar, SEXP Stepper, SEXP ratol, SEXP rrtol) { BEGIN_RCPP Rcpp::RObject rcpp_result_gen; diff --git a/src/DAISIE_IW.cpp b/src/DAISIE_IW.cpp index 09368840..e46f8939 100644 --- a/src/DAISIE_IW.cpp +++ b/src/DAISIE_IW.cpp @@ -227,7 +227,9 @@ namespace { //' //' @name daisie_odeint_iw //' @export daisie_odeint_iw -//' @return The output of the integration, depending on the runmod chosen. + //' @return Object of type `state_type`, which itself is + //' `vector_t`, with the result of the + //' integration depending on the runmod chosen. RcppExport SEXP daisie_odeint_iw(SEXP ry, SEXP rtimes, SEXP rpars, SEXP Stepper, SEXP atolint, SEXP reltolint) { BEGIN_RCPP Rcpp::RObject rcpp_result_gen; From ffceca3a8d9fc05d601dfe64e338bc36473e95b8 Mon Sep 17 00:00:00 2001 From: Neves-P Date: Tue, 28 Mar 2023 17:53:36 +0200 Subject: [PATCH 35/48] Format --- LICENSE | 1191 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 635 insertions(+), 556 deletions(-) diff --git a/LICENSE b/LICENSE index 69bbf02d..f288702d 100644 --- a/LICENSE +++ b/LICENSE @@ -1,556 +1,635 @@ -GNU General Public License -========================== + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 -_Version 3, 29 June 2007_ -_Copyright © 2007 Free Software Foundation, Inc. + 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. -Everyone is permitted to copy and distribute verbatim copies of this license -document, but changing it is not allowed. + Preamble -## Preamble + The GNU General Public License is a free, copyleft license for +software and other kinds of works. -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 + 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 + 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 + "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 + 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 + "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 + 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 + 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. + 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) @@ -566,30 +645,30 @@ where the full notice is found. 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 . + 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: + 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 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 -<>. + 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 +. From 129e0bdecfe7f21041a58f6b07e26cf646ec6c9f Mon Sep 17 00:00:00 2001 From: Neves-P Date: Tue, 28 Mar 2023 18:36:33 +0200 Subject: [PATCH 36/48] Add printing tests --- tests/testthat/test-printing.R | 72 +++++++++++++++++++++++++++++++++- 1 file changed, 71 insertions(+), 1 deletion(-) diff --git a/tests/testthat/test-printing.R b/tests/testthat/test-printing.R index 220f5907..30fac8de 100644 --- a/tests/testthat/test-printing.R +++ b/tests/testthat/test-printing.R @@ -1,4 +1,4 @@ -test_that("printing is done", { +test_that("print_parameters_and_loglik works", { expect_message( print_parameters_and_loglik( pars = c(1, 2:6), @@ -17,3 +17,73 @@ test_that("printing is done", { expect_silent(print_parameters_and_loglik(pars = data.frame(rbind(c(2:6),c(12:16))), loglik = -3, verbose = 1, type = 'multiple_island_ML')) expect_silent(print_parameters_and_loglik(pars = data.frame(rbind(c(2:6),c(12:16))), loglik = -3, verbose = 0, type = 'multiple_island_ML')) }) + +test_that("print_ml_par_settings works", { + + expect_message( + print_ml_par_settings( + namepars = letters[1:5], + idparsopt = 1:5, + idparsfix = NULL, + idparsnoshift = 1:5, + all_no_shift = 1:5, + verbose = 1 + ), + regexp = "You are optimizing: a b c d e +You are fixing: nothing") + + expect_message( + print_ml_par_settings( + namepars = letters[1:5], + idparsopt = 1:4, + idparsfix = 5, + idparsnoshift = 1:5, + all_no_shift = 1:5, + verbose = 1 + ), + regexp = "You are optimizing: a b c d +You are fixing: e") + + expect_message( + print_ml_par_settings( + namepars = letters[1:5], + idparsopt = 1:5, + idparsfix = NULL, + idparsnoshift = 1:4, + all_no_shift = 1:4, + verbose = 1 + ), + regexp = "You are optimizing: a b c d e +You are fixing: nothing +You are not shifting: a b c d") + + expect_silent( + print_ml_par_settings( + namepars = letters[1:5], + idparsopt = 1:5, + idparsfix = NULL, + idparsnoshift = 1:4, + all_no_shift = 1:4, + verbose = 0 + ) + ) + +}) + +test_that("print_init_ll works", { + expect_message( + print_init_ll( + initloglik = 10, + verbose = 1 + ), + regexp = "Calculating the likelihood for the initial parameters. +The loglikelihood for the initial parameter values is 10 +Optimizing the likelihood - this may take a while.") + + expect_silent( + print_init_ll( + initloglik = 10, + verbose = 0 + ) + ) +}) From f2da33a73f9c98d35ef50d3f8eca38c705c1cf8f Mon Sep 17 00:00:00 2001 From: Neves-P Date: Tue, 28 Mar 2023 18:36:43 +0200 Subject: [PATCH 37/48] Delete duplicate code [run ci] --- R/DAISIE_utils.R | 47 ----------------------------------------------- 1 file changed, 47 deletions(-) diff --git a/R/DAISIE_utils.R b/R/DAISIE_utils.R index 39d97027..35bc8d67 100644 --- a/R/DAISIE_utils.R +++ b/R/DAISIE_utils.R @@ -448,54 +448,7 @@ add_column_to_dataframe <- function(df, position, column_to_insert) { return(df) } -#' Print optimisation settings -#' -#' @inheritParams default_params_doc -#' @param all_no_shift numeric vector with the standard no shifted values -#' depending on a model. Internal parameter to DAISIE_ML1, set to NA upstream -#' if not needed to prevent shift message being generated. -#' -#' @return Invisible `NULL`. Prints a `message()` to the console with the parameters -#' that are to be optimized, fixed, and shifted if `isTRUE(verbose)`. -#' @noRd -print_ml_par_settings <- function(namepars, - idparsopt, - idparsfix, - idparsnoshift, - all_no_shift, - verbose) { - if (isTRUE(verbose >= 1)) { - - if (length(namepars[idparsopt]) == 0) { - optstr <- "nothing" - } else { - optstr <- namepars[idparsopt] - } - - opt_print <- paste0("You are optimizing: ", paste(optstr, collapse = " ")) - if (length(namepars[idparsfix]) == 0) { - fixstr <- "nothing" - } else { - fixstr <- namepars[idparsfix] - } - fix_print <- paste0("You are fixing: ", paste(fixstr, collapse = " ")) - if (any(is.numeric(idparsnoshift)) && - sum(idparsnoshift %in% (all_no_shift)) != 5) { - noshiftstring <- namepars[idparsnoshift] - shift_prt <- paste0( - "You are not shifting: ", - paste(noshiftstring, collapse = " ") - ) - message(paste(opt_print, fix_print, shift_prt, sep = "\n")) - } else { - message(paste(opt_print, fix_print, sep = "\n")) - } - - } - - invisible(NULL) -} #' Print optimisation settings #' #' @inheritParams default_params_doc From 8b23c02b57257379ef19b45b477a48f83f34da8a Mon Sep 17 00:00:00 2001 From: Neves-P Date: Tue, 28 Mar 2023 18:46:25 +0200 Subject: [PATCH 38/48] Add license and copyrights notices to DESCRIPTION --- DESCRIPTION | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 95c606cb..e45561d1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -105,10 +105,11 @@ Authors@R: c( email = "r.scherrer@rug.nl", role = c("ctb"), comment = c(ORCID = "0000-0002-1447-7630"))) -License: GPL (>= 3) +License: GPL (>= 3) | file LICENSE +Copyright: See the file COPYRIGHTS for various DAISIE copyright details Description: Simulates and computes the (maximum) likelihood of a dynamical model of island biota assembly through speciation, immigration and - extinction. See Valente et al. (2015 ) . + extinction. See Valente et al. (2015) . NeedsCompilation: yes SystemRequirements: C++17 Encoding: UTF-8 From 1f8bf05227e0bad34f37700536f06edac0a1c6b9 Mon Sep 17 00:00:00 2001 From: Neves-P Date: Tue, 28 Mar 2023 18:48:28 +0200 Subject: [PATCH 39/48] Delete .vscode folder --- .vscode/.env | 23 ---------- .vscode/c_cpp_properties.json | 28 ------------ .vscode/genenv.R | 19 -------- .vscode/launch.json | 71 ------------------------------ .vscode/settings.json | 82 ----------------------------------- .vscode/tasks.json | 13 ------ 6 files changed, 236 deletions(-) delete mode 100644 .vscode/.env delete mode 100644 .vscode/c_cpp_properties.json delete mode 100644 .vscode/genenv.R delete mode 100644 .vscode/launch.json delete mode 100644 .vscode/settings.json delete mode 100644 .vscode/tasks.json diff --git a/.vscode/.env b/.vscode/.env deleted file mode 100644 index 64baa4e3..00000000 --- a/.vscode/.env +++ /dev/null @@ -1,23 +0,0 @@ -LD_LIBRARY_PATH=/home/hanno/opt/Rdebug/lib/R/lib:/usr/local/lib:/usr/lib/jvm/java-17-openjdk-amd64/lib/server -R_ARCH= -R_BROWSER=/usr/bin/xdg-open -R_BZIPCMD=/usr/bin/bzip2 -R_DOC_DIR=/home/hanno/opt/Rdebug/lib/R/doc -R_GZIPCMD=/usr/bin/gzip -R_HOME=/home/hanno/opt/Rdebug/lib/R -R_INCLUDE_DIR=/home/hanno/opt/Rdebug/lib/R/include -R_LIBS_SITE=/home/hanno/opt/Rdebug/lib/R/site-library -R_LIBS_USER=/home/hanno/R/x86_64-pc-linux-gnu-library/4.2 -R_PAPERSIZE=letter -R_PDFVIEWER=/usr/bin/xdg-open -R_PLATFORM=x86_64-pc-linux-gnu -R_PRINTCMD= -R_RD4PDF=times,inconsolata,hyper -R_SESSION_TMPDIR=/tmp/Rtmp5EoJOh -R_SHARE_DIR=/home/hanno/opt/Rdebug/lib/R/share -R_STRIP_SHARED_LIB=strip --strip-unneeded -R_STRIP_STATIC_LIB=strip --strip-debug -R_SYSTEM_ABI=linux,gcc,gxx,gfortran,gfortran -R_TEXI2DVICMD=/usr/bin/texi2dvi -R_UNZIPCMD=/usr/bin/unzip -R_ZIPCMD=/usr/bin/zip diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json deleted file mode 100644 index 42079e35..00000000 --- a/.vscode/c_cpp_properties.json +++ /dev/null @@ -1,28 +0,0 @@ -// c_cpp_properties.json -// -// C/C++ extension config file -// Some settings to augment IntelliSense for C/C++ files -{ - "configurations": [ - { - "name": "Linux gdb", - "includePath": [ - // recurse into workspace, picks up ./src/ and ./inst/include/ - "${workspaceFolder}/**", - // R headers - "${env:HOME}/opt/bin/Rroot/lib/R/include", - // includes used by our package - "${env:HOME}/opt/bin/Rlibrary/Rcpp/include", - "${env:HOME}/opt/bin/Rlibrary/BH/include" - ], - "defines": [], - // absolute path to compiler - "compilerPath": "/usr/bin/gcc", - // "compilerPath": "/usr/bin/clang" - "cStandard": "c11", - // should match [[Rcpp::plugins(cpp17)]] - "cppStandard": "c++17" - } - ], - "version": 4 -} diff --git a/.vscode/genenv.R b/.vscode/genenv.R deleted file mode 100644 index 2cd0a945..00000000 --- a/.vscode/genenv.R +++ /dev/null @@ -1,19 +0,0 @@ -# genenv.R -# -# Colects environment variables from R, required by the R *binary*. -# They are normally set by the R *script* which is circumvented if -# we need to run the binary under the debugger as we want to debug R -# not bash... -# -# This script is configured as a task in 'tasks.json' and referenced within -# 'launch.json' as the 'preLaunchTask'. - -env <- Sys.getenv() -envnames <- names(env) -rnames <- envnames[startsWith(envnames, "R_")] -cached_names <- rnames -ld_lib_path <- Sys.getenv("LD_LIBRARY_PATH") -if (ld_lib_path != "") { - cached_names <- c("LD_LIBRARY_PATH", rnames) -} -writeLines(paste0(cached_names, "=", env[cached_names]), ".vscode/.env") diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index 05e6dc04..00000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,71 +0,0 @@ -// launch.json -// -// launch the R *binary* under gdb and run devtools::test() -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "(gbd) devtools::test()", - "type": "cppdbg", - "request": "launch", - // The binary, not the script - "program": "${env:HOME}/opt/bin/Rroot/lib/R/bin/exec/R", - "args": [ - "--vanilla", - "-e", - "devtools::test()" - ], - "stopAtEntry": false, - // needs to be generated, see below - "envFile": "${workspaceFolder}/.vscode/.env", - "cwd": "${workspaceFolder}", - "externalConsole": false, - "MIMode": "gdb", - //"miDebuggerPath": "/usr/bin/gdb", - "setupCommands": [ - { - "description": "Enable pretty-printing for gdb", - "text": "-enable-pretty-printing", - "ignoreFailures": true - } - ], - // 'R' is a script that sets a ton of environment variables - // required by the R binary. This task emulates that part of - // the R script: - "preLaunchTask": "genenv" - }, - { - "name": "(gbd) R-file", - "type": "cppdbg", - "request": "launch", - // The binary, not the script - "program": "${env:HOME}/opt/bin/Rroot/lib/R/bin/exec/R", - "args": [ - "--vanilla", - "-e", - "devtools::load_all(); source('${fileBasename}')" - ], - "stopAtEntry": false, - // needs to be generated, see below - "envFile": "${workspaceFolder}/.vscode/.env", - "cwd": "${workspaceFolder}", - "externalConsole": false, - "MIMode": "gdb", - //"miDebuggerPath": "/usr/bin/gdb", - "setupCommands": [ - { - "description": "Enable pretty-printing for gdb", - "text": "-enable-pretty-printing", - "ignoreFailures": true - } - ], - // 'R' is a script that sets a ton of environment variables - // required by the R binary. This task emulates that part of - // the R script: - "preLaunchTask": "genenv" - } - ] -} diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 7b9c91f1..00000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "files.associations": { - "*.rmd": "markdown", - "__locale": "cpp", - "__string": "cpp", - "locale": "cpp", - "array": "cpp", - "atomic": "cpp", - "strstream": "cpp", - "bit": "cpp", - "*.tcc": "cpp", - "bitset": "cpp", - "cctype": "cpp", - "cfenv": "cpp", - "chrono": "cpp", - "clocale": "cpp", - "cmath": "cpp", - "codecvt": "cpp", - "compare": "cpp", - "complex": "cpp", - "concepts": "cpp", - "condition_variable": "cpp", - "csetjmp": "cpp", - "cstdarg": "cpp", - "cstddef": "cpp", - "cstdint": "cpp", - "cstdio": "cpp", - "cstdlib": "cpp", - "cstring": "cpp", - "ctime": "cpp", - "cwchar": "cpp", - "cwctype": "cpp", - "deque": "cpp", - "list": "cpp", - "map": "cpp", - "set": "cpp", - "string": "cpp", - "unordered_map": "cpp", - "unordered_set": "cpp", - "vector": "cpp", - "exception": "cpp", - "algorithm": "cpp", - "functional": "cpp", - "iterator": "cpp", - "memory": "cpp", - "memory_resource": "cpp", - "numeric": "cpp", - "optional": "cpp", - "random": "cpp", - "ratio": "cpp", - "string_view": "cpp", - "system_error": "cpp", - "tuple": "cpp", - "type_traits": "cpp", - "utility": "cpp", - "fstream": "cpp", - "initializer_list": "cpp", - "iomanip": "cpp", - "iosfwd": "cpp", - "iostream": "cpp", - "istream": "cpp", - "limits": "cpp", - "mutex": "cpp", - "new": "cpp", - "numbers": "cpp", - "ostream": "cpp", - "semaphore": "cpp", - "sstream": "cpp", - "stdexcept": "cpp", - "stop_token": "cpp", - "streambuf": "cpp", - "thread": "cpp", - "cinttypes": "cpp", - "typeindex": "cpp", - "typeinfo": "cpp", - "variant": "cpp", - "__nullptr": "cpp", - "__hash_table": "cpp", - "__mutex_base": "cpp", - "__tree": "cpp" - } -} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json deleted file mode 100644 index e11a2f20..00000000 --- a/.vscode/tasks.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - // See https://go.microsoft.com/fwlink/?LinkId=733558 - // for the documentation about the tasks.json format - "version": "2.0.0", - "tasks": [ - { - "label": "genenv", - "type": "shell", - "command": "Rscript ${workspaceFolder}/.vscode/genenv.R", - "problemMatcher": [] - } - ] -} From c3861f1d8d3cec1e34d18607a8a050b808413fdf Mon Sep 17 00:00:00 2001 From: Neves-P Date: Tue, 28 Mar 2023 19:00:23 +0200 Subject: [PATCH 40/48] Increment version number to 4.4.0 [run ci] --- DESCRIPTION | 4 ++-- NEWS.md | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index e45561d1..d0a1ca7c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: DAISIE Type: Package Title: Dynamical Assembly of Islands by Speciation, Immigration and Extinction -Version: 4.3.4 -Date: 2023-03-16 +Version: 4.4.0 +Date: 2023-03-28 Depends: R (>= 4.2.0) biocViews: Imports: diff --git a/NEWS.md b/NEWS.md index 7819a59e..f52724f7 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,27 @@ +# DAISIE 4.4.0 + +* No longer include patched version of `boost/numeric/odeint/stepper/bulirsch_stoer.hpp`, +address the issue by passing previously uninitialised variable as `boost::units::quantity`. +* Document return type of exported Rcpp functions per CRAN request. +* Move all internal non-error printing to console `message()` and `warning()` +per CRAN request. Add internal functions to address this. `verbose` variable is +now numeric, varying from 0 to 3. Increasing values increase amount of messages +to be printed. Change default of printing some output to golden rule of silence +`verbose == 0`. To print again, set `verbose >= 1`. +* Safely restore graphics settings after plot as per CRAN request. +* Fix references in DESCRIPTION as per CRAN request. +* Remove internal (unnecessary) calls to internal functions via `:::` per CRAN +request. +* No longer use roxygen2 tag `internal` to document without index but use +`noRd` instead. `are_area_pars()` is now internal. +* Replace `\dontrun` examples in documentation with `\donttest`. Speed up +examples per CRAN request. +* Remove calls to `options(warn = -1)` that suppress warnings in non standard +way. Use `suppressWarnings()` where appropriate per CRAN request. +* License package C++ source files as BSL-1.0 (c) Hanno Hildenbrandt. +* Add `LICENSE.note`, `inst/COPYRIGHTS` to clarify license and copyrights. Pipe +such files in `DESCRIPTION. + # DAISIE 4.3.4 * Require C++17 via `CXX_STD` flag on Makevars[.win]. From 3d7ccda90fe484a89d5291e63613863b50c18215 Mon Sep 17 00:00:00 2001 From: Neves-P Date: Wed, 29 Mar 2023 15:08:50 +0200 Subject: [PATCH 41/48] Fix NEWS --- NEWS.md | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/NEWS.md b/NEWS.md index f52724f7..174b4201 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,25 +2,24 @@ * No longer include patched version of `boost/numeric/odeint/stepper/bulirsch_stoer.hpp`, address the issue by passing previously uninitialised variable as `boost::units::quantity`. -* Document return type of exported Rcpp functions per CRAN request. -* Move all internal non-error printing to console `message()` and `warning()` -per CRAN request. Add internal functions to address this. `verbose` variable is -now numeric, varying from 0 to 3. Increasing values increase amount of messages -to be printed. Change default of printing some output to golden rule of silence +* Document return type of exported Rcpp functions. +* Move all internal non-error printing to console `message()` and `warning()`. +Add internal functions to address this. `verbose` variable is now numeric, +varying from 0 to 3. Increasing values increase amount of messages to be +printed. Change default of printing some output to golden rule of silence `verbose == 0`. To print again, set `verbose >= 1`. -* Safely restore graphics settings after plot as per CRAN request. -* Fix references in DESCRIPTION as per CRAN request. -* Remove internal (unnecessary) calls to internal functions via `:::` per CRAN -request. +* Remove calls to `options(warn = -1)` that suppress warnings in non standard +way. Use `suppressWarnings()` where appropriate. +* Safely restore graphics settings after plot. +* Fix references in `DESCRIPTION`. +* Remove internal (unnecessary) calls to internal functions via `:::`. * No longer use roxygen2 tag `internal` to document without index but use `noRd` instead. `are_area_pars()` is now internal. * Replace `\dontrun` examples in documentation with `\donttest`. Speed up -examples per CRAN request. -* Remove calls to `options(warn = -1)` that suppress warnings in non standard -way. Use `suppressWarnings()` where appropriate per CRAN request. +examples. * License package C++ source files as BSL-1.0 (c) Hanno Hildenbrandt. * Add `LICENSE.note`, `inst/COPYRIGHTS` to clarify license and copyrights. Pipe -such files in `DESCRIPTION. +such files in `DESCRIPTION`. # DAISIE 4.3.4 From d72d7cb19ce1eda25c4f4b6e13fb0ddb2ba316ac Mon Sep 17 00:00:00 2001 From: Neves-P Date: Wed, 29 Mar 2023 15:11:45 +0200 Subject: [PATCH 42/48] BSL (c) @rsetienne on FORTRAN code [run ci] --- LICENSE.note | 3 ++- inst/COPYRIGHTS | 5 +++++ src/DAISIE_loglik_rhs_FORTRAN.f95 | 7 +++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/LICENSE.note b/LICENSE.note index 5156ed43..45d08c6c 100644 --- a/LICENSE.note +++ b/LICENSE.note @@ -1,8 +1,9 @@ -The DAISIE package as a whole is distributed under >= GPL-3, the license of which can be found in the distributed file LICENSE. The DAISIE package includes code written one of the package authors that is distributed under BSL-1.0: +The DAISIE package as a whole is distributed under >= GPL-3, the license of which can be found in the distributed file LICENSE. The DAISIE package includes code written by two of the package authors that is distributed under BSL-1.0: * src/DAISIE_CS.cpp * src/DAISIE_IW.cpp * src/DAISIE_odeint.h * src/DAISIE_types.h +* src/DAISIE_loglik_rhs_FORTRAN.f95 Full copies of the BSL-1.0 license used by these files is included in `inst/LICENSE_1_0.txt`, as is a license and copyright notice on said files, while details are also in `inst/COPYRIGHTS`. diff --git a/inst/COPYRIGHTS b/inst/COPYRIGHTS index c89a8e1f..30e48cc6 100644 --- a/inst/COPYRIGHTS +++ b/inst/COPYRIGHTS @@ -1,6 +1,11 @@ Files: src/DAISIE_CS.cpp src/DAISIE_IW.cpp src/DAISIE_odeint.h src/DAISIE_types.h Copyright: 2023 Hanno Hildenbrandt License: BSL-1.0 + +Files: src/DAISIE_loglik_rhs_FORTRAN.95 +Copyright: 2023 Rampal S. Etienne +License: BSL-1.0 + Boost Software License - Version 1.0 - August 17th, 2003 Permission is hereby granted, free of charge, to any person or organization diff --git a/src/DAISIE_loglik_rhs_FORTRAN.f95 b/src/DAISIE_loglik_rhs_FORTRAN.f95 index 5c121830..e7ffdc93 100644 --- a/src/DAISIE_loglik_rhs_FORTRAN.f95 +++ b/src/DAISIE_loglik_rhs_FORTRAN.f95 @@ -1,3 +1,10 @@ +! +! Copyright (c) 2023, Rampal S. Etienne +! +! Distributed under the Boost Software License, Version 1.0. (See +! accompanying file LICENSE_1_0.txt or copy at +! http://www.boost.org/LICENSE_1_0.txt) +! !========================================================================== ! Helper function: ! fill vec with N elements from parms, starting at position ii From d1b5f5fff50c6f979272a840f4f2b00f560f727b Mon Sep 17 00:00:00 2001 From: Neves-P Date: Wed, 29 Mar 2023 15:12:58 +0200 Subject: [PATCH 43/48] Update date --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index d0a1ca7c..fdbe3656 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,7 +2,7 @@ Package: DAISIE Type: Package Title: Dynamical Assembly of Islands by Speciation, Immigration and Extinction Version: 4.4.0 -Date: 2023-03-28 +Date: 2023-03-29 Depends: R (>= 4.2.0) biocViews: Imports: From 3e5ee7f73ba8a10c067cac5e8e367ae1a5e007f5 Mon Sep 17 00:00:00 2001 From: Neves-P Date: Wed, 29 Mar 2023 17:45:02 +0200 Subject: [PATCH 44/48] LICENSE should not be on .Rbuildignore --- .Rbuildignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.Rbuildignore b/.Rbuildignore index b98deaec..6aaa3e6d 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -14,7 +14,6 @@ ^\.Rproj\.user$ ^\.covrignore$ -^LICENSE$ ^\.zenodo\.json$ ^\.vscode$ From 45efcab228d928e72554b401360f954b19886cae Mon Sep 17 00:00:00 2001 From: Neves-P Date: Wed, 29 Mar 2023 18:19:48 +0200 Subject: [PATCH 45/48] @rsetienne's license in NEWS --- NEWS.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 174b4201..bc057db3 100644 --- a/NEWS.md +++ b/NEWS.md @@ -17,7 +17,8 @@ way. Use `suppressWarnings()` where appropriate. `noRd` instead. `are_area_pars()` is now internal. * Replace `\dontrun` examples in documentation with `\donttest`. Speed up examples. -* License package C++ source files as BSL-1.0 (c) Hanno Hildenbrandt. +* License package C++ source files as BSL-1.0 (c) Hanno Hildenbrandt, FORTRAN +files as BSL-1.0 (c) Rampal S. Etienne. * Add `LICENSE.note`, `inst/COPYRIGHTS` to clarify license and copyrights. Pipe such files in `DESCRIPTION`. From 50c611d13e9272e231f0725015f83343c6c221af Mon Sep 17 00:00:00 2001 From: Neves-P Date: Wed, 29 Mar 2023 18:19:51 +0200 Subject: [PATCH 46/48] lint --- LICENSE.note | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE.note b/LICENSE.note index 45d08c6c..1482fef8 100644 --- a/LICENSE.note +++ b/LICENSE.note @@ -1,4 +1,4 @@ -The DAISIE package as a whole is distributed under >= GPL-3, the license of which can be found in the distributed file LICENSE. The DAISIE package includes code written by two of the package authors that is distributed under BSL-1.0: +The DAISIE package as a whole is distributed under >= GPL-3, the license of which can be found in the distributed file LICENSE. The DAISIE package includes code written by two of the package authors that is distributed under BSL-1.0: * src/DAISIE_CS.cpp * src/DAISIE_IW.cpp From 69e7d8db0a1b4e00e987ddcd8a433530998ddb77 Mon Sep 17 00:00:00 2001 From: Neves-P Date: Wed, 29 Mar 2023 19:19:13 +0200 Subject: [PATCH 47/48] Correctly pass `verbose` --- R/DAISIE_ML1.R | 2 +- R/DAISIE_ML2.R | 2 +- R/DAISIE_ML4.R | 2 +- R/DAISIE_ML_IW.R | 2 +- R/DAISIE_MW_ML.R | 2 +- R/DAISIE_SR_ML_CS.R | 3 ++- R/DAISIE_SR_loglik_CS.R | 18 ++++++++---------- man/DAISIE_SR_loglik_CS.Rd | 2 +- 8 files changed, 16 insertions(+), 17 deletions(-) diff --git a/R/DAISIE_ML1.R b/R/DAISIE_ML1.R index f7c8aaac..d3b3ca20 100644 --- a/R/DAISIE_ML1.R +++ b/R/DAISIE_ML1.R @@ -417,7 +417,7 @@ DAISIE_ML1 <- function( } print_parameters_and_loglik(pars = pars_to_print, loglik = ML, - verbose = TRUE, + verbose = verbose, parnames = parnames, type = 'island_ML') if (eqmodel > 0) { diff --git a/R/DAISIE_ML2.R b/R/DAISIE_ML2.R index b1bda069..c716139c 100644 --- a/R/DAISIE_ML2.R +++ b/R/DAISIE_ML2.R @@ -203,7 +203,7 @@ DAISIE_ML2 <- function( conv = unlist(out$conv)) print_parameters_and_loglik(pars = MLpars1, loglik = ML, - verbose = TRUE, + verbose = verbose, type = 'multiple_island_ML') return(invisible(out2)) } diff --git a/R/DAISIE_ML4.R b/R/DAISIE_ML4.R index 7a1a0872..f739071d 100644 --- a/R/DAISIE_ML4.R +++ b/R/DAISIE_ML4.R @@ -231,7 +231,7 @@ DAISIE_ML4 <- function( ) print_parameters_and_loglik(pars = MLpars1[1:6], loglik = ML, - verbose = TRUE, + verbose = verbose, parnames = c('lambda^c','mu','K','gamma','lambda^a','sd'), type = 'island_ML') return(invisible(out2)) diff --git a/R/DAISIE_ML_IW.R b/R/DAISIE_ML_IW.R index f61b4064..b2c19933 100644 --- a/R/DAISIE_ML_IW.R +++ b/R/DAISIE_ML_IW.R @@ -176,7 +176,7 @@ DAISIE_ML_IW <- function( out2 <- data.frame(lambda_c = MLpars1[1], mu = MLpars1[2], K = MLpars1[3], gamma = MLpars1[4], lambda_a = MLpars1[5], loglik = ML, df = length(initparsopt), conv = unlist(out$conv)) print_parameters_and_loglik(pars = MLpars1[1:5], loglik = ML, - verbose = TRUE, + verbose = verbose, type = 'island_ML') return(invisible(out2)) } diff --git a/R/DAISIE_MW_ML.R b/R/DAISIE_MW_ML.R index 596f03a5..a49f8529 100644 --- a/R/DAISIE_MW_ML.R +++ b/R/DAISIE_MW_ML.R @@ -497,7 +497,7 @@ DAISIE_MW_ML = function( } print_parameters_and_loglik(pars = MLpars1, loglik = ML, - verbose = TRUE, + verbose = verbose, type = 'global_ML', distance_dep = distance_dep) return(invisible(out2)) diff --git a/R/DAISIE_SR_ML_CS.R b/R/DAISIE_SR_ML_CS.R index a71c341a..0f002bb5 100644 --- a/R/DAISIE_SR_ML_CS.R +++ b/R/DAISIE_SR_ML_CS.R @@ -11,6 +11,7 @@ DAISIE_SR_loglik_all_choosepar <- function( abstolint = 1E-16, reltolint = 1E-10 ) { + verbose <- pars2[4] trpars1 <- rep(0, 11) trpars1[idparsopt] <- trparsopt if (length(idparsfix) != 0) { @@ -34,7 +35,7 @@ DAISIE_SR_loglik_all_choosepar <- function( CS_version = CS_version, abstolint = abstolint, reltolint = reltolint, - verbose = FALSE + verbose = verbose ) } if (is.nan(loglik) || is.na(loglik)) { diff --git a/R/DAISIE_SR_loglik_CS.R b/R/DAISIE_SR_loglik_CS.R index e8a35ea7..0cf4094c 100644 --- a/R/DAISIE_SR_loglik_CS.R +++ b/R/DAISIE_SR_loglik_CS.R @@ -73,10 +73,10 @@ DAISIE_SR_loglik_CS_M1 <- DAISIE_SR_loglik <- function( missnumspec, methode = "lsodes", abstolint = abstolint, - reltolint = reltolint, - verbose = FALSE + reltolint = reltolint ) { - if (is.na(pars2[4])) { + verbose <- pars2[4] + if (is.na(verbose)) { pars2[4] <- 0 } ddep <- pars2[2] @@ -233,7 +233,7 @@ DAISIE_SR_loglik_CS_M1 <- DAISIE_SR_loglik <- function( } print_parameters_and_loglik(pars = c(stac,pars1[1:5]), loglik = loglik, - verbose = pars2[4], + verbose = verbose, type = 'clade_loglik') return(as.numeric(loglik)) } @@ -348,9 +348,9 @@ DAISIE_SR_loglik_CS <- DAISIE_SR_loglik_all <- function( methode = "lsodes", CS_version = 1, abstolint = 1E-16, - reltolint = 1E-10, - verbose = FALSE + reltolint = 1E-10 ) { + verbose <- pars2[4] pars1 = as.numeric(pars1) check_shift_loglik = shift_before_certain_brts(datalist, pars1) if(check_shift_loglik != 0){ @@ -365,8 +365,7 @@ DAISIE_SR_loglik_CS <- DAISIE_SR_loglik_all <- function( missnumspec = 0, methode = methode, abstolint = abstolint, - reltolint = reltolint, - verbose = FALSE + reltolint = reltolint ) if (is.null(datalist[[1]]$not_present)) { not_present <- (datalist[[1]]$not_present_type1 + datalist[[1]]$not_present_type2) @@ -387,8 +386,7 @@ DAISIE_SR_loglik_CS <- DAISIE_SR_loglik_all <- function( missnumspec = datalist[[i]]$missing_species, methode = methode, abstolint = abstolint, - reltolint = reltolint, - verbose = FALSE + reltolint = reltolint ) } } diff --git a/man/DAISIE_SR_loglik_CS.Rd b/man/DAISIE_SR_loglik_CS.Rd index 31eb60fb..b5ccdf0f 100644 --- a/man/DAISIE_SR_loglik_CS.Rd +++ b/man/DAISIE_SR_loglik_CS.Rd @@ -15,7 +15,7 @@ DAISIE_SR_loglik_CS( CS_version = 1, abstolint = 1e-16, reltolint = 1e-10, - verbose = FALSE + verbose = verbose ) } \arguments{ From ebf13e6848575b21f2b42d124ef408287ffec009 Mon Sep 17 00:00:00 2001 From: Neves-P Date: Wed, 29 Mar 2023 20:01:59 +0200 Subject: [PATCH 48/48] Delete lingering not needed argument --- R/DAISIE_SR_ML_CS.R | 4 +--- R/DAISIE_SR_loglik_CS.R | 1 - man/DAISIE_SR_loglik_CS.Rd | 5 +---- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/R/DAISIE_SR_ML_CS.R b/R/DAISIE_SR_ML_CS.R index 0f002bb5..6164e53a 100644 --- a/R/DAISIE_SR_ML_CS.R +++ b/R/DAISIE_SR_ML_CS.R @@ -11,7 +11,6 @@ DAISIE_SR_loglik_all_choosepar <- function( abstolint = 1E-16, reltolint = 1E-10 ) { - verbose <- pars2[4] trpars1 <- rep(0, 11) trpars1[idparsopt] <- trparsopt if (length(idparsfix) != 0) { @@ -34,8 +33,7 @@ DAISIE_SR_loglik_all_choosepar <- function( methode = methode, CS_version = CS_version, abstolint = abstolint, - reltolint = reltolint, - verbose = verbose + reltolint = reltolint ) } if (is.nan(loglik) || is.na(loglik)) { diff --git a/R/DAISIE_SR_loglik_CS.R b/R/DAISIE_SR_loglik_CS.R index 0cf4094c..2fc4671a 100644 --- a/R/DAISIE_SR_loglik_CS.R +++ b/R/DAISIE_SR_loglik_CS.R @@ -321,7 +321,6 @@ DAISIE_SR_loglik_CS_M1 <- DAISIE_SR_loglik <- function( #' @param methode Method of the ODE-solver. See package deSolve for details. #' Default is "lsodes" #' @param abstolint Absolute tolerance of the integration -#' @param verbose Logical controling if progress is printed to console. #' @param reltolint Relative tolerance of the integration #' #' @return The loglikelihood diff --git a/man/DAISIE_SR_loglik_CS.Rd b/man/DAISIE_SR_loglik_CS.Rd index b5ccdf0f..63064fba 100644 --- a/man/DAISIE_SR_loglik_CS.Rd +++ b/man/DAISIE_SR_loglik_CS.Rd @@ -14,8 +14,7 @@ DAISIE_SR_loglik_CS( methode = "lsodes", CS_version = 1, abstolint = 1e-16, - reltolint = 1e-10, - verbose = verbose + reltolint = 1e-10 ) } \arguments{ @@ -104,8 +103,6 @@ model, for a relaxed-rate model a list with the following elements: \item{abstolint}{Absolute tolerance of the integration} \item{reltolint}{Relative tolerance of the integration} - -\item{verbose}{Logical controling if progress is printed to console.} } \value{ The loglikelihood