Skip to content

Commit a1cec30

Browse files
committed
removed some extra logs
1 parent 8491643 commit a1cec30

File tree

3 files changed

+11
-22
lines changed

3 files changed

+11
-22
lines changed

src/dt4acc/core/views/shared_view.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ def get_view_instance():
2424
from ...custom_tango.views.result_view import ResultView
2525
# For Tango, prefix must be in format: server_name/instance_name
2626
# Check for TANGO_SERVER_NAME and TANGO_INSTANCE_NAME env vars first
27+
# waheed ! only one changes need be adjusted wiht epics and env variables
28+
# i have set the server name and instance name in the tango_server.py file please check it if not feasible you can change it and let me know
2729
server_name = os.environ.get("TANGO_SERVER_NAME", "SimpleTangoServer")
2830
instance_name = os.environ.get("TANGO_INSTANCE_NAME", "test")
2931
prefix = f"{server_name}/{instance_name}"

src/dt4acc/custom_tango/views/calculation_result_view.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ async def update_twiss_pv(pv_name, twiss_result):
4040

4141
# logger.warning(f"Updating twiss values {tune_x, tune_y}")
4242
try:
43-
# todo: use translation service to provide the calc
43+
# todo: use translation service to provide the calc may be i will ask waheed on this
4444
from .create_or_update_pv import update_twiss_pv as _update_twiss_pv
4545
await _update_twiss_pv(pv_name, twiss_result)
4646
logger.debug("Updated twiss values")
@@ -55,7 +55,7 @@ def __init__(self, *, prefix):
5555

5656
async def push_value(self, elm_update: ElementUpdate):
5757
if elm_update.property_name == "K":
58-
# to create a future
58+
5959
await asyncio.sleep(0.0)
6060
else:
6161
property_name = 'x:set' if 'x' in elm_update.property_name else (
@@ -68,10 +68,10 @@ async def push_orbit(self, orbit_result: Orbit):
6868
logger.warning(
6969
f"{self.__class__.__name__} Orbit pushing view orbit result is none ? {orbit_result is None}")
7070

71-
# Define the device name for Tango (prefix is already server_name/instance_name)
71+
# Define the device name for Tango (prefix is already server_name/instance_name) becuase already defined in the prefix and during the initialization of the view
7272
device_name = f"{self.prefix}/twiss_orbit_device"
7373

74-
# Use the new function to update the structured Orbit PV
74+
7575
try:
7676
await update_orbit_pv(device_name, orbit_result)
7777
except Exception as exc:
@@ -81,13 +81,11 @@ async def push_orbit(self, orbit_result: Orbit):
8181
logger.info('Orbit pushed view')
8282

8383
async def push_twiss(self, twiss_result: TwissWithAggregatedKValues):
84-
# logger.warning('Twiss pushing view')
85-
86-
# Define the device name for Tango (prefix is already server_name/instance_name)
84+
8785
device_name = f"{self.prefix}/twiss_orbit_device"
8886

8987
if twiss_result is None:
9088
return
91-
# Use the bulk update function to update the structured PV
89+
9290
await update_twiss_pv(device_name, twiss_result)
9391
logger.info('Twiss pushed view')

src/dt4acc/custom_tango/views/repeated_publishing_view.py

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ async def push(self, data):
6565
# Note: count attribute is READ_ONLY, so we only write bdata
6666
bdata_attr_name = f"{special_pvs['bpm_pv']}/bdata"
6767

68-
# Clean data and ensure proper format
68+
6969
if isinstance(data, np.ndarray):
7070
# Clean NaN/INF values and convert to int16
7171
data_clean = np.nan_to_num(data, nan=-2**15+1, posinf=-2**15+1, neginf=-2**15+1)
@@ -94,7 +94,6 @@ async def push(self, data):
9494
return
9595

9696
try:
97-
prefix = f"{self.prefix}:ORBITCC"
9897
# Todo: check that the dimensions are properly made
9998
# Extract x and y positions
10099
x_positions = data.loc[:, "x"].fillna(0.0).values # Replace NaN with 0.0
@@ -142,13 +141,7 @@ async def push(self, data: TuneData):
142141
tune_x = float(data.x)
143142
tune_y = float(data.y)
144143

145-
# currently adding very small noise to get data republished
146-
# need to check softioc what its records can do
147-
tune_x += np.random.uniform(-1e-12, 1e-12)
148-
tune_y += np.random.uniform(-1e-12, 1e-12)
149-
150144
try:
151-
prefix = f"{self.prefix}:TUNECC"
152145
device_name = f"{self.prefix}/tune_device"
153146
device = DeviceProxy(device_name)
154147

@@ -160,11 +153,7 @@ async def push(self, data: TuneData):
160153
None,
161154
lambda: device.write_attribute("y", tune_y)
162155
)
163-
#await asyncio.get_event_loop().run_in_executor(
164-
# None,
165-
# lambda: device.write_attribute(f"{prefix}:count", int(next(self.counter)))
166-
#)
167-
# Todo: check that the dimensions are properly made
156+
168157
except Exception as e:
169158
logger.error(f"Error processing tune object data: {e}")
170159

@@ -180,7 +169,7 @@ def __init__(self, *, prefix):
180169
self.legacy_bpm_publisher.set_data(tmp)
181170
self.orbit_object_publisher = PeriodicPublisher(view=OrbitView(prefix=prefix), name="orbit")
182171
self.tune_publisher = PeriodicPublisher(view=TuneView(prefix=prefix), name="tune")
183-
# todo: fix this design flaw
172+
184173
self.bpm_mimicry = None
185174
self.bpm_filter = ExtractBPMFromOrbitFilter()
186175

0 commit comments

Comments
 (0)