planarian
This commit is contained in:
@@ -175,8 +175,8 @@ class WellPosition(models.Model):
|
||||
|
||||
|
||||
@classmethod
|
||||
def active_well(cls, multiwel, well):
|
||||
return WellPosition.objects.filter(multiwel_id=multiwel.id, well_id=well.id).first()
|
||||
def active_well(cls, multiwell, well):
|
||||
return WellPosition.objects.filter(multiwell_id=multiwell.id, well_id=well.id).first()
|
||||
|
||||
class Meta:
|
||||
ordering = ['order']
|
||||
@@ -235,7 +235,7 @@ class Experiment(models.Model):
|
||||
verbose_name_plural = _("Expériences")
|
||||
|
||||
def __str__(self):
|
||||
return f'{self.title}: {self.created} {self.multiwell.order}'
|
||||
return f'{self.id}:{self.title}-{self.created}'
|
||||
|
||||
|
||||
class Session(models.Model):
|
||||
|
||||
@@ -123,6 +123,9 @@ class MultiWellManager:
|
||||
def _grid_scanning_capture(self, uuid, duration):
|
||||
self.process.data.uuid = uuid
|
||||
self.process.data.record = True
|
||||
|
||||
# reset PlanarianTracker => on_well_change
|
||||
self.process.cam.on_well_change()
|
||||
|
||||
start = time.monotonic()
|
||||
while not self.stop_playing.is_set():
|
||||
|
||||
@@ -188,10 +188,11 @@ class ScannerProcess(Task):
|
||||
wells = models.Well.objects.all()
|
||||
for wl in wells:
|
||||
video_lists.append(str( settings.MEDIA_ROOT / 'simulation' / f'{wl.name}.mp4') )
|
||||
|
||||
|
||||
from modules.videofile_capture import VideoFileCapture
|
||||
self.cam = VideoFileCapture(
|
||||
video_file=settings.MEDIA_ROOT / 'simulation' / 'A1.mp4',
|
||||
video_file=settings.MEDIA_ROOT / 'simulation' / 'D6.mp4',
|
||||
fps=self.video_fps,
|
||||
width=self.video_width,
|
||||
height=self.video_height,
|
||||
@@ -273,17 +274,23 @@ class ScannerProcess(Task):
|
||||
if self.grbl:
|
||||
self._send(**msg)
|
||||
|
||||
def _on_frame(self, jpeg_bytes: bytes, ts: datetime, metrics: dict) -> None:
|
||||
def _on_frame(self, jpeg_bytes: bytes, ts: datetime, metrics: dict, frame_count: int = 0) -> None:
|
||||
if self.data.record:
|
||||
self.record_queue.put((self.data.uuid, ts, jpeg_bytes, metrics))
|
||||
self.record_queue.put((self.data.uuid, ts, jpeg_bytes, metrics, frame_count))
|
||||
if self.data.play:
|
||||
self._send(ts=ts.timestamp(), jpeg=base64.b64encode(jpeg_bytes).decode(), **metrics)
|
||||
|
||||
try:
|
||||
jpeg=base64.b64encode(jpeg_bytes).decode()
|
||||
logger.warning(f"{jpeg[:100]}")
|
||||
self._send(ts=ts.timestamp(), jpeg=jpeg, frame_count=frame_count)
|
||||
except Exception as e:
|
||||
logger.error(f"----_on_frame: {e}")
|
||||
|
||||
|
||||
def _recording(self):
|
||||
logger.info(f"Scanner {self.group}: start recorder")
|
||||
while not self.stop_event.is_set():
|
||||
try:
|
||||
(uuid, ts, frame, metrics) = self.record_queue.get()
|
||||
(uuid, ts, frame, metrics, frame_count) = self.record_queue.get()
|
||||
labels = dict(fps=self.video_fps, session=self.data.session, detected="1" if metrics.get("detected") else "0")
|
||||
|
||||
if metrics.get("detected"):
|
||||
|
||||
@@ -86,6 +86,7 @@ class ScannerManager {
|
||||
if (payload.state) { this.debug.insertAdjacentHTML('afterbegin', `<li>[ ${++this.debug_count} - ${payload.state} ]: ${payload.msg}</li>`); }
|
||||
if (payload.ts) { this.ts.textContent = timestampToLocalISOString(payload.ts); }
|
||||
|
||||
/*
|
||||
if (payload.detected && use_tracking) {
|
||||
this.cx.textContent = payload.cx; this.cy.textContent = payload.cy;
|
||||
this.speed_px_s.textContent = payload.speed_px_s;
|
||||
@@ -93,7 +94,8 @@ class ScannerManager {
|
||||
this.axial_pos.textContent = payload.axial_pos;
|
||||
this.area_px.textContent = payload.area_px;
|
||||
this.frame_count.textContent = payload.count;
|
||||
}
|
||||
}*/
|
||||
|
||||
if (payload.buttons) { this.well_btn.innerHTML = payload.buttons; }
|
||||
if (payload.current >= 0) {
|
||||
document.querySelectorAll('button.w3-button.well').forEach(btn => {
|
||||
|
||||
@@ -103,9 +103,13 @@
|
||||
<i class="fa-solid fa-wrench w3-text-red w3-xlarge"></i> {% trans "Calibration" %}
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
<a href="{% url 'scanner:main' %}" class="w3-bar-item w3-btn w3-hover-opacity">
|
||||
<i class="fa-solid fa-film w3-text-green w3-xlarge""></i> {% trans "Balayage multi-puits" %}
|
||||
</a>
|
||||
<a href="{% url 'planarian:experiment-list' %}" class="w3-bar-item w3-btn w3-hover-opacity">
|
||||
<i class="fa-solid fa-vials w3-text-lime w3-xlarge"></i> {% trans "Préparation des expériences" %}
|
||||
</a>
|
||||
<a href="{% url 'scanner:images' %}" class="w3-bar-item w3-btn w3-hover-opacity">
|
||||
<i class="fa-regular fa-images w3-text-cyan w3-xlarge" w3-xlarge""></i> {% trans "Gestionnaire d'images" %}
|
||||
</a>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
<div class="w3-row">
|
||||
{% if conf.tracking %}
|
||||
<div class="w3-col w3-small" style="width:180px">
|
||||
{#% if conf.tracking %#}
|
||||
<!--div class="w3-col w3-small" style="width:180px">
|
||||
<div>Num: <span id="_count"></span></div>
|
||||
<div>Aire: <span id="_area_px"></span></div>
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
<div>V: <span id="_speed_px_s"></span> px/s</div>
|
||||
<div>V.Ax: <span id="_axial_speed"></span> px/s</div>
|
||||
<div>Ax pos: <span id="_axial_pos"></span></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div-->
|
||||
{#% endif %#}
|
||||
<div class="w3-rest">
|
||||
<img id="scan-img" class="w3-image">
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user