Skip to content

Commit

Permalink
Merge branch 'main' into i24-parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
noemifrisina committed Jun 21, 2023
2 parents 1d836ee + 5233f07 commit 5b79e42
Show file tree
Hide file tree
Showing 25 changed files with 1,406 additions and 9,986 deletions.
217 changes: 125 additions & 92 deletions src/mx_bluesky/I24/serial/extruder/i24ssx_Extruder_Collect_py3v2.py

Large diffs are not rendered by default.

This file was deleted.

2,079 changes: 0 additions & 2,079 deletions src/mx_bluesky/I24/serial/fixed_target/FT-gui-edm/MappingLite-bismuth2v5.edl

This file was deleted.

This file was deleted.

2,073 changes: 0 additions & 2,073 deletions src/mx_bluesky/I24/serial/fixed_target/FT-gui-edm/MappingLite-reginav5.edl

This file was deleted.

3,002 changes: 0 additions & 3,002 deletions src/mx_bluesky/I24/serial/fixed_target/FT-gui-edm/MappingLite-torontov5.edl

This file was deleted.

312 changes: 155 additions & 157 deletions src/mx_bluesky/I24/serial/fixed_target/i24ssx_Chip_Collect_py3v1.py

Large diffs are not rendered by default.

626 changes: 246 additions & 380 deletions src/mx_bluesky/I24/serial/fixed_target/i24ssx_Chip_Manager_py3v1.py

Large diffs are not rendered by default.

346 changes: 92 additions & 254 deletions src/mx_bluesky/I24/serial/fixed_target/i24ssx_Chip_Mapping_py3v1.py

Large diffs are not rendered by default.

249 changes: 137 additions & 112 deletions src/mx_bluesky/I24/serial/fixed_target/i24ssx_Chip_StartUp_py3v1.py

Large diffs are not rendered by default.

81 changes: 81 additions & 0 deletions src/mx_bluesky/I24/serial/log.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
from __future__ import annotations

import logging
import logging.config
from os import environ
from pathlib import Path
from typing import Optional

# Logging set up
logging.getLogger("I24ssx").addHandler(logging.NullHandler())

logging_config = {
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"default": {
"class": "logging.Formatter",
"format": "%(message)s",
}
},
"handlers": {
"console": {
"level": "DEBUG",
"class": "logging.StreamHandler",
"formatter": "default",
"stream": "ext://sys.stdout",
}
},
"loggers": {
"I24ssx": {
"handlers": ["console"],
"level": "DEBUG",
"propagate": True,
}
},
}

logging.config.dictConfig(logging_config)


def _get_logging_file_path() -> Path:
"""Get the path to write the artemis log files to.
If on a beamline, this will be written to the according area depending on the
BEAMLINE envrionment variable. If no envrionment variable is found it will default
it to the tmp/dev directory.
Returns:
logging_path (Path): Path to the log file for the file handler to write to.
"""
beamline: Optional[str] = environ.get("BEAMLINE")
logging_path: Path

if beamline:
logging_path = Path("/dls_sw/" + beamline + "/logs/serial/")
else:
logging_path = Path("./tmp/logs/")

Path(logging_path).mkdir(parents=True, exist_ok=True)
return logging_path


def config(logfile: str | None = None, write_mode: str = "a", delayed: bool = False):
"""
Configure the logging.
Args:
logfile (str, optional): Filename for logfile. If passed, create a file handler \
for the logger to write to file the log output. Defaults to None.
write_mode (str, optional): String indicating writing mode for the output \
.log file. Defaults to "a".
"""
logger = logging.getLogger("I24ssx")
if logfile:
logs = _get_logging_file_path() / logfile
fileFormatter = logging.Formatter(
"%(asctime)s %(levelname)s: \t%(message)s",
datefmt="%d-%m-%Y %I:%M:%S",
)
FH = logging.FileHandler(logs, mode=write_mode, encoding="utf-8", delay=delayed)
FH.setLevel(logging.DEBUG)
FH.setFormatter(fileFormatter)
logger.addHandler(FH)
22 changes: 6 additions & 16 deletions src/mx_bluesky/I24/serial/parameters/constants.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,14 @@
from enum import Enum
from pathlib import Path


class SSXType(Enum):
FIXED = "Serial Fixed"
EXTRUDER = "Serial Jet"


PARAM_FILE_PATH = "src/mx_bluesky/I24/serial/parameters/"
LITEMAP_PATH = "src/mx_bluesky/I24/serial/parameters/litemaps"
FULLMAP_PATH = "src/mx_bluesky/I24/serial/parameters/fullmaps"


PVAR_FILE_PATH = (
"/dls_sw/work/R3.14.12.3/ioc/ME14E/ME14E-MO-IOC-01/ME14E-MO-IOC-01App/scripts/"
)
"""
Just for reference, original locations:
# "/dls_sw/i24/scripts/extruder/"
# "/dls_sw/i24/scripts/fastchips/parameter_files/"
# "/dls_sw/i24/scripts/fastchips/litemaps/"
# or '/localhome/local/Documents/sacla/parameter_files/' for the last 2
# "/dls_sw/i24/scripts/fastchips/fullmaps/"
"""
PARAM_FILE_PATH = Path("src/mx_bluesky/I24/serial/parameters")
PARAM_FILE_PATH_FT = Path("src/mx_bluesky/I24/serial/parameters/fixed_target")
LITEMAP_PATH = Path("src/mx_bluesky/I24/serial/parameters/fixed_target/litemaps")
FULLMAP_PATH = Path("src/mx_bluesky/I24/serial/parameters/fixed_target/fullmaps")
PVAR_FILE_PATH = Path("src/mx_bluesky/I24/serial/parameters/pvar_files")
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

# This file give the relationship between stage motor counts pos/neg lab
# coordinate system

# April 2023 @ i24
# motor number * (dir) = positive chip direction

mtr1_dir=1
mtr2_dir=-1
mtr3_dir=-1
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Clear
P3000..3999=0
# Switch all blocks on
P3011,64,10=1
#
P3012=0.000 P3013=0.000
P3022=0.000 P3023=3.175
P3032=0.000 P3033=6.350
P3042=0.000 P3043=9.525
P3052=0.000 P3053=12.700
P3062=0.000 P3063=15.875
P3072=0.000 P3073=19.050
P3082=0.000 P3083=22.225
#
P3092=3.175 P3093=24.600
P3102=3.175 P3103=21.425
P3112=3.175 P3113=18.250
P3122=3.175 P3123=15.075
P3132=3.175 P3133=11.900
P3142=3.175 P3143=8.725
P3152=3.175 P3153=5.550
P3162=3.175 P3163=2.375
#
P3172=6.350 P3173=0.000
P3182=6.350 P3183=3.175
P3192=6.350 P3193=6.350
P3202=6.350 P3203=9.525
P3212=6.350 P3213=12.700
P3222=6.350 P3223=15.875
P3232=6.350 P3233=19.050
P3242=6.350 P3243=22.225
#
P3252=9.525 P3253=24.600
P3262=9.525 P3263=21.425
P3272=9.525 P3273=18.250
P3282=9.525 P3283=15.075
P3292=9.525 P3293=11.900
P3302=9.525 P3303=8.725
P3312=9.525 P3313=5.550
P3322=9.525 P3323=2.375
#
P3332=12.700 P3333=0.000
P3342=12.700 P3343=3.175
P3352=12.700 P3353=6.350
P3362=12.700 P3363=9.525
P3372=12.700 P3373=12.700
P3382=12.700 P3383=15.875
P3392=12.700 P3393=19.050
P3402=12.700 P3403=22.225
#
P3412=15.875 P3413=24.600
P3422=15.875 P3423=21.425
P3432=15.875 P3433=18.250
P3442=15.875 P3443=15.075
P3452=15.875 P3453=11.900
P3462=15.875 P3463=8.725
P3472=15.875 P3473=5.550
P3482=15.875 P3483=2.375
#
P3492=19.050 P3493=0.000
P3502=19.050 P3503=3.175
P3512=19.050 P3513=6.350
P3522=19.050 P3523=9.525
P3532=19.050 P3533=12.700
P3542=19.050 P3543=15.875
P3552=19.050 P3553=19.050
P3562=19.050 P3563=22.225
#
P3572=22.225 P3573=24.600
P3582=22.225 P3583=21.425
P3592=22.225 P3593=18.250
P3602=22.225 P3603=15.075
P3612=22.225 P3613=11.900
P3622=22.225 P3623=8.725
P3632=22.225 P3633=5.550
P3642=22.225 P3643=2.375
# Block direction
P3014,8,10=31
P3094,8,10=32
P3174,8,10=31
P3254,8,10=32
P3334,8,10=31
P3414,8,10=32
P3494,8,10=31
P3574,8,10=32
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Clear
P3000..3999=0
# Switch all blocks on
P3011,36,10=1
#
P3012=0.000 P3013=0.000
P3022=0.000 P3023=3.175
P3032=0.000 P3033=6.350
P3042=0.000 P3043=9.525
P3052=0.000 P3053=12.700
P3062=0.000 P3063=15.875
#
P3072=3.175 P3073=18.25
P3082=3.175 P3083=15.875
P3092=3.175 P3093=12.700
P3102=3.175 P3103=9.525
P3112=3.175 P3113=8.725
P3122=3.175 P3123=5.550

#
P3132=6.350 P3133=0.000
P3142=6.350 P3143=3.175
P3152=6.350 P3153=6.350
P3162=6.350 P3163=9.525
P3172=6.350 P3173=12.700
P3182=6.350 P3183=15.875

#
P3192=9.525 P3193=18.25
P3202=9.525 P3203=15.875
P3212=9.525 P3213=12.700
P3222=9.525 P3223=9.525
P3232=9.525 P3233=8.725
P3242=9.525 P3243=5.550
#
P3252=12.700 P3253=0.000
P3262=12.700 P3263=3.175
P3272=12.700 P3273=6.350
P3282=12.700 P3283=9.525
P3292=12.700 P3293=12.700
P3302=12.700 P3303=15.875

#
P3312=15.875 P3313=18.25
P3322=15.875 P3323=15.875
P3332=15.875 P3333=12.700
P3342=15.875 P3343=9.525
P3352=15.875 P3353=8.725
P3362=15.875 P3363=5.550

# Block direction
P3014,6,10=31
P3074,6,10=32
P3134,6,10=31
P3194,6,10=32
P3254,6,10=31
P3314,6,10=32

Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Clear
P3000..3999=0
# Switch all blocks on
P3011,64,10=1
#
P3012=0.000 P3013=0.000
P3022=0.002 P3023=3.177
P3032=0.005 P3033=6.353
P3042=0.007 P3043=9.528
P3052=0.010 P3053=12.705
P3062=0.010 P3063=15.880
P3072=0.013 P3073=19.057
P3082=0.015 P3083=22.233
#
P3092=3.195 P3093=24.612
P3102=3.192 P3103=21.435
P3112=3.190 P3113=18.258
P3122=3.190 P3123=15.080
P3132=3.187 P3133=11.905
P3142=3.187 P3143=8.730
P3152=3.183 P3153=5.555
P3162=3.180 P3163=2.380
#
P3172=6.357 P3173=0.007
P3182=6.359 P3183=3.182
P3192=6.362 P3193=6.357
P3202=6.364 P3203=9.533
P3212=6.366 P3213=12.708
P3222=6.368 P3223=15.885
P3232=6.370 P3233=19.062
P3242=6.373 P3243=22.238
#
P3252=9.552 P3253=24.617
P3262=9.550 P3263=21.440
P3272=9.548 P3273=18.262
P3282=9.546 P3283=15.087
P3292=9.545 P3293=11.911
P3302=9.542 P3303=8.735
P3312=9.542 P3313=5.560
P3322=9.538 P3323=2.384
#
P3332=12.715 P3333=0.013
P3342=12.717 P3343=3.187
P3352=12.720 P3353=6.363
P3362=12.720 P3363=9.538
P3372=12.722 P3373=12.714
P3382=12.725 P3383=15.890
P3392=12.725 P3393=19.065
P3402=12.727 P3403=22.242
#
P3412=15.908 P3413=24.620
P3422=15.905 P3423=21.441
P3432=15.903 P3433=18.266
P3442=15.900 P3443=15.091
P3452=15.901 P3453=11.915
P3462=15.898 P3463=8.740
P3472=15.898 P3473=5.562
P3482=15.896 P3483=2.387
#
P3492=19.070 P3493=0.015
P3502=19.072 P3503=3.191
P3512=19.075 P3513=6.366
P3522=19.077 P3523=9.542
P3532=19.078 P3533=12.716
P3542=19.081 P3543=15.891
P3552=19.082 P3553=19.070
P3562=19.085 P3563=22.246
#
P3572=22.262 P3573=24.624
P3582=22.262 P3583=21.443
P3592=22.259 P3593=18.270
P3602=22.259 P3603=15.095
P3612=22.257 P3613=11.917
P3622=22.256 P3623=8.743
P3632=22.254 P3633=5.567
P3642=22.252 P3643=2.394
# Block direction
P3014,8,10=31
P3094,8,10=32
P3174,8,10=31
P3254,8,10=32
P3334,8,10=31
P3414,8,10=32
P3494,8,10=31
P3574,8,10=32
Loading

0 comments on commit 5b79e42

Please sign in to comment.