updated folder's names and respective references

This commit is contained in:
Luis Aleixo 2022-09-09 16:11:53 +02:00
parent 1b564d3c9b
commit f4ba8465ab
138 changed files with 288 additions and 344 deletions

View file

@ -1,4 +1,4 @@
# This module is part of CARA. Please see the repository at
# This module is part of CAiMIRA. Please see the repository at
# https://gitlab.cern.ch/cara/cara for details of the license and terms of use.
name: CI
@ -23,7 +23,7 @@ jobs:
runs-on: ubuntu-latest
env:
PROJECT_ROOT: ./
PROJECT_NAME: cara
PROJECT_NAME: caimira
steps:
- name: Checkout
uses: actions/checkout@v2
@ -45,7 +45,7 @@ jobs:
runs-on: ubuntu-20.04
env:
PROJECT_ROOT: ./
PROJECT_NAME: cara
PROJECT_NAME: caimira
steps:
- name: Checkout
uses: actions/checkout@v2

2
.gitignore vendored
View file

@ -18,4 +18,4 @@ app-config/openshift/caimira-test
app-config/openshift/caimira-prod
# documentation build folder
cara/docs/_build
caimira/docs/_build

View file

@ -11,7 +11,7 @@ include:
file: acc_py_devtools/templates/gitlab-ci/python.yml
variables:
project_name: cara
project_name: caimira
PY_VERSION: "3.9"

View file

@ -17,7 +17,7 @@ build:
# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: cara/docs/conf.py
configuration: caimira/docs/conf.py
# If using Sphinx, optionally build your docs in additional formats such as PDF
# formats:

View file

@ -86,7 +86,7 @@ This will start a local version of CAiMIRA, which can be visited at http://local
## Development guide
CAiMIRA is also mirrored to Github if you wish to collaborate on development and can be found at: https://github.com/CERN/cara
CAiMIRA is also mirrored to Github if you wish to collaborate on development and can be found at: https://github.com/CERN/caimira
### Installing CAiMIRA in editable mode
@ -97,19 +97,19 @@ pip install -e . # At the root of the repository
### Running the COVID calculator app in development mode
```
python -m cara.apps.calculator
python -m caimira.apps.calculator
```
To run with the CERN theme:
```
python -m cara.apps.calculator --theme=cara/apps/templates/cern
python -m caimira.apps.calculator --theme=caimira/apps/templates/cern
```
To run the calculator on a different URL path:
```
python -m cara.apps.calculator --prefix=/mycalc
python -m caimira.apps.calculator --prefix=/mycalc
```
### How to compile and read the documentation
@ -120,15 +120,15 @@ In order to generate the documentation, CAiMIRA must be installed first with the
pip install -e .[doc]
```
To generate the HTML documentation page, the command `make html` should be executed in the `cara/docs` directory.
If any of the `.rst` files under the `cara/docs` folder is changed, this command should be executed again.
To generate the HTML documentation page, the command `make html` should be executed in the `caimira/docs` directory.
If any of the `.rst` files under the `caimira/docs` folder is changed, this command should be executed again.
Then, right click on `cara/docs/_build/html/index.html` and select `Open with` your preferred web browser.
Then, right click on `caimira/docs/_build/html/index.html` and select `Open with` your preferred web browser.
### Running the CAiMIRA Expert-App app in development mode
```
voila cara/apps/expert/cara.ipynb --port=8080
voila caimira/apps/expert/caimira.ipynb --port=8080
```
Then visit http://localhost:8080.
@ -138,7 +138,7 @@ Then visit http://localhost:8080.
```
pip install -e .[test]
pytest ./cara
pytest ./caimira
```
### Building the whole environment for local development
@ -175,7 +175,7 @@ Then visit http://localhost:8080/.
### Setting up the application on openshift
The https://cern.ch/cara application is running on CERN's OpenShift platform. In order to set it up for the first time, we followed the documentation at https://cern.service-now.com/service-portal?id=kb_article&n=KB0004498. In particular we:
The https://cern.ch/caimira application is running on CERN's OpenShift platform. In order to set it up for the first time, we followed the documentation at https://cern.service-now.com/service-portal?id=kb_article&n=KB0004498. In particular we:
* Added the OpenShift application deploy key to the GitLab repository
* Created a Python 3.6 (the highest possible at the time of writing) application in OpenShift
@ -183,7 +183,7 @@ The https://cern.ch/cara application is running on CERN's OpenShift platform. In
### Updating the caimira-test.web.cern.ch instance
We have a replica of https://cara.web.cern.ch running on http://caimira-test.web.cern.ch. Its purpose is to simulate what will happen when
We have a replica of https://caimira.web.cern.ch running on http://caimira-test.web.cern.ch. Its purpose is to simulate what will happen when
a feature is merged. To push your changes to caimira-test, simply push your branch to `live/caimira-test` and the CI pipeline will trigger the
deployment. To push to this branch, there is a good chance that you will need to force push - you should always force push with care and
understanding why you are doing it. Syntactically, it will look something like (assuming that you have "upstream" as your remote name,

View file

@ -9,7 +9,7 @@ RUN apt-get update && apt-get install -y nginx
# Now that we have done the installation of the dependencies, copy the caimira source.
COPY ./ /opt/caimira/src
COPY ./app-config/caimira-public-docker-image/run_cara.sh /opt/caimira/start.sh
COPY ./app-config/caimira-public-docker-image/run_caimira.sh /opt/caimira/start.sh
# To ensure that we have installed the full requirements, re-run the pip install.
# In the best case this will be a no-op.

View file

@ -37,7 +37,7 @@ http {
listen 8080 default_server;
listen [::]:8080 default_server;
server_name _;
root /opt/cara/src;
root /opt/caimira/src;
# Load configuration files for the default server block.
include /opt/app-root/etc/nginx.default.d/*.conf;

View file

@ -1,16 +1,16 @@
echo 'CARA is running on http://localhost:8080'
echo 'CAiMIRA is running on http://localhost:8080'
echo 'Please see https://gitlab.cern.ch/cara/cara for terms of use.'
# Run a proxy for the apps (listening on 8080).
nginx -c /opt/cara/nginx.conf
nginx -c /opt/caimira/nginx.conf
# Run the expert app in the background.
cd /opt/cara/src/cara
/opt/cara/app/bin/python -m voila /opt/cara/src/cara/apps/expert/cara.ipynb \
cd /opt/caimira/src/caimira
/opt/caimira/app/bin/python -m voila /opt/caimira/src/caimira/apps/expert/caimira.ipynb \
--port=8082 --no-browser --base_url=/voila-server/ \
--Voila.tornado_settings 'allow_origin=*' \
>> /var/log/expert-app.log 2>&1 &
# Run the calculator in the foreground.
/opt/cara/app/bin/python -m cara.apps.calculator --port 8081 --no-debug
/opt/caimira/app/bin/python -m caimira.apps.calculator --port 8081 --no-debug

View file

@ -29,7 +29,7 @@ RUN mkdir -p /scratch \
# Set the HOME directory to something that anybody can write to (to support non root users, such as on openshift).
ENV HOME=/scratch
WORKDIR /scratch
RUN CAIMIRA_INIT_FILE=$(/opt/app/bin/python -c "import cara; print(cara.__file__)") \
RUN CAIMIRA_INIT_FILE=$(/opt/app/bin/python -c "import caimira; print(caimira.__file__)") \
&& ln -s $(dirname ${CAIMIRA_INIT_FILE}) /scratch/caimira
CMD [ \
"caimira-app.sh" \

View file

@ -14,11 +14,11 @@ if [[ "$APP_NAME" == "caimira-webservice" ]]; then
args+=("--prefix=${CAIMIRA_CALCULATOR_PREFIX}")
fi
echo "Starting the caimira webservice with: python -m cara.apps.calculator ${args[@]}"
python -m cara.apps.calculator "${args[@]}"
echo "Starting the caimira webservice with: python -m caimira.apps.calculator ${args[@]}"
python -m caimira.apps.calculator "${args[@]}"
elif [[ "$APP_NAME" == "caimira-voila" ]]; then
echo "Starting the voila service"
voila cara/apps/expert/ --port=8080 --no-browser --base_url=/voila-server/ --tornado_settings 'allow_origin=*'
voila caimira/apps/expert/ --port=8080 --no-browser --base_url=/voila-server/ --tornado_settings 'allow_origin=*'
else
echo "No APP_NAME specified"
exit 1

View file

@ -12,7 +12,7 @@ services:
- COOKIE_SECRET
- APP_NAME=caimira-webservice
- CAIMIRA_CALCULATOR_PREFIX=/calculator-cern
- CAIMIRA_THEME=cara/apps/templates/cern
- CAIMIRA_THEME=caimira/apps/templates/cern
user: ${CURRENT_UID}
caimira-calculator-open:

View file

@ -208,7 +208,7 @@
- name: CAIMIRA_CALCULATOR_PREFIX
value: /calculator-cern
- name: CAIMIRA_THEME
value: cara/apps/templates/cern
value: caimira/apps/templates/cern
image: '${PROJECT_NAME}/caimira-webservice'
ports:
- containerPort: 8080

View file

@ -1,7 +1,7 @@
# This module is part of CARA. Please see the repository at
# This module is part of CAiMIRA. Please see the repository at
# https://gitlab.cern.ch/cara/cara for details of the license and terms of use.
"""
Documentation for the CARA package
Documentation for the CAiMIRA package
"""

View file

@ -1,4 +1,4 @@
# This module is part of CARA. Please see the repository at
# This module is part of CAiMIRA. Please see the repository at
# https://gitlab.cern.ch/cara/cara for details of the license and terms of use.
import asyncio
@ -31,7 +31,7 @@ from .user import AuthenticatedUser, AnonymousUser
# Effectively, if the model increases its MAJOR version then so too should this
# calculator version. If the calculator needs to make breaking changes (e.g. change
# form attributes) then it can also increase its MAJOR version without needing to
# increase the overall CARA version (found at ``cara.__version__``).
# increase the overall CAiMIRA version (found at ``caimira.__version__``).
__version__ = "4.2"
@ -40,7 +40,7 @@ class BaseRequestHandler(RequestHandler):
"""Called at the beginning of a request before `get`/`post`/etc."""
# Read the secure cookie which exists if we are in an authenticated
# context (though not if the cara webservice is running standalone).
# context (though not if the caimira webservice is running standalone).
session = json.loads(self.get_secure_cookie('session') or 'null')
if session:
@ -60,7 +60,7 @@ class BaseRequestHandler(RequestHandler):
contents = (
f'Unfortunately an error occurred when processing your request. '
f'Please let us know about this issue with as much detail as possible at '
f'<a href="mailto:CARA-dev@cern.ch">CARA-dev@cern.ch</a>, reporting status '
f'<a href="mailto:CAiMIRA-dev@cern.ch">CAiMIRA-dev@cern.ch</a>, reporting status '
f'code {status_code}, the error id of "{error_id}" and the time of the '
f'request ({datetime.datetime.utcnow()}).<br><br><br><br>'
)
@ -269,9 +269,9 @@ def make_app(
(calculator_prefix + r'/static/(.*)', StaticFileHandler, {'path': calculator_static_dir}),
]
cara_templates = Path(__file__).parent.parent / "templates"
caimira_templates = Path(__file__).parent.parent / "templates"
calculator_templates = Path(__file__).parent / "templates"
templates_directories = [cara_templates, calculator_templates]
templates_directories = [caimira_templates, calculator_templates]
if theme_dir:
templates_directories.insert(0, theme_dir)
loader = jinja2.FileSystemLoader([str(path) for path in templates_directories])

View file

@ -8,13 +8,13 @@ import json
import numpy as np
from cara import models
from cara import data
import cara.data.weather
import cara.monte_carlo as mc
from caimira import models
from caimira import data
import caimira.data.weather
import caimira.monte_carlo as mc
from .. import calculator
from cara.monte_carlo.data import activity_distributions, virus_distributions, mask_distributions, short_range_distances
from cara.monte_carlo.data import expiration_distribution, expiration_BLO_factors, expiration_distributions, short_range_expiration_distributions
from caimira.monte_carlo.data import activity_distributions, virus_distributions, mask_distributions, short_range_distances
from caimira.monte_carlo.data import expiration_distribution, expiration_BLO_factors, expiration_distributions, short_range_expiration_distributions
LOG = logging.getLogger(__name__)
@ -330,7 +330,7 @@ class FormData:
"""
month = MONTH_NAMES.index(self.event_month) + 1
timezone = cara.data.weather.timezone_at(
timezone = caimira.data.weather.timezone_at(
latitude=self.location_latitude, longitude=self.location_longitude,
)
# We choose the first of the month for the current year.
@ -351,7 +351,7 @@ class FormData:
month = MONTH_NAMES.index(self.event_month) + 1
wx_station = self.nearest_weather_station()
temp_profile = cara.data.weather.mean_hourly_temperatures(wx_station[0], month)
temp_profile = caimira.data.weather.mean_hourly_temperatures(wx_station[0], month)
_, utc_offset = self.tz_name_and_utc_offset()
@ -359,7 +359,7 @@ class FormData:
# result the first data value may no longer be a midnight, and the hours
# no longer ordered modulo 24).
source_times = np.arange(24) + utc_offset
times, temp_profile = cara.data.weather.refine_hourly_data(
times, temp_profile = caimira.data.weather.refine_hourly_data(
source_times,
temp_profile,
npts=24*10, # 10 steps per hour => 6 min steps
@ -418,9 +418,9 @@ class FormData:
else:
return models.MultipleVentilation((ventilation, infiltration_ventilation))
def nearest_weather_station(self) -> cara.data.weather.WxStationRecordType:
def nearest_weather_station(self) -> caimira.data.weather.WxStationRecordType:
"""Return the nearest weather station (which has valid data) for this form"""
return cara.data.weather.nearest_wx_station(
return caimira.data.weather.nearest_wx_station(
longitude=self.location_longitude, latitude=self.location_latitude
)

View file

@ -11,8 +11,8 @@ import zlib
import jinja2
import numpy as np
from cara import models
from cara.apps.calculator import markdown_tools
from caimira import models
from caimira.apps.calculator import markdown_tools
from ... import monte_carlo as mc
from .model_generator import FormData, _DEFAULT_MC_SAMPLE_SIZE
from ... import dataclass_utils

View file

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View file

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

View file

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 8.5 KiB

View file

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

View file

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 8.5 KiB

View file

Before

Width:  |  Height:  |  Size: 115 KiB

After

Width:  |  Height:  |  Size: 115 KiB

View file

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

View file

@ -11,7 +11,7 @@ import matplotlib.patches as patches
from matplotlib import pyplot as plt
import numpy as np
from cara import data, models, state
from caimira import data, models, state
def collapsible(widgets_to_collapse: typing.List, title: str, start_collapsed=False):
@ -850,7 +850,7 @@ baseline_model = models.ExposureModel(
)
class CARAStateBuilder(state.StateBuilder):
class CAIMIRAStateBuilder(state.StateBuilder):
# Note: The methods in this class must correspond to the *type* of the data classes.
# For example, build_type__VentilationBase is called when dealing with ConcentrationModel
# types as it has a ventilation: _VentilationBase field.
@ -928,7 +928,7 @@ class ExpertApplication(Controller):
def build_new_model(self) -> state.DataclassInstanceState[models.ExposureModel]:
default_model = state.DataclassInstanceState(
models.ExposureModel,
state_builder=CARAStateBuilder(),
state_builder=CAIMIRAStateBuilder(),
)
default_model.dcs_update_from(baseline_model)
# For the time-being, we have to initialise the select states. Careful

View file

@ -7,7 +7,7 @@
"<div style=\"text-align: center;\" align=\"center\" >\n",
"<img src=\"./files/static/images/header_image.png\" style=\"height:5em\"></img></div>\n",
"<p style=\"text-align: center;\">\n",
"Please see the <a href=\"https://cara.web.cern.ch/\">CAiMIRA homepage</a> for details on the methodology, assumptions and limitations of CAiMIRA.</p>"
"Please see the <a href=\"https://caimira.web.cern.ch/\">CAiMIRA homepage</a> for details on the methodology, assumptions and limitations of CAiMIRA.</p>"
]
},
{
@ -21,9 +21,9 @@
},
"outputs": [],
"source": [
"import cara.apps\n",
"import caimira.apps\n",
"\n",
"app = cara.apps.ExpertApplication()\n",
"app = caimira.apps.ExpertApplication()\n",
"app.widget"
]
}

View file

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 41 KiB

View file

@ -92,7 +92,7 @@ body {
height: 10em;
}
.cara_home_image {
.caimira_home_image {
height: 18rem;
padding: 1rem;
border-radius: 1.25rem!important;
@ -258,11 +258,11 @@ footer img {
font-size:1rem;
font-weight:bold;
}
.cara_version {
.caimira_version {
float:left;
font-size:1rem;
}
.cara_home_image {
.caimira_home_image {
float: right;
}
@ -314,7 +314,7 @@ footer img {
font-size:.75rem;
font-weight:bold;
}
.cara_version {
.caimira_version {
float:left;
font-size:.75rem;
}

View file

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View file

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

Before

Width:  |  Height:  |  Size: 954 KiB

After

Width:  |  Height:  |  Size: 954 KiB

View file

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View file

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 41 KiB

View file

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View file

Before

Width:  |  Height:  |  Size: 88 KiB

After

Width:  |  Height:  |  Size: 88 KiB

View file

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View file

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View file

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View file

Before

Width:  |  Height:  |  Size: 264 KiB

After

Width:  |  Height:  |  Size: 264 KiB

View file

@ -18,7 +18,7 @@ if (document.location.hostname == "caimira-test.web.cern.ch") {
g.src = u + "piwik.js";
s.parentNode.insertBefore(g, s);
})();
} else if (document.location.hostname == "cara.web.cern.ch") {
} else if (document.location.hostname == "caimira.web.cern.ch") {
var _paq = _paq || [];
if (typeof AuthUserDomain !== 'undefined') {
_paq.push(["setCustomVariable", 1, "AuthUserDomain", AuthUserDomain, "visit"]);

View file

@ -18,7 +18,7 @@
{% block main %}
<span class="cara_version">v{{ calculator_version }}</span>
<span class="caimira_version">v{{ calculator_version }}</span>
<span class="feedback">Please send feedback to <a href="mailto:CAiMIRA-dev@cern.ch">CAiMIRA-dev@cern.ch</a></span>
<header class= "bg-light">
<div class="container container--padding">

View file

@ -46,8 +46,8 @@
<hr width="95%">
</div>
{% block cara_at_cern %}
{% endblock cara_at_cern %}
{% block caimira_at_cern %}
{% endblock caimira_at_cern %}
<br>
<div>

View file

@ -1,6 +1,6 @@
{% extends "base/index.html.j2" %}
{% block cara_at_cern %}
{% block caimira_at_cern %}
<h2 class="paragraph-title">CAiMIRA @ CERN</h2><br>
<div>
<p>
@ -8,4 +8,4 @@
A hosted <a href="{{ calculator_prefix }}">CERN version of the CAiMIRA Covid Calculator</a> is available on this site to members of the CERN personnel.
</p>
</div>
{% endblock cara_at_cern %}
{% endblock caimira_at_cern %}

View file

@ -1,6 +1,6 @@
import numpy as np
from cara import models
from cara.data.weather import wx_data, nearest_wx_station
from caimira import models
from caimira.data.weather import wx_data, nearest_wx_station
MONTH_NAMES = [
'January', 'February', 'March', 'April', 'May', 'June', 'July',

View file

Before

Width:  |  Height:  |  Size: 690 KiB

After

Width:  |  Height:  |  Size: 690 KiB

View file

@ -17,7 +17,7 @@ sys.path.insert(0, os.path.abspath('..'))
# -- Project information -----------------------------------------------------
project = 'CARA'
project = 'CAiMIRA'
copyright = '2022, Andre Henriques et al.'
author = 'Andre Henriques et al.'

View file

@ -1,9 +1,9 @@
.. CARA documentation master file, created by
.. CAiMIRA documentation master file, created by
sphinx-quickstart on Fri Apr 8 10:26:24 2022.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to CARA's documentation!
Welcome to CAiMIRA's documentation!
================================
.. toctree::
@ -11,7 +11,7 @@ Welcome to CARA's documentation!
:caption: Contents:
full_diameter_dependence
cara
caimira
Indices and tables

View file

@ -1,9 +1,9 @@
# This module is part of CARA. Please see the repository at
# This module is part of CAiMIRA. Please see the repository at
# https://gitlab.cern.ch/cara/cara for details of the license and terms of use.
"""
This module implements the core CARA models.
This module implements the core CAiMIRA models.
The CARA model is a flexible, object-oriented numerical model. It is designed
The CAiMIRA model is a flexible, object-oriented numerical model. It is designed
to allow the user to swap-out and extend its various components. One of the
major abstractions of the model is the distinction between virus concentration
(:class:`ConcentrationModel`) and virus exposure (:class:`ExposureModel`).
@ -15,10 +15,10 @@ deterministic (i.e. running the same model twice will result in the same answer)
In order to apply stochastic / non-deterministic analyses therefore you must
introduce the randomness before constructing the models themselves; the
:mod:`cara.monte_carlo` module is a good example of doing this - that module uses
:mod:`caimira.monte_carlo` module is a good example of doing this - that module uses
the models defined here to allow you to construct a ConcentrationModel containing
parameters which are expressed as probability distributions. Under the hood the
``cara.monte_carlo.ConcentrationModel`` implementation simply samples all of those
``caimira.monte_carlo.ConcentrationModel`` implementation simply samples all of those
probability distributions to produce many instances of the deterministic model.
The models in this module have been designed for flexibility above performance,

View file

@ -5,8 +5,8 @@ import numpy as np
from scipy import special as sp
from scipy.stats import weibull_min
import cara.monte_carlo as mc
from cara.monte_carlo.sampleable import LogCustom, LogNormal,LogCustomKernel,CustomKernel,Uniform, Custom
import caimira.monte_carlo as mc
from caimira.monte_carlo.sampleable import LogCustom, LogNormal,LogCustomKernel,CustomKernel,Uniform, Custom
sqrt2pi = np.sqrt(2.*np.pi)
sqrt2 = np.sqrt(2.)

View file

@ -3,7 +3,7 @@ import dataclasses
import sys
import typing
import cara.models
import caimira.models
from .sampleable import SampleableDistribution, _VectorisedFloatOrSampleable
@ -14,9 +14,9 @@ class MCModelBase(typing.Generic[_ModelType]):
"""
A model base class for monte carlo types.
This base class is essentially a declarative description of a cara.models
This base class is essentially a declarative description of a caimira.models
model with a :meth:`.build_model` method to generate an appropriate
``cara.models` model instance on demand.
``caimira.models` model instance on demand.
"""
_base_cls: typing.Type[_ModelType]
@ -36,7 +36,7 @@ class MCModelBase(typing.Generic[_ModelType]):
def build_model(self, size: int) -> _ModelType:
"""
Turn this MCModelBase subclass into a cara.model Model instance
Turn this MCModelBase subclass into a caimira.model Model instance
from which you can then run the model.
"""
@ -49,7 +49,7 @@ class MCModelBase(typing.Generic[_ModelType]):
def _build_mc_model(model: _ModelType) -> typing.Type[MCModelBase[_ModelType]]:
"""
Generate a new MCModelBase subclass for the given cara.models model.
Generate a new MCModelBase subclass for the given caimira.models model.
"""
fields = []
@ -57,7 +57,7 @@ def _build_mc_model(model: _ModelType) -> typing.Type[MCModelBase[_ModelType]]:
# Note: deepcopy not needed here as we aren't mutating entities beyond
# the top level.
new_field = copy.copy(field)
if field.type is cara.models._VectorisedFloat: # noqa
if field.type is caimira.models._VectorisedFloat: # noqa
new_field.type = _VectorisedFloatOrSampleable # type: ignore
field_type: typing.Any = new_field.type
@ -65,29 +65,29 @@ def _build_mc_model(model: _ModelType) -> typing.Type[MCModelBase[_ModelType]]:
if getattr(field_type, '__origin__', None) in [typing.Union, typing.Tuple]:
# It is challenging to generalise this code, so we provide specific transformations,
# and raise for unforseen cases.
if new_field.type == typing.Tuple[cara.models._VentilationBase, ...]:
if new_field.type == typing.Tuple[caimira.models._VentilationBase, ...]:
VB = getattr(sys.modules[__name__], "_VentilationBase")
field_type = typing.Tuple[typing.Union[cara.models._VentilationBase, VB], ...]
elif new_field.type == typing.Tuple[cara.models._ExpirationBase, ...]:
field_type = typing.Tuple[typing.Union[caimira.models._VentilationBase, VB], ...]
elif new_field.type == typing.Tuple[caimira.models._ExpirationBase, ...]:
EB = getattr(sys.modules[__name__], "_ExpirationBase")
field_type = typing.Tuple[typing.Union[cara.models._ExpirationBase, EB], ...]
elif new_field.type == typing.Tuple[cara.models.SpecificInterval, ...]:
field_type = typing.Tuple[typing.Union[caimira.models._ExpirationBase, EB], ...]
elif new_field.type == typing.Tuple[caimira.models.SpecificInterval, ...]:
SI = getattr(sys.modules[__name__], "SpecificInterval")
field_type = typing.Tuple[typing.Union[cara.models.SpecificInterval, SI], ...]
field_type = typing.Tuple[typing.Union[caimira.models.SpecificInterval, SI], ...]
else:
# Check that we don't need to do anything with this type.
for item in new_field.type.__args__:
if getattr(item, '__module__', None) == 'cara.models':
if getattr(item, '__module__', None) == 'caimira.models':
raise ValueError(
f"unsupported type annotation transformation required for {new_field.type}")
elif field_type.__module__ == 'cara.models':
elif field_type.__module__ == 'caimira.models':
mc_model = getattr(sys.modules[__name__], new_field.type.__name__)
field_type = typing.Union[new_field.type, mc_model]
fields.append((new_field.name, field_type, new_field))
bases = []
# Update the inheritance/based to use the new MC classes, rather than the cara.models ones.
# Update the inheritance/based to use the new MC classes, rather than the caimira.models ones.
for model_base in model.__bases__: # type: ignore
if model_base is object:
bases.append(MCModelBase)
@ -111,7 +111,7 @@ def _build_mc_model(model: _ModelType) -> typing.Type[MCModelBase[_ModelType]]:
_MODEL_CLASSES = [
cls for cls in vars(cara.models).values()
cls for cls in vars(caimira.models).values()
if dataclasses.is_dataclass(cls)
]

View file

@ -3,7 +3,7 @@ import typing
import numpy as np
from sklearn.neighbors import KernelDensity # type: ignore
import cara.models
import caimira.models
# Declare a float array type of a given size.
# There is no better way to declare this currently, unfortunately.
@ -158,5 +158,5 @@ class LogCustomKernel(SampleableDistribution):
_VectorisedFloatOrSampleable = typing.Union[
SampleableDistribution, cara.models._VectorisedFloat,
SampleableDistribution, caimira.models._VectorisedFloat,
]

View file

@ -1,6 +1,6 @@
cd Downloads
git clone https://gitlab.cern.ch/cara/cara.git
cd cara
cd caimira
if [[ `uname -m` == 'arm64' ]]; then
pip3 install scipy --index-url=https://pypi.anaconda.org/scipy-wheels-nightly/simple
pip3 install Cython
@ -8,7 +8,7 @@ if [[ `uname -m` == 'arm64' ]]; then
fi
pip3 install -e .
echo "############################################"
echo "CARA is now running at http://localhost:8080"
echo "CAiMIRA is now running at http://localhost:8080"
echo "############################################"
python3 -m cara.apps.calculator
python3 -m caimira.apps.calculator

View file

@ -1,8 +1,8 @@
git clone https://gitlab.cern.ch/cara/cara.git
cd cara
cd caimira
pip install -e .
echo "############################################"
echo "CARA is now running at http://localhost:8080"
echo "CAiMIRA is now running at http://localhost:8080"
echo "############################################"
python -m cara.apps.calculator
python -m caimira.apps.calculator

View file

@ -1,6 +1,6 @@
cd Downloads
git clone https://gitlab.cern.ch/cara/cara.git
cd cara
cd caimira
if [[ `uname -m` == 'arm64' ]]; then
pip3 install scipy --index-url=https://pypi.anaconda.org/scipy-wheels-nightly/simple
pip3 install Cython
@ -8,7 +8,7 @@ if [[ `uname -m` == 'arm64' ]]; then
fi
pip3 install -e .
echo "############################################"
echo "CARA is now running at http://localhost:8080"
echo "CAiMIRA is now running at http://localhost:8080"
echo "############################################"
python3 -m cara.apps.calculator --theme=cara/apps/templates/cern
python3 -m caimira.apps.calculator --theme=caimira/apps/templates/cern

View file

@ -1,8 +1,8 @@
git clone https://gitlab.cern.ch/cara/cara.git
cd cara
cd caimira
pip install -e .
echo "############################################"
echo "CARA is now running at http://localhost:8080"
echo "CAiMIRA is now running at http://localhost:8080"
echo "############################################"
python -m cara.apps.calculator --theme=cara/apps/templates/cern
python -m caimira.apps.calculator --theme=caimira/apps/templates/cern

View file

@ -5,7 +5,7 @@ for this purpose, but the need to define class-level attributes proved to be a
limitation that meant we could not mutate the state from one subclass to another
after the state was instantiated.
This module MUST not import other parts of cara as this would point at a
This module MUST not import other parts of caimira as this would point at a
leaky abstraction.
"""

Some files were not shown because too many files have changed in this diff Show more