我们经常谈论 Linux 被用于服务器和开发者,但它也被用于许多其他领域,包括天文学。Linux 上有很多可用的天文学工具,例如星图、星象图以及用于控制望远镜的望远镜驱动系统接口。但是,天文学家面临的一个挑战是在保持眼睛在黑暗中工作的同时使用计算机。
晚上在野外工作时,天文学家需要保护他们的夜视能力。人眼完全扩张并适应弱光水平可能需要长达 30 分钟,而在常规颜色和亮度水平下查看手机或笔记本电脑等操作可能会导致眼睛失去调节能力。这降低了在黑暗中看清物体的能力。任何人都可以理解的一个例子:如果你晚上在床上用手机看东西,然后起床去洗手间,你就知道看清路上可能存在的障碍物有多么困难。
解决方案
我想介绍一个巧妙的小脚本,以帮助您家中的天文学家保持“他们的眼睛”在黑暗中。它依赖于一个名为 xcalib 的实用程序,这是一个“用于 X.org 的小型显示器校准加载器”。可以使用您的 Linux 软件包管理器轻松安装它。
例如在 Fedora 上
$ sudo dnf info xcalib
$ sudo dnf install xcalib
或 Ubuntu 上
$ sudo apt-get install xcalib
xcalib 应用程序仅适用于 X11,因此在 Wayland 系统上不起作用。但是 Wayland 具有内置的此功能,因此您可以通过 GNOME 设置获得相同的结果。如果您使用的是 X11,xcalib 是一种更改显示器色温的简便方法。
脚本
我发现了 Jeff Jahr 于 2014 年编写的夜视滤镜脚本 Redscreen。原始脚本是用 C shell 编写的,但如今 Bash 是常见的默认 shell。事实上,我的当前 Fedora Linux 工作站上默认未安装 C shell。因此,我决定编写一个针对最新 Bash 语法的 Redscreen 脚本的更新版本,但我做了一个重大更改:使用 case 语句。
#!/usr/bin/bash
# redscreen.sh Fri Feb 28 11:36 EST 2020 Alan Formy-Duval
# Turn screen red - Useful to Astronomers
# Inspired by redscreen.csh created by Jeff Jahr 2014
# (http://www.jeffrika.com/~malakai/redscreen/index.html)
# This program is free software: you can redistribute it
# and/or modify it under the terms of the GNU General
# Public License as published by the Free Software Foundation,
# either version 3 of the License, or (at your option) any
# later version.
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for
# more details.
# You should have received a copy of the GNU General Public
# License along with this program.
# If not, see <https://gnu.ac.cn/licenses/>.
case $1 in
on)
# adjust color, gamma, brightness, contrast
xcalib -green .1 0 1 -blue .1 0 1 -red 0.5 1 40 -alter
exit 1
;;
off)
xcalib -clear
exit 1
;;
inv)
# Invert screen
xcalib -i -a
exit 1
;;
dim)
# Make the screen darker
xcalib -clear
xcalib -co 30 -alter
exit 1
;;
*)
echo "$0 [on | dim | inv | off]"
exit 1
;;
esac

许多天文程序都包含“夜间模式”功能,但并非所有程序都包含。此外,此脚本提供了一种影响整个屏幕的方法,而不仅仅是特定应用程序。这使您可以在晚上在野外使用 Linux 系统进行观星以外的其他事情——例如查看电子邮件或阅读 Opensource.com——而不会破坏您的夜视能力。
无论您是天文学家还是仅仅是业余观星者,您都可以使用 Linux 和开源软件花一整夜欣赏天空!
10 条评论