Commit bc5089a056480d3ba57bdd63112127de8b2aebe2

Authored by Alain Klotz
1 parent 41f9ef6a
Exists in dev

Cosmetic finalization of the agent ImgProcessor.

Showing 1 changed file with 10 additions and 12 deletions   Show diff stats
src/core/pyros_django/img_process/A_ImgProcessor.py
@@ -432,7 +432,6 @@ class A_ImgProcessor(Agent): @@ -432,7 +432,6 @@ class A_ImgProcessor(Agent):
432 log.info("\n" + "="*70 + f"\n=== End process an image for L0->L1\n" + "="*70 + "\n") 432 log.info("\n" + "="*70 + f"\n=== End process an image for L0->L1\n" + "="*70 + "\n")
433 return None 433 return None
434 434
435 -  
436 # - Get datedict from DATE-OBS of img 435 # - Get datedict from DATE-OBS of img
437 date_obs = self._ima.getkwd("DATE-OBS") 436 date_obs = self._ima.getkwd("DATE-OBS")
438 log.info(f"DATE-OBS: {date_obs}") 437 log.info(f"DATE-OBS: {date_obs}")
@@ -471,14 +470,14 @@ class A_ImgProcessor(Agent): @@ -471,14 +470,14 @@ class A_ImgProcessor(Agent):
471 log.info("\n" + "-"*60 + f"\n--- Cosmetic correction\n" + "-"*60 + "\n") 470 log.info("\n" + "-"*60 + f"\n--- Cosmetic correction\n" + "-"*60 + "\n")
472 self.cosmetic_correction() 471 self.cosmetic_correction()
473 472
474 - # - Save the L1a file name 473 + # - Prepare the L1a file name
475 self._ima.fcontext = "img_L1a" 474 self._ima.fcontext = "img_L1a"
476 param_img['ftype'] = 'L1A' 475 param_img['ftype'] = 'L1A'
477 - fname = self._ima.naming_set(param_img) 476 + #fname = self._ima.naming_set(param_img)
  477 + #fname = self._ima.join(fname)
478 478
479 - fname = self._ima.join(fname) 479 + # - Save and fill the database infos of the table images
480 image_db.set_attribute_and_save(img_obj=self._ima, plan_id=image_db.plan.id) 480 image_db.set_attribute_and_save(img_obj=self._ima, plan_id=image_db.plan.id)
481 - #self._ima.save(fname)  
482 481
483 if param_img['ftype'] == "L1A" or param_img['ftype'] == "L1B": 482 if param_img['ftype'] == "L1A" or param_img['ftype'] == "L1B":
484 483
@@ -486,13 +485,14 @@ class A_ImgProcessor(Agent): @@ -486,13 +485,14 @@ class A_ImgProcessor(Agent):
486 log.info("\n" + "-"*60 + f"\n--- WCS calibration\n" + "-"*60 + "\n") 485 log.info("\n" + "-"*60 + f"\n--- WCS calibration\n" + "-"*60 + "\n")
487 nmatched = self.wcs_calibration() 486 nmatched = self.wcs_calibration()
488 487
489 - # - Save the L1a file name 488 + # - Prepare the L1a file name
490 self._ima.fcontext = "img_L1b" 489 self._ima.fcontext = "img_L1b"
491 param_img['ftype'] = 'L1B' 490 param_img['ftype'] = 'L1B'
492 - fname = self._ima.naming_set(param_img)  
493 - fname = self._ima.join(fname) 491 + #fname = self._ima.naming_set(param_img)
  492 + #fname = self._ima.join(fname)
  493 +
  494 + # - Save and fill the database infos of the table images
494 image_db.set_attribute_and_save(img_obj=self._ima, plan_id=image_db.plan.id) 495 image_db.set_attribute_and_save(img_obj=self._ima, plan_id=image_db.plan.id)
495 - #self._ima.save(fname)  
496 496
497 # - TODO Resampling (img_L1c) 497 # - TODO Resampling (img_L1c)
498 498
@@ -577,14 +577,13 @@ class A_ImgProcessor(Agent): @@ -577,14 +577,13 @@ class A_ImgProcessor(Agent):
577 log.info(f"{file_out=}") 577 log.info(f"{file_out=}")
578 self._ima.setkwd("FILTER", filter_symbol) 578 self._ima.setkwd("FILTER", filter_symbol)
579 579
  580 + # - Save and fill the database infos of the table images
580 try: 581 try:
581 db_image = Image() 582 db_image = Image()
582 -  
583 db_image.set_attribute_and_save(img_obj=self._ima, plan_id=plan_db.id) 583 db_image.set_attribute_and_save(img_obj=self._ima, plan_id=plan_db.id)
584 # db_image has an id assigned 584 # db_image has an id assigned
585 except Exception as e: 585 except Exception as e:
586 print(e) 586 print(e)
587 - #self._ima.save(file_out)  
588 587
589 # --- Build a bias image filled by zeros 588 # --- Build a bias image filled by zeros
590 log.info("Build a test bias") 589 log.info("Build a test bias")
@@ -734,7 +733,6 @@ class A_ImgProcessor(Agent): @@ -734,7 +733,6 @@ class A_ImgProcessor(Agent):
734 db_image.save(img_obj=self._ima) 733 db_image.save(img_obj=self._ima)
735 except Exception as e: 734 except Exception as e:
736 print(e) 735 print(e)
737 - #self._ima.save(file_out)  
738 736
739 # --- Build a bias image 737 # --- Build a bias image
740 log.info("Build a test bias") 738 log.info("Build a test bias")